3 # Script for acquiring and building OS X dependencies for 0 A.D.
5 # The script checks whether a source tarball exists for each
6 # dependency, if not it will download the correct version from
7 # the project's website, then it removes previous build files,
8 # extracts the tarball, configures and builds the lib. The script
9 # should die on any errors to ease troubleshooting.
11 # make install is used to copy the compiled libs to each specific
12 # directory and also the config tools (e.g. sdl-config). Because
13 # of this, OS X developers must run this script at least once,
14 # to configure the correct lib directories. It must be run again
15 # if the libraries are moved.
17 # Building against an SDK is an option, though not required,
18 # as not all build environments contain the Developer SDKs
19 # (Xcode does, but the Command Line Tools package does not)
21 # --------------------------------------------------------------
22 # Library versions for ease of updating:
23 ZLIB_VERSION
="zlib-1.2.11"
24 CURL_VERSION
="curl-7.59.0"
25 ICONV_VERSION
="libiconv-1.15"
26 XML2_VERSION
="libxml2-2.9.8"
27 SDL2_VERSION
="SDL2-2.0.5"
28 BOOST_VERSION
="boost_1_64_0"
29 # NOTE: remember to also update LIB_URL below when changing version
30 WXWIDGETS_VERSION
="wxWidgets-3.0.3.1"
31 # libpng was included as part of X11 but that's removed from Mountain Lion
32 # (also the Snow Leopard version was ancient 1.2)
33 PNG_VERSION
="libpng-1.6.34"
34 OGG_VERSION
="libogg-1.3.3"
35 VORBIS_VERSION
="libvorbis-1.3.6"
36 # gloox is necessary for multiplayer lobby
37 GLOOX_VERSION
="gloox-1.0.20"
38 # NSPR is necessary for threadsafe Spidermonkey
40 # OS X only includes part of ICU, and only the dylib
41 # NOTE: remember to also update LIB_URL below when changing version
42 ICU_VERSION
="icu4c-59_1"
43 ENET_VERSION
="enet-1.3.13"
44 MINIUPNPC_VERSION
="miniupnpc-2.0.20180222"
45 SODIUM_VERSION
="libsodium-1.0.16"
46 # --------------------------------------------------------------
47 # Bundled with the game:
51 # --------------------------------------------------------------
55 # --------------------------------------------------------------
57 # Force build architecture, as sometimes environment is broken.
58 # For a universal fat binary, the approach would be to build every
59 # dependency with both archs and combine them with lipo, then do the
60 # same thing with the game itself.
61 # Choices are "x86_64" or "i386" (ppc and ppc64 not supported)
62 ARCH
=${ARCH:="x86_64"}
64 # Define compiler as "clang", this is all Mavericks supports.
65 # gcc symlinks may still exist, but they are simply clang with
66 # slightly different config, which confuses build scripts.
67 # llvm-gcc and gcc 4.2 are no longer supported by SpiderMonkey.
68 export CC
=${CC:="clang"} CXX
=${CXX:="clang++"}
69 export MIN_OSX_VERSION
=${MIN_OSX_VERSION:="10.9"}
71 # The various libs offer inconsistent configure options, some allow
72 # setting sysroot and OS X-specific options, others don't. Adding to
73 # the confusion, Apple moved /Developer/SDKs into the Xcode app bundle
74 # so the path can't be guessed by clever build tools (like Boost.Build).
75 # Sometimes configure gets it wrong anyway, especially on cross compiles.
76 # This is why we prefer using (OBJ)CFLAGS, (OBJ)CXXFLAGS, and LDFLAGS.
78 # Check if SYSROOT is set and not empty
79 if [[ $SYSROOT && ${SYSROOT-_} ]]; then
80 C_FLAGS
="-isysroot $SYSROOT"
81 LDFLAGS
="$LDFLAGS -Wl,-syslibroot,$SYSROOT"
83 # Check if MIN_OSX_VERSION is set and not empty
84 if [[ $MIN_OSX_VERSION && ${MIN_OSX_VERSION-_} ]]; then
85 C_FLAGS
="$C_FLAGS -mmacosx-version-min=$MIN_OSX_VERSION"
86 # clang and llvm-gcc look at mmacosx-version-min to determine link target
87 # and CRT version, and use it to set the macosx_version_min linker flag
88 LDFLAGS
="$LDFLAGS -mmacosx-version-min=$MIN_OSX_VERSION"
90 # Force using libc++ since it has better C++11 support required by the game
91 # but pre-Mavericks still use libstdc++ by default
92 # Also enable c++0x for consistency with the game build
93 C_FLAGS
="$C_FLAGS -arch $ARCH -fvisibility=hidden"
94 LDFLAGS
="$LDFLAGS -arch $ARCH -stdlib=libc++"
96 CFLAGS
="$CFLAGS $C_FLAGS"
97 CXXFLAGS
="$CXXFLAGS $C_FLAGS -stdlib=libc++ -std=c++0x"
98 OBJCFLAGS
="$OBJCFLAGS $C_FLAGS"
99 OBJCXXFLAGS
="$OBJCXXFLAGS $C_FLAGS"
116 if [ ! -e $filename ]; then
117 echo "Downloading $filename"
118 curl
-L -o ${filename} ${url}${filename} || die
"Download of $url$filename failed"
124 echo -e "Skipping - already built (use --force-rebuild to override)"
127 # Check that we're actually on OS X
128 if [ "`uname -s`" != "Darwin" ]; then
129 die
"This script is intended for OS X only"
132 # Parse command-line options:
138 --force-rebuild ) force_rebuild
=true
;;
144 # Now in libraries/osx/ (where we assume this script resides)
146 # --------------------------------------------------------------
147 echo -e "Building zlib..."
149 LIB_VERSION
="${ZLIB_VERSION}"
150 LIB_ARCHIVE
="$LIB_VERSION.tar.gz"
151 LIB_DIRECTORY
=$LIB_VERSION
152 LIB_URL
="http://zlib.net/"
155 pushd zlib
> /dev
/null
159 if [[ "$force_rebuild" = "true" ]] ||
[[ ! -e .already-built
]] ||
[[ .already-built
-ot $LIB_DIRECTORY ]]
162 download_lib
$LIB_URL $LIB_ARCHIVE
164 rm -rf $LIB_DIRECTORY include lib share
168 # patch zlib's configure script to use our CFLAGS and LDFLAGS
169 (patch -p0 -i ..
/..
/patches
/zlib_flags.
diff && CFLAGS
="$CFLAGS" LDFLAGS
="$LDFLAGS" .
/configure
--prefix="$ZLIB_DIR" --static && make ${JOBS} && make install) || die
"zlib build failed"
177 # --------------------------------------------------------------
178 echo -e "Building libcurl..."
180 LIB_VERSION
="${CURL_VERSION}"
181 LIB_ARCHIVE
="$LIB_VERSION.tar.bz2"
182 LIB_DIRECTORY
="$LIB_VERSION"
183 LIB_URL
="http://curl.haxx.se/download/"
186 pushd libcurl
> /dev
/null
188 if [[ "$force_rebuild" = "true" ]] ||
[[ ! -e .already-built
]] ||
[[ .already-built
-ot $LIB_DIRECTORY ]]
193 download_lib
$LIB_URL $LIB_ARCHIVE
195 rm -rf $LIB_DIRECTORY bin include lib share
199 (.
/configure CFLAGS
="$CFLAGS" LDFLAGS
="$LDFLAGS" --prefix="$INSTALL_DIR" --enable-ipv6 --with-darwinssl --without-gssapi --without-libmetalink --without-librtmp --without-libssh2 --without-nss --without-polarssl --without-spnego --disable-ares --disable-ldap --disable-ldaps --without-libidn --with-zlib="${ZLIB_DIR}" --enable-shared=no
&& make ${JOBS} && make install) || die
"libcurl build failed"
207 # --------------------------------------------------------------
208 echo -e "Building libiconv..."
210 LIB_VERSION
="${ICONV_VERSION}"
211 LIB_ARCHIVE
="$LIB_VERSION.tar.gz"
212 LIB_DIRECTORY
="$LIB_VERSION"
213 LIB_URL
="http://ftp.gnu.org/pub/gnu/libiconv/"
216 pushd iconv > /dev
/null
220 if [[ "$force_rebuild" = "true" ]] ||
[[ ! -e .already-built
]] ||
[[ .already-built
-ot $LIB_DIRECTORY ]]
223 download_lib
$LIB_URL $LIB_ARCHIVE
225 rm -rf $LIB_DIRECTORY bin include lib share
229 (.
/configure CFLAGS
="$CFLAGS" LDFLAGS
="$LDFLAGS" --prefix="$ICONV_DIR" --without-libiconv-prefix --without-libintl-prefix --disable-nls --enable-shared=no
&& make ${JOBS} && make install) || die
"libiconv build failed"
237 # --------------------------------------------------------------
238 echo -e "Building libxml2..."
240 LIB_VERSION
="${XML2_VERSION}"
241 LIB_ARCHIVE
="$LIB_VERSION.tar.gz"
242 LIB_DIRECTORY
="$LIB_VERSION"
243 LIB_URL
="ftp://xmlsoft.org/libxml2/"
246 pushd libxml2
> /dev
/null
248 if [[ "$force_rebuild" = "true" ]] ||
[[ ! -e .already-built
]] ||
[[ .already-built
-ot $LIB_DIRECTORY ]]
253 download_lib
$LIB_URL $LIB_ARCHIVE
255 rm -rf $LIB_DIRECTORY bin include lib share
259 (.
/configure CFLAGS
="$CFLAGS" LDFLAGS
="$LDFLAGS" --prefix="$INSTALL_DIR" --without-lzma --without-python --with-iconv="${ICONV_DIR}" --with-zlib="${ZLIB_DIR}" --enable-shared=no && make ${JOBS} && make install) || die "libxml2 build failed
"
267 # --------------------------------------------------------------
269 echo -e "Building SDL2...
"
271 LIB_VERSION="${SDL2_VERSION}"
272 LIB_ARCHIVE="$LIB_VERSION.
tar.gz
"
273 LIB_DIRECTORY=$LIB_VERSION
274 LIB_URL="https
://libsdl.org
/release
/"
277 pushd sdl2 > /dev/null
279 if [[ "$force_rebuild" = "true
" ]] || [[ ! -e .already-built ]] || [[ .already-built -ot $LIB_DIRECTORY ]]
284 download_lib $LIB_URL $LIB_ARCHIVE
286 rm -rf $LIB_DIRECTORY bin include lib share
290 # We don't want SDL2 to pull in system iconv, force it to detect ours with flags.
291 # Don't use X11 - we don't need it and Mountain Lion removed it
292 (./configure CPPFLAGS="-I${ICONV_DIR}/include
" CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS -L${ICONV_DIR}/lib
" --prefix="$INSTALL_DIR" --disable-video-x11 --without-x --enable-shared=no && make $JOBS && make install) || die "SDL2 build failed
"
300 # --------------------------------------------------------------
301 echo -e "Building Boost...
"
303 LIB_VERSION="${BOOST_VERSION}"
304 LIB_ARCHIVE="$LIB_VERSION.
tar.bz2
"
305 LIB_DIRECTORY="$LIB_VERSION"
306 LIB_URL="http
://download.sourceforge.net
/boost
/"
309 pushd boost > /dev/null
311 if [[ "$force_rebuild" = "true
" ]] || [[ ! -e .already-built ]] || [[ .already-built -ot $LIB_DIRECTORY ]]
316 download_lib $LIB_URL $LIB_ARCHIVE
318 rm -rf $LIB_DIRECTORY include lib
322 # Can't use macosx-version, see above comment.
323 (./bootstrap.sh --with-libraries=filesystem,system --prefix=$INSTALL_DIR && ./b2 cflags="$CFLAGS" toolset=clang cxxflags="$CXXFLAGS" linkflags="$LDFLAGS" ${JOBS} -d2 --layout=tagged --debug-configuration link=static threading=multi variant=release,debug install) || die "Boost build failed
"
332 # --------------------------------------------------------------
333 # TODO: This build takes ages, anything we can exclude?
334 echo -e "Building wxWidgets...
"
336 LIB_VERSION="${WXWIDGETS_VERSION}"
337 LIB_ARCHIVE="$LIB_VERSION.
tar.bz2
"
338 LIB_DIRECTORY="$LIB_VERSION"
339 LIB_URL="http
://github.com
/wxWidgets
/wxWidgets
/releases
/download
/v3.0
.3.1/"
342 pushd wxwidgets > /dev/null
344 if [[ "$force_rebuild" = "true
" ]] || [[ ! -e .already-built ]] || [[ .already-built -ot $LIB_DIRECTORY ]]
349 download_lib $LIB_URL $LIB_ARCHIVE
351 rm -rf $LIB_DIRECTORY bin include lib share
355 mkdir -p build-release
358 CONF_OPTS="--prefix=$INSTALL_DIR --disable-shared --enable-macosx_arch=$ARCH --enable-unicode --with-cocoa --with-opengl --with-libiconv-prefix=${ICONV_DIR} --with-expat=builtin --with-png=builtin --without-libtiff --without-sdl --without-x --disable-webview --disable-webkit --disable-webviewwebkit --disable-webviewie"
359 # wxWidgets configure now defaults to targeting 10.5, if not specified,
360 # but that conflicts with our flags
361 if [[ $MIN_OSX_VERSION && ${MIN_OSX_VERSION-_} ]]; then
362 CONF_OPTS="$CONF_OPTS --with-macosx-version-min=$MIN_OSX_VERSION"
364 (../configure CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" CPPFLAGS="-stdlib=libc
++ -D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=1" LDFLAGS="$LDFLAGS" $CONF_OPTS && make ${JOBS} && make install) || die "wxWidgets build failed
"
373 # --------------------------------------------------------------
374 echo -e "Building libpng...
"
376 LIB_VERSION="${PNG_VERSION}"
377 LIB_ARCHIVE="$LIB_VERSION.
tar.gz
"
378 LIB_DIRECTORY="$LIB_VERSION"
379 LIB_URL="http
://download.sourceforge.net
/libpng
/"
382 pushd libpng > /dev/null
384 if [[ "$force_rebuild" = "true
" ]] || [[ ! -e .already-built ]] || [[ .already-built -ot $LIB_DIRECTORY ]]
389 download_lib $LIB_URL $LIB_ARCHIVE
391 rm -rf $LIB_DIRECTORY bin include lib share
395 (./configure CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" --prefix=$INSTALL_DIR --enable-shared=no && make ${JOBS} && make install) || die "libpng build failed
"
403 # --------------------------------------------------------------
404 echo -e "Building libogg...
"
406 LIB_VERSION="${OGG_VERSION}"
407 LIB_ARCHIVE="$LIB_VERSION.
tar.gz
"
408 LIB_DIRECTORY="$LIB_VERSION"
409 LIB_URL="http
://downloads.xiph.org
/releases
/ogg
/"
411 # Dependency of vorbis
412 # we can install them in the same directory for convenience
416 pushd libogg > /dev/null
419 if [[ "$force_rebuild" = "true
" ]] || [[ ! -e .already-built ]] || [[ .already-built -ot $LIB_DIRECTORY ]]
422 download_lib $LIB_URL $LIB_ARCHIVE
424 rm -rf $LIB_DIRECTORY include lib share
428 (./configure CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" --prefix=$OGG_DIR --enable-shared=no && make ${JOBS} && make install) || die "libogg build failed
"
436 # --------------------------------------------------------------
437 echo -e "Building libvorbis...
"
439 LIB_VERSION="${VORBIS_VERSION}"
440 LIB_ARCHIVE="$LIB_VERSION.
tar.gz
"
441 LIB_DIRECTORY="$LIB_VERSION"
442 LIB_URL="http
://downloads.xiph.org
/releases
/vorbis
/"
444 pushd vorbis > /dev/null
446 if [[ "$force_rebuild" = "true
" ]] || [[ ! -e .already-built ]] || [[ .already-built -ot $LIB_DIRECTORY ]]
451 download_lib $LIB_URL $LIB_ARCHIVE
453 rm -rf $LIB_DIRECTORY include lib share
457 (./configure CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" --prefix="$INSTALL_DIR" --enable-shared=no --with-ogg="$OGG_DIR" && make ${JOBS} && make install) || die "libvorbis build failed
"
465 # --------------------------------------------------------------
466 echo -e "Building gloox...
"
468 LIB_VERSION="${GLOOX_VERSION}"
469 LIB_ARCHIVE="$LIB_VERSION.
tar.bz2
"
470 LIB_DIRECTORY="$LIB_VERSION"
471 LIB_URL="http
://camaya.net
/download
/"
474 pushd gloox > /dev/null
476 if [[ "$force_rebuild" = "true
" ]] || [[ ! -e .already-built ]] || [[ .already-built -ot $LIB_DIRECTORY ]]
481 download_lib $LIB_URL $LIB_ARCHIVE
483 rm -rf $LIB_DIRECTORY bin include lib
487 # TODO: pulls in libresolv dependency from /usr/lib
488 # TODO: if we ever use SSL/TLS, that will add yet another dependency...
489 (./configure CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" --prefix="$INSTALL_DIR" --enable-shared=no --with-zlib="${ZLIB_DIR}" --without-libidn --without-gnutls --without-openssl --without-tests --without-examples && make ${JOBS} && make install) || die "gloox build failed
"
497 # --------------------------------------------------------------
498 echo -e "Building NSPR...
"
500 LIB_VERSION="${NSPR_VERSION}"
501 LIB_ARCHIVE="nspr-
$LIB_VERSION.
tar.gz
"
502 LIB_DIRECTORY="nspr-
$LIB_VERSION"
503 LIB_URL="https
://ftp.mozilla.org
/pub
/mozilla.org
/nspr
/releases
/v
$LIB_VERSION/src
/"
506 pushd nspr > /dev/null
510 if [[ "$force_rebuild" = "true
" ]] || [[ ! -e .already-built ]] || [[ .already-built -ot $LIB_DIRECTORY ]]
513 download_lib $LIB_URL $LIB_ARCHIVE
515 rm -rf $LIB_DIRECTORY bin include lib share
517 pushd $LIB_DIRECTORY/nspr
519 (CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" ./configure --prefix="$NSPR_DIR" && make ${JOBS} && make install) || die "NSPR build failed
"
521 # TODO: how can we not build the dylibs?
529 # --------------------------------------------------------------
530 echo -e "Building ICU...
"
532 LIB_VERSION="${ICU_VERSION}"
533 LIB_ARCHIVE="$LIB_VERSION-src.tgz
"
535 LIB_URL="http
://download.icu-project.org
/files
/icu4c
/59.1/"
538 pushd icu > /dev/null
540 if [[ "$force_rebuild" = "true
" ]] || [[ ! -e .already-built ]] || [[ .already-built -ot $LIB_DIRECTORY ]]
545 download_lib $LIB_URL $LIB_ARCHIVE
547 rm -rf $LIB_DIRECTORY bin include lib sbin share
551 mkdir -p source/build
554 (CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" ../runConfigureICU MacOSX --prefix=$INSTALL_DIR --disable-shared --enable-static --disable-samples --enable-extras --enable-icuio --enable-tools && make ${JOBS} && make install) || die "ICU build failed
"
563 # --------------------------------------------------------------
564 echo -e "Building ENet...
"
566 LIB_VERSION="${ENET_VERSION}"
567 LIB_ARCHIVE="$LIB_VERSION.
tar.gz
"
568 LIB_DIRECTORY="$LIB_VERSION"
569 LIB_URL="http
://enet.bespin.org
/download
/"
572 pushd enet > /dev/null
574 if [[ "$force_rebuild" = "true
" ]] || [[ ! -e .already-built ]] || [[ .already-built -ot $LIB_DIRECTORY ]]
579 download_lib $LIB_URL $LIB_ARCHIVE
581 rm -rf $LIB_DIRECTORY bin include lib sbin share
585 (./configure CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" --prefix=${INSTALL_DIR} --enable-shared=no && make clean && make ${JOBS} && make install) || die "ENet build failed
"
593 # --------------------------------------------------------------
594 echo -e "Building MiniUPnPc...
"
596 LIB_VERSION="${MINIUPNPC_VERSION}"
597 LIB_ARCHIVE="$LIB_VERSION.
tar.gz
"
598 LIB_DIRECTORY="$LIB_VERSION"
599 LIB_URL="http
://miniupnp.tuxfamily.org
/files
/download.php?
file="
602 pushd miniupnpc > /dev/null
604 if [[ "$force_rebuild" = "true
" ]] || [[ ! -e .already-built ]] || [[ .already-built -ot $LIB_DIRECTORY ]]
609 download_lib $LIB_URL $LIB_ARCHIVE
611 rm -rf $LIB_DIRECTORY bin include lib share
615 (make clean && CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS make ${JOBS} && INSTALLPREFIX="$INSTALL_DIR" make install) || die "MiniUPnPc build failed
"
617 # TODO: how can we not build the dylibs?
625 # --------------------------------------------------------------
626 echo -e "Building libsodium...
"
628 LIB_VERSION="${SODIUM_VERSION}"
629 LIB_ARCHIVE="$SODIUM_VERSION.
tar.gz
"
630 LIB_DIRECTORY="$LIB_VERSION"
631 LIB_URL="https
://download.libsodium.org
/libsodium
/releases
/"
634 pushd libsodium > /dev/null
636 if [[ "$force_rebuild" = "true
" ]] || [[ ! -e .already-built ]] || [[ .already-built -ot $LIB_DIRECTORY ]]
641 download_lib $LIB_URL $LIB_ARCHIVE
643 rm -rf $LIB_DIRECTORY include lib
647 (./configure CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" --prefix=${INSTALL_DIR} && make clean && CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS make ${JOBS} && make check && INSTALLPREFIX="$INSTALL_DIR" make install) || die "libsodium build failed
"
655 # --------------------------------------------------------------------
656 # The following libraries are shared on different OSes and may
657 # be customized, so we build and install them from bundled sources
658 # --------------------------------------------------------------------
659 echo -e "Building Spidermonkey...
"
660 LIB_VERSION="mozjs-38.2
.1"
661 LIB_ARCHIVE="$LIB_VERSION.rc0.
tar.bz2
"
662 LIB_DIRECTORY="mozjs-38.0
.0"
664 pushd ../source/spidermonkey/ > /dev/null
666 if [[ "$force_rebuild" = "true
" ]] || [[ ! -e .already-built ]] || [[ .already-built -ot $LIB_DIRECTORY ]] || [[ .already-built -ot README.txt ]]
669 INCLUDE_DIR_DEBUG=$INSTALL_DIR/include-unix-debug
670 INCLUDE_DIR_RELEASE=$INSTALL_DIR/include-unix-release
674 rm -rf $LIB_DIRECTORY $INCLUDE_DIR_DEBUG $INCLUDE_DIR_RELEASE
682 pushd $LIB_DIRECTORY/js/src
683 # We want separate debug/release versions of the library, so change their install name in the Makefile
684 perl -i.bak -pe 's/(^STATIC_LIBRARY_NAME\s+=).*/$1'\''mozjs38-ps-debug'\''/' moz.build
686 CONF_OPTS="--target=$ARCH-apple-darwin --prefix=${INSTALL_DIR} --with-system-nspr --with-nspr-prefix=${NSPR_DIR} --with-system-zlib=${ZLIB_DIR} --disable-tests --disable-shared-js"
687 # Change the default location where the tracelogger should store its output, which is /tmp/ on OSX.
688 TLCXXFLAGS='-DTRACE_LOG_DIR="\"..
/..
/source
/tools
/tracelogger
/\""'
689 # Uncomment this line for 32-bit 10.5 cross compile:
690 #CONF_OPTS="$CONF_OPTS --target=i386-apple-darwin9.0
.0"
691 if [[ $MIN_OSX_VERSION && ${MIN_OSX_VERSION-_} ]]; then
692 CONF_OPTS="$CONF_OPTS --enable-macos-target=$MIN_OSX_VERSION"
694 if [[ $SYSROOT && ${SYSROOT-_} ]]; then
695 CONF_OPTS="$CONF_OPTS --with-macosx-sdk=$SYSROOT"
700 (CC="clang
" CXX="clang
++" CXXFLAGS="${TLCXXFLAGS}" AR=ar CROSS_COMPILE=1 ../configure $CONF_OPTS --enable-debug --disable-optimize --enable-js-diagnostics --enable-gczeal && make ${JOBS}) || die "Spidermonkey build failed
"
701 # js-config.h is different for debug and release builds, so we need different include directories for both
702 mkdir -p $INCLUDE_DIR_DEBUG
703 cp -R -L dist/include/* $INCLUDE_DIR_DEBUG/
704 cp dist/lib/*.a $INSTALL_DIR/lib
706 mv moz.build.bak moz.build
708 perl -i.bak -pe 's/(^STATIC_LIBRARY_NAME\s+=).*/$1'\''mozjs38-ps-release'\''/' moz.build
709 mkdir -p build-release
711 (CC="clang
" CXX="clang
++" CXXFLAGS="${TLCXXFLAGS}" AR=ar CROSS_COMPILE=1 ../configure $CONF_OPTS --enable-optimize && make ${JOBS}) || die "Spidermonkey build failed
"
712 # js-config.h is different for debug and release builds, so we need different include directories for both
713 mkdir -p $INCLUDE_DIR_RELEASE
714 cp -R -L dist/include/* $INCLUDE_DIR_RELEASE/
715 cp dist/lib/*.a $INSTALL_DIR/lib
717 mv moz.build.bak moz.build
726 # --------------------------------------------------------------
728 echo -e "Building NVTT...
"
730 pushd ../source/nvtt > /dev/null
732 if [[ "$force_rebuild" = "true
" ]] || [[ ! -e .already-built ]]
742 # Could use CMAKE_OSX_DEPLOYMENT_TARGET and CMAKE_OSX_SYSROOT
743 # but they're not as flexible for cross-compiling
744 # Disable optional libs that we don't need (avoids some conflicts with MacPorts)
745 (cmake .. -DCMAKE_LINK_FLAGS="$LDFLAGS" -DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_CXX_FLAGS="$CXXFLAGS" -DCMAKE_BUILD_TYPE=Release -DBINDIR=bin -DLIBDIR=lib -DGLUT=0 -DGLEW=0 -DCG=0 -DCUDA=0 -DOPENEXR=0 -DJPEG=0 -DPNG=0 -DTIFF=0 -G "Unix Makefiles
" && make clean && make nvtt ${JOBS}) || die "NVTT build failed
"
749 cp build/src/nv*/libnv*.a ../lib/
750 cp build/src/nvtt/squish/libsquish.a ../lib/
758 # --------------------------------------------------------------
759 # FCollada - no install
760 echo -e "Building FCollada...
"
762 pushd ../source/fcollada > /dev/null
764 if [[ "$force_rebuild" = "true
" ]] || [[ ! -e .already-built ]]
772 # The Makefile refers to pkg-config for libxml2, but we
773 # don't have that (replace with xml2-config instead)
774 sed -i.bak -e 's/pkg-config libxml-2.0/xml2-config/' Makefile
775 (make clean && CXXFLAGS=$CXXFLAGS make ${JOBS}) || die "FCollada build failed
"
776 # Undo Makefile change
777 mv Makefile.bak Makefile