1
0
forked from 0ad/0ad

SpiderMonkey 38 upgrade: 02/35

Update files for building SpiderMonkey.
Add a script for starting the tracelogger, as well as some instructions,
to be detailed in the wiki.

This was SVN commit r18656.
This commit is contained in:
Nicolas Auvray 2016-09-02 16:14:11 +00:00
parent add6b0206c
commit 7e6a960e83
2 changed files with 33 additions and 16 deletions

View File

@ -43,7 +43,7 @@ ENET_VERSION="enet-1.3.13"
MINIUPNPC_VERSION="miniupnpc-1.9.20151026"
# --------------------------------------------------------------
# Bundled with the game:
# * SpiderMonkey 31
# * SpiderMonkey 38
# * NVTT
# * FCollada
# --------------------------------------------------------------
@ -627,9 +627,9 @@ popd > /dev/null
# be customized, so we build and install them from bundled sources
# --------------------------------------------------------------------
echo -e "Building Spidermonkey..."
LIB_VERSION="mozjs-31.2.0"
LIB_VERSION="mozjs-38.2.1"
LIB_ARCHIVE="$LIB_VERSION.rc0.tar.bz2"
LIB_DIRECTORY="mozjs31"
LIB_DIRECTORY="mozjs-38.0.0"
pushd ../source/spidermonkey/ > /dev/null
@ -643,8 +643,6 @@ then
rm -f lib/*.a
rm -rf $LIB_DIRECTORY $INCLUDE_DIR_DEBUG $INCLUDE_DIR_RELEASE
tar -xf $LIB_ARCHIVE
# rename the extracted directory to something shorter
mv $LIB_VERSION $LIB_DIRECTORY
# Apply patches
pushd $LIB_DIRECTORY
@ -653,10 +651,11 @@ then
pushd $LIB_DIRECTORY/js/src
# 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+=).*/$1mozjs31-ps-debug/' Makefile.in
perl -i.bak -pe 's/js_static/mozjs31-ps-debug/g' shell/Makefile.in
perl -i.bak -pe 's/(^STATIC_LIBRARY_NAME\s+=).*/$1'\''mozjs38-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} --enable-gcgenerational --disable-tests --disable-shared-js" # --enable-trace-logging"
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"
# Change the default location where the tracelogger should store its output, which is /tmp/ on OSX.
TLCXXFLAGS='-DTRACE_LOG_DIR="\"../../source/tools/tracelogger/\""'
# Uncomment this line for 32-bit 10.5 cross compile:
#CONF_OPTS="$CONF_OPTS --target=i386-apple-darwin9.0.0"
if [[ $MIN_OSX_VERSION && ${MIN_OSX_VERSION-_} ]]; then
@ -668,27 +667,24 @@ then
mkdir -p build-debug
pushd build-debug
(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"
(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
mkdir -p $INCLUDE_DIR_DEBUG
cp -R -L dist/include/* $INCLUDE_DIR_DEBUG/
cp dist/lib/*.a $INSTALL_DIR/lib
popd
mv Makefile.in.bak Makefile.in
mv shell/Makefile.in.bak shell/Makefile.in
mv moz.build.bak moz.build
perl -i.bak -pe 's/(^STATIC_LIBRARY_NAME\s+=).*/$1mozjs31-ps-release/' Makefile.in
perl -i.bak -pe 's/js_static/mozjs31-ps-release/g' shell/Makefile.in
perl -i.bak -pe 's/(^STATIC_LIBRARY_NAME\s+=).*/$1'\''mozjs38-ps-release'\''/' moz.build
mkdir -p build-release
pushd build-release
(CC="clang" CXX="clang++" 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
mkdir -p $INCLUDE_DIR_RELEASE
cp -R -L dist/include/* $INCLUDE_DIR_RELEASE/
cp dist/lib/*.a $INSTALL_DIR/lib
popd
mv Makefile.in.bak Makefile.in
mv shell/Makefile.in.bak shell/Makefile.in
mv moz.build.bak moz.build
popd
touch .already-built

View File

@ -0,0 +1,21 @@
#!/bin/sh
# Source this script with `. tl-options.sh` in order to set up environment variables for the
# SpiderMonkey tracelogger.
# Once the variables are set, run ./pyrogenesis in binaries/system with the options you need and
# the tracelogging data will be saved to source/tools/tracelogger/
# After the run, use this tool: https://github.com/h4writer/tracelogger to display the data.
# The last tested version of the tool is 1c67e97e794b5039d0cae95f72ea0c76e4aa4696,
# it can be used if more recent versions cause trouble.
# Use semicolons to separate values on Windows.
# If that produces bogus output, you can try with commas instead.
if [ "${OS}" = "Windows_NT" ]
then
export TLLOG="Defaults;IonCompiler"
export TLOPTIONS="EnableMainThread;EnableOffThread;EnableGraph"
else
export TLLOG=Defaults,IonCompiler
export TLOPTIONS=EnableMainThread,EnableOffThread,EnableGraph
fi