forked from oven-sh/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmacos-cross-release.sh
More file actions
executable file
·60 lines (52 loc) · 2.33 KB
/
Copy pathmacos-cross-release.sh
File metadata and controls
executable file
·60 lines (52 loc) · 2.33 KB
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
#!/bin/bash
# Cross-compile JavaScriptCore for macOS on a Linux host via Dockerfile.macos.
# macOS targets are always cross-compiled here (there is no Linux runner with
# Apple's toolchain), so the target arch comes from MACOS_ARCH, not the host.
set -euxo pipefail
export DOCKER_BUILDKIT=1
export MACOS_ARCH="${MACOS_ARCH:-arm64}"
export MACOS_DEPLOYMENT_TARGET="${MACOS_DEPLOYMENT_TARGET:-13.0}"
export WEBKIT_RELEASE_TYPE="${WEBKIT_RELEASE_TYPE:-Release}"
export LTO_FLAG="${LTO_FLAG:-}"
export CPP_FLAGS="${CPP_FLAGS:-}"
export ENABLE_SANITIZERS="${ENABLE_SANITIZERS:-}"
export USE_MIMALLOC="${USE_MIMALLOC:-OFF}"
export USE_EXTERNAL_MIMALLOC="${USE_EXTERNAL_MIMALLOC:-OFF}"
# Match the native macOS lanes: apple-m1 on the arm64 runners (`cpu: native`
# on macos-14-xlarge), nehalem on the amd64 ones.
case "$MACOS_ARCH" in
arm64) : "${MARCH_FLAG:="-mcpu=apple-m1"}" ;;
x86_64) : "${MARCH_FLAG:="-march=nehalem"}" ;;
*) echo "error: MACOS_ARCH must be arm64 or x86_64, got '$MACOS_ARCH'" >&2; exit 1 ;;
esac
export MARCH_FLAG
# Debug builds default ENABLE_MALLOC_HEAP_BREAKDOWN=ON, same as
# mac-release.bash.
DEFAULT_MALLOC_HEAP_BREAKDOWN="OFF"
if [ "$WEBKIT_RELEASE_TYPE" == "Debug" ]; then
DEFAULT_MALLOC_HEAP_BREAKDOWN="ON"
fi
export ENABLE_MALLOC_HEAP_BREAKDOWN="${ENABLE_MALLOC_HEAP_BREAKDOWN:-$DEFAULT_MALLOC_HEAP_BREAKDOWN}"
export CONTAINER_NAME="bun-webkit-macos-cross-${MACOS_ARCH}"
if [ "$WEBKIT_RELEASE_TYPE" == "Debug" ]; then
CONTAINER_NAME="${CONTAINER_NAME}-debug"
fi
temp="${temp:-${TMPDIR:-/tmp}}"
mkdir -p "$temp"
rm -rf "$temp/bun-webkit"
docker buildx build -f Dockerfile.macos -t "$CONTAINER_NAME" \
--build-arg MACOS_ARCH="$MACOS_ARCH" \
--build-arg MACOS_DEPLOYMENT_TARGET="$MACOS_DEPLOYMENT_TARGET" \
--build-arg LTO_FLAG="$LTO_FLAG" \
--build-arg CPP_FLAGS="$CPP_FLAGS" \
--build-arg MARCH_FLAG="$MARCH_FLAG" \
--build-arg WEBKIT_RELEASE_TYPE="$WEBKIT_RELEASE_TYPE" \
--build-arg ENABLE_MALLOC_HEAP_BREAKDOWN="$ENABLE_MALLOC_HEAP_BREAKDOWN" \
--build-arg ENABLE_SANITIZERS="$ENABLE_SANITIZERS" \
--build-arg USE_MIMALLOC="$USE_MIMALLOC" \
--build-arg USE_EXTERNAL_MIMALLOC="$USE_EXTERNAL_MIMALLOC" \
--progress=plain \
--platform=linux/amd64 \
--target=artifact \
--output type=local,dest="$temp/bun-webkit" .
echo "Successfully built $CONTAINER_NAME to $temp/bun-webkit"