Skip to content

Add a CMake build alongside autotools#606

Open
matejk wants to merge 4 commits into
LinearTapeFileSystem:mainfrom
matejk:feature/cmake-build
Open

Add a CMake build alongside autotools#606
matejk wants to merge 4 commits into
LinearTapeFileSystem:mainfrom
matejk:feature/cmake-build

Conversation

@matejk

@matejk matejk commented Jun 12, 2026

Copy link
Copy Markdown

Summary

Adds a CMake build (>= 3.18) that coexists with the autotools build, plus CI updates. 4 commits based directly on main:

  • VERSION file: the package version moves from AC_INIT to a top-level VERSION file read by both build systems, so there is a single source of truth. The resulting PACKAGE_VERSION string is unchanged.
  • Reusable message-compile script: messages/make_message_src.sh accepts 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 and messages/Makefile.am is unchanged.
  • CI: deprecated GitHub Actions versions updated; a new workflow configures, builds, and runs ctest.
  • The CMake build itself.

Scope

Linux is fully wired: libltfs, the ltfs/mkltfs/ltfsck executables, 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.

Notable differences from the autotools implementation:

  • ICU is found through CMake's ICU module instead of the icu-config tool that ICU removed in 2018 (ICU6x is set automatically for ICU >= 60); libxml2 uses find_package(LibXml2); fuse/uuid/net-snmp use pkg-config imported targets.
  • The per-backend source symlinks and the CRC_OPTIMIZE rule are replaced by direct source paths and one SSE4.2-flagged OBJECT library.
  • Plugins are MODULE libraries named exactly as ltfs.conf expects (libtape-sg.so etc.), installed to <libdir>/ltfs.
  • ctest registers tests/t/*.sh by 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 --version reports the identical string; the autotools build and make check stay green. macOS 26 (arm64, macFUSE SDK): the build produces libltfs, the executables, and all plugins including libtape-iokit.so.

Fixes #521.

matejk added 4 commits June 12, 2026 12:31
The version string lived only in configure.ac's AC_INIT. Move it to a
neutral VERSION file (line 1: numeric X.Y.Z.W, line 2: optional suffix)
so a second build system can read the same source. AC_INIT now joins
the two lines via m4_esyscmd_s; the resulting PACKAGE_VERSION is
unchanged ("2.4.8.4 (Prelim)").
…stem

make_message_src.sh hardcoded the genrb/pkgdata paths per-OS and
assumed the in-source messages/ layout (cd into the bundle dir, write
the archive to ../../). Honor $GENRB/$PKGDATA from the environment
when set, and accept optional source-bundle and output directories so
an out-of-source build can call the same script. The one-argument form
keeps the historical behavior, so messages/Makefile.am is unchanged.
actions/checkout v4 runs on Node.js 20, which GitHub deprecates in
June 2026; move to v6. codeql-action moves to v4 and
create-pull-request to v8 for the same reason.
CMake >= 3.18, coexisting with the autotools build; both read the
package version from the shared VERSION file. Linux is fully wired
(libltfs, the ltfs/mkltfs/ltfsck executables, the sg/file/itdtimg tape
backends, both I/O schedulers, both key managers); macOS builds the
iokit tape backend; the FreeBSD/NetBSD backends are skipped with a
notice and remain autotools-only. The build targets libfuse 2, like
autotools; the FUSE 3 selection arrives with the FUSE 3 port.

Notable differences from the autotools implementation:
- ICU is found through CMake's ICU module instead of the icu-config
  tool that ICU removed in 2018, and ICU6x is defined automatically
  for ICU >= 60. libxml2 uses find_package(LibXml2); fuse/uuid/
  net-snmp have no CMake packages and use pkg-config imported targets.
- config.h is generated from cmake/config.h.in, covering the subset
  of macros the sources use; feature toggles are passed on the
  command line, as in the autotools build.
- The message bundles are compiled by the same shared
  messages/make_message_src.sh, invoked with explicit source/output
  directories and the discovered genrb/pkgdata.
- The per-backend source symlinks and the CRC_OPTIMIZE compile rule
  are replaced by direct source paths and one SSE4.2-flagged OBJECT
  library linked into every tape backend.
- Plugins are MODULE libraries named exactly as ltfs.conf expects
  (libtape-sg.so etc.), installed to <libdir>/ltfs.
- ctest registers tests/t/*.sh by glob via the shared harness
  (SKIP_RETURN_CODE 77 outside Linux/fuse hosts), so the build works
  with or without the integration test suite.

A CI workflow configures, builds, and runs ctest on ubuntu.

Verified in an Ubuntu VM: the build and all 14 tests pass via ctest
with the test suite present; the install tree matches autotools (bin,
lib, lib/ltfs plugins, etc/ltfs.conf{,.local}, pkgconfig, man,
headers); ltfs --version reports the identical version string; the
autotools build and make check stay green. On macOS 26 (arm64,
macFUSE SDK) the CMake build produces libltfs, the executables, and
all plugins including libtape-iokit.so.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add cmake support

1 participant