diff --git a/build/premake/extern_libs4.lua b/build/premake/extern_libs4.lua
index e6c74eb..674cf67 100644
a
|
b
|
extern_lib_defs = {
|
571 | 571 | else |
572 | 572 | if os.is("windows") then |
573 | 573 | include_dir = "include-win32" |
574 | | elseif os.is("macosx") then |
575 | | include_dir = "include-unix" |
576 | 574 | else |
577 | 575 | include_dir = "include-unix" |
578 | 576 | end |
… |
… |
extern_lib_defs = {
|
593 | 591 | -- pkgconfig_libs("mozjs185") |
594 | 592 | --end |
595 | 593 | else |
| 594 | if os.is("macosx") then |
| 595 | add_default_lib_paths("nspr") |
| 596 | links { "nspr4", "plc4", "plds4" } |
| 597 | end |
596 | 598 | configuration "Debug" |
597 | 599 | links { "mozjs24-ps-debug" } |
598 | 600 | configuration "Release" |
diff --git a/libraries/osx/build-osx-libs.sh b/libraries/osx/build-osx-libs.sh
index f3a0a2b..cb85759 100755
a
|
b
|
OGG_VERSION="libogg-1.3.0"
|
38 | 38 | VORBIS_VERSION="libvorbis-1.3.3" |
39 | 39 | # gloox is necessary for multiplayer lobby |
40 | 40 | GLOOX_VERSION="gloox-1.0.9" |
| 41 | # NSPR is necessary for threadsafe Spidermonkey |
| 42 | NSPR_VERSION="4.10.3" |
41 | 43 | # -------------------------------------------------------------- |
42 | 44 | # Bundled with the game: |
43 | | # * SpiderMonkey 1.8.5 |
| 45 | # * SpiderMonkey 24 |
44 | 46 | # * ENet 1.3.3 |
45 | 47 | # * NVTT |
46 | 48 | # * FCollada |
… |
… |
else
|
518 | 520 | fi |
519 | 521 | popd > /dev/null |
520 | 522 | |
| 523 | # -------------------------------------------------------------- |
| 524 | echo -e "Building NSPR..." |
| 525 | |
| 526 | LIB_VERSION="${NSPR_VERSION}" |
| 527 | LIB_ARCHIVE="nspr-$LIB_VERSION.tar.gz" |
| 528 | LIB_DIRECTORY="nspr-$LIB_VERSION" |
| 529 | LIB_URL="https://ftp.mozilla.org/pub/mozilla.org/nspr/releases/v$LIB_VERSION/src/" |
| 530 | |
| 531 | mkdir -p nspr |
| 532 | pushd nspr > /dev/null |
| 533 | |
| 534 | NSPR_DIR="$(pwd)" |
| 535 | |
| 536 | if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ .already-built -ot $LIB_DIRECTORY ]] |
| 537 | then |
| 538 | rm -f .already-built |
| 539 | download_lib $LIB_URL $LIB_ARCHIVE |
| 540 | |
| 541 | rm -rf $LIB_DIRECTORY bin include lib share |
| 542 | tar -xf $LIB_ARCHIVE |
| 543 | pushd $LIB_DIRECTORY/nspr |
| 544 | |
| 545 | (CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" ./configure --prefix="$NSPR_DIR" && make ${JOBS} && make install) || die "NSPR build failed" |
| 546 | popd |
| 547 | # TODO: how can we not build the dylibs? |
| 548 | rm -f lib/*.dylib |
| 549 | touch .already-built |
| 550 | else |
| 551 | already_built |
| 552 | fi |
| 553 | popd > /dev/null |
| 554 | |
521 | 555 | # -------------------------------------------------------------------- |
522 | 556 | # The following libraries are shared on different OSes and may |
523 | 557 | # be customzied, so we build and install them from bundled sources |
524 | 558 | # -------------------------------------------------------------------- |
525 | 559 | echo -e "Building Spidermonkey..." |
526 | 560 | |
527 | | LIB_VERSION="js185-1.0.0" |
528 | | LIB_ARCHIVE="$LIB_VERSION.tar.gz" |
529 | | LIB_DIRECTORY="js-1.8.5" |
| 561 | LIB_VERSION="mozjs-24.2.0" |
| 562 | LIB_ARCHIVE="$LIB_VERSION.tar.bz2" |
| 563 | LIB_DIRECTORY="mozjs24" |
530 | 564 | |
531 | 565 | pushd ../source/spidermonkey/ > /dev/null |
532 | 566 | |
533 | 567 | if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ .already-built -ot $LIB_DIRECTORY ]] |
534 | 568 | then |
535 | 569 | INSTALL_DIR="$(pwd)" |
| 570 | INCLUDE_DIR_DEBUG=$INSTALL_DIR/include-unix-debug |
| 571 | INCLUDE_DIR_RELEASE=$INSTALL_DIR/include-unix-release |
536 | 572 | |
537 | 573 | rm -f .already-built |
538 | 574 | rm -f lib/*.a |
539 | | rm -rf $LIB_DIRECTORY |
| 575 | rm -rf $LIB_DIRECTORY $INCLUDE_DIR_DEBUG $INCLUDE_DIR_RELEASE |
540 | 576 | tar -xf $LIB_ARCHIVE |
| 577 | # rename the extracted directory to something shorter |
| 578 | mv $LIB_VERSION $LIB_DIRECTORY |
541 | 579 | pushd $LIB_DIRECTORY/js/src |
542 | 580 | |
| 581 | NSPR_INCLUDES="`${NSPR_DIR}/bin/nspr-config --cflags`" |
| 582 | NSPR_LIBS="`${NSPR_DIR}/bin/nspr-config --libs`" |
| 583 | |
543 | 584 | # We want separate debug/release versions of the library, so change their install name in the Makefile |
544 | | sed -i.bak -e 's/\(STATIC_LIBRARY_NAME),mozjs185-\)\(\$(SRCREL_ABI_VERSION)\)\{0,1\}/\1ps-debug/' Makefile.in |
| 585 | perl -i.bak -pe 's/(^STATIC_LIBRARY_NAME\s+=).*/$1mozjs24-ps-debug/' Makefile.in |
| 586 | perl -i.bak -pe 's/js_static/mozjs24-ps-debug/g' shell/Makefile.in |
545 | 587 | |
546 | | CONF_OPTS="--prefix=${INSTALL_DIR} --disable-tests --disable-shared-js" |
| 588 | CONF_OPTS="--prefix=${INSTALL_DIR} --enable-threadsafe --disable-tests --disable-shared-js" # --enable-trace-logging" |
547 | 589 | # Uncomment this line for 32-bit 10.5 cross compile: |
548 | 590 | #CONF_OPTS="$CONF_OPTS --target=i386-apple-darwin9.0.0" |
549 | 591 | if [[ $MIN_OSX_VERSION && ${MIN_OSX_VERSION-_} ]]; then |
… |
… |
then
|
555 | 597 | |
556 | 598 | mkdir -p build-debug |
557 | 599 | pushd build-debug |
558 | | (CC="$CC -arch $ARCH" CXX="$CXX -arch $ARCH" AR=ar CROSS_COMPILE=1 ../configure $CONF_OPTS --enable-debug --disable-optimize && make ${JOBS} && make install) || die "Spidermonkey build failed" |
| 600 | (CC="clang -arch $ARCH" CXX="clang++ -arch $ARCH" AR=ar CROSS_COMPILE=1 ../configure $CONF_OPTS --enable-debug --disable-optimize --enable-js-diagnostics --enable-gczeal --with-nspr-libs="$NSPR_LIBS" --with-nspr-cflags="$NSPR_INCLUDES" && make ${JOBS}) || die "Spidermonkey build failed" |
| 601 | # js-config.h is different for debug and release builds, so we need different include directories for both |
| 602 | mkdir -p $INCLUDE_DIR_DEBUG |
| 603 | cp -R -L dist/include/* $INCLUDE_DIR_DEBUG/ |
| 604 | cp *.a $INSTALL_DIR/lib |
559 | 605 | popd |
560 | 606 | mv Makefile.in.bak Makefile.in |
561 | | |
562 | | sed -i.bak -e 's/\(STATIC_LIBRARY_NAME),mozjs185-\)\(\$(SRCREL_ABI_VERSION)\)\{0,1\}/\1ps-release/' Makefile.in |
| 607 | mv shell/Makefile.in.bak shell/Makefile.in |
563 | 608 | |
| 609 | perl -i.bak -pe 's/(^STATIC_LIBRARY_NAME\s+=).*/$1mozjs24-ps-release/' Makefile.in |
| 610 | perl -i.bak -pe 's/js_static/mozjs24-ps-release/g' shell/Makefile.in |
564 | 611 | mkdir -p build-release |
565 | 612 | pushd build-release |
566 | | (CC="$CC -arch $ARCH" CXX="$CXX -arch $ARCH" AR=ar CROSS_COMPILE=1 ../configure $CONF_OPTS && make ${JOBS} && make install) || die "Spidermonkey build failed" |
| 613 | (CC="clang -arch $ARCH" CXX="clang++ -arch $ARCH" AR=ar CROSS_COMPILE=1 ../configure $CONF_OPTS --enable-optimize --with-nspr-libs="$NSPR_LIBS" --with-nspr-cflags="$NSPR_INCLUDES" && make ${JOBS}) || die "Spidermonkey build failed" |
| 614 | # js-config.h is different for debug and release builds, so we need different include directories for both |
| 615 | mkdir -p $INCLUDE_DIR_RELEASE |
| 616 | cp -R -L dist/include/* $INCLUDE_DIR_RELEASE/ |
| 617 | cp *.a $INSTALL_DIR/lib |
567 | 618 | popd |
568 | 619 | mv Makefile.in.bak Makefile.in |
| 620 | mv shell/Makefile.in.bak shell/Makefile.in |
569 | 621 | |
570 | 622 | popd |
571 | 623 | touch .already-built |