Changeset View
Changeset View
Standalone View
Standalone View
libraries/osx/build-osx-libs.sh
Show First 20 Lines • Show All 651 Lines • ▼ Show 20 Lines | |||||
fi | fi | ||||
popd > /dev/null | popd > /dev/null | ||||
# -------------------------------------------------------------------- | # -------------------------------------------------------------------- | ||||
# The following libraries are shared on different OSes and may | # The following libraries are shared on different OSes and may | ||||
# be customized, so we build and install them from bundled sources | # be customized, so we build and install them from bundled sources | ||||
# -------------------------------------------------------------------- | # -------------------------------------------------------------------- | ||||
echo -e "Building Spidermonkey..." | echo -e "Building Spidermonkey..." | ||||
LIB_VERSION="mozjs-38.2.1" | LIB_VERSION="mozjs-45.0.2" | ||||
LIB_ARCHIVE="$LIB_VERSION.rc0.tar.bz2" | LIB_ARCHIVE="$LIB_VERSION.tar.bz2" | ||||
LIB_DIRECTORY="mozjs-38.0.0" | LIB_DIRECTORY="mozjs-45.0.0" | ||||
pushd ../source/spidermonkey/ > /dev/null | pushd ../source/spidermonkey/ > /dev/null | ||||
if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ .already-built -ot $LIB_DIRECTORY ]] || [[ .already-built -ot README.txt ]] | if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ .already-built -ot $LIB_DIRECTORY ]] || [[ .already-built -ot README.txt ]] | ||||
then | then | ||||
INSTALL_DIR="$(pwd)" | INSTALL_DIR="$(pwd)" | ||||
INCLUDE_DIR_DEBUG=$INSTALL_DIR/include-unix-debug | INCLUDE_DIR_DEBUG=$INSTALL_DIR/include-unix-debug | ||||
INCLUDE_DIR_RELEASE=$INSTALL_DIR/include-unix-release | INCLUDE_DIR_RELEASE=$INSTALL_DIR/include-unix-release | ||||
rm -f .already-built | rm -f .already-built | ||||
rm -f lib/*.a | rm -f lib/*.a | ||||
rm -rf $LIB_DIRECTORY $INCLUDE_DIR_DEBUG $INCLUDE_DIR_RELEASE | rm -rf $LIB_DIRECTORY $INCLUDE_DIR_DEBUG $INCLUDE_DIR_RELEASE | ||||
tar -xf $LIB_ARCHIVE | tar -xf $LIB_ARCHIVE | ||||
# Apply patches | # Apply patches | ||||
pushd $LIB_DIRECTORY | pushd $LIB_DIRECTORY | ||||
. ../patch.sh | . ../patch.sh | ||||
popd | popd | ||||
pushd $LIB_DIRECTORY/js/src | pushd $LIB_DIRECTORY/js/src | ||||
# We want separate debug/release versions of the library, so change their install name in the Makefile | # We want separate debug/release versions of the library, so change their install name in the Makefile | ||||
perl -i.bak -pe 's/(^STATIC_LIBRARY_NAME\s+=).*/$1'\''mozjs38-ps-debug'\''/' moz.build | perl -i.bak -pe 's/(^STATIC_LIBRARY_NAME\s+=).*/$1'\''mozjs45-ps-debug'\''/' moz.build | ||||
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" | 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 --without-intl-api" | ||||
# Change the default location where the tracelogger should store its output, which is /tmp/ on OSX. | # Change the default location where the tracelogger should store its output, which is /tmp/ on OSX. | ||||
TLCXXFLAGS='-DTRACE_LOG_DIR="\"../../source/tools/tracelogger/\""' | TLCXXFLAGS='-DTRACE_LOG_DIR="\"../../source/tools/tracelogger/\""' | ||||
# Uncomment this line for 32-bit 10.5 cross compile: | # Uncomment this line for 32-bit 10.5 cross compile: | ||||
#CONF_OPTS="$CONF_OPTS --target=i386-apple-darwin9.0.0" | #CONF_OPTS="$CONF_OPTS --target=i386-apple-darwin9.0.0" | ||||
if [[ $MIN_OSX_VERSION && ${MIN_OSX_VERSION-_} ]]; then | if [[ $MIN_OSX_VERSION && ${MIN_OSX_VERSION-_} ]]; then | ||||
CONF_OPTS="$CONF_OPTS --enable-macos-target=$MIN_OSX_VERSION" | CONF_OPTS="$CONF_OPTS --enable-macos-target=$MIN_OSX_VERSION" | ||||
fi | fi | ||||
if [[ $SYSROOT && ${SYSROOT-_} ]]; then | if [[ $SYSROOT && ${SYSROOT-_} ]]; then | ||||
CONF_OPTS="$CONF_OPTS --with-macosx-sdk=$SYSROOT" | CONF_OPTS="$CONF_OPTS --with-macosx-sdk=$SYSROOT" | ||||
fi | fi | ||||
mkdir -p build-debug | mkdir -p build-debug | ||||
pushd build-debug | pushd build-debug | ||||
(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" | (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" | ||||
# js-config.h is different for debug and release builds, so we need different include directories for both | # js-config.h is different for debug and release builds, so we need different include directories for both | ||||
mkdir -p $INCLUDE_DIR_DEBUG | mkdir -p $INCLUDE_DIR_DEBUG | ||||
cp -R -L dist/include/* $INCLUDE_DIR_DEBUG/ | cp -R -L dist/include/* $INCLUDE_DIR_DEBUG/ | ||||
cp dist/lib/*.a $INSTALL_DIR/lib | cp dist/lib/*.a $INSTALL_DIR/lib | ||||
popd | popd | ||||
mv moz.build.bak moz.build | mv moz.build.bak moz.build | ||||
perl -i.bak -pe 's/(^STATIC_LIBRARY_NAME\s+=).*/$1'\''mozjs38-ps-release'\''/' moz.build | perl -i.bak -pe 's/(^STATIC_LIBRARY_NAME\s+=).*/$1'\''mozjs45-ps-release'\''/' moz.build | ||||
mkdir -p build-release | mkdir -p build-release | ||||
pushd build-release | pushd build-release | ||||
(CC="clang" CXX="clang++" CXXFLAGS="${TLCXXFLAGS}" AR=ar CROSS_COMPILE=1 ../configure $CONF_OPTS --enable-optimize && make ${JOBS}) || die "Spidermonkey build failed" | (CC="clang" CXX="clang++" CXXFLAGS="${TLCXXFLAGS}" AR=ar CROSS_COMPILE=1 ../configure $CONF_OPTS --enable-optimize && make ${JOBS}) || die "Spidermonkey build failed" | ||||
# js-config.h is different for debug and release builds, so we need different include directories for both | # js-config.h is different for debug and release builds, so we need different include directories for both | ||||
mkdir -p $INCLUDE_DIR_RELEASE | mkdir -p $INCLUDE_DIR_RELEASE | ||||
cp -R -L dist/include/* $INCLUDE_DIR_RELEASE/ | cp -R -L dist/include/* $INCLUDE_DIR_RELEASE/ | ||||
cp dist/lib/*.a $INSTALL_DIR/lib | cp dist/lib/*.a $INSTALL_DIR/lib | ||||
popd | popd | ||||
▲ Show 20 Lines • Show All 67 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator