%bcond check 1 %bcond heif %{undefined rhel} %bcond jpegxl 1 %bcond bundled_jxl 1 %bcond bundled_rust_deps %{defined rhel} %global tarball_version %%(echo %{version} | tr '~' '.') %global jxl_private_dir %{_libexecdir}/glycin-loaders/2+/private Name: glycin Version: 2.0.8 Release: 114%{?dist} Summary: Sandboxed image rendering SourceLicense: MPL-2.0 OR LGPL-2.1-or-later # (Apache-2.0 OR MIT) AND BSD-3-Clause # (MIT OR Apache-2.0) AND IJG # (MIT OR Apache-2.0) AND Unicode-3.0 # (MIT OR Apache-2.0) AND Unicode-DFS-2016 # 0BSD OR MIT OR Apache-2.0 # Apache-2.0 OR MIT # Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT # BSD-2-Clause OR Apache-2.0 OR MIT # BSD-3-Clause # BSD-3-Clause OR Apache-2.0 # GPL-3.0-or-later # ISC # MIT # MIT OR Apache-2.0 # MIT OR Apache-2.0 OR Zlib # MIT OR Zlib OR Apache-2.0 # MPL-2.0 OR LGPL-2.1-or-later # Unlicense OR MIT # Zlib OR Apache-2.0 OR MIT License: %{shrink: (MPL-2.0 OR LGPL-2.1-or-later) AND BSD-3-Clause AND GPL-3.0-or-later AND IJG AND ISC AND MIT AND Unicode-3.0 AND Unicode-DFS-2016 AND (0BSD OR MIT OR Apache-2.0) AND (Apache-2.0 OR MIT) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND (BSD-2-Clause OR Apache-2.0 OR MIT) AND (BSD-3-Clause OR Apache-2.0) AND (MIT OR Apache-2.0 OR Zlib) AND (Unlicense OR MIT) } # LICENSE.dependencies contains a full license breakdown URL: https://gitlab.gnome.org/GNOME/glycin Source0: https://download.gnome.org/sources/%{name}/2.0/%{name}-%{tarball_version}.tar.xz Source1: glycin-2.0.8-vendor.tar.xz # Bundled libjxl 0.11.1 (private copy to avoid conflict with EPEL libjxl-0.10) Source2: https://github.com/libjxl/libjxl/archive/refs/tags/v0.11.1.tar.gz#/libjxl-0.11.1.tar.gz # vendor tarball is generated by running: # tar xf glycin-%%{tarball_version}.tar.xz # pushd glycin-%%{tarball_version} # patch -p1 < ../0001-fix-invalid-crate-manifest-for-tests-workspace-membe.patch # cargo vendor --versioned-dirs # tar Jcvf ../glycin-%%{tarball_version}-vendor.tar.xz vendor/ # popd # fixup for issue that makes "cargo tree" fail to parse tests/Cargo.toml Patch: 0001-fix-invalid-crate-manifest-for-tests-workspace-membe.patch # partial revert of https://gitlab.gnome.org/GNOME/glycin/-/commit/f637a7e Patch: 0002-Replace-serde_yaml_ng-with-equivalent-serde_yaml-dep.patch %if 0%{?rhel} BuildRequires: rust-toolset %else BuildRequires: cargo-rpm-macros %endif BuildRequires: gettext BuildRequires: git-core BuildRequires: meson BuildRequires: vala BuildRequires: pkgconfig(gio-2.0) >= 2.60 BuildRequires: pkgconfig(gobject-introspection-1.0) BuildRequires: pkgconfig(gtk4) >= 4.12 BuildRequires: pkgconfig(librsvg-2.0) >= 2.52.0 BuildRequires: pkgconfig(lcms2) >= 2.14 BuildRequires: pkgconfig(libseccomp) >= 2.5.0 %if %{with heif} BuildRequires: pkgconfig(libheif) >= 1.17.0 %endif %if %{with jpegxl} %if %{with bundled_jxl} # Build libjxl privately to avoid conflict with EPEL libjxl-0.10 (libavcodec dep) BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: ninja-build BuildRequires: patchelf BuildRequires: pkgconfig(libbrotlicommon) BuildRequires: pkgconfig(libbrotlidec) BuildRequires: pkgconfig(libbrotlienc) BuildRequires: pkgconfig(libhwy) %else BuildRequires: pkgconfig(libjxl) >= 0.11.0 %endif %endif %description Sandboxed and extendable image decoding. %package loaders Summary: Sandboxed image rendering (image loading backends) Requires: bubblewrap %if %{with jpegxl} && %{with bundled_jxl} # Private bundled libjxl (avoids ABI conflict with EPEL libjxl-0.10) Provides: bundled(libjxl) = 0.11.1 Provides: bundled(libjxl_cms) = 0.11.1 Requires: highway %endif %description loaders Sandboxed and extendable image decoding. This package contains the different image loading backends. %package thumbnailer Summary: Sandboxed image rendering (thumbnailer) Requires: glycin-loaders%{_isa} = %{version}-%{release} # Ensure glycin-thumbnailer replaces the old gdk-pixbuf-thumbnailer. %description thumbnailer Sandboxed and extendable image decoding. This package contains the thumbnailer implementation. %package libs Summary: Sandboxed image rendering (C library) Requires: glycin-loaders%{_isa} = %{version}-%{release} %description libs Sandboxed and extendable image decoding. This package contains a shared library interface for glycin. %package gtk4-libs Summary: Sandboxed image rendering (GTK4 integration) Requires: glycin-libs%{_isa} = %{version}-%{release} %description gtk4-libs Sandboxed and extendable image decoding. This package contains a shared library interface for glycin which provides integration with GDK / GTK4. %package devel Summary: Sandboxed image rendering (development files) Requires: glycin-libs%{_isa} = %{version}-%{release} %description devel Sandboxed and extendable image decoding. This package contains files for developing against libglycin. %package gtk4-devel Summary: Sandboxed image rendering (GTK4 development files) Requires: glycin-devel%{_isa} = %{version}-%{release} Requires: glycin-gtk4-libs%{_isa} = %{version}-%{release} %description gtk4-devel Sandboxed and extendable image decoding. This package contains files for developing against libglycin-gtk4. %prep %autosetup -n glycin-2.0.8 -p1 -a1 # Disable tests directory in workspace to avoid missing serde_yaml sed -i '/"tests",/d' Cargo.toml mkdir -p .cargo cat >.cargo/config.toml < %{_builddir}/jxl-private/lib64/pkgconfig/libjxl.pc << 'EOF' prefix=%{_builddir}/jxl-private libdir=${prefix}/lib64 includedir=${prefix}/include Name: libjxl Version: 0.11.1 Description: JPEG XL image codec (private bundled build) Libs: -L${libdir} -ljxl Cflags: -I${includedir} EOF cat > %{_builddir}/jxl-private/lib64/pkgconfig/libjxl_threads.pc << 'EOF' prefix=%{_builddir}/jxl-private libdir=${prefix}/lib64 includedir=${prefix}/include Name: libjxl_threads Version: 0.11.1 Description: JPEG XL threading (private bundled build) Libs: -L${libdir} -ljxl_threads Cflags: -I${includedir} Requires: libjxl EOF popd export PKG_CONFIG_PATH="%{_builddir}/jxl-private/lib/pkgconfig:%{_builddir}/jxl-private/lib64/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" %endif # Return to glycin source dir (%setup -T -b 2 in %prep leaves CWD at libjxl dir) cd %{_builddir}/glycin-2.0.8 meson setup --prefix=/usr --libdir=/usr/lib64 --buildtype=plain build \ -Dloaders=%{?with_heif:glycin-heif,}glycin-image-rs,%{?with_jpegxl:glycin-jxl,}glycin-svg \ -Dtest_skip_install=true \ %{nil} meson compile -C build %{cargo_license_summary} %{cargo_license} > LICENSE.dependencies %if %{with bundled_rust_deps} %cargo_vendor_manifest %endif %install cd %{_builddir}/glycin-2.0.8 %if %{with jpegxl} && %{with bundled_jxl} # %build already compiled jxl; re-export so meson install doesn't rebuild export PKG_CONFIG_PATH="%{_builddir}/jxl-private/lib/pkgconfig:%{_builddir}/jxl-private/lib64/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" %endif DESTDIR=%{buildroot} meson install -C build %if %{with jpegxl} && %{with bundled_jxl} # Install private libjxl alongside the JXL loader binary install -d %{buildroot}%{jxl_private_dir} find %{_builddir}/jxl-private -name "libjxl.so*" -o -name "libjxl_threads.so*" -o -name "libjxl_cms.so*" | \ xargs -I{} cp -P {} %{buildroot}%{jxl_private_dir}/ # Remove build-dir RPATHs baked in by cmake (triggers RPM QA check-rpaths failure) patchelf --remove-rpath %{buildroot}%{jxl_private_dir}/libjxl.so.0.11.1 patchelf --remove-rpath %{buildroot}%{jxl_private_dir}/libjxl_threads.so.0.11.1 patchelf --remove-rpath %{buildroot}%{jxl_private_dir}/libjxl_cms.so.0.11.1 # libjxl.so links against libjxl_cms.so — point it to its sibling in the same dir patchelf --set-rpath '$ORIGIN' %{buildroot}%{jxl_private_dir}/libjxl.so.0.11.1 # Set RPATH on the glycin-jxl loader to find the private libjxl at runtime patchelf --set-rpath '$ORIGIN/private' \ %{buildroot}%{_libexecdir}/glycin-loaders/2+/glycin-jxl # Ship an ldconfig conf so the linker cache includes the private dir. # $ORIGIN RPATH resolution is blocked by glycin's bwrap seccomp filter; # the ld.so.cache lookup path is the reliable alternative. install -Dm644 /dev/stdin \ %{buildroot}%{_sysconfdir}/ld.so.conf.d/glycin-jxl-private.conf <<'EOF' %{jxl_private_dir} EOF %endif %if %{with check} %check cd %{_builddir}/glycin-2.0.8 # tests fail with "UnsupportedFileType" (missing nonfree plugins for libheif?) %meson_test || : %endif %if %{with jpegxl} && %{with bundled_jxl} %post loaders /sbin/ldconfig %postun loaders /sbin/ldconfig %endif %files loaders %license LICENSE %license LICENSE-LGPL-2.1 %license LICENSE-MPL-2.0 %license LICENSE.dependencies %if %{with bundled_rust_deps} %license cargo-vendor.txt %endif %doc README.md %doc NEWS %{_libexecdir}/glycin-loaders/ %{_datadir}/glycin-loaders/ %if %{with jpegxl} && %{with bundled_jxl} %{jxl_private_dir}/ %{_sysconfdir}/ld.so.conf.d/glycin-jxl-private.conf %endif %files thumbnailer %{_bindir}/glycin-thumbnailer %dir %{_datadir}/thumbnailers/ %{_datadir}/thumbnailers/*.thumbnailer %files libs %{_libdir}/libglycin-2.so.0{,.*} %{_libdir}/girepository-1.0/Gly-2.typelib %files gtk4-libs %{_libdir}/libglycin-gtk4-2.so.0{,.*} %{_libdir}/girepository-1.0/GlyGtk4-2.typelib %files devel %{_includedir}/glycin-2/ %{_libdir}/libglycin-2.so %{_libdir}/pkgconfig/glycin-2.pc %{_datadir}/gir-1.0/Gly-2.gir %{_datadir}/vala/vapi/glycin-2.{deps,vapi} %files gtk4-devel %{_includedir}/glycin-gtk4-2/ %{_libdir}/libglycin-gtk4-2.so %{_libdir}/pkgconfig/glycin-gtk4-2.pc %{_datadir}/gir-1.0/GlyGtk4-2.gir %{_datadir}/vala/vapi/glycin-gtk4-2.{deps,vapi} %changelog %autochangelog