2 # Copyright 2009-2014 Jeremy Thurgood <firxen@gmail.com>
3 # GPL - see COPYING for details
9 # This requires a 32-bit Python build from python.org and a binary pygame
12 # https://www.python.org/ftp/python/2.7.6/python-2.7.6-macosx10.3.dmg
13 # http://pygame.org/ftp/pygame-1.9.1release-python.org-32bit-py2.7-macosx10.3.dmg
15 # Install these in /Library/Frameworks and build the virtualenv with
16 # --system-site-packages to make the pygame installation available.
18 GAME_NAME=`sed -ne 's/NAME_STR = "\(.*\)"/\1/p' setup.py`
19 GAME_VERSION=`sed -ne 's/VERSION_STR = "\(.*\)"/\1/p' setup.py`
20 BUILD_NAME="${GAME_NAME}-${GAME_VERSION}"
21 BUILD_FOLDER="build/${BUILD_NAME}"
22 DMG_NAME="${BUILD_NAME}.dmg"
23 PY2APP_LOG="py2app.log"
27 echo "=== Setting up build environment ==="
29 python setup.py sdist > /dev/null
31 (cd build; tar xzf ../dist/${BUILD_NAME}.tar.gz)
36 echo "=== Running python setup.py ==="
37 echo " ${GAME_NAME} version: ${GAME_VERSION}"
38 echo " Writing log to ${PY2APP_LOG}"
40 python setup.py py2app >${PY2APP_LOG} 2>&1
43 echo "=== Removing useless cruft that just takes up space ==="
46 for dir in docs examples tests; do
47 find "dist/" -path "*/Resources/lib/*/pygame/${dir}/*" -delete
50 echo "=== Adding magic icon ==="
53 cp data/icons/*.icns dist/${GAME_NAME}.app/Contents/Resources/
55 echo "=== Building DMG ==="
60 rm dist/${DMG_NAME} > /dev/null
62 cat > ${BUILD_FOLDER}/dist/IMPORTANT\ NOTE.txt <<EOF
63 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.
65 If this doesn't work, please let me (<firxen@gmail.com>) know, especially if you have any ideas about how to fix it.
67 You should also be able to use the unix tarball available at the same place you got this dmg.
72 hdiutil create -volname ${GAME_NAME} -srcfolder ${BUILD_FOLDER}/dist/*.app/ -srcfolder ${BUILD_FOLDER}/dist/IMPORTANT\ NOTE.txt dist/${DMG_NAME}
77 du -sh dist/* | sed 's/^/ /'