Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for linux gnu build targets #741

Merged
merged 4 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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].
Expand Down
11 changes: 9 additions & 2 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +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 = .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,
Expand All @@ -22,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(.{});

//
Expand Down
3 changes: 2 additions & 1 deletion ext/avahi/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions ext/h2o/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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
"",
},
});

Expand Down
Loading