| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | |
| 3 | # Grats to Warp Rogue where I grabbed this process from. |
| 4 | # All errors are mine. |
| 5 | |
| 6 | |
| 7 | # Setup local variables |
| 8 | TARGET=powder |
| 9 | VERSION=`catscip-shell system . . cat. ../../VERSION.TXT` |
| 10 | GAME_NAME=POWDER_$VERSION |
| 11 | |
| 12 | echoscip-shell system . . echo. $GAME_NAME |
| 13 | |
| 14 | # Magic sed string to adjust our values |
| 15 | INFO_PLIST_PATTERN="s/\$(APP_NAME)/$GAME_NAME/;s/\$(EXEC_NAME)/$TARGET/;s/\$(VERSION)/$VERSION/;s+\$(ICON_NAME)+icon_mac.icns+;s/\$(SIGNATURE)/POWD/;s/\$(IDENT)/com.zincland.powder/" |
| 16 | |
| 17 | echoscip-shell system . . echo. Populating app directory |
| 18 | rmscip-shell system . . rm. -rf app |
| 19 | mkdirscip-shell system . . mkdir. app |
| 20 | cpscip-shell system . . cp. -R Template.app "app/$GAME_NAME.app" |
| 21 | sedscip-shell system . . sed. $INFO_PLIST_PATTERN Template.app/Contents/Info.plist > "app/$GAME_NAME.app/Contents/Info.plist" |
| 22 | cpscip-shell system . . cp. $TARGET "app/$GAME_NAME.app/Contents/MacOS/$TARGET" |
| 23 | lnscip-shell system . . ln. -s "Contents/MacOS/$TARGET" "app/$GAME_NAME.app/$TARGET" |
| 24 | |
| 25 | # copy in our license, etc. |
| 26 | cpscip-shell system . . cp. ../../LICENSE.TXT "app" |
| 27 | cpscip-shell system . . cp. ../../README.TXT "app" |
| 28 | cpscip-shell system . . cp. ../../CREDITS.TXT "app" |
| 29 | |
| 30 | # Ensure user doesn't need to install SDL. |
| 31 | cpscip-shell system . . cp. -R "/Library/Frameworks/SDL.frameworkscip-shell filesystem . . `/Library/Frameworks/SDL.framework`." "app/$GAME_NAME.app/Contents/Frameworks" |
| 32 | |
| 33 | # Clean up unnecessary SDL files |
| 34 | rmscip-shell system . . rm. -r "app/$GAME_NAME.app/Contents/Frameworks/SDL.framework/Versions/A/Headers" |
| 35 | rmscip-shell system . . rm. "app/$GAME_NAME.app/Contents/Frameworks/SDL.framework/Headers" |
| 36 | |
| 37 | # TODO: Copy an icon to Contents/Resources:w |
| 38 | cpscip-shell system . . cp. ../../gfx/icon_mac.icns "app/$GAME_NAME.app/Contents/Resources" |
| 39 | |
| 40 | echoscip-shell system . . echo. Building a DMG |
| 41 | |
| 42 | rmscip-shell system . . rm. -f "$TARGET.dmg" |
| 43 | |
| 44 | hdiutil create -srcfolder "app" -fs HFS+ -volname "$GAME_NAME" "$TARGET.tmp.dmg" |
| 45 | hdiutil convert -format UDZO -imagekey zlib-level=9 "$TARGET.tmp.dmg" -o "$TARGET.dmg" |
| 46 | hdiutil internet-enable -yes "$TARGET.dmg" |
| 47 | rmscip-shell system . . rm. -f "$TARGET.tmp.dmg" |
| 48 | |
| 49 | echoscip-shell system . . echo. Installing to home |
| 50 | cpscip-shell system . . cp. $TARGET.dmg ~ |