From 1e883aebc9f5b3004d61aa14fa4ad154305e05ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mina=20Gali=C4=87?= Date: Wed, 27 Sep 2023 15:16:00 +0000 Subject: [PATCH] lang/python310: backport GH-107812 to extend netlink support upstream issue: https://github.com/python/cpython/issues/107812 upstream pull request: https://github.com/python/cpython/pull/107813 PR: 273114 Sponsored by: The FreeBSD Foundation --- lang/python310/Makefile | 3 +- .../patch-0001-GH-107812-netlink-support | 74 +++++++++++++++++++ lang/python310/files/patch-configure | 32 -------- lang/python310/files/patch-configure.ac | 20 +++++ 4 files changed, 96 insertions(+), 33 deletions(-) create mode 100644 lang/python310/files/patch-0001-GH-107812-netlink-support delete mode 100644 lang/python310/files/patch-configure create mode 100644 lang/python310/files/patch-configure.ac diff --git a/lang/python310/Makefile b/lang/python310/Makefile index d6b8587218fe..07e78534d1b3 100644 --- a/lang/python310/Makefile +++ b/lang/python310/Makefile @@ -1,5 +1,6 @@ PORTNAME= python DISTVERSION= ${PYTHON_DISTVERSION} +PORTREVISION= 1 CATEGORIES= lang python MASTER_SITES= PYTHON/ftp/python/${DISTVERSION:C/[a-z].*//} PKGNAMESUFFIX= ${PYTHON_SUFFIX} @@ -14,7 +15,7 @@ LICENSE= PSFL LIB_DEPENDS= libffi.so:devel/libffi -USES= compiler:c11 cpe ncurses pathfix pkgconfig \ +USES= autoreconf:2.69 compiler:c11 cpe ncurses pathfix pkgconfig \ python:${PYTHON_DISTVERSION:R},env readline shebangfix ssl tar:xz PATHFIX_MAKEFILEIN= Makefile.pre.in USE_LDCONFIG= yes diff --git a/lang/python310/files/patch-0001-GH-107812-netlink-support b/lang/python310/files/patch-0001-GH-107812-netlink-support new file mode 100644 index 000000000000..6ee2cae69179 --- /dev/null +++ b/lang/python310/files/patch-0001-GH-107812-netlink-support @@ -0,0 +1,74 @@ +From e1feab79ada917d891ae77c1888a9c08fa08073a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Mina=20Gali=C4=87?= +Date: Wed, 27 Sep 2023 14:48:01 +0000 +Subject: [PATCH] GH-107812: extend socket's netlink support to FreeBSD + +backport to 3.10 +--- + .../2023-08-09-15-37-20.gh-issue-107812.CflAXa.rst | 1 + + Modules/socketmodule.h | 2 ++ + configure.ac | 3 ++- + pyconfig.h.in | 12 ++++++++++++ + 4 files changed, 17 insertions(+), 1 deletion(-) + create mode 100644 Misc/NEWS.d/next/Library/2023-08-09-15-37-20.gh-issue-107812.CflAXa.rst + +diff --git Misc/NEWS.d/next/Library/2023-08-09-15-37-20.gh-issue-107812.CflAXa.rst Misc/NEWS.d/next/Library/2023-08-09-15-37-20.gh-issue-107812.CflAXa.rst +new file mode 100644 +index 0000000000..0aac44fb41 +--- /dev/null ++++ Misc/NEWS.d/next/Library/2023-08-09-15-37-20.gh-issue-107812.CflAXa.rst +@@ -0,0 +1 @@ ++Extend socket's netlink support to the FreeBSD platform. +diff --git Modules/socketmodule.h Modules/socketmodule.h +index e4f375d5e8..121a1d47d7 100644 +--- Modules/socketmodule.h ++++ Modules/socketmodule.h +@@ -91,6 +91,8 @@ typedef int socklen_t; + # include + # endif + # include ++#elif defined(HAVE_NETLINK_NETLINK_H) ++# include + #else + # undef AF_NETLINK + #endif +diff --git configure.ac configure.ac +index ac3be3850a..90651a4ce3 100644 +--- configure.ac ++++ configure.ac +@@ -2254,7 +2254,8 @@ AC_CHECK_HEADERS([net/if.h], [], [], + ]) + + # On Linux, netlink.h requires asm/types.h +-AC_CHECK_HEADERS(linux/netlink.h,,,[ ++# On FreeBSD, netlink.h is located in netlink/netlink.h ++AC_CHECK_HEADERS([linux/netlink.h netlink/netlink.h], [], [], [ + #ifdef HAVE_ASM_TYPES_H + #include + #endif +diff --git pyconfig.h.in pyconfig.h.in +index 57c84e5f8f..1b356a7439 100644 +--- pyconfig.h.in ++++ pyconfig.h.in +@@ -745,6 +745,18 @@ + /* Define to 1 if you have the header file, and it defines `DIR'. */ + #undef HAVE_NDIR_H + ++/* Define to 1 if you have the header file. */ ++#undef HAVE_NETCAN_CAN_H ++ ++/* Define to 1 if you have the header file. */ ++#undef HAVE_NETDB_H ++ ++/* Define to 1 if you have the header file. */ ++#undef HAVE_NETINET_IN_H ++ ++/* Define to 1 if you have the header file. */ ++#undef HAVE_NETLINK_NETLINK_H ++ + /* Define to 1 if you have the header file. */ + #undef HAVE_NETPACKET_PACKET_H + +-- +2.42.0 + diff --git a/lang/python310/files/patch-configure b/lang/python310/files/patch-configure deleted file mode 100644 index 1890947cf0d6..000000000000 --- a/lang/python310/files/patch-configure +++ /dev/null @@ -1,32 +0,0 @@ -Disable the detection of includes and library from e2fsprogs-libuuid, which -introduces hidden dependency and breaks build - ---- configure.orig 2022-08-01 20:25:27 UTC -+++ configure -@@ -6625,7 +6625,7 @@ fi - - if test "$Py_LTO" = 'true' ; then - case $CC in -- *clang*) -+ *clang*|cc) - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}llvm-ar", so it can be a program name with args. -@@ -10123,7 +10123,7 @@ fi - # Dynamic linking for HP-UX - - # checks for uuid.h location --for ac_header in uuid/uuid.h uuid.h -+for ac_header in uuid.h - do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` - ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -@@ -10141,7 +10141,7 @@ done - $as_echo_n "checking for uuid_generate_time_safe... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext - /* end confdefs.h. */ --#include -+#include - int - main () - { diff --git a/lang/python310/files/patch-configure.ac b/lang/python310/files/patch-configure.ac new file mode 100644 index 000000000000..eee48a18eddc --- /dev/null +++ b/lang/python310/files/patch-configure.ac @@ -0,0 +1,20 @@ +--- configure.ac.orig 2023-09-27 15:04:55 UTC ++++ configure.ac +@@ -1380,7 +1380,7 @@ fi], + [AC_MSG_RESULT(no)]) + if test "$Py_LTO" = 'true' ; then + case $CC in +- *clang*) ++ *clang*|cc) + AC_SUBST(LLVM_AR) + AC_PATH_TOOL(LLVM_AR, llvm-ar, '', ${llvm_path}) + AC_SUBST(LLVM_AR_FOUND) +@@ -2906,7 +2906,7 @@ AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV + AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX + + # checks for uuid.h location +-AC_CHECK_HEADERS([uuid/uuid.h uuid.h]) ++AC_CHECK_HEADERS([uuid.h uuid/uuid.hh]) + + AC_MSG_CHECKING(for uuid_generate_time_safe) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[ -- 2.42.0