Truly independent web browser
Meta: Install the CI image's build dependencies with a script
Jelle Raaijmakers67cac576d164
diff --git a/.github/workflows/ci-image.yml b/.github/workflows/ci-image.ymlindex 205bd1adf9d..f57ac584624 100644--- a/.github/workflows/ci-image.yml+++ b/.github/workflows/ci-image.yml@@ -54,7 +54,7 @@ jobs:shell: bashrun: |changed_files="$(git diff --name-only "${{ github.event.pull_request.base.sha }}...HEAD")"- if grep -Eqx 'Meta/Docker/ci/Dockerfile|rust-toolchain.toml' <<< "${changed_files}" \+ if grep -Eqx 'Meta/Docker/ci/Dockerfile|Meta/Docker/ci/install-build-dependencies.sh|rust-toolchain.toml' <<< "${changed_files}" \&& ! grep -qx 'Meta/Docker/ci/VERSION' <<< "${changed_files}"; thenecho "Meta/Docker/ci/VERSION must change when CI image inputs change."exit 1diff --git a/Meta/Docker/ci/Dockerfile b/Meta/Docker/ci/Dockerfileindex 94d02629b17..06d41ffc5e7 100644--- a/Meta/Docker/ci/Dockerfile+++ b/Meta/Docker/ci/Dockerfile@@ -2,7 +2,12 @@ FROM ubuntu:26.04ARG GCC_VERSION=16ARG LLVM_VERSION=22+ARG RUSTUP_VERSION=1.29.3+ARG RUSTUP_INIT_SHA256_X86_64=b1c8cb14e30889e7e2999e6b69e62d9e9b9ffc0f4df8180564d306d9680e6c55+ARG RUSTUP_INIT_SHA256_AARCH64=9f608c142e0e38a78957d0661ba1dfaf0b6fb37184cfaa4b9a0aa57af6184282ARG WASM_TOOLS_VERSION=1.243.0+ARG WASM_TOOLS_SHA256_X86_64=f261622f8015d38ebe9c3345cc2f7bb5de055d3a66ab44efdf78f11068ed9d9f+ARG WASM_TOOLS_SHA256_AARCH64=ad06ba3c527992a1e6e9a7e807cc2bb914072f0a0ae6ce71680de91b1054d2e9ENV DEBIAN_FRONTEND=noninteractiveENV RUSTUP_HOME=/opt/rustup@@ -11,7 +16,8 @@ ENV PATH=/opt/cargo/bin:$PATHSHELL ["/bin/bash", "-o", "pipefail", "-c"]-COPY rust-toolchain.toml /tmp/rust-toolchain.toml+COPY rust-toolchain.toml /tmp/ladybird/rust-toolchain.toml+COPY install-build-dependencies.sh /tmp/ladybird/Meta/Docker/ci/install-build-dependencies.shRUN apt-get update -o APT::Update::Error-Mode=any \&& apt-get install -y --no-install-recommends \@@ -23,100 +29,38 @@ RUN apt-get update -o APT::Update::Error-Mode=any \&& UBUNTU_RELEASE="$(lsb_release -cs)" \&& curl -fsSL https://apt.kitware.com/keys/kitware-archive-latest.asc | gpg --dearmor -o /usr/share/keyrings/kitware-archive-keyring.gpg \&& echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ ${UBUNTU_RELEASE} main" > /etc/apt/sources.list.d/kitware.list \- && apt-get update -o APT::Update::Error-Mode=any \+ && /tmp/ladybird/Meta/Docker/ci/install-build-dependencies.sh \&& apt-get install -y --no-install-recommends \at-spi2-core \- autoconf \- autoconf-archive \- automake \- build-essential \ccache \- clang-${LLVM_VERSION} \clang-format-${LLVM_VERSION} \clang-tools-${LLVM_VERSION} \- cmake \dbus-x11 \- file \- fonts-liberation2 \g++-${GCC_VERSION} \gcc-${GCC_VERSION} \generate-ninja \gir1.2-atspi-2.0 \- git \jq \libcurl4-openssl-dev \- libdrm-dev \- libegl1-mesa-dev \- libgl1-mesa-dev \- libpulse-dev \libssl-dev \- libstdc++-${GCC_VERSION}-dev \- libtool \- libxcb-icccm4-dev \libclang-${LLVM_VERSION}-dev \- libclang-rt-${LLVM_VERSION}-dev \- lld-${LLVM_VERSION} \- llvm-${LLVM_VERSION} \llvm-${LLVM_VERSION}-dev \- nasm \- ninja-build \nodejs \npm \openssl \optipng \orca \- pkg-config \- pulseaudio \- python3 \python3-dasbus \python3-gi \python3-psutil \- python3-venv \- qt6-base-private-dev \- qt6-positioning-dev \- qt6-tools-dev-tools \rsync \sccache \shellcheck \- tar \- unzip \xvfb \- xz-utils \- zip \zstd \- && update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${LLVM_VERSION} 100 \- && update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${LLVM_VERSION} 100 \&& update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-${LLVM_VERSION} 100 \&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_VERSION} 100 \&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${GCC_VERSION} 100 \- && update-alternatives --install /usr/bin/ld.lld ld.lld /usr/bin/ld.lld-${LLVM_VERSION} 100 \- && update-alternatives --install /usr/bin/lld lld /usr/bin/lld-${LLVM_VERSION} 100 \- && update-alternatives --install /usr/bin/llvm-symbolizer llvm-symbolizer /usr/bin/llvm-symbolizer-${LLVM_VERSION} 100 \&& npm install -g [email protected] \- && rustup_init="$(mktemp)" \- && curl -fsSL https://sh.rustup.rs -o "${rustup_init}" \- && chmod +x "${rustup_init}" \- && rust_toolchain="$(grep -E '^channel = ' /tmp/rust-toolchain.toml | cut -d '"' -f 2)" \- && "${rustup_init}" -y --no-modify-path --profile minimal --default-toolchain "${rust_toolchain}" \- && rm "${rustup_init}" \&& rustup component add rustfmt clippy \- && rm -rf /opt/rustup/downloads /opt/rustup/tmp /opt/cargo/registry /tmp/rust-toolchain.toml \- && rm -rf /var/lib/apt/lists/*--ARG TARGETARCH--# wasm-tools is required at build time to generate the WebAssembly spec tests-# (INCLUDE_WASM_SPEC_TESTS). The version is pinned for reproducible test generation.-RUN case "${TARGETARCH}" in \- amd64) WASM_TOOLS_ARCH=x86_64 ;; \- arm64) WASM_TOOLS_ARCH=aarch64 ;; \- *) echo "Unsupported TARGETARCH: ${TARGETARCH}" >&2 ; exit 1 ;; \- esac \- && NAME="wasm-tools-${WASM_TOOLS_VERSION}-${WASM_TOOLS_ARCH}-linux" \- && curl -fsSL --retry 5 --retry-delay 5 --retry-all-errors \- "https://github.com/bytecodealliance/wasm-tools/releases/download/v${WASM_TOOLS_VERSION}/${NAME}.tar.gz" \- -o /tmp/wasm-tools.tar.gz \- && tar -xzf /tmp/wasm-tools.tar.gz -C /tmp \- && install -m 0755 "/tmp/${NAME}/wasm-tools" /usr/local/bin/wasm-tools \- && rm -rf /tmp/wasm-tools.tar.gz "/tmp/${NAME}" \- && wasm-tools --version+ && rm -rf /opt/rustup/downloads /opt/rustup/tmp /opt/cargo/registry /tmp/ladybird /var/lib/apt/lists/*diff --git a/Meta/Docker/ci/VERSION b/Meta/Docker/ci/VERSIONindex a0914a44d4a..e0338917c27 100644--- a/Meta/Docker/ci/VERSION+++ b/Meta/Docker/ci/VERSION@@ -1 +1 @@-2026.10.29+2026.11.11diff --git a/Meta/Docker/ci/install-build-dependencies.sh b/Meta/Docker/ci/install-build-dependencies.shnew file mode 100755index 00000000000..e4de5ba3fbe--- /dev/null+++ b/Meta/Docker/ci/install-build-dependencies.sh@@ -0,0 +1,125 @@+#!/usr/bin/env bash++# Installs what building Ladybird needs into the CI image.+# The CI image's Dockerfile pins the versions and digests of what this installs, which its build passes in and which are+# read from it otherwise.++set -euo pipefail++SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"+CI_DOCKERFILE="${SOURCE_DIR}/Meta/Docker/ci/Dockerfile"++ci_image_argument() {+ local value="${!1:-}"+ if [ -n "${value}" ]; then+ echo "${value}"+ return+ fi+ value="$(sed -n "s/^ARG $1=//p" "${CI_DOCKERFILE}")"+ if [ -z "${value}" ]; then+ echo "${CI_DOCKERFILE} has no ARG $1." >&2+ exit 1+ fi+ echo "${value}"+}++download() {+ local url="$1" sha256="$2" output="$3"+ curl --fail --silent --show-error --location --retry 5 --retry-all-errors --output "${output}" "${url}"+ echo "${sha256} ${output}" | sha256sum --check --quiet+}++ARCH="$(uname -m)"+case "${ARCH}" in+ x86_64) ARCH_ARGUMENT=X86_64 ;;+ aarch64) ARCH_ARGUMENT=AARCH64 ;;+ *) echo "Installing the build dependencies on ${ARCH} is not supported." >&2; exit 1 ;;+esac++LLVM_VERSION="$(ci_image_argument LLVM_VERSION)"+GCC_VERSION="$(ci_image_argument GCC_VERSION)"+RUSTUP_VERSION="$(ci_image_argument RUSTUP_VERSION)"+RUSTUP_INIT_SHA256="$(ci_image_argument "RUSTUP_INIT_SHA256_${ARCH_ARGUMENT}")"+WASM_TOOLS_VERSION="$(ci_image_argument WASM_TOOLS_VERSION)"+WASM_TOOLS_SHA256="$(ci_image_argument "WASM_TOOLS_SHA256_${ARCH_ARGUMENT}")"++# shellcheck source=/dev/null+. /etc/os-release++case "${ID}" in+ ubuntu)+ export DEBIAN_FRONTEND=noninteractive+ apt-get update -o APT::Update::Error-Mode=any+ apt-get install -y --no-install-recommends \+ autoconf \+ autoconf-archive \+ automake \+ build-essential \+ ca-certificates \+ clang-"${LLVM_VERSION}" \+ cmake \+ curl \+ dpkg-dev \+ file \+ fonts-liberation2 \+ git \+ libclang-rt-"${LLVM_VERSION}"-dev \+ libdrm-dev \+ libegl1-mesa-dev \+ libgl1-mesa-dev \+ libpulse-dev \+ libstdc++-"${GCC_VERSION}"-dev \+ libtool \+ libxcb-icccm4-dev \+ lld-"${LLVM_VERSION}" \+ llvm-"${LLVM_VERSION}" \+ nasm \+ ninja-build \+ pkg-config \+ pulseaudio \+ python3 \+ python3-venv \+ qt6-base-private-dev \+ qt6-positioning-dev \+ qt6-tools-dev-tools \+ tar \+ unzip \+ xz-utils \+ zip+ for tool in clang clang++ ld.lld lld llvm-symbolizer; do+ update-alternatives --install "/usr/bin/${tool}" "${tool}" "/usr/bin/${tool}-${LLVM_VERSION}" 100+ done+ ;;+ *)+ echo "Installing the build dependencies on ${PRETTY_NAME:-${ID}} is not supported." >&2+ exit 1+ ;;+esac++clang_major="$(clang -dumpversion | cut -d . -f 1)"+if [ "${clang_major}" != "${LLVM_VERSION}" ]; then+ echo "${PRETTY_NAME} installed Clang ${clang_major}, but Ladybird builds with Clang ${LLVM_VERSION}." >&2+ exit 1+fi++export RUSTUP_HOME=/opt/rustup+export CARGO_HOME=/opt/cargo+rust_toolchain="$(sed -n 's/^channel = "\(.*\)"/\1/p' "${SOURCE_DIR}/rust-toolchain.toml")"+rustup_init_directory="$(mktemp -d)"+download "https://static.rust-lang.org/rustup/archive/${RUSTUP_VERSION}/${ARCH}-unknown-linux-gnu/rustup-init" \+ "${RUSTUP_INIT_SHA256}" "${rustup_init_directory}/rustup-init"+chmod +x "${rustup_init_directory}/rustup-init"+"${rustup_init_directory}/rustup-init" -y --no-modify-path --profile minimal --default-toolchain "${rust_toolchain}"+rm "${rustup_init_directory}/rustup-init"+rmdir "${rustup_init_directory}"+rm -rf "${RUSTUP_HOME}/downloads" "${RUSTUP_HOME}/tmp" "${CARGO_HOME}/registry"++# wasm-tools is required at build time to generate the WebAssembly spec tests (INCLUDE_WASM_SPEC_TESTS). The version is+# pinned for reproducible test generation.+wasm_tools="wasm-tools-${WASM_TOOLS_VERSION}-${ARCH}-linux"+wasm_tools_archive="$(mktemp)"+download "https://github.com/bytecodealliance/wasm-tools/releases/download/v${WASM_TOOLS_VERSION}/${wasm_tools}.tar.gz" \+ "${WASM_TOOLS_SHA256}" "${wasm_tools_archive}"+tar -xzf "${wasm_tools_archive}" -C /usr/local/bin --strip-components=1 "${wasm_tools}/wasm-tools"+rm "${wasm_tools_archive}"+wasm-tools --version