# Upstream's newest tag is release-1.6.50; master has moved on since and is what # the ACES tree builds from. Package the tip of master, as bicpl and minc-tools # already do here. configure.ac still says 1.6.4, so the version follows the tag. %global commit 87a90dfc0b7cd45375c925e948f8ec10bdeba0cb %global shortcommit %(c=%{commit}; echo ${c:0:7}) %global date 20140819 Name: EBTKS Version: 1.6.50 Release: 4.%{date}git%{shortcommit}%{?dist} Summary: Basic tools and template classes for medical image processing # COPYING: the classic MNI/BIC permissive notice, no advertising clause and no # field-of-use restriction. See docs/civet-licensing.md (tier 1). License: HPND URL: https://github.com/aces/EBTKS Source0: %{url}/archive/%{commit}/%{name}-%{shortcommit}.tar.gz # m4/ is a git submodule (BIC-MNI/mni-acmacros) and so is absent from the # archive tarball; configure.ac needs its macros. Same arrangement as bicpl. Source1: https://github.com/BIC-MNI/mni-acmacros/archive/master.tar.gz#/mni-acmacros.tar.gz # Two pre-C++11 idioms that no longer compile. Sent upstream: see # docs/upstream/ebtks-cxx11-compat.md Patch0: EBTKS-cxx11-compat.patch # Missing explicit template instantiations, plus a 64-bit fix to Pool<>: each # pooled element must be at least pointer-sized because it holds a free-list # link, which does not hold for MPoint (two shorts) on LP64. Same report. Patch1: EBTKS-missing-template-instantiations.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: libtool BuildRequires: make %description EBTKS (Edmonton Brain Toolkit) is a C++ library of template container and matrix classes, histogram and polynomial fitting, simplex optimisation, a back-propagation network and assorted file and path utilities. It is the numerical foundation of the MNI/BIC tools, notably N3 (nu_correct) and classify. %package devel Summary: Development files for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} %description devel Headers and link-time libraries for building applications against %{name}. %prep %autosetup -p1 -n %{name}-%{commit} # Supply the mni-acmacros submodule that the tarball cannot carry. mkdir -p m4 tar -xf %{SOURCE1} --strip-components=1 -C m4 test -f m4/smr_WITH_BUILD_PATH.m4 # Drop the bundled CLAPACK/f2c subset. It is dead code: blaswrap.h renames every # symbol to EBTKS_*, and nothing outside clapack/ references those names, so # removing it changes no interface the library offers. It also no longer # compiles -- clapack/xerbla.c calls printf with no declaration, which C23 makes # an error. Dropping it beats both silencing the error and shipping a bundled # copy of a library Fedora already provides. awk '!/clapack\//' Makefile.am | awk '{l[NR]=$0} END {for (i=1; i<=NR; i++) { s=l[i] if (s ~ /\\$/ && (i==NR || l[i+1] ~ /^[[:space:]]*$/)) sub(/[[:space:]]*\\$/, "", s) print s}}' > Makefile.am.new mv Makefile.am.new Makefile.am ! grep -q clapack Makefile.am grep -q 'templates/MatrixConv.cc$' Makefile.am rm -rf clapack %build autoreconf -ifv -I m4 # 1996-era C++: builds as C++17 at best, and even that needs the old implicit # conversions and register-keyword usage tolerated. # -DUSE_FLMAT: src/Polynomial.cc calls asFlMat() unconditionally, but its # definition (templates/Matrix.cc) sits behind USE_FLMAT, which upstream's # AM_CPPFLAGS never defines -- so libEBTKS referenced a function it had compiled # out. The guard is independent of USE_FCOMPMAT, so this adds the float matrix # support only. Upstream ships -DUSE_COMPMAT -DUSE_DBLMAT. export CXXFLAGS="%{optflags} -std=gnu++17 -fpermissive -DUSE_FLMAT" export CFLAGS="%{optflags} -std=gnu17" %configure --disable-static --enable-shared %make_build %install %make_install find %{buildroot} -name '*.la' -delete %check # Every symbol the shared library needs must resolve; missing explicit template # instantiations do not fail the link of a shared object, they fail its # consumers (N3's configure could not link against -lEBTKS). test -z "$(ldd -r .libs/libEBTKS.so.0 2>&1 | grep '^undefined symbol')" || { ldd -r .libs/libEBTKS.so.0 2>&1 | grep '^undefined symbol' exit 1 } %files %license COPYING %doc AUTHORS NEWS README ChangeLog %{_libdir}/libEBTKS.so.* %files devel %{_includedir}/EBTKS/ %{_libdir}/libEBTKS.so %changelog * Thu Sep 24 2026 Morgan Hough - 1.6.50-4.20140819git87a90df - Pool assumed sizeof(Type) >= sizeof(void*), which is an ILP32 assumption: a pooled element holds a free-list link while free, and MPoint is two shorts. On LP64 "Assertion failed at line 32 in file templates/Pool.cc" aborted spline_smooth, i.e. every nu_correct run. Allocate raw storage with a stride of max(sizeof(Type), sizeof(_Link*)) instead of Type[]. Upstream's "Crashes on MPoint3D. Couldn't figure out why" note in MPoint.h is the same bug. Found by N3's test suite. * Thu Sep 24 2026 Morgan Hough - 1.6.50-3.20140819git87a90df - Instantiate Mat operator*(Mat, Mat) too: declared at Matrix.h:220 and used by N3's spline fitting, but the single-type _INSTANTIATE_MAT covers only scalar*matrix. Consumers linked against the shared library could not resolve it. * Thu Sep 24 2026 Morgan Hough - 1.6.50-2.20140819git87a90df - Patch1: instantiate the templates the shared library referenced but never defined (Array >, asFlMat, asFloatArray, array). Upstream builds only a static library, so the undefined references never surfaced there; against the shared library every consumer failed to link, which is how N3's configure reported "cannot find required library EBTKS". - %%check now fails the build on any unresolved symbol in the library. * Tue Sep 22 2026 Morgan Hough - 1.6.50-1.20140819git87a90df - Initial package, from the tip of upstream master. CIVET/MNI tier 1 (docs/civet-licensing.md); N3, classify and inormalize all need it.