From fcedfddf00b3f994e4f4e40332ac7fc192c63244 Mon Sep 17 00:00:00 2001 From: polwex Date: Sun, 5 Oct 2025 21:56:51 +0700 Subject: claude is gud --- vere/pkg/past/build.zig | 88 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 vere/pkg/past/build.zig (limited to 'vere/pkg/past/build.zig') diff --git a/vere/pkg/past/build.zig b/vere/pkg/past/build.zig new file mode 100644 index 0000000..6f059af --- /dev/null +++ b/vere/pkg/past/build.zig @@ -0,0 +1,88 @@ +const std = @import("std"); + +pub fn build(b: *std.Build) !void { + const target = b.standardTargetOptions(.{}); + const optimize = b.standardOptimizeOption(.{}); + + const copts: []const []const u8 = + b.option([]const []const u8, "copt", "") orelse &.{}; + + const pkg_past = b.addStaticLibrary(.{ + .name = "past", + .target = target, + .optimize = optimize, + }); + + if (target.result.os.tag.isDarwin() and !target.query.isNative()) { + const macos_sdk = b.lazyDependency("macos_sdk", .{ + .target = target, + .optimize = optimize, + }); + if (macos_sdk != null) { + pkg_past.addSystemIncludePath(macos_sdk.?.path("usr/include")); + pkg_past.addLibraryPath(macos_sdk.?.path("usr/lib")); + pkg_past.addFrameworkPath(macos_sdk.?.path("System/Library/Frameworks")); + } + } + + const pkg_c3 = b.dependency("pkg_c3", .{ + .target = target, + .optimize = optimize, + .copt = copts, + }); + + const pkg_noun = b.dependency("pkg_noun", .{ + .target = target, + .optimize = optimize, + .copt = copts, + }); + + const gmp = b.dependency("gmp", .{ + .target = target, + .optimize = optimize, + }); + + pkg_past.linkLibC(); + + pkg_past.linkLibrary(pkg_c3.artifact("c3")); + pkg_past.linkLibrary(pkg_noun.artifact("noun")); + pkg_past.linkLibrary(gmp.artifact("gmp")); + + var flags = std.ArrayList([]const u8).init(b.allocator); + defer flags.deinit(); + try flags.appendSlice(&.{ + // "-pedantic", + "-std=gnu23", + }); + try flags.appendSlice(copts); + + pkg_past.addCSourceFiles(.{ + .root = b.path(""), + .files = &c_source_files, + .flags = flags.items, + }); + + for (install_headers) |h| pkg_past.installHeader(b.path(h), h); + + b.installArtifact(pkg_past); +} + +const c_source_files = [_][]const u8{ + "v1.c", + "v2.c", + "v3.c", + "v4.c", + "migrate_v2.c", + "migrate_v3.c", + "migrate_v4.c", + "migrate_v5.c", +}; + +const install_headers = [_][]const u8{ + "v1.h", + "v2.h", + "v3.h", + "v4.h", + "v5.h", + "migrate.h", +}; -- cgit v1.2.3