Skip to main content

Module rockspec

Module rockspec 

Source
Expand description

In-tree LuaRocks rockspec support (git-only).

A rock is consumed the way luarocks make consumes it: the package is already checked out (here: cloned by GitFetcher) and the rockspec shipped inside the repository describes where the Lua modules live. No luarocks.org access, no luarocks binary, no HTTP.

What is read from the rockspec:

fielduse
package / versionsynthesized author manifest (version minus the -N rockspec revision)
build.typeonly builtin (or absent) and none are considered
build.modulesmodule name → file map, folded into one entry directory

§Discovery (same rule as luarocks make)

<root>/*.rockspec, then <root>/rockspec/*.rockspec, then <root>/rockspecs/*.rockspec. When several exist, the one whose version matches the resolved tag wins, then the highest release version, and scm / dev rockspecs come last.

§Entry folding

build.modules = { ["foo"] = "lua/foo/init.lua", ["foo.bar"] = "lua/foo/bar.lua" } folds to entry lua because every path equals <entry>/<module with '.' → '/'>.lua (or /init.lua). The rockspec is a hint: when the map contains non-Lua modules (C sources), is empty, or cannot be expressed as a single directory, no entry is derived and the usual fallback chain (src/lua/ → root) applies.

§Evaluation

A rockspec is a Lua file that assigns globals. It is run in a fresh Lua state with no standard library, a memory cap and an instruction cap, so a hostile rockspec cannot do more than fill a table.

Structs§

Rockspec
The subset of a rockspec that mlua-pkg acts on.

Functions§

find_in_tree
Locate the rockspec to use for a checkout at root.