summaryrefslogtreecommitdiff
path: root/src/third_party/mozjs/gen-config.sh
diff options
context:
space:
mode:
authorJustin Seyster <justin.seyster@mongodb.com>2022-02-28 22:30:51 -0500
committerJustin Seyster <justin.seyster@mongodb.com>2022-03-07 12:08:01 -0500
commit26bab136615f5f7a5d6c35e767e2321dcc31b956 (patch)
tree63ecab22fa06e3b308f91697864f272c44152595 /src/third_party/mozjs/gen-config.sh
parent82190f17c29d5090c16af894ec21a9b51312cc4f (diff)
downloadmongo-26bab136615f5f7a5d6c35e767e2321dcc31b956.tar.gz
SERVER-61008 Upgrade vendorized mozjs to esr91.3
Co-authored-by: Mohammad Dashti <mdashti@gmail.com>
Diffstat (limited to 'src/third_party/mozjs/gen-config.sh')
-rwxr-xr-xsrc/third_party/mozjs/gen-config.sh99
1 files changed, 78 insertions, 21 deletions
diff --git a/src/third_party/mozjs/gen-config.sh b/src/third_party/mozjs/gen-config.sh
index c1ad3efa546..28d86330a77 100755
--- a/src/third_party/mozjs/gen-config.sh
+++ b/src/third_party/mozjs/gen-config.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
set -e
set -v
@@ -10,6 +10,7 @@ then
exit 0;
fi
+_BuiltPathPrefix="mozilla-release/js/src/_build/js/src"
_Path=platform/$1/$2
shift
shift
@@ -30,32 +31,36 @@ _xcode_setup() {
case "$_Path" in
"platform/aarch64/linux")
_CONFIG_OPTS="--host=aarch64-linux"
- ;;
+ ;;
"platform/ppc64le/freebsd")
_CONFIG_OPTS="--host=ppc64le-freebsd"
- ;;
+ ;;
"platform/ppc64le/linux")
_CONFIG_OPTS="--host=ppc64le-linux"
- ;;
+ ;;
"platform/s390x/linux")
_CONFIG_OPTS="--host=s390x-linux"
- ;;
+ ;;
"platform/x86_64/freebsd")
_CONFIG_OPTS="--host=x86_64-freebsd"
- ;;
+ ;;
"platform/x86_64/linux")
_CONFIG_OPTS="--host=x86_64-linux"
- ;;
+ ;;
"platform/x86_64/openbsd")
_CONFIG_OPTS="--host=x86_64-openbsd"
- ;;
+ ;;
"platform/x86_64/windows")
_CONFIG_OPTS="--host=x86_64-windows"
- ;;
+ ;;
+ "platform/aarch64/macOS")
+ _xcode_setup "macosx" "arm64" "macos-version-min=10.9"
+ _CONFIG_OPTS="--host=aarch64-apple-darwin"
+ ;;
"platform/x86_64/macOS")
_xcode_setup "macosx" "x86_64" "macos-version-min=10.9"
_CONFIG_OPTS="--host=x86_64-apple-darwin"
- ;;
+ ;;
"platform/aarch64/iOS")
_xcode_setup "iphoneos" "arm64" "iphoneos-version-min=10.2"
_CONFIG_OPTS="--target=aarch64-apple-darwin"
@@ -83,27 +88,79 @@ esac
# based on configuration, so save those too.
cd mozilla-release/js/src
+
+echo "Create _build"
+rm -rf _build
+mkdir -p _build
+cd _build
+
rm config.cache || true
-PYTHON=python ./configure --without-intl-api --enable-posix-nspr-emulation --disable-trace-logging --disable-js-shell --disable-tests "$_CONFIG_OPTS"
+echo "Run configure"
+# The 'ppc64le/linux' platform requires the additional 'CXXFLAGS' and 'CFLAGS' flags to compile
+CXXFLAGS="$CXXFLAGS -D__STDC_FORMAT_MACROS"\
+CFLAGS="$CFLAGS -D__STDC_FORMAT_MACROS" \
+../configure \
+ --disable-jemalloc \
+ --with-system-zlib \
+ --without-intl-api \
+ --enable-optimize \
+ --disable-js-shell \
+ --disable-tests "$_CONFIG_OPTS"
make recurse_export
-cd ../../..
+cd ../../../..
rm -rf $_Path/
mkdir -p $_Path/build
-mkdir $_Path/include
+mkdir -p $_Path/include
+cp $_BuiltPathPrefix/*.cpp $_Path/build
+cp $_BuiltPathPrefix/*.h $_Path/include
+cp $_BuiltPathPrefix/js-confdefs.h $_Path/build
+
+mkdir -p $_Path/build/jit
+mkdir -p $_Path/include/jit
+cp $_BuiltPathPrefix/jit/*.cpp $_Path/build/jit
+cp $_BuiltPathPrefix/jit/*.h $_Path/include/jit
+
+
+mkdir -p $_Path/build/gc
+mkdir -p $_Path/include/gc
+cp $_BuiltPathPrefix/gc/*.cpp $_Path/build/gc
+cp $_BuiltPathPrefix/gc/*.h $_Path/include/gc
-cp mozilla-release/js/src/js/src/js-confdefs.h $_Path/build
-cp mozilla-release/js/src/js/src/*.cpp $_Path/build
-cp mozilla-release/js/src/js/src/js-config.h $_Path/include
+mkdir -p $_Path/build/wasm
+mkdir -p $_Path/include/wasm
+cp $_BuiltPathPrefix/wasm/*.cpp $_Path/build/wasm
-for unified_file in $(ls -1 $_Path/build/*.cpp) ; do
- sed 's/#include ".*\/js\/src\//#include "/' < $unified_file > t1
- sed 's/#error ".*\/js\/src\//#error "/' < t1 > $unified_file
- rm t1
-done
+mkdir -p $_Path/build/irregexp
+mkdir -p $_Path/include/irregexp
+cp $_BuiltPathPrefix/irregexp/*.cpp $_Path/build/irregexp
+mkdir -p $_Path/build/debugger
+mkdir -p $_Path/include/debugger
+cp $_BuiltPathPrefix/debugger/*.cpp $_Path/build/debugger
+
+mkdir -p $_Path/build/frontend
+mkdir -p $_Path/include/frontend
+cp $_BuiltPathPrefix/frontend/*.cpp $_Path/build/frontend
+cp $_BuiltPathPrefix/frontend/*.h $_Path/include/frontend
+
+cp $_BuiltPathPrefix/js-config.h $_Path/include
+
+SEDOPTION="-i"
+if [[ "$OSTYPE" == "darwin"* ]]; then
+ SEDOPTION="-i ''"
+fi
+
+find "$_Path/build" -name '*.cpp' |
+ while read unified_file ; do
+ echo "Processing $unified_file"
+ sed $SEDOPTION \
+ -e 's|#include ".*/js/src/|#include "|' \
+ -e 's|#error ".*/js/src/|#error "|' \
+ "$unified_file"
+ done