# 1. Commit Hash from your build logs %global commit e3825986359ecd75d82aa88ff2015d36e234e55d %global shortcommit %(c=%{commit}; echo ${c:0:7}) %global date 20260106 Name: minc-tools Version: 2.3.2 Release: 6.%{date}git%{shortcommit}%{?dist} Summary: Basic command-line tools for MINC files License: BSD-3-Clause URL: https://github.com/BIC-MNI/minc-tools Source0: https://github.com/BIC-MNI/%{name}/archive/%{commit}/%{name}-%{shortcommit}.tar.gz BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: make BuildRequires: bison BuildRequires: flex # NeuroFedora Dependencies BuildRequires: libminc-devel BuildRequires: netcdf-devel BuildRequires: hdf5-devel BuildRequires: zlib-devel # Runtime scripts often need these Requires: ImageMagick Requires: perl %description A collection of tools that work on MINC format images, including: mincinfo, mincresample, mincreshape, minccalc, and mincstats. %prep # Unpack the specific commit directory %autosetup -n %{name}-%{commit} # --- FIX 1: C23 Standard Conflicts (NAN collision) --- sed -i 's/\bNAN\b/MINC_NAN/g' progs/minccalc/gram.y sed -i 's/\bNAN\b/MINC_NAN/g' progs/minccalc/lex.l # --- FIX 2: C23/HDF5 Conflict (true/false keywords) --- sed -i '/enum {false=0, true=1};/d' progs/mincdump/mincdump.h # cmake 4.x: drop the IF(COMMAND CMAKE_POLICY) block that SETs CMP0026 OLD — # CMP0026 (LOCATION property read on TARGET) was removed in CMake 4.x and # the SET call now hard-errors. sed -i '/^IF(COMMAND CMAKE_POLICY)/,/^ENDIF(COMMAND CMAKE_POLICY)/d' CMakeLists.txt # Testing/CMakeLists.txt uses GET_PROPERTY(... TARGET tgt PROPERTY LOCATION) # (the same removed CMP0026 mechanism). Disable the Testing subdir entirely # (we don't run upstream's tests in the RPM build anyway). sed -i '/add_subdirectory[[:space:]]*(Testing)/Id; /ADD_SUBDIRECTORY[[:space:]]*(Testing)/Id' CMakeLists.txt # netCDF API: F44/rawhide netcdf renamed _FillValue to NC_FillValue (the leading # underscore identifier was always reserved-to-the-implementation in ISO C and # newer netcdf headers no longer expose it). progs/mincgen/ncgentab.y uses it. find progs -name '*.[chyl]' -exec sed -i 's/\b_FillValue\b/NC_FillValue/g' {} + # --- FIX 3: Cleanly Rewrite conversion/CMakeLists.txt --- # We overwrite this file to: # 1. Disable the broken NIfTI tools # 2. Properly build the internal 'acr_nema' library which lacks its own build file cat > conversion/CMakeLists.txt << 'EOF' INCLUDE_DIRECTORIES(${LIBMINC_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/Acr_nema) # Manually define the helper library sources SET(ACR_SRCS Acr_nema/acr_io.c Acr_nema/dicom_client_routines.c Acr_nema/dicom_network.c Acr_nema/element.c Acr_nema/file_io.c Acr_nema/globals.c Acr_nema/group.c Acr_nema/message.c Acr_nema/value_repr.c ) # Create the static library locally ADD_LIBRARY(acr_nema STATIC ${ACR_SRCS}) # Tool: minctoecat (Needs acr_nema) ADD_EXECUTABLE(minctoecat minctoecat/minctoecat.c minctoecat/ecat_write.c minctoecat/machine_indep.c ) TARGET_LINK_LIBRARIES(minctoecat acr_nema ${LIBMINC_LIBRARIES} m) # Tool: ecattominc ADD_EXECUTABLE(ecattominc ecattominc/ecattominc.c ecattominc/insertblood.c ecattominc/ecat_file.c ecattominc/machine_indep.c ) TARGET_LINK_LIBRARIES(ecattominc ${LIBMINC_LIBRARIES}) # Tool: upet2mnc ADD_EXECUTABLE(upet2mnc micropet/upet2mnc.c) TARGET_LINK_LIBRARIES(upet2mnc ${LIBMINC_LIBRARIES}) # Install these tools to bin/ INSTALL(TARGETS minctoecat ecattominc upet2mnc DESTINATION bin) EOF %build # --- FIX 4: Linker & Compiler Flags --- # -std=gnu17: Forces older C standard to avoid strict C23 keyword errors. # -fcommon: Allows legacy global variables (fixes "multiple definition" errors). export CFLAGS="%{optflags} -std=gnu17 -fcommon" %cmake \ -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ -DBUILD_TESTING=OFF \ -DLIBMINC_DIR=%{_libdir}/cmake/libminc \ -DLIBMINC_INCLUDE_DIR=%{_includedir} \ -DLIBMINC_LIBRARY=%{_libdir}/libminc.so %cmake_build %install %cmake_install # Fix man page location — cmake installs to /usr/man/ instead of /usr/share/man/ if [ -d %{buildroot}%{_prefix}/man ]; then mkdir -p %{buildroot}%{_mandir} cp -a %{buildroot}%{_prefix}/man/* %{buildroot}%{_mandir}/ rm -rf %{buildroot}%{_prefix}/man fi %check # Tests disabled (-DBUILD_TESTING=OFF) — upstream's Testing/CMakeLists.txt # uses TARGET LOCATION property reads that cmake 4.x removed. %files %license COPYING # Use wildcard for README to match whatever is present (README or README.md) %doc README* %{_bindir}/minc* %{_bindir}/rawtominc %{_bindir}/voxeltoworld %{_bindir}/worldtovoxel %{_bindir}/invert_raw_image %{_bindir}/ecattominc %{_bindir}/upet2mnc %{_bindir}/transformtags %{_bindir}/xfmconcat %{_bindir}/xfminvert %{_bindir}/xfm* %{_mandir}/man1/*.1* %changelog * Sat May 23 2026 Morgan Hough - 2.3.2-6.20260106gite382598 - Rename _FillValue to NC_FillValue in progs/mincgen — newer libnetcdf drops the underscore-prefixed identifier (reserved-to-implementation) * Sat May 23 2026 Morgan Hough - 2.3.2-5.20260106gite382598 - Drop CMAKE_POLICY(SET CMP0026 OLD) block (CMP0026 was removed in cmake 4.x); disable Testing/ subdir (its GET_PROPERTY ... LOCATION reads are also gone) * Sat May 23 2026 Morgan Hough - 2.3.2-4.20260106gite382598 - Add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 for cmake 4.x compatibility (F44+) * Mon Mar 16 2026 Morgan Hough - 2.3.2-2.20260106gite382598 - Fix man page installation: /usr/man/ -> /usr/share/man/ - Include man pages in files list * Tue Jan 06 2026 Matthew Hough - 2.3.2-1.20260106gite382598 - Initial package for NeuroFedora - Update to latest git snapshot (e382598) - Fix C23 compatibility issues (NAN, true/false keywords) - Fix legacy linker errors with -fcommon - Completely rewrite conversion/CMakeLists.txt to fix linking