diff --git a/recipes/libs/ncurses/recipe.toml b/recipes/libs/ncurses/recipe.toml index ff2e30688..0fa4f74d3 100644 --- a/recipes/libs/ncurses/recipe.toml +++ b/recipes/libs/ncurses/recipe.toml @@ -1,6 +1,9 @@ [source] tar = "https://ftp.gnu.org/gnu/ncurses/ncurses-6.4.tar.gz" blake3 = "0d1c9fdf53c0ca4bd66ba707d49a079d2dd6f5a960cdec74a56e29952c4ffe73" +patches = [ + "redox.patch" +] [build] template = "custom" @@ -10,12 +13,12 @@ COOKBOOK_CONFIGURE_FLAGS+=( --disable-db-install --disable-stripping --without-ada - --without-cxx-binding + --without-manpages --without-tests + --with-shared cf_cv_func_mkstemp=yes ) cookbook_configure -rm -rfv "${COOKBOOK_STAGE}/bin" "${COOKBOOK_STAGE}/share/"{doc,info,man} """ [package] diff --git a/recipes/libs/ncurses/redox.patch b/recipes/libs/ncurses/redox.patch new file mode 100644 index 000000000..b446db168 --- /dev/null +++ b/recipes/libs/ncurses/redox.patch @@ -0,0 +1,12 @@ +diff -ruwN source/configure source-new/configure +--- source/configure 2022-11-06 04:13:26.000000000 +0700 ++++ source-new/configure 2025-09-17 21:14:28.163192730 +0700 +@@ -6386,7 +6386,7 @@ + fi + cf_cv_rm_so_locs=yes + ;; +- (linux*|gnu*|k*bsd*-gnu) ++ (linux*|gnu*|k*bsd*-gnu|redox*) + if test "$DFT_LWR_MODEL" = "shared" && test -n "$LD_RPATH_OPT" ; then + LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)" + LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" diff --git a/recipes/libs/ncursesw/recipe.toml b/recipes/libs/ncursesw/recipe.toml index f1733fe43..a697aabe6 100644 --- a/recipes/libs/ncursesw/recipe.toml +++ b/recipes/libs/ncursesw/recipe.toml @@ -1,22 +1,27 @@ [source] tar = "https://ftp.gnu.org/gnu/ncurses/ncurses-6.4.tar.gz" blake3 = "0d1c9fdf53c0ca4bd66ba707d49a079d2dd6f5a960cdec74a56e29952c4ffe73" +patches = [ + "redox.patch" +] [build] template = "custom" script = """ +DYNAMIC_INIT COOKBOOK_CONFIGURE_FLAGS+=( --disable-db-install --disable-ext-colors + --disable-stripping --enable-widec --without-ada - --without-cxx-binding + --without-manpages --without-tests + --with-shared cf_cv_func_mkstemp=yes cf_cv_wint_t=yes ) cookbook_configure -rm -rfv "${COOKBOOK_STAGE}/bin" "${COOKBOOK_STAGE}/share/"{doc,info,man} """ [package] diff --git a/recipes/libs/ncursesw/redox.patch b/recipes/libs/ncursesw/redox.patch new file mode 100644 index 000000000..b446db168 --- /dev/null +++ b/recipes/libs/ncursesw/redox.patch @@ -0,0 +1,12 @@ +diff -ruwN source/configure source-new/configure +--- source/configure 2022-11-06 04:13:26.000000000 +0700 ++++ source-new/configure 2025-09-17 21:14:28.163192730 +0700 +@@ -6386,7 +6386,7 @@ + fi + cf_cv_rm_so_locs=yes + ;; +- (linux*|gnu*|k*bsd*-gnu) ++ (linux*|gnu*|k*bsd*-gnu|redox*) + if test "$DFT_LWR_MODEL" = "shared" && test -n "$LD_RPATH_OPT" ; then + LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)" + LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" diff --git a/recipes/libs/openssl1/recipe.toml b/recipes/libs/openssl1/recipe.toml index b2836cf9f..d51979cb8 100644 --- a/recipes/libs/openssl1/recipe.toml +++ b/recipes/libs/openssl1/recipe.toml @@ -10,6 +10,7 @@ ARCH="${TARGET%%-*}" COOKBOOK_CONFIGURE="${COOKBOOK_SOURCE}/Configure" COOKBOOK_CONFIGURE_FLAGS=( shared +# threads # needs ucontext.h no-dgram "redox-${ARCH}" --prefix="/" diff --git a/recipes/wip/dev/lang/python312/recipe.toml b/recipes/wip/dev/lang/python312/recipe.toml index e53fb2c00..ada36f03b 100644 --- a/recipes/wip/dev/lang/python312/recipe.toml +++ b/recipes/wip/dev/lang/python312/recipe.toml @@ -1,14 +1,36 @@ -#TODO finish it based on the python310 recipe +#TODO works without pip, probably it requires openssl [source] tar = "https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tar.xz" +patches = [ + "redox.patch" +] + [build] template = "custom" dependencies = [ - "openssl1", +# "openssl1", requires 1.1.1 +# "ncurses", + "ncursesw", +# "readline", unable to link + "zlib", + "xz" ] script = """ -COOKBOOK_CONFIGURE_FLAGS+=( +DYNAMIC_INIT +export PYTHONDONTWRITEBYTECODE=1 +ARCH="${TARGET%%-*}" + +COOKBOOK_CONFIGURE_FLAGS=( + --prefix=/usr --disable-ipv6 + --host=${GNU_TARGET} + --build=$ARCH + --with-build-python +# --with-openssl="${COOKBOOK_SYSROOT}/usr" + --with-ensurepip=install + ac_cv_file__dev_ptmx=no + ac_cv_file__dev_ptc=no ) + cookbook_configure """ diff --git a/recipes/wip/dev/lang/python312/redox.patch b/recipes/wip/dev/lang/python312/redox.patch new file mode 100644 index 000000000..292c43db9 --- /dev/null +++ b/recipes/wip/dev/lang/python312/redox.patch @@ -0,0 +1,204 @@ +diff -ruwN source/configure source-new/configure +--- source/configure 2025-02-04 21:38:38.000000000 +0700 ++++ source-new/configure 2025-09-17 20:20:00.088297027 +0700 +@@ -4283,6 +4283,9 @@ + *-*-wasi) + ac_sys_system=WASI + ;; ++ *-*-redox*) ++ ac_sys_system=Redox ++ ;; + *) + # for now, limit cross builds to known configurations + MACHDEP="unknown" +@@ -4307,6 +4310,7 @@ + case $MACHDEP in + aix*) MACHDEP="aix";; + linux*) MACHDEP="linux";; ++ redox*) MACHDEP="redox";; + cygwin*) MACHDEP="cygwin";; + darwin*) MACHDEP="darwin";; + '') MACHDEP="unknown";; +@@ -4327,7 +4331,7 @@ + + if test "$cross_compiling" = yes; then + case "$host" in +- *-*-linux*) ++ *-*-linux*|*-*-redox*) + case "$host_cpu" in + arm*) + _host_cpu=arm +@@ -6762,6 +6766,7 @@ + #undef cris + #undef fr30 + #undef linux ++#undef redox + #undef hppa + #undef hpux + #undef i386 +@@ -6907,6 +6912,18 @@ + # endif + #elif defined(__gnu_hurd__) + i386-gnu ++#elif defined(__redox__) ++# if defined(__x86_64__) ++ x86_64-redox ++# elif defined(__i386__) ++ i386-redox ++# elif defined(__aarch64__) ++ aarch64-redox ++# elif defined(__riscv) ++ riscv64-redox ++# else ++# error unknown platform triplet ++# endif + #elif defined(__APPLE__) + darwin + #elif defined(__VXWORKS__) +@@ -7507,7 +7524,7 @@ + PY3LIBRARY=libpython3.so + fi + ;; +- Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*|VxWorks*) ++ Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*|VxWorks*|Redox*) + LDLIBRARY='libpython$(LDVERSION).so' + BLDLIBRARY='-L. -lpython$(LDVERSION)' + RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} +@@ -12815,7 +12832,7 @@ + Emscripten*|WASI*) + LDSHARED='$(CC) -shared' + LDCXXSHARED='$(CXX) -shared';; +- Linux*|GNU*|QNX*|VxWorks*|Haiku*) ++ Linux*|GNU*|QNX*|VxWorks*|Haiku*|Redox*) + LDSHARED='$(CC) -shared' + LDCXXSHARED='$(CXX) -shared';; + FreeBSD*) +@@ -12901,7 +12918,7 @@ + else CCSHARED="+z"; + fi;; + Linux-android*) ;; +- Linux*|GNU*) CCSHARED="-fPIC";; ++ Linux*|GNU*|Redox*) CCSHARED="-fPIC";; + Emscripten*|WASI*) + if test "x$enable_wasm_dynamic_linking" = xyes + then : +@@ -12939,7 +12956,7 @@ + LINKFORSHARED="-Wl,-E -Wl,+s";; + # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";; + Linux-android*) LINKFORSHARED="-pie -Xlinker -export-dynamic";; +- Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";; ++ Linux*|GNU*|Redox*) LINKFORSHARED="-Xlinker -export-dynamic";; + # -u libsys_s pulls in all symbols in libsys + Darwin/*) + LINKFORSHARED="$extra_undefs -framework CoreFoundation" +diff -ruwN source/Include/pyport.h source-new/Include/pyport.h +--- source/Include/pyport.h 2025-02-04 21:38:38.000000000 +0700 ++++ source-new/Include/pyport.h 2025-09-08 00:58:51.645114412 +0700 +@@ -684,7 +684,7 @@ + # error "Py_TRACE_REFS ABI is not compatible with release and debug ABI" + #endif + +-#if defined(__ANDROID__) || defined(__VXWORKS__) ++#if defined(__ANDROID__) || defined(__VXWORKS__) || defined(__redox__) + // Use UTF-8 as the locale encoding, ignore the LC_CTYPE locale. + // See _Py_GetLocaleEncoding(), PyUnicode_DecodeLocale() + // and PyUnicode_EncodeLocale(). +diff -ruwN source/Modules/_cryptmodule.c source-new/Modules/_cryptmodule.c +--- source/Modules/_cryptmodule.c 2025-02-04 21:38:38.000000000 +0700 ++++ source-new/Modules/_cryptmodule.c 2025-09-08 01:08:47.321046272 +0700 +@@ -38,13 +38,7 @@ + /*[clinic end generated code: output=0512284a03d2803c input=0e8edec9c364352b]*/ + { + char *crypt_result; +-#ifdef HAVE_CRYPT_R +- struct crypt_data data; +- memset(&data, 0, sizeof(data)); +- crypt_result = crypt_r(word, salt, &data); +-#else + crypt_result = crypt(word, salt); +-#endif + 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-02-04 21:38:38.000000000 +0700 ++++ source-new/Modules/posixmodule.c 2025-09-08 01:06:48.400701428 +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-02-04 21:38:38.000000000 +0700 ++++ source-new/Modules/resource.c 2025-09-08 01:10:18.427310454 +0700 +@@ -216,7 +216,7 @@ + { + struct rlimit rl; + +- if (resource < 0 || resource >= RLIM_NLIMITS) { ++ if (resource < 0 || resource >= RLIMIT_NLIMITS) { + PyErr_SetString(PyExc_ValueError, + "invalid resource specified"); + return NULL; +@@ -244,7 +244,7 @@ + { + struct rlimit rl; + +- if (resource < 0 || resource >= RLIM_NLIMITS) { ++ if (resource < 0 || resource >= RLIMIT_NLIMITS) { + PyErr_SetString(PyExc_ValueError, + "invalid resource specified"); + return NULL; +@@ -292,7 +292,7 @@ + struct rlimit old_limit, new_limit; + int retval; + +- if (resource < 0 || resource >= RLIM_NLIMITS) { ++ if (resource < 0 || resource >= RLIMIT_NLIMITS) { + PyErr_SetString(PyExc_ValueError, + "invalid resource specified"); + return NULL; diff --git a/recipes/wip/dev/lang/python310/recipe.toml b/recipes/wip/dev/lang/python39/recipe.toml similarity index 64% rename from recipes/wip/dev/lang/python310/recipe.toml rename to recipes/wip/dev/lang/python39/recipe.toml index 6c69663f0..537c920a4 100644 --- a/recipes/wip/dev/lang/python310/recipe.toml +++ b/recipes/wip/dev/lang/python39/recipe.toml @@ -2,15 +2,24 @@ #TODO Fix openssl dependency #TODO Add additional dependencies (readline, ncurses, etc.) [source] -tar = "https://www.python.org/ftp/python/3.10.13/Python-3.10.13.tar.xz" +tar = "https://www.python.org/ftp/python/3.9.9/Python-3.9.9.tar.xz" patches = [ - 'redox.patch' +# 'redox.patch' ] [build] template = "custom" -dependencies = [] +dependencies = [ +# "openssl1", needs threading / ucontext.h + "ncursesw", + "zlib", + "xz" +] script = """ +DYNAMIC_INIT +export PYTHONDONTWRITEBYTECODE=1 +ARCH="${TARGET%%-*}" + # Python cross-compilation requires the same Python version on the build machine BUILDMACH_TARGET="$(gcc -dumpmachine)" BUILDMACH_BUILD="${COOKBOOK_RECIPE}/target/${BUILDMACH_TARGET}/build" @@ -27,19 +36,23 @@ mkdir -p "${BUILDMACH_STAGE}" cd "${BUILDMACH_BUILD}" # Use env that does not use the Redox build tools -env -i PATH="$PATH" CC=gcc "${COOKBOOK_SOURCE}/configure" -env -i PATH="$PATH" CC=gcc "${COOKBOOK_MAKE}" -j "${COOKBOOK_MAKE_JOBS}" +env -i PATH="$PATH" CC="$CC_WRAPPER gcc" "${COOKBOOK_SOURCE}/configure" +env -i PATH="$PATH" CC="$CC_WRAPPER gcc" "${COOKBOOK_MAKE}" -j "${COOKBOOK_MAKE_JOBS}" "${COOKBOOK_MAKE}" install DESTDIR="${BUILDMACH_STAGE}" cd - export PATH="${BUILDMACH_STAGE}/usr/local/bin:${PATH}" -# --enable-optimizations for release build -COOKBOOK_CONFIGURE_FLAGS+=( +COOKBOOK_CONFIGURE_FLAGS=( + --prefix=/usr --disable-ipv6 - --build="${ARCH}" + --host=${GNU_TARGET} + --build=$ARCH +# --with-openssl="${COOKBOOK_SYSROOT}/usr" + --with-ensurepip=install ac_cv_file__dev_ptmx=no ac_cv_file__dev_ptc=no ) + cookbook_configure """ diff --git a/recipes/wip/dev/lang/python310/redox.patch b/recipes/wip/dev/lang/python39/redox.patch similarity index 66% rename from recipes/wip/dev/lang/python310/redox.patch rename to recipes/wip/dev/lang/python39/redox.patch index 3f42622d3..5f776a987 100644 --- a/recipes/wip/dev/lang/python310/redox.patch +++ b/recipes/wip/dev/lang/python39/redox.patch @@ -1,7 +1,7 @@ -diff -ur source-orig/configure source/configure ---- source-orig/configure 2023-08-24 13:46:25.000000000 +0100 -+++ source/configure 2024-10-17 16:50:09.377036649 +0100 -@@ -3347,6 +3347,9 @@ +diff -ruwN source/configure source-new/configure +--- source/configure 2021-11-16 00:43:00.000000000 +0700 ++++ source-new/configure 2025-09-17 21:31:19.787497963 +0700 +@@ -3307,6 +3307,9 @@ *-*-vxworks*) ac_sys_system=VxWorks ;; @@ -11,7 +11,7 @@ diff -ur source-orig/configure source/configure *) # for now, limit cross builds to known configurations MACHDEP="unknown" -@@ -3371,6 +3374,7 @@ +@@ -3331,6 +3334,7 @@ case $MACHDEP in aix*) MACHDEP="aix";; linux*) MACHDEP="linux";; @@ -19,7 +19,7 @@ diff -ur source-orig/configure source/configure cygwin*) MACHDEP="cygwin";; darwin*) MACHDEP="darwin";; '') MACHDEP="unknown";; -@@ -3382,7 +3386,7 @@ +@@ -3342,7 +3346,7 @@ if test "$cross_compiling" = yes; then case "$host" in @@ -28,16 +28,16 @@ diff -ur source-orig/configure source/configure case "$host_cpu" in arm*) _host_cpu=arm -@@ -5989,7 +5993,7 @@ +@@ -5951,7 +5955,7 @@ PY3LIBRARY=libpython3.so fi ;; -- Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*|VxWorks*) -+ Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*|VxWorks*|Redox*) +- Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*) ++ Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*|Redox*) LDLIBRARY='libpython$(LDVERSION).so' BLDLIBRARY='-L. -lpython$(LDVERSION)' RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} -@@ -9787,7 +9791,7 @@ +@@ -9551,7 +9555,7 @@ BLDSHARED="$LDSHARED" fi ;; @@ -46,7 +46,7 @@ diff -ur source-orig/configure source/configure LDSHARED='$(CC) -shared' LDCXXSHARED='$(CXX) -shared';; FreeBSD*) -@@ -9856,7 +9860,7 @@ +@@ -9620,7 +9624,7 @@ else CCSHARED="+z"; fi;; Linux-android*) ;; @@ -55,7 +55,7 @@ diff -ur source-orig/configure source/configure FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";; OpenUNIX*|UnixWare*) if test "$GCC" = "yes" -@@ -9886,7 +9890,7 @@ +@@ -9650,7 +9654,7 @@ LINKFORSHARED="-Wl,-E -Wl,+s";; # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";; Linux-android*) LINKFORSHARED="-pie -Xlinker -export-dynamic";; @@ -64,22 +64,22 @@ diff -ur source-orig/configure source/configure # -u libsys_s pulls in all symbols in libsys Darwin/*) LINKFORSHARED="$extra_undefs -framework CoreFoundation" -diff -ur source-orig/Include/pyport.h source/Include/pyport.h ---- source-orig/Include/pyport.h 2023-08-24 13:46:25.000000000 +0100 -+++ source/Include/pyport.h 2024-10-17 17:34:54.514295923 +0100 -@@ -843,7 +843,7 @@ +diff -ruwN source/Include/pyport.h source-new/Include/pyport.h +--- source/Include/pyport.h 2021-11-16 00:43:00.000000000 +0700 ++++ source-new/Include/pyport.h 2025-09-17 21:31:56.613084352 +0700 +@@ -838,7 +838,7 @@ # error "Py_TRACE_REFS ABI is not compatible with release and debug ABI" #endif -#if defined(__ANDROID__) || defined(__VXWORKS__) +#if defined(__ANDROID__) || defined(__VXWORKS__) || defined(__redox__) - // Use UTF-8 as the locale encoding, ignore the LC_CTYPE locale. - // See _Py_GetLocaleEncoding(), PyUnicode_DecodeLocale() - // and PyUnicode_EncodeLocale(). -diff -ur source-orig/Modules/timemodule.c source/Modules/timemodule.c ---- source-orig/Modules/timemodule.c 2023-08-24 13:46:25.000000000 +0100 -+++ source/Modules/timemodule.c 2024-10-17 17:38:08.481699567 +0100 -@@ -1453,7 +1453,7 @@ + /* Ignore the locale encoding: force UTF-8 */ + # define _Py_FORCE_UTF8_LOCALE + #endif +diff -ruwN source/Modules/timemodule.c source-new/Modules/timemodule.c +--- source/Modules/timemodule.c 2021-11-16 00:43:00.000000000 +0700 ++++ source-new/Modules/timemodule.c 2025-09-17 21:30:18.552349106 +0700 +@@ -1416,7 +1416,7 @@ return 0; }