download patch
commit e91c88fd0922bc59424a7449124412d565bde087
Author: tri <tri@thac.loan>
Date: Sun Oct 12 14:47:52 2025 +0700
add option to dynamically link lua
diff --git a/Makefile b/Makefile
index 87612c5..bc33da5 100644
--- a/Makefile
+++ b/Makefile
+ZIGARGS = -Doptimize=ReleaseSafe -Dcpu=baseline -fsys=lua
+
build:
- zig build -Doptimize=ReleaseSafe
+ zig build $(ZIGARGS)
watch:
zig build run --watch -- sample
diff --git a/build.zig b/build.zig
index c909164..250e7de 100644
--- a/build.zig
+++ b/build.zig
pub fn build(b: *std.Build) void {
b.installArtifact(exe);
+ const use_system_lua = b.systemIntegrationOption("lua", .{});
+
const lua_dep = b.dependency("zlua", .{
.target = target,
.optimize = optimize,
+ .shared = use_system_lua,
});
+ if (use_system_lua) {
+ exe.linkSystemLibrary("lua");
+ }
exe.root_module.addImport("zlua", lua_dep.module("zlua"));
const run_step = b.step("run", "Run the app");
diff --git a/readme.md b/readme.md
index 6dd9cca..63cb63e 100644
--- a/readme.md
+++ b/readme.md
loa
loa .
````
+## Build
+
+Loa targets zig 0.15.1 and by default has no runtime dependency except for libc. You can optionally dynamically link lua 5.4 with `-fsys=lua`.
+
+```sh
+# either command works:
+zig build -Doptimize=ReleaseSafe
+zig build -Doptimize=ReleaseSafe -fsys=lua
+```
+
+If you're curious, lua is used for running [djot.lua][1], which is vendored in src/vendor/djot.lua.
+
## License
Copyright © 2025 tri@thac.loan
This program is free software: you can redistribute it and/or modify it under th
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program (agpl-3.0.txt). If not, see <https://www.gnu.org/licenses/>.
+
+[1]: https://github.com/jgm/djot.lua