mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 21:05:07 +00:00
Ports: Regenerate patches for python3
This commit is contained in:
parent
bbd4343b31
commit
fc02370dc7
7 changed files with 175 additions and 82 deletions
|
@ -0,0 +1,27 @@
|
||||||
|
From 88be19427b96ec99d861b7b6eae7bdad0c7f3bd5 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Linus Groh <mail@linusgroh.de>
|
||||||
|
Date: Fri, 14 Jan 2022 23:35:20 +0330
|
||||||
|
Subject: [PATCH 1/4] Enforce UTF-8 as the locale encoding
|
||||||
|
|
||||||
|
By defining `_Py_FORCE_UTF8_LOCALE` as some other platforms already do,
|
||||||
|
we can enforce UTF-8 as the encoding.
|
||||||
|
---
|
||||||
|
Include/pyport.h | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/Include/pyport.h b/Include/pyport.h
|
||||||
|
index 6ab0ae4..dffd616 100644
|
||||||
|
--- a/Include/pyport.h
|
||||||
|
+++ b/Include/pyport.h
|
||||||
|
@@ -843,7 +843,7 @@ extern _invalid_parameter_handler _Py_silent_invalid_parameter_handler;
|
||||||
|
# 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(__serenity__)
|
||||||
|
// Use UTF-8 as the locale encoding, ignore the LC_CTYPE locale.
|
||||||
|
// See _Py_GetLocaleEncoding(), PyUnicode_DecodeLocale()
|
||||||
|
// and PyUnicode_EncodeLocale().
|
||||||
|
--
|
||||||
|
2.34.1
|
||||||
|
|
|
@ -1,6 +1,21 @@
|
||||||
--- Python-3.10.1/configure.ac 2021-12-06 18:23:39.000000000 +0000
|
From ede554ba7adc8533d1089bf9d153009c0566ebac Mon Sep 17 00:00:00 2001
|
||||||
+++ Python-3.10.1/configure.ac 2021-12-11 17:23:18.363664786 +0000
|
From: Linus Groh <mail@linusgroh.de>
|
||||||
@@ -391,6 +391,9 @@
|
Date: Fri, 14 Jan 2022 23:35:57 +0330
|
||||||
|
Subject: [PATCH 2/4] Tweak configure and configure.ac
|
||||||
|
|
||||||
|
As usual, make the `configure` script recognize Serenity. Also set
|
||||||
|
`MACHDEP` (which is used for `sys.platform`) to a version-less
|
||||||
|
`serenityos`, even when not cross-compiling.
|
||||||
|
---
|
||||||
|
configure | 9 ++++++++-
|
||||||
|
configure.ac | 9 ++++++++-
|
||||||
|
2 files changed, 16 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/configure b/configure
|
||||||
|
index 2e7e0b7..f62120f 100755
|
||||||
|
--- a/configure
|
||||||
|
+++ b/configure
|
||||||
|
@@ -3335,6 +3335,9 @@ then
|
||||||
# a lot of different things including 'define_xopen_source'
|
# a lot of different things including 'define_xopen_source'
|
||||||
# in the case statement below.
|
# in the case statement below.
|
||||||
case "$host" in
|
case "$host" in
|
||||||
|
@ -10,7 +25,7 @@
|
||||||
*-*-linux-android*)
|
*-*-linux-android*)
|
||||||
ac_sys_system=Linux-android
|
ac_sys_system=Linux-android
|
||||||
;;
|
;;
|
||||||
@@ -429,6 +432,7 @@
|
@@ -3373,6 +3376,7 @@ then
|
||||||
linux*) MACHDEP="linux";;
|
linux*) MACHDEP="linux";;
|
||||||
cygwin*) MACHDEP="cygwin";;
|
cygwin*) MACHDEP="cygwin";;
|
||||||
darwin*) MACHDEP="darwin";;
|
darwin*) MACHDEP="darwin";;
|
||||||
|
@ -18,46 +33,7 @@
|
||||||
'') MACHDEP="unknown";;
|
'') MACHDEP="unknown";;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
@@ -437,6 +441,9 @@
|
@@ -3382,6 +3386,9 @@ $as_echo "\"$MACHDEP\"" >&6; }
|
||||||
AC_SUBST(_PYTHON_HOST_PLATFORM)
|
|
||||||
if test "$cross_compiling" = yes; then
|
|
||||||
case "$host" in
|
|
||||||
+ *-*-serenity*)
|
|
||||||
+ _host_cpu=$host_cpu
|
|
||||||
+ ;;
|
|
||||||
*-*-linux*)
|
|
||||||
case "$host_cpu" in
|
|
||||||
arm*)
|
|
||||||
@@ -2802,7 +2809,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*|SerenityOS*) LINKFORSHARED="-Xlinker -export-dynamic";;
|
|
||||||
# -u libsys_s pulls in all symbols in libsys
|
|
||||||
Darwin/*)
|
|
||||||
LINKFORSHARED="$extra_undefs -framework CoreFoundation"
|
|
||||||
--- Python-3.10.1/configure 2021-12-06 18:23:39.000000000 +0000
|
|
||||||
+++ Python-3.10.1/configure 2021-12-11 17:25:05.866475699 +0000
|
|
||||||
@@ -3335,6 +3335,9 @@
|
|
||||||
# a lot of different things including 'define_xopen_source'
|
|
||||||
# in the case statement below.
|
|
||||||
case "$host" in
|
|
||||||
+ *-*-serenity*)
|
|
||||||
+ ac_sys_system=SerenityOS
|
|
||||||
+ ;;
|
|
||||||
*-*-linux-android*)
|
|
||||||
ac_sys_system=Linux-android
|
|
||||||
;;
|
|
||||||
@@ -3373,6 +3376,7 @@
|
|
||||||
linux*) MACHDEP="linux";;
|
|
||||||
cygwin*) MACHDEP="cygwin";;
|
|
||||||
darwin*) MACHDEP="darwin";;
|
|
||||||
+ serenityos*) MACHDEP="serenityos";;
|
|
||||||
'') MACHDEP="unknown";;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
@@ -3382,6 +3386,9 @@
|
|
||||||
|
|
||||||
if test "$cross_compiling" = yes; then
|
if test "$cross_compiling" = yes; then
|
||||||
case "$host" in
|
case "$host" in
|
||||||
|
@ -67,7 +43,7 @@
|
||||||
*-*-linux*)
|
*-*-linux*)
|
||||||
case "$host_cpu" in
|
case "$host_cpu" in
|
||||||
arm*)
|
arm*)
|
||||||
@@ -9875,7 +9882,7 @@
|
@@ -9875,7 +9882,7 @@ then
|
||||||
LINKFORSHARED="-Wl,-E -Wl,+s";;
|
LINKFORSHARED="-Wl,-E -Wl,+s";;
|
||||||
# LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
|
# LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
|
||||||
Linux-android*) LINKFORSHARED="-pie -Xlinker -export-dynamic";;
|
Linux-android*) LINKFORSHARED="-pie -Xlinker -export-dynamic";;
|
||||||
|
@ -76,3 +52,47 @@
|
||||||
# -u libsys_s pulls in all symbols in libsys
|
# -u libsys_s pulls in all symbols in libsys
|
||||||
Darwin/*)
|
Darwin/*)
|
||||||
LINKFORSHARED="$extra_undefs -framework CoreFoundation"
|
LINKFORSHARED="$extra_undefs -framework CoreFoundation"
|
||||||
|
diff --git a/configure.ac b/configure.ac
|
||||||
|
index 0c06914..383031e 100644
|
||||||
|
--- a/configure.ac
|
||||||
|
+++ b/configure.ac
|
||||||
|
@@ -391,6 +391,9 @@ then
|
||||||
|
# a lot of different things including 'define_xopen_source'
|
||||||
|
# in the case statement below.
|
||||||
|
case "$host" in
|
||||||
|
+ *-*-serenity*)
|
||||||
|
+ ac_sys_system=SerenityOS
|
||||||
|
+ ;;
|
||||||
|
*-*-linux-android*)
|
||||||
|
ac_sys_system=Linux-android
|
||||||
|
;;
|
||||||
|
@@ -429,6 +432,7 @@ then
|
||||||
|
linux*) MACHDEP="linux";;
|
||||||
|
cygwin*) MACHDEP="cygwin";;
|
||||||
|
darwin*) MACHDEP="darwin";;
|
||||||
|
+ serenityos*) MACHDEP="serenityos";;
|
||||||
|
'') MACHDEP="unknown";;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
@@ -437,6 +441,9 @@ AC_MSG_RESULT("$MACHDEP")
|
||||||
|
AC_SUBST(_PYTHON_HOST_PLATFORM)
|
||||||
|
if test "$cross_compiling" = yes; then
|
||||||
|
case "$host" in
|
||||||
|
+ *-*-serenity*)
|
||||||
|
+ _host_cpu=$host_cpu
|
||||||
|
+ ;;
|
||||||
|
*-*-linux*)
|
||||||
|
case "$host_cpu" in
|
||||||
|
arm*)
|
||||||
|
@@ -2802,7 +2809,7 @@ then
|
||||||
|
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*|SerenityOS*) LINKFORSHARED="-Xlinker -export-dynamic";;
|
||||||
|
# -u libsys_s pulls in all symbols in libsys
|
||||||
|
Darwin/*)
|
||||||
|
LINKFORSHARED="$extra_undefs -framework CoreFoundation"
|
||||||
|
--
|
||||||
|
2.34.1
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
From d8533ba9c81ffdd11f39aa2d9fb89fd3564d4d44 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Linus Groh <mail@linusgroh.de>
|
||||||
|
Date: Fri, 14 Jan 2022 23:36:28 +0330
|
||||||
|
Subject: [PATCH 3/4] Include `sys/uio.h` in `socketmodule.c`
|
||||||
|
|
||||||
|
This is to ensure that `struct iovec` is defined, which is required by
|
||||||
|
the `socket` module.
|
||||||
|
---
|
||||||
|
Modules/socketmodule.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
|
||||||
|
index ab8618b..0109d97 100644
|
||||||
|
--- a/Modules/socketmodule.c
|
||||||
|
+++ b/Modules/socketmodule.c
|
||||||
|
@@ -168,7 +168,7 @@ shutdown(how) -- shut down traffic in one or both directions\n\
|
||||||
|
# undef HAVE_GETHOSTBYNAME_R_6_ARG
|
||||||
|
#endif
|
||||||
|
|
||||||
|
-#if defined(__OpenBSD__)
|
||||||
|
+#if defined(__OpenBSD__) || defined(__serenity__)
|
||||||
|
# include <sys/uio.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
--
|
||||||
|
2.34.1
|
||||||
|
|
|
@ -1,6 +1,26 @@
|
||||||
--- Python-3.10.1/setup.py 2021-12-12 00:14:06.628584207 +0000
|
From 2654555e3b0f4ddce9da96eafebd74449892e713 Mon Sep 17 00:00:00 2001
|
||||||
+++ Python-3.10.1/setup.py 2021-12-12 00:14:57.889343919 +0000
|
From: Linus Groh <mail@linusgroh.de>
|
||||||
@@ -846,8 +846,8 @@
|
Date: Fri, 14 Jan 2022 23:36:52 +0330
|
||||||
|
Subject: [PATCH 4/4] Tweak `setup.py`
|
||||||
|
|
||||||
|
Make some tweaks to Python's `setup.py`:
|
||||||
|
|
||||||
|
- Add `/usr/local/lib` and `/usr/local/include` to the system lib and
|
||||||
|
include dirs respectively, relative to the sysroot when
|
||||||
|
crosscompiling. These are by default only included when not
|
||||||
|
crosscompiling for some reason.
|
||||||
|
- Add `/usr/local/include/ncurses` to the curses include paths so it can
|
||||||
|
build the `_curses` module. This is by default included for a bunch of
|
||||||
|
extensions, but not `_curses`.
|
||||||
|
---
|
||||||
|
setup.py | 11 ++++++++---
|
||||||
|
1 file changed, 8 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/setup.py b/setup.py
|
||||||
|
index 43e807f..454be9e 100644
|
||||||
|
--- a/setup.py
|
||||||
|
+++ b/setup.py
|
||||||
|
@@ -846,8 +846,8 @@ class PyBuildExt(build_ext):
|
||||||
add_dir_to_list(self.compiler.include_dirs,
|
add_dir_to_list(self.compiler.include_dirs,
|
||||||
sysconfig.get_config_var("INCLUDEDIR"))
|
sysconfig.get_config_var("INCLUDEDIR"))
|
||||||
|
|
||||||
|
@ -11,7 +31,7 @@
|
||||||
# lib_dirs and inc_dirs are used to search for files;
|
# lib_dirs and inc_dirs are used to search for files;
|
||||||
# if a file is found in one of those directories, it can
|
# if a file is found in one of those directories, it can
|
||||||
# be assumed that no additional -I,-L directives are needed.
|
# be assumed that no additional -I,-L directives are needed.
|
||||||
@@ -1158,7 +1158,12 @@
|
@@ -1158,7 +1158,12 @@ class PyBuildExt(build_ext):
|
||||||
# Curses support, requiring the System V version of curses, often
|
# Curses support, requiring the System V version of curses, often
|
||||||
# provided by the ncurses library.
|
# provided by the ncurses library.
|
||||||
curses_defines = []
|
curses_defines = []
|
||||||
|
@ -25,3 +45,6 @@
|
||||||
panel_library = 'panel'
|
panel_library = 'panel'
|
||||||
if curses_library == 'ncursesw':
|
if curses_library == 'ncursesw':
|
||||||
curses_defines.append(('HAVE_NCURSESW', '1'))
|
curses_defines.append(('HAVE_NCURSESW', '1'))
|
||||||
|
--
|
||||||
|
2.34.1
|
||||||
|
|
|
@ -1,20 +1,38 @@
|
||||||
# Patches for Python 3.9 on SerenityOS
|
# Patches for python3 on SerenityOS
|
||||||
|
|
||||||
## `include-sys-uio.patch`
|
## `0001-Enforce-UTF-8-as-the-locale-encoding.patch`
|
||||||
|
|
||||||
Ensures `struct iovec` is defined, required by the socket module.
|
Enforce UTF-8 as the locale encoding
|
||||||
|
|
||||||
## `define-py-force-utf8-locale.patch`
|
By defining `_Py_FORCE_UTF8_LOCALE` as some other platforms already do,
|
||||||
|
we can enforce UTF-8 as the encoding.
|
||||||
|
|
||||||
Enforce UTF-8 as encoding by defining `_Py_FORCE_UTF8_LOCALE`.
|
## `0002-Tweak-configure-and-configure.ac.patch`
|
||||||
|
|
||||||
## `fix-autoconf.patch`
|
Tweak configure and configure.ac
|
||||||
|
|
||||||
As usual, make the `configure` script recognize Serenity. Also set `MACHDEP` (which is used for `sys.platform`) to a version-less `serenityos`, even when not cross-compiling.
|
As usual, make the `configure` script recognize Serenity. Also set
|
||||||
|
`MACHDEP` (which is used for `sys.platform`) to a version-less
|
||||||
|
`serenityos`, even when not cross-compiling.
|
||||||
|
|
||||||
## `tweak-setup-py.patch`
|
## `0003-Include-sys-uio.h-in-socketmodule.c.patch`
|
||||||
|
|
||||||
Make some tweaks to Python's `setup.py` files:
|
Include `sys/uio.h` in `socketmodule.c`
|
||||||
|
|
||||||
|
This is to ensure that `struct iovec` is defined, which is required by
|
||||||
|
the `socket` module.
|
||||||
|
|
||||||
|
## `0004-Tweak-setup.py.patch`
|
||||||
|
|
||||||
|
Tweak `setup.py`
|
||||||
|
|
||||||
|
Make some tweaks to Python's `setup.py`:
|
||||||
|
|
||||||
|
- Add `/usr/local/lib` and `/usr/local/include` to the system lib and
|
||||||
|
include dirs respectively, relative to the sysroot when
|
||||||
|
crosscompiling. These are by default only included when not
|
||||||
|
crosscompiling for some reason.
|
||||||
|
- Add `/usr/local/include/ncurses` to the curses include paths so it can
|
||||||
|
build the `_curses` module. This is by default included for a bunch of
|
||||||
|
extensions, but not `_curses`.
|
||||||
|
|
||||||
- Add `/usr/local/lib` / `/usr/local/include` to the system lib / include dirs, relative to the sysroot when crosscompiling. These are by default only included when not crosscompiling for some reason.
|
|
||||||
- Add `/usr/local/include/ncurses` to the curses include paths so it can build the `_curses` module. This is by default included for a bunch of extensions, but not `_curses`.
|
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
--- Python-3.10.1/Include/pyport.h 2021-08-03 18:40:05.313000000 +0100
|
|
||||||
+++ Python-3.10.1/Include/pyport.h 2021-08-03 18:40:28.722351782 +0100
|
|
||||||
@@ -843,7 +843,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(__serenity__)
|
|
||||||
// Use UTF-8 as the locale encoding, ignore the LC_CTYPE locale.
|
|
||||||
// See _Py_GetLocaleEncoding(), PyUnicode_DecodeLocale()
|
|
||||||
// and PyUnicode_EncodeLocale().
|
|
|
@ -1,11 +0,0 @@
|
||||||
--- Python-3.10.1/Modules/socketmodule.c 2021-09-09 01:14:41.120232921 +0800
|
|
||||||
+++ Python-3.10.1/Modules/socketmodule.c 2021-08-03 03:53:59.000000000 +0800
|
|
||||||
@@ -168,7 +168,7 @@
|
|
||||||
# undef HAVE_GETHOSTBYNAME_R_6_ARG
|
|
||||||
#endif
|
|
||||||
|
|
||||||
-#if defined(__OpenBSD__)
|
|
||||||
+#if defined(__OpenBSD__) || defined(__serenity__)
|
|
||||||
# include <sys/uio.h>
|
|
||||||
#endif
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue