summaryrefslogtreecommitdiff
path: root/Ports/python3
diff options
context:
space:
mode:
Diffstat (limited to 'Ports/python3')
-rw-r--r--Ports/python3/patches/0001-Enforce-UTF-8-as-the-locale-encoding.patch27
-rw-r--r--Ports/python3/patches/0002-Tweak-configure-and-configure.ac.patch (renamed from Ports/python3/patches/fix-autoconf.patch)48
-rw-r--r--Ports/python3/patches/0003-Include-sys-uio.h-in-socketmodule.c.patch27
-rw-r--r--Ports/python3/patches/0004-Tweak-setup.py.patch (renamed from Ports/python3/patches/tweak-setup-py.patch)31
-rw-r--r--Ports/python3/patches/ReadMe.md40
-rw-r--r--Ports/python3/patches/define-py-force-utf8-locale.patch11
-rw-r--r--Ports/python3/patches/include-sys-uio.patch11
7 files changed, 144 insertions, 51 deletions
diff --git a/Ports/python3/patches/0001-Enforce-UTF-8-as-the-locale-encoding.patch b/Ports/python3/patches/0001-Enforce-UTF-8-as-the-locale-encoding.patch
new file mode 100644
index 0000000000..6c2eec9fd4
--- /dev/null
+++ b/Ports/python3/patches/0001-Enforce-UTF-8-as-the-locale-encoding.patch
@@ -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
+
diff --git a/Ports/python3/patches/fix-autoconf.patch b/Ports/python3/patches/0002-Tweak-configure-and-configure.ac.patch
index 914d085d29..5663babf64 100644
--- a/Ports/python3/patches/fix-autoconf.patch
+++ b/Ports/python3/patches/0002-Tweak-configure-and-configure.ac.patch
@@ -1,6 +1,21 @@
---- Python-3.10.1/configure.ac 2021-12-06 18:23:39.000000000 +0000
-+++ Python-3.10.1/configure.ac 2021-12-11 17:23:18.363664786 +0000
-@@ -391,6 +391,9 @@
+From ede554ba7adc8533d1089bf9d153009c0566ebac Mon Sep 17 00:00:00 2001
+From: Linus Groh <mail@linusgroh.de>
+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'
# in the case statement below.
case "$host" in
@@ -10,7 +25,7 @@
*-*-linux-android*)
ac_sys_system=Linux-android
;;
-@@ -429,6 +432,7 @@
+@@ -3373,6 +3376,7 @@ then
linux*) MACHDEP="linux";;
cygwin*) MACHDEP="cygwin";;
darwin*) MACHDEP="darwin";;
@@ -18,8 +33,8 @@
'') MACHDEP="unknown";;
esac
fi
-@@ -437,6 +441,9 @@
- AC_SUBST(_PYTHON_HOST_PLATFORM)
+@@ -3382,6 +3386,9 @@ $as_echo "\"$MACHDEP\"" >&6; }
+
if test "$cross_compiling" = yes; then
case "$host" in
+ *-*-serenity*)
@@ -28,7 +43,7 @@
*-*-linux*)
case "$host_cpu" in
arm*)
-@@ -2802,7 +2809,7 @@
+@@ -9875,7 +9882,7 @@ then
LINKFORSHARED="-Wl,-E -Wl,+s";;
# LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Linux-android*) LINKFORSHARED="-pie -Xlinker -export-dynamic";;
@@ -37,9 +52,11 @@
# -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 @@
+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
@@ -49,7 +66,7 @@
*-*-linux-android*)
ac_sys_system=Linux-android
;;
-@@ -3373,6 +3376,7 @@
+@@ -429,6 +432,7 @@ then
linux*) MACHDEP="linux";;
cygwin*) MACHDEP="cygwin";;
darwin*) MACHDEP="darwin";;
@@ -57,8 +74,8 @@
'') MACHDEP="unknown";;
esac
fi
-@@ -3382,6 +3386,9 @@
-
+@@ -437,6 +441,9 @@ AC_MSG_RESULT("$MACHDEP")
+ AC_SUBST(_PYTHON_HOST_PLATFORM)
if test "$cross_compiling" = yes; then
case "$host" in
+ *-*-serenity*)
@@ -67,7 +84,7 @@
*-*-linux*)
case "$host_cpu" in
arm*)
-@@ -9875,7 +9882,7 @@
+@@ -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";;
@@ -76,3 +93,6 @@
# -u libsys_s pulls in all symbols in libsys
Darwin/*)
LINKFORSHARED="$extra_undefs -framework CoreFoundation"
+--
+2.34.1
+
diff --git a/Ports/python3/patches/0003-Include-sys-uio.h-in-socketmodule.c.patch b/Ports/python3/patches/0003-Include-sys-uio.h-in-socketmodule.c.patch
new file mode 100644
index 0000000000..9098c8bd7c
--- /dev/null
+++ b/Ports/python3/patches/0003-Include-sys-uio.h-in-socketmodule.c.patch
@@ -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
+
diff --git a/Ports/python3/patches/tweak-setup-py.patch b/Ports/python3/patches/0004-Tweak-setup.py.patch
index d2416a9635..19ef44f3b0 100644
--- a/Ports/python3/patches/tweak-setup-py.patch
+++ b/Ports/python3/patches/0004-Tweak-setup.py.patch
@@ -1,6 +1,26 @@
---- Python-3.10.1/setup.py 2021-12-12 00:14:06.628584207 +0000
-+++ Python-3.10.1/setup.py 2021-12-12 00:14:57.889343919 +0000
-@@ -846,8 +846,8 @@
+From 2654555e3b0f4ddce9da96eafebd74449892e713 Mon Sep 17 00:00:00 2001
+From: Linus Groh <mail@linusgroh.de>
+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,
sysconfig.get_config_var("INCLUDEDIR"))
@@ -11,7 +31,7 @@
# lib_dirs and inc_dirs are used to search for files;
# if a file is found in one of those directories, it can
# 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
# provided by the ncurses library.
curses_defines = []
@@ -25,3 +45,6 @@
panel_library = 'panel'
if curses_library == 'ncursesw':
curses_defines.append(('HAVE_NCURSESW', '1'))
+--
+2.34.1
+
diff --git a/Ports/python3/patches/ReadMe.md b/Ports/python3/patches/ReadMe.md
index 77516ed87b..3ad5774a62 100644
--- a/Ports/python3/patches/ReadMe.md
+++ b/Ports/python3/patches/ReadMe.md
@@ -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`.
diff --git a/Ports/python3/patches/define-py-force-utf8-locale.patch b/Ports/python3/patches/define-py-force-utf8-locale.patch
deleted file mode 100644
index 98f4ccdf2d..0000000000
--- a/Ports/python3/patches/define-py-force-utf8-locale.patch
+++ /dev/null
@@ -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().
diff --git a/Ports/python3/patches/include-sys-uio.patch b/Ports/python3/patches/include-sys-uio.patch
deleted file mode 100644
index 64edd2c9a1..0000000000
--- a/Ports/python3/patches/include-sys-uio.patch
+++ /dev/null
@@ -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
-