mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
Some are real bugs, some are bashisms, but most is zealous quoting of variables. Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
77 lines
2 KiB
Bash
Executable file
77 lines
2 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
# Build the Pyrogenesis executable, used to create the bundle and run the archiver.
|
|
|
|
export ARCH="${ARCH:=$(uname -m)}"
|
|
|
|
# Set mimimum required OS X version, SDK location and tools
|
|
# Old SDKs can be found at https://github.com/phracker/MacOSX-SDKs
|
|
export MIN_OSX_VERSION="${MIN_OSX_VERSION:="10.12"}"
|
|
# Note that the 10.12 SDK is know to be too old for FMT 7.
|
|
export SYSROOT="${SYSROOT:="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"}"
|
|
export CC="${CC:="clang"}" CXX="${CXX:="clang++"}"
|
|
|
|
die()
|
|
{
|
|
echo ERROR: "$*"
|
|
exit 1
|
|
}
|
|
|
|
# Check that we're actually on OS X
|
|
if [ "$(uname -s)" != "Darwin" ]; then
|
|
die "This script is intended for OS X only"
|
|
fi
|
|
|
|
# Check SDK exists
|
|
if [ ! -d "${SYSROOT}" ]; then
|
|
die "${SYSROOT} does not exist! You probably need to install Xcode"
|
|
fi
|
|
|
|
cd "build/workspaces/" || die
|
|
|
|
JOBS=${JOBS:="-j5"}
|
|
|
|
# Toggle whether this is a full rebuild, including libraries (takes much longer).
|
|
FULL_REBUILD=${FULL_REBUILD:=false}
|
|
|
|
if [ "$FULL_REBUILD" = true ]; then
|
|
CLEAN_WORKSPACE_ARGS=""
|
|
BUILD_LIBS_ARGS="--force-rebuild"
|
|
else
|
|
CLEAN_WORKSPACE_ARGS="--preserve-libs"
|
|
BUILD_LIBS_ARGS=""
|
|
fi
|
|
|
|
./clean-workspaces.sh "${CLEAN_WORKSPACE_ARGS}"
|
|
|
|
# Build libraries against SDK
|
|
echo
|
|
echo "Building libraries"
|
|
echo
|
|
cd ../../libraries/osx || die
|
|
SYSROOT="${SYSROOT}" MIN_OSX_VERSION="${MIN_OSX_VERSION}" \
|
|
./build-osx-libs.sh "$JOBS" "${BUILD_LIBS_ARGS}" || die "Libraries build script failed"
|
|
cd - || die
|
|
|
|
# Update workspaces
|
|
echo
|
|
echo "Generating workspaces"
|
|
echo
|
|
|
|
# Pass OS X options through to Premake
|
|
(./update-workspaces.sh --sysroot="${SYSROOT}" --macosx-version-min="${MIN_OSX_VERSION}") || die "update-workspaces.sh failed!"
|
|
|
|
echo
|
|
echo "Building game"
|
|
echo
|
|
cd gcc || die
|
|
(make clean && CC="$CC -arch $ARCH" CXX="$CXX -arch $ARCH" make "${JOBS}") || die "Game build failed!"
|
|
cd - || die
|
|
|
|
# Run test to confirm all is OK
|
|
echo
|
|
echo "Running tests"
|
|
echo
|
|
cd ../../binaries/system || die
|
|
./test || die "Post-build testing failed!"
|
|
cd - || die
|