Use Mozilla's mach to build SpiderMonkey

This removes the need for many customizations in the build script.
This commit is contained in:
Itms 2024-10-13 14:25:24 +02:00
parent 88d3550aaa
commit 2e32636a53
No known key found for this signature in database
GPG key ID: C7E52BD14CE14E09
5 changed files with 24 additions and 42 deletions

1
.gitignore vendored
View file

@ -18,6 +18,7 @@ libraries/source/fcollada/*
libraries/source/nvtt/*
libraries/source/premake-core/*
libraries/source/spidermonkey/*
!libraries/source/spidermonkey/mozconfig
libraries/source/spirv-reflect/*
!libraries/source/**/build.sh
!libraries/source/**/patches/

View file

@ -27,6 +27,7 @@ RUN apt-get -qqy update && apt-get install -qqy --no-install-recommends \
libvorbis-dev \
libwxgtk3.0-gtk3-dev \
libxml2-dev \
llvm \
make \
m4 \
patch \

View file

@ -27,6 +27,7 @@ RUN apt-get -qqy update && apt-get install -qqy --no-install-recommends \
libvorbis-dev \
libwxgtk3.0-dev \
libxml2-dev \
llvm \
make \
m4 \
patch \

View file

@ -50,15 +50,6 @@ tar xfJ "${FOLDER}.tar.xz"
# user-installed python packages.
PYTHONNOUSERSITE=true
# Use Mozilla make on Windows
if [ "${OS}" = "Windows_NT" ]; then
MAKE="mozmake"
else
MAKE=${MAKE:="make"}
fi
MAKE_OPTS="${JOBS}"
# Standalone SpiderMonkey can not use jemalloc (see https://bugzilla.mozilla.org/show_bug.cgi?id=1465038)
# Jitspew doesn't compile on VS17 in the zydis disassembler - since we don't use it, deactivate it.
# Trace-logging doesn't compile for now.
@ -101,15 +92,6 @@ tar xfJ "${FOLDER}.tar.xz"
fi
fi
LLVM_OBJDUMP=${LLVM_OBJDUMP:=$(command -v llvm-objdump || command -v objdump)}
# Quick sanity check to print explicit error messages
# (Don't run this on windows as it would likely fail spuriously)
if [ "${OS}" != "Windows_NT" ]; then
[ -n "$(command -v rustc)" ] || (echo "Error: rustc is not available. Install the rust toolchain (rust + cargo) before proceeding." && exit 1)
[ -n "${LLVM_OBJDUMP}" ] || (echo "Error: LLVM objdump is not available. Install it (likely via LLVM-clang) before proceeding." && exit 1)
fi
# If Valgrind looks like it's installed, then set up SM to support it
# (else the JITs will interact poorly with it)
if [ -e /usr/include/valgrind/valgrind.h ]; then
@ -122,35 +104,25 @@ tar xfJ "${FOLDER}.tar.xz"
${CHOST:+--host=${CHOST}} \
${CTARGET:+--target=${CTARGET}}"
echo "SpiderMonkey build options: ${CONF_OPTS}"
# Build
./mach create-mach-environment
# Debug (broken on FreeBSD)
if [ "${OS}" != "FreeBSD" ]; then
mkdir -p build-debug
(
cd build-debug
# llvm-objdump is searched for with the complete name, not simply 'objdump', account for that.
CXXFLAGS="${CXXFLAGS}" ../js/src/configure \
LLVM_OBJDUMP="${LLVM_OBJDUMP}" \
${CONF_OPTS} \
--enable-debug \
--disable-optimize \
--enable-gczeal
${MAKE} ${MAKE_OPTS}
)
MOZCONFIG="$(pwd)/../mozconfig" \
OPTIONS="${CONF_OPTS} \
--enable-debug \
--disable-optimize \
--enable-gczeal" \
BUILD_DIR="build-debug" \
./mach build "${JOBS}"
fi
# Release
mkdir -p build-release
(
cd build-release
CXXFLAGS="${CXXFLAGS}" ../js/src/configure \
LLVM_OBJDUMP="${LLVM_OBJDUMP}" \
${CONF_OPTS} \
--enable-optimize
${MAKE} ${MAKE_OPTS}
)
MOZCONFIG="$(pwd)/../mozconfig" \
OPTIONS="${CONF_OPTS} \
--enable-optimize" \
BUILD_DIR="build-release" \
./mach build "${JOBS}"
)
# install

View file

@ -0,0 +1,7 @@
# Pass options to configure
for option in ${OPTIONS}; do
ac_add_options "$option"
done
# Setup output dir
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/${BUILD_DIR}