This Trac instance is not used for development anymore!

We migrated our development workflow to git and Gitea.
To test the future redirection, replace trac by ariadne in the page URL.

source: ps/trunk/source/tools/dist/build-osx-executable.sh

Last change on this file was 26881, checked in by wraitii, 3 years ago

Allo native builds on Mac OS M1 / Apple Silicon

  • Update GMP to a version that supports arm64 darwin
  • Patch spidermonkey 78 to build and run on arm64 darwin
  • Choose the correct architecture dynamically in build scripts
  • Include python workaround that fixes python related errors on spidermonkey build

Based on a patch by: kumikumi
Based on a patch by: Langbart

Fixes #6474

Differential Revision: https://code.wildfiregames.com/D4607

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