Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/libraries/source/spidermonkey/build.sh
#!/bin/sh | #!/bin/sh | ||||
# This script is called by update-workspaces.sh / build-osx-libraries.sh | # This script is called by update-workspaces.sh / build-osx-libraries.sh | ||||
set -e | set -e | ||||
# This should match the version in config/milestone.txt | # This should match the version in config/milestone.txt | ||||
FOLDER="mozjs-60.9.1" | FOLDER="mozjs-68.12.1" | ||||
# If same-version changes are needed, increment this. | # If same-version changes are needed, increment this. | ||||
LIB_VERSION="60.9.1+0" | LIB_VERSION="68.12.1+0" | ||||
LIB_NAME="mozjs60-ps" | LIB_NAME="mozjs68-ps" | ||||
# Since this script is called by update-workspaces.sh, we want to quickly | # Since this script is called by update-workspaces.sh, we want to quickly | ||||
# avoid doing any work if SpiderMonkey is already built and up-to-date. | # avoid doing any work if SpiderMonkey is already built and up-to-date. | ||||
# Running SM's Makefile is a bit slow and noisy, so instead we'll make a | # Running SM's Makefile is a bit slow and noisy, so instead we'll make a | ||||
# special file and only rebuild if the build.sh version differs. | # special file and only rebuild if the build.sh version differs. | ||||
if [ -e .already-built ] && [ "$(cat .already-built)" = "${LIB_VERSION}" ] | if [ -e .already-built ] && [ "$(cat .already-built)" = "${LIB_VERSION}" ] | ||||
then | then | ||||
echo "SpiderMonkey is already up to date" | echo "SpiderMonkey is already up to date" | ||||
Show All 20 Lines | CONF_OPTS="--disable-tests | ||||
--without-intl-api | --without-intl-api | ||||
--enable-shared-js" | --enable-shared-js" | ||||
# NSPR is needed on Windows for POSIX emulation. | # NSPR is needed on Windows for POSIX emulation. | ||||
# If you want to build on Windows, check README.txt and edit the absolute paths | # If you want to build on Windows, check README.txt and edit the absolute paths | ||||
# to match your environment. | # to match your environment. | ||||
if [ "${OS}" = "Windows_NT" ] | if [ "${OS}" = "Windows_NT" ] | ||||
then | then | ||||
CONF_OPTS="${CONF_OPTS} --enable-nspr-build --with-visual-studio-version=2015" | # On windows, you may either use the full firefox build process (via mach bootstrap) | ||||
# or simply install LLVM to some convenient directory and hack the env. | |||||
if [ ! -d "~/.mozbuild"]; | |||||
then | |||||
export MOZBUILD_STATE_PATH="C:/Program Files/LLVM" | |||||
fi | |||||
CONF_OPTS="${CONF_OPTS} --enable-nspr-build --with-visual-studio-version=2017 --target=i686" | |||||
else | else | ||||
CONF_OPTS="${CONF_OPTS} --enable-posix-nspr-emulation" | CONF_OPTS="${CONF_OPTS} --enable-posix-nspr-emulation" | ||||
fi | fi | ||||
if [ "`uname -s`" = "Darwin" ] | if [ "`uname -s`" = "Darwin" ] | ||||
then | then | ||||
# Link to custom-built zlib | # Link to custom-built zlib | ||||
CONF_OPTS="${CONF_OPTS} --with-system-zlib=${ZLIB_DIR}" | CONF_OPTS="${CONF_OPTS} --with-system-zlib=${ZLIB_DIR}" | ||||
# Specify target versions and SDK | # Specify target versions and SDK | ||||
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-macos-sdk=${SYSROOT}" | CONF_OPTS="${CONF_OPTS} --with-macos-sdk=${SYSROOT}" | ||||
fi | fi | ||||
fi | fi | ||||
# If Valgrind looks like it's installed, then set up SM to support it | # If Valgrind looks like it's installed, then set up SM to support it | ||||
# (else the JITs will interact poorly with it) | # (else the JITs will interact poorly with it) | ||||
if [ -e /usr/include/valgrind/valgrind.h ] | if [ -e /usr/include/valgrind/valgrind.h ] | ||||
then | then | ||||
CONF_OPTS="${CONF_OPTS} --enable-valgrind" | CONF_OPTS="${CONF_OPTS} --enable-valgrind" | ||||
fi | fi | ||||
# Quick sanity check to print explicit error messages | |||||
if [ ! "$(command -v rustc)" ] | |||||
then | |||||
echo "Error: rustc is not available. Install the rust toolchain before proceeding." | |||||
exit 1 | |||||
fi | |||||
# We need to be able to override CHOST in case it is 32bit userland on 64bit kernel | # We need to be able to override CHOST in case it is 32bit userland on 64bit kernel | ||||
CONF_OPTS="${CONF_OPTS} \ | CONF_OPTS="${CONF_OPTS} \ | ||||
${CBUILD:+--build=${CBUILD}} \ | ${CBUILD:+--build=${CBUILD}} \ | ||||
${CHOST:+--host=${CHOST}} \ | ${CHOST:+--host=${CHOST}} \ | ||||
${CTARGET:+--target=${CTARGET}}" | ${CTARGET:+--target=${CTARGET}}" | ||||
echo "SpiderMonkey build options: ${CONF_OPTS}" | echo "SpiderMonkey build options: ${CONF_OPTS}" | ||||
# It can occasionally be useful to not rebuild everything, but don't do this by default. | # It can occasionally be useful to not rebuild everything, but don't do this by default. | ||||
REBUILD=true | REBUILD=true | ||||
if $REBUILD = true; | if $REBUILD = true; | ||||
then | then | ||||
# Delete the existing directory to avoid conflicts and extract the tarball | # Delete the existing directory to avoid conflicts and extract the tarball | ||||
rm -rf "$FOLDER" | rm -rf "$FOLDER" | ||||
if [ ! -e "${FOLDER}.tar.bz2" ]; | if [ ! -e "${FOLDER}.tar.bz2" ]; | ||||
then | then | ||||
# The tarball is committed to svn, but it's useful to let jenkins download it (when testing upgrade scripts). | # The tarball is committed to svn, but it's useful to let jenkins download it (when testing upgrade scripts). | ||||
download="$(command -v wget || echo "curl -L -o "${FOLDER}.tar.bz2"")" | download="$(command -v wget || echo "curl -L -o "${FOLDER}.tar.bz2"")" | ||||
$download "https://github.com/wraitii/spidermonkey-tarballs/releases/download/v60.9.1/${FOLDER}.tar.bz2" | $download "https://github.com/wraitii/spidermonkey-tarballs/releases/download/v68.12.1/${FOLDER}.tar.bz2" | ||||
fi | fi | ||||
tar xjf "${FOLDER}.tar.bz2" | tar xjf "${FOLDER}.tar.bz2" | ||||
# Clean up header files that may be left over by earlier versions of SpiderMonkey | # Clean up header files that may be left over by earlier versions of SpiderMonkey | ||||
rm -rf include-unix-debug | rm -rf include-unix-debug | ||||
rm -rf include-unix-release | rm -rf include-unix-release | ||||
# Apply patches | # Apply patches | ||||
cd "$FOLDER" | cd "$FOLDER" | ||||
. ../patch.sh | . ../patch.sh | ||||
# Prevent complaining that configure is outdated. | # Prevent complaining that configure is outdated. | ||||
touch ./js/src/configure | touch ./js/src/configure | ||||
else | else | ||||
cd "$FOLDER" | cd "$FOLDER" | ||||
fi | fi | ||||
mkdir -p build-debug | mkdir -p build-debug | ||||
cd build-debug | cd build-debug | ||||
# SM build scripts check for autoconf, but it isn't actually needed, so just pass something. | # SM configure checks for autoconf and llvm-objdump, but neither are actually used for building. | ||||
CXXFLAGS="${CXXFLAGS}" ../js/src/configure AUTOCONF="false" ${CONF_OPTS} \ | # To avoid a dependency, pass something arbitrary (it does need to be an actual program). | ||||
CXXFLAGS="${CXXFLAGS}" ../js/src/configure AUTOCONF="ls" LLVM_OBJDUMP="ls" ${CONF_OPTS} \ | |||||
--enable-debug \ | --enable-debug \ | ||||
--disable-optimize \ | --disable-optimize \ | ||||
--enable-gczeal | --enable-gczeal | ||||
${MAKE} ${MAKE_OPTS} | ${MAKE} ${MAKE_OPTS} | ||||
cd .. | cd .. | ||||
mkdir -p build-release | mkdir -p build-release | ||||
cd build-release | cd build-release | ||||
CXXFLAGS="${CXXFLAGS}" ../js/src/configure AUTOCONF="false" ${CONF_OPTS} \ | CXXFLAGS="${CXXFLAGS}" ../js/src/configure AUTOCONF="ls" LLVM_OBJDUMP="ls" ${CONF_OPTS} \ | ||||
--enable-optimize | --enable-optimize | ||||
${MAKE} ${MAKE_OPTS} | ${MAKE} ${MAKE_OPTS} | ||||
cd .. | cd .. | ||||
cd .. | cd .. | ||||
if [ "${OS}" = "Windows_NT" ] | if [ "${OS}" = "Windows_NT" ] | ||||
then | then | ||||
▲ Show 20 Lines • Show All 73 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator