Emil Lerch
88632df671
My PR is still open, so it will be 0.9.0 at least before we get static build.zig support
61 lines
2.3 KiB
Zig
61 lines
2.3 KiB
Zig
// const std = @import("std");
|
|
const Builder = @import("std").build.Builder;
|
|
|
|
pub fn build(b: *Builder) void {
|
|
// Standard target options allows the person running `zig build` to choose
|
|
// what target to build for. Here we do not override the defaults, which
|
|
// means any target is allowed, and the default is native. Other options
|
|
// for restricting supported target set are available.
|
|
const target = b.standardTargetOptions(.{});
|
|
|
|
// Standard release options allow the person running `zig build` to select
|
|
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
|
|
const mode = b.standardReleaseOptions();
|
|
const exe = b.addExecutable("demo", "src/main.zig");
|
|
|
|
// TODO: Generate src/models.zig
|
|
|
|
exe.addCSourceFile("src/bitfield-workaround.c", &[_][]const u8{"-std=c99"});
|
|
exe.addIncludeDir("./src/");
|
|
exe.addIncludeDir("/usr/local/include");
|
|
exe.addObjectFile("/usr/local/lib64/libs2n.a");
|
|
exe.addObjectFile("/usr/local/lib64/libcrypto.a");
|
|
exe.addObjectFile("/usr/local/lib64/libssl.a");
|
|
exe.addObjectFile("/usr/local/lib64/libaws-c-auth.a");
|
|
exe.addObjectFile("/usr/local/lib64/libaws-c-cal.a");
|
|
exe.addObjectFile("/usr/local/lib64/libaws-c-common.a");
|
|
exe.addObjectFile("/usr/local/lib64/libaws-c-compression.a");
|
|
exe.addObjectFile("/usr/local/lib64/libaws-c-http.a");
|
|
exe.addObjectFile("/usr/local/lib64/libaws-c-io.a");
|
|
exe.linkSystemLibrary("c");
|
|
exe.setTarget(target);
|
|
exe.setBuildMode(mode);
|
|
exe.override_dest_dir = .{ .Custom = ".." };
|
|
|
|
// TODO: Figure out -static
|
|
// Neither of these two work
|
|
// exe.addCompileFlags([][]const u8{
|
|
// "-static",
|
|
// "--strip",
|
|
// });
|
|
//
|
|
// To compile on stock 0.8.0, comment this line of code, or use the Makefile
|
|
// See https://github.com/ziglang/zig/pull/8248
|
|
//
|
|
// On a musl-based x86_64 system, this pre-compiled zig can be used:
|
|
// https://github.com/elerch/zig/releases/download/0.8.0/zig-0.8.0-static-support-musl-libz.tgz
|
|
exe.is_static = true;
|
|
|
|
exe.strip = true;
|
|
exe.install();
|
|
|
|
const run_cmd = exe.run();
|
|
run_cmd.step.dependOn(b.getInstallStep());
|
|
if (b.args) |args| {
|
|
run_cmd.addArgs(args);
|
|
}
|
|
|
|
const run_step = b.step("run", "Run the app");
|
|
run_step.dependOn(&run_cmd.step);
|
|
}
|