diff --git a/docs/packages/pyvips-binary.yaml b/docs/packages/pyvips-binary.yaml index 205d38ed3ca..18799574f96 100644 --- a/docs/packages/pyvips-binary.yaml +++ b/docs/packages/pyvips-binary.yaml @@ -12,3 +12,4 @@ versions: gpl-sources: filename: gpl-sources.tar description: libvips, GLib, Pango, librsvg, libheif, libexif, FriBidi +- version: 8.18.7 diff --git a/patches/pyvips-binary/8.18.7/0001-libvips-packaging-add-a-linux-riscv64-platform.patch b/patches/pyvips-binary/8.18.7/0001-libvips-packaging-add-a-linux-riscv64-platform.patch new file mode 100644 index 00000000000..29db6b33a05 --- /dev/null +++ b/patches/pyvips-binary/8.18.7/0001-libvips-packaging-add-a-linux-riscv64-platform.patch @@ -0,0 +1,178 @@ +From 64ca2bd38804131beb1e75bdd933a5fec595f356 Mon Sep 17 00:00:00 2001 +From: Ludovic Henry +Date: Sat, 26 Sep 2026 11:45:09 +0000 +Subject: [PATCH 1/2] Add a linux-riscv64 platform + +Upstream-Status: To upstream [not yet submitted; python-wheels does not open issues/PRs on third-party repos] + +Build the same shared libraries natively on a riscv64 host, in a +Rocky Linux 10 (glibc 2.39) container, the way linux-arm64 is built +natively in a Rocky Linux 8 container. The platform files are the +linux-arm64 ones with the RISC-V triplet, Rust host and -march=rv64gc +baseline swapped in, and Rocky 10's own GCC 14 in place of +gcc-toolset-15. The rv64gc baseline matches what lovell/sharp-libvips' +linux-riscv64 platform uses. + +Signed-off-by: Ludovic Henry +--- + README.md | 1 + + build.sh | 5 +- + platforms/linux-riscv64/Dockerfile | 60 +++++++++++++++++++ + platforms/linux-riscv64/Toolchain.cmake | 5 ++ + platforms/linux-riscv64/meson.ini | 10 ++++ + .../linux-riscv64/riscv64-linux-gnu-pkgconf | 12 ++++ + 6 files changed, 91 insertions(+), 2 deletions(-) + create mode 100644 platforms/linux-riscv64/Dockerfile + create mode 100644 platforms/linux-riscv64/Toolchain.cmake + create mode 100644 platforms/linux-riscv64/meson.ini + create mode 100755 platforms/linux-riscv64/riscv64-linux-gnu-pkgconf + +diff --git a/README.md b/README.md +index 6ebf369..a2827f3 100644 +--- a/README.md ++++ b/README.md +@@ -26,6 +26,7 @@ the same shared libraries within multiple containers. + * [x64 musl](platforms/linux-musl-x64/Dockerfile) + * [ARMv7-A glibc](platforms/linux-arm/Dockerfile) + * [ARM64v8-A glibc](platforms/linux-arm64/Dockerfile) ++* [RISC-V 64-bit glibc](platforms/linux-riscv64/Dockerfile) + * [ARM64v8-A musl](platforms/linux-musl-arm64/Dockerfile) + + ### Windows +diff --git a/build.sh b/build.sh +index 5e34e67..48c0f4f 100755 +--- a/build.sh ++++ b/build.sh +@@ -16,6 +16,7 @@ if [ $# -lt 1 ]; then + echo "- linux-x64" + echo "- linux-arm" + echo "- linux-arm64" ++ echo "- linux-riscv64" + echo "- linux-musl-x64" + echo "- linux-musl-arm64" + echo "- win-x64" +@@ -84,8 +85,8 @@ for flavour in win-x64 win-x64.net462 win-x86 win-x86.net462 win-arm64 win-arm64 + fi + done + +-# Linux (x64, ARMv7 and ARM64v8) +-for flavour in linux-x64 linux-arm linux-arm64 linux-musl-x64 linux-musl-arm64; do ++# Linux (x64, ARMv7, ARM64v8 and RISC-V 64-bit) ++for flavour in linux-x64 linux-arm linux-arm64 linux-riscv64 linux-musl-x64 linux-musl-arm64; do + if [ $PLATFORM = "all" ] || [ $PLATFORM = $flavour ]; then + echo "Building $flavour..." + docker build --pull --cache-from vips-dev-$flavour --build-arg BUILDKIT_INLINE_CACHE=1 -t vips-dev-$flavour platforms/$flavour +diff --git a/platforms/linux-riscv64/Dockerfile b/platforms/linux-riscv64/Dockerfile +new file mode 100644 +index 0000000..04f1d6b +--- /dev/null ++++ b/platforms/linux-riscv64/Dockerfile +@@ -0,0 +1,60 @@ ++FROM --platform=linux/riscv64 rockylinux/rockylinux:10-ubi-init ++ ++## Copyright 2017 Lovell Fuller and others. ++## SPDX-License-Identifier: Apache-2.0 ++ ++# Create Rocky Linux 10 (glibc 2.39) container suitable for building Linux RISC-V 64-bit binaries ++ ++# Path settings ++ENV \ ++ RUSTUP_HOME="/usr/local/rustup" \ ++ CARGO_HOME="/usr/local/cargo" \ ++ PATH="/usr/local/cargo/bin:$PATH" ++ ++# Build dependencies ++RUN \ ++ dnf update -y && \ ++ dnf install -y dnf-plugins-core && \ ++ dnf config-manager --set-enabled crb && \ ++ dnf install -y --setopt=tsflags=nodocs \ ++ autoconf \ ++ automake \ ++ bzip2 \ ++ cmake \ ++ diffutils \ ++ findutils \ ++ gcc \ ++ gcc-c++ \ ++ gettext \ ++ git \ ++ gperf \ ++ jq \ ++ libcurl-devel \ ++ make \ ++ openssl-devel \ ++ patch \ ++ pkgconf \ ++ python3-pip \ ++ tar \ ++ xz \ ++ && \ ++ curl https://sh.rustup.rs -sSf | sh -s -- -y \ ++ --no-modify-path \ ++ --profile minimal \ ++ --default-host riscv64gc-unknown-linux-gnu \ ++ --default-toolchain nightly \ ++ && \ ++ cargo install cargo-c --locked && \ ++ pip3 install meson ninja ++ ++# Compiler settings ++ENV \ ++ PKG_CONFIG="riscv64-linux-gnu-pkgconf --static" \ ++ PLATFORM="linux-riscv64" \ ++ FLAGS="-march=rv64gc" \ ++ RUSTFLAGS="-Zlocation-detail=none -Zfmt-debug=none" \ ++ MESON="--cross-file=/root/meson.ini" ++ ++COPY Toolchain.cmake /root/ ++COPY meson.ini /root/ ++COPY riscv64-linux-gnu-pkgconf /usr/bin +diff --git a/platforms/linux-riscv64/Toolchain.cmake b/platforms/linux-riscv64/Toolchain.cmake +new file mode 100644 +index 0000000..96ed502 +--- /dev/null ++++ b/platforms/linux-riscv64/Toolchain.cmake +@@ -0,0 +1,5 @@ ++set(CMAKE_FIND_ROOT_PATH $ENV{TARGET_SYSROOT}) ++set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) ++set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) ++set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) ++set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) +diff --git a/platforms/linux-riscv64/meson.ini b/platforms/linux-riscv64/meson.ini +new file mode 100644 +index 0000000..2f9d2ad +--- /dev/null ++++ b/platforms/linux-riscv64/meson.ini +@@ -0,0 +1,10 @@ ++[binaries] ++strip = 'strip' ++ ++[built-in options] ++libdir = 'lib' ++datadir = '/usr/share' ++localedir = '/usr/share/locale' ++sysconfdir = '/etc' ++localstatedir = '/var' ++wrap_mode = 'nofallback' +diff --git a/platforms/linux-riscv64/riscv64-linux-gnu-pkgconf b/platforms/linux-riscv64/riscv64-linux-gnu-pkgconf +new file mode 100755 +index 0000000..84b5ae9 +--- /dev/null ++++ b/platforms/linux-riscv64/riscv64-linux-gnu-pkgconf +@@ -0,0 +1,12 @@ ++#!/bin/bash ++ ++# Workaround for https://github.com/mesonbuild/meson/issues/5402 ++for arg in "$@"; do ++ if [[ "$arg" == "--version" ]]; then ++ exec pkgconf --version ++ exit 0 ++ fi ++done ++ ++exec pkgconf "$@" ++exit $? +-- +2.43.0 + diff --git a/patches/pyvips-binary/8.18.7/0002-libvips-packaging-build-zlib-ng-libaom-and-pixman-without-RVV.patch b/patches/pyvips-binary/8.18.7/0002-libvips-packaging-build-zlib-ng-libaom-and-pixman-without-RVV.patch new file mode 100644 index 00000000000..f4dd97220ec --- /dev/null +++ b/patches/pyvips-binary/8.18.7/0002-libvips-packaging-build-zlib-ng-libaom-and-pixman-without-RVV.patch @@ -0,0 +1,58 @@ +From 3d104ee25a7ff6d866df657937d377d5d00ddb39 Mon Sep 17 00:00:00 2001 +From: Ludovic Henry +Date: Sat, 26 Sep 2026 11:45:18 +0000 +Subject: [PATCH 2/2] Build zlib-ng, libaom and pixman without RVV kernels + +Upstream-Status: Inappropriate [works around riscv64 hosts that advertise V but trap on RVV 1.0 code, as the python-wheels riscv64 runners do] + +zlib-ng, libaom and pixman each compile RVV 1.0 kernels whenever the +compiler supports them and pick them at runtime from AT_HWCAP (or +hwprobe). On hosts whose kernel reports V while the core only +implements a pre-1.0 vector extension, the first vsetvli raises +SIGILL, so the dispatch is not a safe guard there. Keep the rv64gc +scalar paths instead; libaom's -DENABLE_RVV=0 is what +lovell/sharp-libvips already passes for its linux-riscv64 build. + +zlib-ng 2.3.3 also needs WITH_RISCV_ZBC off: it defines RISCV_FEATURES +only when RVV is enabled, so a Zbc-only build fails in functable.c on +`cf.riscv` (fixed after 2.3.3 by zlib-ng/zlib-ng@9f396c3). + +Signed-off-by: Ludovic Henry +--- + build/posix.sh | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/build/posix.sh b/build/posix.sh +index c455c85..73896d2 100755 +--- a/build/posix.sh ++++ b/build/posix.sh +@@ -138,7 +138,7 @@ $CURL https://github.com/zlib-ng/zlib-ng/archive/${VERSION_ZLIB_NG}.tar.gz | tar + cd ${DEPS}/zlib-ng + CFLAGS="${CFLAGS} -O3" cmake -G"Unix Makefiles" \ + -DCMAKE_TOOLCHAIN_FILE=${ROOT}/Toolchain.cmake -DCMAKE_INSTALL_PREFIX=${TARGET} -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_BUILD_TYPE=Release \ +- -DBUILD_SHARED_LIBS=FALSE -DBUILD_TESTING=FALSE -DZLIB_COMPAT=TRUE -DWITH_ARMV6=FALSE ++ -DBUILD_SHARED_LIBS=FALSE -DBUILD_TESTING=FALSE -DZLIB_COMPAT=TRUE -DWITH_ARMV6=FALSE -DWITH_RVV=FALSE -DWITH_RISCV_ZBC=FALSE + make install/strip + + mkdir ${DEPS}/ffi +@@ -188,7 +188,7 @@ cd aom_build + AOM_AS_FLAGS="${FLAGS}" cmake -G"Unix Makefiles" \ + -DCMAKE_TOOLCHAIN_FILE=${ROOT}/Toolchain.cmake -DCMAKE_INSTALL_PREFIX=${TARGET} -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_BUILD_TYPE=MinSizeRel \ + -DBUILD_SHARED_LIBS=FALSE -DENABLE_DOCS=0 -DENABLE_TESTS=0 -DENABLE_TESTDATA=0 -DENABLE_TOOLS=0 -DENABLE_APPS=0 -DENABLE_EXAMPLES=0 \ +- -DCONFIG_PIC=1 -DENABLE_NASM=1 \ ++ -DCONFIG_PIC=1 -DENABLE_NASM=1 -DENABLE_RVV=0 \ + -DCONFIG_AV1_HIGHBITDEPTH=1 -DCONFIG_WEBM_IO=0 \ + .. + make install/strip +@@ -309,7 +309,7 @@ mkdir ${DEPS}/pixman + $CURL https://cairographics.org/releases/pixman-${VERSION_PIXMAN}.tar.gz | tar xzC ${DEPS}/pixman --strip-components=1 + cd ${DEPS}/pixman + meson setup _build --default-library=static --buildtype=release --strip --prefix=${TARGET} ${MESON} \ +- -Dlibpng=disabled -Dgtk=disabled -Dopenmp=disabled -Dtests=disabled -Ddemos=disabled ++ -Dlibpng=disabled -Dgtk=disabled -Dopenmp=disabled -Dtests=disabled -Ddemos=disabled -Drvv=disabled + meson install -C _build --tag devel + + mkdir ${DEPS}/cairo +-- +2.43.0 + diff --git a/patches/pyvips-binary/8.18.7/0003-pyvips-binary-add-riscv64-to-the-download-vips.py-platform-tables.patch b/patches/pyvips-binary/8.18.7/0003-pyvips-binary-add-riscv64-to-the-download-vips.py-platform-tables.patch new file mode 100644 index 00000000000..f2ef7478d95 --- /dev/null +++ b/patches/pyvips-binary/8.18.7/0003-pyvips-binary-add-riscv64-to-the-download-vips.py-platform-tables.patch @@ -0,0 +1,41 @@ +From 71d7846d286050f8bd8bffac21269de823fbfbcc Mon Sep 17 00:00:00 2001 +From: Ludovic Henry +Date: Sat, 26 Sep 2026 11:45:31 +0000 +Subject: [PATCH 3/4] Add riscv64 to the download-vips.py platform tables + +Upstream-Status: To upstream [not yet submitted; python-wheels does not open issues/PRs on third-party repos] + +get_plat() asserts the platform is in SUPPORTED_PLATFORMS, so a +riscv64 build fails before it downloads anything. Add linux-riscv64 +and map the riscv64 machine name to the libvips-packaging platform +suffix, so the script resolves libvips--linux-riscv64.tar.gz +the same way it resolves the other Linux tarballs. + +Signed-off-by: Ludovic Henry +--- + scripts/download-vips.py | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/scripts/download-vips.py b/scripts/download-vips.py +index 23826eb..0b52604 100644 +--- a/scripts/download-vips.py ++++ b/scripts/download-vips.py +@@ -18,6 +18,7 @@ BASE_LOC = ( + SUPPORTED_PLATFORMS = [ + 'linux-aarch64', + 'linux-armv7l', ++ 'linux-riscv64', + 'linux-x86_64', + 'musllinux-aarch64', + 'musllinux-x86_64', +@@ -33,6 +34,7 @@ ARCH_REMAP = { + 'amd64': 'x64', + 'arm64': 'arm64', + 'armv7l': 'arm', ++ 'riscv64': 'riscv64', + 'x86_64': 'x64', + } + +-- +2.43.0 + diff --git a/patches/pyvips-binary/8.18.7/0004-pyvips-binary-let-download-vips.py-use-a-locally-built-libvips.patch b/patches/pyvips-binary/8.18.7/0004-pyvips-binary-let-download-vips.py-use-a-locally-built-libvips.patch new file mode 100644 index 00000000000..294dff866d7 --- /dev/null +++ b/patches/pyvips-binary/8.18.7/0004-pyvips-binary-let-download-vips.py-use-a-locally-built-libvips.patch @@ -0,0 +1,36 @@ +From e20dcedd086e4f3efb3f4dc8541dc13bbf7f226c Mon Sep 17 00:00:00 2001 +From: Ludovic Henry +Date: Sat, 26 Sep 2026 11:45:31 +0000 +Subject: [PATCH 4/4] Let download-vips.py use a locally built libvips tarball + +Upstream-Status: Inappropriate [python-wheels builds the riscv64 libvips-packaging tarball in the same workflow because no release asset exists for it] + +kleisauke/libvips-packaging publishes no linux-riscv64 tarball, so the +riscv64 wheel build compiles one with libvips-packaging's own build.sh +first. Take its path from LIBVIPS_TARBALL and unpack that instead of +downloading the release asset; nothing changes when it is unset. + +Signed-off-by: Ludovic Henry +--- + scripts/download-vips.py | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/scripts/download-vips.py b/scripts/download-vips.py +index 0b52604..c7e94e8 100644 +--- a/scripts/download-vips.py ++++ b/scripts/download-vips.py +@@ -80,6 +80,12 @@ def get_win32(arch): + + + def download_vips(target, plat): ++ tarball = os.environ.get('LIBVIPS_TARBALL') ++ if tarball: ++ print(f'Using local "{tarball}"', file=sys.stderr) ++ shutil.copyfile(tarball, target) ++ return 'tar.gz' ++ + osname, arch = plat.split('-') + headers = {'User-Agent': + ('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 ; ' +-- +2.43.0