| ... | ... | @@ -6,8 +6,8 @@ |
| 6 | 6 | //! this tool. |
| 7 | 7 | //! |
| 8 | 8 | //! First, use the glibc, musl, FreeBSD, and NetBSD build systems to create installations of all the |
| 9 | | //! targets in the `glibc_targets`, `musl_targets`, `freebsd_targets`, and `netbsd_targets` |
| 10 | | //! variables. Next, run this tool to create a new directory which puts .h files into |
| 9 | //! targets in the `glibc_targets`, `musl_targets`, `freebsd_targets`, `netbsd_targets`, and |
| 10 | //! `openbsd_targets` variables. Next, run this tool to create a new directory which puts .h files into |
| 11 | 11 | //! <arch> subdirectories, with `generic` being files that apply to all architectures. |
| 12 | 12 | //! You'll then have to manually update Zig source repo with these new files. |
| 13 | 13 | |
| ... | ... | @@ -104,6 +104,19 @@ const netbsd_targets = [_]LibCTarget{ |
| 104 | 104 | .{ .arch = .x86_64, .abi = .none }, |
| 105 | 105 | }; |
| 106 | 106 | |
| 107 | const openbsd_targets = [_]LibCTarget{ |
| 108 | .{ .arch = .arm, .abi = .eabi }, |
| 109 | .{ .arch = .aarch64, .abi = .none }, |
| 110 | .{ .arch = .mips64, .abi = .none }, |
| 111 | .{ .arch = .mips64el, .abi = .none }, |
| 112 | .{ .arch = .powerpc, .abi = .eabihf }, |
| 113 | .{ .arch = .powerpc64, .abi = .none }, |
| 114 | .{ .arch = .riscv64, .abi = .none }, |
| 115 | .{ .arch = .sparc64, .abi = .none }, |
| 116 | .{ .arch = .x86, .abi = .none }, |
| 117 | .{ .arch = .x86_64, .abi = .none }, |
| 118 | }; |
| 119 | |
| 107 | 120 | const Contents = struct { |
| 108 | 121 | bytes: []const u8, |
| 109 | 122 | hit_count: usize, |
| ... | ... | @@ -125,6 +138,7 @@ const LibCVendor = enum { |
| 125 | 138 | glibc, |
| 126 | 139 | freebsd, |
| 127 | 140 | netbsd, |
| 141 | openbsd, |
| 128 | 142 | }; |
| 129 | 143 | |
| 130 | 144 | pub fn main(init: std.process.Init) !void { |
| ... | ... | @@ -176,6 +190,7 @@ pub fn main(init: std.process.Init) !void { |
| 176 | 190 | .musl => &musl_targets, |
| 177 | 191 | .freebsd => &freebsd_targets, |
| 178 | 192 | .netbsd => &netbsd_targets, |
| 193 | .openbsd => &openbsd_targets, |
| 179 | 194 | }; |
| 180 | 195 | |
| 181 | 196 | var path_table = PathTable.init(arena); |
| ... | ... | @@ -215,6 +230,22 @@ pub fn main(init: std.process.Init) !void { |
| 215 | 230 | .sparc64, |
| 216 | 231 | => |a| @tagName(a), |
| 217 | 232 | |
| 233 | else => unreachable, |
| 234 | }, |
| 235 | .openbsd => switch (libc_target.arch) { |
| 236 | .arm => "armv7", |
| 237 | .aarch64 => "arm64", |
| 238 | .mips64 => "octeon", |
| 239 | .mips64el => "loongson", |
| 240 | .powerpc => "macppc", |
| 241 | .x86 => "i386", |
| 242 | .x86_64 => "amd64", |
| 243 | |
| 244 | .powerpc64, |
| 245 | .riscv64, |
| 246 | .sparc64, |
| 247 | => |a| @tagName(a), |
| 248 | |
| 218 | 249 | else => unreachable, |
| 219 | 250 | }, |
| 220 | 251 | }; |
| ... | ... | @@ -225,6 +256,7 @@ pub fn main(init: std.process.Init) !void { |
| 225 | 256 | .musl, .glibc => "linux", |
| 226 | 257 | .freebsd => "freebsd", |
| 227 | 258 | .netbsd => "netbsd", |
| 259 | .openbsd => "openbsd", |
| 228 | 260 | }, |
| 229 | 261 | @tagName(libc_target.abi), |
| 230 | 262 | }); |
| ... | ... | @@ -234,6 +266,7 @@ pub fn main(init: std.process.Init) !void { |
| 234 | 266 | .glibc, |
| 235 | 267 | .freebsd, |
| 236 | 268 | .netbsd, |
| 269 | .openbsd, |
| 237 | 270 | => &[_][]const u8{ search_path, libc_dir, "usr", "include" }, |
| 238 | 271 | .musl => &[_][]const u8{ search_path, libc_dir, "usr", "local", "musl", "include" }, |
| 239 | 272 | }; |
| ... | ... | @@ -370,6 +403,6 @@ fn usageAndExit(arg0: []const u8) noreturn { |
| 370 | 403 | std.debug.print("--search-path can be used any number of times.\n", .{}); |
| 371 | 404 | std.debug.print(" subdirectories of search paths look like, e.g. x86_64-linux-gnu\n", .{}); |
| 372 | 405 | std.debug.print("--out is a dir that will be created, and populated with the results\n", .{}); |
| 373 | | std.debug.print("--abi is either glibc, musl, freebsd, or netbsd\n", .{}); |
| 406 | std.debug.print("--abi is either glibc, musl, freebsd, netbsd, or openbsd\n", .{}); |
| 374 | 407 | std.process.exit(1); |
| 375 | 408 | } |