Changeset View
Changeset View
Standalone View
Standalone View
libraries/osx/build-osx-libs.sh
Show All 18 Lines | |||||
# (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.71.0" | CURL_VERSION="curl-7.71.0" | ||||
ICONV_VERSION="libiconv-1.16" | ICONV_VERSION="libiconv-1.16" | ||||
XML2_VERSION="libxml2-2.9.10" | XML2_VERSION="libxml2-2.9.10" | ||||
SDL2_VERSION="SDL2-2.0.12" | SDL2_VERSION="SDL2-2.0.18" | ||||
# 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_76_0" | BOOST_VERSION="boost_1_76_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.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" | ||||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | if [[ $MIN_OSX_VERSION && ${MIN_OSX_VERSION-_} ]]; then | ||||
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 -msse4.1" | ||||
OBJCFLAGS="$OBJCFLAGS $C_FLAGS" | OBJCFLAGS="$OBJCFLAGS $C_FLAGS" | ||||
OBJCXXFLAGS="$OBJCXXFLAGS $C_FLAGS" | OBJCXXFLAGS="$OBJCXXFLAGS $C_FLAGS" | ||||
LDFLAGS="$LDFLAGS -stdlib=libc++" | # Force x86_64 architecture on MacOS for now. | ||||
# 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. | |||||
ARCHLESS_CFLAGS=$CFLAGS | |||||
ARCHLESS_CXXFLAGS=$CXXFLAGS | |||||
ARCHLESS_LDFLAGS="$LDFLAGS -stdlib=libc++" | |||||
CFLAGS="$CFLAGS -arch x86_64" | |||||
CXXFLAGS="$CXXFLAGS -arch x86_64" | |||||
LDFLAGS="$LDFLAGS -arch x86_64" | |||||
# Some libs want this passed to configure for cross compilation. | |||||
HOST_PLATFORM="--host=x86_64-apple-darwin" | |||||
# CMake doesn't seem to pick up on architecture with CFLAGS only | |||||
CMAKE_FLAGS="-DCMAKE_OSX_ARCHITECTURES=x86_64" | |||||
JOBS=${JOBS:="-j2"} | JOBS=${JOBS:="-j2"} | ||||
set -e | set -e | ||||
die() | die() | ||||
{ | { | ||||
echo ERROR: $* | echo ERROR: $* | ||||
▲ Show 20 Lines • Show All 327 Lines • ▼ Show 20 Lines | then | ||||
pushd $LIB_DIRECTORY | pushd $LIB_DIRECTORY | ||||
mkdir -p build-release | mkdir -p build-release | ||||
pushd build-release | pushd build-release | ||||
CONF_OPTS="--prefix=$INSTALL_DIR | CONF_OPTS="--prefix=$INSTALL_DIR | ||||
--disable-shared | --disable-shared | ||||
--enable-unicode | --enable-unicode | ||||
--enable-universal_binary=x86_64 | |||||
--with-cocoa | --with-cocoa | ||||
--with-opengl | --with-opengl | ||||
--with-libiconv-prefix=${ICONV_DIR} | --with-libiconv-prefix=${ICONV_DIR} | ||||
--with-expat=builtin | --with-expat=builtin | ||||
--with-libpng=builtin | --with-libpng=builtin | ||||
--without-libtiff | --without-libtiff | ||||
--without-sdl | --without-sdl | ||||
--without-x | --without-x | ||||
--disable-stc | --disable-stc | ||||
--disable-webview | --disable-webview | ||||
--disable-webkit | --disable-webkit | ||||
--disable-webviewwebkit | --disable-webviewwebkit | ||||
--disable-webviewie | --disable-webviewie | ||||
--without-libjpeg" | --without-libjpeg" | ||||
# wxWidgets configure now defaults to targeting 10.5, if not specified, | # wxWidgets configure now defaults to targeting 10.5, if not specified, | ||||
# but that conflicts with our flags | # but that conflicts with our flags | ||||
if [[ $MIN_OSX_VERSION && ${MIN_OSX_VERSION-_} ]]; then | if [[ $MIN_OSX_VERSION && ${MIN_OSX_VERSION-_} ]]; then | ||||
CONF_OPTS="$CONF_OPTS --with-macosx-version-min=$MIN_OSX_VERSION" | CONF_OPTS="$CONF_OPTS --with-macosx-version-min=$MIN_OSX_VERSION" | ||||
fi | fi | ||||
(../configure CFLAGS="$CFLAGS" \ | (../configure CFLAGS="$ARCHLESS_CFLAGS" \ | ||||
CXXFLAGS="$CXXFLAGS" \ | CXXFLAGS="$ARCHLESS_CXXFLAGS" \ | ||||
CPPFLAGS="-stdlib=libc++ -D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=1" \ | CPPFLAGS="-D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=1" \ | ||||
LDFLAGS="$LDFLAGS" $CONF_OPTS \ | LDFLAGS="$ARCHLESS_LDFLAGS" $CONF_OPTS \ | ||||
&& make ${JOBS} && make install) || die "wxWidgets build failed" | && make ${JOBS} && make install) || die "wxWidgets build failed" | ||||
popd | popd | ||||
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 168 Lines • ▼ Show 20 Lines | then | ||||
tar -xf $LIB_ARCHIVE | tar -xf $LIB_ARCHIVE | ||||
pushd $LIB_DIRECTORY | pushd $LIB_DIRECTORY | ||||
# NOTE: enable-fat in this case allows building and running on different CPUS. | # NOTE: enable-fat in this case allows building and running on different CPUS. | ||||
# Otherwise CPU-specific instructions will be used with no fallback for older CPUs. | # Otherwise CPU-specific instructions will be used with no fallback for older CPUs. | ||||
(./configure CFLAGS="$CFLAGS" \ | (./configure CFLAGS="$CFLAGS" \ | ||||
CXXFLAGS="$CXXFLAGS" \ | CXXFLAGS="$CXXFLAGS" \ | ||||
LDFLAGS="$LDFLAGS" \ | LDFLAGS="$LDFLAGS" \ | ||||
"$HOST_PLATFORM" \ | |||||
--prefix="$INSTALL_DIR" \ | --prefix="$INSTALL_DIR" \ | ||||
--enable-fat \ | --enable-fat \ | ||||
--disable-shared \ | --disable-shared \ | ||||
--with-pic \ | --with-pic \ | ||||
&& make ${JOBS} && make install) || die "GMP build failed" | && make ${JOBS} && make install) || die "GMP build failed" | ||||
popd | popd | ||||
cp -f lib/pkgconfig/* $PC_PATH | cp -f lib/pkgconfig/* $PC_PATH | ||||
▲ Show 20 Lines • Show All 130 Lines • ▼ Show 20 Lines | then | ||||
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 | ||||
# TODO: pulls in libresolv dependency from /usr/lib | # TODO: pulls in libresolv dependency from /usr/lib | ||||
(./configure CFLAGS="$CFLAGS" \ | (./configure CFLAGS="$CFLAGS" \ | ||||
CXXFLAGS="$CXXFLAGS" \ | CXXFLAGS="$CXXFLAGS" \ | ||||
LDFLAGS="$LDFLAGS" \ | LDFLAGS="$LDFLAGS" \ | ||||
"$HOST_PLATFORM" \ | |||||
--prefix="$INSTALL_DIR" \ | --prefix="$INSTALL_DIR" \ | ||||
GNUTLS_CFLAGS="-I${GNUTLS_DIR}/include" \ | GNUTLS_CFLAGS="-I${GNUTLS_DIR}/include" \ | ||||
GNUTLS_LIBS="-L${GNUTLS_DIR}/lib -lgnutls" \ | GNUTLS_LIBS="-L${GNUTLS_DIR}/lib -lgnutls" \ | ||||
--enable-shared=no \ | --enable-shared=no \ | ||||
--with-zlib="${ZLIB_DIR}" \ | --with-zlib="${ZLIB_DIR}" \ | ||||
--without-libidn \ | --without-libidn \ | ||||
--with-gnutls="yes" \ | --with-gnutls="yes" \ | ||||
--without-openssl \ | --without-openssl \ | ||||
Show All 32 Lines | then | ||||
tar -xf $LIB_ARCHIVE | tar -xf $LIB_ARCHIVE | ||||
pushd $LIB_DIRECTORY | pushd $LIB_DIRECTORY | ||||
mkdir -p source/build | mkdir -p source/build | ||||
pushd source/build | pushd source/build | ||||
(CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" \ | (CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" \ | ||||
../runConfigureICU MacOSX \ | ../runConfigureICU MacOSX \ | ||||
"$HOST_PLATFORM" \ | |||||
--prefix=$INSTALL_DIR \ | --prefix=$INSTALL_DIR \ | ||||
--disable-shared \ | --disable-shared \ | ||||
--enable-static \ | --enable-static \ | ||||
--disable-samples \ | --disable-samples \ | ||||
--enable-extras \ | --enable-extras \ | ||||
--enable-icuio \ | --enable-icuio \ | ||||
--enable-tools \ | --enable-tools \ | ||||
&& make ${JOBS} && make install) || die "ICU build failed" | && make ${JOBS} && make install) || die "ICU build failed" | ||||
▲ Show 20 Lines • Show All 146 Lines • ▼ Show 20 Lines | then | ||||
mkdir -p build | mkdir -p build | ||||
pushd build | pushd build | ||||
(cmake .. \ | (cmake .. \ | ||||
-DFMT_TEST=False \ | -DFMT_TEST=False \ | ||||
-DFMT_DOC=False \ | -DFMT_DOC=False \ | ||||
-DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \ | -DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \ | ||||
"$CMAKE_FLAGS" \ | |||||
&& make fmt ${JOBS} && make install) || die "fmt build failed" | && make fmt ${JOBS} && make install) || die "fmt build failed" | ||||
popd | popd | ||||
popd | popd | ||||
cp -f lib/pkgconfig/* $PC_PATH | cp -f lib/pkgconfig/* $PC_PATH | ||||
echo "$FMT_VERSION" > .already-built | echo "$FMT_VERSION" > .already-built | ||||
else | else | ||||
already_built | already_built | ||||
Show All 21 Lines | |||||
# 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" ]] | ||||
then | then | ||||
rm -f .already-built | rm -f .already-built | ||||
fi | fi | ||||
CXXFLAGS="$CXXFLAGS" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" JOBS="$JOBS" ./build.sh || die "Error building NVTT" | CXXFLAGS="$CXXFLAGS" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" CMAKE_FLAGS="$CMAKE_FLAGS" JOBS="$JOBS" ./build.sh || die "Error building NVTT" | ||||
popd > /dev/null | popd > /dev/null | ||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
# FCollada - bundled, no download | # FCollada - bundled, no download | ||||
pushd ../source/fcollada/ > /dev/null | pushd ../source/fcollada/ > /dev/null | ||||
if [[ "$force_rebuild" = "true" ]] | if [[ "$force_rebuild" = "true" ]] | ||||
then | then | ||||
rm -f .already-built | rm -f .already-built | ||||
fi | fi | ||||
CXXFLAGS="$CXXFLAGS" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" JOBS="$JOBS" ./build.sh || die "Error building FCollada" | CXXFLAGS="$CXXFLAGS" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" JOBS="$JOBS" ./build.sh || die "Error building FCollada" | ||||
popd > /dev/null | popd > /dev/null |
Wildfire Games · Phabricator