Truly independent web browser
Meta+CI: Package AppImages in Build Release
Jelle Raaijmakers17279a4ca566
diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.ymlindex 3172416f807..54f4b8b8e69 100644--- a/.github/workflows/build-release.yml+++ b/.github/workflows/build-release.yml@@ -83,6 +83,7 @@ jobs:runner_labels: '["blacksmith-16vcpu-ubuntu-2404"]'container: &noble_container '{"image":"docker.io/library/ubuntu:24.04","options":"--ulimit core=1"}'packages: 'DEB'+ appimage: true- system: 'Ubuntu 24.04'os_name: 'Linux'@@ -90,6 +91,7 @@ jobs:runner_labels: '["blacksmith-16vcpu-ubuntu-2404-arm"]'container: *noble_containerpackages: 'DEB'+ appimage: true- system: 'Ubuntu 26.04'os_name: 'Linux'@@ -171,6 +173,15 @@ jobs:cpack -G "${{ matrix.packages }}" -B packages \-D CPACK_COMPONENTS_ALL="ladybird_Runtime;ladybird_SystemIntegration;ladybird_SystemSymbols"+ # The AppImage is built on Ubuntu 24.04, the oldest system that Ladybird builds for, so that it runs on systems with+ # the same glibc or newer.+ - name: Package the AppImage+ if: ${{ matrix.appimage && inputs.version != '' }}+ env:+ RELEASE_VERSION: ${{ inputs.version }}+ ARCH: ${{ matrix.arch }}+ run: ./Meta/package-appimage.sh Build "$RELEASE_VERSION" "$ARCH" Build/packages+# release-tools publishes the source archive of every LGPL port at the address that LICENSES.txt names.- name: Package the source code of the LGPL librariesif: ${{ inputs.version != '' }}@@ -193,6 +204,7 @@ jobs:Build/packages/*.tar.xzBuild/packages/*.debBuild/packages/*.rpm+ Build/packages/*.AppImageBuild/packages/*-third-party-sources.tar- name: Upload@@ -247,6 +259,14 @@ jobs:archive: falseif-no-files-found: error+ - name: Upload the AppImage+ if: ${{ matrix.appimage && inputs.version != '' }}+ uses: actions/upload-artifact@v7+ with:+ path: Build/packages/ladybird-*.AppImage+ archive: false+ if-no-files-found: error+- name: Upload the source code of the LGPL librariesif: ${{ inputs.version != '' }}uses: actions/upload-artifact@v7diff --git a/Meta/package-appimage.sh b/Meta/package-appimage.shnew file mode 100755index 00000000000..5c7b7b4f37b--- /dev/null+++ b/Meta/package-appimage.sh@@ -0,0 +1,87 @@+#!/usr/bin/env bash++# Packages an installed Ladybird build as an AppImage, which names the zsync file that updates it.+#+# Usage: package-appimage.sh BUILD_DIRECTORY VERSION ARCHITECTURE OUTPUT_DIRECTORY+# BUILD_DIRECTORY is a configured and built Distribution build of Linux, and ARCHITECTURE is x86_64 or arm64.++set -euo pipefail++if [ "$#" -ne 4 ]; then+ echo "Usage: $0 BUILD_DIRECTORY VERSION ARCHITECTURE OUTPUT_DIRECTORY" >&2+ exit 1+fi++version=$2+case "$3" in+ x86_64) architecture=x86_64 ;;+ arm64 | aarch64) architecture=aarch64 ;;+ *)+ echo "Unknown architecture: $3" >&2+ exit 1+ ;;+esac+build_directory=$(realpath "$1")+mkdir -p "$4"+output_directory=$(realpath "$4")++LINUXDEPLOY_URL=https://github.com/linuxdeploy/linuxdeploy/releases/download/1-alpha-20251107-1+APPIMAGETOOL_URL=https://github.com/AppImage/appimagetool/releases/download/1.9.1+RUNTIME_URL=https://github.com/AppImage/type2-runtime/releases/download/20251108++case "$architecture" in+ x86_64)+ LINUXDEPLOY_SHA256=c20cd71e3a4e3b80c3483cef793cda3f4e990aca14014d23c544ca3ce1270b4d+ APPIMAGETOOL_SHA256=ed4ce84f0d9caff66f50bcca6ff6f35aae54ce8135408b3fa33abfc3cb384eb0+ RUNTIME_SHA256=2fca8b443c92510f1483a883f60061ad09b46b978b2631c807cd873a47ec260d+ ;;+ aarch64)+ LINUXDEPLOY_SHA256=620095110d693282b8ebeb244a95b5e911cf8f65f76c88b4b47d16ae6346fcff+ APPIMAGETOOL_SHA256=f0837e7448a0c1e4e650a93bb3e85802546e60654ef287576f46c71c126a9158+ RUNTIME_SHA256=00cbdfcf917cc6c0ff6d3347d59e0ca1f7f45a6df1a428a0d6d8a78664d87444+ ;;+esac++name="ladybird-${version}-Linux-${architecture}.AppImage"+update_information="zsync|https://download.ladybird.org/linux/latest/ladybird-Linux-${architecture}.AppImage.zsync"++work_directory=$(mktemp -d)+trap 'rm -rf "$work_directory"' EXIT++fetch() {+ local url=$1 sha256=$2 file=$3+ curl --fail --location --silent --show-error --output "$work_directory/$file" "$url"+ echo "$sha256 $work_directory/$file" | sha256sum --check --quiet+ chmod +x "$work_directory/$file"+}++fetch "$LINUXDEPLOY_URL/linuxdeploy-$architecture.AppImage" "$LINUXDEPLOY_SHA256" linuxdeploy+fetch "$APPIMAGETOOL_URL/appimagetool-$architecture.AppImage" "$APPIMAGETOOL_SHA256" appimagetool+fetch "$RUNTIME_URL/runtime-$architecture" "$RUNTIME_SHA256" runtime++# The AppImage tools are AppImages themselves, which run without FUSE in a container.+export APPIMAGE_EXTRACT_AND_RUN=1++appdir="$work_directory/AppDir"+for component in ladybird_Runtime ladybird_Freedesktop; do+ cmake --install "$build_directory" --prefix "$appdir/usr" --component "$component"+done+echo AppImage >"$appdir/usr/share/Lagom/package-format"++"$work_directory/linuxdeploy" --appdir "$appdir" \+ --deploy-deps-only "$appdir/usr/lib" --deploy-deps-only "$appdir/usr/libexec" \+ --executable "$appdir/usr/bin/Ladybird" \+ --desktop-file "$appdir/usr/share/applications/org.ladybird.Ladybird.desktop" \+ --icon-file "$appdir/usr/share/icons/hicolor/scalable/apps/org.ladybird.Ladybird.svg"++# linuxdeploy gives every library the runpath of one in usr/lib, which the plugins in directories below it do not share.+while IFS= read -r library; do+ if patchelf --print-rpath "$library" >/dev/null 2>&1; then+ patchelf --set-rpath "\$ORIGIN:\$ORIGIN/$(realpath --relative-to="$(dirname "$library")" "$appdir/usr/lib")" "$library"+ fi+done < <(find "$appdir/usr/lib" -mindepth 2 -type f -name '*.so*')++ln -sf usr/bin/Ladybird "$appdir/AppRun"++ARCH="$architecture" "$work_directory/appimagetool" --no-appstream --runtime-file "$work_directory/runtime" \+ -u "$update_information" "$appdir" "$output_directory/$name"