From 28b9621f176d7eab33794f1cbff5519072221f32 Mon Sep 17 00:00:00 2001 From: vasilito Date: Fri, 19 Jun 2026 03:35:28 +0300 Subject: [PATCH] fix: uutils-tar build + ncurses patch for ncurses-6.6 uutils-tar (WIP recipe): - Pin to commit 8ecd8e0 (rust-version 1.85.0, compatible with our nightly-2025-10-03 toolchain) - Fix nix-0.30.1 Redox bug: SaFlags_t declared as c_ulong but libc-0.2.184 defines SA_*/sa_flags as c_int. Patch SaFlags_t to c_int. - Enable nix pty module for Redox (relibc has all POSIX PTY functions) - Add forkpty to libc-0.2.184 Redox module (relibc's pty.h defines it but libc crate doesn't expose it) ncurses: - Remove obsolete first hunk from redox.patch (cf_includedir lines already removed in ncurses-6.6). Keep second hunk (redox* platform detection). --- recipes/libs/ncurses/redox.patch | 11 +------ recipes/wip/rs/uutils-tar/recipe.toml | 43 +++++++++++++++++++++++++-- 2 files changed, 42 insertions(+), 12 deletions(-) diff --git a/recipes/libs/ncurses/redox.patch b/recipes/libs/ncurses/redox.patch index 5d059649d5..f98c5c8ad6 100644 --- a/recipes/libs/ncurses/redox.patch +++ b/recipes/libs/ncurses/redox.patch @@ -1,15 +1,6 @@ diff -ruwN source/configure source-new/configure --- source/configure 2022-11-06 04:13:26.000000000 +0700 -+++ source-new/configure 2026-02-17 13:42:38.449890407 +0700 -@@ -3480,8 +3480,6 @@ - echo $ECHO_N "checking if $CXX works... $ECHO_C" >&6 - - save_CPPFLAGS="$CPPFLAGS" -- eval cf_includedir=${includedir} -- CPPFLAGS="$CPPFLAGS -I${cf_includedir}" - - cat >"conftest.$ac_ext" <<_ACEOF - #line 3487 "configure" ++++ source-new/configure 2026-06-19 00:00:00.000000000 +0700 @@ -6386,7 +6384,7 @@ fi cf_cv_rm_so_locs=yes diff --git a/recipes/wip/rs/uutils-tar/recipe.toml b/recipes/wip/rs/uutils-tar/recipe.toml index 6e67b6bbba..48008e7e72 100644 --- a/recipes/wip/rs/uutils-tar/recipe.toml +++ b/recipes/wip/rs/uutils-tar/recipe.toml @@ -1,6 +1,45 @@ #TODO not compiled or tested [source] git = "https://github.com/uutils/tar" -shallow_clone = true +rev = "8ecd8e0bfde251de26df450efcec2da45135af9c" [build] -template = "cargo" +template = "custom" +script = """ +DYNAMIC_INIT + +# nix-0.30.1 has three Redox bugs: +# 1. SaFlags_t is c_ulong (u64) but libc-0.2.184 defines SA_* and sa_flags +# as c_int (i32). Fix: change SaFlags_t to c_int for Redox. +# 2. The pty module is excluded for Redox (cfg(not(any(redox, fuchsia)))), +# but relibc now has all POSIX PTY functions. Fix: remove Redox exclusion. +# 3. libc-0.2.184 doesn't expose forkpty for Redox, but relibc's pty.h +# defines it. Fix: add forkpty declaration to libc Redox module. +for nix_src in /home/kellito/.cargo/registry/src/*/nix-0.30.1; do + if [ -f "$nix_src/src/sys/signal.rs" ]; then + # Fix 1: SaFlags_t type mismatch + sed -i 's/type SaFlags_t = libc::c_ulong;/type SaFlags_t = libc::c_int;/' \ + "$nix_src/src/sys/signal.rs" + fi + if [ -f "$nix_src/src/lib.rs" ]; then + # Fix 2: Enable pty module for Redox + sed -i 's/#\\[cfg(not(any(target_os = "redox", target_os = "fuchsia")))\\]/#[cfg(not(target_os = "fuchsia"))]/' \ + "$nix_src/src/lib.rs" + fi +done + +# Fix 3: Add forkpty to libc Redox module (relibc's pty.h defines it) +for libc_src in /home/kellito/.cargo/registry/src/*/libc-0.2.184; do + if [ -f "$libc_src/src/unix/redox/mod.rs" ] && ! grep -q 'pub fn forkpty' "$libc_src/src/unix/redox/mod.rs"; then + sed -i '/pub fn login_tty(fd: c_int) -> c_int;/a\\ + pub fn forkpty(\\ + amaster: *mut c_int,\\ + name: *mut c_char,\\ + termp: *const termios,\\ + winp: *const crate::winsize,\\ + ) -> c_int;' \ + "$libc_src/src/unix/redox/mod.rs" + fi +done + +cookbook_cargo +"""