Rev 3 | Blame | Last modification | View Log | Download | RSS feed
#!/bin/bash
MY_PATH=`dirname "$0"`
APP_NAME="Rick Dangerous"
APP_VERSION="1.2"
APP_COPYRIGHT="© 2016 Pierre-Marie Baty
© 2002 BigOrno
© 1989 CORE Design
Artwork by Simon Phipps"
BUNDLE_ID="com.pmbaty.rick.rickdangerous"
ICON_FILE="rick.png"
cd "${MY_PATH}"
rm -rf "${APP_NAME}.app"
mkdir "${APP_NAME}.app"
mkdir "${APP_NAME}.app/Contents"
mkdir "${APP_NAME}.app/Contents/MacOS"
mkdir "${APP_NAME}.app/Contents/Frameworks"
mkdir "${APP_NAME}.app/Contents/Resources"
cp -r "SDL.framework" "${APP_NAME}.app/Contents/Frameworks"
gcc *.c osx-sdlmain.m -ISDL.framework/Headers -framework Foundation -framework Cocoa -F. -framework SDL -o "${APP_NAME}.app/Contents/MacOS/${APP_NAME}"
if [ ! "_$?" = "_0" ]; then
rm -rf "${APP_NAME}.app"
exit
fi
install_name_tool -add_rpath "@loader_path/../Frameworks" "${APP_NAME}.app/Contents/MacOS/${APP_NAME}"
if [ ! "_$?" = "_0" ]; then
rm -rf "${APP_NAME}.app"
exit
fi
mkdir "__${APP_NAME}.iconset"
sips -z 16 16 "${ICON_FILE}" --out "__${APP_NAME}.iconset/icon_16x16.png" > /dev/null
sips -z 32 32 "${ICON_FILE}" --out "__${APP_NAME}.iconset/icon_16x16@2x.png" > /dev/null
sips -z 32 32 "${ICON_FILE}" --out "__${APP_NAME}.iconset/icon_32x32.png" > /dev/null
sips -z 64 64 "${ICON_FILE}" --out "__${APP_NAME}.iconset/icon_32x32@2x.png" > /dev/null
sips -z 128 128 "${ICON_FILE}" --out "__${APP_NAME}.iconset/icon_128x128.png" > /dev/null
sips -z 256 256 "${ICON_FILE}" --out "__${APP_NAME}.iconset/icon_128x128@2x.png" > /dev/null
sips -z 256 256 "${ICON_FILE}" --out "__${APP_NAME}.iconset/icon_256x256.png" > /dev/null
sips -z 512 512 "${ICON_FILE}" --out "__${APP_NAME}.iconset/icon_256x256@2x.png" > /dev/null
sips -z 512 512 "${ICON_FILE}" --out "__${APP_NAME}.iconset/icon_512x512.png" > /dev/null
sips -z 1024 1024 "${ICON_FILE}" --out "__${APP_NAME}.iconset/icon_512x512@2x.png" > /dev/null
iconutil -c icns "__${APP_NAME}.iconset"
if [ ! "_$?" = "_0" ]; then
rm -rf "__${APP_NAME}.iconset"
rm -rf "${APP_NAME}.app"
exit
fi
rm -rf "__${APP_NAME}.iconset"
mv "__${APP_NAME}.icns" "${APP_NAME}.app/Contents/Resources/${APP_NAME}.icns"
cp -r "../sounds" "${APP_NAME}.app/Contents/Resources"
echo -n "APPL???" > "${APP_NAME}.app/Contents/PkgInfo"
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > "${APP_NAME}.app/Contents/Info.plist"
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"
echo "<plist version=\"1.0\">" >> "${APP_NAME}.app/Contents/Info.plist"
echo "<dict>" >> "${APP_NAME}.app/Contents/Info.plist"
echo " <key>CFBundleDevelopmentRegion</key>" >> "${APP_NAME}.app/Contents/Info.plist"
echo " <string>en</string>" >> "${APP_NAME}.app/Contents/Info.plist"
echo " <key>CFBundleExecutable</key>" >> "${APP_NAME}.app/Contents/Info.plist"
echo " <string>${APP_NAME}</string>" >> "${APP_NAME}.app/Contents/Info.plist"
echo " <key>CFBundleIconFile</key>" >> "${APP_NAME}.app/Contents/Info.plist"
echo " <string>${APP_NAME}.icns</string>" >> "${APP_NAME}.app/Contents/Info.plist"
echo " <key>CFBundleIdentifier</key>" >> "${APP_NAME}.app/Contents/Info.plist"
echo " <string>${BUNDLE_ID}</string>" >> "${APP_NAME}.app/Contents/Info.plist"
echo " <key>CFBundleInfoDictionaryVersion</key>" >> "${APP_NAME}.app/Contents/Info.plist"
echo " <string>6.0</string>" >> "${APP_NAME}.app/Contents/Info.plist"
echo " <key>CFBundleName</key>" >> "${APP_NAME}.app/Contents/Info.plist"
echo " <string>${APP_NAME}</string>" >> "${APP_NAME}.app/Contents/Info.plist"
echo " <key>CFBundleVersion</key>" >> "${APP_NAME}.app/Contents/Info.plist"
echo " <string>${APP_VERSION}</string>" >> "${APP_NAME}.app/Contents/Info.plist"
echo " <key>NSHumanReadableCopyright</key>" >> "${APP_NAME}.app/Contents/Info.plist"
echo " <string>${APP_COPYRIGHT}</string>" >> "${APP_NAME}.app/Contents/Info.plist"
echo " <key>CFBundlePackageType</key>" >> "${APP_NAME}.app/Contents/Info.plist"
echo " <string>APPL</string>" >> "${APP_NAME}.app/Contents/Info.plist"
echo " <key>CFBundleSignature</key>" >> "${APP_NAME}.app/Contents/Info.plist"
echo " <string>????</string>" >> "${APP_NAME}.app/Contents/Info.plist"
echo "</dict>" >> "${APP_NAME}.app/Contents/Info.plist"
echo "</plist>" >> "${APP_NAME}.app/Contents/Info.plist"