2 # Copyright 2009 Jeremy Thurgood <firxen@gmail.com>
3 # GPL - see COPYING for details
7 GAME_NAME=`sed -ne 's/NAME_STR = "\(.*\)"/\1/p' setup.py`
8 GAME_VERSION=`sed -ne 's/VERSION_STR = "\(.*\)"/\1/p' setup.py`
9 BUILD_NAME="${GAME_NAME}-${GAME_VERSION}"
10 BUILD_FOLDER="build/${BUILD_NAME}"
11 DMG_NAME="${BUILD_NAME}.dmg"
12 PY2APP_LOG="py2app.log"
16 echo "=== Setting up build environment ==="
18 python setup.py sdist > /dev/null
20 (cd build; tar xzf ../dist/${BUILD_NAME}.tar.gz)
22 echo "[${BUILD_FOLDER}]"
27 echo "=== Running python setup.py ==="
28 echo " ${GAME_NAME} version: ${GAME_VERSION}"
29 echo " Writing log to ${PY2APP_LOG}"
31 python setup.py py2app >${PY2APP_LOG} 2>&1
34 echo "=== Removing useless cruft that just takes up space ==="
37 for dir in docs examples tests; do
38 find "dist/" -path "*/Resources/lib/*/pygame/${dir}/*" -delete
41 echo "=== Adding magic icon ==="
44 cp data/icons/*.icns dist/${GAME_NAME}.app/Contents/Resources/
46 echo "=== Building DMG ==="
52 rm dist/${DMG_NAME} > /dev/null
54 echo -e "For some reason the game starts without a foreground window. Click on the icon in the dock (or minimize and restore from the menu) to get it back.\n\nIf this doesn't work, please let me (<firxen@gmail.com>) know, especially if you have any ideas about how to fix it.\n\nYou should also be able to use the unix tarball available at the same place you got this dmg.\n\nThanks." > ${BUILD_FOLDER}/dist/IMPORTANT\ NOTE.txt
56 hdiutil create -volname ${GAME_NAME} -srcfolder ${BUILD_FOLDER}/dist/*.app/ -srcfolder ${BUILD_FOLDER}/dist/IMPORTANT\ NOTE.txt dist/${DMG_NAME}
61 du -sh dist/* | sed 's/^/ /'