44.5. lua54-luaexpat-1.5.2
Expat XML parser binding for Lua 5.4 — Prosody reads XMPP stanzas with it
| Version | 1.5.2, release 1 |
| Shelf | lang — Language implementations, plus the modules of any language that has no module shelf of its own |
| Phase | 30_foundation (Build Foundation), 108 of 127 in build order |
| Licence | MIT |
| Homepage | https://github.com/lunarmodules/luaexpat |
| Build time | 0.1 SBU |
| Installed size | 64.5 KiB in 5 files |
| Recipe | ports/core/lang/lua54-luaexpat/kpkgbuild |
About
LuaExpat is the expat XML parser for Lua: its lxp module calls Lua functions for each element as the parser reads, and lxp.lom and lxp.totable build tables from a document. This port builds it for lua54 alone. XMPP is XML on the wire, and prosody parses every stream through it; Prosody’s dependency check counts a missing lxp as fatal, and the server does not start without it.
Every variable the recipe passes on the make command line is also the makefile’s own default in this release; naming them keeps the build from following a change of default.
Why it is in KDOS
The comment above the 4 ports from lua54-luasocket to lua54-luafilesystem in script/phases/30_foundation/packages.txt:
The four modules Prosody will not start without: a transport, TLS over it, an XML parser (XMPP is XML on the wire) and stat/mkdir/readdir.
Sources
lua54-luaexpat-1.5.2.tar.gz(52.8 KiB)
sha25689d83f2141edec31be576425637216928221918fe95dc3854d1b7fd4c627213f
upstream: https://github.com/lunarmodules/luaexpat/archive/refs/tags/1.5.2.tar.gz
archive copy: sources-3/lang--lua54-luaexpat-1.5.2.tar.gz
Dependencies
Required by (1): prosody.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/30_foundation/phase.env && kpkg install lua54-luaexpat'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/lang/lua54-luaexpat.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/lang/lua54-luaexpat
echo '89d83f2141edec31be576425637216928221918fe95dc3854d1b7fd4c627213f lua54-luaexpat-1.5.2.tar.gz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/lua54-luaexpat
SRC=$SRC_ROOT/lua54-luaexpat-1.5.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf lua54-luaexpat-1.5.2.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the recipe’s helpers _lv and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
export CFLAGS="$CFLAGS -g0"
make LUA_V=$_lv \
LUA_INC="-I/usr/include/lua$_lv" \
EXPAT_INC="-I/usr/include" \
LUA_LDIR=/usr/share/lua/$_lv \
LUA_CDIR=/usr/lib/lua/$_lv
make DESTDIR=$PKG LUA_V=$_lv \
LUA_LDIR=/usr/share/lua/$_lv \
LUA_CDIR=/usr/lib/lua/$_lv install
The switches, and why each is set:
CFLAGS="$CFLAGS -g0"— The makefile’s own flags put-gbefore$(CFLAGS);-g0, last on the line, turns the debugging information back off.LUA_V=$_lv— The Lua series,5.4. It is passed, like every path, on themakecommand line, where it beats the makefile’s?=default.LUA_INC="-I/usr/include/lua$_lv"— The Lua header directory, with its own-I. The makefile pastes this variable straight into the compile line, so a bare path there would be read by the compiler as a source file.EXPAT_INC="-I/usr/include"— expat’s header directory, under the same rule.LUA_LDIR=/usr/share/lua/$_lv— Where the Lua parts,lxp/lom.lua,lxp/totable.luaandlxp/threat.lua, go. It is passed to the install step as well.LUA_CDIR=/usr/lib/lua/$_lv— Wherelxp.sogoes.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/lua54-luaexpat, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf lua54-luaexpat-1.5.2-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/lua54-luaexpat, and runs the triggers its paths call for.
Contents
Installed directories: /usr/share/licenses/lua54-luaexpat, /usr/share/lua/5.4/lxp.