Skip to content

Readers, Lua build and release path - #43

Merged
HaoZeke merged 27 commits into
developfrom
docs/readers-lua-r7
Nov 21, 2026
Merged

HaoZeke merged 27 commits into
developfrom
docs/readers-lua-r7

Conversation

@HaoZeke

@HaoZeke HaoZeke commented Nov 19, 2026

Copy link
Copy Markdown
Member

Replaces #42 with a rebased series on current main.

  • The Lua build queries chemfiles and readcon-core, and CI builds and tests with both.
  • The readers follow the seams-core reader macros.
  • The release path mirrors rgpot: meson.build holds the version, cog bump writes it with meson rewrite, regenerates the version copies with cogapp and builds the changelog with towncrier.
  • The software author list and the Lua reference text match the base.

Detect chemfiles and readcon-core with Meson feature options, define
SEAMS_HAS_CHEMFILES and SEAMS_HAS_READCON when they are found, and
expose has_chemfiles and has_readcon to Lua and Fennel. Tests read a
.con, a PDB, and a GRO file and skip only when the matching query is
false.
Install chemfiles 0.10.4 and readcon-core v0.14.10, require both
readers at configure time, assert the feature queries, and run the
test suite.
Add the Org developer guide for tests, the FAQ, and the cocogitto
plus towncrier release onto LuaRocks. List the binding's analyses in
the rockspec and Nix metadata, and record Ruhila Goswami's ORCID with
the software authors.
has_chemfiles and has_readcon report the chemfiles_dep and
readcon_dep results from the seams-core subproject. A dependency
lookup in this project is not used, so a missing system library
does not hide the readcon-core wrap fallback.
The job still installs readcon-core v0.14.10, the revision in the
current seams-core wrap. A later wrap has to follow seams-core's
floor, which is >=0.16.2 in seams-core v2.14.1.
The pre-bump hook is cogapp over ci/version/files.txt. The version
field in meson.build is the source of those copies.
Ruhila Goswami was not a software author on the base revision, so
the added entry is removed. Amrita Goswami's entry is unchanged.
meson rewrite sets the project() version before cogapp copies it.
The version module reads that keyword with meson introspect.
The has_chemfiles and has_readcon notes are outside the release fix.
@HaoZeke
HaoZeke changed the base branch from main to develop November 20, 2026 03:32
The rockspec ran DESTDIR=$(PREFIX) meson install, which put every
file under the rock directory's usr/local tree instead of the
LuaRocks module paths. require("dseams") failed after luarocks make.
The install command copies dseams.lua, yoda.lua, and the Fennel
sources to $(LUADIR) and dseams_core.so to $(LIBDIR). CI installs
the rock into a local tree and requires it from a fresh interpreter.

Meson tried lua5.4 before lua5.3, and the header search did the same
under /usr/include. A LuaRocks build for 5.3, with both pkg-config
files visible, compiled against 5.4 and installed that module under
lib/lua/5.3. The rockspec asks $(LUA), the interpreter LuaRocks
selected, for its version and passes that to -Dlua_version. That
option accepts only the requested version, and the lua.h copied into
the build is taken from the same version. LuaRocks 3.8 does not
define $(LUA_VERSION), so the interpreter is the source that works
on that release and on later ones.

The rock ships dseams.fnl and yoda.fnl. They are loaded with
fennel.dofile, and the docs say not to compile dseams.fnl as the
dseams module. Meson install ships the vendored fennel.lua for that
dofile. The rock did not, and it did not depend on fennel, so a
LuaRocks install could not load the .fnl files. Compiling them
during the build would replace that dofile path with a second Lua
module. The rock depends on fennel 1.5.3, the compiler already
vendored for the CLI.

readChemfiles and readCon were declared in lua_api.hpp whenever
SEAMS_HAS_* was set. lua_api.cpp defines them only when that macro
is set and DSEAMS_DISABLE_* is not. A build with the reader disabled
declared a function it did not define. The header now uses the same
condition as the definition.

Edit links were built from GITHUB_HEAD_REF. A pull request from a
fork has a head branch that does not exist in d-SEAMS/yodaStruct, so
those links 404. Pull-request builds use GITHUB_SHA, which names a
commit in the base repository. Push builds publish the site for a
branch. A blob URL pinned to a commit does not open GitHub's editor,
so a push uses GITHUB_REF_NAME, which is main or develop.

The build, docs, and Nix workflows run for develop as well as main.
The readers job installs cargo-c 0.10.26 and caches cargo-capi,
cargo-cbuild, cargo-cinstall, and cargo-ctest, plus the crate
metadata cargo uses to remember an install. cargo install does not
produce a binary named cargo-c, so a cache of that path restored
nothing and the job compiled cargo-c every time. The cache key is
the cargo-c version: an unrelated workflow edit keeps the binaries,
and a version bump does not reuse them.

The developer guide wrote .con with Markdown backticks in Org. That
is Org verbatim markup now, and the RST export was regenerated.
meson.build picked the test interpreter with a fixed search for
lua5.4, lua-5.4, lua5.3, then lua, whatever lua_version said. With
Lua 5.3 and 5.4 both installed, -Dlua_version=5.3 linked liblua5.3
and then ran every test under lua5.4, and all 11 tests died with
SIGSEGV.

The interpreter now follows the Lua dependency Meson resolved. The
ABI is the major.minor of lua_dep's version, and configure stops if
that disagrees with an explicit lua_version. The candidates are
lua<abi>, lua-<abi>, then lua. Each one found is run to print its
_VERSION, and only a candidate that reports the linked ABI is used,
because lua and the versioned names can be links to another release.
Candidates that report another version are named in the configure
output, and the summary shows the linked ABI and the chosen
interpreter.

A new lua_abi_match test runs example_lua/library/abi_match.lua with
the linked ABI as its argument. The script fails when the interpreter
reports another version, and checks this before it requires
dseams_core, because loading the module into the other Lua crashes
inside liblua before an error can be raised. After the require it
reads /proc/self/maps where that exists and fails if a shared liblua
of another version is mapped. If only interpreters of the wrong
version are on PATH, lua_abi_match is still registered with the first
of them, so meson test fails with a message instead of losing its Lua
tests. With no Lua interpreter at all the tests are absent, as before.
The build_test job installs only conda's Lua 5.4, so nothing in CI
configures -Dlua_version=5.3, and nothing runs where a second Lua
could be picked by mistake.

The new lua_abi job runs on Ubuntu 24.04 with the apt packages for
Lua 5.3 and 5.4 installed together. Each matrix entry configures
with -Dlua_version set to its version, builds, and checks that
readelf lists that version's liblua as NEEDED by dseams_core.so. It
then runs meson test and checks that the test log holds the
lua_abi_match line naming the same version for the interpreter and
the linked library. A build or test run that mixes the two versions
fails the job.
The rockspec required fennel == 1.5.3. LuaRocks already publishes
fennel 1.6.0 and 1.6.1, so installing dseams into a tree that held
fennel 1.6.1 built 1.5.3, removed 1.6.1, and broke any other rock in
that tree that needs fennel 1.6.

The dependency is now fennel >= 1.5.3, < 2.0. The lower bound is the
compiler vendored for the CLI, and it also keeps LuaRocks away from
the 1.5.0 and 1.5.1 rockspecs, which point at a git:// URL that no
longer serves. dseams.fnl and yoda.fnl only use local, fn, and table
literals, and with fennel 1.5.3 and with 1.6.1 both files load through
fennel.dofile on Lua 5.3 and 5.4 and read an XYZ file through the
wrapped read. A tree that already has either version keeps it.
conda-forge publishes luarocks 3.13.0 only for Lua 5.1, Lua 5.5, and
LuaJIT. With lua=5.4 in the environment, an unpinned luarocks resolves
to the LuaJIT build on linux-64 and osx-arm64 alike. LuaJIT refuses a
chunk with more than 65536 constants, so every luarocks.org manifest
fails to load and `luarocks make rockspec` cannot satisfy
fennel >= 1.5.3, < 2.0.

Pin luarocks 3.12.2, the newest Lua 5.4 build on both platforms, and
check that LuaRocks runs under Lua 5.4 rather than LuaJIT. After
`luarocks make`, require that fennel is a 1.x rock in the local tree
and that require("fennel") loads it from that tree with a version in
the rockspec range.
readers.lua exited 77 for con, PDB, and GRO when the feature query was
false, and dseams_read_dcd was registered only with chemfiles. A build
that lost a reader therefore passed with skips, and builds without the
readers never exercised the missing-reader path.

Meson now registers all four reader tests and passes "on" or "off"
from lua_has_readcon and lua_has_chemfiles. With "on", has_chemfiles /
has_readcon and the Fennel has-chemfiles / has-readcon must be true and
the fixture is read and checked as before. With "off", both queries
must be false, the compiled read must be unbound, and read from Lua and
from dseams.fnl must raise the missing-reader error.

CI requires no skipped tests. build_test requires all four readers to
report missing, the readers job requires a real read of all four
fixtures, and its disabled build now runs the reader suite and requires
all four to report missing.
The release page documents the cocogitto version bump and tag, which
run on main (cog.toml whitelists main and master) and are not part of
this change to develop. Drop release.org and its generated RST, the
developer guide's link, toctree entry, and bump dry-run row, and the
FAQ's link to it.
The rockspec is new in this change and had no towncrier fragment.
Record what `luarocks make rockspec` builds and installs and the fennel
range it depends on.
The reader test paragraph wrapped so that "10." began a line. Org read
that as an ordered list item, so the RST and HTML lost the third box
length and split the paragraph around a one-item list. Reflow the lines
so "10, 10, 10." stays together and no line starts with a number and a
period, and re-export the RST.
Meson 1.12 omits the Skipped summary line when nothing skipped, but
Meson 1.3.2 from Ubuntu 24.04 writes "Skipped: 0". Counting Skipped
lines therefore worked only on the conda-forge Meson and would fail a
clean run under apt Meson. Fail only when the Skipped count starts with
a nonzero digit, and run the same check in the lua_abi job, which uses
apt Meson.
@HaoZeke
HaoZeke force-pushed the docs/readers-lua-r7 branch from ec4188e to 21260ca Compare November 21, 2026 21:13
@HaoZeke
HaoZeke merged commit 1bfec4a into develop Nov 21, 2026
12 of 14 checks passed
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.

1 participant