%global _lto_cflags %{nil} # Use 'define' not 'global' for debug_package: EPEL 9 auto-injects the # debuginfo stanza during spec parsing and 'global' scope causes a conflict. %define debug_package %{nil} %global itk_ver 6.0b02 Name: InsightToolkit6 Version: 6.0.0~b02 Release: 10%{?dist} Summary: Insight Segmentation and Registration Toolkit (ITK) v6 License: Apache-2.0 URL: https://itk.org/ Source0: https://github.com/InsightSoftwareConsortium/ITK/archive/v%{itk_ver}/ITK-%{itk_ver}.tar.gz # Install the generated itk_expat.h wrapper header (upstream CMakeLists # misses the install() rule). Without it every downstream that consumes # ITK6 gifti_io.h FTBFS — surfaced by ANTs3 build 10529612. Patch0: InsightToolkit6-install-itk-expat-header.patch # Remote modules (pre-populated for offline mock/COPR builds) # GenericLabelInterpolator: required by ANTs %global glinterp_commit ebf2436469ccf82c08fab54b7446f699ad0eae01 Source1: https://github.com/InsightSoftwareConsortium/ITKGenericLabelInterpolator/archive/%{glinterp_commit}/ITKGenericLabelInterpolator-%{glinterp_commit}.tar.gz # AdaptiveDenoising: required by ANTs DenoiseImage and antsJointFusion # # UPSTREAM REPO IS GONE. InsightSoftwareConsortium/ITKAdaptiveDenoising returns # 404 for the repository itself, not just this commit, and a GitHub search finds # no fork or rename. The module cannot be dropped -- ANTs DenoiseImage and # antsJointFusion need it -- so Source2 now points at the COPR dist-git # lookaside, which still holds the exact tarball from build 10533127: # md5 31fc97c606f33c7ccac60fd9ca021bf7 # sha256 7fe6328375f8869865380b73fbf60ec2ce0afb33ff15839ee41a0abc1a6d2582 # # THIS IS AN INTERIM MEASURE and it depends on COPR internals. If a canonical # home for this module reappears, or the tarball is rehosted somewhere we # control, point Source2 there instead. %global adenoise_commit 24825c8d246e941334f47968553f0ae388851f0c %global adenoise_tar ITKAdaptiveDenoising-%{adenoise_commit}.tar.gz Source2: https://copr-dist-git.fedorainfracloud.org/repo/pkgs/mhough/neurofedora/InsightToolkit6/%{adenoise_tar}/md5/31fc97c606f33c7ccac60fd9ca021bf7/%{adenoise_tar} # MorphologicalContourInterpolation: required by some segmentation workflows # # UPSTREAM REPO IS ALSO GONE (404 on the repository, same as AdaptiveDenoising # above -- two InsightSoftwareConsortium remote-module repos have disappeared). # Served from the COPR dist-git lookaside copy of the tarball from build # 10533127: md5 5e36bf01d749218c40fd1fba3bf31b2a # Interim, same caveat as Source2. %global morphinterp_commit 821bf9b3ef8eaaab10391ed060dc9ca5e4d37b39 %global morphinterp_tar ITKMorphologicalContourInterpolation-%{morphinterp_commit}.tar.gz Source3: https://copr-dist-git.fedorainfracloud.org/repo/pkgs/mhough/neurofedora/InsightToolkit6/%{morphinterp_tar}/md5/5e36bf01d749218c40fd1fba3bf31b2a/%{morphinterp_tar} # GrowCut: required by ITK-SNAP %global growcut_commit cbf93ab65117abfbf5798745117e34f22ff04728 Source4: https://github.com/InsightSoftwareConsortium/ITKGrowCut/archive/%{growcut_commit}/ITKGrowCut-%{growcut_commit}.tar.gz # SimpleITKFilters: required by SimpleITK %global sitk_commit bb896868fc6480835495d0da4356d5db009592a6 Source5: https://github.com/InsightSoftwareConsortium/ITKSimpleITKFilters/archive/%{sitk_commit}/ITKSimpleITKFilters-%{sitk_commit}.tar.gz # LabelErodeDilate: required by many pipelines %global lerode_commit 22d8846dbe4368312aa3aa95ecfe3542ab894e15 Source6: https://github.com/InsightSoftwareConsortium/ITKLabelErodeDilate/archive/%{lerode_commit}/ITKLabelErodeDilate-%{lerode_commit}.tar.gz # --- Dependencies --- BuildRequires: gcc-c++ BuildRequires: cmake BuildRequires: ninja-build BuildRequires: python3-devel BuildRequires: fftw-devel BuildRequires: libtiff-devel BuildRequires: libpng-devel BuildRequires: libjpeg-turbo-devel BuildRequires: zlib-ng-compat-devel BuildRequires: expat-devel # Transitive: VtkGlue triggers find_package(VTK) → find_package(CLI11). # vtk-devel doesn't yet Require cli11-devel ([[vtk-devel-transitive-requires]]). BuildRequires: cli11-devel BuildRequires: hdf5-devel BuildRequires: gdcm-devel BuildRequires: libminc-devel BuildRequires: vtk-devel BuildRequires: double-conversion-devel BuildRequires: json-devel BuildRequires: utf8cpp-devel BuildRequires: dcmtk-devel BuildRequires: freetype-devel BuildRequires: jsoncpp-devel BuildRequires: libxml2-devel BuildRequires: libogg-devel BuildRequires: libtheora-devel BuildRequires: lz4-devel BuildRequires: openjpeg-devel BuildRequires: proj-devel BuildRequires: sqlite-devel BuildRequires: PEGTL-devel BuildRequires: qt6-qtbase-devel BuildRequires: qt6-qtdeclarative-devel BuildRequires: fmt-devel %description ITK is an open-source, cross-platform system that provides developers with an extensive suite of software tools for image analysis. # Version 6.0 is a major upgrade with significant API changes. # It is installed into versioned paths to avoid conflict with ITK 5. %package devel Summary: Development files for ITK v6 Requires: %{name}%{?_isa} = %{version}-%{release} Requires: vtk-devel Requires: fftw-devel Requires: hdf5-devel %description devel The %{name}-devel package contains libraries and header files for developing applications that use ITK v6. %package examples Summary: ITK v6 examples Requires: %{name}-devel%{?_isa} = %{version}-%{release} %description examples Example source code, CMakeLists.txt, and test data for building applications with ITK 6. Use as starting points for new projects. %prep %autosetup -p1 -n ITK-%{itk_ver} # Fix missing include for GCC 14+ (cstdint) sed -i 's/#include "itkMacro.h"/#include "itkMacro.h"\n#include /' \ Modules/Core/Common/include/itkFloatingPointExceptions.h 2>/dev/null || true # Strip the invalid `typename std::is_nothrow_move_*::value` from the bundled # Eigen's Quaternion.h. `::value` is a non-type member, so the typename keyword # is illegal; GCC 16 now enforces this. Mirror of the same fix in InsightToolkit5.spec # so ITK6 consumers don't need per-package shadow-patches. sed -i 's/typename std::is_nothrow_move_/std::is_nothrow_move_/g' \ Modules/ThirdParty/Eigen3/src/itkeigen/Eigen/src/Geometry/Quaternion.h 2>/dev/null || true # Prepare Remote Modules mkdir -p Modules/Remote/GenericLabelInterpolator mkdir -p Modules/Remote/AdaptiveDenoising mkdir -p Modules/Remote/MorphologicalContourInterpolation mkdir -p Modules/Remote/GrowCut mkdir -p Modules/Remote/SimpleITKFilters mkdir -p Modules/Remote/LabelErodeDilate tar -xzf %{SOURCE1} --strip-components=1 \ -C Modules/Remote/GenericLabelInterpolator tar -xzf %{SOURCE2} --strip-components=1 \ -C Modules/Remote/AdaptiveDenoising tar -xzf %{SOURCE3} --strip-components=1 \ -C Modules/Remote/MorphologicalContourInterpolation tar -xzf %{SOURCE4} --strip-components=1 \ -C Modules/Remote/GrowCut tar -xzf %{SOURCE5} --strip-components=1 \ -C Modules/Remote/SimpleITKFilters tar -xzf %{SOURCE6} --strip-components=1 \ -C Modules/Remote/LabelErodeDilate # Remove remote module fetch triggers to prevent git calls during build rm Modules/Remote/GenericLabelInterpolator.remote.cmake rm Modules/Remote/AdaptiveDenoising.remote.cmake rm Modules/Remote/MorphologicalContourInterpolation.remote.cmake rm Modules/Remote/GrowCut.remote.cmake rm Modules/Remote/SimpleITKFilters.remote.cmake rm Modules/Remote/LabelErodeDilate.remote.cmake %build # GCC 15 compatibility flags export CXXFLAGS="%{optflags} -fpermissive -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -D_GNU_SOURCE -I%{_builddir}/ITK-%{itk_ver}/Modules/Core/Common/include" %cmake -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_CXX_STANDARD:STRING=17 \ -DBUILD_EXAMPLES:BOOL=OFF \ -DBUILD_TESTING:BOOL=OFF \ -DBUILD_SHARED_LIBS:BOOL=ON \ -DITK_BUILD_DEFAULT_MODULES:BOOL=ON \ -DITK_USE_SYSTEM_LIBRARIES:BOOL=OFF \ -DITK_USE_SYSTEM_EIGEN:BOOL=OFF \ -DITK_USE_SYSTEM_EXPAT:BOOL=ON \ -DITK_USE_SYSTEM_FFTW:BOOL=ON \ -DITK_USE_SYSTEM_ZLIB:BOOL=ON \ -DITK_USE_SYSTEM_OPENJPEG:BOOL=ON \ `# HDF5 explicit OFF: ITK6 cmake re-includes hdf5-targets.cmake via` \ `# multiple module find_package calls. The system HDF5 export set` \ `# only defines the shared targets; subsequent re-loads fail with` \ `# "Some (but not all) targets in this export set were already defined".` \ `# Bundling HDF5 sidesteps the conflict. (Same class of issue we hit` \ `# in VTK 9.6.2; ITK has the same multi-include pattern internally.)` \ -DITK_USE_SYSTEM_HDF5:BOOL=OFF \ -DITK_USE_SYSTEM_DOUBLECONVERSION:BOOL=OFF \ -DITK_USE_SYSTEM_GDCM:BOOL=OFF \ -DITK_USE_SYSTEM_MINC:BOOL=OFF \ -DModule_ITKGoogleTest:BOOL=OFF \ -DModule_GenericLabelInterpolator:BOOL=ON \ -DModule_AdaptiveDenoising:BOOL=ON \ -DModule_MorphologicalContourInterpolation:BOOL=ON \ -DModule_GrowCut:BOOL=ON \ -DModule_SimpleITKFilters:BOOL=ON \ -DModule_LabelErodeDilate:BOOL=ON \ %if 0%{?fedora} >= 45 `# Rawhide HDF5's cmake export config splits target definitions across` \ `# multiple includes, so when VtkGlue triggers find_package(VTK) -> ` \ `# find_package(HDF5), the second include trips hdf5-targets.cmake's` \ `# "Some (but not all) targets in this export set were already defined"` \ `# guard and configure aborts. Disable VtkGlue on rawhide until HDF5` \ `# stabilizes upstream; F44 with older HDF5 still ships it.` \ -DModule_ITKVtkGlue:BOOL=OFF \ %else -DModule_ITKVtkGlue:BOOL=ON \ %endif -DModule_ITKIOPhilipsREC:BOOL=ON \ -DModule_ITKDeprecated:BOOL=ON \ -DCMAKE_SKIP_INSTALL_RPATH:BOOL=ON \ -DITK_INSTALL_INCLUDE_DIR:PATH=include/ITK-6.0 \ -DITK_INSTALL_LIBRARY_DIR:PATH=%{_lib}/ITK-6.0 \ -DITK_INSTALL_PACKAGE_DIR:PATH=%{_lib}/cmake/ITK-6.0 %cmake_build %install %cmake_install # Bundled HDF5 helper binaries (h5cc, h5c++, h5dump, h5ls, ...) must not escape # into /usr/bin — the system hdf5-devel already owns those paths. We bundle # HDF5 only to dodge ITK6's multi-include cmake conflict, not to expose its # CLI tools. rm -f %{buildroot}%{_bindir}/h5* # Make itkTestDriver parallel-installable with InsightToolkit5-devel. # ITKTargets-*.cmake exposes the binary as an imported cmake target whose # IMPORTED_LOCATION points at /usr/bin/itkTestDriver — update both ends so # ITK6 consumers continue to resolve the target correctly. mv %{buildroot}%{_bindir}/itkTestDriver %{buildroot}%{_bindir}/itkTestDriver-6.0 sed -i 's|/bin/itkTestDriver"|/bin/itkTestDriver-6.0"|g' \ %{buildroot}%{_libdir}/cmake/ITK-6.0/ITKTargets-*.cmake # Libraries install to %{_libdir}/ITK-6.0/ for parallel install with ITK5 # (which uses /usr/lib64/ directly). That dir isn't in the default ldconfig # search path, so transitive deps fail at runtime — e.g. libITKIONIFTI loads # libITKniftiio via DT_NEEDED with no RPATH hint. Drop an ld.so.conf.d entry # so the dynamic linker finds them. The %%ldconfig_scriptlets macro below # triggers ldconfig on install/remove. install -d %{buildroot}%{_sysconfdir}/ld.so.conf.d echo '%{_libdir}/ITK-6.0' > %{buildroot}%{_sysconfdir}/ld.so.conf.d/InsightToolkit6-%{_arch}.conf %ldconfig_scriptlets %files %license LICENSE %doc README.md %{_libdir}/ITK-6.0/libITK*.so.1 %{_libdir}/ITK-6.0/libitk*.so.1 %{_bindir}/itkTestDriver-6.0 %{_libdir}/ITK-6.0/libhdf5.settings %{_libdir}/ITK-6.0/pkgconfig/*.pc %config(noreplace) %{_sysconfdir}/ld.so.conf.d/InsightToolkit6-%{_arch}.conf %{_datadir}/ITK-6.0/ %{_datadir}/doc/ITK-6.0/ %files devel %{_includedir}/ITK-6.0/ %{_libdir}/cmake/ITK-6.0/ %{_libdir}/ITK-6.0/libITK*.so %{_libdir}/ITK-6.0/libitk*.so %{_libdir}/ITK-6.0/cmake/itkLIBMINC*.cmake %{_libdir}/ITK-6.0/cmake/UseitkLIBMINC.cmake %{_includedir}/itkopenjpeg-2.5/ %changelog * Sun Aug 23 2026 Morgan Hough - 6.0.0~b02-10 - 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. - Source2: the ITKAdaptiveDenoising upstream repository has been deleted from GitHub, so the SCM build could not fetch it and produced no SRPM. Point it at the COPR dist-git lookaside copy of the identical tarball. Interim. * Mon Jun 1 2026 Morgan Hough - 6.0.0~b02-9 - Fix install patch DESTINATION: ${ITKExpat_INSTALL_INCLUDE_DIR} is empty in the parent CMakeLists context; switch to global ${ITK_INSTALL_INCLUDE_DIR} which we set explicitly in %%build. Build 10533120 (-8) failed with `install FILES given no DESTINATION!`. - Add cli11-devel BR: ITK6 itself builds VtkGlue → find_package(VTK) → find_package(CLI11), same recurring transitive issue from VTK -7+. * Mon Jun 1 2026 Morgan Hough - 6.0.0~b02-8 - Patch upstream: install Modules/ThirdParty/Expat's generated itk_expat.h wrapper header. ITK6 ships gifti_io.h which does `#include ` (ITK5 used direct ``), but upstream's CMakeLists never installs the wrapper. Every downstream consumer FTBFS — ANTs3 build 10529612 surfaced it after 118 min of compile. Switch %%autosetup to -p1 to enable Patch0. * Sat May 30 2026 Morgan Hough - 6.0.0~b02-7 - Ship /etc/ld.so.conf.d/InsightToolkit6-x86_64.conf so the dynamic linker finds libs under %%{_libdir}/ITK-6.0/. Without it, smoke binaries linked against libITKIONIFTI fail at runtime with "libITKniftiio-6.0.so.1: cannot open shared object file" — the DT_NEEDED transitive dep has no RPATH hint and ldconfig wasn't scanning the versioned subdir. Surfaced by neurofedora CDash on the first ITK6 component run after b02-6 install. - Add %%ldconfig_scriptlets so install/remove triggers ldconfig. * Thu May 28 2026 Morgan Hough - 6.0.0~b02-6 - Disable Module_ITKVtkGlue on rawhide (f45+). Rawhide HDF5's hdf5-targets.cmake split-include pattern conflicts with VTK's find_package(HDF5) chain triggered by VtkGlue's init module, failing configure with "Some (but not all) targets in this export set were already defined". F44 with older HDF5 still builds VtkGlue cleanly (build 10522400 succeeded on f44 chroot). * Wed May 27 2026 Morgan Hough - 6.0.0~b02-5 - Resolve parallel-install file conflicts with InsightToolkit5-devel and hdf5-devel (surfaced by neurofedora CDash dashboard). * Drop bundled HDF5 helper binaries (h5cc/h5c++/h5dump/...) from /usr/bin so they no longer collide with hdf5-devel. The bundled HDF5 is internal to ITK6; its CLI tools were never the intent. * Rename /usr/bin/itkTestDriver -> /usr/bin/itkTestDriver-6.0 and patch ITKTargets-*.cmake so the imported cmake target still resolves. ITK5 keeps its unversioned /usr/bin/itkTestDriver; both ITKs now coexist. * Tue May 26 2026 Morgan Hough - 6.0.0~b02-4 - Bundle HDF5 (-DITK_USE_SYSTEM_HDF5:BOOL=OFF) to sidestep the cmake export-set conflict between hdf5-shared and hdf5_tools-shared when multiple module find_package calls re-include the system hdf5-targets.cmake. Same class of issue as VTK 9.6.2. * Sun May 24 2026 Morgan Hough - 6.0.0~b02-3 - Mirror of the InsightToolkit5-5.4.6-2 bundled-Eigen Quaternion.h fix: strip the invalid `typename std::is_nothrow_move_*::value` keyword for GCC 16. Every ITK6 consumer inherits the fix automatically. * Wed May 06 2026 Morgan Hough - 6.0.0~b02-2 - Bundle GDCM and MINC to fix ITK 6.0 beta target errors - Clean up spec file and use versioned install paths * Wed Apr 23 2026 Morgan Hough - 6.0.0~b02-1 - Update to ITK 6.0 beta 2 - Fix Source0 and build paths * Tue Feb 24 2026 Morgan Hough - 6.0.0~b01-1 - Initial package for ITK 6.0 beta 1