Changeset View
Standalone View
libraries/source/spidermonkey/build.sh
Show All 21 Lines | |||||
then | then | ||||
MAKE="mozmake" | MAKE="mozmake" | ||||
else | else | ||||
MAKE=${MAKE:="make"} | MAKE=${MAKE:="make"} | ||||
fi | fi | ||||
MAKE_OPTS="${JOBS}" | MAKE_OPTS="${JOBS}" | ||||
CONF_OPTS="--enable-shared-js --disable-tests --without-intl-api" | # jemalloc is outdated on SM45, do not use it | ||||
CONF_OPTS="--disable-tests --disable-jemalloc --enable-shared-js --without-intl-api" | |||||
# Bug 1269319 | # Bug 1269319 | ||||
# When compiled with GCC 6 (or later), SpiderMonkey 38 (and versions up to 49) is | # When compiled with GCC 6 (or later), SpiderMonkey 45 (and versions up to 49) is | ||||
# subject to segfaults. Disabling a few optimizations fixes that. | # subject to segfaults. Disabling a few optimizations fixes that. | ||||
# See also #4053 | # See also #4053 | ||||
if [ "${OS}" != "Windows_NT" ] | if [ "${OS}" != "Windows_NT" ] | ||||
then | then | ||||
if [ "`${CXX:=g++} -dumpversion | cut -f1 -d.`" -ge "6" ] | if [ "`${CXX:=g++} -dumpversion | cut -f1 -d.`" -ge "6" ] | ||||
then | then | ||||
CXXFLAGS="${CXXFLAGS} -fno-schedule-insns2 -fno-delete-null-pointer-checks" | CXXFLAGS="${CXXFLAGS} -fno-schedule-insns2 -fno-delete-null-pointer-checks" | ||||
fi | fi | ||||
fi | fi | ||||
# Change the default location where the tracelogger should store its output. | # Change the default location where the tracelogger should store its output. | ||||
# The default location is . on Windows and /tmp/ on *nix. | # The default location is . on Windows and /tmp/ on *nix. | ||||
TLCXXFLAGS='-DTRACE_LOG_DIR="\"../../source/tools/tracelogger/\""' | TLCXXFLAGS='-DTRACE_LOG_DIR="\"../../source/tools/tracelogger/\""' | ||||
# We bundle prebuilt binaries for Windows and the .libs for nspr aren't included. | # 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 | ||||
NSPR_INCLUDES="-IC:/Projects/nspr/nspr-4.12/nspr/dist/include/nspr" | NSPR_INCLUDES="-IC:/Users/Nicolas/Documents/0ad/nspr-4.12/nspr/dist/include/nspr" | ||||
NSPR_LIBS=" \ | NSPR_LIBS=" \ | ||||
C:/Projects/nspr/nspr-4.12/nspr/dist/lib/nspr4 \ | C:/Users/Nicolas/Documents/0ad/nspr-4.12/nspr/dist/lib/nspr4 \ | ||||
C:/Projects/nspr/nspr-4.12/nspr/dist/lib/plds4 \ | C:/Users/Nicolas/Documents/0ad/nspr-4.12/nspr/dist/lib/plds4 \ | ||||
C:/Projects/nspr/nspr-4.12/nspr/dist/lib/plc4" | C:/Users/Nicolas/Documents/0ad/nspr-4.12/nspr/dist/lib/plc4" | ||||
else | else | ||||
NSPR_INCLUDES="`pkg-config nspr --cflags`" | CONF_OPTS="${CONF_OPTS} --enable-posix-nspr-emulation" | ||||
NSPR_LIBS="`pkg-config nspr --libs`" | |||||
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 | ||||
# 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}" | ||||
echo ${CONF_OPTS} | echo ${CONF_OPTS} | ||||
FOLDER=mozjs-38.0.0 | FOLDER=mozjs-45.0.2 | ||||
s0600204: The tar file below extracts to `mozjs-45.0.2`
`tar -C $FOLDER -xjf ./mozjs-45.0.2.tar.bz2… | |||||
Not Done Inline ActionsYeah I messed up that one in this patch. I'll update. wraitii: Yeah I messed up that one in this patch. I'll update. | |||||
# 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 | ||||
tar xjf mozjs-38.2.1.rc0.tar.bz2 | tar xjf mozjs-45.0.2.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-* | rm -rf include-unix-* | ||||
cd $FOLDER | cd $FOLDER | ||||
# Apply patches | # Apply patches | ||||
. ../patch.sh | . ../patch.sh | ||||
cd js/src | cd js/src | ||||
# Clean up data generated by previous builds that could cause problems | # Clean up data generated by previous builds that could cause problems | ||||
rm -rf build-debug | rm -rf build-debug | ||||
rm -rf build-release | rm -rf build-release | ||||
# We want separate debug/release versions of the library, so we have to change | # We want separate debug/release versions of the library, so we have to change | ||||
# the LIBRARY_NAME for each build. | # the LIBRARY_NAME for each build. | ||||
# (We use perl instead of sed so that it works with MozillaBuild on Windows, | # (We use perl instead of sed so that it works with MozillaBuild on Windows, | ||||
# which has an ancient sed.) | # which has an ancient sed.) | ||||
perl -i.bak -pe 's/(SHARED_LIBRARY_NAME\s+=).*/$1 '\''mozjs38-ps-debug'\''/' moz.build | perl -i.bak -pe 's/(SHARED_LIBRARY_NAME\s+=).*/$1 '\''mozjs45-ps-debug'\''/' moz.build | ||||
mkdir -p build-debug | mkdir -p build-debug | ||||
cd build-debug | cd build-debug | ||||
CXXFLAGS="${CXXFLAGS} ${TLCXXFLAGS}" ../configure ${CONF_OPTS} --with-nspr-libs="$NSPR_LIBS" --with-nspr-cflags="$NSPR_INCLUDES" --enable-debug --disable-optimize --enable-js-diagnostics --enable-gczeal | if [ "${OS}" = "Windows_NT" ] | ||||
then | |||||
CXXFLAGS="${CXXFLAGS} ${TLCXXFLAGS}" ../configure ${CONF_OPTS} --with-nspr-cflags="${NSPR_INCLUDES}" --with-nspr-libs="${NSPR_LIBS}" --enable-debug --disable-optimize --enable-js-diagnostics --enable-gczeal | |||||
Done Inline ActionsWould be nice to replace these long lines with each flag on a separate line, as in rP22492 (notice the diff here isn't very clean, but compare to build-osx-libs.sh diff) historic_bruno: Would be nice to replace these long lines with each flag on a separate line, as in rP22492… | |||||
Done Inline ActionsDone! Itms: Done! | |||||
else | |||||
CXXFLAGS="${CXXFLAGS} ${TLCXXFLAGS}" ../configure ${CONF_OPTS} --enable-debug --disable-optimize --enable-js-diagnostics --enable-gczeal | |||||
fi | |||||
${MAKE} ${MAKE_OPTS} | ${MAKE} ${MAKE_OPTS} | ||||
cd .. | cd .. | ||||
perl -i.bak -pe 's/(SHARED_LIBRARY_NAME\s+=).*/$1 '\''mozjs38-ps-release'\''/' moz.build | perl -i.bak -pe 's/(SHARED_LIBRARY_NAME\s+=).*/$1 '\''mozjs45-ps-release'\''/' moz.build | ||||
mkdir -p build-release | mkdir -p build-release | ||||
cd build-release | cd build-release | ||||
CXXFLAGS="${CXXFLAGS} ${TLCXXFLAGS}" ../configure ${CONF_OPTS} --with-nspr-libs="$NSPR_LIBS" --with-nspr-cflags="$NSPR_INCLUDES" --enable-optimize # --enable-gczeal --enable-debug-symbols | if [ "${OS}" = "Windows_NT" ] | ||||
then | |||||
CXXFLAGS="${CXXFLAGS} ${TLCXXFLAGS}" ../configure ${CONF_OPTS} --with-nspr-cflags="${NSPR_INCLUDES}" --with-nspr-libs="${NSPR_LIBS}" --enable-optimize # --enable-gczeal --enable-debug-symbols | |||||
else | |||||
CXXFLAGS="${CXXFLAGS} ${TLCXXFLAGS}" ../configure ${CONF_OPTS} --enable-optimize # --enable-gczeal --enable-debug-symbols | |||||
fi | |||||
${MAKE} ${MAKE_OPTS} | ${MAKE} ${MAKE_OPTS} | ||||
cd .. | cd .. | ||||
cd ../../.. | cd ../../.. | ||||
if [ "${OS}" = "Windows_NT" ] | if [ "${OS}" = "Windows_NT" ] | ||||
then | then | ||||
INCLUDE_DIR_DEBUG=include-win32-debug | INCLUDE_DIR_DEBUG=include-win32-debug | ||||
Show All 20 Lines | else | ||||
fi | fi | ||||
fi | fi | ||||
if [ "${OS}" = "Windows_NT" ] | if [ "${OS}" = "Windows_NT" ] | ||||
then | then | ||||
# Bug #776126 | # Bug #776126 | ||||
# SpiderMonkey uses a tweaked zlib when building, and it wrongly copies its own files to include dirs | # SpiderMonkey uses a tweaked zlib when building, and it wrongly copies its own files to include dirs | ||||
# afterwards, so we have to remove them to not have them conflicting with the regular zlib | # afterwards, so we have to remove them to not have them conflicting with the regular zlib | ||||
cd ${FOLDER}/js/src/build-release/dist/include | pushd ${FOLDER}/js/src/build-release/dist/include | ||||
rm mozzconf.h zconf.h zlib.h | rm mozzconf.h zconf.h zlib.h | ||||
cd ../../../../../.. | popd | ||||
cd ${FOLDER}/js/src/build-debug/dist/include | pushd ${FOLDER}/js/src/build-debug/dist/include | ||||
rm mozzconf.h zconf.h zlib.h | rm mozzconf.h zconf.h zlib.h | ||||
cd ../../../../../.. | 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_DEBUG} | ||||
mkdir -p ${INCLUDE_DIR_RELEASE} | mkdir -p ${INCLUDE_DIR_RELEASE} | ||||
cp -R -L ${FOLDER}/js/src/build-release/dist/include/* ${INCLUDE_DIR_RELEASE}/ | cp -R -L ${FOLDER}/js/src/build-release/dist/include/* ${INCLUDE_DIR_RELEASE}/ | ||||
cp -R -L ${FOLDER}/js/src/build-debug/dist/include/* ${INCLUDE_DIR_DEBUG}/ | cp -R -L ${FOLDER}/js/src/build-debug/dist/include/* ${INCLUDE_DIR_DEBUG}/ | ||||
mkdir -p lib/ | mkdir -p lib/ | ||||
cp -L ${FOLDER}/js/src/build-debug/dist/lib/${LIB_PREFIX}mozjs38-ps-debug${LIB_SRC_SUFFIX} lib/${LIB_PREFIX}mozjs38-ps-debug${LIB_DST_SUFFIX} | cp -L ${FOLDER}/js/src/build-debug/dist/sdk/lib/${LIB_PREFIX}mozjs45-ps-debug${LIB_SRC_SUFFIX} lib/${LIB_PREFIX}mozjs45-ps-debug${LIB_DST_SUFFIX} | ||||
cp -L ${FOLDER}/js/src/build-release/dist/lib/${LIB_PREFIX}mozjs38-ps-release${LIB_SRC_SUFFIX} lib/${LIB_PREFIX}mozjs38-ps-release${LIB_DST_SUFFIX} | cp -L ${FOLDER}/js/src/build-release/dist/sdk/lib/${LIB_PREFIX}mozjs45-ps-release${LIB_SRC_SUFFIX} lib/${LIB_PREFIX}mozjs45-ps-release${LIB_DST_SUFFIX} | ||||
Not Done Inline ActionsDitto here: ${FOLDER}/js/src/build-release/dist/lib/ does not exist, s0600204: Ditto here: `${FOLDER}/js/src/build-release/dist/lib/` does not exist,
but… | |||||
Not Done Inline ActionsYup, needs to be updated too. wraitii: Yup, needs to be updated too. | |||||
cp -L ${FOLDER}/js/src/build-debug/dist/bin/${LIB_PREFIX}mozjs38-ps-debug${DLL_SRC_SUFFIX} ../../../binaries/system/${LIB_PREFIX}mozjs38-ps-debug${DLL_DST_SUFFIX} | cp -L ${FOLDER}/js/src/build-debug/dist/bin/${LIB_PREFIX}mozjs45-ps-debug${DLL_SRC_SUFFIX} ../../../binaries/system/${LIB_PREFIX}mozjs45-ps-debug${DLL_DST_SUFFIX} | ||||
cp -L ${FOLDER}/js/src/build-release/dist/bin/${LIB_PREFIX}mozjs38-ps-release${DLL_SRC_SUFFIX} ../../../binaries/system/${LIB_PREFIX}mozjs38-ps-release${DLL_DST_SUFFIX} | cp -L ${FOLDER}/js/src/build-release/dist/bin/${LIB_PREFIX}mozjs45-ps-release${DLL_SRC_SUFFIX} ../../../binaries/system/${LIB_PREFIX}mozjs45-ps-release${DLL_DST_SUFFIX} | ||||
Not Done Inline ActionsThe folder ${FOLDER}/js/src/build-debug/dist/lib/ does not exist at this point in the compilation. However, ${FOLDER}/js/src/build-debug/dist/sdk/lib/ appears to contain the appropriate symbolic link. Certainly, if I look at an SM38 build (in a different repo instance), both the libmozjs38-ps-debug.so symlinks inside that version's dist/lib and dist/sdk/lib folders point to the same target. s0600204: The folder `${FOLDER}/js/src/build-debug/dist/lib/` does not exist at this point in the… | |||||
# On Windows, also copy debugging symbols files | # On Windows, also copy debugging symbols files | ||||
if [ "${OS}" = "Windows_NT" ] | if [ "${OS}" = "Windows_NT" ] | ||||
then | then | ||||
cp -L ${FOLDER}/js/src/build-debug/js/src/${LIB_PREFIX}mozjs38-ps-debug.pdb ../../../binaries/system/${LIB_PREFIX}mozjs38-ps-debug.pdb | cp -L ${FOLDER}/js/src/build-debug/js/src/${LIB_PREFIX}mozjs45-ps-debug.pdb ../../../binaries/system/${LIB_PREFIX}mozjs45-ps-debug.pdb | ||||
cp -L ${FOLDER}/js/src/build-release/js/src/${LIB_PREFIX}mozjs38-ps-release.pdb ../../../binaries/system/${LIB_PREFIX}mozjs38-ps-release.pdb | cp -L ${FOLDER}/js/src/build-release/js/src/${LIB_PREFIX}mozjs45-ps-release.pdb ../../../binaries/system/${LIB_PREFIX}mozjs45-ps-release.pdb | ||||
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 | ||||
touch .already-built | touch .already-built |
The tar file below extracts to mozjs-45.0.2
tar -C $FOLDER -xjf ./mozjs-45.0.2.tar.bz2 --strip-components=1 works if you wish to keep the folder the same between sub-releases. (You'll need a mkdir first, though.)