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-78.6.0" | FOLDER="mozjs-78.6.0" | ||||
# If same-version changes are needed, increment this. | # If same-version changes are needed, increment this. | ||||
LIB_VERSION="78.6.0+1" | LIB_VERSION="78.6.0+2" | ||||
LIB_NAME="mozjs78-ps" | LIB_NAME="mozjs78-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 | ||||
▲ Show 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | then | ||||
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 | ||||
# Debug version of SM is broken on FreeBSD. | |||||
if [ "$(uname -s)" != "FreeBSD" ]; then | |||||
mkdir -p build-debug | mkdir -p build-debug | ||||
cd build-debug | cd build-debug | ||||
# SM configure checks for autoconf, but we don't actually need it. | # SM configure checks for autoconf, but we don't actually need it. | ||||
# To avoid a dependency, pass something arbitrary (it does need to be an actual program). | # To avoid a dependency, pass something arbitrary (it does need to be an actual program). | ||||
# llvm-objdump is searched for with the complete name, not simply 'objdump', account for that. | # llvm-objdump is searched for with the complete name, not simply 'objdump', account for that. | ||||
CXXFLAGS="${CXXFLAGS}" ../js/src/configure AUTOCONF="ls" \ | CXXFLAGS="${CXXFLAGS}" ../js/src/configure AUTOCONF="ls" \ | ||||
LLVM_OBJDUMP="${LLVM_OBJDUMP}" \ | LLVM_OBJDUMP="${LLVM_OBJDUMP}" \ | ||||
${CONF_OPTS} \ | ${CONF_OPTS} \ | ||||
--enable-debug \ | --enable-debug \ | ||||
--disable-optimize \ | --disable-optimize \ | ||||
--enable-gczeal | --enable-gczeal | ||||
${MAKE} ${MAKE_OPTS} | ${MAKE} ${MAKE_OPTS} | ||||
cd .. | cd .. | ||||
fi | |||||
mkdir -p build-release | mkdir -p build-release | ||||
cd build-release | cd build-release | ||||
CXXFLAGS="${CXXFLAGS}" ../js/src/configure AUTOCONF="ls" \ | CXXFLAGS="${CXXFLAGS}" ../js/src/configure AUTOCONF="ls" \ | ||||
LLVM_OBJDUMP="${LLVM_OBJDUMP}" \ | LLVM_OBJDUMP="${LLVM_OBJDUMP}" \ | ||||
${CONF_OPTS} \ | ${CONF_OPTS} \ | ||||
--enable-optimize | --enable-optimize | ||||
${MAKE} ${MAKE_OPTS} | ${MAKE} ${MAKE_OPTS} | ||||
Show All 34 Lines | then | ||||
pushd "${FOLDER}/build-debug/dist/include" | pushd "${FOLDER}/build-debug/dist/include" | ||||
rm -f mozzconf.h zconf.h zlib.h | rm -f mozzconf.h zconf.h zlib.h | ||||
popd | popd | ||||
fi | fi | ||||
# Copy files into the necessary locations for building and running the game | # Copy files into the necessary locations for building and running the game | ||||
# 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_RELEASE}" | mkdir -p "${INCLUDE_DIR_RELEASE}" | ||||
cp -R -L "${FOLDER}"/build-release/dist/include/* "${INCLUDE_DIR_RELEASE}/" | cp -R -L "${FOLDER}"/build-release/dist/include/* "${INCLUDE_DIR_RELEASE}/" | ||||
if [ "$(uname -s)" != "FreeBSD" ]; then | |||||
mkdir -p "${INCLUDE_DIR_DEBUG}" | |||||
cp -R -L "${FOLDER}"/build-debug/dist/include/* "${INCLUDE_DIR_DEBUG}/" | cp -R -L "${FOLDER}"/build-debug/dist/include/* "${INCLUDE_DIR_DEBUG}/" | ||||
fi | |||||
# These align the ligns below, making it easier to check for mistakes. | # These align the ligns below, making it easier to check for mistakes. | ||||
DEB="debug" | DEB="debug" | ||||
REL="release" | REL="release" | ||||
mkdir -p lib/ | mkdir -p lib/ | ||||
# Fetch the jsrust static library. Path is grepped from the build file as it varies by rust toolset. | # Fetch the jsrust static library. Path is grepped from the build file as it varies by rust toolset. | ||||
Show All 19 Lines | then | ||||
rust_path=$(grep jsrust < "${FOLDER}/build-debug/js/src/build/backend.mk" | cut -d = -f 2 | cut -c2-) | rust_path=$(grep jsrust < "${FOLDER}/build-debug/js/src/build/backend.mk" | cut -d = -f 2 | cut -c2-) | ||||
cp -L "${rust_path}" "lib/${LIB_PREFIX}${LIB_NAME}-rust-debug${STATIC_LIB_SUFFIX}" | cp -L "${rust_path}" "lib/${LIB_PREFIX}${LIB_NAME}-rust-debug${STATIC_LIB_SUFFIX}" | ||||
# Windows need some additional libraries for posix emulation. | # Windows need some additional libraries for posix emulation. | ||||
cp -L "${FOLDER}/build-release/dist/bin/${LIB_PREFIX}nspr4.dll" "../../../binaries/system/${LIB_PREFIX}nspr4.dll" | cp -L "${FOLDER}/build-release/dist/bin/${LIB_PREFIX}nspr4.dll" "../../../binaries/system/${LIB_PREFIX}nspr4.dll" | ||||
cp -L "${FOLDER}/build-release/dist/bin/${LIB_PREFIX}plc4.dll" "../../../binaries/system/${LIB_PREFIX}plc4.dll" | cp -L "${FOLDER}/build-release/dist/bin/${LIB_PREFIX}plc4.dll" "../../../binaries/system/${LIB_PREFIX}plc4.dll" | ||||
cp -L "${FOLDER}/build-release/dist/bin/${LIB_PREFIX}plds4.dll" "../../../binaries/system/${LIB_PREFIX}plds4.dll" | cp -L "${FOLDER}/build-release/dist/bin/${LIB_PREFIX}plds4.dll" "../../../binaries/system/${LIB_PREFIX}plds4.dll" | ||||
else | else | ||||
# Copy shared libs to both lib/ and binaries/ so the compiler and executable (resp.) can find them. | # Copy shared libs to both lib/ and binaries/ so the compiler and executable (resp.) can find them. | ||||
cp -L "${FOLDER}/build-${DEB}/js/src/build/${LIB_PREFIX}${LIB_NAME}-${DEB}${LIB_SUFFIX}" "lib/${LIB_PREFIX}${LIB_NAME}-${DEB}${LIB_SUFFIX}" | |||||
cp -L "${FOLDER}/build-${REL}/js/src/build/${LIB_PREFIX}${LIB_NAME}-${REL}${LIB_SUFFIX}" "lib/${LIB_PREFIX}${LIB_NAME}-${REL}${LIB_SUFFIX}" | cp -L "${FOLDER}/build-${REL}/js/src/build/${LIB_PREFIX}${LIB_NAME}-${REL}${LIB_SUFFIX}" "lib/${LIB_PREFIX}${LIB_NAME}-${REL}${LIB_SUFFIX}" | ||||
cp -L "${FOLDER}/build-${DEB}/js/src/build/${LIB_PREFIX}${LIB_NAME}-${DEB}${LIB_SUFFIX}" "../../../binaries/system/${LIB_PREFIX}${LIB_NAME}-${DEB}${LIB_SUFFIX}" | |||||
cp -L "${FOLDER}/build-${REL}/js/src/build/${LIB_PREFIX}${LIB_NAME}-${REL}${LIB_SUFFIX}" "../../../binaries/system/${LIB_PREFIX}${LIB_NAME}-${REL}${LIB_SUFFIX}" | cp -L "${FOLDER}/build-${REL}/js/src/build/${LIB_PREFIX}${LIB_NAME}-${REL}${LIB_SUFFIX}" "../../../binaries/system/${LIB_PREFIX}${LIB_NAME}-${REL}${LIB_SUFFIX}" | ||||
if [ "$(uname -s)" != "FreeBSD" ]; then | |||||
cp -L "${FOLDER}/build-${DEB}/js/src/build/${LIB_PREFIX}${LIB_NAME}-${DEB}${LIB_SUFFIX}" "../../../binaries/system/${LIB_PREFIX}${LIB_NAME}-${DEB}${LIB_SUFFIX}" | |||||
cp -L "${FOLDER}/build-${DEB}/js/src/build/${LIB_PREFIX}${LIB_NAME}-${DEB}${LIB_SUFFIX}" "lib/${LIB_PREFIX}${LIB_NAME}-${DEB}${LIB_SUFFIX}" | |||||
fi | |||||
fi | fi | ||||
# Flag that it's already been built successfully so we can skip it next time | # Flag that it's already been built successfully so we can skip it next time | ||||
echo "${LIB_VERSION}" > .already-built | echo "${LIB_VERSION}" > .already-built |
Wildfire Games · Phabricator