Ports/zig: Bump zig version to 0.12.0-dev.141+ddf5859c2

Fixes build error
```
error "It looks like you're trying to enable vendor availability
markup, but you haven't defined the corresponding macros yet!"
```
while trying to #include <__availability> header without having
the necessary preprocessor directive
`_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS` set
This commit is contained in:
Andre Herbst 2023-08-19 18:02:30 +02:00 committed by Tim Schumacher
parent ca16a1ed08
commit 14d8403a7b
Notes: sideshowbarker 2024-07-17 03:45:48 +09:00
10 changed files with 219 additions and 77 deletions

View file

@ -329,7 +329,7 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n
| [`xorriso`](xorriso/) | xorriso | 1.5.6 | https://www.gnu.org/software/xorriso |
| [`xz`](xz/) | xz | 5.2.5 | https://tukaani.org/xz/ |
| [`yasm`](yasm/) | Yasm Modular Assembler | 1.3.0 | https://yasm.tortall.net/ |
| [`zig`](zig/) | Zig programming language | 0.11.0-dev.4003+c6aa29b6f | https://ziglang.org/ |
| [`zig`](zig/) | Zig programming language | 0.12.0-dev.141+ddf5859c2 | https://ziglang.org/ |
| [`zlib`](zlib/) | zlib | 1.3 | https://www.zlib.net/ |
| [`zsh`](zsh/) | Z Shell (Zsh) | 5.9 | https://www.zsh.org |
| [`zstd`](zstd/) | Zstandard | 1.5.2 | https://facebook.github.io/zstd/ |

View file

@ -1,16 +1,16 @@
#!/usr/bin/env -S bash ../.port_include.sh
port='zig'
version='0.11.0-dev.4003+c6aa29b6f'
version='0.12.0-dev.141+ddf5859c2'
files=(
'https://github.com/ziglang/zig-bootstrap/archive/bf1b2cdb83141ad9336eec42160c9fe87f90198d.tar.gz#363f97884f4a291c7167468e53cf4570fa03bc7b8973365dbce2019ffc103150'
'https://github.com/ziglang/zig/archive/c6aa29b6fdba1606bfd218b17de89f64179c0ed8.tar.gz#d63c5087a737c46072f155eacacaa406af67addab39ad8179c44b0fc7d698ac1'
'https://github.com/ziglang/zig-bootstrap/archive/34644ad5032c58e39327d33d7f96d63d7c330003.tar.gz#e502ae17b01f03c627927d60b2e26b5f7f83b0e8be27b6ef55511d52e5892ccf'
'https://github.com/ziglang/zig/archive/ddf5859c22527c6bf5d8bb13310db996fcc58874.tar.gz#9adaf787b6233cfbe784d2d8a72398784f3742e2f5ac700cbd59ba952f9491ad'
)
# The actual directory to build in.
workdir='zig-bootstrap-bf1b2cdb83141ad9336eec42160c9fe87f90198d'
workdir='zig-bootstrap-34644ad5032c58e39327d33d7f96d63d7c330003'
# The newer Zig directory we move into the workdir.
zigdir='zig-c6aa29b6fdba1606bfd218b17de89f64179c0ed8'
zigdir='zig-ddf5859c22527c6bf5d8bb13310db996fcc58874'
post_fetch() {
# Move the newer version of Zig into the bootstrap
@ -33,6 +33,6 @@ install() {
mkdir -p "${DESTDIR}/usr/local/bin/."
mkdir -p "${DESTDIR}/usr/local/lib/."
cp -rv "${zig_install_dir}/bin/"* "${DESTDIR}/usr/local/bin/"
cp -rv "${zig_install_dir}/zig" "${DESTDIR}/usr/local/bin/"
cp -rv "${zig_install_dir}/lib/"* "${DESTDIR}/usr/local/lib/"
}

View file

@ -11,23 +11,23 @@ Named "serenity" within the code to match what LLVM says.
zig/src/codegen/llvm/bindings.zig | 1 +
zig/src/libc_installation.zig | 6 +++++-
zig/src/link/Elf.zig | 9 +++++++++
zig/src/target.zig | 5 ++++-
zig/src/target.zig | 7 +++++--
zig/src/zig_llvm.h | 3 ++-
8 files changed, 31 insertions(+), 3 deletions(-)
8 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/zig/lib/std/target.zig b/zig/lib/std/target.zig
index 2a96e84001ebf67ce29a9059f62045776530549a..b137e48c02d7d7ecc0f5eae61f6225504bf0ba3d 100644
index c3d12b2759cead4c23d3145fe018327f838399ff..608f0e958144fc53dfb67fa2efa29690a60599ba 100644
--- a/zig/lib/std/target.zig
+++ b/zig/lib/std/target.zig
@@ -60,6 +60,7 @@ pub const Target = struct {
@@ -57,6 +57,7 @@ pub const Target = struct {
glsl450,
vulkan,
plan9,
+ serenity,
other,
pub fn isDarwin(tag: Tag) bool {
@@ -267,6 +268,7 @@ pub const Target = struct {
pub inline fn isDarwin(tag: Tag) bool {
@@ -264,6 +265,7 @@ pub const Target = struct {
.glsl450, // TODO: GLSL versions
.vulkan,
.plan9,
@ -35,7 +35,7 @@ index 2a96e84001ebf67ce29a9059f62045776530549a..b137e48c02d7d7ecc0f5eae61f622550
.other,
=> return .{ .none = {} },
@@ -410,6 +412,7 @@ pub const Target = struct {
@@ -407,6 +409,7 @@ pub const Target = struct {
.openbsd,
.haiku,
.solaris,
@ -43,7 +43,7 @@ index 2a96e84001ebf67ce29a9059f62045776530549a..b137e48c02d7d7ecc0f5eae61f622550
=> true,
.linux,
@@ -568,6 +571,7 @@ pub const Target = struct {
@@ -565,6 +568,7 @@ pub const Target = struct {
.watchos,
.driverkit,
.shadermodel,
@ -51,7 +51,7 @@ index 2a96e84001ebf67ce29a9059f62045776530549a..b137e48c02d7d7ecc0f5eae61f622550
=> return .none,
}
}
@@ -1690,6 +1694,8 @@ pub const Target = struct {
@@ -1689,6 +1693,8 @@ pub const Target = struct {
// TODO revisit when multi-arch for Haiku is available
.haiku => return copy(&result, "/system/runtime_loader"),
@ -81,10 +81,10 @@ index d42b02d931dc3afa7cc33b1576ec77d123fc5bd5..479c1bffc8df034ee2d876118c1aa257
=> return error.InvalidOperatingSystemVersion,
diff --git a/zig/src/codegen/llvm.zig b/zig/src/codegen/llvm.zig
index ec456e53a7b29be235ec329882e593545273c732..32baa8fbb39a699e57450ed36d5897991c32524b 100644
index e36f411a01a631c7a52cf8ad8b50986ab26c69bd..7c651e4456ec984730e77a6f29e4c61aa4983310 100644
--- a/zig/src/codegen/llvm.zig
+++ b/zig/src/codegen/llvm.zig
@@ -144,6 +144,7 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![:0]u8 {
@@ -148,6 +148,7 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 {
.watchos => "watchos",
.driverkit => "driverkit",
.shadermodel => "shadermodel",
@ -92,7 +92,7 @@ index ec456e53a7b29be235ec329882e593545273c732..32baa8fbb39a699e57450ed36d589799
.opencl,
.glsl450,
.vulkan,
@@ -250,6 +251,7 @@ pub fn targetOs(os_tag: std.Target.Os.Tag) llvm.OSType {
@@ -254,6 +255,7 @@ pub fn targetOs(os_tag: std.Target.Os.Tag) llvm.OSType {
.emscripten => .Emscripten,
.driverkit => .DriverKit,
.shadermodel => .ShaderModel,
@ -101,10 +101,10 @@ index ec456e53a7b29be235ec329882e593545273c732..32baa8fbb39a699e57450ed36d589799
}
diff --git a/zig/src/codegen/llvm/bindings.zig b/zig/src/codegen/llvm/bindings.zig
index b093588e80c1dcbcd3d515ffa09b9ffefcd55828..385b17bd16a2f957f6e79bd7c068820415bcae6f 100644
index 66826caa42547b19a68c2301ece99d1e7a6d5f86..2f9fae37aad13d16fe4fdf0f0ae205ad1c13855b 100644
--- a/zig/src/codegen/llvm/bindings.zig
+++ b/zig/src/codegen/llvm/bindings.zig
@@ -1298,6 +1298,7 @@ pub const OSType = enum(c_int) {
@@ -1191,6 +1191,7 @@ pub const OSType = enum(c_int) {
WASI,
Emscripten,
ShaderModel,
@ -113,10 +113,10 @@ index b093588e80c1dcbcd3d515ffa09b9ffefcd55828..385b17bd16a2f957f6e79bd7c0688204
pub const ArchType = enum(c_int) {
diff --git a/zig/src/libc_installation.zig b/zig/src/libc_installation.zig
index 355c3bad8dcd53a03e4df133f0a470b91d390a22..c048b865270640877e0bd042c21faa7e8317991f 100644
index 2d42a03a32d7601dbdc8358af5c40e0aef482837..ce550aa8db4e1b3b75ad4a1669edbce3b2ddf8a0 100644
--- a/zig/src/libc_installation.zig
+++ b/zig/src/libc_installation.zig
@@ -8,6 +8,7 @@ const build_options = @import("build_options");
@@ -7,6 +7,7 @@ const Allocator = std.mem.Allocator;
const is_darwin = builtin.target.isDarwin();
const is_windows = builtin.target.os.tag == .windows;
const is_haiku = builtin.target.os.tag == .haiku;
@ -124,7 +124,7 @@ index 355c3bad8dcd53a03e4df133f0a470b91d390a22..c048b865270640877e0bd042c21faa7e
const log = std.log.scoped(.libc_installation);
@@ -205,6 +206,9 @@ pub const LibCInstallation = struct {
@@ -213,6 +214,9 @@ pub const LibCInstallation = struct {
try self.findNativeIncludeDirPosix(args);
try self.findNativeCrtBeginDirHaiku(args);
self.crt_dir = try args.allocator.dupeZ(u8, "/system/develop/lib");
@ -134,7 +134,7 @@ index 355c3bad8dcd53a03e4df133f0a470b91d390a22..c048b865270640877e0bd042c21faa7e
} else if (std.process.can_spawn) {
try self.findNativeIncludeDirPosix(args);
switch (builtin.target.os.tag) {
@@ -308,7 +312,7 @@ pub const LibCInstallation = struct {
@@ -316,7 +320,7 @@ pub const LibCInstallation = struct {
const include_dir_example_file = if (is_haiku) "posix/stdlib.h" else "stdlib.h";
const sys_include_dir_example_file = if (is_windows)
"sys\\types.h"
@ -144,10 +144,10 @@ index 355c3bad8dcd53a03e4df133f0a470b91d390a22..c048b865270640877e0bd042c21faa7e
else
"sys/errno.h";
diff --git a/zig/src/link/Elf.zig b/zig/src/link/Elf.zig
index 0258b0a6a70ad07bf6bad54ccf24954d67bb98d9..fc2d11a10eb8aa31a739a0da15b592cd0f0b90ac 100644
index 9d71885e61dea3e9a5a2d45dd31462b0da963367..ed62c1cf0979e26179d18507abece2f0af2f3a04 100644
--- a/zig/src/link/Elf.zig
+++ b/zig/src/link/Elf.zig
@@ -3382,6 +3382,15 @@ const CsuObjects = struct {
@@ -3368,6 +3368,15 @@ const CsuObjects = struct {
.static_pie => result.set( "rcrt0.o", null, "crtbegin.o", "crtend.o", null ),
// zig fmt: on
},
@ -164,7 +164,7 @@ index 0258b0a6a70ad07bf6bad54ccf24954d67bb98d9..fc2d11a10eb8aa31a739a0da15b592cd
// zig fmt: off
.dynamic_lib => result.set( null, "crti.o", "crtbeginS.o", "crtendS.o", "crtn.o" ),
diff --git a/zig/src/target.zig b/zig/src/target.zig
index f07dcc43d21e516ef5e5f392d231207a4e6389eb..95efc730d9c2ba61a19200bf11ad1456a37650dc 100644
index 2e7cd46e4376efe9d2c543b3aad937dbc5a6f4b0..0219d7419a54ebfc7dd78a058b8871d417b65d01 100644
--- a/zig/src/target.zig
+++ b/zig/src/target.zig
@@ -190,7 +190,7 @@ pub fn libcNeedsLibUnwind(target: std.Target) bool {
@ -176,7 +176,16 @@ index f07dcc43d21e516ef5e5f392d231207a4e6389eb..95efc730d9c2ba61a19200bf11ad1456
}
/// This function returns whether non-pic code is completely invalid on the given target.
@@ -476,6 +476,9 @@ pub fn libcFullLinkFlags(target: std.Target) []const []const u8 {
@@ -378,7 +378,7 @@ pub fn is_libc_lib_name(target: std.Target, name: []const u8) bool {
return false;
}
- if (target.abi.isGnu() or target.abi.isMusl() or target.os.tag.isDarwin()) {
+ if (target.abi.isGnu() or target.abi.isMusl() or target.os.tag.isDarwin() or target.os.tag == .serenity) {
if (eqlIgnoreCase(ignore_case, name, "m"))
return true;
if (eqlIgnoreCase(ignore_case, name, "rt"))
@@ -485,6 +485,9 @@ pub fn libcFullLinkFlags(target: std.Target) []const []const u8 {
"-lpthread",
"-lc",
},
@ -187,10 +196,10 @@ index f07dcc43d21e516ef5e5f392d231207a4e6389eb..95efc730d9c2ba61a19200bf11ad1456
.android => &[_][]const u8{
"-lm",
diff --git a/zig/src/zig_llvm.h b/zig/src/zig_llvm.h
index 74dcd105649ab9633f67a8caaf26e2d3ba5b5aef..6dc140d69c16935654a9d58658184def3464be35 100644
index 6671922090761915ed74913602c8b0d5a21d559f..c8c90adfeac7a5a4ee8348bf119491aadaa4c156 100644
--- a/zig/src/zig_llvm.h
+++ b/zig/src/zig_llvm.h
@@ -475,7 +475,8 @@ enum ZigLLVM_OSType {
@@ -426,7 +426,8 @@ enum ZigLLVM_OSType {
ZigLLVM_WASI, // Experimental WebAssembly OS
ZigLLVM_Emscripten,
ZigLLVM_ShaderModel, // DirectX ShaderModel

View file

@ -6,19 +6,19 @@ Subject: [PATCH] Implement SerenityOS support in std
---
zig/lib/std/Thread.zig | 2 +-
zig/lib/std/c.zig | 1 +
zig/lib/std/c/serenity.zig | 621 +++++++++++++++++++++++++++
zig/lib/std/c/serenity.zig | 709 +++++++++++++++++++++++++++
zig/lib/std/c/serenity/constants.zig | 6 +
zig/lib/std/debug.zig | 3 +-
zig/lib/std/fs.zig | 72 +++-
zig/lib/std/debug.zig | 5 +-
zig/lib/std/fs.zig | 79 ++-
zig/lib/std/fs/get_app_data_dir.zig | 2 +-
zig/lib/std/os.zig | 3 +-
zig/lib/std/os.zig | 4 +-
zig/lib/std/target.zig | 1 +
9 files changed, 705 insertions(+), 6 deletions(-)
9 files changed, 801 insertions(+), 8 deletions(-)
create mode 100644 zig/lib/std/c/serenity.zig
create mode 100644 zig/lib/std/c/serenity/constants.zig
diff --git a/zig/lib/std/Thread.zig b/zig/lib/std/Thread.zig
index 99e2feb4cf432d7fb323b62412e810a7b932d9a9..4dcc644b36cf99a7c18084c5ccdaeffa7723e7bd 100644
index 74f8e98df4bf212830933c150d6d7f0242007bda..fe8fc416fcb0c1ec4ec414c9f01e4d6639c1d87b 100644
--- a/zig/lib/std/Thread.zig
+++ b/zig/lib/std/Thread.zig
@@ -636,7 +636,7 @@ const PosixThreadImpl = struct {
@ -31,7 +31,7 @@ index 99e2feb4cf432d7fb323b62412e810a7b932d9a9..4dcc644b36cf99a7c18084c5ccdaeffa
// /dev/kstat via ioctls, and traverse a linked list for each
// cpu.
diff --git a/zig/lib/std/c.zig b/zig/lib/std/c.zig
index 149f3ab7e19919ad8d2b57988aa1db61213ea60d..d7720089a346f4c2ea8ef8f9aac15459b3fc2235 100644
index 66875eadd0347c930632254901d37f1b4f4fabcc..c78c8aa3d0daa67279a17c359870ac3052e43bb9 100644
--- a/zig/lib/std/c.zig
+++ b/zig/lib/std/c.zig
@@ -54,6 +54,7 @@ pub usingnamespace switch (builtin.os.tag) {
@ -44,13 +44,16 @@ index 149f3ab7e19919ad8d2b57988aa1db61213ea60d..d7720089a346f4c2ea8ef8f9aac15459
diff --git a/zig/lib/std/c/serenity.zig b/zig/lib/std/c/serenity.zig
new file mode 100644
index 0000000000000000000000000000000000000000..1c8dc37af9d528338d2c5543b5f3a47894264c0e
index 0000000000000000000000000000000000000000..d85d44ee1f0c71706f6c17f15183ece261a42e28
--- /dev/null
+++ b/zig/lib/std/c/serenity.zig
@@ -0,0 +1,621 @@
@@ -0,0 +1,709 @@
+const builtin = @import("builtin");
+pub const std = @import("std");
+pub const SerenityConstants = @import("serenity/constants.zig");
+
+const native_arch = builtin.cpu.arch;
+
+pub const fd_t = c_int;
+pub const dev_t = u64;
+pub const ino_t = u64;
@ -199,6 +202,9 @@ index 0000000000000000000000000000000000000000..1c8dc37af9d528338d2c5543b5f3a478
+ _,
+};
+
+// see Kernel/API/POSIX/sys/limits.h
+pub const HOST_NAME_MAX = SerenityConstants.HOST_NAME_MAX;
+pub const NAME_MAX = SerenityConstants.NAME_MAX;
+pub const PATH_MAX = SerenityConstants.PATH_MAX;
+
+pub const time_t = i64;
@ -295,6 +301,7 @@ index 0000000000000000000000000000000000000000..1c8dc37af9d528338d2c5543b5f3a478
+ pub const RAW = 255;
+};
+
+// see Kernel/API/POSIX/types.h
+pub const pthread_mutex_t = extern struct {
+ lock: u32 = 0,
+ owner: ?std.c.pthread_t = null,
@ -308,6 +315,10 @@ index 0000000000000000000000000000000000000000..1c8dc37af9d528338d2c5543b5f3a478
+ clockid: c_int = CLOCK.MONOTONIC_COARSE, // clockid_t
+};
+
+pub const pthread_rwlock_t = extern struct {
+ ptr: u64 = 0
+};
+
+pub const PTHREAD_STACK_MIN = SerenityConstants.PTHREAD_STACK_MIN;
+
+pub const uid_t = u32;
@ -410,6 +421,7 @@ index 0000000000000000000000000000000000000000..1c8dc37af9d528338d2c5543b5f3a478
+ pub const END = SerenityConstants.SEEK_END;
+};
+
+// see Kernel/API/POSIX/signal_numbers.h
+pub const SIG = struct {
+ pub const ABRT = SerenityConstants.SIGABRT;
+ pub const ALRM = SerenityConstants.SIGALRM;
@ -444,6 +456,11 @@ index 0000000000000000000000000000000000000000..1c8dc37af9d528338d2c5543b5f3a478
+ pub const WINCH = SerenityConstants.SIGWINCH;
+ pub const XCPU = SerenityConstants.SIGXCPU;
+ pub const XFSZ = SerenityConstants.SIGXFSZ;
+
+ // see Kernel/API/POSIX/signal.h
+ pub const ERR = @as(?Sigaction.handler_fn, @ptrFromInt(-1));
+ pub const DFL = @as(?Sigaction.handler_fn, @ptrFromInt(0));
+ pub const IGN = @as(?Sigaction.handler_fn, @ptrFromInt(1));
+};
+
+pub const sigval = extern union {
@ -475,7 +492,7 @@ index 0000000000000000000000000000000000000000..1c8dc37af9d528338d2c5543b5f3a478
+ sigaction: ?sigaction_fn,
+ },
+ mask: sigset_t,
+ flags: c_int,
+ flags: c_uint,
+};
+
+pub const SO = struct {
@ -507,14 +524,8 @@ index 0000000000000000000000000000000000000000..1c8dc37af9d528338d2c5543b5f3a478
+// see Kernel/API/POSIX/netinet/in.h
+pub const in_port_t = u16;
+
+pub const in_addr = extern struct {
+ addr: u32,
+};
+
+pub const in6_addr = extern union {
+ addr: [16]u8,
+ addr32: [4]u32,
+};
+pub const in_addr = u32;
+pub const in6_addr = [16]u8;
+
+// see Kernel/API/POSIX/sys/socket.h
+pub const sockaddr = extern struct {
@ -562,7 +573,27 @@ index 0000000000000000000000000000000000000000..1c8dc37af9d528338d2c5543b5f3a478
+ pub const RDHUP = SerenityConstants.POLLRDHUP;
+};
+
+// see Kernel/API/POSIX/signal.h
+pub const SA = struct {
+ pub const NOCLDSTOP = SerenityConstants.SA_NOCLDSTOP;
+ pub const NOCLDWAIT = SerenityConstants.SA_NOCLDWAIT;
+ pub const SIGINFO = SerenityConstants.SA_SIGINFO;
+ pub const RESTART = SerenityConstants.SA_RESTART;
+ pub const RESETHAND = SerenityConstants.SA_RESETHAND;
+ pub const ONSTACK = SerenityConstants.SA_ONSTACK;
+ pub const NODEFER = SerenityConstants.SA_NODEFER;
+
+ // see Toolchain/Tarballs/gcc-13.1.0/libsanitizer/sanitizer_common/sanitizer_linux.cpp
+ pub const RESTORER = 0x04000000;
+};
+
+//see Kernel/API/POSIX/sys/socket.h
+pub const SHUT = struct {
+ pub const RD = SerenityConstants.SHUT_RD;
+ pub const WR = SerenityConstants.SHUT_WR;
+ pub const RDWR = SerenityConstants.SHUT_RDWR;
+};
+
+pub const SOCK = struct {
+ pub const TYPE_MASK = 0xff;
+ pub const STREAM = 1;
@ -582,6 +613,63 @@ index 0000000000000000000000000000000000000000..1c8dc37af9d528338d2c5543b5f3a478
+
+pub const nfds_t = c_uint;
+
+// see Userland/Libraries/LibC/signal.h
+pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int;
+
+// see Kernel/API/POSIX/signal.h
+pub const stack_t = struct {
+ sp: *anyopaque,
+ flags: c_int,
+ size: usize
+};
+
+pub const mcontext_t = switch (native_arch) {
+ .x86_64 =>
+ // see Kernel/Arch/x86_64/mcontext.h
+ struct {
+ rax: u64,
+ rcx: u64,
+ rdx: u64,
+ rbx: u64,
+ rsp: u64,
+ rbp: u64,
+ rsi: u64,
+ rdi: u64,
+ rip: u64,
+ r8: u64,
+ r9: u64,
+ r10: u64,
+ r11: u64,
+ r12: u64,
+ r13: u64,
+ r14: u64,
+ r15: u64,
+ rflags: u64,
+ cs: u32,
+ ss: u32,
+ ds: u32,
+ es: u32,
+ fs: u32,
+ gs: u32
+ },
+ .aarch64 =>
+ // see Kernel/Arch/aarch64/mcontext.h
+ struct {
+ x: [31]u64,
+ sp: u64,
+ pc: u64
+ },
+ else => @compileError("Arch {native_arch} not implemented for serenity")
+};
+
+// see Kernel/API/POSIX/ucontext.h
+pub const ucontext_t = struct {
+ uc_link: *ucontext_t,
+ uc_sigmask: sigset_t,
+ uc_stack: stack_t,
+ uc_mcontext: mcontext_t
+};
+
+pub const W = struct {
+ pub const NOHANG = SerenityConstants.WNOHANG;
+ pub const UNTRACED = SerenityConstants.WUNTRACED;
@ -682,10 +770,19 @@ index 0000000000000000000000000000000000000000..94d7b1c091f7affb5c968738a8719cbb
+ );
+}
diff --git a/zig/lib/std/debug.zig b/zig/lib/std/debug.zig
index 44f6ce136759b773e2426656aa9907b5fc51d9fc..9b5f6f993ef870689d31a8ee99bb358b4d25278d 100644
index 6de21ddd1be833db60a8460cfe15ca6cd36fb90a..ff8465975624ec09453f62824ee5d75bc8d0be4a 100644
--- a/zig/lib/std/debug.zig
+++ b/zig/lib/std/debug.zig
@@ -771,6 +771,7 @@ pub fn openSelfDebugInfo(allocator: mem.Allocator) OpenSelfDebugInfoError!DebugI
@@ -167,7 +167,7 @@ pub fn relocateContext(context: *ThreadContext) void {
};
}
-pub const have_getcontext = @hasDecl(os.system, "getcontext") and
+pub const have_getcontext = @hasDecl(os.system, "getcontext") and builtin.os.tag != .serenity and
builtin.os.tag != .openbsd and
(builtin.os.tag != .linux or switch (builtin.cpu.arch) {
.x86,
@@ -984,6 +984,7 @@ pub fn openSelfDebugInfo(allocator: mem.Allocator) OpenSelfDebugInfoError!DebugI
.dragonfly,
.openbsd,
.macos,
@ -693,7 +790,7 @@ index 44f6ce136759b773e2426656aa9907b5fc51d9fc..9b5f6f993ef870689d31a8ee99bb358b
.solaris,
.windows,
=> return try DebugInfo.init(allocator),
@@ -1748,7 +1749,7 @@ pub const ModuleDebugInfo = switch (native_os) {
@@ -2223,7 +2224,7 @@ pub const ModuleDebugInfo = switch (native_os) {
};
}
},
@ -703,19 +800,28 @@ index 44f6ce136759b773e2426656aa9907b5fc51d9fc..9b5f6f993ef870689d31a8ee99bb358b
dwarf: DW.DwarfInfo,
mapped_memory: []align(mem.page_size) const u8,
diff --git a/zig/lib/std/fs.zig b/zig/lib/std/fs.zig
index cb6ce2032ec7e2f2bc720f354558bb5335ae7d24..3894bc6dfc4bb383f7055dd4a264e9f9e2132d76 100644
index f01bcb4f22c86a7a237fb43fa219ba6071c646d3..8beea7604a3965e322706e329476609a8ff198ac 100644
--- a/zig/lib/std/fs.zig
+++ b/zig/lib/std/fs.zig
@@ -39,7 +39,7 @@ pub const Watch = @import("fs/watch.zig").Watch;
/// fit into a UTF-8 encoded array of this length.
/// The byte count includes room for a null sentinel byte.
pub const MAX_PATH_BYTES = switch (builtin.os.tag) {
- .linux, .macos, .ios, .freebsd, .openbsd, .netbsd, .dragonfly, .haiku, .solaris => os.PATH_MAX,
+ .linux, .macos, .ios, .freebsd, .openbsd, .netbsd, .dragonfly, .haiku, .solaris, .serenity => os.PATH_MAX,
- .linux, .macos, .ios, .freebsd, .openbsd, .netbsd, .dragonfly, .haiku, .solaris, .plan9 => os.PATH_MAX,
+ .linux, .macos, .ios, .freebsd, .openbsd, .netbsd, .dragonfly, .haiku, .solaris, .plan9, .serenity => os.PATH_MAX,
// Each UTF-16LE character may be expanded to 3 UTF-8 bytes.
// If it would require 4 UTF-8 bytes, then there would be a surrogate
// pair in the UTF-16LE, and we (over)account 3 bytes for it that way.
@@ -528,6 +528,69 @@ pub const IterableDir = struct {
@@ -59,7 +59,7 @@ pub const MAX_PATH_BYTES = switch (builtin.os.tag) {
/// (depending on the platform) this assumption may not hold for every configuration.
/// The byte count does not include a null sentinel byte.
pub const MAX_NAME_BYTES = switch (builtin.os.tag) {
- .linux, .macos, .ios, .freebsd, .openbsd, .netbsd, .dragonfly => os.NAME_MAX,
+ .linux, .macos, .ios, .freebsd, .openbsd, .netbsd, .dragonfly, .serenity => os.NAME_MAX,
// Haiku's NAME_MAX includes the null terminator, so subtract one.
.haiku => os.NAME_MAX - 1,
.solaris => os.system.MAXNAMLEN,
@@ -528,6 +528,74 @@ pub const IterableDir = struct {
self.first_iter = true;
}
},
@ -781,11 +887,16 @@ index cb6ce2032ec7e2f2bc720f354558bb5335ae7d24..3894bc6dfc4bb383f7055dd4a264e9f9
+ };
+ }
+ }
+
+ pub fn reset(self: *Self) void {
+ // FIXME: Very small chance this may fail.
+ self.dir_ptr = os.system.fdopendir(self.dir.fd).?;
+ }
+ },
.haiku => struct {
dir: Dir,
buf: [1024]u8, // TODO align(@alignOf(os.dirent64)),
@@ -913,6 +976,11 @@ pub const IterableDir = struct {
@@ -913,6 +981,11 @@ pub const IterableDir = struct {
.buf = undefined,
.first_iter = first_iter_start_value,
},
@ -797,7 +908,7 @@ index cb6ce2032ec7e2f2bc720f354558bb5335ae7d24..3894bc6dfc4bb383f7055dd4a264e9f9
.windows => return Iterator{
.dir = self.dir,
.index = 0,
@@ -2993,7 +3061,7 @@ pub fn selfExePath(out_buffer: []u8) SelfExePathError![]u8 {
@@ -3004,7 +3077,7 @@ pub fn selfExePath(out_buffer: []u8) SelfExePathError![]u8 {
return result;
}
switch (builtin.os.tag) {
@ -820,10 +931,10 @@ index 2f599c32130e2be12f44fa015df91816614d5f5b..896dde5ab8e0e573dc137d9a86be8298
return fs.path.join(allocator, &[_][]const u8{ xdg, appname });
}
diff --git a/zig/lib/std/os.zig b/zig/lib/std/os.zig
index cb988ca9a8e67f1c3c383a0b2a74bda7b0e14152..0c740baadaeb045c0c01dc7be92f3472b01afa17 100644
index e4ac38051e3558ec796f9eefc96c5d8950425e3f..188c0f490bf10d588fbf4c6040bde416b88decf8 100644
--- a/zig/lib/std/os.zig
+++ b/zig/lib/std/os.zig
@@ -35,6 +35,7 @@ pub const freebsd = std.c;
@@ -32,6 +32,7 @@ pub const freebsd = std.c;
pub const haiku = std.c;
pub const netbsd = std.c;
pub const openbsd = std.c;
@ -831,7 +942,15 @@ index cb988ca9a8e67f1c3c383a0b2a74bda7b0e14152..0c740baadaeb045c0c01dc7be92f3472
pub const solaris = std.c;
pub const linux = @import("os/linux.zig");
pub const plan9 = @import("os/plan9.zig");
@@ -5205,7 +5206,7 @@ pub fn getFdPath(fd: fd_t, out_buffer: *[MAX_PATH_BYTES]u8) RealPathError![]u8 {
@@ -5179,6 +5180,7 @@ pub fn isGetFdPathSupportedOnTarget(os: std.Target.Os) bool {
.linux,
.solaris,
.freebsd,
+ .serenity,
=> true,
// zig fmt: on
.dragonfly => os.version_range.semver.max.order(.{ .major = 6, .minor = 0, .patch = 0 }) != .lt,
@@ -5219,7 +5221,7 @@ pub fn getFdPath(fd: fd_t, out_buffer: *[MAX_PATH_BYTES]u8) RealPathError![]u8 {
const len = mem.indexOfScalar(u8, out_buffer[0..], @as(u8, 0)) orelse MAX_PATH_BYTES;
return out_buffer[0..len];
},
@ -841,10 +960,10 @@ index cb988ca9a8e67f1c3c383a0b2a74bda7b0e14152..0c740baadaeb045c0c01dc7be92f3472
const proc_path = std.fmt.bufPrintZ(procfs_buf[0..], "/proc/self/fd/{d}", .{fd}) catch unreachable;
diff --git a/zig/lib/std/target.zig b/zig/lib/std/target.zig
index b137e48c02d7d7ecc0f5eae61f6225504bf0ba3d..956edd944f587759ae04f69d477447f96441367c 100644
index 608f0e958144fc53dfb67fa2efa29690a60599ba..08dc72f28c8bd06137b46510dffeae6a8358cce7 100644
--- a/zig/lib/std/target.zig
+++ b/zig/lib/std/target.zig
@@ -2079,6 +2079,7 @@ pub const Target = struct {
@@ -2121,6 +2121,7 @@ pub const Target = struct {
.ananas,
.fuchsia,
.minix,

View file

@ -8,7 +8,7 @@ Subject: [PATCH] build: Adjust build process for SerenityOS
1 file changed, 52 insertions(+), 1 deletion(-)
diff --git a/build b/build
index 71b49cf828bc7f224a3a5dd0533fb4d4ccb873db..aae2f445209bbab53670a4809293e22e8a5091c0 100755
index b1917f6bb18a587d9b5e98171c9f789d9a29aff6..e7d809893e46e247a579050ac61091a78c6b90a5 100755
--- a/build
+++ b/build
@@ -17,6 +17,7 @@ case $TARGET_OS_CMAKE in

View file

@ -8,7 +8,7 @@ Subject: [PATCH] build: Remove unsupported zig linker flag -z seperate-code
1 file changed, 1 insertion(+)
diff --git a/build b/build
index aae2f445209bbab53670a4809293e22e8a5091c0..31754a58c596a80bcb302b98faae15c88ebe798b 100755
index e7d809893e46e247a579050ac61091a78c6b90a5..bf53f9ecca8fc15b9a80bd3c13b7c551f77979df 100755
--- a/build
+++ b/build
@@ -190,6 +190,7 @@ cmake "$ROOTDIR/llvm" \

View file

@ -6,14 +6,14 @@ Subject: [PATCH] docgen: Filter ZIG_LIBC from the environment
This environment variable can leak into the doctest builds and cause
them to look for the host libraries in the target libc locations.
---
zig/doc/docgen.zig | 5 +++++
zig/tools/docgen.zig | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/zig/doc/docgen.zig b/zig/doc/docgen.zig
index 675dcccf70b599600112fd894e7b4bc3a38ad52f..1b0ba0e2775cb16e3bf324d4045d90ab6b81fee5 100644
--- a/zig/doc/docgen.zig
+++ b/zig/doc/docgen.zig
@@ -1307,6 +1307,11 @@ fn genHtml(
diff --git a/zig/tools/docgen.zig b/zig/tools/docgen.zig
index e3a6aecabe170605bc5bfb54ff596ce6c8a16145..b23dc47ee5821f6e4a131109330110ecbd1716cd 100644
--- a/zig/tools/docgen.zig
+++ b/zig/tools/docgen.zig
@@ -1309,6 +1309,11 @@ fn genHtml(
var env_map = try process.getEnvMap(allocator);
try env_map.put("YES_COLOR", "1");

View file

@ -1,22 +1,22 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: sin-ack <sin-ack@users.noreply.github.com>
Date: Mon, 17 Jul 2023 03:26:04 +0300
Subject: [PATCH] build: Set Zig version to 0.11.0-dev.4003+c6aa29b6f
Subject: [PATCH] build: Set Zig version to 0.12.0-dev.141+ddf5859c2
---
build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/build b/build
index 31754a58c596a80bcb302b98faae15c88ebe798b..ce4ded52344a89fbad56141c5ad30b11f46d4527 100755
index bf53f9ecca8fc15b9a80bd3c13b7c551f77979df..4b70377b43a35a1ba48ed50f1b29326798ab7c17 100755
--- a/build
+++ b/build
@@ -6,7 +6,7 @@ TARGET="$1" # Example: riscv64-linux-gnu
MCPU="$2" # Examples: `baseline`, `native`, `generic+v7a`, or `arm1176jzf_s`
ROOTDIR="$(pwd)"
-ZIG_VERSION="0.11.0-dev.2680+a1aa55ebe"
+ZIG_VERSION="0.11.0-dev.4003+c6aa29b6f"
-ZIG_VERSION="0.11.0"
+ZIG_VERSION="0.12.0-dev.141+ddf5859c2"
TARGET_OS_AND_ABI=${TARGET#*-} # Example: linux-gnu

View file

@ -23,6 +23,8 @@ This makes the compiler look for libraries and headers in the right
places, and enables some security mitigations like stack-smashing
protection and position-independent code by default.
Co-authored-by: kleines Filmröllchen <filmroellchen@serenityos.org>
## `0004-Driver-Default-to-ftls-model-initial-exec-on-Serenit.patch`
Default to -ftls-model=initial-exec on SerenityOS
@ -120,8 +122,8 @@ docgen: Filter ZIG_LIBC from the environment
This environment variable can leak into the doctest builds and cause
them to look for the host libraries in the target libc locations.
## `0017-build-Set-Zig-version-to-0.11.0-dev.4003-c6aa29b6f.patch`
## `0017-build-Set-Zig-version-to-0.12.0-dev.141-ddf5859c2.patch`
build: Set Zig version to 0.11.0-dev.4003+c6aa29b6f
build: Set Zig version to 0.12.0-dev.141+ddf5859c2

View file

@ -99,6 +99,7 @@ F_SETFD
F_SETFL
F_SETLK
F_SETLKW
HOST_NAME_MAX
IOV_MAX
LOCK_EX
LOCK_NB
@ -118,6 +119,7 @@ MAP_STACK
MS_ASYNC
MS_INVALIDATE
MS_SYNC
NAME_MAX
O_ACCMODE
O_APPEND
O_CLOEXEC
@ -151,9 +153,19 @@ PROT_READ
PROT_WRITE
PTHREAD_STACK_MIN
R_OK
SA_NOCLDSTOP
SA_NOCLDWAIT
SA_SIGINFO
SA_RESTART
SA_RESETHAND
SA_ONSTACK
SA_NODEFER
SEEK_CUR
SEEK_END
SEEK_SET
SHUT_RD
SHUT_WR
SHUT_RDWR
SIGABRT
SIGALRM
SIGBUS