blob: 76533e49fc3fb1d93d2eccfae330d6f6182da6cf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
#!/bin/sh
set -e
set -v
set -x
if [ $# -ne 2 ]
then
echo "Please supply an arch: x86_64, i386, etc and a platform: osx, linux, windows, etc"
exit 0;
fi
_Path=platform/$1/$2
shift
shift
_CONFIG_OPTS=""
_xcode_setup() {
local sdk=$1; shift
local arch=$1; shift
local target=$1; shift
export SDKROOT=`xcrun --sdk $sdk --show-sdk-path`
export HOST_CC=/usr/bin/gcc
export HOST_CXX=/usr/bin/c++
export CC=`xcrun -f clang`" -arch $arch -isysroot $SDKROOT -m$target"
export CXX=`xcrun -f clang++`" -arch $arch -isysroot $SDKROOT -m$target"
}
case "$_Path" in
"platform/aarch64/linux")
_CONFIG_OPTS="--host=aarch64-linux"
;;
"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/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"
;;
"platform/x86_64/iOS-sim")
_xcode_setup "iphonesimulator" "x86_64" "iphoneos-version-min=10.2"
_CONFIG_OPTS="--host=x86_64-apple-darwin"
;;
"platform/aarch64/tvOS")
_xcode_setup "appletvos" "arm64" "tvos-version-min=10.1"
_CONFIG_OPTS="--target=aarch64-apple-darwin"
;;
"platform/x86_64/tvOS-sim")
_xcode_setup "appletvsimulator" "x86_64" "tvos-version-min=10.1"
_CONFIG_OPTS="--host=x86_64-apple-darwin"
;;
*)
echo "Unknown configuration $_Path"
exit 1
;;
esac
# the two files we need are js-confdefs.h which get used for the build and
# js-config.h for library consumers. We also get different unity source files
# based on configuration, so save those too.
cd mozilla-release/js/src
rm config.cache || true
PYTHON=python ./configure --without-intl-api --enable-posix-nspr-emulation --disable-trace-logging --disable-js-shell --disable-tests "$_CONFIG_OPTS"
make recurse_export
cd ../../..
rm -rf $_Path/
mkdir -p $_Path/build
mkdir $_Path/include
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
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
|