| 1 | #!/bin/sh
|
|---|
| 2 |
|
|---|
| 3 | # Build the Pyrogenesis executable, used to create the bundle and run the archiver.
|
|---|
| 4 |
|
|---|
| 5 | export ARCH=${ARCH:=$(uname -m)}
|
|---|
| 6 |
|
|---|
| 7 | # Set mimimum required OS X version, SDK location and tools
|
|---|
| 8 | # Old SDKs can be found at https://github.com/phracker/MacOSX-SDKs
|
|---|
| 9 | export MIN_OSX_VERSION=${MIN_OSX_VERSION:="10.12"}
|
|---|
| 10 | # Note that the 10.12 SDK is know to be too old for FMT 7.
|
|---|
| 11 | export SYSROOT=${SYSROOT:="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"}
|
|---|
| 12 | export CC=${CC:="clang"} CXX=${CXX:="clang++"}
|
|---|
| 13 |
|
|---|
| 14 | die()
|
|---|
| 15 | {
|
|---|
| 16 | echo ERROR: $*
|
|---|
| 17 | exit 1
|
|---|
| 18 | }
|
|---|
| 19 |
|
|---|
| 20 | # Check that we're actually on OS X
|
|---|
| 21 | if [ "`uname -s`" != "Darwin" ]; then
|
|---|
| 22 | die "This script is intended for OS X only"
|
|---|
| 23 | fi
|
|---|
| 24 |
|
|---|
| 25 | # Check SDK exists
|
|---|
| 26 | if [ ! -d "${SYSROOT}" ]; then
|
|---|
| 27 | die "${SYSROOT} does not exist! You probably need to install Xcode"
|
|---|
| 28 | fi
|
|---|
| 29 |
|
|---|
| 30 | # Assume this is called from trunk/
|
|---|
| 31 | SVN_REV=$(svnversion -n .)
|
|---|
| 32 | echo "L\"${SVN_REV}-release\"" > build/svn_revision/svn_revision.txt
|
|---|
| 33 |
|
|---|
| 34 | cd "build/workspaces/"
|
|---|
| 35 |
|
|---|
| 36 | JOBS=${JOBS:="-j5"}
|
|---|
| 37 |
|
|---|
| 38 | # Toggle whether this is a full rebuild, including libraries (takes much longer).
|
|---|
| 39 | FULL_REBUILD=${FULL_REBUILD:=false}
|
|---|
| 40 |
|
|---|
| 41 | if $FULL_REBUILD = true; then
|
|---|
| 42 | CLEAN_WORKSPACE_ARGS=""
|
|---|
| 43 | BUILD_LIBS_ARGS="--force-rebuild"
|
|---|
| 44 | else
|
|---|
| 45 | CLEAN_WORKSPACE_ARGS="--preserve-libs"
|
|---|
| 46 | BUILD_LIBS_ARGS=""
|
|---|
| 47 | fi
|
|---|
| 48 |
|
|---|
| 49 | ./clean-workspaces.sh "${CLEAN_WORKSPACE_ARGS}"
|
|---|
| 50 |
|
|---|
| 51 | # Build libraries against SDK
|
|---|
| 52 | echo "\nBuilding libraries\n"
|
|---|
| 53 | pushd ../../libraries/osx > /dev/null
|
|---|
| 54 | SYSROOT="${SYSROOT}" MIN_OSX_VERSION="${MIN_OSX_VERSION}" \
|
|---|
| 55 | ./build-osx-libs.sh $JOBS "${BUILD_LIBS_ARGS}" || die "Libraries build script failed"
|
|---|
| 56 | popd > /dev/null
|
|---|
| 57 |
|
|---|
| 58 | # Update workspaces
|
|---|
| 59 | echo "\nGenerating workspaces\n"
|
|---|
| 60 |
|
|---|
| 61 | # Pass OS X options through to Premake
|
|---|
| 62 | (SYSROOT="${SYSROOT}" MIN_OSX_VERSION="${MIN_OSX_VERSION}" \
|
|---|
| 63 | ./update-workspaces.sh --sysroot="${SYSROOT}" --macosx-version-min="${MIN_OSX_VERSION}") || die "update-workspaces.sh failed!"
|
|---|
| 64 |
|
|---|
| 65 | pushd gcc > /dev/null
|
|---|
| 66 | echo "\nBuilding game\n"
|
|---|
| 67 | (make clean && CC="$CC -arch $ARCH" CXX="$CXX -arch $ARCH" make ${JOBS}) || die "Game build failed!"
|
|---|
| 68 | popd > /dev/null
|
|---|
| 69 |
|
|---|
| 70 | # Run test to confirm all is OK
|
|---|
| 71 | pushd ../../binaries/system > /dev/null
|
|---|
| 72 | echo "\nRunning tests\n"
|
|---|
| 73 | ./test || die "Post-build testing failed!"
|
|---|
| 74 | popd > /dev/null
|
|---|