changeset 433:e07b42656d22

Untested build scripts.
author Simon Cross <hodgestar@gmail.com>
date Sat, 17 Sep 2011 19:31:31 +0200
parents b49f6dde8731
children 4a6f7e892d55
files scripts/build_unix.sh scripts/darwin-py2app.sh scripts/wine-py2exe
diffstat 3 files changed, 148 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/build_unix.sh	Sat Sep 17 19:31:31 2011 +0200
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+GAME_NAME="mutable-mamba"
+
+NT_VERSION=`sed -ne 's/VERSION_STR = "\(.*\)"/\1/p' setup.py`
+BUILD_NAME="${GAME_NAME}-${NT_VERSION}"
+BUILD_FOLDER="build/${GAME_NAME}"
+TARBALL_NAME="${BUILD_NAME}.tgz"
+
+rm -rf ${BUILD_FOLDER}
+mkdir -p ${BUILD_FOLDER} dist
+
+hg archive ${BUILD_FOLDER}/ -I LICENSE.txt -I README.txt \
+                            -I setup.py -I run_game.py \
+                            -I scripts -I data -I mamba
+
+cd build
+tar czf ../dist/${TARBALL_NAME} ${GAME_NAME}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/darwin-py2app.sh	Sat Sep 17 19:31:31 2011 +0200
@@ -0,0 +1,54 @@
+#!/bin/sh
+# Copyright 2009 Jeremy Thurgood <firxen+rinkhals@gmail.com>
+# GPL - see COPYING for details
+#
+# Usage: darwin-py2app
+
+GAME_NAME="mutable-mamba"
+
+NT_VERSION=`sed -ne 's/VERSION_STR = "\(.*\)"/\1/p' setup.py`
+BUILD_NAME="${GAME_NAME}-${NT_VERSION}"
+BUILD_FOLDER="build/${GAME_NAME}"
+DMG_NAME="${BUILD_NAME}.dmg"
+PY2APP_LOG="py2app.log"
+
+BASEDIR=`pwd`
+
+echo "=== Setting up build environment ==="
+
+./scripts/build_unix.sh
+
+cd ${BUILD_FOLDER}
+
+# find data -name '*.svg' -delete
+
+echo ""
+echo "=== Running python setup.py ==="
+echo "  Mutable Mamba version: ${NT_VERSION}"
+echo "  Writing log to ${PY2APP_LOG}"
+
+python setup.py py2app >${PY2APP_LOG} 2>&1
+
+echo ""
+echo "=== Removing useless cruft that just takes up space ==="
+echo ""
+
+for dir in docs examples tests; do
+    find "dist/" -path "*/Resources/lib/*/pygame/${dir}/*" -delete
+done
+
+echo "=== Building DMG ==="
+echo ""
+
+cd ${BASEDIR}
+
+pwd
+rm dist/${DMG_NAME} > /dev/null
+hdiutil create -srcfolder ${BUILD_FOLDER}/dist/*.app/ dist/${DMG_NAME}
+
+echo ""
+echo "=== Done ==="
+echo ""
+du -sh dist/* | sed 's/^/   /'
+echo ""
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/wine-py2exe	Sat Sep 17 19:31:31 2011 +0200
@@ -0,0 +1,76 @@
+#!/bin/sh
+# wine-py2exe
+#
+# Usage: wine-py2exe
+
+NT_VERSION=`sed -nre 's/VERSION_STR = "(.*)"/\1/p' setup.py`
+BUILD_FOLDER="mutable-mamba-${NT_VERSION}"
+ZIP_NAME="${BUILD_FOLDER}.zip"
+PY2EXE_LOG="py2exe.log"
+
+WINE_PYTHON=`winepath "C:/Python26"`
+WINE_SYS32=`winepath "C:/windows/system32"`
+
+#
+# Run py2exe build under wine
+#
+
+echo "=== Running wine python setup.py ==="
+echo ""
+echo "  Mutable Mamba version: ${NT_VERSION}"
+echo "  Writing log to ${PY2EXE_LOG}."
+echo "  ---"
+echo "  Please make sure you have patched your py2exe run.exe"
+echo "  and run_w.exe with PETools (they need to have their"
+echo "  executable size correctly set)."
+echo ""
+
+rm -rf "dist/${BUILD_FOLDER}"
+mkdir -p "dist/${BUILD_FOLDER}"
+rm -rf "dist/${ZIP_NAME}"
+
+wine python setup.py py2exe >${PY2EXE_LOG} 2>&1
+
+#
+# Copy dependencies py2exe missed
+#
+
+echo "=== Copying dependencies that py2exe missed ==="
+echo ""
+
+DEST="dist/${BUILD_FOLDER}"
+
+cp -v "${WINE_SYS32}/python26.dll" "${DEST}"
+# TODO: the line below copies in the Wine placeholder DLL (oddly this
+# doesn't appear to break anything)
+# Decide whether to keep this or not.
+# cp -v "${WINE_SYS32}/msvcr80.dll" "${DEST}"
+
+echo "'data' -> '${DEST}/data'"
+hg archive -I "path:data/" "${DEST}"
+
+echo "'${WINE_PYTHON}/Lib/site-packages/pygame' -> '${DEST}'"
+rm -rf "${DEST}/pygame"
+cp -R "${WINE_PYTHON}/Lib/site-packages/pygame" "${DEST}"
+rm -rf "${DEST}/pygame/examples" "${DEST}/pygame/tests" "${DEST}/pygame/docs"
+
+#
+# create zip file
+#
+
+echo "=== Creating zip of patched py2exe dist folder ==="
+echo ""
+echo "  Zip file: dist/${ZIP_NAME}"
+echo "  Build folder: dist/${BUILD_FOLDER}"
+echo ""
+
+cd dist
+rm -f "$ZIP_NAME"
+zip -r -q "$ZIP_NAME" "$BUILD_FOLDER"
+cd ..
+
+echo "=== Done ==="
+echo ""
+echo -n "  "; du -sh dist/${ZIP_NAME}
+echo -n "  "; du -sh dist/${BUILD_FOLDER}
+echo ""