mirror of
https://github.com/ziglang/zig.git
synced 2024-11-28 08:02:32 +00:00
4616af0ca4
* re-introduce `std.build.Target` which is distinct from `std.Target`. `std.build.Target` wraps `std.Target` so that it can be annotated as "the native target" or an explicitly specified target. * `std.Target.Os` is moved to `std.Target.Os.Tag`. The former is now a struct which has the tag as well as version range information. * `std.elf` gains some more ELF header constants. * `std.Target.parse` gains the ability to parse operating system version ranges as well as glibc version. * Added `std.Target.isGnuLibC()`. * self-hosted dynamic linker detection and glibc version detection. This also adds the improved logic using `/usr/bin/env` rather than invoking the system C compiler to find the dynamic linker when zig is statically linked. Related: #2084 Note: this `/usr/bin/env` code is work-in-progress. * `-target-glibc` CLI option is removed in favor of the new `-target` syntax. Example: `-target x86_64-linux-gnu.2.27` closes #1907
31 lines
997 B
Zig
31 lines
997 B
Zig
//! Platform-dependent types and values that are used along with OS-specific APIs.
|
|
//! These are imported into `std.c`, `std.os`, and `std.os.linux`.
|
|
//! Root source files can define `os.bits` and these will additionally be added
|
|
//! to the namespace.
|
|
|
|
const std = @import("std");
|
|
const root = @import("root");
|
|
|
|
pub usingnamespace switch (std.Target.current.os.tag) {
|
|
.macosx, .ios, .tvos, .watchos => @import("bits/darwin.zig"),
|
|
.dragonfly => @import("bits/dragonfly.zig"),
|
|
.freebsd => @import("bits/freebsd.zig"),
|
|
.linux => @import("bits/linux.zig"),
|
|
.netbsd => @import("bits/netbsd.zig"),
|
|
.wasi => @import("bits/wasi.zig"),
|
|
.windows => @import("bits/windows.zig"),
|
|
else => struct {},
|
|
};
|
|
|
|
pub usingnamespace if (@hasDecl(root, "os") and @hasDecl(root.os, "bits")) root.os.bits else struct {};
|
|
|
|
pub const iovec = extern struct {
|
|
iov_base: [*]u8,
|
|
iov_len: usize,
|
|
};
|
|
|
|
pub const iovec_const = extern struct {
|
|
iov_base: [*]const u8,
|
|
iov_len: usize,
|
|
};
|