Skip to content

Commit a79287d

Browse files
committed
feat: add lua 5.4.7 (C library)
Pure-C scripting library; relies on mcpp's C compile rule. Form B descriptor enumerates the 32 library translation units (CORE_O + LIB_O from upstream's src/Makefile) into a single `liblua.a` static archive. The two binary entry points (src/lua.c interpreter, src/luac.c bytecode compiler) are intentionally excluded — both define `int main()` and aren't part of the embeddable library. Tarball: https://www.lua.org/ftp/lua-5.4.7.tar.gz SHA256: 9fbf5e28ef86c69858f6d3d34eccc32e911c1a28b4120ff3e84aaa70cfbf1e30 Verified end-to-end with a small consumer that calls lua_State / luaL_openlibs / luaL_dostring("return 1+2") — outputs "3", links clean against liblua.a, no main() collision.
1 parent 160c504 commit a79287d

1 file changed

Lines changed: 86 additions & 0 deletions

File tree

pkgs/l/lua.lua

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
-- M6.x glob-aware Form B descriptor for Lua 5.4.
2+
--
3+
-- Pure-C library; relies on mcpp 0.0.2's C-language compile rule (`.c`
4+
-- routed to `c_object` via the gcc/clang sibling driver). Builds the
5+
-- 32 library translation units (CORE_O + LIB_O from upstream's
6+
-- src/Makefile) into a single static archive `liblua.a`. The two
7+
-- binary entry points (`src/lua.c` for the interpreter and
8+
-- `src/luac.c` for the bytecode compiler) are intentionally excluded —
9+
-- both define `int main()` and aren't part of the embeddable library.
10+
-- Consumers `#include <lua.h>` and link against liblua.a.
11+
12+
package = {
13+
spec = "1",
14+
name = "lua",
15+
description = "A powerful, efficient, lightweight, embeddable scripting language",
16+
licenses = {"MIT"},
17+
repo = "https://www.lua.org",
18+
type = "package",
19+
20+
xpm = {
21+
linux = {
22+
["5.4.7"] = {
23+
url = "https://www.lua.org/ftp/lua-5.4.7.tar.gz",
24+
sha256 = "9fbf5e28ef86c69858f6d3d34eccc32e911c1a28b4120ff3e84aaa70cfbf1e30",
25+
},
26+
},
27+
macosx = {
28+
["5.4.7"] = {
29+
url = "https://www.lua.org/ftp/lua-5.4.7.tar.gz",
30+
sha256 = "9fbf5e28ef86c69858f6d3d34eccc32e911c1a28b4120ff3e84aaa70cfbf1e30",
31+
},
32+
},
33+
windows = {
34+
["5.4.7"] = {
35+
url = "https://www.lua.org/ftp/lua-5.4.7.tar.gz",
36+
sha256 = "9fbf5e28ef86c69858f6d3d34eccc32e911c1a28b4120ff3e84aaa70cfbf1e30",
37+
},
38+
},
39+
},
40+
41+
-- Form B `mcpp` segment: paths are globs relative to the verdir
42+
-- (~/.mcpp/registry/data/xpkgs/<idx>-x-lua/<ver>/). The leading
43+
-- `*/` absorbs the upstream tarball's `lua-5.4.7/` wrap layer.
44+
mcpp = {
45+
language = "c++23", -- top-level [package].standard knob; mcpp drives a c++23 toolchain even for pure-C deps.
46+
import_std = false, -- pure C — no `import std;`.
47+
c_standard = "c99", -- Lua's reference build is c99-clean; matches upstream src/Makefile.
48+
include_dirs = { "*/src" }, -- public headers (lua.h, lualib.h, lauxlib.h, luaconf.h) live next to .c files.
49+
sources = {
50+
"*/src/lapi.c",
51+
"*/src/lauxlib.c",
52+
"*/src/lbaselib.c",
53+
"*/src/lcode.c",
54+
"*/src/lcorolib.c",
55+
"*/src/lctype.c",
56+
"*/src/ldblib.c",
57+
"*/src/ldebug.c",
58+
"*/src/ldo.c",
59+
"*/src/ldump.c",
60+
"*/src/lfunc.c",
61+
"*/src/lgc.c",
62+
"*/src/linit.c",
63+
"*/src/liolib.c",
64+
"*/src/llex.c",
65+
"*/src/lmathlib.c",
66+
"*/src/lmem.c",
67+
"*/src/loadlib.c",
68+
"*/src/lobject.c",
69+
"*/src/lopcodes.c",
70+
"*/src/loslib.c",
71+
"*/src/lparser.c",
72+
"*/src/lstate.c",
73+
"*/src/lstring.c",
74+
"*/src/lstrlib.c",
75+
"*/src/ltable.c",
76+
"*/src/ltablib.c",
77+
"*/src/ltm.c",
78+
"*/src/lundump.c",
79+
"*/src/lutf8lib.c",
80+
"*/src/lvm.c",
81+
"*/src/lzio.c",
82+
},
83+
targets = { ["lua"] = { kind = "lib" } },
84+
deps = { },
85+
},
86+
}

0 commit comments

Comments
 (0)