forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 13
/
mac-release.bash
79 lines (70 loc) · 3.91 KB
/
mac-release.bash
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
#!/usr/bin/env bash
set -euxo pipefail
# This script is intended to be run on a Mac machine to build a release
# of the CLI. It will build the CLI for all supported platforms and
# architectures, and then create a tarball of the binaries.
THIS_DIR=$(pwd)
# Set default values for environment variables that are not set.
CMAKE_C_COMPILER=${CMAKE_C_COMPILER:-clang-16}
CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER:-clang++-16}
CMAKE_C_FLAGS=${CMAKE_C_FLAGS:-}
CMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS:-}
CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Release}
RUNNER_TEMP=${RUNNER_TEMP:-/tmp}
PACKAGE_JSON_LABEL=${PACKAGE_JSON_LABEL:-bun-webkit-$CMAKE_BUILD_TYPE}
AR=${AR:-llvm-ar}
RANLIB=${RANLIB:-llvm-ranlib}
CMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET:-13.0}
export DEFAULT_MALLOC_HEAP_BREAKDOWN=${DEFAULT_MALLOC_HEAP_BREAKDOWN:-"OFF"}
if [ "$CMAKE_BUILD_TYPE" == "Debug" ]; then
export DEFAULT_MALLOC_HEAP_BREAKDOWN="ON"
fi
ENABLE_MALLOC_HEAP_BREAKDOWN=${ENABLE_MALLOC_HEAP_BREAKDOWN:-$DEFAULT_MALLOC_HEAP_BREAKDOWN}
rm -rf $RUNNER_TEMP/webkit-release $RUNNER_TEMP/bun-webkit $RUNNER_TEMP/bun-webkit $RUNNER_TEMP/bun-webkit.tar.gz
mkdir -p $RUNNER_TEMP/webkit-release
cd $RUNNER_TEMP/webkit-release
cmake \
-DPORT="JSCOnly" \
-DENABLE_STATIC_JSC=ON \
-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \
-DENABLE_BUN_SKIP_FAILING_ASSERTIONS=ON \
-DUSE_THIN_ARCHIVES=OFF \
-DENABLE_FTL_JIT=ON \
-DCMAKE_C_COMPILER="$CMAKE_C_COMPILER" \
-DCMAKE_CXX_COMPILER="$CMAKE_CXX_COMPILER" \
-DCMAKE_C_FLAGS="$CMAKE_C_FLAGS -ffile-prefix-map=$THIS_DIR/Source=vendor/WebKit/Source " \
-DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS -ffile-prefix-map=$THIS_DIR/Source=vendor/WebKit/Source " \
-DENABLE_MALLOC_HEAP_BREAKDOWN=$ENABLE_MALLOC_HEAP_BREAKDOWN \
-DUSE_BUN_JSC_ADDITIONS=ON \
-DCMAKE_AR="$AR" \
-DCMAKE_RANLIB="$RANLIB" \
-DALLOW_LINE_AND_COLUMN_NUMBER_IN_BUILTINS=ON \
-G Ninja \
-DCMAKE_OSX_DEPLOYMENT_TARGET=$CMAKE_OSX_DEPLOYMENT_TARGET \
-DPTHREAD_JIT_PERMISSIONS_API=1 \
-DUSE_PTHREAD_JIT_PERMISSIONS_API=ON \
-DENABLE_REMOTE_INSPECTOR=ON \
$THIS_DIR \
$RUNNER_TEMP/webkit-release &&
cmake --build $RUNNER_TEMP/webkit-release --config $CMAKE_BUILD_TYPE --target jsc
mkdir -p $RUNNER_TEMP/bun-webkit/lib $RUNNER_TEMP/bun-webkit/include $RUNNER_TEMP/bun-webkit/include/JavaScriptCore $RUNNER_TEMP/bun-webkit/include/wtf $RUNNER_TEMP/bun-webkit/include/bmalloc
cp $RUNNER_TEMP/webkit-release/lib/* $RUNNER_TEMP/bun-webkit/lib
cp -r $RUNNER_TEMP/webkit-release/cmakeconfig.h $RUNNER_TEMP/bun-webkit/include/cmakeconfig.h
echo "#define BUN_WEBKIT_VERSION \"$GITHUB_SHA\"" >>$RUNNER_TEMP/bun-webkit/include/cmakeconfig.h
cp -r $RUNNER_TEMP/webkit-release/WTF/Headers/wtf $RUNNER_TEMP/bun-webkit/include
cp -r $RUNNER_TEMP/webkit-release/ICU/Headers/* $RUNNER_TEMP/bun-webkit/include
if [ -e $RUNNER_TEMP/webkit-release/bmalloc ]; then
cp -r $RUNNER_TEMP/webkit-release/bmalloc/Headers/bmalloc $RUNNER_TEMP/bun-webkit/include
fi
# Copy all the header files in the JavaScriptCore directory to the bun-webkit include/JavaScriptCore directory.
cp -f $RUNNER_TEMP/webkit-release/JavaScriptCore/Headers/JavaScriptCore/* \
$RUNNER_TEMP/webkit-release/JavaScriptCore/PrivateHeaders/JavaScriptCore/* \
$RUNNER_TEMP/webkit-release/JavaScriptCore/DerivedSources/*.h \
$RUNNER_TEMP/webkit-release/JavaScriptCore/DerivedSources/*/*.h \
$RUNNER_TEMP/bun-webkit/include/JavaScriptCore/
mkdir -p $RUNNER_TEMP/bun-webkit/Source/JavaScriptCore
cp -r $THIS_DIR/Source/JavaScriptCore/Scripts $RUNNER_TEMP/bun-webkit/Source/JavaScriptCore
cp $THIS_DIR/Source/JavaScriptCore/create_hash_table $RUNNER_TEMP/bun-webkit/Source/JavaScriptCore
echo "{ \"name\": \"$PACKAGE_JSON_LABEL\", \"version\": \"0.0.1-$GITHUB_SHA\", \"os\": [\"darwin\"], \"cpu\": [\"$PACKAGE_JSON_ARCH\"], \"repository\": \"https://github.com/$GITHUB_REPOSITORY\" }" >$RUNNER_TEMP/bun-webkit/package.json
cd $RUNNER_TEMP
tar -czf bun-webkit.tar.gz bun-webkit