44.4. lua54-luasec-1.3.2
TLS for LuaSocket on Lua 5.4 — Prosody encrypts its connections with it
| Version | 1.3.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), 107 of 127 in build order |
| Licence | MIT |
| Homepage | https://github.com/lunarmodules/luasec |
| Build time | 0.1 SBU |
| Installed size | 112.6 KiB in 4 files |
| Recipe | ports/core/lang/lua54-luasec/kpkgbuild |
About
LuaSec is the TLS layer for LuaSocket, built on openssl: it wraps a socket in an encrypted connection and adds ssl.https. This port builds it for lua54 alone, for prosody, whose TLS it provides. Prosody starts without LuaSec and reports it as a missing dependency, but by default it requires an encrypted stream before a client may authenticate (its c2s_require_encryption option), so without LuaSec no client can log in.
LuaSec has no configure step, and its makefile defaults to Lua 5.1’s module directories, so the recipe passes every path on the make command line, where it beats the makefile’s own ?= defaults.
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-luasec-1.3.2.tar.gz(53.6 KiB)
sha25697293092ba385ab390decb6678bc8cbeffd5899bfbc49eb7ef4aa00f5e31c3d4
upstream: https://github.com/lunarmodules/luasec/archive/refs/tags/v1.3.2.tar.gz
archive copy: sources-3/lang--lua54-luasec-1.3.2.tar.gz
Dependencies
Depends on: lua54, lua54-luasocket, openssl.
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-luasec'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/lang/lua54-luasec.
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-luasec
echo '97293092ba385ab390decb6678bc8cbeffd5899bfbc49eb7ef4aa00f5e31c3d4 lua54-luasec-1.3.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-luasec
SRC=$SRC_ROOT/lua54-luasec-1.3.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf lua54-luasec-1.3.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:
make linux LUA_VERSION=$_lv \
INC_PATH="-I/usr/include/lua$_lv" \
LUAPATH=/usr/share/lua/$_lv \
LUACPATH=/usr/lib/lua/$_lv
make install DESTDIR=$PKG \
LUAPATH=/usr/share/lua/$_lv \
LUACPATH=/usr/lib/lua/$_lv
The switches, and why each is set:
linux— Builds with upstream’s Linux compile and link flags. The baremakebuilds nothing and prints the list of platforms.LUA_VERSION=$_lv— Read by none of LuaSec’s makefiles; it changes nothing in the build. What ties the build to 5.4 is the include path and the two install directories.INC_PATH="-I/usr/include/lua$_lv"— The header directory, with its-I, in place of upstream’s-I/usr/include. The lua port’s headers are in/usr/include, so the default would compile a 5.4 module against the newer series’lua.h.LUAPATH=/usr/share/lua/$_lv— Wheressl.luaandssl/https.luago, in place of upstream’s/usr/share/lua/5.1. It is passed to the install step as well.LUACPATH=/usr/lib/lua/$_lv— Wheressl.sogoes, in place of/usr/lib/lua/5.1.
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-luasec, 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-luasec-1.3.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-luasec, and runs the triggers its paths call for.
Contents
Installed directories: /usr/share/licenses/lua54-luasec, /usr/share/lua/5.4/ssl.
Notes
LuaSec compiles its own private copy of a few LuaSocket C files into ssl.so and links that, not the installed LuaSocket. The dependency on lua54-luasocket is for run time: ssl.https and Prosody load the socket module it wraps.
The tree’s CFLAGS and LDFLAGS reach the build from the environment, because LuaSec’s makefile adds its own flags to them with += rather than assigning them.