%global _lto_cflags %{nil} Name: InsightToolkit5 Version: 5.4.5 Release: 7%{?dist} Summary: Insight Segmentation and Registration Toolkit (ITK) v5 License: Apache-2.0 URL: https://itk.org/ Source0: https://github.com/InsightSoftwareConsortium/ITK/releases/download/v%{version}/InsightToolkit-%{version}.tar.gz # ITK remote module required by ANTs (pinned commit from ITK 5.4.5's GenericLabelInterpolator.remote.cmake) %global glinterp_commit ebf2436469ccf82c08fab54b7446f699ad0eae01 Source1: https://github.com/InsightSoftwareConsortium/ITKGenericLabelInterpolator/archive/%{glinterp_commit}/ITKGenericLabelInterpolator-%{glinterp_commit}.tar.gz # AdaptiveDenoising remote module: provides itkAdaptiveNonLocalMeansDenoisingImageFilter.h # required by ANTs 2.6.5 DenoiseImage and antsJointFusion %global adaptive_commit 24825c8d246e941334f47968553f0ae388851f0c Source2: https://github.com/ntustison/ITKAdaptiveDenoising/archive/%{adaptive_commit}/ITKAdaptiveDenoising-%{adaptive_commit}.tar.gz BuildRequires: gcc-c++ BuildRequires: cmake >= 3.16 BuildRequires: fftw-devel BuildRequires: expat-devel BuildRequires: libtiff-devel BuildRequires: libjpeg-devel BuildRequires: libpng-devel BuildRequires: zlib-devel %if 0%{?fedora} BuildRequires: libminc-devel %endif BuildRequires: hdf5-devel BuildRequires: gdcm-devel BuildRequires: openjpeg2-devel BuildConflicts: InsightToolkit-devel # ITK 5.x is not fully compatible with ITK 4.x, so we package it separately. # We use ITK's versioned install paths to allow side-by-side installation. # Eigen3 is bundled (ITK_USE_SYSTEM_EIGEN=OFF) because Fedora 44+ ships # eigen3-devel 5.0.1 which declares SameMajorVersion compatibility, breaking # ITK's find_package(Eigen3 3.3) even though 5.0.1 > 3.3. %description The Insight Toolkit (ITK) is an open-source, cross-platform system that provides developers with an extensive suite of software tools for image analysis. This package provides version 5 of the toolkit. %package devel Summary: Development files for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} # Transitive cmake find_package deps: downstream consumers of ITK's UseITK.cmake # will have find_package() called for each system library ITK was built against. Requires: fftw-devel Requires: hdf5-devel Requires: expat-devel Requires: libjpeg-devel Requires: libpng-devel Requires: libtiff-devel Requires: zlib-devel Requires: gdcm-devel Requires: openjpeg2-devel %if 0%{?fedora} Requires: libminc-devel %endif %description devel The %{name}-devel package contains libraries and header files for developing applications that use %{name}. %prep %autosetup -n InsightToolkit-%{version} # Fix missing include for uint8_t in itkFloatingPointExceptions.h (required for GCC 14+) sed -i 's/#include "itkMacro.h"/#include "itkMacro.h"\n#include /' Modules/Core/Common/include/itkFloatingPointExceptions.h # Unpack the GenericLabelInterpolator remote module into the expected location. # ITK's Module_GenericLabelInterpolator=ON normally fetches this at cmake time; we # pre-populate the source directory so the build works offline (mock/COPR policy). mkdir -p Modules/Remote/GenericLabelInterpolator tar -xzf %{SOURCE1} --strip-components=1 \ -C Modules/Remote/GenericLabelInterpolator mkdir -p Modules/Remote/AdaptiveDenoising tar -xzf %{SOURCE2} --strip-components=1 \ -C Modules/Remote/AdaptiveDenoising %build # Relax compiler checks for compatibility with GCC 14+ and force local include # path to avoid system header conflicts export CXXFLAGS="%{optflags} -fpermissive -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -D_GNU_SOURCE -I%{_builddir}/InsightToolkit-%{version}/Modules/Core/Common/include" %cmake \ -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_HDF5:BOOL=ON \ -DITK_USE_SYSTEM_JPEG:BOOL=ON \ -DITK_USE_SYSTEM_PNG:BOOL=ON \ -DITK_USE_SYSTEM_TIFF:BOOL=ON \ -DITK_USE_SYSTEM_ZLIB:BOOL=ON \ -DITK_USE_SYSTEM_GDCM:BOOL=ON \ -DITK_USE_SYSTEM_OPENJPEG:BOOL=ON \ -DITK_USE_SYSTEM_DOUBLECONVERSION:BOOL=OFF \ -DModule_ITKGoogleTest:BOOL=OFF \ -DModule_GenericLabelInterpolator:BOOL=ON \ -DModule_AdaptiveDenoising:BOOL=ON \ -DITK_FORBID_DOWNLOADS:BOOL=ON \ %if 0%{?fedora} -DITK_USE_SYSTEM_MINC:BOOL=ON \ %else -DITK_USE_SYSTEM_MINC:BOOL=OFF \ %endif -DITK_INSTALL_PACKAGE_SUFFIX:STRING=-5.4 \ -DITK_INSTALL_LIBRARY_DIR:PATH=%{_lib} \ -DITK_INSTALL_INCLUDE_DIR:PATH=include/ITK-5.4 \ -DITK_SKIP_PATH_LENGTH_CHECKS:BOOL=ON %cmake_build %install %cmake_install # Drop bundled html docs; narrative docs are in the doc macro below rm -rf %{buildroot}%{_datadir}/doc/ITK-5.4 # Remove zero-length stub headers (rpmlint zero-length error; ITK uses them as placeholders) find %{buildroot}%{_includedir} -name stub.h -empty -delete # Remove cmake configs for ITK's internal bundled MINC library (installed to lib64/cmake/ # when ITK_USE_SYSTEM_MINC=OFF on EPEL; not a public API) find %{buildroot}%{_libdir}/cmake -maxdepth 1 \ \( -name 'itkLIBMINC*.cmake' -o -name 'UseitkLIBMINC.cmake' \) -delete %files %license LICENSE %doc NOTICE README.md %{_libdir}/libITK*.so.1 %{_libdir}/libitk*.so.1 %files devel %{_includedir}/ITK-5.4/ %{_prefix}/lib/cmake/ITK*/ %{_libdir}/libITK*.so %{_libdir}/libitk*.so %{_bindir}/itkTestDriver %changelog * Wed Feb 25 2026 Morgan Hough - 5.4.5-7 - Remove cmake configs for ITK's bundled MINC library in %%install: when ITK_USE_SYSTEM_MINC=OFF (EPEL 9), ITK installs itkLIBMINCConfig.cmake and UseitkLIBMINC.cmake to lib64/cmake/ outside the %%files glob, causing unpackaged-file build failures on EPEL 9 * Tue Feb 24 2026 Morgan Hough - 5.4.5-6 - Add AdaptiveDenoising remote module (Source2): provides itkAdaptiveNonLocalMeansDenoisingImageFilter.h and itkNonLocalPatchBasedImageFilter.h required by ANTs 2.6.5 DenoiseImage and antsJointFusion * Tue Feb 24 2026 Morgan Hough - 5.4.5-5 - Bundle GenericLabelInterpolator remote module (Source1): required by ANTs 2.6.5 which uses itkLabelImageGenericInterpolateImageFunction.h - Enable Module_GenericLabelInterpolator=ON in cmake build * Tue Feb 24 2026 Morgan Hough - 5.4.5-4 - Disable Module_ITKGoogleTest (OFF): ITKGoogleTest.cmake sets GTest::GTest in ITK_LIBRARIES but never calls find_package(GTest), breaking downstream cmake - Remove gtest-devel BuildRequires (no longer needed) * Tue Feb 24 2026 Morgan Hough - 5.4.5-3 - Add transitive system-lib Requires to -devel: hdf5, expat, jpeg, png, tiff, zlib, libminc * Tue Feb 24 2026 Morgan Hough - 5.4.5-2 - Remove zero-length stub.h placeholders (rpmlint zero-length error) * Mon Feb 23 2026 Morgan Hough - 5.4.5-1 - Bump to ITK 5.4.5 - Bundle Eigen3 (USE_SYSTEM_EIGEN=OFF): Fedora 44+ eigen3-devel 5.0.1 uses SameMajorVersion compat, breaking find_package(Eigen3 3.3) - Disable MINC on non-Fedora (EPEL 9 lacks libminc-devel) - Remove Eigen3 min-version sed workaround (no longer needed) * Tue Feb 03 2026 Maintainer - 5.4.2-1 - Initial package for ITK 5.4.2