Skip to content

Commit

Permalink
lang/python3.11: backport netlink patch
Browse files Browse the repository at this point in the history
this patch backports GH-107812: extend socket's netlink support to FreeBSD
see python/cpython#107813
for the patch.

see python/cpython#107812
for the discussion on the backport itself.

Sponsored by: The FreeBSD Foundation
  • Loading branch information
igalic authored and vishwin committed Feb 1, 2024
1 parent 1b4f401 commit 70c33d0
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 3 deletions.
11 changes: 11 additions & 0 deletions lang/python311/files/patch-Modules__socketmodule.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- Modules/socketmodule.h.orig
+++ Modules/socketmodule.h
@@ -89,6 +89,8 @@ typedef int socklen_t;
# include <asm/types.h>
# endif
# include <linux/netlink.h>
+#elif defined(HAVE_NETLINK_NETLINK_H)
+# include <netlink/netlink.h>
#else
# undef AF_NETLINK
#endif
36 changes: 33 additions & 3 deletions lang/python311/files/patch-configure
Original file line number Diff line number Diff line change
@@ -1,11 +1,41 @@
--- configure.orig 2022-12-07 13:31:07 UTC
+++ configure
@@ -7630,7 +7630,7 @@ if test "$Py_LTO" = 'true' ; then

@@ -8336,7 +8336,7 @@ fi

if test "$Py_LTO" = 'true' ; then
case $CC in
- *clang*)
+ *clang*|cc)
LDFLAGS_NOLTO="-fno-lto"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -flto=thin" >&5
$as_echo_n "checking whether C compiler accepts -flto=thin... " >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -flto=thin" >&5
printf %s "checking whether C compiler accepts -flto=thin... " >&6; }
@@ -10629,6 +10629,7 @@ fi


# On Linux, netlink.h requires asm/types.h
+# On FreeBSD, netlink.h is located in netlink/netlink.h
ac_fn_c_check_header_compile "$LINENO" "linux/netlink.h" "ac_cv_header_linux_netlink_h" "
#ifdef HAVE_ASM_TYPES_H
#include <asm/types.h>
@@ -10643,6 +10644,20 @@ then :
printf "%s\n" "#define HAVE_LINUX_NETLINK_H 1" >>confdefs.h

fi
+ac_fn_c_check_header_compile "$LINENO" "netlink/netlink.h" "ac_cv_header_netlink_netlink_h" "
+#ifdef HAVE_ASM_TYPES_H
+#include <asm/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
+"
+if test "x$ac_cv_header_netlink_netlink_h" = xyes
+then :
+ printf "%s\n" "#define HAVE_NETLINK_NETLINK_H 1" >>confdefs.h
+
+fi


# On Linux, qrtr.h requires asm/types.h
12 changes: 12 additions & 0 deletions lang/python311/files/patch-pyconfig.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- pyconfig.h.in.orig
+++ pyconfig.h.in
@@ -835,6 +835,9 @@
/* Define to 1 if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H

+/* Define to 1 if you have the <netlink/netlink.h> header file. */
+#undef HAVE_NETLINK_NETLINK_H
+
/* Define to 1 if you have the <netpacket/packet.h> header file. */
#undef HAVE_NETPACKET_PACKET_H

0 comments on commit 70c33d0

Please sign in to comment.