Skip to content

Commit

Permalink
Support x86 only
Browse files Browse the repository at this point in the history
  • Loading branch information
leki75 committed Nov 4, 2024
1 parent 06f9204 commit f0507ca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 20 deletions.
25 changes: 6 additions & 19 deletions build.zig
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
const std = @import("std");

fn isAlpine() bool {
const f = std.fs.openFileAbsolute(
"/etc/alpine-release",
std.fs.File.OpenFlags{},
) catch {
return false;
};
defer f.close();
return true;
}

pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});

if (target.result.cpu.arch != .x86_64) @panic("The target CPU architecture have to be 'x86_64'");

const options = b.addOptions();
const dynamic = b.option(bool, "dynamic", "link with dynamic library (default: false)") orelse false;
options.addOption(bool, "dynamic", dynamic);
Expand All @@ -26,13 +17,9 @@ pub fn build(b: *std.Build) void {
});

lib.addLibraryPath(b.path("lib"));
if (isAlpine() and !dynamic) {
lib.linkSystemLibrary("aeron_static_musl", .{});
} else if (isAlpine() and dynamic) {
lib.linkSystemLibrary("aeron_musl", .{});
} else if (!isAlpine() and !dynamic) {
lib.linkSystemLibrary("aeron_static_libc", .{});
} else if (!isAlpine() and dynamic) {
lib.linkSystemLibrary("aeron_libc", .{});
switch (target.result.abi) {
.gnu => lib.linkSystemLibrary(if (dynamic) "aeron_libc" else "aeron_static_libc", .{}),
.musl => lib.linkSystemLibrary(if (dynamic) "aeron_musl" else "aeron_static_musl", .{}),
else => @panic("The target ABI have to be 'musl' or 'gnu'"),
}
}
2 changes: 1 addition & 1 deletion build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.{
.name = "aeron",
.version = "1.46.6",
.version = "1.46.6+x86",
.minimum_zig_version = "0.13.0",
.paths = .{
"build.zig",
Expand Down

0 comments on commit f0507ca

Please sign in to comment.