diff options
author | 2021-12-21 21:56:01 -0800 | |
---|---|---|
committer | 2021-12-21 21:56:01 -0800 | |
commit | 873e12c7c61a7e798489ce51ca32389a86f1e29f (patch) | |
tree | 29e335aceae28580bee189d826ca70579a5ced93 | |
parent | fecfb784ee640d7b8120918b456c31363e7745a6 (diff) | |
download | bun-873e12c7c61a7e798489ce51ca32389a86f1e29f.tar.gz bun-873e12c7c61a7e798489ce51ca32389a86f1e29f.tar.zst bun-873e12c7c61a7e798489ce51ca32389a86f1e29f.zip |
Add script for building zig
-rw-r--r-- | zig-build/Dockerfile | 4 | ||||
-rw-r--r-- | zig-build/release.sh | 56 |
2 files changed, 56 insertions, 4 deletions
diff --git a/zig-build/Dockerfile b/zig-build/Dockerfile index eb4476555..999ac60ad 100644 --- a/zig-build/Dockerfile +++ b/zig-build/Dockerfile @@ -18,19 +18,15 @@ RUN apt-get update && apt-get install --no-install-recommends -y \ build-essential \ git \ libssl-dev \ - ruby \ liblld-12-dev \ libclang-12-dev \ - nodejs \ gcc \ g++ \ - npm \ clang-12 \ clang-format-12 \ libc++-12-dev \ libc++abi-12-dev \ lld-12 \ - libicu-dev \ zip RUN update-alternatives --install /usr/bin/ld ld /usr/bin/lld-12 90 && \ diff --git a/zig-build/release.sh b/zig-build/release.sh new file mode 100644 index 000000000..615844064 --- /dev/null +++ b/zig-build/release.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +export DOCKER_BUILDKIT=1 + +export BUILDKIT_ARCH=$(uname -m) +export ARCH=${BUILDKIT_ARCH} + +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 + +# Name should be $BUILDKIT_ARCH so we only need that arg passed +export CONTAINER_NAME=zig-linux-$BUILDKIT_ARCH +export TAG=dec20 + +temp=$(mktemp -d) + +docker build . -t $CONTAINER_NAME --progress=plain --platform=linux/$BUILDKIT_ARCH + +if (($?)); then + echo "Failed to build container" + exit 1 +fi + +id=$(docker create $CONTAINER_NAME:latest) +docker cp $id:/output/zig.zip $temp/$CONTAINER_NAME.zip + +if (($?)); then + echo "Failed to cp out" + exit 1 +fi + +docker rm $id + +gh release upload $TAG $temp/$CONTAINER_NAME.zip --clobber --repo Jarred-Sumner/zig |