%global commit 6565932c434827a2e2b103bb4f80e46f449cba40 %global shortcommit %(c=%{commit}; echo ${c:0:7}) %global snapdate 20251104 # CLI shape-analysis tools; strip the debug subpackage to keep it lean. %global debug_package %{nil} Name: SPHARM-PDM Version: 2.0.0 Release: 0.4.%{snapdate}git%{shortcommit}%{?dist} Summary: Spherical harmonic point distribution model shape analysis tools License: Apache-2.0 URL: https://github.com/NIRALUser/SPHARM-PDM Source0: %{url}/archive/%{commit}/%{name}-%{commit}.tar.gz BuildRequires: gcc-c++ BuildRequires: cmake BuildRequires: ninja-build BuildRequires: chrpath BuildRequires: git-core # The three superbuild dependencies — all provided as system packages, so we # disable the (offline-fatal) superbuild and build the inner project directly. BuildRequires: InsightToolkit5-devel BuildRequires: vtk-devel BuildRequires: SlicerExecutionModel-devel # VTK cmake config runs find_package for all its module deps at configure time. BuildRequires: freetype-devel BuildRequires: pugixml-devel BuildRequires: fmt-devel BuildRequires: utf8cpp-devel BuildRequires: PEGTL-devel BuildRequires: jsoncpp-devel BuildRequires: nlohmann-json-devel BuildRequires: hdf5-devel BuildRequires: double-conversion-devel BuildRequires: expat-devel BuildRequires: glew-devel BuildRequires: lz4-devel BuildRequires: libxml2-devel BuildRequires: libtiff-devel BuildRequires: libjpeg-turbo-devel BuildRequires: libpng-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 SPHARM-PDM is a set of command-line tools for spherical-harmonic-based shape analysis. It computes correspondent point-based shape models (PDMs) from binary segmentations by parameterising the surface with spherical harmonics and sampling a corresponding icosahedral mesh, enabling group statistical shape analysis of brain structures and other objects. Part of the NIRAL / SlicerSALT shape-analysis ecosystem. This build uses the system ITK, VTK and SlicerExecutionModel (no superbuild). %prep %autosetup -n %{name}-%{commit} # CMake/CMakeLists.txt does nothing but file(DOWNLOAD) a Windows-only # FindVcvars.cmake from GitHub at configure time (fatal offline). FindVcvars is # never used on Linux — neutralise the whole sub-CMakeLists. echo '# FindVcvars download removed: Windows-only, unused on Linux, offline build' \ > CMake/CMakeLists.txt # GCC 16 rejects this legacy code's unqualified std names (e.g. MeshMath.cxx # uses bare `cout`/`endl`, relying on a `using namespace std` that older # standard headers pulled in transitively). Force-include a small compat header # that brings the std names into scope for every translation unit. cat > std-compat.h <<'EOF' #pragma once #include #include #include #include #include #include #include using namespace std; EOF %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; } export CXXFLAGS="%{optflags} -include ${PWD}/std-compat.h -fpermissive" %cmake -GNinja \ -DCMAKE_BUILD_TYPE=Release \ -DSPHARM-PDM_SUPERBUILD:BOOL=OFF \ -DUSE_SYSTEM_ITK:BOOL=ON \ -DUSE_SYSTEM_VTK:BOOL=ON \ -DUSE_SYSTEM_SlicerExecutionModel:BOOL=ON \ -DBUILD_TESTING:BOOL=OFF \ -DCMAKE_SKIP_INSTALL_RPATH:BOOL=ON %cmake_build %install %cmake_install # This is a CLI-tools package: drop the static dev libraries and headers the # build also installs (the tools are statically linked and self-contained). rm -rf %{buildroot}%{_includedir}/Shape find %{buildroot} -name '*.a' -delete # Strip any residual build-tree RPATHs the SEM macros may leave. find %{buildroot} -type f -perm -111 \ -exec chrpath --delete {} \; 2>/dev/null || : %files %license License.txt %{_bindir}/* %changelog * Sat Sep 19 2026 Morgan Hough - 2.0.0-0.4.git - Rebuild against InsightToolkit5 5.4.7-8, which unbundles Eigen3, VXL and double-conversion. No source or spec change; the Release bump is what makes the rebuild reach anyone. COPR adds a sibling at an already-published NVR rather than replacing it, and dnf then serves the older copy -- so a rebuild at the same NVR would leave this package linked against the bundled ITK while appearing to succeed. - Validated against -8 in mhough/neurofedora-itk5-test before this bump. * Sun Aug 23 2026 Morgan Hough - 2.0.0-0.2.20251104git6565932 - 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. * Mon Jun 15 2026 Morgan Hough - 2.0.0-0.1.20251104git6565932 - Initial package: SPHARM-PDM spherical-harmonic shape-analysis CLI tools (master snapshot 6565932). Built against system ITK/VTK/SlicerExecutionModel with the superbuild disabled (Fedora no-superbuild policy). Complements the FSL FIRST mesh shape-analysis workflow.