forked from oven-sh/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmusl-release.sh
More file actions
56 lines (43 loc) · 1.54 KB
/
musl-release.sh
File metadata and controls
56 lines (43 loc) · 1.54 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
#!/bin/bash
set -euxo pipefail
export DOCKER_BUILDKIT=1
export BUILDKIT_ARCH=$(uname -m)
export ARCH=${BUILDKIT_ARCH}
export LTO_FLAG="${LTO_FLAG:-""}"
if [ "$BUILDKIT_ARCH" == "amd64" ]; then
export BUILDKIT_ARCH="amd64"
export ARCH=x64
fi
if [ "$BUILDKIT_ARCH" == "x86_64" ]; then
export BUILDKIT_ARCH="amd64"
export ARCH=x64
fi
if [ "$BUILDKIT_ARCH" == "arm64" ]; then
export BUILDKIT_ARCH="arm64"
export ARCH=aarch64
fi
if [ "$BUILDKIT_ARCH" == "aarch64" ]; then
export BUILDKIT_ARCH="arm64"
export ARCH=aarch64
fi
if [ "$BUILDKIT_ARCH" == "armv7l" ]; then
echo "Unsupported platform: $BUILDKIT_ARCH"
exit 1
fi
export WEBKIT_RELEASE_TYPE=${WEBKIT_RELEASE_TYPE:-"Release"}
# Set default MARCH_FLAG based on architecture if not already set
if [ -z "${MARCH_FLAG:-}" ]; then
if [ "$BUILDKIT_ARCH" == "arm64" ]; then
export MARCH_FLAG="-march=armv8-a+crc -mtune=ampere1"
elif [ "$BUILDKIT_ARCH" == "amd64" ]; then
export MARCH_FLAG="-march=nehalem"
fi
fi
export MARCH_FLAG="${MARCH_FLAG:-""}"
export CONTAINER_NAME=bun-webkit-linux-$BUILDKIT_ARCH
if [ "$WEBKIT_RELEASE_TYPE" == "relwithdebuginfo" ]; then
CONTAINER_NAME=bun-webkit-linux-$BUILDKIT_ARCH-dbg
fi
mkdir -p $temp
rm -rf $temp/bun-webkit
docker buildx build -f Dockerfile.musl -t $CONTAINER_NAME --build-arg LTO_FLAG="$LTO_FLAG" --build-arg MARCH_FLAG="$MARCH_FLAG" --build-arg WEBKIT_RELEASE_TYPE=$WEBKIT_RELEASE_TYPE --progress=plain --platform=linux/$BUILDKIT_ARCH --target=artifact --output type=local,dest=$temp/bun-webkit .