%define commit 9e7cecf64c4144ed3750f9a0604554333faba59f %define shortcommit %(c=%{commit}; echo ${c:0:7}) Name: dtk-imaging Version: 0.1.0 Release: 7%{?dist} Summary: Medical imaging algorithms based on dtk License: BSD URL: https://gitlab.inria.fr/dtk/dtk-imaging # Upstream is INRIA's GitLab, not GitHub -- github.com/medInria/dtk-imaging is a # 404. The project is gitlab.inria.fr/dtk/dtk-imaging (id 7417, branch develop), # and the archive endpoint serves the pinned commit anonymously (verified: 200, # 59640 bytes), so this needs no lookaside. Source0: %{url}/-/archive/%{commit}/%{name}-%{commit}.tar.gz BuildRequires: gcc-c++ BuildRequires: cmake BuildRequires: ninja-build BuildRequires: dtk-devel BuildRequires: qt5-qtbase-devel # Qt5::Quick appears in dtk's exported link interfaces (dtkDepends.cmake) and is # not part of qt5-qtbase-devel. BuildRequires: qt5-qtdeclarative-devel BuildRequires: vtk-devel BuildRequires: InsightToolkit-devel # CMakeLists.txt has find_package(xtl REQUIRED) and find_package(xtensor REQUIRED), # and %%cmake below already points xtl_DIR/xtensor_DIR at %%{_libdir}/cmake -- but # nothing ever pulled the packages in. Fedora ships both (xtl 0.8.1, xtensor 0.27.0 # as of f44), so the bundled 0.7.5/0.24.7 tarballs were never the right answer. BuildRequires: xtl-devel BuildRequires: xtensor-devel # Pin the exact VTK ABI this package was built against. VTK freezes its soname at # libvtk*.so.1 across all of 9.x, so rpm cannot tell 9.5 from 9.6 from 9.7: a consumer # built against one installs cleanly against another and fails at LOAD with undefined # symbols. A >= floor does not help -- 9.7.0 satisfies >= 9.6.2 -- so this is an exact # match. %%vtk_abi comes from vtk-devel's macros.vtk, so it re-pins on every rebuild. # # The missing-macro check lives in %%build, deliberately, NOT at parse time. A # parse-time %%error cannot distinguish "COPR is generating the SRPM" from "this is a # real buildroot": rpkg srpm parses the spec with no buildroot and therefore no # vtk-devel, so a parse-time guard killed every SCM build of every guarded package # before any chroot existed (python-simpleitk 10980296 failed in 0 minutes with # "can't parse specfile"). Expanding to UNSET keeps the SRPM parse alive, and the # %%build test still fails loudly in a buildroot lacking vtk-devel, so no RPM carrying # the placeholder can ever be produced. Requires: vtk(abi) = %{?vtk_abi}%{!?vtk_abi:UNSET} %description dtk-imaging provides core imaging data structures and algorithms. %prep %setup -q -n dtk-imaging-%{commit} # --------------------------------------------------------- # FIX 1: API Mismatch - Rename dtkCoreObjectManager -> dtkObjectManager # --------------------------------------------------------- sed -i 's/dtkCoreObjectManager/dtkObjectManager/g' src/dtkImagingCore/dtkImaging.cpp # --------------------------------------------------------- # FIX 2: Header Include Style # --------------------------------------------------------- # Replace the missing specific header with the module header grep -rl "#include " . | xargs sed -i 's|#include |#include |g' # --------------------------------------------------------- # FIX 3: Forwarding headers for the flat pre-0.25 xtensor layout # --------------------------------------------------------- # dtk-imaging is from 2018 and includes xtensor's old flat headers. xtensor 0.25 # moved everything into subdirectories, so each one needs a forwarder. Measured # from the sources (grep '#include local_include/xtensor/"$old" done # xtl 0.8 went C++17-only and deleted its C++14 backports. dtk-imaging (2018) # uses three of them, and the 0.1.0-5 build (11019766) named all three once it # finally reached the compiler: # # xtl/xvariant.hpp -- header gone; xtl::variant/get/visit with it # xtl::disjunction -- "does not name a template type" (xtype_traits) # xtl::make_overload -- "is not a member of 'xtl'" # # Verified against the installed xtl-devel 0.8.1 rather than assumed: xvariant.hpp # is absent, xtype_traits.hpp now calls std::disjunction directly rather than # providing its own, and make_overload appears nowhere in the package. Nothing in # 0.8.1 declares any of these names, so the definitions below cannot collide. # # Under C++17 the originals were thin: the variant names were using-declarations # onto std, disjunction became std::disjunction, and make_overload built the # standard "overload set from lambdas" object for xtl::visit. Reproduce exactly # that. # # Force-included from CXXFLAGS rather than left to an #include: the only xtl # header dtk-imaging names anywhere is , but xtl::disjunction # is used in dtkImageFunction.h, which reaches namespace xtl transitively through # xtensor. A shim that only lands when xvariant.hpp is included would not be # visible there. mkdir -p local_include/xtl cat > local_include/dtk_xtl_compat.hpp <<'XCOMPAT' #ifndef DTK_XTL_COMPAT_HPP #define DTK_XTL_COMPAT_HPP #include #include #include namespace xtl { using std::variant; using std::monostate; using std::get; using std::get_if; using std::visit; using std::holds_alternative; using std::variant_alternative; using std::variant_alternative_t; using std::variant_size; using std::variant_size_v; using std::bad_variant_access; using std::conjunction; using std::disjunction; using std::negation; namespace dtk_compat_detail { template struct overload_set : Ts... { using Ts::operator()...; }; template overload_set(Ts...) -> overload_set; } template auto make_overload(Ts&&... ts) { return dtk_compat_detail::overload_set...>{ std::forward(ts)...}; } } #endif XCOMPAT echo '#include "dtk_xtl_compat.hpp"' > local_include/xtl/xvariant.hpp # --------------------------------------------------------- # FIX 3b: Per-module dtk CMake package configs # --------------------------------------------------------- # CMakeLists.txt calls find_package(dtkCore/dtkLog/dtkWidgets REQUIRED), but # dtk-devel 1.7.1 ships only a monolithic dtkConfig.cmake plus Fonts/Settings/ # Themes configs -- there is no dtkCoreConfig.cmake, so the build died at # CMakeLists.txt:116 (11019733, f44). # # Nothing is actually missing: dtkConfig.cmake includes dtkDepends.cmake, which # already defines the IMPORTED targets dtkCore, dtkDistributed, dtkLog, dtkMath, # dtkMeta and dtkWidgets -- exactly the names dtk-imaging links against. Only the # find_package entry points are absent. dtk-devel itself shows the intended # pattern: its dtkFontsConfig.cmake is one line, `include(dtkConfig.cmake)`. # Reproduce that for the five modules it omits, and point their _DIR at this # directory instead of %%{_libdir}/cmake/dtk. # # The alternative is adding these five files to dtk-devel, which would fix every # dtk consumer at once rather than this one -- but dtk is a foundation package # and this shim is contained. See docs/COORDINATION.md. # # The shim also has to resolve dtk's own Qt dependencies, which dtkConfig.cmake # does not. dtkDepends.cmake names Qt5::Core, Gui, Network, Quick, Widgets and # Xml in its targets' link interfaces while dtkConfig.cmake calls find_package # for none of them, so a consumer that has not already found all six fails at # CMake *generate* time rather than configure time: # # The link interface of target "dtkDistributed" contains: Qt5::Network # but the target was not found. (11019745) # # dtk-imaging asks only for Core/Test (plus Widgets/Xml when widgets are on), so # Network, Gui and Quick were never found. Resolving dependencies before # defining targets is what a package config file is supposed to do, so do it # here rather than patching dtk-imaging's CMakeLists. mkdir -p local_cmake/dtk for mod in Core Log Math Meta Widgets; do cat > local_cmake/dtk/dtk${mod}Config.cmake <<'DTKCFG' find_package(Qt5 REQUIRED COMPONENTS Core Gui Network Quick Widgets Xml) DTKCFG echo 'include("%{_libdir}/cmake/dtk/dtkConfig.cmake")' \ >> local_cmake/dtk/dtk${mod}Config.cmake done # --------------------------------------------------------- # FIX 4: Shadow broken system dtkWidgets header # --------------------------------------------------------- mkdir -p local_include/dtkWidgets cp /usr/include/dtkWidgets/dtkWidgets local_include/dtkWidgets/ sed -i '/dtkDistributedGuiApplication.h/d' local_include/dtkWidgets/dtkWidgets # --------------------------------------------------------- # FIX 5: Rename Missing Class (dtkWidgetsWidget -> QWidget) # --------------------------------------------------------- # The class dtkWidgetsWidget was removed in dtk 1.7.1. # We assume it was just a wrapper around QWidget. grep -rl "dtkWidgetsWidget" src | xargs sed -i 's/dtkWidgetsWidget/QWidget/g' %build # vtk_abi comes from vtk-devel's macros.vtk. Absent means BuildRequires: vtk-devel is # missing, and the Requires above would ship as the vacuous "vtk(abi) = UNSET". test -n "%{?vtk_abi}" || { echo "ERROR: vtk_abi undefined - add 'BuildRequires: vtk-devel'" >&2; exit 1; } # We add -I.../local_include/dtkWidgets so the compiler finds our patched "dtkWidgets" # header before looking in /usr/include. export CXXFLAGS="%{optflags} \ -I$(pwd)/local_include \ -include $(pwd)/local_include/dtk_xtl_compat.hpp \ -I$(pwd)/local_include/dtkWidgets \ -I%{_includedir}/dtk \ -I%{_includedir}/dtkCore \ -I%{_includedir}/dtkLog \ -I%{_includedir}/dtkMath \ -I%{_includedir}/dtkMeta \ -I%{_includedir}/dtkWidgets \ -I%{_includedir} \ -idirafter %{_includedir}" %cmake \ -GNinja \ -DCMAKE_BUILD_TYPE=Release \ `# The three libraries install with a redundant runpath of /usr/lib64, which` \ `# check-rpaths rejects and which fails the build after everything has already` \ `# compiled and installed (11019772). Upstream asks for it twice: the root` \ `# CMakeLists sets CMAKE_INSTALL_RPATH plus CMAKE_INSTALL_RPATH_USE_LINK_PATH,` \ `# and each src/*/CMakeLists.txt also sets the INSTALL_RPATH target property to` \ `# ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}. SKIP_INSTALL_RPATH overrides` \ `# both, and /usr/lib64 is the default search path anyway, so nothing is lost.` \ -DCMAKE_SKIP_INSTALL_RPATH:BOOL=ON \ -DdtkCore_DIR=$(pwd)/local_cmake/dtk \ -DdtkLog_DIR=$(pwd)/local_cmake/dtk \ -DdtkMath_DIR=$(pwd)/local_cmake/dtk \ -DdtkMeta_DIR=$(pwd)/local_cmake/dtk \ -DdtkWidgets_DIR=$(pwd)/local_cmake/dtk \ -DdtkFonts_DIR=%{_libdir}/cmake/dtk \ -DdtkThemes_DIR=%{_libdir}/cmake/dtk \ -DdtkSettings_DIR=%{_libdir}/cmake/dtk \ -Dxtl_DIR=%{_libdir}/cmake/xtl \ -Dxtensor_DIR=%{_libdir}/cmake/xtensor %cmake_build %install %cmake_install %files # Match all library versions (so.2, so.2.0.4, etc.) %{_libdir}/libdtkImaging*.so* # Match all dtkImaging include directories (Core, Filters, Widgets) %{_includedir}/dtkImaging* # Match the correct CamelCase cmake directory %{_libdir}/cmake/dtkImaging %changelog * Mon Sep 21 2026 Morgan Hough - 0.1.0-7 - Drop the redundant /usr/lib64 runpath. -6 compiled and installed the whole package -- all three libraries, headers and cmake config -- and then failed check-rpaths, which rejects a standard runpath. Upstream sets it both globally (CMAKE_INSTALL_RPATH + CMAKE_INSTALL_RPATH_USE_LINK_PATH) and per target; CMAKE_SKIP_INSTALL_RPATH overrides both, and /usr/lib64 is already the default search path. * Mon Sep 21 2026 Morgan Hough - 0.1.0-6 - Restore the three xtl C++14 backports that 0.8 deleted. -5 got the whole configure/generate stage clean and reached the compiler, which reported xtl::disjunction and xtl::make_overload missing on top of the already-shimmed xvariant.hpp. Replaces the xvariant-only shim with one compat header covering all three, force-included from CXXFLAGS -- dtkImageFunction.h uses xtl::disjunction while including no xtl header itself, so an #include-triggered shim would never reach it. Checked xtl-devel 0.8.1: none of these names exist there, so nothing collides. * Mon Sep 21 2026 Morgan Hough - 0.1.0-5 - Resolve dtk's Qt dependencies in the shim configs. -4 got find_package(dtkCore) working and CMake configured cleanly, then failed at generate: dtkDepends.cmake puts Qt5::Core/Gui/Network/Quick/Widgets/Xml in its targets' link interfaces while dtkConfig.cmake find_package()s none of them, so any consumer that has not already found all six dies on the first one it is missing. dtk-imaging asks for Core/Test/Widgets/Xml only. Adds qt5-qtdeclarative-devel for Qt5::Quick. * Mon Sep 21 2026 Morgan Hough - 0.1.0-4 - Supply the five dtk per-module CMake package configs the build looks for. 0.1.0-3 got as far as CMakeLists.txt:116, find_package(dtkCore REQUIRED): dtk-devel 1.7.1 ships a monolithic dtkConfig.cmake and configs for Fonts, Settings and Themes only. The IMPORTED targets dtkCore/dtkLog/dtkMath/dtkMeta/ dtkWidgets all exist already via dtkDepends.cmake, so only the find_package entry points were missing; generate them with the same one-line include that dtk-devel's own dtkFontsConfig.cmake uses. Confirms the xtl/xtensor unbundling in -3 was correct -- find_package(xtl) and find_package(xtensor) both passed. * Mon Sep 21 2026 Morgan Hough - 0.1.0-3 - Make the package SCM-buildable and unbundle xtl/xtensor. Source0 was a bare filename and the URL was a dead GitHub path; upstream is INRIA's GitLab (gitlab.inria.fr/dtk/dtk-imaging), whose archive endpoint serves the pinned commit anonymously. Source1/Source2 carried xtl 0.7.5 and xtensor 0.24.7 as tarballs even though %%cmake already pointed xtl_DIR/xtensor_DIR at the system copies and nothing declared a BuildRequires for either; Fedora ships both, so use them. Extends the single xarray.hpp forwarding header to all six flat xtensor headers the sources include, and adds an xtl/xvariant.hpp shim -- xtl dropped that header, and the one file using it is a test that only needs xtl::get. Removes three entries from ci/lookaside-allowlist.txt. * Sun Aug 23 2026 Morgan Hough - 0.1.0-2 - Rebuild against VTK 9.7.0. VTK here installs unversioned sonames (libvtk*.so.1), so 9.7 replaces 9.6 in place and every consumer must be rebuilt or it fails at runtime with undefined symbols. * Tue Jan 06 2026 Morgan Hough - 0.1.0-1 - Fix API mismatch, include paths, and broken system headers