Subversion Repositories Games.Rick Dangerous

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 pmbaty 1
#!/bin/bash
2
 
10 pmbaty 3
MY_PATH="$(dirname "$0")"
4 pmbaty 4
APP_NAME="Rick Dangerous"
10 pmbaty 5
APP_VERSION="1.4"
4 pmbaty 6
APP_COPYRIGHT="© 2016 Pierre-Marie Baty
7
© 2002 BigOrno
8
© 1989 CORE Design
9
Artwork by Simon Phipps"
10
BUNDLE_ID="com.pmbaty.rick.rickdangerous"
11
ICON_FILE="rick.png"
12
 
10 pmbaty 13
cd "${MY_PATH}" || exit 1
4 pmbaty 14
 
10 pmbaty 15
rm -rf "${APP_NAME}.app"
4 pmbaty 16
 
17
mkdir "${APP_NAME}.app"
18
mkdir "${APP_NAME}.app/Contents"
19
mkdir "${APP_NAME}.app/Contents/MacOS"
20
mkdir "${APP_NAME}.app/Contents/Frameworks"
21
mkdir "${APP_NAME}.app/Contents/Resources"
22
 
7 pmbaty 23
cp -pPR SDL2.framework "${APP_NAME}.app/Contents/Frameworks"
24
rm -rf "${APP_NAME}.app/Contents/Frameworks/SDL2.framework/Versions/A/_CodeSignature"
25
rm -rf "${APP_NAME}.app/Contents/Frameworks/SDL2.framework/Versions/A/Headers"
26
rm -rf "${APP_NAME}.app/Contents/Frameworks/SDL2.framework/Headers"
27
rm -rf "${APP_NAME}.app/Contents/Frameworks/SDL2_image.framework"
4 pmbaty 28
 
10 pmbaty 29
# target El Capitan
30
for ARCH in x86_64 arm64; do
31
	cc -mmacosx-version-min=10.11 -arch "${ARCH}" *.c osx-sdlmain.m -ISDL2.framework/Headers -framework Foundation -framework Cocoa -F. -framework SDL2 -o "${APP_NAME}.mac-${ARCH}"
32
	if [ ! "_$?" = "_0" ]; then
33
		rm -rf "${APP_NAME}.app"
34
		exit 1
35
	fi
36
	install_name_tool -add_rpath "@loader_path/../Frameworks" "${APP_NAME}.mac-${ARCH}"
37
	if [ ! "_$?" = "_0" ]; then
38
		rm "${APP_NAME}.mac-x86_64" "${APP_NAME}.mac-arm64" 2>/dev/null
39
		rm -rf "${APP_NAME}.app"
40
		exit 1
41
	fi
42
done
43
lipo "${APP_NAME}.mac-x86_64" "${APP_NAME}.mac-arm64" -create -output "${APP_NAME}.app/Contents/MacOS/${APP_NAME}"
4 pmbaty 44
if [ ! "_$?" = "_0" ]; then
10 pmbaty 45
	rm "${APP_NAME}.mac-x86_64" "${APP_NAME}.mac-arm64"
46
	rm -rf "${APP_NAME}.app"
47
	exit 1
4 pmbaty 48
fi
10 pmbaty 49
rm "${APP_NAME}.mac-x86_64" "${APP_NAME}.mac-arm64"
4 pmbaty 50
 
51
mkdir "__${APP_NAME}.iconset"
52
sips -z 16 16     "${ICON_FILE}" --out "__${APP_NAME}.iconset/icon_16x16.png"      > /dev/null
53
sips -z 32 32     "${ICON_FILE}" --out "__${APP_NAME}.iconset/icon_16x16@2x.png"   > /dev/null
54
sips -z 32 32     "${ICON_FILE}" --out "__${APP_NAME}.iconset/icon_32x32.png"      > /dev/null
55
sips -z 64 64     "${ICON_FILE}" --out "__${APP_NAME}.iconset/icon_32x32@2x.png"   > /dev/null
56
sips -z 128 128   "${ICON_FILE}" --out "__${APP_NAME}.iconset/icon_128x128.png"    > /dev/null
57
sips -z 256 256   "${ICON_FILE}" --out "__${APP_NAME}.iconset/icon_128x128@2x.png" > /dev/null
58
sips -z 256 256   "${ICON_FILE}" --out "__${APP_NAME}.iconset/icon_256x256.png"    > /dev/null
59
sips -z 512 512   "${ICON_FILE}" --out "__${APP_NAME}.iconset/icon_256x256@2x.png" > /dev/null
60
sips -z 512 512   "${ICON_FILE}" --out "__${APP_NAME}.iconset/icon_512x512.png"    > /dev/null
61
sips -z 1024 1024 "${ICON_FILE}" --out "__${APP_NAME}.iconset/icon_512x512@2x.png" > /dev/null
62
iconutil -c icns "__${APP_NAME}.iconset"
63
if [ ! "_$?" = "_0" ]; then
64
	rm -rf "__${APP_NAME}.iconset"
65
	rm -rf "${APP_NAME}.app" 
10 pmbaty 66
	exit 1
4 pmbaty 67
fi
68
rm -rf "__${APP_NAME}.iconset"
69
mv "__${APP_NAME}.icns" "${APP_NAME}.app/Contents/Resources/${APP_NAME}.icns"
70
 
71
cp -r "../sounds" "${APP_NAME}.app/Contents/Resources"
72
 
73
echo -n "APPL???" > "${APP_NAME}.app/Contents/PkgInfo"
74
 
75
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > "${APP_NAME}.app/Contents/Info.plist"
76
echo "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">" >> "${APP_NAME}.app/Contents/Info.plist"
77
echo "<plist version=\"1.0\">" >> "${APP_NAME}.app/Contents/Info.plist"
78
echo "<dict>" >> "${APP_NAME}.app/Contents/Info.plist"
79
echo "	<key>CFBundleDevelopmentRegion</key>" >> "${APP_NAME}.app/Contents/Info.plist"
80
echo "	<string>en</string>" >> "${APP_NAME}.app/Contents/Info.plist"
81
echo "	<key>CFBundleExecutable</key>" >> "${APP_NAME}.app/Contents/Info.plist"
82
echo "	<string>${APP_NAME}</string>" >> "${APP_NAME}.app/Contents/Info.plist"
83
echo "	<key>CFBundleIconFile</key>" >> "${APP_NAME}.app/Contents/Info.plist"
84
echo "	<string>${APP_NAME}.icns</string>" >> "${APP_NAME}.app/Contents/Info.plist"
85
echo "	<key>CFBundleIdentifier</key>" >> "${APP_NAME}.app/Contents/Info.plist"
86
echo "	<string>${BUNDLE_ID}</string>" >> "${APP_NAME}.app/Contents/Info.plist"
87
echo "	<key>CFBundleInfoDictionaryVersion</key>" >> "${APP_NAME}.app/Contents/Info.plist"
88
echo "	<string>6.0</string>" >> "${APP_NAME}.app/Contents/Info.plist"
89
echo "	<key>CFBundleName</key>" >> "${APP_NAME}.app/Contents/Info.plist"
90
echo "	<string>${APP_NAME}</string>" >> "${APP_NAME}.app/Contents/Info.plist"
91
echo "	<key>CFBundleVersion</key>" >> "${APP_NAME}.app/Contents/Info.plist"
92
echo "	<string>${APP_VERSION}</string>" >> "${APP_NAME}.app/Contents/Info.plist"
93
echo "	<key>NSHumanReadableCopyright</key>" >> "${APP_NAME}.app/Contents/Info.plist"
94
echo "	<string>${APP_COPYRIGHT}</string>" >> "${APP_NAME}.app/Contents/Info.plist"
95
echo "	<key>CFBundlePackageType</key>" >> "${APP_NAME}.app/Contents/Info.plist"
96
echo "	<string>APPL</string>" >> "${APP_NAME}.app/Contents/Info.plist"
97
echo "	<key>CFBundleSignature</key>" >> "${APP_NAME}.app/Contents/Info.plist"
98
echo "	<string>????</string>" >> "${APP_NAME}.app/Contents/Info.plist"
99
echo "</dict>" >> "${APP_NAME}.app/Contents/Info.plist"
100
echo "</plist>" >> "${APP_NAME}.app/Contents/Info.plist"
10 pmbaty 101
 
102
exit 0