mirror of
https://gitlab.redox-os.org/redox-os/redox.git
synced 2026-06-17 15:34:18 +08:00
Port python 3.15 alpha
This commit is contained in:
parent
baec8f7bb4
commit
a77eb39d50
66
recipes/wip/dev/python315/recipe.toml
Normal file
66
recipes/wip/dev/python315/recipe.toml
Normal file
@ -0,0 +1,66 @@
|
||||
# TODO: Not tested
|
||||
[source]
|
||||
tar = "https://www.python.org/ftp/python/3.15.0/Python-3.15.0a8.tar.xz"
|
||||
blake3 = "b1e24434fc15b352b07222e44e6ff12ce14bbbe8535928a13123ee6a49fa6541"
|
||||
patches = [
|
||||
"redox.patch"
|
||||
]
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
dependencies = [
|
||||
"target:bzip2",
|
||||
"target:libffi",
|
||||
"target:openssl3",
|
||||
"target:ncursesw",
|
||||
"target:readline",
|
||||
"target:sqlite3",
|
||||
"target:zlib",
|
||||
"target:xz",
|
||||
"target:zstd",
|
||||
]
|
||||
dev-dependencies = [
|
||||
"host:python315"
|
||||
]
|
||||
script = """
|
||||
DYNAMIC_INIT
|
||||
|
||||
export PYTHONDONTWRITEBYTECODE=1
|
||||
ARCH="${TARGET%%-*}"
|
||||
OS=$(echo "${TARGET}" | cut -d - -f3-4)
|
||||
|
||||
if [ "$TARGET" != "$COOKBOOK_HOST_TARGET" ]; then
|
||||
COOKBOOK_CONFIGURE_FLAGS=(
|
||||
--prefix=/usr
|
||||
--disable-ipv6
|
||||
--host=${GNU_TARGET}
|
||||
--build="$ARCH"
|
||||
--with-build-python="${COOKBOOK_TOOLCHAIN}/usr/bin/python3.15"
|
||||
--with-ensurepip=install
|
||||
--disable-test-modules
|
||||
--with-ssl-default-suites=openssl
|
||||
ac_cv_file__dev_ptmx=no
|
||||
ac_cv_file__dev_ptc=no
|
||||
)
|
||||
else
|
||||
COOKBOOK_CONFIGURE_FLAGS=(--prefix=/usr)
|
||||
fi
|
||||
|
||||
if [ "${COOKBOOK_DYNAMIC}" != "1" ]; then
|
||||
export MODULE_BUILDTYPE=static
|
||||
COOKBOOK_CONFIGURE_FLAGS+=( --enable-shared )
|
||||
fi
|
||||
|
||||
cookbook_configure
|
||||
|
||||
# A same file to save 73MB
|
||||
(cd "${COOKBOOK_STAGE}/usr/lib/python3.15/config-3.15" && \
|
||||
rm -f libpython3.15.a && ln -s ../../libpython3.15.a)
|
||||
"""
|
||||
|
||||
[[optional-packages]]
|
||||
name = "dev"
|
||||
files = [
|
||||
"usr/lib/python3.15/config-*/**",
|
||||
"usr/lib/libpython*.a"
|
||||
]
|
||||
134
recipes/wip/dev/python315/redox.patch
Normal file
134
recipes/wip/dev/python315/redox.patch
Normal file
@ -0,0 +1,134 @@
|
||||
diff -ruwN source/configure source-new/configure
|
||||
--- source/configure 2026-04-07 18:24:03.000000000 +0700
|
||||
+++ source-new/configure 2026-05-07 12:19:48.765197728 +0700
|
||||
@@ -4163,6 +4163,9 @@
|
||||
*-*-wasi*)
|
||||
ac_sys_system=WASI
|
||||
;;
|
||||
+ *-*-redox*)
|
||||
+ ac_sys_system=Redox
|
||||
+ ;;
|
||||
*)
|
||||
# for now, limit cross builds to known configurations
|
||||
MACHDEP="unknown"
|
||||
@@ -4189,6 +4192,7 @@
|
||||
freebsd*) MACHDEP="freebsd";;
|
||||
linux-android*) MACHDEP="android";;
|
||||
linux*) MACHDEP="linux";;
|
||||
+ redox*) MACHDEP="redox";;
|
||||
cygwin*) MACHDEP="cygwin";;
|
||||
darwin*) MACHDEP="darwin";;
|
||||
'') MACHDEP="unknown";;
|
||||
@@ -4615,7 +4619,7 @@
|
||||
|
||||
if test "$cross_compiling" = yes; then
|
||||
case "$host" in
|
||||
- *-*-linux*)
|
||||
+ *-*-linux*|*-*-redox*)
|
||||
case "$host_cpu" in
|
||||
arm*)
|
||||
_host_ident=arm
|
||||
@@ -7771,7 +7775,7 @@
|
||||
PY3LIBRARY=libpython3.so
|
||||
fi
|
||||
;;
|
||||
- Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*|VxWorks*)
|
||||
+ Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*|Redox*|VxWorks*)
|
||||
LDLIBRARY='libpython$(LDVERSION).so'
|
||||
BLDLIBRARY='-L. -lpython$(LDVERSION)'
|
||||
RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
|
||||
@@ -13777,7 +13781,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*)
|
||||
@@ -13862,7 +13866,7 @@
|
||||
then CCSHARED="-fPIC";
|
||||
else CCSHARED="+z";
|
||||
fi;;
|
||||
- Linux*|GNU*) CCSHARED="-fPIC";;
|
||||
+ Linux*|GNU*|Redox*) CCSHARED="-fPIC";;
|
||||
Emscripten*|WASI*)
|
||||
if test "x$enable_wasm_dynamic_linking" = xyes
|
||||
then :
|
||||
@@ -13900,7 +13904,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/*|iOS/*)
|
||||
LINKFORSHARED="$extra_undefs -framework CoreFoundation"
|
||||
diff -ruwN source/Include/internal/pycore_time.h source-new/Include/internal/pycore_time.h
|
||||
--- source/Include/internal/pycore_time.h 2026-04-07 18:24:03.000000000 +0700
|
||||
+++ source-new/Include/internal/pycore_time.h 2026-05-07 12:55:06.797297037 +0700
|
||||
@@ -49,6 +49,10 @@
|
||||
|
||||
#ifndef Py_INTERNAL_TIME_H
|
||||
#define Py_INTERNAL_TIME_H
|
||||
+
|
||||
+// FIXME: where timeval should be declared from?
|
||||
+# include <sys/time.h>
|
||||
+
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
diff -ruwN source/Include/pyport.h source-new/Include/pyport.h
|
||||
--- source/Include/pyport.h 2026-04-07 18:24:03.000000000 +0700
|
||||
+++ source-new/Include/pyport.h 2026-05-07 12:16:56.305047939 +0700
|
||||
@@ -541,7 +541,7 @@
|
||||
# endif
|
||||
#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/posixmodule.c source-new/Modules/posixmodule.c
|
||||
--- source/Modules/posixmodule.c 2026-04-07 18:24:03.000000000 +0700
|
||||
+++ source-new/Modules/posixmodule.c 2026-05-07 12:57:16.208883903 +0700
|
||||
@@ -11253,7 +11253,7 @@
|
||||
struct tms process;
|
||||
clock_t elapsed;
|
||||
errno = 0;
|
||||
- elapsed = times(&process);
|
||||
+ elapsed = (clock_t) -1;
|
||||
if (elapsed == (clock_t) -1) {
|
||||
return posix_error();
|
||||
}
|
||||
diff -ruwN source/Modules/resource.c source-new/Modules/resource.c
|
||||
--- source/Modules/resource.c 2026-04-07 18:24:03.000000000 +0700
|
||||
+++ source-new/Modules/resource.c 2026-05-07 12:16:56.305184305 +0700
|
||||
@@ -245,7 +245,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;
|
||||
@@ -273,7 +273,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;
|
||||
@@ -321,7 +321,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;
|
||||
Loading…
Reference in New Issue
Block a user