diff options
| author | Anhgelus Morhtuuzh <william@herges.fr> | 2026-04-20 14:07:29 +0200 |
|---|---|---|
| committer | Anhgelus Morhtuuzh <william@herges.fr> | 2026-04-20 14:07:29 +0200 |
| commit | 87046ba0fc5b9c3be61d23bd8cc2bc6fa84577ba (patch) | |
| tree | c53336a0dcc223819986ddba016b31cc32e73de9 /go/build.zig | |
| parent | db2f49115713c47b48587022511b3654a7042493 (diff) | |
feat(go): bindings
Diffstat (limited to 'go/build.zig')
| -rw-r--r-- | go/build.zig | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/go/build.zig b/go/build.zig new file mode 100644 index 0000000..5e6b59d --- /dev/null +++ b/go/build.zig @@ -0,0 +1,31 @@ +const std = @import("std"); + +pub fn build(b: *std.Build) !void { + const target = b.standardTargetOptions(.{}); + const optimize = b.standardOptimizeOption(.{}); + + const typdown = b.dependency("typdown", .{ + .optimize = optimize, + .target = target, + }).module("typdown"); + const lib = b.addLibrary(.{ + .name = "typdown", + .root_module = typdown, + .linkage = .static, + }); + const install = b.addInstallArtifact(lib, .{}); + // when emitting headers will be fixed + // currently, we have to use a symlink/copy to get it + //installed.emitted_h = lib.getEmittedH(); + b.getInstallStep().dependOn(&install.step); + + var flags = try std.ArrayList(u8).initCapacity(b.allocator, 2); + try flags.appendSlice(b.allocator, "-linkmode external -extldflags -static"); + if (optimize != .Debug) try flags.appendSlice(b.allocator, " -s"); + const go_build = b.addSystemCommand(&[_][]const u8{ + "go", "build", + "-ldflags", try flags.toOwnedSlice(b.allocator), + ".", + }); + b.getInstallStep().dependOn(&go_build.step); +} |
