add: zig and build.sh

build systems
This commit is contained in:
2026-08-23 16:48:51 -04:00
parent 4c701854f9
commit 0b3ebd0f7a
7 changed files with 84 additions and 6 deletions
+11 -1
View File
@@ -3,7 +3,7 @@
-- Handles the full build pipeline for a recipe:
-- 1. fetch_source — download to cache (or detect git)
-- 2. extract_source — unpack tarball or clone git repo
-- 3. run_build — dispatch autotools/cmake/meson/make/cargo/custom
-- 3. run_build — dispatch autotools/cmake/meson/make/cargo/zig/build.sh/custom
-- 4. run_test — execute post-build verification command
--
-- All subprocesses run in a minimal environment. Build tools (meson, cmake,
@@ -298,6 +298,16 @@ function builder.run_build(recipe, source_dir, stage_dir, opts)
end
run("install -D " .. path.quote(target) .. " " .. path.quote(path.join(bin_dir, path.basename(target))))
elseif bs == "zig" then
run("zig build -Doptimize=ReleaseSafe" .. args_str)
run("zig build install --prefix /usr -Ddestdir=" .. path.quote(stage_dir))
elseif bs == "build.sh" then
if not path.exists(path.join(source_dir, "build.sh")) then
error(("no build.sh script found in %s (build_system is 'build.sh')"):format(source_dir), 0)
end
run("DESTDIR=" .. path.quote(stage_dir) .. " sh build.sh")
elseif bs == "custom" then
local script = recipe.build_script
run("DESTDIR=" .. path.quote(stage_dir) .. " sh " .. path.quote(script))
+3 -2
View File
@@ -11,7 +11,7 @@
-- url = "https://.../mypkg-1.2.3.tar.gz",
-- sha256 = nil, -- optional source checksum
-- deps = { "libfoo" },
-- build_system = "meson", -- autotools | cmake | meson | make | cargo | custom
-- build_system = "meson", -- autotools | cmake | meson | make | cargo | zig | build.sh | custom
-- configure_args = { ... }, -- optional extra args
-- build_script = "build.sh", -- required for custom
-- test = "test -f ${DESTDIR}/usr/bin/mypkg",
@@ -31,7 +31,8 @@ local KNOWN_KEYS = {
local BUILD_SYSTEMS = {
autotools = true, cmake = true, meson = true,
make = true, cargo = true, custom = true,
make = true, cargo = true, zig = true,
["build.sh"] = true, custom = true,
}
local HEX64 = "^" .. string.rep("%x", 64) .. "$"