From 606ca2c77d9e4998a2c0265c51729beb2c0cfbb2 Mon Sep 17 00:00:00 2001 From: Santeri Hannula Date: Thu, 10 Oct 2024 13:35:59 +0300 Subject: [PATCH 1/4] build: add gnu linux targets --- build.zig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build.zig b/build.zig index 86e22ba633..a9ab22bc79 100644 --- a/build.zig +++ b/build.zig @@ -5,6 +5,8 @@ const VERSION = "3.2"; const targets: []const std.Target.Query = &.{ .{ .cpu_arch = .aarch64, .os_tag = .macos, .abi = null }, .{ .cpu_arch = .x86_64, .os_tag = .macos, .abi = null }, + .{ .cpu_arch = .aarch64, .os_tag = .linux, .abi = .gnu }, + .{ .cpu_arch = .x86_64, .os_tag = .linux, .abi = .gnu }, .{ .cpu_arch = .aarch64, .os_tag = .linux, .abi = .musl }, .{ .cpu_arch = .x86_64, .os_tag = .linux, .abi = .musl }, }; From 94099691dadf632e694ec5c18aaa59b1b512577f Mon Sep 17 00:00:00 2001 From: Santeri Hannula Date: Thu, 24 Oct 2024 14:18:02 +0300 Subject: [PATCH 2/4] build: fix errors when building against glibc --- ext/avahi/build.zig | 3 ++- ext/h2o/build.zig | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ext/avahi/build.zig b/ext/avahi/build.zig index ea8171fbe7..44fe568090 100644 --- a/ext/avahi/build.zig +++ b/ext/avahi/build.zig @@ -538,7 +538,8 @@ pub fn build(b: *std.Build) void { avahi.root_module.addCMacro("HAVE_DBUS_CONNECTION_CLOSE", "0"); avahi.root_module.addCMacro("HAVE_EXPAT_H", "1"); avahi.root_module.addCMacro("HAVE_CONFIG_H", "1"); - avahi.root_module.addCMacro("HAVE_STRLCPY", "1"); + if (!t.isGnu()) + avahi.root_module.addCMacro("HAVE_STRLCPY", "1"); const avahi_config_h = b.addConfigHeader(.{ .style = .blank, diff --git a/ext/h2o/build.zig b/ext/h2o/build.zig index 51d395fdbf..c2bfc15b41 100644 --- a/ext/h2o/build.zig +++ b/ext/h2o/build.zig @@ -55,6 +55,10 @@ pub fn build(b: *std.Build) !void { .files = &.{"cloexec.c"}, .flags = &.{ "-fno-sanitize=all", + if (t.isGnu()) + "-D_GNU_SOURCE" + else + "", }, }); From 28f6ec9bf4af4e2ca8dd9a01c5b743a9d505c9b2 Mon Sep 17 00:00:00 2001 From: Santeri Hannula Date: Thu, 24 Oct 2024 16:55:04 +0300 Subject: [PATCH 3/4] build: do not build gnu targets with `-Dall` --- build.zig | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/build.zig b/build.zig index a9ab22bc79..ec35661a34 100644 --- a/build.zig +++ b/build.zig @@ -2,15 +2,20 @@ const std = @import("std"); const VERSION = "3.2"; -const targets: []const std.Target.Query = &.{ +const main_targets = .{ .{ .cpu_arch = .aarch64, .os_tag = .macos, .abi = null }, .{ .cpu_arch = .x86_64, .os_tag = .macos, .abi = null }, - .{ .cpu_arch = .aarch64, .os_tag = .linux, .abi = .gnu }, - .{ .cpu_arch = .x86_64, .os_tag = .linux, .abi = .gnu }, .{ .cpu_arch = .aarch64, .os_tag = .linux, .abi = .musl }, .{ .cpu_arch = .x86_64, .os_tag = .linux, .abi = .musl }, }; +const supported_targets: []const std.Target.Query = &(main_targets ++ .{ + .{ .cpu_arch = .aarch64, .os_tag = .linux, .abi = .gnu }, + .{ .cpu_arch = .x86_64, .os_tag = .linux, .abi = .gnu }, +}); + +const targets: []const std.Target.Query = &main_targets; + const BuildCfg = struct { version: []const u8, pace: []const u8, @@ -24,7 +29,7 @@ const BuildCfg = struct { }; pub fn build(b: *std.Build) !void { - const target = b.standardTargetOptions(.{ .whitelist = targets }); + const target = b.standardTargetOptions(.{ .whitelist = supported_targets }); var optimize = b.standardOptimizeOption(.{}); // From c561fa52baaa744359bf4c74d29dda46ed22a9bc Mon Sep 17 00:00:00 2001 From: Santeri Hannula Date: Mon, 4 Nov 2024 16:15:04 +0200 Subject: [PATCH 4/4] docs: add new targets to `INSTALL.md` --- INSTALL.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/INSTALL.md b/INSTALL.md index ba86e70793..4fa62ffe3c 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -5,11 +5,16 @@ We use [`zig`][zig] to build Vere, which is packaged as a single binary, ## Supported Targets +Main (`-Dall`) targets: - `aarch64-linux-musl` - `x86_64-linux-musl` - `aarch64-macos` - `x86_64-macos` +Additional targets: +- `aarch64-linux-gnu` +- `x86_64-linux-gnu` + ## Prerequisites Install version 0.13.0 of `zig` with the package manager of your choosing, e.g., `brew install zig`, or download the binary from [here][zig-download].