Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distribute IVAN.dmg for MacOS and Fix icon for IVAN.app #525

Merged
merged 5 commits into from Feb 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,15 @@ script:
- if [[ -n "$IVAN_PLATFORM" ]]; then make install; fi
- if [[ -n "$IVAN_PLATFORM" ]]; then "../ci/$IVAN_PLATFORM/package.sh"; fi

# https://docs.travis-ci.com/user/deployment/releases
deploy:
provider: releases
api_key: $GH_API_KEY
skip_cleanup: true
file_glob: true
file: $IVAN_BUILD_DIR/$IVAN_PLATFORM/*.zip
file:
- $IVAN_BUILD_DIR/$IVAN_PLATFORM/*.zip
- $IVAN_BUILD_DIR/$IVAN_PLATFORM/*.dmg
on:
condition: '"$IVAN_PLATFORM" =~ ^(win|osx)$'
repo: Attnam/ivan
Expand Down
2 changes: 1 addition & 1 deletion Main/Source/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5167,7 +5167,7 @@ festring game::GetDataDir()
{
#ifdef UNIX
#ifdef MAC_APP
return "../Resources/ivan/";
return "../Resources/data/";
#else
return DATADIR "/ivan/";
#endif
Expand Down
6 changes: 5 additions & 1 deletion Main/Source/igraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,19 @@ void igraph::Init()
RawGraphicFileName[GR_CHARACTER]="Graphics/Char-outlined.png";
RawGraphicFileName[GR_HUMANOID]="Graphics/Humanoid-outlined.png";
}

static truth AlreadyInstalled = false;

if(!AlreadyInstalled)
{
AlreadyInstalled = true;
graphics::Init();
graphics::SetMode("IVAN " IVAN_VERSION,
#ifndef MAC_APP
festring(game::GetDataDir() + "Graphics/Icon.bmp").CStr(),
#else
NULL,
#endif
v2(ivanconfig::GetStartingWindowWidth(), ivanconfig::GetStartingWindowHeight()),
#ifndef __DJGPP__
ivanconfig::GetGraphicsScale(),
Expand Down
2 changes: 1 addition & 1 deletion ci/osx/IVAN.app/Contents/Info.plist
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>play</string>
<key>CFBundleIconFile</key>
<string>ivan</string>
<string>ivan.icns</string>
<key>CFBundleIdentifier</key>
<string>com.attnam.ivan</string>
<key>CFBundleInfoDictionaryVersion</key>
Expand Down
6 changes: 3 additions & 3 deletions ci/osx/IVAN.app/Contents/MacOS/play
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/sh

export PATH=/usr/bin:/bin:/usr/sbin:/sbin

cd "$(dirname -- "$0")"
set -e
export PATH=/usr/bin:/bin
cd -- "$(dirname -- "$0")"

if [ "$(uname -r | cut -d. -f1)" -ge 11 ]; then
export DYLD_LIBRARY_PATH=. DYLD_FRAMEWORK_PATH=.
Expand Down
Binary file modified ci/osx/IVAN.app/Contents/Resources/ivan.icns
Binary file not shown.
22 changes: 14 additions & 8 deletions ci/osx/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ BUILD_DIR="${IVAN_BUILD_DIR}/${IVAN_PLATFORM}"
FILENAME="IVAN-v${IVAN_FILE_VERSION:-000}-${IVAN_PLATFORM}"
GAME_DIR="${BUILD_DIR}/${FILENAME}"
ZIP_FILE="${BUILD_DIR}/${FILENAME}.zip"
DMG_FILE="${BUILD_DIR}/${FILENAME}.dmg"

# directory of this script
SCRIPT_DIR=$(dirname -- "$0")
Expand All @@ -34,8 +35,10 @@ DATA_DIR="${GAME_DIR}/IVAN.app/Contents"
mkdir -p "${DATA_DIR}"/{MacOS,Resources,Frameworks}
cp "${BUILD_DIR}"/bin/ivan "${DATA_DIR}/MacOS"
cp -R "${BUILD_DIR}"/docs/* "${GAME_DIR}"
cp -R "${BUILD_DIR}"/ivan "${DATA_DIR}/Resources"
cp -R "${BUILD_DIR}"/ivan "${DATA_DIR}/Resources/data"
cp -R "${SDL2DIR}"/*.framework "${DATA_DIR}/Frameworks"
ln -s /Applications "${GAME_DIR}/Applications"
echo 'Drag IVAN.app into the Applications folder.' > "${GAME_DIR}/INSTALL.txt"

BIN="${DATA_DIR}/MacOS/ivan"
install_name_tool -add_rpath @loader_path/../Frameworks "${BIN}"
Expand All @@ -53,11 +56,14 @@ cp "${libpng}" "${DATA_DIR}/Frameworks/libpng.dylib"
install_name_tool -change "${libpng}" @loader_path/../Frameworks/libpng.dylib "${BIN}"

# for a good-looking zipball
cd "${GAME_DIR}/.."
GAME_DIR=$(basename "${GAME_DIR}")
#cd "${GAME_DIR}/.."
#GAME_DIR=$(basename "${GAME_DIR}")
#if [[ -n "${IVAN_PLATFORM}" ]]; then
# zip -9 -r --symlinks "${ZIP_FILE}" "${GAME_DIR}" | grep -v Headers
#else
# zip -9 -r --symlinks "${ZIP_FILE}" "${GAME_DIR}"
#fi

if [[ -n "${IVAN_PLATFORM}" ]]; then
zip -9 -r --symlinks "${ZIP_FILE}" "${GAME_DIR}" | grep -v Headers
else
zip -9 -r --symlinks "${ZIP_FILE}" "${GAME_DIR}"
fi
# for a compact dmg file
hdiutil create -fs HFSX -fsargs '-c c=64,a=16,e=16' -format UDBZ \
-volname "${FILENAME}" -srcfolder "${GAME_DIR}" "${DMG_FILE}"
9 changes: 6 additions & 3 deletions ci/osx/requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ CACHE_DIR="${SDL2DIR}"
brew_install() {
for dep in "$@"; do
if brew list "${dep}" &>/dev/null; then
brew upgrade "${dep}" || true # error for "already installed" is so annoying
if [[ -n "${IVAN_PLATFORM}" || "${BUILD_MAC_APP}" = ON ]]; then
brew upgrade "${dep}" || true # error for "already installed" is so annoying
fi
else
brew install "${dep}"
fi
Expand All @@ -20,8 +22,8 @@ brew_install() {

install_sdl2() {
local urls=(
'https://libsdl.org/release/SDL2-2.0.8.dmg'
'https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.2.dmg'
'https://libsdl.org/release/SDL2-2.0.9.dmg'
'https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.4.dmg'
)

mkdir -p "${CACHE_DIR}"
Expand All @@ -30,6 +32,7 @@ install_sdl2() {
local tmpdir=$(mktemp -d)
pushd "${tmpdir}"

local url
for url in "${urls[@]}"; do
curl -L --fail --retry 5 -o sdl.dmg "${url}"
hdiutil mount -readonly -mountpoint sdl sdl.dmg
Expand Down