Add a CMake build alongside autotools - #606
Conversation
87e81d7 to
5fe0f1c
Compare
5fe0f1c to
ccff08f
Compare
|
Done, cmake.yml now uses actions/checkout@v6. The version updates for the existing workflows moved to a separate PR, #622. |
Single source of truth for the autotools and CMake builds.
…stem Honor $GENRB/$PKGDATA and accept source and output directories; the one-argument form is unchanged.
CMake >= 3.18, libfuse 2 like autotools. ICU via CMake's ICU module instead of the removed icu-config; plugins are MODULE libraries named as ltfs.conf expects; ctest registers tests/t/*.sh by glob.
gnu11: the sources use GNU extensions.
b24c452 to
91f1ced
Compare
|
Hello @matejk thanks for this contribution. |
There was a problem hiding this comment.
[madjesc@lima-alma build]$ ldd /usr/local/bin/ltfs
linux-vdso.so.1 (0x00007ffe43fa9000)
libltfs.so.2 => not found
libfuse.so.2 => /lib64/libfuse.so.2 (0x00007f2883c84000)
libxml2.so.2 => /lib64/libxml2.so.2 (0x00007f2883afa000)
libuuid.so.1 => /lib64/libuuid.so.1 (0x00007f2883af0000)
libicuuc.so.67 => /lib64/libicuuc.so.67 (0x00007f2883905000)
libicui18n.so.67 => /lib64/libicui18n.so.67 (0x00007f2883400000)
libicuio.so.67 => /lib64/libicuio.so.67 (0x00007f28838f5000)
libicudata.so.67 => /lib64/libicudata.so.67 (0x00007f2881800000)
libc.so.6 => /lib64/libc.so.6 (0x00007f2881400000)
libz.so.1 => /lib64/libz.so.1 (0x00007f28838db000)
liblzma.so.5 => /lib64/liblzma.so.5 (0x00007f28838ad000)
libm.so.6 => /lib64/libm.so.6 (0x00007f28837d2000)
/lib64/ld-linux-x86-64.so.2 (0x00007f2883ccf000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f2881000000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f28837b5000)
The libtool build embeds RUNPATH=<libdir> into everything it installs, so a default /usr/local install runs without loader configuration; the CMake install produced no RUNPATH, which fails on RHEL (no /usr/local path in ld.so.conf). Set CMAKE_INSTALL_RPATH the same way unless the libdir is a system directory, so packaging installs to /usr stay RUNPATH-free.
|
Done. CMAKE_INSTALL_RPATH is now set to the install libdir unless that is a system directory, matching the libtool build (which embeds RUNPATH= into everything it installs). Installs to /usr get no RUNPATH, so deb/rpm packaging is unaffected. Verified on Rocky 9: the stock install reproduces your ldd output; with the change ldd resolves /usr/local/lib64/libltfs.so.2 and ltfs --version runs. Note el9 uses /usr/local/lib64, not /usr/local/lib. |
madjesc
left a comment
There was a problem hiding this comment.
LGTM overall.
Could you add the build directory into .gitignore? Most people build into build directory using cmake -S . -B build. So its nice to have a default gitignore entry for this directory
|
Done, /build/ is now in .gitignore. |
Summary
Adds a CMake build (>= 3.18) that coexists with the autotools build, plus CI updates. Rebased onto the v2.4.8.4 release on
main; 4 commits:AC_INITto a top-levelVERSIONfile read by both build systems, so there is a single source of truth. It tracks the release version (2.4.8.4), and the autotoolsPACKAGE_VERSIONstring is unchanged.messages/make_message_src.shaccepts optional source/output directories and honors$GENRB/$PKGDATA, so an out-of-source build can call it; the one-argument form keeps the historical behavior andmessages/Makefile.amis unchanged.Scope
Linux is fully wired: libltfs, the
ltfs/mkltfs/ltfsckexecutables, the sg/file/itdtimg tape backends, both I/O schedulers, both key managers. macOS additionally builds the iokit tape backend. The FreeBSD/NetBSD backends are skipped with a notice and remain autotools-only. The build targets libfuse 2, matching autotools; the FUSE 3 selection follows as a small extension once #603 merges.The CMake build compiles as C11 (
gnu11, since LTFS uses_GNU_SOURCE/asprintf); a commented-outC17line is provided for when the minimum supported toolchain is GCC 8+/Clang 7+.Notable differences from the autotools implementation:
icu-configtool that ICU removed in 2018 (ICU6xis set automatically for ICU >= 60); libxml2 usesfind_package(LibXml2); fuse/uuid/net-snmp use pkg-config imported targets.CRC_OPTIMIZErule are replaced by direct source paths and one SSE4.2-flagged OBJECT library.ltfs.confexpects (libtape-sg.soetc.), installed to<libdir>/ltfs./usrget no RUNPATH.tests/t/*.shby glob via the shared harness, so the build works with or without the integration test suite (Add an integration test suite using the file tape backend #611) and picks up its tests automatically.Verification
Ubuntu VM: the CMake build and all 14 integration tests pass via ctest (with #611 merged alongside); the install tree matches autotools (bin, lib, plugins,
etc/ltfs.conf{,.local}, pkgconfig, man, headers);ltfs --versionreports the identical string; the autotools build andmake checkstay green. macOS 26 (arm64, macFUSE 5.2 SDK): the CMake build produces libltfs, the executables, and all plugins includinglibtape-iokit.so, as C11.Fixes #521.