From 965ff8fccf3afa1da6343ae21911b1be9f3b55c3 Mon Sep 17 00:00:00 2001 From: Wildan Mubarok Date: Mon, 4 Aug 2025 10:10:21 +0000 Subject: [PATCH 1/3] Update zig recipe --- recipes/wip/dev/lang/zig/01_redox.patch | 83 +++++++++++++++++++++++++ recipes/wip/dev/lang/zig/recipe.toml | 26 ++++---- 2 files changed, 94 insertions(+), 15 deletions(-) create mode 100644 recipes/wip/dev/lang/zig/01_redox.patch diff --git a/recipes/wip/dev/lang/zig/01_redox.patch b/recipes/wip/dev/lang/zig/01_redox.patch new file mode 100644 index 00000000..093eb2f4 --- /dev/null +++ b/recipes/wip/dev/lang/zig/01_redox.patch @@ -0,0 +1,83 @@ +diff -ruwN source/build.zig source-new/build.zig +--- source/build.zig 2025-05-23 11:31:41 ++++ source-new/build.zig 2025-08-04 17:06:57 +@@ -802,7 +802,7 @@ + try addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), null, need_cpp_includes); + try addCxxKnownPath(b, cfg, exe, b.fmt("libgcc_eh.{s}", .{lib_suffix}), null, need_cpp_includes); + }, +- .haiku => { ++ .haiku, .redox => { + try addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), null, need_cpp_includes); + }, + else => {}, +diff -ruwN source/lib/std/Target.zig source-new/lib/std/Target.zig +--- source/lib/std/Target.zig 2025-05-23 11:31:41 ++++ source-new/lib/std/Target.zig 2025-08-04 16:59:08 +@@ -29,6 +29,7 @@ + hurd, + linux, + plan9, ++ redox, + rtems, + serenity, + zos, +@@ -904,6 +905,7 @@ + .fuchsia, + .hermit, + .plan9, ++ .redox, + .serenity, + .zos, + .dragonfly, +@@ -2435,6 +2437,16 @@ + else + "/usr", + }) else none, ++ ++ .redox => switch (cpu.arch) { ++ .x86, ++ => init("/usr/lib/ld.so.1"), ++ .aarch64, ++ .riscv64, ++ .x86_64, ++ => init("/usr/lib/ld64.so.1"), ++ else => none, ++ }, + + .freebsd => switch (cpu.arch) { + .arm, +diff -ruwN source/test/llvm_targets.zig source-new/test/llvm_targets.zig +--- source/test/llvm_targets.zig 2025-05-23 11:31:41 ++++ source-new/test/llvm_targets.zig 2025-08-04 17:02:56 +@@ -20,6 +20,7 @@ + .{ .cpu_arch = .aarch64, .os_tag = .macos, .abi = .none }, + .{ .cpu_arch = .aarch64, .os_tag = .netbsd, .abi = .none }, + .{ .cpu_arch = .aarch64, .os_tag = .openbsd, .abi = .none }, ++ .{ .cpu_arch = .aarch64, .os_tag = .redox, .abi = .none }, + .{ .cpu_arch = .aarch64, .os_tag = .rtems, .abi = .none }, + .{ .cpu_arch = .aarch64, .os_tag = .serenity, .abi = .none }, + .{ .cpu_arch = .aarch64, .os_tag = .tvos, .abi = .none }, +@@ -238,6 +239,7 @@ + .{ .cpu_arch = .riscv64, .os_tag = .linux, .abi = .none }, + .{ .cpu_arch = .riscv64, .os_tag = .netbsd, .abi = .none }, + .{ .cpu_arch = .riscv64, .os_tag = .openbsd, .abi = .none }, ++ .{ .cpu_arch = .riscv64, .os_tag = .redox, .abi = .none }, + .{ .cpu_arch = .riscv64, .os_tag = .rtems, .abi = .none }, + .{ .cpu_arch = .riscv64, .os_tag = .serenity, .abi = .none }, + // .{ .cpu_arch = .riscv64, .os_tag = .uefi, .abi = .none }, +@@ -325,6 +327,7 @@ + .{ .cpu_arch = .x86, .os_tag = .linux, .abi = .none }, + .{ .cpu_arch = .x86, .os_tag = .netbsd, .abi = .none }, + .{ .cpu_arch = .x86, .os_tag = .openbsd, .abi = .none }, ++ .{ .cpu_arch = .x86, .os_tag = .redox, .abi = .none }, + .{ .cpu_arch = .x86, .os_tag = .rtems, .abi = .none }, + .{ .cpu_arch = .x86, .os_tag = .solaris, .abi = .none }, + .{ .cpu_arch = .x86, .os_tag = .uefi, .abi = .none }, +@@ -361,6 +364,7 @@ + .{ .cpu_arch = .x86_64, .os_tag = .macos, .abi = .none }, + .{ .cpu_arch = .x86_64, .os_tag = .netbsd, .abi = .none }, + .{ .cpu_arch = .x86_64, .os_tag = .openbsd, .abi = .none }, ++ .{ .cpu_arch = .x86_64, .os_tag = .redox, .abi = .none }, + .{ .cpu_arch = .x86_64, .os_tag = .rtems, .abi = .none }, + .{ .cpu_arch = .x86_64, .os_tag = .serenity, .abi = .none }, + .{ .cpu_arch = .x86_64, .os_tag = .solaris, .abi = .none }, diff --git a/recipes/wip/dev/lang/zig/recipe.toml b/recipes/wip/dev/lang/zig/recipe.toml index 90ceedba..c88b9070 100644 --- a/recipes/wip/dev/lang/zig/recipe.toml +++ b/recipes/wip/dev/lang/zig/recipe.toml @@ -1,20 +1,16 @@ -#TODO probably wrong script, see https://github.com/ziglang/zig/wiki/Building-Zig-From-Source +#TODO see https://github.com/ziglang/zig/wiki/Building-Zig-From-Source [source] -tar = "https://ziglang.org/download/0.10.1/zig-0.10.1.tar.xz" +tar = "https://ziglang.org/download/0.14.1/zig-0.14.1.tar.xz" +patches = [ + "01_redox.patch" +] + [build] +dependencies = [ + "llvm18" # need lld +] template = "custom" script = """ -COOKBOOK_CONFIGURE="cmake" -COOKBOOK_CONFIGURE_FLAGS=( - -DCMAKE_BUILD_TYPE=Release - -DCMAKE_CROSSCOMPILING=True - -DCMAKE_EXE_LINKER_FLAGS="-static" - -DCMAKE_INSTALL_PREFIX="/" - -DCMAKE_PREFIX_PATH="${COOKBOOK_SYSROOT}" - -DCMAKE_SYSTEM_NAME=Generic - -DCMAKE_SYSTEM_PROCESSOR="$(echo "${TARGET}" | cut -d - -f1)" - -DCMAKE_VERBOSE_MAKEFILE=On -"${COOKBOOK_SOURCE}" -) -cookbook_configure +DYNAMIC_INIT +cookbook_cmake """ From 70fba227648048eab36c695495ad5fc67e8cbc5f Mon Sep 17 00:00:00 2001 From: Wildan Mubarok Date: Thu, 4 Sep 2025 11:48:00 +0000 Subject: [PATCH 2/3] Use fork instead --- recipes/wip/dev/lang/zig/01_redox.patch | 83 ------------------------- recipes/wip/dev/lang/zig/recipe.toml | 23 ++++--- 2 files changed, 14 insertions(+), 92 deletions(-) delete mode 100644 recipes/wip/dev/lang/zig/01_redox.patch diff --git a/recipes/wip/dev/lang/zig/01_redox.patch b/recipes/wip/dev/lang/zig/01_redox.patch deleted file mode 100644 index 093eb2f4..00000000 --- a/recipes/wip/dev/lang/zig/01_redox.patch +++ /dev/null @@ -1,83 +0,0 @@ -diff -ruwN source/build.zig source-new/build.zig ---- source/build.zig 2025-05-23 11:31:41 -+++ source-new/build.zig 2025-08-04 17:06:57 -@@ -802,7 +802,7 @@ - try addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), null, need_cpp_includes); - try addCxxKnownPath(b, cfg, exe, b.fmt("libgcc_eh.{s}", .{lib_suffix}), null, need_cpp_includes); - }, -- .haiku => { -+ .haiku, .redox => { - try addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), null, need_cpp_includes); - }, - else => {}, -diff -ruwN source/lib/std/Target.zig source-new/lib/std/Target.zig ---- source/lib/std/Target.zig 2025-05-23 11:31:41 -+++ source-new/lib/std/Target.zig 2025-08-04 16:59:08 -@@ -29,6 +29,7 @@ - hurd, - linux, - plan9, -+ redox, - rtems, - serenity, - zos, -@@ -904,6 +905,7 @@ - .fuchsia, - .hermit, - .plan9, -+ .redox, - .serenity, - .zos, - .dragonfly, -@@ -2435,6 +2437,16 @@ - else - "/usr", - }) else none, -+ -+ .redox => switch (cpu.arch) { -+ .x86, -+ => init("/usr/lib/ld.so.1"), -+ .aarch64, -+ .riscv64, -+ .x86_64, -+ => init("/usr/lib/ld64.so.1"), -+ else => none, -+ }, - - .freebsd => switch (cpu.arch) { - .arm, -diff -ruwN source/test/llvm_targets.zig source-new/test/llvm_targets.zig ---- source/test/llvm_targets.zig 2025-05-23 11:31:41 -+++ source-new/test/llvm_targets.zig 2025-08-04 17:02:56 -@@ -20,6 +20,7 @@ - .{ .cpu_arch = .aarch64, .os_tag = .macos, .abi = .none }, - .{ .cpu_arch = .aarch64, .os_tag = .netbsd, .abi = .none }, - .{ .cpu_arch = .aarch64, .os_tag = .openbsd, .abi = .none }, -+ .{ .cpu_arch = .aarch64, .os_tag = .redox, .abi = .none }, - .{ .cpu_arch = .aarch64, .os_tag = .rtems, .abi = .none }, - .{ .cpu_arch = .aarch64, .os_tag = .serenity, .abi = .none }, - .{ .cpu_arch = .aarch64, .os_tag = .tvos, .abi = .none }, -@@ -238,6 +239,7 @@ - .{ .cpu_arch = .riscv64, .os_tag = .linux, .abi = .none }, - .{ .cpu_arch = .riscv64, .os_tag = .netbsd, .abi = .none }, - .{ .cpu_arch = .riscv64, .os_tag = .openbsd, .abi = .none }, -+ .{ .cpu_arch = .riscv64, .os_tag = .redox, .abi = .none }, - .{ .cpu_arch = .riscv64, .os_tag = .rtems, .abi = .none }, - .{ .cpu_arch = .riscv64, .os_tag = .serenity, .abi = .none }, - // .{ .cpu_arch = .riscv64, .os_tag = .uefi, .abi = .none }, -@@ -325,6 +327,7 @@ - .{ .cpu_arch = .x86, .os_tag = .linux, .abi = .none }, - .{ .cpu_arch = .x86, .os_tag = .netbsd, .abi = .none }, - .{ .cpu_arch = .x86, .os_tag = .openbsd, .abi = .none }, -+ .{ .cpu_arch = .x86, .os_tag = .redox, .abi = .none }, - .{ .cpu_arch = .x86, .os_tag = .rtems, .abi = .none }, - .{ .cpu_arch = .x86, .os_tag = .solaris, .abi = .none }, - .{ .cpu_arch = .x86, .os_tag = .uefi, .abi = .none }, -@@ -361,6 +364,7 @@ - .{ .cpu_arch = .x86_64, .os_tag = .macos, .abi = .none }, - .{ .cpu_arch = .x86_64, .os_tag = .netbsd, .abi = .none }, - .{ .cpu_arch = .x86_64, .os_tag = .openbsd, .abi = .none }, -+ .{ .cpu_arch = .x86_64, .os_tag = .redox, .abi = .none }, - .{ .cpu_arch = .x86_64, .os_tag = .rtems, .abi = .none }, - .{ .cpu_arch = .x86_64, .os_tag = .serenity, .abi = .none }, - .{ .cpu_arch = .x86_64, .os_tag = .solaris, .abi = .none }, diff --git a/recipes/wip/dev/lang/zig/recipe.toml b/recipes/wip/dev/lang/zig/recipe.toml index c88b9070..f5103b29 100644 --- a/recipes/wip/dev/lang/zig/recipe.toml +++ b/recipes/wip/dev/lang/zig/recipe.toml @@ -1,16 +1,21 @@ -#TODO see https://github.com/ziglang/zig/wiki/Building-Zig-From-Source +#TODO requires openat functions and posix_getdents to compile [source] -tar = "https://ziglang.org/download/0.14.1/zig-0.14.1.tar.xz" -patches = [ - "01_redox.patch" -] +git = "https://github.com/willnode/zig" +branch = "zig-0.15-redox" [build] -dependencies = [ - "llvm18" # need lld -] template = "custom" script = """ DYNAMIC_INIT -cookbook_cmake +rsync -av --delete "${COOKBOOK_SOURCE}"/* ./ +export ZIG_BOOTSTRAP_CFLAGS="$CFLAGS" +export ZIG_BOOTSTRAP_LDFLAGS="$LDFLAGS" +export ZIG_BOOTSTRAP_TARGET_CC="${TARGET}-gcc" +export ZIG_HOST_TARGET_TRIPLE="${TARGET%%-*}-redox" +unset AR AS CC CXX LD LDFLAGS NM OBJCOPY OBJDUMP RANLIB READELF RUSTFLAGS STRIP +cc bootstrap.c -o ./bootstrap +./bootstrap + +mkdir -pv "${COOKBOOK_STAGE}/usr/bin" +cp -v "zig2" "${COOKBOOK_STAGE}/usr/bin/zig" """ From c37ddfdfe33e1ee04f3a9323bfdd05083983f974 Mon Sep 17 00:00:00 2001 From: Wildan Mubarok Date: Sun, 7 Sep 2025 18:18:18 +0000 Subject: [PATCH 3/3] Update zig, and go notes --- recipes/wip/dev/lang/go/recipe.toml | 2 +- recipes/wip/dev/lang/zig/recipe.toml | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/recipes/wip/dev/lang/go/recipe.toml b/recipes/wip/dev/lang/go/recipe.toml index 97b80f53..20dd03b5 100644 --- a/recipes/wip/dev/lang/go/recipe.toml +++ b/recipes/wip/dev/lang/go/recipe.toml @@ -1,4 +1,4 @@ -#TODO: Can be built, but ends in breakpoint trap +#TODO compiling, not tested further [source] git = "https://github.com/willnode/go" branch = "go-1.25-redox" diff --git a/recipes/wip/dev/lang/zig/recipe.toml b/recipes/wip/dev/lang/zig/recipe.toml index f5103b29..5c9d26f7 100644 --- a/recipes/wip/dev/lang/zig/recipe.toml +++ b/recipes/wip/dev/lang/zig/recipe.toml @@ -1,4 +1,4 @@ -#TODO requires openat functions and posix_getdents to compile +#TODO compiling, not tested further [source] git = "https://github.com/willnode/zig" branch = "zig-0.15-redox" @@ -8,14 +8,15 @@ template = "custom" script = """ DYNAMIC_INIT rsync -av --delete "${COOKBOOK_SOURCE}"/* ./ -export ZIG_BOOTSTRAP_CFLAGS="$CFLAGS" -export ZIG_BOOTSTRAP_LDFLAGS="$LDFLAGS" -export ZIG_BOOTSTRAP_TARGET_CC="${TARGET}-gcc" + +export ZIG_HOST_TARGET_CFLAGS="$CFLAGS" +export ZIG_HOST_TARGET_LDFLAGS="$LDFLAGS" +export ZIG_HOST_TARGET_CC="${TARGET}-gcc" export ZIG_HOST_TARGET_TRIPLE="${TARGET%%-*}-redox" unset AR AS CC CXX LD LDFLAGS NM OBJCOPY OBJDUMP RANLIB READELF RUSTFLAGS STRIP cc bootstrap.c -o ./bootstrap ./bootstrap -mkdir -pv "${COOKBOOK_STAGE}/usr/bin" -cp -v "zig2" "${COOKBOOK_STAGE}/usr/bin/zig" +mkdir -p "${COOKBOOK_STAGE}"/usr/bin +cp ./zig2 "${COOKBOOK_STAGE}"/usr/bin/zig """