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)
25 echo "=== Running python setup.py ==="
26 echo " ${GAME_NAME} version: ${GAME_VERSION}"
27 echo " Writing log to ${PY2APP_LOG}"
29 python setup.py py2app >${PY2APP_LOG} 2>&1
32 echo "=== Removing useless cruft that just takes up space ==="
35 for dir in docs examples tests; do
36 find "dist/" -path "*/Resources/lib/*/pygame/${dir}/*" -delete
39 echo "=== Adding magic icon ==="
42 cp data/icons/*.icns dist/${GAME_NAME}.app/Contents/Resources/
44 echo "=== Building DMG ==="
49 rm dist/${DMG_NAME} > /dev/null
51 cat > ${BUILD_FOLDER}/dist/IMPORTANT\ NOTE.txt <<EOF
52 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.
54 If this doesn't work, please let me (<firxen@gmail.com>) know, especially if you have any ideas about how to fix it.
56 You should also be able to use the unix tarball available at the same place you got this dmg.
61 hdiutil create -volname ${GAME_NAME} -srcfolder ${BUILD_FOLDER}/dist/*.app/ -srcfolder ${BUILD_FOLDER}/dist/IMPORTANT\ NOTE.txt dist/${DMG_NAME}
66 du -sh dist/* | sed 's/^/ /'