%global commit d853f053d83aa8098caeddc001d276c3c5ecf8f4 %global shortcommit %(c=%{commit}; echo ${c:0:7}) %global date 20260104 # 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} Name: mricrogl # Using the date as the version is common for untagged scientific software Version: 1.2.%{date} Release: 4.git%{shortcommit}%{?dist} Summary: GL-accelerated medical image viewer with Python scripting License: BSD-2-Clause URL: https://github.com/rordenlab/MRIcroGL # Download the archive for the specific commit, save as name-shortcommit.tar.gz Source0: %{url}/archive/%{commit}.tar.gz#/%{name}-%{shortcommit}.tar.gz # SynZip defines USEZLIBSSE for every Linux CPU and then links the prebuilt # ./x86_64-linux/*.o CloudFlare-zlib objects committed upstream, so aarch64 # fails with "file in wrong format". Upstream already guards this for Apple # Silicon; add the same CPU test on Linux and fall back to system zlib. Patch0: mricrogl-no-zlibsse-on-non-x86.patch # nifti.pas always defines SSE, which on CPUAARCH64 pulls in neon.pas and its # prebuilt Mach-O ./aarch64-darwin/scale2uint8.o -- unusable on aarch64 Linux. # Fall back to the pure-Pascal SISD paths there. Patch1: mricrogl-no-neon-on-aarch64-linux.patch BuildRequires: lazarus >= 2.0 BuildRequires: fpc BuildRequires: fpc-src BuildRequires: qt5pas-devel BuildRequires: qt5-qtbase-devel BuildRequires: lazarus-lcl-qt5 BuildRequires: python3-devel BuildRequires: dos2unix BuildRequires: desktop-file-utils Requires: qt5pas Requires: python3-libs Requires: dcm2niix Requires: hicolor-icon-theme %description MRIcroGL is a cross-platform NIfTI format image viewer that uses your graphics card's hardware acceleration (OpenGL) to provide interactive volume rendering. It includes embedded Python scripting for automated analysis. %prep # GitHub commit archives extract to RepoName-FullCommitHash %autosetup -n MRIcroGL-%{commit} -p1 # 1. Clean up Permissions & Line Endings find . -type f \( -name "*.ini" -o -name "*.lut" -o -name "*.txt" -o -name "*.py" -o -name "*.glsl" \) -exec dos2unix {} \; find . -type f -exec chmod 644 {} \; %build # 1. Dynamically locate the source root PROJECT_FILE=$(find . -name "MRIcroGL.lpi" -print -quit) SOURCE_DIR=$(dirname "$PROJECT_FILE") # 2. Dynamically determine Python version and linker flags PY_VER=$(python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')") PY_LIBS=$(python3-config --libs) # 3. FIX: Link against system python instead of bundled static lib sed -i "s|{\$linklib ./PythonBridge/x86_64-linux/libpython3.7m.a}|{\$linklib python${PY_VER}}|" "$SOURCE_DIR/mainunit.pas" # 4. Inject flags into the .lpi project file # -Cg: generate PIC code # -k-no-pie: disable PIE to avoid conflict with non-PIC FPC RTL sed -i "s| %{buildroot}%{_bindir}/%{name} < ../../bin/dcm2niix -> /usr/bin/dcm2niix ln -s ../../bin/dcm2niix %{buildroot}%{_libexecdir}/%{name}/dcm2niix # 6. Desktop Entry cat > %{buildroot}%{_datadir}/applications/%{name}.desktop < - 1.2.20260104-4.gitd853f05 - Add mricrogl-no-neon-on-aarch64-linux.patch. With the zlib fix in -3 the build got as far as linking and then failed on "./aarch64-darwin/scale2uint8.o: file not recognized": nifti.pas defines SSE unconditionally, which on CPUAARCH64 selects neon.pas, and that unit links a Mach-O object and declares its externals with Darwin C++ mangling. Leave SSE undefined on aarch64 Linux so the pure-Pascal SISD routines are used -- slower there, but correct and free of prebuilt binaries. * Mon Sep 14 2026 Morgan Hough - 1.2.20260104-3.gitd853f05 - Add mricrogl-no-zlibsse-on-non-x86.patch. SynZip.pas defines USEZLIBSSE on all Linux CPUs and links the prebuilt ./x86_64-linux/*.o zlib objects, so the aarch64 build failed with "cannot find ./x86_64-linux/adler32.o: file in wrong format" / Error (9013). Upstream already leaves USEZLIBSSE undefined for DARWIN+CPUAARCH64; apply the same CPU test to the LINUX branch so non-x86_64 uses the system zlib. Also add -p1 to %%autosetup. Fedora forbids linking prebuilt binary objects, so this is the right fix rather than excluding the arch. * Thu Feb 26 2026 Morgan Hough - 1.2.20260104-2.gitd853f05 - Switch debug_package suppression from global to define scope; fixes EPEL 9 SRPM rebuild failure caused by auto-injected debuginfo stanza * Sun Jan 04 2026 Morgan Hough - 1.2.20260104-1.gitd853f05 - Initial RPM release for MRIcroGL