python3: use pkgconfig to find readline
authorRosen Penev <rosenp@gmail.com>
Tue, 2 Jul 2024 00:00:35 +0000 (17:00 -0700)
committerRosen Penev <rosenp@gmail.com>
Fri, 12 Jul 2024 20:10:49 +0000 (13:10 -0700)
When searching for readline, ncurses is needed, which can be ncursesw or
ncurses. Use pkgconfig to avoid the whole situation and simplify.

Also add readline/host as the OS one may be unusable.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
lang/python/python3/Makefile
lang/python/python3/patches/010-no-ncursesw.patch [new file with mode: 0644]

index cd01fc9e41874c9f038b0b02145e4d80338132a3..9a9e2ce82b773f737442eef11ce69cc18011e4a6 100644 (file)
@@ -11,7 +11,7 @@ include $(TOPDIR)/rules.mk
 include ../python3-version.mk
 
 PKG_NAME:=python3
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 PKG_VERSION:=$(PYTHON3_VERSION).$(PYTHON3_VERSION_MICRO)
 
 PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz
@@ -41,7 +41,7 @@ PKG_BUILD_DIR:=$(BUILD_DIR)/Python-$(PKG_VERSION)
 HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/Python-$(PKG_VERSION)
 
 PKG_BUILD_DEPENDS:=bluez python3/host python-build/host python-installer/host python-wheel/host
-HOST_BUILD_DEPENDS:=bzip2/host libffi/host
+HOST_BUILD_DEPENDS:=bzip2/host libffi/host readline/host
 
 include $(INCLUDE_DIR)/host-build.mk
 include $(INCLUDE_DIR)/package.mk
diff --git a/lang/python/python3/patches/010-no-ncursesw.patch b/lang/python/python3/patches/010-no-ncursesw.patch
new file mode 100644 (file)
index 0000000..137c433
--- /dev/null
@@ -0,0 +1,52 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -5839,20 +5839,13 @@ if test "$with_readline" != no; then
+   # library.  NOTE: Keep the precedence of listed libraries synchronised
+   # with setup.py.
+   AC_MSG_CHECKING([how to link readline libs])
+-  for py_libtermcap in "" tinfo ncursesw ncurses curses termcap; do
+-    if test -z "$py_libtermcap"; then
+-      READLINE_LIBS="-l$LIBREADLINE"
+-    else
+-      READLINE_LIBS="-l$LIBREADLINE -l$py_libtermcap"
+-    fi
+-    LIBS="$READLINE_LIBS $LIBS_no_readline"
+-    AC_LINK_IFELSE(
+-      [AC_LANG_CALL([],[readline])],
+-      [py_cv_lib_readline=yes])
+-    if test $py_cv_lib_readline = yes; then
+-      break
+-    fi
+-  done
++  PKG_CHECK_MODULES_STATIC(
++    [READLINE], [readline], [
++      py_cv_lib_readline=yes
++      AC_DEFINE(HAVE_LIBREADLINE, 1,
++        [Define to build the readline module.])
++    ], py_cv_lib_readline=no
++  )
+   # Uncomment this line if you want to use READLINE_LIBS in Makefile or scripts
+   #AC_SUBST([READLINE_LIBS])
+@@ -5860,8 +5853,6 @@ if test "$with_readline" != no; then
+     AC_MSG_RESULT([none])
+   else
+     AC_MSG_RESULT([$READLINE_LIBS])
+-    AC_DEFINE(HAVE_LIBREADLINE, 1,
+-      [Define to build the readline module.])
+   fi
+ fi
+@@ -6099,12 +6090,6 @@ then
+   [Define if you have struct stat.st_mtimensec])
+ fi
+-# first curses header check
+-ac_save_cppflags="$CPPFLAGS"
+-if test "$cross_compiling" = no; then
+-  CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw"
+-fi
+-
+ AC_CHECK_HEADERS(curses.h ncurses.h)
+ # On Solaris, term.h requires curses.h