User:Alerque/Lua package guidelines
Category:Arch package guidelines
32-bit – CLR – CMake – Cross – DKMS – Eclipse – Electron – Font – Free Pascal – GNOME – Go – Haskell – Java – KDE – Kernel – Lisp – Meson – MinGW – Node.js – Nonfree – OCaml – Perl – PHP – Python – R – Ruby – Rust – Shell – VCS – Web – Wine
This document covers standards and guidelines on writing PKGBUILDs for Lua software.
Package naming
All packages should be prefixed with lua- (or lua51-, lua52- as appropriate, see #Lua version).
Where possible, drop occurrences of "lua" in the upstream project name. For example Cassowary.lua should be packaged as lua-cassowaryAUR, and luafilesystem is lua-filesystem.
Lua version
Most Lua packages are compatible with multiple versions of Lua. Packages should always be generated for all versions of Lua that they are compatible with.
Architecture
See PKGBUILD#arch.
Lua modules may or may not be architecture-dependent. Lua modules containing only Lua code (often referred to as "pure") any usually architecture-independent. On the other hand many modules include libraries built from C code and must be tagged with the architecture. Mixed modules (with both *.lua and *.so contents) also need tagging.
Source
Many (but not all) Lua modules are available from LuaRocks and can be installed via luarocks. Most packages there are only meta data specifications and the actual source files are hosted elsewhere. Examining the source field in the *.rockspec file usually reveals the source.
Installation methods
make
Some packages include a Makefile and sometimes even GNU Autoconf tooling. These may be configured, built, and installed much like other C packages.
luarocks
Luarocks may be used to facilitate build and packaging, but...
- Use upstream sources (preferred) or source rocks, not rockspecs.
- Use `make` not `install
- Remove pkgdir/srcdir references in `/usr/bin` scripts
- Don't build manifests
- Don't allow any bundled dependencies
luarocks --lua-version="$1" --tree="$pkgdir/usr/" make --deps-mode=none --no-manifest "$_rockname-scm-$_rockrel.rockspec" find "$pkgdir/usr/bin" -type f -execdir sed -i -e "s#$pkgdir##" {} \;
manual copy
Some packages contain only Lua file(s) that requires no build or configuration steps. These may be manually copied to the correct location.
install -Dm644 module.lua -t "$pkgdir/usr/share/lua/$lua_version/"