Zig build system updated: can compile static binaries.

This commit is contained in:
Philippe Pittoli 2023-02-09 16:27:02 +01:00
parent 0585110df4
commit b567a25969
3 changed files with 12 additions and 1 deletions

View File

@ -1,6 +1,7 @@
ifdef STATIC
STATIC_BUILD ?= -static
CRYSTAL_STATIC_BUILD ?= --static
ZIG_STATIC_BUILD ?= -Dstatic=true
endif
# For interactive completion in the shell.

View File

@ -58,4 +58,12 @@ pub fn build(b: *std.Build) void {
.optimize = optimize,
});
link_and_install(pongd_exe);
const is_static = b.option(bool, "static", "Compile static binaries.") orelse false;
if (is_static) {
ipcd_exe.linkage = .static;
tcpd_exe.linkage = .static;
pong_exe.linkage = .static;
pongd_exe.linkage = .static;
}
}

View File

@ -1,9 +1,11 @@
all: build
include ../mk/makefile.utils
update-libipc:
git submodule update
ZIG_OPTS ?=
ZIG_OPTIM ?= ReleaseSafe
build:
zig build -Doptimize=$(ZIG_OPTIM) $(ZIG_OPTS)
zig build -Doptimize=$(ZIG_OPTIM) $(ZIG_OPTS) $(ZIG_STATIC_BUILD)