From 6581cf21634bee4c06e43b59c3b14ba50ddf5c13 Mon Sep 17 00:00:00 2001 From: Wildan M Date: Tue, 10 Mar 2026 10:37:44 +0700 Subject: [PATCH] Fix ncursesw, readline and bzip2 for python build --- recipes/dev/python312/recipe.toml | 2 +- recipes/dev/python312/redox.patch | 52 ------------------------------- recipes/libs/ncurses/recipe.toml | 5 ++- recipes/libs/ncursesw/recipe.toml | 8 ++++- recipes/libs/readline/recipe.toml | 12 +++---- recipes/libs/readline/redox.patch | 21 ------------- recipes/tools/bzip2/pkgconfig | 10 ++++++ recipes/tools/bzip2/recipe.toml | 3 ++ src/cook/cook_build.rs | 4 +-- 9 files changed, 32 insertions(+), 85 deletions(-) delete mode 100644 recipes/libs/readline/redox.patch create mode 100644 recipes/tools/bzip2/pkgconfig diff --git a/recipes/dev/python312/recipe.toml b/recipes/dev/python312/recipe.toml index 4d90c8407..c2e0e0936 100644 --- a/recipes/dev/python312/recipe.toml +++ b/recipes/dev/python312/recipe.toml @@ -10,7 +10,6 @@ template = "custom" dependencies = [ "target:bzip2", "target:libffi", - "target:libuuid", "target:openssl3", "target:ncursesw", "target:readline", @@ -38,6 +37,7 @@ if [ "$TARGET" != "$COOKBOOK_HOST_TARGET" ]; then --with-build-python="${COOKBOOK_TOOLCHAIN}/usr/bin/python3.12" --with-ensurepip=install --disable-test-modules + --with-ssl-default-suites=openssl ac_cv_file__dev_ptmx=no ac_cv_file__dev_ptc=no ) diff --git a/recipes/dev/python312/redox.patch b/recipes/dev/python312/redox.patch index a0cfe4a54..034194a22 100644 --- a/recipes/dev/python312/redox.patch +++ b/recipes/dev/python312/redox.patch @@ -120,58 +120,6 @@ diff -ruwN source/Modules/_cryptmodule.c source-new/Modules/_cryptmodule.c if (crypt_result == NULL) { return PyErr_SetFromErrno(PyExc_OSError); } -diff -ruwN source/Modules/posixmodule.c source-new/Modules/posixmodule.c ---- source/Modules/posixmodule.c 2025-10-09 18:07:00.000000000 +0700 -+++ source-new/Modules/posixmodule.c 2025-12-09 22:14:30.781035339 +0700 -@@ -2695,8 +2695,7 @@ - #ifdef HAVE_FSTATAT - if ((dir_fd != DEFAULT_DIR_FD) || !follow_symlinks) { - if (HAVE_FSTATAT_RUNTIME) { -- result = fstatat(dir_fd, path->narrow, &st, -- follow_symlinks ? 0 : AT_SYMLINK_NOFOLLOW); -+ result = fstatat(dir_fd, path->narrow, &st, 0); - - } else { - fstatat_unavailable = 1; -@@ -3186,8 +3185,6 @@ - - if (HAVE_FACCESSAT_RUNTIME) { - int flags = 0; -- if (!follow_symlinks) -- flags |= AT_SYMLINK_NOFOLLOW; - if (effective_ids) - flags |= AT_EACCESS; - result = faccessat(dir_fd, path->narrow, mode, flags); -@@ -3472,8 +3469,7 @@ - * support dir_fd and follow_symlinks=False. (Hopefully.) - * Until then, we need to be careful what exception we raise. - */ -- result = fchmodat(dir_fd, path->narrow, mode, -- follow_symlinks ? 0 : AT_SYMLINK_NOFOLLOW); -+ result = fchmodat(dir_fd, path->narrow, mode, 0); - /* - * But wait! We can't throw the exception without allowing threads, - * and we can't do that in this nested scope. (Macro trickery, sigh.) -@@ -3850,8 +3846,7 @@ - #ifdef HAVE_FCHOWNAT - if ((dir_fd != DEFAULT_DIR_FD) || (!follow_symlinks)) { - if (HAVE_FCHOWNAT_RUNTIME) { -- result = fchownat(dir_fd, path->narrow, uid, gid, -- follow_symlinks ? 0 : AT_SYMLINK_NOFOLLOW); -+ result = fchownat(dir_fd, path->narrow, uid, gid, 0); - } else { - fchownat_unsupported = 1; - } -@@ -14727,8 +14722,7 @@ - #ifdef HAVE_FSTATAT - if (HAVE_FSTATAT_RUNTIME) { - Py_BEGIN_ALLOW_THREADS -- result = fstatat(self->dir_fd, path, &st, -- follow_symlinks ? 0 : AT_SYMLINK_NOFOLLOW); -+ result = fstatat(self->dir_fd, path, &st, 0); - Py_END_ALLOW_THREADS - } else - diff -ruwN source/Modules/resource.c source-new/Modules/resource.c --- source/Modules/resource.c 2025-10-09 18:07:00.000000000 +0700 +++ source-new/Modules/resource.c 2025-12-09 22:14:30.781035339 +0700 diff --git a/recipes/libs/ncurses/recipe.toml b/recipes/libs/ncurses/recipe.toml index 87fc7479c..03535a5ef 100644 --- a/recipes/libs/ncurses/recipe.toml +++ b/recipes/libs/ncurses/recipe.toml @@ -1,5 +1,5 @@ [source] -tar = "https://ftp.gnu.org/gnu/ncurses/ncurses-6.4.tar.gz" +tar = "https://ftp.gnu.org/gnu/ncurses/ncurses-6.6.tar.gz" blake3 = "0d1c9fdf53c0ca4bd66ba707d49a079d2dd6f5a960cdec74a56e29952c4ffe73" patches = [ "redox.patch" @@ -15,6 +15,9 @@ COOKBOOK_CONFIGURE_FLAGS+=( --without-ada --without-manpages --without-tests + --enable-pc-files + --with-terminfo-dirs=/usr/share/terminfo + --with-pkg-config-libdir=/usr/lib/pkgconfig cf_cv_func_mkstemp=yes ) if [ "${COOKBOOK_DYNAMIC}" == "1" ] diff --git a/recipes/libs/ncursesw/recipe.toml b/recipes/libs/ncursesw/recipe.toml index 80eee8273..a3e5e1965 100644 --- a/recipes/libs/ncursesw/recipe.toml +++ b/recipes/libs/ncursesw/recipe.toml @@ -13,10 +13,16 @@ COOKBOOK_CONFIGURE_FLAGS+=( --without-ada --without-manpages --without-tests - --with-shared + --enable-pc-files + --with-terminfo-dirs=/usr/share/terminfo + --with-pkg-config-libdir=/usr/lib/pkgconfig cf_cv_func_mkstemp=yes cf_cv_wint_t=yes ) +if [ "${COOKBOOK_DYNAMIC}" == "1" ] +then + COOKBOOK_CONFIGURE_FLAGS+=(--with-shared) +fi cookbook_configure """ diff --git a/recipes/libs/readline/recipe.toml b/recipes/libs/readline/recipe.toml index 8d3b9670b..25a830e11 100644 --- a/recipes/libs/readline/recipe.toml +++ b/recipes/libs/readline/recipe.toml @@ -1,9 +1,6 @@ [source] -tar = "https://ftp.gnu.org/gnu/readline/readline-7.0.tar.gz" -blake3 = "962483e201f36f05a5ccb507bb7330b4d4e4989fd52f41eb15ba65582ad02703" -patches = [ - "redox.patch" -] +tar = "https://ftp.gnu.org/gnu/readline/readline-8.3.tar.gz" +blake3 = "7109f094062bda387a0c16b4875375b96e36437bebbbd8d8f91bb27ba01d687f" [build] template = "custom" @@ -15,7 +12,8 @@ DYNAMIC_INIT cookbook_configure OS=$(echo "${TARGET}" | cut -d - -f3) if [ "${OS}" = "redox" ]; then - ln -s "libhistory.so.7" "${COOKBOOK_STAGE}"/usr/lib/libhistory.so - ln -s "libreadline.so.7" "${COOKBOOK_STAGE}"/usr/lib/libreadline.so + ln -s "libhistory.so.8" "${COOKBOOK_STAGE}"/usr/lib/libhistory.so + ln -s "libreadline.so.8" "${COOKBOOK_STAGE}"/usr/lib/libreadline.so + patchelf --add-needed libncursesw.so "${COOKBOOK_STAGE}/usr/lib/libreadline.so.8" fi """ diff --git a/recipes/libs/readline/redox.patch b/recipes/libs/readline/redox.patch deleted file mode 100644 index 7b632e527..000000000 --- a/recipes/libs/readline/redox.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff -ru source/support/config.sub source-new/support/config.sub ---- source/support/config.sub 2013-12-17 16:49:47.000000000 +0100 -+++ source-new/support/config.sub 2017-08-14 09:09:20.158401733 +0200 -@@ -2,7 +2,7 @@ - # Configuration validation subroutine script. - # Copyright 1992-2013 Free Software Foundation, Inc. - --timestamp='2013-10-01' -+timestamp='2017-08-14' - - # This file is free software; you can redistribute it and/or modify it - # under the terms of the GNU General Public License as published by -@@ -1351,7 +1351,7 @@ - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. -- -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ -+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* | -redox* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* | -plan9* \ diff --git a/recipes/tools/bzip2/pkgconfig b/recipes/tools/bzip2/pkgconfig new file mode 100644 index 000000000..84fd47176 --- /dev/null +++ b/recipes/tools/bzip2/pkgconfig @@ -0,0 +1,10 @@ +prefix=/usr +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: bzip2 +Description: A file compression library +Version: 1.0.8 +Libs: -L${libdir} -lbz2 +Cflags: -I${includedir} \ No newline at end of file diff --git a/recipes/tools/bzip2/recipe.toml b/recipes/tools/bzip2/recipe.toml index b7fdd3835..a2f191079 100644 --- a/recipes/tools/bzip2/recipe.toml +++ b/recipes/tools/bzip2/recipe.toml @@ -32,4 +32,7 @@ rsync -av --delete "${COOKBOOK_SOURCE}/" ./ cp -av libbz2.so* "${COOKBOOK_STAGE}/lib" ln -sr "${COOKBOOK_STAGE}/lib/libbz2.so.1.0" "${COOKBOOK_STAGE}/lib/libbz2.so.1" ln -sr "${COOKBOOK_STAGE}/lib/libbz2.so.1.0" "${COOKBOOK_STAGE}/lib/libbz2.so" + +mkdir -p "${COOKBOOK_STAGE}/lib/pkgconfig" +cp "${COOKBOOK_RECIPE}/pkgconfig" "${COOKBOOK_STAGE}/lib/pkgconfig/bzip2.pc" """ diff --git a/src/cook/cook_build.rs b/src/cook/cook_build.rs index 47b02f3e0..302d7a385 100644 --- a/src/cook/cook_build.rs +++ b/src/cook/cook_build.rs @@ -136,7 +136,7 @@ fn auto_deps_from_dynamic_linking( if verbose { log_to_pty!(logger, "DEBUG: {} provides {}", dep, child_name); } - deps.insert(dep.clone()); + deps.insert(dep.with_prefix(pkg::PackagePrefix::Any)); missing.remove(child_name); } } @@ -555,7 +555,7 @@ fn build_deps_dir( &tags_dir, &dep_pkgars .iter() - .map(|(name, _)| name.without_host()) + .map(|(name, _)| name.without_prefix()) .collect(), )? {