Commit 3c94377ba for imagemagick.org

commit 3c94377ba63f3ed31e2f8272e2681bda25992183
Author: Dirk Lemstra <dirk@lemstra.org>
Date:   Sun Nov 1 20:47:56 2026 +0100

    Added portable linux build.

diff --git a/.github/build/windows/create-sbom.py b/.github/build/shared/create-sbom.py
similarity index 100%
rename from .github/build/windows/create-sbom.py
rename to .github/build/shared/create-sbom.py
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 71b5f4897..5c63a267a 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -9,12 +9,14 @@ on:
     - configure
     - m4/version.m4
     - .github/build/windows/download-configure.sh
+    - .github/build/shared/create-sbom.py
     - .github/build/shared/download-dependencies.sh
     - .github/workflows/release.yml
   pull_request:
     branches:
     - main
     paths:
+    - .github/build/shared/create-sbom.py
     - .github/workflows/release.yml

 permissions:
@@ -217,7 +219,7 @@ jobs:
           MAGICK_VERSION: ${{needs.version.outputs.version}}
           FILENAME: ImageMagick-${{needs.version.outputs.version}}-${{matrix.quantum}}${{matrix.hdri_flag}}-${{matrix.architecture}}-${{matrix.typeName}}.cdx.json
         run: |
-          python ImageMagick\.github\build\windows\create-sbom.py Configure\Installer\Inno\Artifacts\%FILENAME%
+          python ImageMagick\.github\build\shared\create-sbom.py Configure\Installer\Inno\Artifacts\%FILENAME%

       - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 #v7.0.2
         with:
@@ -363,7 +365,7 @@ jobs:
           MAGICK_VERSION: ${{needs.version.outputs.version}}
           FILENAME: ImageMagick-${{needs.version.outputs.version}}-portable-${{matrix.quantum}}${{matrix.hdri_flag}}-${{matrix.architecture}}.cdx.json
         run: |
-          python ImageMagick\.github\build\windows\create-sbom.py %FILENAME%
+          python ImageMagick\.github\build\shared\create-sbom.py %FILENAME%

       - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 #v7.0.2
         with:
@@ -515,6 +517,128 @@ jobs:
           name: AppImage
           path: artifacts

+  linux_portable:
+    name: Linux portable Q${{matrix.quantum}}${{matrix.hdri_flag}}-${{matrix.architecture}}
+    container:
+      image: ubuntu:20.04
+    runs-on: ${{matrix.runner}}
+    needs:
+      - changelog
+      - version
+
+    strategy:
+      fail-fast: false
+      matrix:
+        architecture: [ x64, arm64 ]
+        quantum: [ 16, 8 ]
+        hdri: [ yes, no ]
+        exclude:
+          - quantum: 8
+            hdri: yes
+        include:
+          - architecture: x64
+            runner: ubuntu-24.04
+            triplet: x86_64-linux-gnu
+          - architecture: arm64
+            runner: ubuntu-24.04-arm
+            triplet: aarch64-linux-gnu
+          - hdri: yes
+            hdri_flag: -HDRI
+
+    env:
+      PACKAGE_NAME: ImageMagick-${{needs.version.outputs.version}}-portable-Q${{matrix.quantum}}${{matrix.hdri_flag}}-linux-${{matrix.architecture}}
+
+    steps:
+      - name: Install dependencies
+        run: |
+          set -e
+          export DEBIAN_FRONTEND=noninteractive
+          apt-get update -y
+          apt-get install -y autoconf ca-certificates curl gcc g++ git make pkg-config python3 unzip xz-utils
+
+      - name: Clone ImageMagick
+        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 #v7.0.1
+        with:
+          persist-credentials: false
+
+      - name: Download dependencies
+        run: |
+          bash .github/build/shared/download-dependencies.sh --dependencies-artifact linux-${{matrix.architecture}}-static.zip
+          mkdir -p /tmp/dependencies
+          mv Artifacts/include Artifacts/lib /tmp/dependencies/
+
+      - name: Download ChangeLog.md
+        uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 #v8.0.2
+        with:
+          name: ChangeLog
+
+      - name: Configure ImageMagick
+        env:
+          CC: gcc
+          CXX: g++
+          CFLAGS: -O3
+          CXXFLAGS: -O3
+          CPPFLAGS: -I/tmp/dependencies/include
+          LDFLAGS: -L/tmp/dependencies/lib -L/tmp/dependencies/lib/${{matrix.triplet}}
+          PKG_CONFIG_LIBDIR: /tmp/dependencies/lib/pkgconfig:/tmp/dependencies/lib/${{matrix.triplet}}/pkgconfig
+          PKG_CONFIG: pkg-config --static
+        run: |
+          ./configure --prefix=/usr --disable-installed --disable-shared --enable-static --without-modules --without-magick-plus-plus --without-perl --without-x --with-rsvg --with-quantum-depth=${{matrix.quantum}} --enable-hdri=${{matrix.hdri}}
+
+      - name: Build ImageMagick
+        run: |
+          make -j$(nproc)
+          make install DESTDIR="$GITHUB_WORKSPACE/portable"
+
+      - name: Create portable archive
+        run: |
+          set -e
+          mkdir -p "$PACKAGE_NAME/bin" "$PACKAGE_NAME/etc" "$PACKAGE_NAME/share"
+          cp portable/usr/bin/magick "$PACKAGE_NAME/bin/"
+          strip "$PACKAGE_NAME/bin/magick"
+          for utility in compare composite conjure convert identify magick-script mogrify montage stream; do
+            ln -s magick "$PACKAGE_NAME/bin/$utility"
+          done
+          cp -a portable/usr/etc/ImageMagick-7 "$PACKAGE_NAME/etc/"
+          cp -a portable/usr/share/ImageMagick-7 "$PACKAGE_NAME/share/"
+          cp portable/usr/lib/ImageMagick-*/config-*/configure.xml "$PACKAGE_NAME/etc/ImageMagick-7/"
+          cp ChangeLog.md LICENSE NOTICE "$PACKAGE_NAME/"
+          cp config/sRGB.icm "$PACKAGE_NAME/sRGB.icc"
+          mkdir -p artifacts
+          XZ_OPT="-9e" tar -cJf "artifacts/$PACKAGE_NAME.tar.xz" "$PACKAGE_NAME"
+
+      - name: Test portable archive
+        run: |
+          set -e
+          mkdir portable-test
+          tar -xJf "artifacts/$PACKAGE_NAME.tar.xz" -C portable-test
+          cd portable-test
+          magick="$PWD/$PACKAGE_NAME/bin/magick"
+          "$magick" -version
+          "$magick" -list policy | grep -F "$PWD/$PACKAGE_NAME/etc/ImageMagick-7/policy.xml"
+          ldd "$magick" | tee runtime-libraries.txt
+          if grep -q "not found" runtime-libraries.txt; then
+            exit 1
+          fi
+          if grep " => " runtime-libraries.txt | grep -Ev '^[[:space:]]*(libc|libm|libdl|libpthread|libresolv|librt|libstdc\+\+|libgcc_s|libgomp)\.so'; then
+            echo "Unexpected shared dependency in portable build"
+            exit 1
+          fi
+
+      - name: Create SBOM
+        env:
+          MAGICK_COMMIT: ${{github.sha}}
+          MAGICK_TIMESTAMP: ${{needs.version.outputs.timestamp}}
+          MAGICK_VERSION: ${{needs.version.outputs.version}}
+        run: |
+          python3 .github/build/shared/create-sbom.py "artifacts/$PACKAGE_NAME.cdx.json"
+
+      - name: Upload portable archive and SBOM
+        uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 #v7.0.2
+        with:
+          name: ImageMagick-${{needs.version.outputs.version}}-portable-Q${{matrix.quantum}}${{matrix.hdri_flag}}-linux-${{matrix.architecture}}
+          path: artifacts
+
   source:
     name: Create source archive
     runs-on: ubuntu-24.04
@@ -592,6 +716,7 @@ jobs:
       - version
       - source
       - linux_app_image
+      - linux_portable
       - windows_installer
       - windows_portable
       - windows_source