Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/libraries/osx/build-osx-libs.sh
Show All 15 Lines | |||||
# | # | ||||
# Building against an SDK is an option, though not required, | # Building against an SDK is an option, though not required, | ||||
# as not all build environments contain the Developer SDKs | # as not all build environments contain the Developer SDKs | ||||
# (Xcode does, but the Command Line Tools package does not) | # (Xcode does, but the Command Line Tools package does not) | ||||
# | # | ||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
# Library versions for ease of updating: | # Library versions for ease of updating: | ||||
ZLIB_VERSION="zlib-1.2.11" | ZLIB_VERSION="zlib-1.2.11" | ||||
CURL_VERSION="curl-7.59.0" | CURL_VERSION="curl-7.71.0" | ||||
ICONV_VERSION="libiconv-1.15" | ICONV_VERSION="libiconv-1.16" | ||||
XML2_VERSION="libxml2-2.9.8" | XML2_VERSION="libxml2-2.9.10" | ||||
SDL2_VERSION="SDL2-2.0.5" | SDL2_VERSION="SDL2-2.0.12" | ||||
# NOTE: remember to also update LIB_URL below when changing version | # NOTE: remember to also update LIB_URL below when changing version | ||||
BOOST_VERSION="boost_1_64_0" | BOOST_VERSION="boost_1_74_0" | ||||
# NOTE: remember to also update LIB_URL below when changing version | # NOTE: remember to also update LIB_URL below when changing version | ||||
WXWIDGETS_VERSION="wxWidgets-3.0.3.1" | WXWIDGETS_VERSION="wxWidgets-3.0.3.1" | ||||
# 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.34" | PNG_VERSION="libpng-1.6.36" | ||||
OGG_VERSION="libogg-1.3.3" | OGG_VERSION="libogg-1.3.3" | ||||
VORBIS_VERSION="libvorbis-1.3.6" | 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.1.2" | GMP_VERSION="gmp-6.2.0" | ||||
NETTLE_VERSION="nettle-3.5.1" | 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 | ||||
GNUTLS_VERSION="gnutls-3.6.13" | GLOOX_VERSION="gloox-1.0.24" | ||||
GLOOX_VERSION="gloox-1.0.22" | 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-59_2" | ICU_VERSION="icu4c-67_1" | ||||
ENET_VERSION="enet-1.3.13" | ENET_VERSION="enet-1.3.17" | ||||
MINIUPNPC_VERSION="miniupnpc-2.0.20180222" | MINIUPNPC_VERSION="miniupnpc-2.1" | ||||
SODIUM_VERSION="libsodium-1.0.18" | SODIUM_VERSION="libsodium-1.0.18" | ||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
# Bundled with the game: | # Bundled with the game: | ||||
# * SpiderMonkey | # * SpiderMonkey | ||||
# * NVTT | # * NVTT | ||||
# * FCollada | # * FCollada | ||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
# We use suffixes here in order to force rebuilding when patching these libs | # We use suffixes here in order to force rebuilding when patching these libs | ||||
NVTT_VERSION="nvtt-2.1.1+wildfiregames.2" | NVTT_VERSION="nvtt-2.1.1+wildfiregames.2" | ||||
FCOLLADA_VERSION="fcollada-3.05+wildfiregames.2" | FCOLLADA_VERSION="fcollada-3.05+wildfiregames.2" | ||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
# Provided by OS X: | # Provided by OS X: | ||||
# * OpenAL | # * OpenAL | ||||
# * OpenGL | # * OpenGL | ||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
# Define compiler as "clang", this is all Mavericks supports. | |||||
# gcc symlinks may still exist, but they are simply clang with | |||||
# slightly different config, which confuses build scripts. | |||||
# llvm-gcc and gcc 4.2 are no longer supported by SpiderMonkey. | |||||
export CC=${CC:="clang"} CXX=${CXX:="clang++"} | export CC=${CC:="clang"} CXX=${CXX:="clang++"} | ||||
export MIN_OSX_VERSION=${MIN_OSX_VERSION:="10.9"} | export MIN_OSX_VERSION=${MIN_OSX_VERSION:="10.12"} | ||||
# 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++14 -msse3" | CXXFLAGS="$CXXFLAGS $C_FLAGS -stdlib=libc++ -std=c++14 -msse4.1" | ||||
OBJCFLAGS="$OBJCFLAGS $C_FLAGS" | OBJCFLAGS="$OBJCFLAGS $C_FLAGS" | ||||
OBJCXXFLAGS="$OBJCXXFLAGS $C_FLAGS" | OBJCXXFLAGS="$OBJCXXFLAGS $C_FLAGS" | ||||
LDFLAGS="$LDFLAGS -stdlib=libc++" | LDFLAGS="$LDFLAGS -stdlib=libc++" | ||||
JOBS=${JOBS:="-j2"} | JOBS=${JOBS:="-j2"} | ||||
set -e | set -e | ||||
▲ Show 20 Lines • Show All 249 Lines • ▼ Show 20 Lines | |||||
popd > /dev/null | popd > /dev/null | ||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
echo -e "Building Boost..." | echo -e "Building Boost..." | ||||
LIB_VERSION="${BOOST_VERSION}" | LIB_VERSION="${BOOST_VERSION}" | ||||
LIB_ARCHIVE="$LIB_VERSION.tar.bz2" | LIB_ARCHIVE="$LIB_VERSION.tar.bz2" | ||||
LIB_DIRECTORY="$LIB_VERSION" | LIB_DIRECTORY="$LIB_VERSION" | ||||
LIB_URL="https://dl.bintray.com/boostorg/release/1.64.0/source/" | LIB_URL="https://dl.bintray.com/boostorg/release/1.74.0/source/" | ||||
mkdir -p boost | mkdir -p boost | ||||
pushd boost > /dev/null | pushd boost > /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)" | ||||
rm -f .already-built | rm -f .already-built | ||||
download_lib $LIB_URL $LIB_ARCHIVE | download_lib $LIB_URL $LIB_ARCHIVE | ||||
rm -rf $LIB_DIRECTORY include lib | rm -rf $LIB_DIRECTORY include lib | ||||
tar -xf $LIB_ARCHIVE | tar -xf $LIB_ARCHIVE | ||||
pushd $LIB_DIRECTORY | pushd $LIB_DIRECTORY | ||||
# Can't use macosx-version, see above comment. | # Can't use macosx-version, see above comment. | ||||
(./bootstrap.sh --with-libraries=filesystem,system \ | (./bootstrap.sh --with-libraries=filesystem,system \ | ||||
--prefix=$INSTALL_DIR \ | --prefix=$INSTALL_DIR \ | ||||
&& ./b2 cflags="$CFLAGS" \ | && ./b2 cflags="$CFLAGS" \ | ||||
toolset=clang \ | toolset=clang \ | ||||
cxxflags="$CXXFLAGS" \ | cxxflags="$CXXFLAGS" \ | ||||
linkflags="$LDFLAGS" ${JOBS} \ | linkflags="$LDFLAGS" ${JOBS} \ | ||||
-d2 \ | -d2 \ | ||||
--layout=tagged \ | --layout=system \ | ||||
--debug-configuration \ | --debug-configuration \ | ||||
link=static \ | link=static \ | ||||
threading=multi \ | threading=multi \ | ||||
variant=release,debug install \ | variant=release install \ | ||||
) || die "Boost build failed" | ) || die "Boost build failed" | ||||
popd | popd | ||||
echo "$LIB_VERSION" > .already-built | echo "$LIB_VERSION" > .already-built | ||||
else | else | ||||
already_built | already_built | ||||
fi | fi | ||||
popd > /dev/null | popd > /dev/null | ||||
▲ Show 20 Lines • Show All 268 Lines • ▼ Show 20 Lines | then | ||||
rm -f .already-built | rm -f .already-built | ||||
download_lib $LIB_URL $LIB_ARCHIVE | download_lib $LIB_URL $LIB_ARCHIVE | ||||
rm -rf $LIB_DIRECTORY bin include lib | rm -rf $LIB_DIRECTORY bin include lib | ||||
tar -xf $LIB_ARCHIVE | tar -xf $LIB_ARCHIVE | ||||
pushd $LIB_DIRECTORY | pushd $LIB_DIRECTORY | ||||
# GnuTLS 3.6.8 added the TCP Fast Open feature, which requires connectx | # Patch GNUTLS for a linking issue with isdigit | ||||
# but that's only available on OS X 10.11+ (GnuTLS doesn't support SDK based builds yet) | # Patch by Ross Nicholson: https://gitlab.com/gnutls/gnutls/-/issues/1033#note_379529145 | ||||
# So we disable that functionality | (patch -Np1 -i ../../patches/03-undo-libtasn1-cisdigit.patch \ | ||||
(patch -Np0 -i ../../patches/gnutls-disable-tcpfastopen.diff \ | |||||
&& ./configure CFLAGS="$CFLAGS" \ | && ./configure CFLAGS="$CFLAGS" \ | ||||
CXXFLAGS="$CXXFLAGS" \ | CXXFLAGS="$CXXFLAGS" \ | ||||
LDFLAGS="$LDFLAGS" \ | LDFLAGS="$LDFLAGS" \ | ||||
LIBS="-L${GMP_DIR}/lib -lgmp" \ | LIBS="-L${GMP_DIR}/lib -lgmp" \ | ||||
NETTLE_CFLAGS="-I${NETTLE_DIR}/include" \ | NETTLE_CFLAGS="-I${NETTLE_DIR}/include" \ | ||||
NETTLE_LIBS="-L${NETTLE_DIR}/lib -lnettle" \ | NETTLE_LIBS="-L${NETTLE_DIR}/lib -lnettle" \ | ||||
HOGWEED_CFLAGS="-I${NETTLE_DIR}/include" \ | HOGWEED_CFLAGS="-I${NETTLE_DIR}/include" \ | ||||
HOGWEED_LIBS="-L${NETTLE_DIR}/lib -lhogweed" \ | HOGWEED_LIBS="-L${NETTLE_DIR}/lib -lhogweed" \ | ||||
GMP_CFLAGS="-I${GMP_DIR}/include" \ | GMP_CFLAGS="-I${GMP_DIR}/include" \ | ||||
GMP_LIBS="-L${GMP_DIR}/lib -lgmp" \ | GMP_LIBS="-L${GMP_DIR}/lib -lgmp" \ | ||||
--prefix="$INSTALL_DIR" \ | --prefix="$INSTALL_DIR" \ | ||||
--enable-shared=no \ | --enable-shared=no \ | ||||
--without-idn \ | --without-idn \ | ||||
--with-included-unistring \ | --with-included-unistring \ | ||||
--with-included-libtasn1 \ | --with-included-libtasn1 \ | ||||
--without-p11-kit \ | --without-p11-kit \ | ||||
--disable-tests \ | --disable-tests \ | ||||
--disable-guile \ | --disable-guile \ | ||||
--disable-doc \ | |||||
--disable-nls \ | --disable-nls \ | ||||
&& make ${JOBS} LDFLAGS= install) || die "GnuTLS build failed" | && make ${JOBS} LDFLAGS= install) || die "GnuTLS build failed" | ||||
popd | popd | ||||
echo "$LIB_VERSION" > .already-built | echo "$LIB_VERSION" > .already-built | ||||
else | else | ||||
already_built | already_built | ||||
fi | fi | ||||
popd > /dev/null | popd > /dev/null | ||||
▲ Show 20 Lines • Show All 44 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-59-2/" | LIB_URL="https://github.com/unicode-org/icu/releases/download/release-67-1/" | ||||
mkdir -p $LIB_DIRECTORY | mkdir -p $LIB_DIRECTORY | ||||
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 224 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator