# vtk-abi-compat -- vtk(abi) and %%vtk_abi for chroots that use FEDORA's vtk. # # Our consumers (opencv-viz, mitk, ctk-vtk, InsightToolkit-vtk, ...) carry # Requires: vtk(abi) = %%{vtk_abi} # because VTK's sonames are libvtk*.so.1 across all of 9.x, so rpm cannot tell # 9.6 from 9.7 and a Fedora f3d built on 9.6 died loading our 9.7 (2026-10-26, # docs: memory vtk-soname-hides-abi-break). Our vtk.spec Provides vtk(abi) and # ships macros.vtk; Fedora's vtk ships neither (checked: vtk 9.6.2-13.fc45 and # 9.7.0-2.fc46 have no macros file and no vtk(abi) Provides). Morgan decided # 2026-10-27 to rebase onto Fedora's vtk (rawhide first, f45 after GA); this # package supplies both pieces there, so the consumers build and pin unchanged. # # The series is read from the vtk-devel in the buildroot, so one spec serves # every chroot. It is evaluated at parse time; when the SRPM is made without # vtk-devel installed it is the placeholder 0.0, and %%build refuses that, so # no binary ever carries it. # # Do NOT put this in a chroot that uses OUR vtk: that vtk already provides both, # and %%build refuses a buildroot where %%vtk_abi is already defined. # # File name: macros.vtk-abi, not macros.vtk, so it can never collide with our # vtk-devel's file. No Fedora package ships either name or provides vtk(abi) # or rpm_macro(vtk_abi) (repoquery of f45 and rawhide, 2026-10-27, with # macros.python3 as the positive control). %global vtk_series %(rpm -q --qf '%%{version}\\n' vtk-devel 2>/dev/null | grep -E '^[0-9]+\\.[0-9]+' | head -1 | cut -d. -f1,2) %if "%{vtk_series}" == "" %global vtk_series 0.0 %endif # The first version of the NEXT minor series, for the upper bound. %global vtk_next %{lua: local M, m = string.match(rpm.expand("%{vtk_series}"), "^(%d+)%.(%d+)$") if M then print(M .. "." .. (tonumber(m) + 1)) else print("0.1") end } # Arch-specific for %%{?_isa}, but nothing is compiled. %global debug_package %{nil} Name: vtk-abi-compat Version: 1.0 Release: 1%{?dist} Summary: VTK ABI series marker (vtk(abi) and %%vtk_abi) for Fedora's vtk License: MIT URL: https://gitlab.com/morgan.hough/neurofedora BuildRequires: vtk-devel Provides: vtk(abi) = %{vtk_series} Requires: (vtk%{?_isa} >= %{vtk_series} with vtk%{?_isa} < %{vtk_next}) %description Fedora's vtk package keeps the soname libvtk*.so.1 across every 9.x release, although VTK breaks ABI between minor releases, so rpm cannot keep a program built against one VTK series from loading another. This package states which series is installed: it Provides vtk(abi) = %{vtk_series}, requires a vtk of exactly that series, and defines the rpm macro %%vtk_abi for packages that pin "Requires: vtk(abi) = %%{vtk_abi}" at build time. %prep # Nothing to unpack. %build # Refuse the SRPM placeholder: a binary must name a real series. case "%{vtk_series}" in 0.0|'') echo "ERROR: vtk_series is '%{vtk_series}'; vtk-devel is not installed in the buildroot" >&2; exit 1 ;; esac # Refuse a buildroot whose vtk already defines it (our COPR vtk): this package # would only duplicate it there. %if 0%{?vtk_abi:1} echo "ERROR: %%vtk_abi is already defined (%{vtk_abi}); this vtk does not need vtk-abi-compat" >&2 exit 1 %endif %install install -d %{buildroot}%{_rpmmacrodir} cat > %{buildroot}%{_rpmmacrodir}/macros.vtk-abi <<'EOF' # The VTK major.minor series this system's vtk provides (vtk-abi-compat). # Consumers: Requires: vtk(abi) = %%{vtk_abi} EOF echo '%%vtk_abi %{vtk_series}' >> %{buildroot}%{_rpmmacrodir}/macros.vtk-abi %check # The macro must expand, from the shipped file, to the series vtk-devel reports. got=$(rpm --load %{buildroot}%{_rpmmacrodir}/macros.vtk-abi --eval '%%vtk_abi') want=$(rpm -q --qf '%%{version}\n' vtk-devel | head -1 | cut -d. -f1,2) echo "vtk_abi from the shipped file: '$got'; vtk-devel series: '$want'; upper bound: %{vtk_next}" test -n "$want" && test "$got" = "$want" # Negative control on the comparison: a different series must not match. test "$got" != "0.0" %files %{_rpmmacrodir}/macros.vtk-abi %changelog * Tue Oct 27 2026 Morgan Hough - 1.0-1 - New package for the rebase onto Fedora's vtk (rawhide first, f45 after GA): Provides vtk(abi) = the buildroot vtk's major.minor, requires that series, and ships macros.vtk-abi defining %%vtk_abi.