Ticket #2442: 0ad_mozjs24_osx_build_fixes_03102014.patch
File 0ad_mozjs24_osx_build_fixes_03102014.patch, 8.6 KB (added by , 10 years ago) |
---|
-
libraries/osx/build-osx-libs.sh
diff --git a/libraries/osx/build-osx-libs.sh b/libraries/osx/build-osx-libs.sh index 16f4a26..7718304 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 # NSPR is necessary for threadsafe Spidermonkey 42 NSPR_VERSION="4.10.3" 43 43 # -------------------------------------------------------------- 44 44 # Bundled with the game: 45 # * SpiderMonkey 24 45 # * SpiderMonkey 24 46 46 # * ENet 1.3.3 47 47 # * NVTT 48 48 # * FCollada … … else 520 520 fi 521 521 popd > /dev/null 522 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 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 555 555 # -------------------------------------------------------------------- 556 556 # The following libraries are shared on different OSes and may 557 557 # be customzied, so we build and install them from bundled sources 558 558 # -------------------------------------------------------------------- 559 559 echo -e "Building Spidermonkey..." 560 560 561 LIB_VERSION="mozjs-24.2.0" 562 LIB_ARCHIVE="$LIB_VERSION.tar.bz2" 563 LIB_DIRECTORY="mozjs24" 561 LIB_VERSION="mozjs-24.2.0" 562 LIB_ARCHIVE="$LIB_VERSION.tar.bz2" 563 LIB_DIRECTORY="mozjs24" 564 564 565 565 pushd ../source/spidermonkey/ > /dev/null 566 566 567 567 if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ .already-built -ot $LIB_DIRECTORY ]] 568 568 then 569 569 INSTALL_DIR="$(pwd)" 570 INCLUDE_DIR_DEBUG=$INSTALL_DIR/include-unix-debug 571 INCLUDE_DIR_RELEASE=$INSTALL_DIR/include-unix-release 570 INCLUDE_DIR_DEBUG=$INSTALL_DIR/include-unix-debug 571 INCLUDE_DIR_RELEASE=$INSTALL_DIR/include-unix-release 572 572 573 573 rm -f .already-built 574 574 rm -f lib/*.a 575 rm -rf $LIB_DIRECTORY $INCLUDE_DIR_DEBUG $INCLUDE_DIR_RELEASE 575 rm -rf $LIB_DIRECTORY $INCLUDE_DIR_DEBUG $INCLUDE_DIR_RELEASE 576 576 tar -xf $LIB_ARCHIVE 577 # rename the extracted directory to something shorter 578 mv $LIB_VERSION $LIB_DIRECTORY 577 # rename the extracted directory to something shorter 578 mv $LIB_VERSION $LIB_DIRECTORY 579 579 pushd $LIB_DIRECTORY/js/src 580 580 581 NSPR_INCLUDES="`${NSPR_DIR}/bin/nspr-config --cflags`"582 NSPR_LIBS="`${NSPR_DIR}/bin/nspr-config --libs`"583 584 581 # We want separate debug/release versions of the library, so change their install name in the Makefile 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 582 perl -i.bak -pe 's/(^STATIC_LIBRARY_NAME\s+=).*/$1mozjs24-ps-debug/' Makefile.in 583 perl -i.bak -pe 's/js_static/mozjs24-ps-debug/g' shell/Makefile.in 587 584 588 CONF_OPTS="-- prefix=${INSTALL_DIR} --enable-threadsafe --disable-tests --disable-shared-js" # --enable-trace-logging"585 CONF_OPTS="--target=$ARCH-apple-darwin --prefix=${INSTALL_DIR} --with-system-nspr --with-nspr-prefix=${NSPR_DIR} --with-system-zlib=${ZLIB_DIR} --enable-threadsafe --disable-tests --disable-shared-js" # --enable-trace-logging" 589 586 # Uncomment this line for 32-bit 10.5 cross compile: 590 587 #CONF_OPTS="$CONF_OPTS --target=i386-apple-darwin9.0.0" 591 588 if [[ $MIN_OSX_VERSION && ${MIN_OSX_VERSION-_} ]]; then … … then 595 592 CONF_OPTS="$CONF_OPTS --with-macosx-sdk=$SYSROOT" 596 593 fi 597 594 595 # apply patch to fix clang build on Mavericks (see https://bugzilla.mozilla.org/show_bug.cgi?id=917526) 596 patch -p0 -d ../../ -i ../../../osx/patches/sm-mavericks-clang-fix.diff || die "Spidermonkey build failed" 597 598 598 mkdir -p build-debug 599 599 pushd build-debug 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 600 (CC="clang" CXX="clang++" AR=ar CROSS_COMPILE=1 ../configure $CONF_OPTS --enable-debug --disable-optimize --enable-js-diagnostics --enable-gczeal && 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 605 605 popd 606 606 mv Makefile.in.bak Makefile.in 607 mv shell/Makefile.in.bak shell/Makefile.in 607 mv shell/Makefile.in.bak shell/Makefile.in 608 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 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 611 611 mkdir -p build-release 612 612 pushd build-release 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 613 (CC="clang" CXX="clang++" AR=ar CROSS_COMPILE=1 ../configure $CONF_OPTS --enable-optimize && 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 618 618 popd 619 619 mv Makefile.in.bak Makefile.in 620 mv shell/Makefile.in.bak shell/Makefile.in 620 mv shell/Makefile.in.bak shell/Makefile.in 621 621 622 622 popd 623 623 touch .already-built -
new file libraries/osx/patches/sm-mavericks-clang-fix.diff
diff --git a/libraries/osx/patches/sm-mavericks-clang-fix.diff b/libraries/osx/patches/sm-mavericks-clang-fix.diff new file mode 100644 index 0000000..44b0d68
- + 1 --- js/src/configure 2013-12-11 14:23:20.000000000 -0800 2 +++ js/src/configure 2014-03-10 19:12:35.000000000 -0700 3 @@ -6229,7 +6229,12 @@ 4 if test "$GNU_CC"; then 5 # Per bug 719659 comment 2, some of the headers on ancient build machines 6 # may require gnu89 inline semantics. But otherwise, we use C99. 7 - CFLAGS="$CFLAGS -std=gnu99 -fgnu89-inline" 8 + # But on OS X we just use C99 plus GNU extensions, in order to fix 9 + # bug 917526. 10 + CFLAGS="$CFLAGS -std=gnu99" 11 + if test "${OS_ARCH}" != Darwin; then 12 + CFLAGS="$CFLAGS -fgnu89-inline" 13 + fi 14 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(notdir $@) -o $@' 15 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(notdir $@) -o $@' 16 DSO_LDOPTS='-shared' 17 No newline at end of file