Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/libraries/osx/build-osx-libs.sh
Show All 30 Lines | |||||
WXWIDGETS_VERSION="wxWidgets-3.1.4" | WXWIDGETS_VERSION="wxWidgets-3.1.4" | ||||
# libpng was included as part of X11 but that's removed from Mountain Lion | # libpng was included as part of X11 but that's removed from Mountain Lion | ||||
# (also the Snow Leopard version was ancient 1.2) | # (also the Snow Leopard version was ancient 1.2) | ||||
PNG_VERSION="libpng-1.6.36" | PNG_VERSION="libpng-1.6.36" | ||||
FREETYPE_VERSION="freetype-2.10.4" | FREETYPE_VERSION="freetype-2.10.4" | ||||
OGG_VERSION="libogg-1.3.3" | OGG_VERSION="libogg-1.3.3" | ||||
VORBIS_VERSION="libvorbis-1.3.7" | VORBIS_VERSION="libvorbis-1.3.7" | ||||
# gloox requires GnuTLS, GnuTLS requires Nettle and GMP | # gloox requires GnuTLS, GnuTLS requires Nettle and GMP | ||||
GMP_VERSION="gmp-6.2.0" | GMP_VERSION="gmp-6.2.1" | ||||
NETTLE_VERSION="nettle-3.6" | NETTLE_VERSION="nettle-3.6" | ||||
# NOTE: remember to also update LIB_URL below when changing version | # NOTE: remember to also update LIB_URL below when changing version | ||||
GLOOX_VERSION="gloox-1.0.24" | GLOOX_VERSION="gloox-1.0.24" | ||||
GNUTLS_VERSION="gnutls-3.6.15" | GNUTLS_VERSION="gnutls-3.6.15" | ||||
# OS X only includes part of ICU, and only the dylib | # OS X only includes part of ICU, and only the dylib | ||||
# NOTE: remember to also update LIB_URL below when changing version | # NOTE: remember to also update LIB_URL below when changing version | ||||
ICU_VERSION="icu4c-67_1" | ICU_VERSION="icu4c-69_1" | ||||
ENET_VERSION="enet-1.3.17" | ENET_VERSION="enet-1.3.17" | ||||
MINIUPNPC_VERSION="miniupnpc-2.2.2" | MINIUPNPC_VERSION="miniupnpc-2.2.2" | ||||
SODIUM_VERSION="libsodium-1.0.18" | SODIUM_VERSION="libsodium-1.0.18" | ||||
FMT_VERSION="7.1.3" | FMT_VERSION="7.1.3" | ||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
# Bundled with the game: | # Bundled with the game: | ||||
# * SpiderMonkey | # * SpiderMonkey | ||||
# * NVTT | # * NVTT | ||||
# * FCollada | # * FCollada | ||||
# Provided by OS X: | # Provided by OS X: | ||||
# * OpenAL | # * OpenAL | ||||
# * OpenGL | # * OpenGL | ||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
export CC=${CC:="clang"} CXX=${CXX:="clang++"} | export CC=${CC:="clang"} CXX=${CXX:="clang++"} | ||||
export MIN_OSX_VERSION=${MIN_OSX_VERSION:="10.12"} | export MIN_OSX_VERSION=${MIN_OSX_VERSION:="10.12"} | ||||
export ARCH=${ARCH:=""} | |||||
# The various libs offer inconsistent configure options, some allow | # The various libs offer inconsistent configure options, some allow | ||||
# setting sysroot and OS X-specific options, others don't. Adding to | # setting sysroot and OS X-specific options, others don't. Adding to | ||||
# the confusion, Apple moved /Developer/SDKs into the Xcode app bundle | # the confusion, Apple moved /Developer/SDKs into the Xcode app bundle | ||||
# so the path can't be guessed by clever build tools (like Boost.Build). | # so the path can't be guessed by clever build tools (like Boost.Build). | ||||
# Sometimes configure gets it wrong anyway, especially on cross compiles. | # Sometimes configure gets it wrong anyway, especially on cross compiles. | ||||
# This is why we prefer using (OBJ)CFLAGS, (OBJ)CXXFLAGS, and LDFLAGS. | # This is why we prefer using (OBJ)CFLAGS, (OBJ)CXXFLAGS, and LDFLAGS. | ||||
# Check if SYSROOT is set and not empty | # Check if SYSROOT is set and not empty | ||||
if [[ $SYSROOT && ${SYSROOT-_} ]]; then | if [[ $SYSROOT && ${SYSROOT-_} ]]; then | ||||
C_FLAGS="-isysroot $SYSROOT" | C_FLAGS="-isysroot $SYSROOT" | ||||
LDFLAGS="$LDFLAGS -Wl,-syslibroot,$SYSROOT" | LDFLAGS="$LDFLAGS -Wl,-syslibroot,$SYSROOT" | ||||
fi | fi | ||||
# Check if MIN_OSX_VERSION is set and not empty | # Check if MIN_OSX_VERSION is set and not empty | ||||
if [[ $MIN_OSX_VERSION && ${MIN_OSX_VERSION-_} ]]; then | if [[ $MIN_OSX_VERSION && ${MIN_OSX_VERSION-_} ]]; then | ||||
C_FLAGS="$C_FLAGS -mmacosx-version-min=$MIN_OSX_VERSION" | C_FLAGS="$C_FLAGS -mmacosx-version-min=$MIN_OSX_VERSION" | ||||
# clang and llvm-gcc look at mmacosx-version-min to determine link target | # clang and llvm-gcc look at mmacosx-version-min to determine link target | ||||
# and CRT version, and use it to set the macosx_version_min linker flag | # and CRT version, and use it to set the macosx_version_min linker flag | ||||
LDFLAGS="$LDFLAGS -mmacosx-version-min=$MIN_OSX_VERSION" | LDFLAGS="$LDFLAGS -mmacosx-version-min=$MIN_OSX_VERSION" | ||||
fi | fi | ||||
CFLAGS="$CFLAGS $C_FLAGS -fvisibility=hidden" | CFLAGS="$CFLAGS $C_FLAGS -fvisibility=hidden" | ||||
CXXFLAGS="$CXXFLAGS $C_FLAGS -stdlib=libc++ -std=c++17 -msse4.1" | CXXFLAGS="$CXXFLAGS $C_FLAGS -stdlib=libc++ -std=c++17" | ||||
OBJCFLAGS="$OBJCFLAGS $C_FLAGS" | OBJCFLAGS="$OBJCFLAGS $C_FLAGS" | ||||
OBJCXXFLAGS="$OBJCXXFLAGS $C_FLAGS" | OBJCXXFLAGS="$OBJCXXFLAGS $C_FLAGS" | ||||
# Force x86_64 architecture on MacOS for now. | # Force x86_64 architecture on MacOS for now. | ||||
# NB: annoyingly, this is rather unstandardised. Some libs expect -arch, others different things. | # NB: annoyingly, this is rather unstandardised. Some libs expect -arch, others different things. | ||||
# Further: wxWidgets uses its own system and actually fails to compile with arch arguments. | # Further: wxWidgets uses its own system and actually fails to compile with arch arguments. | ||||
ARCHLESS_CFLAGS=$CFLAGS | ARCHLESS_CFLAGS=$CFLAGS | ||||
ARCHLESS_CXXFLAGS=$CXXFLAGS | ARCHLESS_CXXFLAGS=$CXXFLAGS | ||||
ARCHLESS_LDFLAGS="$LDFLAGS -stdlib=libc++" | ARCHLESS_LDFLAGS="$LDFLAGS -stdlib=libc++" | ||||
CFLAGS="$CFLAGS -arch x86_64" | # If ARCH isn't set, select either x86_64 or arm64 | ||||
CXXFLAGS="$CXXFLAGS -arch x86_64" | if [ -z "${ARCH}" ]; then | ||||
if [ "`uname -m`" == "arm64" ]; then | |||||
LDFLAGS="$LDFLAGS -arch x86_64" | ARCH="arm64" | ||||
# Some libs want this passed to configure for cross compilation. | |||||
HOST_PLATFORM="--host=aarch64-apple-darwin" | |||||
else | |||||
CXXFLAGS="$CXXFLAGS -msse4.1" | |||||
ARCH="x86_64" | |||||
# Some libs want this passed to configure for cross compilation. | # Some libs want this passed to configure for cross compilation. | ||||
HOST_PLATFORM="--host=x86_64-apple-darwin" | HOST_PLATFORM="--host=x86_64-apple-darwin" | ||||
fi | |||||
fi | |||||
echo "ARCHITECTURE BREAKDOWN" | |||||
echo $ARCH | |||||
echo $HOST_PLATFORM | |||||
CFLAGS="$CFLAGS -arch $ARCH" | |||||
CXXFLAGS="$CXXFLAGS -arch $ARCH" | |||||
LDFLAGS="$LDFLAGS -arch $ARCH" | |||||
# CMake doesn't seem to pick up on architecture with CFLAGS only | # CMake doesn't seem to pick up on architecture with CFLAGS only | ||||
CMAKE_FLAGS="-DCMAKE_OSX_ARCHITECTURES=x86_64" | CMAKE_FLAGS="-DCMAKE_OSX_ARCHITECTURES=$ARCH" | ||||
JOBS=${JOBS:="-j2"} | JOBS=${JOBS:="-j2"} | ||||
set -e | set -e | ||||
die() | die() | ||||
{ | { | ||||
echo ERROR: $* | echo ERROR: $* | ||||
▲ Show 20 Lines • Show All 710 Lines • ▼ Show 20 Lines | |||||
popd > /dev/null | popd > /dev/null | ||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
echo -e "Building ICU..." | echo -e "Building ICU..." | ||||
LIB_VERSION="${ICU_VERSION}" | LIB_VERSION="${ICU_VERSION}" | ||||
LIB_ARCHIVE="$LIB_VERSION-src.tgz" | LIB_ARCHIVE="$LIB_VERSION-src.tgz" | ||||
LIB_DIRECTORY="icu" | LIB_DIRECTORY="icu" | ||||
LIB_URL="https://github.com/unicode-org/icu/releases/download/release-67-1/" | LIB_URL="https://github.com/unicode-org/icu/releases/download/release-69-1/" | ||||
mkdir -p icu | mkdir -p icu | ||||
pushd icu > /dev/null | pushd icu > /dev/null | ||||
if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]] | if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]] | ||||
then | then | ||||
INSTALL_DIR="$(pwd)" | INSTALL_DIR="$(pwd)" | ||||
▲ Show 20 Lines • Show All 192 Lines • ▼ Show 20 Lines | |||||
pushd ../source/spidermonkey/ > /dev/null | pushd ../source/spidermonkey/ > /dev/null | ||||
if [[ "$force_rebuild" = "true" ]] | if [[ "$force_rebuild" = "true" ]] | ||||
then | then | ||||
rm -f .already-built | rm -f .already-built | ||||
fi | fi | ||||
# Use the regular build script for SM. | # Use the regular build script for SM. | ||||
JOBS="$JOBS" ZLIB_DIR="$ZLIB_DIR" ./build.sh || die "Error building spidermonkey" | JOBS="$JOBS" ZLIB_DIR="$ZLIB_DIR" ARCH="$ARCH" ./build.sh || die "Error building spidermonkey" | ||||
popd > /dev/null | popd > /dev/null | ||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
# NVTT - bundled, no download | # NVTT - bundled, no download | ||||
pushd ../source/nvtt > /dev/null | pushd ../source/nvtt > /dev/null | ||||
if [[ "$force_rebuild" = "true" ]] | if [[ "$force_rebuild" = "true" ]] | ||||
Show All 20 Lines |
Wildfire Games · Phabricator