diff --git a/.builds/linux-amd64.yml b/.builds/linux-amd64.yml index 3d36253..4c15128 100644 --- a/.builds/linux-amd64.yml +++ b/.builds/linux-amd64.yml @@ -6,6 +6,8 @@ packages: - curl-dev environment: version: zig-linux-x86_64-0.9.0-dev.689+507dc1f2e +artifacts: + - derploader/zig-out/bin/derploader tasks: - getzig: | wget https://ziglang.org/builds/${version}.tar.xz @@ -25,7 +27,8 @@ tasks: - build: | cd derploader source source-me.sh - $zig build + $zig build -Drelease-small=true -Dtarget=x86_64-linux-gnu -Dcpu=sandybridge -Dstrip=true -Dstatic=true + strip -s zig-out/bin/derploader triggers: - action: email condition: failure diff --git a/build.zig b/build.zig index b214631..cff9bdb 100644 --- a/build.zig +++ b/build.zig @@ -18,8 +18,16 @@ pub fn build(b: *std.build.Builder) void { // Standard release options allow the person running `zig build` to select // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. const mode = b.standardReleaseOptions(); + const strip = b.option(bool, "strip", "strip executable"); + const static = b.option(bool, "static", "compile a static executable"); const exe = b.addExecutable("derploader", "src/main.zig"); + if (strip != null) { + exe.strip = strip.?; + } + if (static != null and static.? == true) { + exe.linkage = .static; + } deps.addAllTo(exe); exe.linkLibC(); exe.linkSystemLibrary("libcurl");