aws-sdk-for-zig/build.zig
Emil Lerch e0b3c4f0b3
switch openssl->aws-lc
This switch moves to a full AWS stack and a core ssl library with
smaller security attack surface. It increases final binary size by
3MB which may be largely avoided by tweaking the aws-lc build
commands at the expense of some performance. Note aws-lc will
likely be the primarily supported ssl library by the AWS c
runtime libs moving forward, and thus this also allows us to move
to more recent versions of the dependant libraries. We still
require a custom fork of aws-c-cal until PR 89 is merged
2021-04-29 16:27:23 -07:00

52 lines
1.9 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("start-hand-test", "src/main.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",
// });
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);
}