forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathwindows-cross-release.sh
More file actions
executable file
·70 lines (62 loc) · 2.68 KB
/
Copy pathwindows-cross-release.sh
File metadata and controls
executable file
·70 lines (62 loc) · 2.68 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
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
# Cross-compile JavaScriptCore for Windows on a Linux host via
# Dockerfile.windows. Windows targets are always cross-compiled here; the
# target arch comes from WIN_ARCH, not the host.
set -euxo pipefail
export DOCKER_BUILDKIT=1
export WIN_ARCH="${WIN_ARCH:-x64}"
export WEBKIT_RELEASE_TYPE="${WEBKIT_RELEASE_TYPE:-Release}"
export LTO_FLAG="${LTO_FLAG:-}"
export ENABLE_SANITIZERS="${ENABLE_SANITIZERS:-}"
export USE_MIMALLOC="${USE_MIMALLOC:-OFF}"
export USE_EXTERNAL_MIMALLOC="${USE_EXTERNAL_MIMALLOC:-OFF}"
# Codegen floor per arch: x64 -> nehalem, arm64 -> armv8-a+crc.
#
# There is only one x64 floor now. WebKit used to ship a haswell build next to a
# nehalem "baseline" one, which meant every x64 consumer had to pick, and a
# consumer that picked wrong either raised its CPU requirement silently or gave
# up cross-language LTO because the matching variant did not exist. Building
# only nehalem removes the choice; a consumer that wants a higher floor for its
# own code can still set one, it just does not get it inside JSC.
case "$WIN_ARCH" in
x64)
WIN_TRIPLE_ARCH="x86_64"
: "${MARCH:=nehalem}"
: "${MARCH_FLAG:="/clang:-march=${MARCH}"}"
: "${ICU_MARCH_FLAG:="-march=${MARCH}"}"
;;
arm64)
WIN_TRIPLE_ARCH="aarch64"
: "${MARCH_FLAG:="/clang:-march=armv8-a+crc"}"
: "${ICU_MARCH_FLAG:="-march=armv8-a+crc"}"
;;
*) echo "error: WIN_ARCH must be x64 or arm64, got '$WIN_ARCH'" >&2; exit 1 ;;
esac
export WIN_TRIPLE_ARCH MARCH_FLAG ICU_MARCH_FLAG
# Sanitizers are x64-only: LLVM ships no Windows ARM64 ASAN runtime.
if [ -n "$ENABLE_SANITIZERS" ] && [ "$WIN_ARCH" != "x64" ]; then
echo "error: ENABLE_SANITIZERS requires WIN_ARCH=x64 (no Windows ARM64 ASAN runtime)" >&2
exit 1
fi
export CONTAINER_NAME="bun-webkit-windows-cross-${WIN_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.windows -t "$CONTAINER_NAME" \
--build-arg WIN_ARCH="$WIN_ARCH" \
--build-arg WIN_TRIPLE_ARCH="$WIN_TRIPLE_ARCH" \
--build-arg WEBKIT_RELEASE_TYPE="$WEBKIT_RELEASE_TYPE" \
--build-arg LTO_FLAG="$LTO_FLAG" \
--build-arg MARCH_FLAG="$MARCH_FLAG" \
--build-arg ICU_MARCH_FLAG="$ICU_MARCH_FLAG" \
--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"