# CSXCAD is the geometry/material description library of the openEMS FDTD project (openems.de): the first of four # packages (CSXCAD -> openEMS -> QCSXCAD -> AppCSXCAD) packaged for MRI RF-coil simulation (B1 maps, SAR, loop and # birdcage coils). Upstream switched from the 0.0.x/0.6.x scheme to 0.7.0 / 0.37.0 in 2026-10. # # fparser is Fedora's fparser 4.5.2 on f44 and the project's revival of it (fparser.spec) on f45/rawhide, where # Fedora retired it (upstream's thliebig/fparser is the same code with a CMake build); tinyxml, # HDF5, Boost and VTK are Fedora's / the project's (VTK 9.7 from mhough/neurofedora, Qt6). %global libsuffix %(echo %{_lib} | sed 's/^lib//') Name: CSXCAD Version: 0.7.0 Release: 2%{?dist} Summary: Continuous Structure XML CAD library (geometry and materials for openEMS) License: LGPL-3.0-or-later URL: https://github.com/thliebig/CSXCAD Source0: %{url}/archive/v%{version}/CSXCAD-%{version}.tar.gz # python/setup.py looks for the library in /lib and /lib/64, never /lib64, so on a # multilib host it only links because /usr/lib64 happens to be a default search dir -- which a buildroot prefix # is not. Spell it lib64. To report upstream (same code in openEMS/python/setup.py). Patch0: CSXCAD-python-lib64.patch BuildRequires: gcc-c++ BuildRequires: cmake BuildRequires: ninja-build # runtime_library_dirs in setup.py bake the build prefix (and /usr/local/lib) into the extensions' RPATH BuildRequires: chrpath BuildRequires: fparser-devel BuildRequires: tinyxml-devel BuildRequires: hdf5-devel BuildRequires: boost-devel # polyhedron inside-tests (CGAL 6 is header-only over gmp/mpfr) BuildRequires: CGAL-devel BuildRequires: gmp-devel BuildRequires: mpfr-devel BuildRequires: vtk-devel # Defines %%vtk_abi on Fedora's vtk (via vtk-abi-compat); our vtk provides it itself. BuildRequires: vtk(abi) # VTK cmake config pulls these at find_package time. BuildRequires: freetype-devel pugixml-devel fmt-devel utf8cpp-devel BuildRequires: PEGTL-devel jsoncpp-devel nlohmann-json-devel BuildRequires: double-conversion-devel expat-devel glew-devel lz4-devel BuildRequires: libxml2-devel libtiff-devel libjpeg-turbo-devel libpng-devel BuildRequires: mesa-libGL-devel # python3-CSXCAD (Cython extensions over the library) BuildRequires: python3-devel BuildRequires: pyproject-rpm-macros BuildRequires: python3-Cython BuildRequires: python3-numpy BuildRequires: python3-matplotlib BuildRequires: python3-pytest # 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. %%vtk_abi comes from vtk-devel's macros.vtk; the %%build test catches a # buildroot without it (see 3dslicer-igt.spec for why the check is not at parse time). Requires: vtk(abi) = %{?vtk_abi}%{!?vtk_abi:UNSET} %description CSXCAD (Continuous Structure XML CAD) describes geometry and electromagnetic material properties for the openEMS FDTD solver: primitives (boxes, cylinders, spheres, polygons, polyhedra, curves, wires, STL/PLY meshes), properties (metal, conducting sheets, dispersive and discrete voxel materials, lumped elements, excitations, probes, dumps), parametrised coordinates through fparser, and the XML file format openEMS reads. Voxel body models for MRI simulation enter openEMS through its discrete-material primitive. %package devel Summary: Headers and development files for CSXCAD Requires: %{name}%{?_isa} = %{version}-%{release} # the public headers include fparser.hh, tinyxml.h and the HDF5 C API Requires: fparser-devel%{?_isa} Requires: tinyxml-devel%{?_isa} Requires: hdf5-devel%{?_isa} %description devel Headers and the unversioned shared library link for building against CSXCAD (openEMS, QCSXCAD, AppCSXCAD and your own code). %package -n python3-CSXCAD Summary: Python interface to CSXCAD Requires: %{name}%{?_isa} = %{version}-%{release} # %%pyproject_install generates the numpy/matplotlib requirements from the metadata %py_provides python3-csxcad %description -n python3-CSXCAD Python (Cython) bindings for CSXCAD: build the simulation geometry in Python with ContinuousStructure, the primitive and property classes and the mesh helpers, for use with python3-openEMS. %package octave Summary: Octave/MATLAB interface to CSXCAD BuildArch: noarch Suggests: octave %description octave The CSXCAD .m files (geometry definition, mesh helpers, structure import and export) for GNU Octave or MATLAB. Add %{_datadir}/CSXCAD/matlab to the path; openEMS-octave requires this package. %prep %autosetup -p1 -n CSXCAD-%{version} # The tests are only reachable through the option below; make sure it still exists. grep -q 'option(CSXCAD_BUILD_TESTS' CMakeLists.txt %generate_buildrequires cd python # setup.py runs here too and insists on a prefix; none is needed for the metadata. export, not a prefix: the # macro expands to several commands and a prefix would reach only the first. export CSXCAD_NOSCM=1 CSXCAD_INSTALL_PATH_IGNORE=1 %pyproject_buildrequires %build test -n "%{?vtk_abi}" || { echo "ERROR: vtk_abi undefined - add 'BuildRequires: vtk-devel'" >&2; exit 1; } %cmake -G Ninja \ -DLIB_SUFFIX=%{libsuffix} \ -DENABLE_RPATH=OFF \ -DCSXCAD_BUILD_TESTS=ON %cmake_build # The Python extensions compile against the headers and link the library as installed. Stage that layout # under the build directory: a buildroot path compiled into the extensions trips check-buildroot. DESTDIR=$PWD/stage cmake --install %{_vpath_builddir} STAGE=$PWD/stage cd python export CSXCAD_NOSCM=1 CSXCAD_INSTALL_PATH_IGNORE=1 export CFLAGS="%{build_cflags} -I$STAGE%{_includedir}" CXXFLAGS="%{build_cxxflags} -I$STAGE%{_includedir}" export LDFLAGS="%{build_ldflags} -L$STAGE%{_libdir}" %pyproject_wheel %install %cmake_install cd python %pyproject_install %pyproject_save_files CSXCAD cd .. # setup.py puts /usr/local/lib{,64} into the extensions' RPATH for so in %{buildroot}%{python3_sitearch}/CSXCAD/*.so; do chrpath --delete "$so"; done %check %ctest # From a copy outside the source tree: tests/ is a package, so pytest puts python/ on sys.path, and the source # CSXCAD/ there (no compiled extensions) would shadow the installed module. rm -rf pytests && mkdir pytests && cp -a python/tests pytests/ cd pytests LD_LIBRARY_PATH=%{buildroot}%{_libdir} %pytest -p no:cacheprovider tests %files %license COPYING %doc README.md CHANGELOG.md %{_libdir}/libCSXCAD.so.0 %{_libdir}/libCSXCAD.so.%{version} %files devel %{_includedir}/CSXCAD/ %{_libdir}/libCSXCAD.so %files -n python3-CSXCAD -f %{pyproject_files} %doc python/README.md %files octave %license COPYING %{_datadir}/CSXCAD/ %changelog * Fri Oct 30 2026 Morgan Hough - 0.7.0-2 - Rebuild against Fedora's vtk 9.7.0 on rawhide. No spec change was needed: the mock build was clean and no binary needs libjava, libjvm or libvtkJava. * Fri Oct 23 2026 Morgan Hough - 0.7.0-1 - Initial package: CSXCAD 0.7.0 (library, headers, Python bindings as python3-CSXCAD, Octave scripts), the geometry layer of openEMS, packaged for MRI RF-coil simulation. Fedora's fparser, tinyxml, HDF5 and the project's VTK 9.7 (vtk(abi) pin). The C++ unit tests and the Python test suite run in %%check. - Patch0: setup.py searched /lib/64 instead of lib64 (to report upstream). The extensions' RPATH (build prefix, /usr/local) is stripped with chrpath.