Name: jemris Version: 2.9.2 Release: 6%{?dist} Summary: Juelich Extensible MRI Simulator License: GPL-2.0-or-later URL: https://github.com/JEMRIS/jemris Source0: %{url}/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: make BuildRequires: sundials-devel BuildRequires: xerces-c-devel BuildRequires: hdf5-devel BuildRequires: cln-devel BuildRequires: ginac-devel BuildRequires: ismrmrd-devel BuildRequires: openmpi-devel BuildRequires: boost-devel %description JEMRIS is a general MRI simulation framework. It is designed to simulate realistic MRI experiments with arbitrary pulse sequences, coil setups, and samples. %prep %autosetup -n %{name}-%{version} # Remove hardcoded mpicxx compiler sed -i '/set(CMAKE_CXX_COMPILER/d' CMakeLists.txt # Remove the docker pull block entirely (runs at cmake configure time, fails in mock). # The block structure is: message / execute_process / if / message / else / message / endif # Delete the whole block from "# Docker image" to the endif(). sed -i '/^# Docker image$/,/^endif()$/{d}' CMakeLists.txt # The conda block is guarded by SKIP_CONDA which we pass as ON, so leave it intact. # Fix SUNDIALS 7.x types (realtype -> sunrealtype) sed -i 's/\brealtype\b/sunrealtype/g' src/*.cpp src/*.h # Fix SUNDIALS 7.x API (passing comm by value instead of pointer) sed -i 's/SUNContext_Create( \&comm,/SUNContext_Create( comm,/g' src/*.cpp # SUNDIALS 7 moved the SUNContext API into its own libsundials_core, but # cmake/FindSundials.cmake only looks for sundials_cvode and sundials_nvecserial, # so SUNContext_Create is never linked. That went unnoticed while `core` was a # shared library -- libcore.so resolved the symbol transitively through # libsundials_cvode's own DT_NEEDED. Linking core statically (see %%build) makes # the executable responsible for it and the link fails outright: # # undefined reference to symbol 'SUNContext_Create' # /usr/lib64/libsundials_core.so.7: error adding symbols: DSO missing from command line # # So the shared build was under-linked and only worked by accident. Add # sundials_core to the finder, guarded so a pre-7 SUNDIALS (no such library) # still configures. sed -i 's|^ find_library(SUNDIALS_LIBRARIES_NVEC .*$|&\n find_library(SUNDIALS_LIBRARIES_CORE "sundials_core" DOC "sundials core, SUNDIALS >= 7")|' \ cmake/FindSundials.cmake sed -i 's|^ list(APPEND SUNDIALS_LIBRARIES ${SUNDIALS_LIBRARIES_CVODE} ${SUNDIALS_LIBRARIES_NVEC})$| list(APPEND SUNDIALS_LIBRARIES ${SUNDIALS_LIBRARIES_CVODE} ${SUNDIALS_LIBRARIES_NVEC})\n if (SUNDIALS_LIBRARIES_CORE)\n list(APPEND SUNDIALS_LIBRARIES ${SUNDIALS_LIBRARIES_CORE})\n endif()|' \ cmake/FindSundials.cmake grep -q SUNDIALS_LIBRARIES_CORE cmake/FindSundials.cmake || \ { echo "ERROR: sundials_core patch did not apply to FindSundials.cmake" >&2; exit 1; } # Remove deprecated CVodeSetErrFile (not in SUNDIALS 6+) sed -i 's/CVodeSetErrFile.*//g' src/*.cpp # Fix HDF5/size_t conflict in NDData.h # On 64-bit Fedora, hsize_t and size_t are same, causing an overload conflict. # We use a more robust way to remove the duplicate constructor. sed -i '/NDData (const std::vector& dims)/,/}/d' src/NDData.h # Add missing includes for newer GCC sed -i '1i #include \n#include \n#include ' src/NDData.h %build # Standard serial build # BUILD_SHARED_LIBS=OFF is load-bearing, not a preference. # # src/CMakeLists.txt:54 is `add_library (core ${CORE_SRC})` with no STATIC or # SHARED keyword, so the target follows BUILD_SHARED_LIBS -- and Fedora's %%cmake # macro sets it ON. That turns jemris's internal `core` into libcore.so, which # the jemris executable then links. Upstream only ever installs the executable # (`install (TARGETS jemris DESTINATION "bin")`, line 63); `core` has no install # rule at all, because upstream expects it to be static. # # Result with the macro default: /usr/bin/jemris carries # Requires: libcore.so()(64bit), nothing provides it, and the package cannot be # installed. Nothing fails at build time -- the library is never installed, so # there is no unpackaged-files error to notice. Found by # ci/check-installable.sh. # # Static is also the correct answer rather than a workaround: `core` is jemris's # own code with no install rule, no soname and no external consumer, so there is # nothing to gain from shipping it as a shared object. %cmake \ -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ -DBUILD_SHARED_LIBS:BOOL=OFF \ -DSKIP_CONDA=ON \ -DJEMRIS_ENABLE_MPI=OFF %cmake_build %install %cmake_install # Remove upstream's prebuilt MATLAB binaries. share/jemris/standalone_guis/apps/ # ships JEMRIS_seq, JEMRIS_sim and JEMRIS_txrx, which are MATLAB Compiler # Runtime executables checked into the tarball -- their only interesting # DT_NEEDED is libmwlaunchermain.so, i.e. the proprietary MCR. # # Three reasons they cannot stay, any one sufficient: # * prebuilt binaries with no buildable source, which Fedora does not allow # * they need MATLAB Runtime, which is not and cannot be packaged # * RPM generates Requires: libmwlaunchermain.so()(64bit) from them, and # nothing provides it, so jemris was UNINSTALLABLE even after the libcore.so # fix -- the sweep only reports the first unmet dependency, so this one was # hidden behind it. # The run_*.sh launchers go too: they exist only to invoke those binaries. rm -rf %{buildroot}%{_datadir}/%{name}/standalone_guis/apps # Guard: nothing MCR-linked may survive anywhere in the buildroot. if find %{buildroot} -type f -exec sh -c 'head -c4 "$1" | grep -q ELF' _ {} \; -print 2>/dev/null \ | xargs -r objdump -p 2>/dev/null | grep -q libmwlaunchermain; then echo "ERROR: a MATLAB-runtime-linked binary is still in the buildroot" >&2 exit 1 fi %files %license COPYING %doc README.md AUTHORS ChangeLog %{_bindir}/jemris %{_datadir}/jemris/ %changelog * Mon Sep 28 2026 Morgan Hough - 2.9.2-6 - Stop shipping upstream's prebuilt MATLAB binaries. standalone_guis/apps/ holds JEMRIS_seq, JEMRIS_sim and JEMRIS_txrx, MATLAB Compiler Runtime executables checked into the tarball whose only real DT_NEEDED is libmwlaunchermain.so. They are prebuilt binaries with no buildable source, they need the proprietary MCR, and they made jemris uninstallable -- this was hidden behind the libcore.so failure, since the sweep reports only the first unmet dependency. A guard fails the build if anything MCR-linked survives in the buildroot. * Mon Sep 28 2026 Morgan Hough - 2.9.2-5 - Link libsundials_core. SUNDIALS 7 moved the SUNContext API into its own library, but cmake/FindSundials.cmake looks only for sundials_cvode and sundials_nvecserial, so SUNContext_Create was never linked. That was invisible while `core` was shared -- libcore.so resolved it transitively through libsundials_cvode's DT_NEEDED -- and the static link exposes it as "undefined reference to symbol 'SUNContext_Create'". So the previous shared build was under-linked and only worked by accident. Guarded so a pre-7 SUNDIALS still configures, and the %prep step fails loudly if the patch stops applying. - Build the internal `core` library static. jemris was UNINSTALLABLE: src/CMakeLists.txt declares `add_library (core ...)` with no STATIC/SHARED keyword, Fedora's %%cmake sets BUILD_SHARED_LIBS=ON, so core became libcore.so -- and upstream installs only the jemris executable, never core. /usr/bin/jemris therefore required libcore.so with nothing providing it. No build-time error, because the library is never installed and so never shows up as an unpackaged file. Found by ci/check-installable.sh. * Sun May 24 2026 Morgan Hough - 2.9.2-4 - Add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to %%cmake for cmake 4.x compat. * Mon Mar 16 2026 Morgan Hough - 2.9.2-2 - Fix cmake parse error: rewrite docker block removal to preserve if/endif nesting - Conda block left intact (guarded by -DSKIP_CONDA=ON) * Fri Feb 27 2026 Gemini CLI - 2.9.2-1 - Initial package for Fedora