Skip to content

Commit

Permalink
Add Python 3.12 patches
Browse files Browse the repository at this point in the history
  • Loading branch information
elprans committed Feb 12, 2024
1 parent e5cba15 commit 80773b4
Show file tree
Hide file tree
Showing 5 changed files with 371 additions and 0 deletions.
45 changes: 45 additions & 0 deletions edgedbpkg/python/patches/python-edgedb__arm64-312.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
From fdd1e139ccd02fc93c39a46ddff27795df685c1f Mon Sep 17 00:00:00 2001
From: Elvis Pranskevichus <[email protected]>
Date: Wed, 21 Apr 2021 14:59:44 -0700
Subject: [PATCH 3/4] Add ability to do pure arm64 builds

---
configure | 5 +++++
configure.ac | 5 +++++
2 files changed, 10 insertions(+)

diff --git a/configure b/configure
index 035d61df16..259cbafb83 100755
--- a/configure
+++ b/configure
@@ -10059,6 +10059,11 @@ printf "%s\n" "$CC" >&6; }
LIPO_INTEL64_FLAGS="-extract x86_64"
ARCH_RUN_32BIT="true"
;;
+ arm-64)
+ UNIVERSAL_ARCH_FLAGS="-arch arm64"
+ LIPO_32BIT_FLAGS=""
+ ARCH_RUN_32BIT="true"
+ ;;
intel)
UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
LIPO_32BIT_FLAGS="-extract i386"
diff --git a/configure.ac b/configure.ac
index 22336ab8db..bdd739961f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2553,6 +2553,11 @@ yes)
LIPO_INTEL64_FLAGS="-extract x86_64"
ARCH_RUN_32BIT="true"
;;
+ arm-64)
+ UNIVERSAL_ARCH_FLAGS="-arch arm64"
+ LIPO_32BIT_FLAGS=""
+ ARCH_RUN_32BIT="true"
+ ;;
intel)
UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
LIPO_32BIT_FLAGS="-extract i386"
--
2.43.0

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
From 2f2f1748064ed2ff3a26b06005e28724780892e6 Mon Sep 17 00:00:00 2001
From: Elvis Pranskevichus <[email protected]>
Date: Tue, 26 Oct 2021 09:58:46 -0700
Subject: [PATCH] Use -Wl,-rpath on macOS also

The claim that macOS linker doesn't understand `-rpath` seems to be
outdated.
---
Lib/distutils/unixccompiler.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py
index f0792de74a..08440805b2 100644
--- a/Lib/distutils/unixccompiler.py
+++ b/Lib/distutils/unixccompiler.py
@@ -233,8 +233,7 @@ def runtime_library_dir_option(self, dir):
# we use this hack.
compiler = os.path.basename(sysconfig.get_config_var("CC"))
if sys.platform[:6] == "darwin":
- # MacOSX's linker doesn't understand the -R flag at all
- return "-L" + dir
+ return "-Wl,-rpath," + dir
elif sys.platform[:7] == "freebsd":
return "-Wl,-rpath=" + dir
elif sys.platform[:5] == "hp-ux":
--
2.32.0

240 changes: 240 additions & 0 deletions edgedbpkg/python/patches/python-edgedb__libuuid-312.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,240 @@
From 4d35a188aaa4de6e7cc99c9ef9d25f0114f0e8df Mon Sep 17 00:00:00 2001
From: Elvis Pranskevichus <[email protected]>
Date: Thu, 8 Jun 2023 00:22:04 -0700
Subject: [PATCH] Improve detection of libuuid

---
configure | 102 +++++++++++++++++++++------------------------------
configure.ac | 51 ++++++++++++++------------
2 files changed, 70 insertions(+), 83 deletions(-)

diff --git a/configure b/configure
index 259cbafb83..6d1d84e505 100755
--- a/configure
+++ b/configure
@@ -13260,22 +13260,42 @@ fi
echo "$LIBUUID_PKG_ERRORS" >&5


- save_CFLAGS=$CFLAGS
+ have_uuid=missing
+
+elif test $pkg_failed = untried; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+
+ have_uuid=missing
+
+else
+ LIBUUID_CFLAGS=$pkg_cv_LIBUUID_CFLAGS
+ LIBUUID_LIBS=$pkg_cv_LIBUUID_LIBS
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; }
+
+ possibly_have_uuid=yes
+
+fi
+
+fi
+
+save_CFLAGS=$CFLAGS
save_CPPFLAGS=$CPPFLAGS
save_LDFLAGS=$LDFLAGS
save_LIBS=$LIBS


- CPPFLAGS="$CPPFLAGS $LIBUUID_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBUUID_LIBS"
- for ac_header in uuid/uuid.h
+ CPPFLAGS="$CFLAGS $LIBUUID_CFLAGS"
+ LDFLAGS="$LDFLAGS $LIBUUID_LIBS"
+ for ac_header in uuid/uuid.h
do :
ac_fn_c_check_header_compile "$LINENO" "uuid/uuid.h" "ac_cv_header_uuid_uuid_h" "$ac_includes_default"
if test "x$ac_cv_header_uuid_uuid_h" = xyes
then :
printf "%s\n" "#define HAVE_UUID_UUID_H 1" >>confdefs.h

- py_check_lib_save_LIBS=$LIBS
+ py_check_lib_save_LIBS=$LIBS
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for uuid_generate_time in -luuid" >&5
printf %s "checking for uuid_generate_time in -luuid... " >&6; }
if test ${ac_cv_lib_uuid_uuid_generate_time+y}
@@ -13357,51 +13377,23 @@ printf "%s\n" "$ac_cv_lib_uuid_uuid_generate_time_safe" >&6; }
if test "x$ac_cv_lib_uuid_uuid_generate_time_safe" = xyes
then :
have_uuid=yes
- printf "%s\n" "#define HAVE_UUID_GENERATE_TIME_SAFE 1" >>confdefs.h
+ printf "%s\n" "#define HAVE_UUID_GENERATE_TIME_SAFE 1" >>confdefs.h

fi

LIBS=$py_check_lib_save_LIBS

-fi
-
-done
- if test "x$have_uuid" = xyes
-then :
-
- LIBUUID_CFLAGS=${LIBUUID_CFLAGS-""}
- LIBUUID_LIBS=${LIBUUID_LIBS-"-luuid"}
-
-fi
-
-CFLAGS=$save_CFLAGS
-CPPFLAGS=$save_CPPFLAGS
-LDFLAGS=$save_LDFLAGS
-LIBS=$save_LIBS
-
-
-
-
-elif test $pkg_failed = untried; then
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
-printf "%s\n" "no" >&6; }
-
- save_CFLAGS=$CFLAGS
-save_CPPFLAGS=$CPPFLAGS
-save_LDFLAGS=$LDFLAGS
-save_LIBS=$LIBS

+else $as_nop

- CPPFLAGS="$CPPFLAGS $LIBUUID_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBUUID_LIBS"
- for ac_header in uuid/uuid.h
+ for ac_header in uuid.h
do :
- ac_fn_c_check_header_compile "$LINENO" "uuid/uuid.h" "ac_cv_header_uuid_uuid_h" "$ac_includes_default"
-if test "x$ac_cv_header_uuid_uuid_h" = xyes
+ ac_fn_c_check_header_compile "$LINENO" "uuid.h" "ac_cv_header_uuid_h" "$ac_includes_default"
+if test "x$ac_cv_header_uuid_h" = xyes
then :
- printf "%s\n" "#define HAVE_UUID_UUID_H 1" >>confdefs.h
+ printf "%s\n" "#define HAVE_UUID_H 1" >>confdefs.h

- py_check_lib_save_LIBS=$LIBS
+ py_check_lib_save_LIBS=$LIBS
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for uuid_generate_time in -luuid" >&5
printf %s "checking for uuid_generate_time in -luuid... " >&6; }
if test ${ac_cv_lib_uuid_uuid_generate_time+y}
@@ -13483,20 +13475,26 @@ printf "%s\n" "$ac_cv_lib_uuid_uuid_generate_time_safe" >&6; }
if test "x$ac_cv_lib_uuid_uuid_generate_time_safe" = xyes
then :
have_uuid=yes
- printf "%s\n" "#define HAVE_UUID_GENERATE_TIME_SAFE 1" >>confdefs.h
+ printf "%s\n" "#define HAVE_UUID_GENERATE_TIME_SAFE 1" >>confdefs.h

fi

LIBS=$py_check_lib_save_LIBS

+
+fi
+
+done
+
fi

done
- if test "x$have_uuid" = xyes
+
+ if test "x$have_uuid" = xyes
then :

- LIBUUID_CFLAGS=${LIBUUID_CFLAGS-""}
- LIBUUID_LIBS=${LIBUUID_LIBS-"-luuid"}
+ LIBUUID_CFLAGS=${LIBUUID_CFLAGS-""}
+ LIBUUID_LIBS=${LIBUUID_LIBS-""}

fi

@@ -13507,22 +13505,6 @@ LIBS=$save_LIBS



-
-else
- LIBUUID_CFLAGS=$pkg_cv_LIBUUID_CFLAGS
- LIBUUID_LIBS=$pkg_cv_LIBUUID_LIBS
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-printf "%s\n" "yes" >&6; }
- have_uuid=yes
- printf "%s\n" "#define HAVE_UUID_H 1" >>confdefs.h
-
- printf "%s\n" "#define HAVE_UUID_GENERATE_TIME_SAFE 1" >>confdefs.h
-
-
-fi
-
-fi
-
if test "x$have_uuid" = xmissing
then :

diff --git a/configure.ac b/configure.ac
index bdd739961f..076f43b694 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3596,29 +3596,34 @@ AC_CHECK_HEADERS([uuid.h],
])

AS_VAR_IF([have_uuid], [missing], [
- PKG_CHECK_MODULES(
- [LIBUUID], [uuid >= 2.20],
- [dnl linux-util's libuuid has uuid_generate_time_safe() since v2.20 (2011)
- dnl and provides <uuid.h>.
- have_uuid=yes
- AC_DEFINE([HAVE_UUID_H], [1])
- AC_DEFINE([HAVE_UUID_GENERATE_TIME_SAFE], [1])
- ], [
- WITH_SAVE_ENV([
- CPPFLAGS="$CPPFLAGS $LIBUUID_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBUUID_LIBS"
- AC_CHECK_HEADERS([uuid/uuid.h], [
- PY_CHECK_LIB([uuid], [uuid_generate_time], [have_uuid=yes])
- PY_CHECK_LIB([uuid], [uuid_generate_time_safe],
- [have_uuid=yes
- AC_DEFINE([HAVE_UUID_GENERATE_TIME_SAFE], [1]) ]) ])
- AS_VAR_IF([have_uuid], [yes], [
- LIBUUID_CFLAGS=${LIBUUID_CFLAGS-""}
- LIBUUID_LIBS=${LIBUUID_LIBS-"-luuid"}
- ])
- ])
- ]
- )
+ PKG_CHECK_MODULES([LIBUUID], [uuid >= 2.20], [
+ possibly_have_uuid=yes
+ ], [
+ have_uuid=missing
+ ])
+])
+
+WITH_SAVE_ENV([
+ CPPFLAGS="$CFLAGS $LIBUUID_CFLAGS"
+ LDFLAGS="$LDFLAGS $LIBUUID_LIBS"
+ AC_CHECK_HEADERS([uuid/uuid.h], [
+ PY_CHECK_LIB([uuid], [uuid_generate_time], [have_uuid=yes])
+ PY_CHECK_LIB([uuid], [uuid_generate_time_safe],
+ [have_uuid=yes
+ AC_DEFINE([HAVE_UUID_GENERATE_TIME_SAFE], [1]) ])
+ ], [
+ AC_CHECK_HEADERS([uuid.h], [
+ PY_CHECK_LIB([uuid], [uuid_generate_time], [have_uuid=yes])
+ PY_CHECK_LIB([uuid], [uuid_generate_time_safe],
+ [have_uuid=yes
+ AC_DEFINE([HAVE_UUID_GENERATE_TIME_SAFE], [1]) ])
+ ])
+ ])
+
+ AS_VAR_IF([have_uuid], [yes], [
+ LIBUUID_CFLAGS=${LIBUUID_CFLAGS-""}
+ LIBUUID_LIBS=${LIBUUID_LIBS-""}
+ ])
])

dnl macOS has uuid/uuid.h but uuid_generate_time is in libc
--
2.43.0

58 changes: 58 additions & 0 deletions edgedbpkg/python/patches/python-edgedb__openssl-rpath-312.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
From 245b58f5e7d19f1524794aeb90a46d30b5b98f94 Mon Sep 17 00:00:00 2001
From: Elvis Pranskevichus <[email protected]>
Date: Tue, 10 Aug 2021 19:51:36 -0700
Subject: [PATCH 2/4] Stop eagerly checking for OpenSSL rpath directory
existence

Also, fix linker flag syntax (should be `rpath,`, not `rpath=`)
---
configure | 10 ++--------
configure.ac | 10 +++-------
2 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/configure b/configure
index e962a6aed1..035d61df16 100755
--- a/configure
+++ b/configure
@@ -28153,15 +28153,9 @@ esac
no) :
OPENSSL_RPATH= ;; #(
*) :
- if test -d "$with_openssl_rpath"
-then :
-
- OPENSSL_RPATH="$with_openssl_rpath"
- OPENSSL_LDFLAGS_RPATH="${rpath_arg}$with_openssl_rpath"

-else $as_nop
- as_fn_error $? "--with-openssl-rpath \"$with_openssl_rpath\" is not a directory" "$LINENO" 5
-fi
+ OPENSSL_RPATH="$with_openssl_rpath"
+ OPENSSL_LDFLAGS_RPATH="${rpath_arg}$with_openssl_rpath"

;;
esac
diff --git a/configure.ac b/configure.ac
index 384718db1f..22336ab8db 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7033,13 +7033,9 @@ AS_CASE([$with_openssl_rpath],
done
],
[no], [OPENSSL_RPATH=],
- [AS_IF(
- [test -d "$with_openssl_rpath"],
- [
- OPENSSL_RPATH="$with_openssl_rpath"
- OPENSSL_LDFLAGS_RPATH="${rpath_arg}$with_openssl_rpath"
- ],
- AC_MSG_ERROR([--with-openssl-rpath "$with_openssl_rpath" is not a directory]))
+ [
+ OPENSSL_RPATH="$with_openssl_rpath"
+ OPENSSL_LDFLAGS_RPATH="${rpath_arg}$with_openssl_rpath"
]
)
AC_MSG_RESULT([$OPENSSL_RPATH])
--
2.43.0

0 comments on commit 80773b4

Please sign in to comment.