File: build-osx-executable.sh

package info (click to toggle)
0ad 0.0.26-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 130,460 kB
  • sloc: cpp: 261,824; ansic: 198,392; javascript: 19,067; python: 14,557; sh: 7,629; perl: 4,072; xml: 849; makefile: 741; java: 533; ruby: 229; php: 190; pascal: 30; sql: 21; tcl: 4
file content (74 lines) | stat: -rwxr-xr-x 2,198 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/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

# Assume this is called from trunk/
SVN_REV=$(svnversion -n .)
echo "L\"${SVN_REV}-release\"" > build/svn_revision/svn_revision.txt

cd "build/workspaces/"

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 "\nBuilding libraries\n"
pushd ../../libraries/osx > /dev/null
SYSROOT="${SYSROOT}" MIN_OSX_VERSION="${MIN_OSX_VERSION}" \
	./build-osx-libs.sh $JOBS "${BUILD_LIBS_ARGS}" || die "Libraries build script failed"
popd > /dev/null

# Update workspaces
echo "\nGenerating workspaces\n"

# Pass OS X options through to Premake
(SYSROOT="${SYSROOT}" MIN_OSX_VERSION="${MIN_OSX_VERSION}" \
	./update-workspaces.sh --sysroot="${SYSROOT}" --macosx-version-min="${MIN_OSX_VERSION}") || die "update-workspaces.sh failed!"

pushd gcc > /dev/null
echo "\nBuilding game\n"
(make clean && CC="$CC -arch $ARCH" CXX="$CXX -arch $ARCH" make ${JOBS}) || die "Game build failed!"
popd > /dev/null

# Run test to confirm all is OK
pushd ../../binaries/system > /dev/null
echo "\nRunning tests\n"
./test || die "Post-build testing failed!"
popd > /dev/null