-
Notifications
You must be signed in to change notification settings - Fork 0
/
make-macosx.sh
executable file
·69 lines (56 loc) · 2.08 KB
/
make-macosx.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/sh
set -e
. ./make-vars.sh
PROJECT=${PROJECT:=${PWD##*/}}
GAME_TITLE=${GAME_TITLE:=${PROJECT}${GAME_TYPE}}
GAME_TYPE=${GAME_TYPE:=game}
GAME_ASSET=${GAME_ASSET:=${GAME_TYPE}.love}
GAME_APP=${GAME_APP:="${GAME_TITLE}.app"}
CFBundleName=${CFBundleName:=${GAME_TITLE}}
CFBundleIdentifier=${CFBundleIdentifier:=org.unknown.${PROJECT}${GAME_TYPE}}
NSHumanReadableCopyright=${NSHumanReadableCopyright:="© 2xxx unknown"}
INSTALL_NAME_TOOL=${INSTALL_NAME_TOOL:=install_name_tool}
LOVE_VERSION=${LOVE_VERSION:=11.3}
LOVE_APP=love.app
LOVE_ZIP=love-${LOVE_VERSION}-macos.zip
LOVE_URL=https://github.com/love2d/love/releases/download/${LOVE_VERSION}/${LOVE_ZIP}
LOVE_APP_INFO=game.app/Contents/Info.plist
GAME_ASSET_PATH=game.app/Contents/Resources
GAME_LIB_PATH=game.app/Contents/Frameworks
./make-game.sh
# Download and extract the Mac version of LÖVE from the LÖVE homepage
if [ ! -e ${LOVE_APP} ]
then
wget ${LOVE_URL} -O ${LOVE_ZIP}
unzip ${LOVE_ZIP} -d .
fi
# Rename love.app to SuperGame.app
cp -r ${LOVE_APP} game.app
# Modify SuperGame.app/Contents/Info.plist
#patch -p0 < love-macosx-game.patch
cp -r love-macosx/* game.app/
sed -i -e "s/myCFBundleIdentifier/${CFBundleIdentifier}/" ${LOVE_APP_INFO}
sed -i -e "s/myCFBundleName/${CFBundleName}/" ${LOVE_APP_INFO}
sed -i -e "s/myNSHumanReadableCopyright/${NSHumanReadableCopyright}/" ${LOVE_APP_INFO}
# Copy your SuperGame.love to SuperGame.app/Contents/Resources/
mkdir -p $GAME_ASSET_PATH
cp ${GAME_ASSET} ${GAME_ASSET_PATH}
# Extra libraries
getHomebrewDyLib() {
PKG_NAME=$1
PKG_VERSION=$2
PKG_OSX_VERSION=high_sierra
PKG_TAR_GZ=${PKG_NAME}-${PKG_VERSION}.${PKG_OSX_VERSION}.bottle.tar.gz
PKG_URL=https://bintray.com/homebrew/bottles/download_file?file_path=${PKG_TAR_GZ}
PKG_LIB=${PKG_NAME}/${PKG_VERSION}/lib
if [ ! -e ${PKG_LIB} ]
then
wget ${PKG_URL} -O ${PKG_TAR_GZ}
tar -zxf ${PKG_TAR_GZ} ${PKG_LIB}
fi
cp ${PKG_LIB}/*.dylib ${GAME_LIB_PATH}
}
getHomebrewDyLib game-music-emu 0.6.2
chmod +w ${GAME_LIB_PATH}/libgme.0.6.2.dylib
$INSTALL_NAME_TOOL -id @rpath/libgme.0.dylib ${GAME_LIB_PATH}/libgme.0.6.2.dylib
mv game.app "${GAME_APP}"