# Cleaver2 -- the multi-material tetrahedral meshing library that SCIRun # links, from the SCIRun-pinned fork CIBC-Internal/Cleaver2Library. This is # NOT the upstream SCIInstitute/Cleaver application, and the two cannot # substitute for each other: # - the fork is a 2017-12-19 copy of Cleaver2 master @ 6d4e617 with the # namespace renamed to cleaver2:: (upstream uses cleaver::), so SCIRun's # InterfaceWithCleaver2Algorithm cannot build against upstream; # - upstream kept developing to 2023; the two share no git history and # differ by 1,623 non-whitespace lines across the same 66 library files. # SCIRun pins this exact commit in Superbuild/VERSIONS.cmake (tag # scirun-pin-2026.07.27, branch scirun-5.0.0-beta). Packaged for the SCIRun # spec on intel-skullcandy, agreed on the board 2026-10-07. # # The library needs only the C++ standard library: no ITK, VTK, teem or Qt. # The fork's `INCLUDE_DIRECTORIES(${Teem_BINARY_DIR}/include)` is vestigial # (no source includes teem), and `-DTETLIBRARY` is too: there is no TetGen # code, only a writer for TetGen's .node/.ele text format. %global commit 7e2904699aef2d2929621515adf203dd9027721d %global shortcommit %(c=%{commit}; echo ${c:0:7}) %global snapdate 20260211 Name: cleaver2 # 0.1.0 is the library's own project() version; upstream has never tagged a # release, only the SCIRun pin. snapdate is the pinned commit's date. Version: 0.1.0^%{snapdate}git%{shortcommit} # Explicit, not %%autorelease -- that macro is inert in this COPR # (ci/PROCEDURES.md golden rule 3). Release: 2%{?dist} Summary: Multi-material tetrahedral meshing library (SCIRun's Cleaver2) # The library is MIT: LICENSE, plus MIT text in 46 of its 65 sources; 17 # carry no header. Timer.cpp/.h carry a 2012 notice by the same author as # LICENSE: "This source code is not to be used, copied, or shared, without # explicit permission from the author." (-1 described this wrongly as a bare # copyright line.) It contradicts the MIT LICENSE, so they are NOT built: # Source3/Source4 replace them with an MIT std::chrono implementation of the # same class, with the same members and layout, so libcleaver2.so.0's ABI is # unchanged (cleaver-timer.h explains; shared with the cleaver package). The # tarball still contains them, covered by the repository-wide MIT LICENSE # from the same copyright holder; upstream is asked to fix the header. # Roots3And4.cpp is Jochen Schwarze's cubic/quartic # solver from Graphics Gems I (1990). It has no notice of its own, it is # compiled in, and TopologicalInterfaceCalculator calls SolveQuadric and # SolveCubic from it at four sites, so the binary carries it. SPDX has # Graphics-Gems; fedora-license-data 1.76 does not classify it yet, so this # is fine for the COPR but needs a fedora-license-data request (Morgan's, # outside party) before any Fedora submission. # # Also on the record, but not a licence term of the shipped code: # src/lib/cleaver2/CMakeLists.txt carries a 2011-12 header, "All Rights # Reserved. Redistribution and use in source and binary forms is strictly # prohibited without the direct consent of the author." It is a build # script, nothing from it ships, and every C++ source from the same years # and author carries MIT text. Upstream SCIInstitute/Cleaver has the same # stale header on three of its CMakeLists. Drafted as an upstream ask. License: MIT AND Graphics-Gems URL: https://github.com/CIBC-Internal/Cleaver2Library Source0: %{url}/archive/%{commit}/Cleaver2Library-%{shortcommit}.tar.gz # %%check: mesh a sphere in a box and check the volumes, building against # the installed Cleaver2Config.cmake exactly as SCIRun's src/CMakeLists.txt # does. Source1: cleaver2-smoke.cpp Source2: cleaver2-smoke-CMakeLists.txt # Replacements for Timer.h/Timer.cpp (see the License comment). Written for # upstream's cleaver:: namespace; %%prep renames it to the fork's cleaver2::. Source3: cleaver-timer.h Source4: cleaver-timer.cpp # Upstream has no install step at all; SCIRun's Superbuild reads the build # tree. Ours: build shared (upstream forces STATIC) with soname # libcleaver2.so.0, install the library and every header (the API headers # include the internal ones), and install a Cleaver2Config.cmake that sets # the four variables SCIRun reads -- SCI_CLEAVER2_INCLUDE, # SCI_CLEAVER2_LIBRARY (bare "cleaver2", as SCIRun links it), # SCI_CLEAVER2_LIBRARY_DIR and CLEAVER2_USE_FILE -- so SCIRun needs only # -DCLEAVER2_DIR=%%{_libdir}/cmake/Cleaver2 and no shim. Patch0: cleaver2-shared-and-install.patch BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: ninja-build %description Cleaver2 is a multi-material tetrahedral meshing library from the SCI Institute at the University of Utah. It generates conforming tetrahedral meshes, with guaranteed bounds on element quality, from volumetric data with several materials -- for example a labeled head or heart segmentation -- for finite element simulation. This is the library SCIRun links (its InterfaceWithCleaver2 module), built from the fork SCIRun pins. It is not the standalone Cleaver application. %package devel Summary: Development files for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} %description devel Headers, the unversioned shared-library link and a Cleaver2Config.cmake for building against Cleaver2. Consumers follow SCIRun's pattern: point CLEAVER2_DIR at %{_libdir}/cmake/Cleaver2, include Cleaver2Config.cmake and ${CLEAVER2_USE_FILE}, add ${SCI_CLEAVER2_INCLUDE} and link ${SCI_CLEAVER2_LIBRARY}. Headers are included as . %prep %autosetup -n Cleaver2Library-%{commit} -p1 sed 's/^namespace cleaver$/namespace cleaver2/' %{SOURCE3} > src/lib/cleaver2/Timer.h sed 's/^namespace cleaver$/namespace cleaver2/' %{SOURCE4} > src/lib/cleaver2/Timer.cpp grep -q '^namespace cleaver2$' src/lib/cleaver2/Timer.h grep -q '^namespace cleaver2$' src/lib/cleaver2/Timer.cpp %build # src/CMakeLists.txt appends -std=c++11 to CMAKE_CXX_FLAGS itself. %cmake -G Ninja -DBUILD_SHARED_LIBS=ON %cmake_build %install %cmake_install %check # The fork ships no tests. Build Source1 against the BUILDROOT's install, # through its Cleaver2Config.cmake with /usr rewritten to the buildroot, # then mesh a radius-7 sphere in a 24^3 box with SCIRun's default # parameters. It asserts on numbers rather than on not crashing: two # materials present, sphere volume within 10% of 4/3 pi r^3, tets fill the # box to 5%, no degenerate tets. cfg=$(mktemp -d) sed -e 's|"%{_prefix}|"%{buildroot}%{_prefix}|' \ %{buildroot}%{_libdir}/cmake/Cleaver2/Cleaver2Config.cmake > $cfg/Cleaver2Config.cmake cat $cfg/Cleaver2Config.cmake grep -q '"%{buildroot}%{_includedir}"' $cfg/Cleaver2Config.cmake mkdir -p smoke cp %{SOURCE1} smoke/cleaver2-smoke.cpp cp %{SOURCE2} smoke/CMakeLists.txt cmake -S smoke -B smoke/build -G Ninja -DCLEAVER2_DIR=$cfg \ -DCMAKE_CXX_FLAGS="%{optflags}" -DCMAKE_EXE_LINKER_FLAGS="%{build_ldflags}" cmake --build smoke/build LD_LIBRARY_PATH=%{buildroot}%{_libdir} smoke/build/cleaver2-smoke # and it really linked the shared library, by soname readelf -d smoke/build/cleaver2-smoke | grep -q 'NEEDED.*libcleaver2\.so\.0' %files %license LICENSE %doc README.md %{_libdir}/libcleaver2.so.0 %{_libdir}/libcleaver2.so.0.1.0 %files devel %{_includedir}/cleaver2/ %{_libdir}/libcleaver2.so %dir %{_libdir}/cmake/Cleaver2 %{_libdir}/cmake/Cleaver2/Cleaver2Config.cmake %{_libdir}/cmake/Cleaver2/UseCleaver2.cmake %changelog * Thu Oct 08 2026 Morgan Hough - 0.1.0^20260211git7e29046-2 - Replace Timer.h/Timer.cpp, whose 2012 header forbids use without the author's permission, contradicting LICENSE, with an MIT implementation of the same class (same layout and symbols, so the soname stays). -1's License comment misdescribed that header as a bare copyright line; corrected. * Wed Oct 07 2026 Morgan Hough - 0.1.0^20260211git7e29046-1 - Initial package, from the commit SCIRun pins (scirun-pin-2026.07.27). - Build shared with soname libcleaver2.so.0; add install rules and an install-tree Cleaver2Config.cmake carrying SCIRun's four variables.