Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
build_ref: ${{ needs.trigger.outputs.sha }}
release_tag: ${{ needs.trigger.outputs.release_tag }}
is_prerelease: true
llvm_version: '19'
llvm_version: '22'

notify:
name: Update PR Comment
Expand Down
18 changes: 14 additions & 4 deletions .github/workflows/build-reusable.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Build WebKit (Reusable)

env:
LLVM_VERSION: 21
LLVM_VERSION: 22

on:
workflow_call:
Expand All @@ -21,7 +21,7 @@ on:
llvm_version:
description: 'LLVM version to use'
type: string
default: '19'
default: '22'
outputs:
release_tag:
description: 'The release tag that was created'
Expand All @@ -32,6 +32,8 @@ jobs:
name: Linux
runs-on: ${{matrix.os}}
strategy:
# One variant's failure shouldn't cancel the others.
fail-fast: false
matrix:
include:
- lto_flag: ""
Expand Down Expand Up @@ -266,8 +268,8 @@ jobs:
scoop config use_external_7zip true
scoop install ninja
# Install LLVM ARM64 from official LLVM releases
# Use LLVM 21 for ARM64 - has better Windows ARM64 support and fixes SEH unwind bugs
$llvmVersion = "21.1.8"
# Use LLVM 22 for ARM64 - has better Windows ARM64 support and fixes SEH unwind bugs
$llvmVersion = "22.1.8"
Comment on lines +271 to +272

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

tmp_dir="$(mktemp -d)"
gh release download llvmorg-22.1.8 \
  --repo llvm/llvm-project \
  --pattern 'LLVM-22.1.8-woa64.exe*' \
  --dir "$tmp_dir"

gh attestation verify \
  --repo llvm/llvm-project \
  "$tmp_dir/LLVM-22.1.8-woa64.exe"

Repository: oven-sh/WebKit

Length of output: 152


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

rg -n -C 4 'LLVM-22.1.8-woa64\.exe|attestation|checksum|extract|Expand-Archive|Invoke-WebRequest|curl|wget' .github/workflows/build-reusable.yml

Repository: oven-sh/WebKit

Length of output: 1270


Verify the LLVM ARM64 installer before extracting it.

Invoke-WebRequest downloads LLVM-22.1.8-woa64.exe and 7-Zip extracts it immediately. Add checksum or attestation verification before extraction so a tampered release asset can’t run in CI.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/build-reusable.yml around lines 271 - 272, Update the LLVM
ARM64 download flow using $llvmVersion so LLVM-22.1.8-woa64.exe is verified with
the publisher’s checksum or attestation immediately after Invoke-WebRequest and
before 7-Zip extraction. Fail the workflow when verification fails, and only
extract the verified installer.

Source: MCP tools

$llvmUrl = "https://github.com/llvm/llvm-project/releases/download/llvmorg-$llvmVersion/LLVM-$llvmVersion-woa64.exe"
$llvmPath = "C:\LLVM"
Invoke-WebRequest -Uri $llvmUrl -OutFile "$env:TEMP\llvm-arm64.exe"
Expand Down Expand Up @@ -305,6 +307,8 @@ jobs:
name: Linux musl
runs-on: ${{matrix.os}}
strategy:
# One variant's failure shouldn't cancel the others.
fail-fast: false
matrix:
include:
- lto_flag: ""
Expand Down Expand Up @@ -390,6 +394,8 @@ jobs:
# mac-release.bash remains for building on a real Mac locally.
runs-on: linux-x64-gh
strategy:
# One variant's failure shouldn't cancel the others.
fail-fast: false
matrix:
include:
- label: bun-webkit-macos-arm64
Expand Down Expand Up @@ -484,6 +490,8 @@ jobs:
# so all FreeBSD targets build on x64 regardless of target arch.
runs-on: linux-x64-gh
strategy:
# One variant's failure shouldn't cancel the others.
fail-fast: false
matrix:
include:
- label: bun-webkit-freebsd-amd64
Expand Down Expand Up @@ -541,6 +549,8 @@ jobs:
# cross-compile from x64 regardless of target arch.
runs-on: linux-x64-gh
strategy:
# One variant's failure shouldn't cancel the others.
fail-fast: false
matrix:
include:
- label: bun-webkit-linux-arm64-android
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
inputs:
llvm_version:
description: "LLVM version"
default: "19"
default: "22"

jobs:
build:
Expand All @@ -22,4 +22,4 @@ jobs:
build_ref: ${{ github.sha }}
release_tag: autobuild-${{ github.sha }}
is_prerelease: false
llvm_version: ${{ inputs.llvm_version || '19' }}
llvm_version: ${{ inputs.llvm_version || '22' }}
96 changes: 82 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ARG WEBKIT_RELEASE_TYPE=Release
ARG CPU=native
ARG LTO_FLAG="-flto=thin -fno-split-lto-unit -fwhole-program-vtables -fforce-emit-vtables "
ARG RELEASE_FLAGS="-O3 -DNDEBUG=1"
ARG LLVM_VERSION="21"
ARG LLVM_VERSION="22"
ARG DEFAULT_CFLAGS="-mno-omit-leaf-frame-pointer -g -fno-omit-frame-pointer -ffunction-sections -fdata-sections -faddrsig -fno-unwind-tables -fno-asynchronous-unwind-tables -DU_STATIC_IMPLEMENTATION=1 "
ARG ENABLE_SANITIZERS=""
ARG USE_MIMALLOC="OFF"
Expand Down Expand Up @@ -31,15 +31,20 @@ ENV DEBIAN_FRONTEND=noninteractive

# Both archive.ubuntu.com and azure.archive.ubuntu.com have intermittently
# timed out from inside the GitHub-hosted docker-buildx network at different
# times. Prefer Azure (faster on Azure-hosted runners) but fall back to the
# canonical mirror if `apt-get update` can't reach it. arm64 uses
# ports.ubuntu.com which has been reachable, so leave it alone.
RUN sed -i 's|http://archive.ubuntu.com/ubuntu|http://azure.archive.ubuntu.com/ubuntu|g' /etc/apt/sources.list
# times, and ports.ubuntu.com (arm64) has gone fully dark for hours at a
# stretch. Prefer Azure on amd64 (faster on Azure-hosted runners). On any
# failed attempt, swap to a fallback mirror before retrying: amd64 falls back
# to the canonical archive, arm64 falls back to a Launchpad-registered
# ubuntu-ports mirror.
RUN sed -i 's|http://archive.ubuntu.com/ubuntu|http://azure.archive.ubuntu.com/ubuntu|g' /etc/apt/sources.list \
&& echo 'Acquire::Retries "5";' > /etc/apt/apt.conf.d/99-retries

# Install basic build dependencies
RUN ( apt-get update || \
( sed -i 's|http://azure.archive.ubuntu.com/ubuntu|http://archive.ubuntu.com/ubuntu|g' /etc/apt/sources.list && apt-get update ) \
) && apt-get install -y \
# Install basic build dependencies. `apt-get update` exits 0 on partial index
# fetch failure (only W:, not E:), which then makes the install fail with
# "no installation candidate" — so retry the whole update+install, swapping
# to a fallback mirror after the first failure.
RUN for attempt in 1 2 3; do \
apt-get update && apt-get install -y \
wget \
curl \
git \
Expand All @@ -52,6 +57,15 @@ RUN ( apt-get update || \
ca-certificates \
gnupg \
lsb-release \
&& break || { \
echo "apt attempt $attempt failed, swapping mirrors and retrying"; \
sed -i -e 's|http://azure.archive.ubuntu.com/ubuntu|http://archive.ubuntu.com/ubuntu|g' \
-e 's|http://ports.ubuntu.com/ubuntu-ports|http://mirrors.ocf.berkeley.edu/ubuntu-ports|g' \
/etc/apt/sources.list; \
sleep 15; \
}; \
done \
&& dpkg -l wget curl git python3 ninja-build lsb-release >/dev/null \
&& rm -rf /var/lib/apt/lists/*

# Install zstd (for icu/compress-data.ts). Pinned: focal's apt has 1.4.4 which
Expand Down Expand Up @@ -102,11 +116,65 @@ RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 130 \
--slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-13 \
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-13

# Install LLVM 21
RUN wget https://apt.llvm.org/llvm.sh \
&& chmod +x llvm.sh \
&& ./llvm.sh 21 all \
&& rm llvm.sh \
# Install LLVM 22.
#
# apt.llvm.org stopped publishing focal arm64 binaries for the 22 release
# (llvm-toolchain-focal-22/main/binary-arm64 carries only the Architecture:all
# -doc/-examples packages). The bullseye repo still has the full arm64 set and
# is built against glibc 2.31 (same as focal), so on arm64 we pull from there
# instead. The bullseye clang-22 package declares Depends on Debian's
# libstdc++-10-dev/libgcc-10-dev/libobjc-10-dev, which focal doesn't name that
# way (we use gcc-13's libstdc++ via the PPA and set its include paths below),
# so those three are satisfied with equivs dummies before the install.
#
# Two more bullseye-vs-focal gaps have to be closed on arm64:
#
# libz3: bullseye's libllvm22 needs libz3-4 (>= 4.8.10) and llvm-22-dev needs
# the matching libz3-dev; focal only has 4.8.7. equivs can't paper over this
# one -- libz3.so.4 is a real DT_NEEDED of libLLVM, so a dummy would make
# clang-22 fail to start. The two bullseye .debs are installed directly,
# SHA-256-pinned, rather than by adding deb.debian.org as an apt source: it
# keeps apt from pulling any other Debian package into the image, in
# particular a libc6/libstdc++6 that would move the glibc floor. Both only
# declare libc6 (>= 2.30) / libstdc++6 (>= 9), which focal already satisfies,
# so the floor stays where the base image puts it (verified: libc6 stays at
# 2.31 and a clang++-22 -stdlib=libstdc++ binary still tops out at GLIBC_2.17).
#
# lldb-22: pulls python3-lldb-22, which Depends: python3 (>= 3.9~) (<< 3.10).
# focal ships python3.8, so it is not installable here and would need Debian's
# whole python3 stack. Nothing in the build uses lldb, so arm64 omits it; the
# /usr/bin/lldb symlink below is left dangling, which is harmless.
ARG LIBZ3_VERSION=4.8.10-1
ARG LIBZ3_SHA256_arm64=ae1ea58ecfdd4b5ec53d734e60ac2df37fddb11888b7730a19335f1a9b09f489
ARG LIBZ3_DEV_SHA256_arm64=4739e62c1f39c35f2382f15347b588245a71bd12c8628a8caa6639fdc1774b6c
RUN wget -qO /etc/apt/trusted.gpg.d/apt.llvm.org.asc https://apt.llvm.org/llvm-snapshot.gpg.key \
&& if [ "$TARGETARCH" = "arm64" ]; then \
echo "deb https://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-22 main" > /etc/apt/sources.list.d/llvm.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends equivs \
&& for p in libstdc++-10-dev libgcc-10-dev libobjc-10-dev; do \
printf 'Section: misc\nPriority: optional\nStandards-Version: 3.9.2\nPackage: %s\nVersion: 99\nDescription: dummy for bullseye clang-22 dep\n' "$p" > /tmp/$p.ctl \
&& (cd /tmp && equivs-build $p.ctl && dpkg -i ${p}_99_all.deb && rm -f $p.ctl ${p}_99_all.deb); \
done \
&& curl -fsSL --retry 5 --retry-connrefused \
"http://deb.debian.org/debian/pool/main/z/z3/libz3-4_${LIBZ3_VERSION}_arm64.deb" -o /tmp/libz3-4.deb \
&& curl -fsSL --retry 5 --retry-connrefused \
"http://deb.debian.org/debian/pool/main/z/z3/libz3-dev_${LIBZ3_VERSION}_arm64.deb" -o /tmp/libz3-dev.deb \
&& echo "${LIBZ3_SHA256_arm64} /tmp/libz3-4.deb" | sha256sum -c - \
&& echo "${LIBZ3_DEV_SHA256_arm64} /tmp/libz3-dev.deb" | sha256sum -c - \
&& dpkg -i /tmp/libz3-4.deb /tmp/libz3-dev.deb \
&& rm -f /tmp/libz3-4.deb /tmp/libz3-dev.deb \
&& apt-get install -y --no-install-recommends \
clang-22 lld-22 llvm-22 llvm-22-dev llvm-22-tools llvm-22-runtime \
llvm-22-linker-tools libllvm22 libclang-cpp22 libclang1-22 \
libclang-common-22-dev libclang-rt-22-dev liblld-22 clangd-22; \
else \
wget https://apt.llvm.org/llvm.sh \
&& chmod +x llvm.sh \
&& ./llvm.sh 22 all \
&& rm llvm.sh; \
fi \
&& clang-22 --version \
Comment on lines +147 to +177

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Hardcoded 22 throughout the arm64/bullseye install block instead of ${LLVM_VERSION}.

ARG LLVM_VERSION is available in this stage (line 22) and is used consistently everywhere else in the file (e.g. lines 193, 230, 245-249), but this block hardcodes the literal 22 in the bullseye suite name (line 152), all ~14 package names (lines 168-170), the llvm.sh invocation (line 174), and the version-check (line 177). This is exactly the kind of duplication that forced manual edits across this file for the 21→22 bump; the next bump will need the same manual sweep instead of just changing the ARG default.

♻️ Proposed fix (illustrative, non-exhaustive)
-         echo "deb https://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-22 main" > /etc/apt/sources.list.d/llvm.list \
+         echo "deb https://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-${LLVM_VERSION} main" > /etc/apt/sources.list.d/llvm.list \
...
          && apt-get install -y --no-install-recommends \
-              clang-22 lld-22 llvm-22 llvm-22-dev llvm-22-tools llvm-22-runtime \
-              llvm-22-linker-tools libllvm22 libclang-cpp22 libclang1-22 \
-              libclang-common-22-dev libclang-rt-22-dev liblld-22 clangd-22; \
+              clang-${LLVM_VERSION} lld-${LLVM_VERSION} llvm-${LLVM_VERSION} llvm-${LLVM_VERSION}-dev llvm-${LLVM_VERSION}-tools llvm-${LLVM_VERSION}-runtime \
+              llvm-${LLVM_VERSION}-linker-tools libllvm${LLVM_VERSION} libclang-cpp${LLVM_VERSION} libclang1-${LLVM_VERSION} \
+              libclang-common-${LLVM_VERSION}-dev libclang-rt-${LLVM_VERSION}-dev liblld-${LLVM_VERSION} clangd-${LLVM_VERSION}; \
       else \
         wget https://apt.llvm.org/llvm.sh \
         && chmod +x llvm.sh \
-        && ./llvm.sh 22 all \
+        && ./llvm.sh ${LLVM_VERSION} all \
         && rm llvm.sh; \
       fi \
-    && clang-22 --version \
+    && clang-${LLVM_VERSION} --version \
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
ARG LIBZ3_VERSION=4.8.10-1
ARG LIBZ3_SHA256_arm64=ae1ea58ecfdd4b5ec53d734e60ac2df37fddb11888b7730a19335f1a9b09f489
ARG LIBZ3_DEV_SHA256_arm64=4739e62c1f39c35f2382f15347b588245a71bd12c8628a8caa6639fdc1774b6c
RUN wget -qO /etc/apt/trusted.gpg.d/apt.llvm.org.asc https://apt.llvm.org/llvm-snapshot.gpg.key \
&& if [ "$TARGETARCH" = "arm64" ]; then \
echo "deb https://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-22 main" > /etc/apt/sources.list.d/llvm.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends equivs \
&& for p in libstdc++-10-dev libgcc-10-dev libobjc-10-dev; do \
printf 'Section: misc\nPriority: optional\nStandards-Version: 3.9.2\nPackage: %s\nVersion: 99\nDescription: dummy for bullseye clang-22 dep\n' "$p" > /tmp/$p.ctl \
&& (cd /tmp && equivs-build $p.ctl && dpkg -i ${p}_99_all.deb && rm -f $p.ctl ${p}_99_all.deb); \
done \
&& curl -fsSL --retry 5 --retry-connrefused \
"http://deb.debian.org/debian/pool/main/z/z3/libz3-4_${LIBZ3_VERSION}_arm64.deb" -o /tmp/libz3-4.deb \
&& curl -fsSL --retry 5 --retry-connrefused \
"http://deb.debian.org/debian/pool/main/z/z3/libz3-dev_${LIBZ3_VERSION}_arm64.deb" -o /tmp/libz3-dev.deb \
&& echo "${LIBZ3_SHA256_arm64} /tmp/libz3-4.deb" | sha256sum -c - \
&& echo "${LIBZ3_DEV_SHA256_arm64} /tmp/libz3-dev.deb" | sha256sum -c - \
&& dpkg -i /tmp/libz3-4.deb /tmp/libz3-dev.deb \
&& rm -f /tmp/libz3-4.deb /tmp/libz3-dev.deb \
&& apt-get install -y --no-install-recommends \
clang-22 lld-22 llvm-22 llvm-22-dev llvm-22-tools llvm-22-runtime \
llvm-22-linker-tools libllvm22 libclang-cpp22 libclang1-22 \
libclang-common-22-dev libclang-rt-22-dev liblld-22 clangd-22; \
else \
wget https://apt.llvm.org/llvm.sh \
&& chmod +x llvm.sh \
&& ./llvm.sh 22 all \
&& rm llvm.sh; \
fi \
&& clang-22 --version \
ARG LIBZ3_VERSION=4.8.10-1
ARG LIBZ3_SHA256_arm64=ae1ea58ecfdd4b5ec53d734e60ac2df37fddb11888b7730a19335f1a9b09f489
ARG LIBZ3_DEV_SHA256_arm64=4739e62c1f39c35f2382f15347b588245a71bd12c8628a8caa6639fdc1774b6c
RUN wget -qO /etc/apt/trusted.gpg.d/apt.llvm.org.asc https://apt.llvm.org/llvm-snapshot.gpg.key \
&& if [ "$TARGETARCH" = "arm64" ]; then \
echo "deb https://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-${LLVM_VERSION} main" > /etc/apt/sources.list.d/llvm.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends equivs \
&& for p in libstdc++-10-dev libgcc-10-dev libobjc-10-dev; do \
printf 'Section: misc\nPriority: optional\nStandards-Version: 3.9.2\nPackage: %s\nVersion: 99\nDescription: dummy for bullseye clang-22 dep\n' "$p" > /tmp/$p.ctl \
&& (cd /tmp && equivs-build $p.ctl && dpkg -i ${p}_99_all.deb && rm -f $p.ctl ${p}_99_all.deb); \
done \
&& curl -fsSL --retry 5 --retry-connrefused \
"http://deb.debian.org/debian/pool/main/z/z3/libz3-4_${LIBZ3_VERSION}_arm64.deb" -o /tmp/libz3-4.deb \
&& curl -fsSL --retry 5 --retry-connrefused \
"http://deb.debian.org/debian/pool/main/z/z3/libz3-dev_${LIBZ3_VERSION}_arm64.deb" -o /tmp/libz3-dev.deb \
&& echo "${LIBZ3_SHA256_arm64} /tmp/libz3-4.deb" | sha256sum -c - \
&& echo "${LIBZ3_DEV_SHA256_arm64} /tmp/libz3-dev.deb" | sha256sum -c - \
&& dpkg -i /tmp/libz3-4.deb /tmp/libz3-dev.deb \
&& rm -f /tmp/libz3-4.deb /tmp/libz3-dev.deb \
&& apt-get install -y --no-install-recommends \
clang-${LLVM_VERSION} lld-${LLVM_VERSION} llvm-${LLVM_VERSION} llvm-${LLVM_VERSION}-dev llvm-${LLVM_VERSION}-tools llvm-${LLVM_VERSION}-runtime \
llvm-${LLVM_VERSION}-linker-tools libllvm${LLVM_VERSION} libclang-cpp${LLVM_VERSION} libclang1-${LLVM_VERSION} \
libclang-common-${LLVM_VERSION}-dev libclang-rt-${LLVM_VERSION}-dev liblld-${LLVM_VERSION} clangd-${LLVM_VERSION}; \
else \
wget https://apt.llvm.org/llvm.sh \
&& chmod +x llvm.sh \
&& ./llvm.sh ${LLVM_VERSION} all \
&& rm llvm.sh; \
fi \
&& clang-${LLVM_VERSION} --version \
🧰 Tools
🪛 Hadolint (2.14.0)

[info] 150-150: Avoid use of wget without progress bar. Use wget --progress=dot:giga <url>. Or consider using -q or -nv (shorthands for --quiet or --no-verbose).

(DL3047)


[warning] 150-150: Pin versions in apt get install. Instead of apt-get install <package> use apt-get install <package>=<version>

(DL3008)


[warning] 150-150: Either use Wget or Curl but not both

(DL4001)


[warning] 150-150: Use WORKDIR to switch to a directory

(DL3003)


[warning] 150-150: Set the SHELL option -o pipefail before RUN with a pipe in it. If you are using /bin/sh in an alpine image or if your shell is symlinked to busybox then consider explicitly setting your SHELL to /bin/ash, or disable this check

(DL4006)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Dockerfile` around lines 147 - 177, Replace every hardcoded LLVM version
literal in the arm64/bullseye installation block with the existing LLVM_VERSION
build argument, including the apt suite name, LLVM/Clang package names, llvm.sh
invocation, and clang version check. Keep package naming and installation
behavior unchanged while ensuring changing LLVM_VERSION updates the entire
block.

&& rm -rf /var/lib/apt/lists/*

# Configure library paths
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.android
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG MARCH_FLAG="-march=armv8-a+crc -mtune=cortex-a78"
ARG WEBKIT_RELEASE_TYPE=Release
ARG LTO_FLAG=""
ARG LLVM_VERSION="21"
ARG LLVM_VERSION="22"
ARG NDK_VERSION="r27c"
ARG NDK_SHA256="59c2f6dc96743b5daf5d1626684640b20a6bd2b1d85b13156b90333741bad5cc"
ARG ANDROID_API="28"
Expand All @@ -28,7 +28,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \

# Host clang (same version Bun uses) — we cross-compile via --target/--sysroot,
# not via the NDK's bundled clang. apt.llvm.org installs version-suffixed names
# only (ld.lld-21, not ld.lld), so add unversioned links for -fuse-ld=lld.
# only (ld.lld-22, not ld.lld), so add unversioned links for -fuse-ld=lld.
RUN wget -qO- https://apt.llvm.org/llvm.sh | bash -s -- ${LLVM_VERSION} && \
for t in clang clang++ ld.lld lld llvm-ar llvm-ranlib; do \
ln -sf /usr/bin/${t}-${LLVM_VERSION} /usr/local/bin/${t}; \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.freebsd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG MARCH_FLAG="-march=nehalem"
ARG WEBKIT_RELEASE_TYPE=Release
ARG LTO_FLAG=""
ARG LLVM_VERSION="21"
ARG LLVM_VERSION="22"
ARG FREEBSD_VERSION="14.3"
ARG FREEBSD_ARCH="x86_64"
ARG DEFAULT_CFLAGS="-mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -ffunction-sections -fdata-sections -faddrsig -fno-unwind-tables -fno-asynchronous-unwind-tables -DU_STATIC_IMPLEMENTATION=1 "
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile.macos
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ARG BUN_DOWNLOAD_URL="https://pub-5e11e972747a44bf9aaf9394f185a982.r2.dev/releas
ARG WEBKIT_RELEASE_TYPE=Release
ARG LTO_FLAG=""
ARG MARCH_FLAG="-mcpu=apple-m1"
ARG LLVM_VERSION="21"
ARG LLVM_VERSION="22"
ARG BOOTSTRAP_CMDS_TAG="bootstrap_cmds-138"
# Matches the native macOS lane's CMAKE_C_FLAGS (build-reusable.yml) plus -g
# from mac-release.bash. Cross-only additions live in the build stage.
Expand All @@ -47,8 +47,8 @@ ARG ENABLE_MALLOC_HEAP_BREAKDOWN="OFF"
ARG ENABLE_SANITIZERS=""
ARG USE_MIMALLOC="OFF"
ARG USE_EXTERNAL_MIMALLOC="OFF"
ARG COMPILER_RT_DARWIN_TAG="compiler-rt-darwin-21.1.8"
ARG COMPILER_RT_DARWIN_SHA256="f9bab8191d63873682ec69492d06cfdf0807a7335c4e9b188ef013b3cc3c9dbc"
ARG COMPILER_RT_DARWIN_TAG="compiler-rt-darwin-22.1.8"
ARG COMPILER_RT_DARWIN_SHA256="2a6cb08a41880f20f882205d567ee0676ced7db9aaeccfa2e26643d94eca23b7"
Comment on lines +50 to +51

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Version 22.1.8 is duplicated between COMPILER_RT_DARWIN_TAG and the hardcoded filename.

COMPILER_RT_DARWIN_TAG already encodes the version, but the ADD filename at line 116 separately hardcodes 22.1.8 again. If a future bump only updates the tag ARG, the filename would silently mismatch (404 on the wrong artifact). See consolidated comment.

Also applies to: 116-116

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Dockerfile.macos` around lines 50 - 51, Update the Dockerfile macOS artifact
download using COMPILER_RT_DARWIN_TAG so the ADD filename derives its version
from that argument instead of hardcoding 22.1.8. Keep the existing checksum
validation and artifact path behavior unchanged.


FROM ubuntu:24.04 AS base
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
Expand Down Expand Up @@ -113,7 +113,7 @@ ENV MACOS_SDK=/opt/MacOSX${MACOS_SDK_VERSION}.sdk
# in Dockerfile). Installed into clang's resource dir where the darwin
# driver looks for libclang_rt.*_osx*.
ADD --checksum=sha256:${COMPILER_RT_DARWIN_SHA256} \
https://github.com/oven-sh/WebKit/releases/download/${COMPILER_RT_DARWIN_TAG}/compiler-rt-darwin-21.1.8-arm64.tar.gz /compiler-rt-darwin.tar.gz
https://github.com/oven-sh/WebKit/releases/download/${COMPILER_RT_DARWIN_TAG}/compiler-rt-darwin-22.1.8-arm64.tar.gz /compiler-rt-darwin.tar.gz
RUN tar -xzf /compiler-rt-darwin.tar.gz -C /usr/lib/llvm-${LLVM_VERSION}/lib/clang/${LLVM_VERSION}/lib/ && \
rm /compiler-rt-darwin.tar.gz && \
test -f /usr/lib/llvm-${LLVM_VERSION}/lib/clang/${LLVM_VERSION}/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
Expand Down
21 changes: 13 additions & 8 deletions Dockerfile.musl
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ ARG MARCH_FLAG=""
ARG WEBKIT_RELEASE_TYPE=Release
ARG CPU=native
ARG LTO_FLAG="-flto=thin -fno-split-lto-unit -fwhole-program-vtables -fforce-emit-vtables "
ARG LLVM_VERSION="21"
ARG LLVM_VERSION="22"
ARG DEFAULT_CFLAGS="-mno-omit-leaf-frame-pointer -g -fno-omit-frame-pointer -ffunction-sections -fdata-sections -faddrsig -fno-unwind-tables -fno-asynchronous-unwind-tables -DU_STATIC_IMPLEMENTATION=1 "
ARG USE_MIMALLOC="OFF"
ARG USE_EXTERNAL_MIMALLOC="OFF"

FROM alpine:3.23 as base
FROM alpine:3.24 as base

ARG MARCH_FLAG
ARG WEBKIT_RELEASE_TYPE
Expand All @@ -16,14 +16,19 @@ ARG LTO_FLAG
ARG LLVM_VERSION
ARG DEFAULT_CFLAGS

# alpine 3.24 ships clang22/llvm22/lld22 at 22.1.3; edge has 22.1.8. Tag the
# edge repo so only the llvm packages come from there (musl is the same
# version in both, so edge's binaries run on 3.24). Everything else stays on
# 3.24 stable.
RUN echo "@edge https://dl-cdn.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories
RUN apk update
RUN apk add --no-cache cmake make clang21 clang21-static clang21-dev llvm21-dev llvm21-static musl-dev git lld libgcc gcc g++ libstdc++ build-base lld-dev llvm21-libs libc-dev xz zlib zlib-dev libxml2 libxml2-dev
RUN apk add --no-cache cmake make clang22@edge clang22-static@edge clang22-dev@edge llvm22-dev@edge llvm22-static@edge lld22@edge lld22-dev@edge llvm22-libs@edge musl-dev git libgcc gcc g++ libstdc++ build-base libc-dev xz zlib zlib-dev libxml2 libxml2-dev
Comment on lines +23 to +25

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Split apk update/apk add into separate RUN layers.

Static analysis flags this pattern (Trivy DS-0017, Hadolint DL3059): with apk update cached in its own layer, a later rebuild that only touches the apk add layer risks reusing a stale index if Docker's layer cache isn't fully invalidated. Since the new @edge repo line was just added right above, consolidating into one RUN removes this risk cleanly.

♻️ Proposed fix
 RUN echo "`@edge` https://dl-cdn.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories
-RUN apk update
-RUN apk add --no-cache cmake make clang22@edge clang22-static@edge clang22-dev@edge llvm22-dev@edge llvm22-static@edge lld22@edge lld22-dev@edge llvm22-libs@edge musl-dev git libgcc gcc g++ libstdc++ build-base libc-dev xz zlib zlib-dev libxml2 libxml2-dev
+RUN apk update && apk add --no-cache cmake make clang22@edge clang22-static@edge clang22-dev@edge llvm22-dev@edge llvm22-static@edge lld22@edge lld22-dev@edge llvm22-libs@edge musl-dev git libgcc gcc g++ libstdc++ build-base libc-dev xz zlib zlib-dev libxml2 libxml2-dev
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
RUN echo "@edge https://dl-cdn.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories
RUN apk update
RUN apk add --no-cache cmake make clang21 clang21-static clang21-dev llvm21-dev llvm21-static musl-dev git lld libgcc gcc g++ libstdc++ build-base lld-dev llvm21-libs libc-dev xz zlib zlib-dev libxml2 libxml2-dev
RUN apk add --no-cache cmake make clang22@edge clang22-static@edge clang22-dev@edge llvm22-dev@edge llvm22-static@edge lld22@edge lld22-dev@edge llvm22-libs@edge musl-dev git libgcc gcc g++ libstdc++ build-base libc-dev xz zlib zlib-dev libxml2 libxml2-dev
RUN echo "`@edge` https://dl-cdn.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories
RUN apk update && apk add --no-cache cmake make clang22@edge clang22-static@edge clang22-dev@edge llvm22-dev@edge llvm22-static@edge lld22@edge lld22-dev@edge llvm22-libs@edge musl-dev git libgcc gcc g++ libstdc++ build-base libc-dev xz zlib zlib-dev libxml2 libxml2-dev
🧰 Tools
🪛 Hadolint (2.14.0)

[info] 24-24: Multiple consecutive RUN instructions. Consider consolidation.

(DL3059)


[warning] 25-25: Pin versions in apk add. Instead of apk add <package> use apk add <package>=<version>

(DL3018)


[info] 25-25: Multiple consecutive RUN instructions. Consider consolidation.

(DL3059)

🪛 Trivy (0.72.0)

[error] 24-24: 'RUN update' instruction alone

The instruction 'RUN update' should always be followed by ' install' in the same RUN statement.

Rule: DS-0017

Learn more

(IaC/Dockerfile)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Dockerfile.musl` around lines 23 - 25, Combine the repository update, apk
index refresh, and package installation into a single RUN instruction in
Dockerfile.musl. Keep the existing `@edge` repository configuration and package
list unchanged while removing the separate apk update layer.

Source: Linters/SAST tools


ENV CXX=clang++-21
ENV CC=clang-21
ENV LDFLAGS='-L/usr/include -L/usr/include/llvm21'
ENV CXXFLAGS="-I/usr/include -I/usr/include/llvm21"
ENV PATH="/usr/bin:/usr/local/bin:/zig/bin:/usr/lib/llvm21/bin:$PATH"
ENV CXX=clang++-22
ENV CC=clang-22
ENV LDFLAGS='-L/usr/include -L/usr/include/llvm22'
ENV CXXFLAGS="-I/usr/include -I/usr/include/llvm22"
ENV PATH="/usr/bin:/usr/local/bin:/zig/bin:/usr/lib/llvm22/bin:$PATH"
ENV CPU=${CPU}
ENV MARCH_FLAG=${MARCH_FLAG}
ENV WEBKIT_OUT_DIR=/webkitbuild
Expand Down
26 changes: 13 additions & 13 deletions Dockerfile.windows
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ ARG ICU_MARCH_FLAG="-march=nehalem"
ARG ENABLE_SANITIZERS=""
ARG USE_MIMALLOC="OFF"
ARG USE_EXTERNAL_MIMALLOC="OFF"
ARG LLVM_VERSION="21"
ARG LLVM_VERSION="22"
ARG XWIN_VERSION="0.9.0"
ARG XWIN_SHA256="31e1033f30608ba6b821d17f1461042bd54c23424813c9b4e9ae15b6d32fa4cd"
# Pinned MSVC CRT + Windows SDK versions. Bump deliberately; the manifest on
Expand Down Expand Up @@ -125,10 +125,10 @@ RUN set -e; \
# 2.0 with LLVM exceptions; redistribution is permitted.
# OptionsMSVC.cmake's find_library(CLANG_BUILTINS_LIBRARY) searches
# WebKitLibraries/windows, which is symlinked to /winsdk in the build stage.
ADD --checksum=sha256:9cff03d2c5218693b1f91efc0074957c710eeddd932d57a681c8f558b81fbe8e \
https://github.com/oven-sh/WebKit/releases/download/compiler-rt-windows-21.1.8/clang_rt.builtins-x86_64.lib /winsdk/clang_rt.builtins-x86_64.lib
ADD --checksum=sha256:b1bfec6276dde6166aa038de10c378ec17996779786fe1747c40b833cb826e16 \
https://github.com/oven-sh/WebKit/releases/download/compiler-rt-windows-21.1.8/clang_rt.builtins-aarch64.lib /winsdk/clang_rt.builtins-aarch64.lib
ADD --checksum=sha256:22fb8699144ab076d5e331b3deb804e591c43905ec7e0fa5c62ba28f8679d68b \
https://github.com/oven-sh/WebKit/releases/download/compiler-rt-windows-22.1.8/clang_rt.builtins-x86_64.lib /winsdk/clang_rt.builtins-x86_64.lib
ADD --checksum=sha256:06a345ec83e1f19b62442ef6b615ea742effd2593581692fd15d38a10847f5bf \
https://github.com/oven-sh/WebKit/releases/download/compiler-rt-windows-22.1.8/clang_rt.builtins-aarch64.lib /winsdk/clang_rt.builtins-aarch64.lib

# Windows ASAN/UBSan runtime for the -asan variant, mirrored from the same
# LLVM release as the builtins above (x64 only: LLVM ships no Windows ARM64
Expand All @@ -139,14 +139,14 @@ ADD --checksum=sha256:b1bfec6276dde6166aa038de10c378ec17996779786fe1747c40b833cb
# UBSan handlers, so -fsanitize=address,undefined needs no separate
# ubsan_standalone libraries. A Linux LLVM install doesn't ship any of these;
# WebKitCompilerFlags.cmake locates them via CLANG_LIB_PATH (set below).
ADD --checksum=sha256:3dff47943143ab2c1a786a7c90c88f897bfa34e8b5a4c9382eadf8373fd19ec0 \
https://github.com/oven-sh/WebKit/releases/download/compiler-rt-windows-21.1.8/clang_rt.asan_dynamic-x86_64.lib /winsdk/clang_rt.asan_dynamic-x86_64.lib
ADD --checksum=sha256:d4a0398ed7d2e1361674fbb2cfceec4df502052cfe17b51718b061e9fe523719 \
https://github.com/oven-sh/WebKit/releases/download/compiler-rt-windows-21.1.8/clang_rt.asan_static_runtime_thunk-x86_64.lib /winsdk/clang_rt.asan_static_runtime_thunk-x86_64.lib
ADD --checksum=sha256:b3c1d6c988792651cc0b0b61b4114cbe513a5e2f6beb067fd54a96b98be9b328 \
https://github.com/oven-sh/WebKit/releases/download/compiler-rt-windows-21.1.8/clang_rt.asan_dynamic_runtime_thunk-x86_64.lib /winsdk/clang_rt.asan_dynamic_runtime_thunk-x86_64.lib
ADD --checksum=sha256:14025e779d3c67c53027312d7542aea8f814e5237e59f41cfc6165666189f886 \
https://github.com/oven-sh/WebKit/releases/download/compiler-rt-windows-21.1.8/clang_rt.asan_dynamic-x86_64.dll /winsdk/clang_rt.asan_dynamic-x86_64.dll
ADD --checksum=sha256:208ff221af5dff61be90398b1e569d1b2f3b5335066c5c87444454920c3eadb6 \
https://github.com/oven-sh/WebKit/releases/download/compiler-rt-windows-22.1.8/clang_rt.asan_dynamic-x86_64.lib /winsdk/clang_rt.asan_dynamic-x86_64.lib
ADD --checksum=sha256:e9571b2c165e1c74475e887858ad344769bb2613547bb91cfe3ada44d378f7bb \
https://github.com/oven-sh/WebKit/releases/download/compiler-rt-windows-22.1.8/clang_rt.asan_static_runtime_thunk-x86_64.lib /winsdk/clang_rt.asan_static_runtime_thunk-x86_64.lib
ADD --checksum=sha256:ec97ba766ff24271f7848393601fe5f3eb0c95c3c6cbedfd0913434e425c9096 \
https://github.com/oven-sh/WebKit/releases/download/compiler-rt-windows-22.1.8/clang_rt.asan_dynamic_runtime_thunk-x86_64.lib /winsdk/clang_rt.asan_dynamic_runtime_thunk-x86_64.lib
ADD --checksum=sha256:273d06d96cf390f551b2e0ac36de3a82cf2150271ffc1f5f8b13588ee0df7482 \
https://github.com/oven-sh/WebKit/releases/download/compiler-rt-windows-22.1.8/clang_rt.asan_dynamic-x86_64.dll /winsdk/clang_rt.asan_dynamic-x86_64.dll

# Sanity check: compile + link a PE executable for both arches.
RUN for pair in "x86_64 x64" "aarch64 arm64"; do \
Expand Down
4 changes: 2 additions & 2 deletions build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ const HAS_CCACHE = CCACHE !== null;
// On Windows, use clang-cl for MSVC compatibility
const CC_BASE = IS_WINDOWS
? findExecutable(["clang-cl.exe", "clang-cl"]) || "clang-cl"
: findExecutable(["clang-21", "clang"]) || "clang";
: findExecutable(["clang-22", "clang"]) || "clang";
const CXX_BASE = IS_WINDOWS
? findExecutable(["clang-cl.exe", "clang-cl"]) || "clang-cl"
: findExecutable(["clang++-21", "clang++"]) || "clang++";
: findExecutable(["clang++-22", "clang++"]) || "clang++";

const CC = HAS_CCACHE ? CCACHE : CC_BASE;
const CXX = HAS_CCACHE ? CCACHE : CXX_BASE;
Expand Down
Loading
Loading