mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
process_headers: add openbsd support
This commit is contained in:
parent
c166bb36f6
commit
154ad83ea4
1 changed files with 36 additions and 3 deletions
|
|
@ -6,8 +6,8 @@
|
||||||
//! this tool.
|
//! this tool.
|
||||||
//!
|
//!
|
||||||
//! First, use the glibc, musl, FreeBSD, and NetBSD build systems to create installations of all the
|
//! First, use the glibc, musl, FreeBSD, and NetBSD build systems to create installations of all the
|
||||||
//! targets in the `glibc_targets`, `musl_targets`, `freebsd_targets`, and `netbsd_targets`
|
//! targets in the `glibc_targets`, `musl_targets`, `freebsd_targets`, `netbsd_targets`, and
|
||||||
//! variables. Next, run this tool to create a new directory which puts .h files into
|
//! `openbsd_targets` variables. Next, run this tool to create a new directory which puts .h files into
|
||||||
//! <arch> subdirectories, with `generic` being files that apply to all architectures.
|
//! <arch> subdirectories, with `generic` being files that apply to all architectures.
|
||||||
//! You'll then have to manually update Zig source repo with these new files.
|
//! You'll then have to manually update Zig source repo with these new files.
|
||||||
|
|
||||||
|
|
@ -103,6 +103,19 @@ const netbsd_targets = [_]LibCTarget{
|
||||||
.{ .arch = .x86_64, .abi = .none },
|
.{ .arch = .x86_64, .abi = .none },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const openbsd_targets = [_]LibCTarget{
|
||||||
|
.{ .arch = .arm, .abi = .eabi },
|
||||||
|
.{ .arch = .aarch64, .abi = .none },
|
||||||
|
.{ .arch = .mips64, .abi = .none },
|
||||||
|
.{ .arch = .mips64el, .abi = .none },
|
||||||
|
.{ .arch = .powerpc, .abi = .eabihf },
|
||||||
|
.{ .arch = .powerpc64, .abi = .none },
|
||||||
|
.{ .arch = .riscv64, .abi = .none },
|
||||||
|
.{ .arch = .sparc64, .abi = .none },
|
||||||
|
.{ .arch = .x86, .abi = .none },
|
||||||
|
.{ .arch = .x86_64, .abi = .none },
|
||||||
|
};
|
||||||
|
|
||||||
const Contents = struct {
|
const Contents = struct {
|
||||||
bytes: []const u8,
|
bytes: []const u8,
|
||||||
hit_count: usize,
|
hit_count: usize,
|
||||||
|
|
@ -124,6 +137,7 @@ const LibCVendor = enum {
|
||||||
glibc,
|
glibc,
|
||||||
freebsd,
|
freebsd,
|
||||||
netbsd,
|
netbsd,
|
||||||
|
openbsd,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn main() !void {
|
pub fn main() !void {
|
||||||
|
|
@ -172,6 +186,7 @@ pub fn main() !void {
|
||||||
.musl => &musl_targets,
|
.musl => &musl_targets,
|
||||||
.freebsd => &freebsd_targets,
|
.freebsd => &freebsd_targets,
|
||||||
.netbsd => &netbsd_targets,
|
.netbsd => &netbsd_targets,
|
||||||
|
.openbsd => &openbsd_targets,
|
||||||
};
|
};
|
||||||
|
|
||||||
var path_table = PathTable.init(allocator);
|
var path_table = PathTable.init(allocator);
|
||||||
|
|
@ -211,6 +226,22 @@ pub fn main() !void {
|
||||||
.sparc64,
|
.sparc64,
|
||||||
=> |a| @tagName(a),
|
=> |a| @tagName(a),
|
||||||
|
|
||||||
|
else => unreachable,
|
||||||
|
},
|
||||||
|
.openbsd => switch (libc_target.arch) {
|
||||||
|
.arm => "armv7",
|
||||||
|
.aarch64 => "arm64",
|
||||||
|
.mips64 => "octeon",
|
||||||
|
.mips64el => "loongson",
|
||||||
|
.powerpc => "macppc",
|
||||||
|
.x86 => "i386",
|
||||||
|
.x86_64 => "amd64",
|
||||||
|
|
||||||
|
.powerpc64,
|
||||||
|
.riscv64,
|
||||||
|
.sparc64,
|
||||||
|
=> |a| @tagName(a),
|
||||||
|
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
@ -221,6 +252,7 @@ pub fn main() !void {
|
||||||
.musl, .glibc => "linux",
|
.musl, .glibc => "linux",
|
||||||
.freebsd => "freebsd",
|
.freebsd => "freebsd",
|
||||||
.netbsd => "netbsd",
|
.netbsd => "netbsd",
|
||||||
|
.openbsd => "openbsd",
|
||||||
},
|
},
|
||||||
@tagName(libc_target.abi),
|
@tagName(libc_target.abi),
|
||||||
});
|
});
|
||||||
|
|
@ -230,6 +262,7 @@ pub fn main() !void {
|
||||||
.glibc,
|
.glibc,
|
||||||
.freebsd,
|
.freebsd,
|
||||||
.netbsd,
|
.netbsd,
|
||||||
|
.openbsd,
|
||||||
=> &[_][]const u8{ search_path, libc_dir, "usr", "include" },
|
=> &[_][]const u8{ search_path, libc_dir, "usr", "include" },
|
||||||
.musl => &[_][]const u8{ search_path, libc_dir, "usr", "local", "musl", "include" },
|
.musl => &[_][]const u8{ search_path, libc_dir, "usr", "local", "musl", "include" },
|
||||||
};
|
};
|
||||||
|
|
@ -368,6 +401,6 @@ fn usageAndExit(arg0: []const u8) noreturn {
|
||||||
std.debug.print("--search-path can be used any number of times.\n", .{});
|
std.debug.print("--search-path can be used any number of times.\n", .{});
|
||||||
std.debug.print(" subdirectories of search paths look like, e.g. x86_64-linux-gnu\n", .{});
|
std.debug.print(" subdirectories of search paths look like, e.g. x86_64-linux-gnu\n", .{});
|
||||||
std.debug.print("--out is a dir that will be created, and populated with the results\n", .{});
|
std.debug.print("--out is a dir that will be created, and populated with the results\n", .{});
|
||||||
std.debug.print("--abi is either glibc, musl, freebsd, or netbsd\n", .{});
|
std.debug.print("--abi is either glibc, musl, freebsd, netbsd, or openbsd\n", .{});
|
||||||
std.process.exit(1);
|
std.process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue