pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/lang
Module Name: pkgsrc
Committed By: riastradh
Date: Sat Jan 13 04:24:29 UTC 2024
Modified Files:
pkgsrc/lang/python310: Makefile distinfo
pkgsrc/lang/python310/patches: patch-setup.py
pkgsrc/lang/python311: Makefile distinfo
pkgsrc/lang/python311/patches: patch-setup.py
pkgsrc/lang/python39: distinfo
pkgsrc/lang/python39/patches: patch-setup.py
Log Message:
lang/python3*: Fix cross-build by patching out broken readline crud.
Python's setup.py tries to decide whether readline is available by
running readelf on the path it thinks it can find to libreadline.so.
Since we always use a single static readline/curses choice in Pythin
(readline, not editline, with (fake-)ncurses), just patch all that
buggy detection goo away.
No new maintenance burden because this logic has been ripped out of
Python 3.12 anyway. Python 3.8 skipped for now because it doesn't
cross-build at the moment anyway -- more work needed to make that
happen (and it's not as easy as Python>=3.9 as I recall).
To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 pkgsrc/lang/python310/Makefile
cvs rdiff -u -r1.27 -r1.28 pkgsrc/lang/python310/distinfo
cvs rdiff -u -r1.7 -r1.8 pkgsrc/lang/python310/patches/patch-setup.py
cvs rdiff -u -r1.23 -r1.24 pkgsrc/lang/python311/Makefile
cvs rdiff -u -r1.12 -r1.13 pkgsrc/lang/python311/distinfo
cvs rdiff -u -r1.2 -r1.3 pkgsrc/lang/python311/patches/patch-setup.py
cvs rdiff -u -r1.37 -r1.38 pkgsrc/lang/python39/distinfo
cvs rdiff -u -r1.10 -r1.11 pkgsrc/lang/python39/patches/patch-setup.py
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/lang/python310/Makefile
diff -u pkgsrc/lang/python310/Makefile:1.29 pkgsrc/lang/python310/Makefile:1.30
--- pkgsrc/lang/python310/Makefile:1.29 Thu Nov 23 12:43:35 2023
+++ pkgsrc/lang/python310/Makefile Sat Jan 13 04:24:28 2024
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.29 2023/11/23 12:43:35 jperkin Exp $
+# $NetBSD: Makefile,v 1.30 2024/01/13 04:24:28 riastradh Exp $
.include "dist.mk"
@@ -38,6 +38,7 @@ USE_TOOLS+= pkg-config
GNU_CONFIGURE= yes
CONFIGURE_ARGS+= --enable-shared
CONFIGURE_ARGS+= --with-openssl=${BUILDLINK_PREFIX.openssl}
+CONFIGURE_ARGS+= --with-readline=readline # XXX editline?
CONFIGURE_ARGS+= --with-system-expat
CONFIGURE_ARGS+= --with-system-ffi
CONFIGURE_ARGS+= --without-ensurepip
Index: pkgsrc/lang/python310/distinfo
diff -u pkgsrc/lang/python310/distinfo:1.27 pkgsrc/lang/python310/distinfo:1.28
--- pkgsrc/lang/python310/distinfo:1.27 Fri Nov 10 09:48:40 2023
+++ pkgsrc/lang/python310/distinfo Sat Jan 13 04:24:28 2024
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.27 2023/11/10 09:48:40 nia Exp $
+$NetBSD: distinfo,v 1.28 2024/01/13 04:24:28 riastradh Exp $
BLAKE2s (Python-3.10.13.tar.xz) = c714daeb2437980ce940e76db70f037d844bcddc06dddb6ac966cef281a2b514
SHA512 (Python-3.10.13.tar.xz) = 7579772e501486b2b07f78142082dee1e99c7643640098860ac0cf2ca87daf7588b0c00b1db1960146b37f56a6ed98fd08297c25c9a19b612cf6e6a258984da8
@@ -16,4 +16,4 @@ SHA1 (patch-Modules_socketmodule.h) = 87
SHA1 (patch-Python_thread__pthread.h) = b8efa178380fe48da4a0bf2bfa906851a314824e
SHA1 (patch-configure) = 8ffe98e51407d10e46e7d1531f2e0e0b58e1cfa6
SHA1 (patch-pyconfig.h.in) = 1ab77914315acbf0352d242ed66200bea54548f6
-SHA1 (patch-setup.py) = 5ab776a53ad361fdea9004817a7157743ab42db7
+SHA1 (patch-setup.py) = 5d1907202ad38286b92f41a553f34cf87c965213
Index: pkgsrc/lang/python310/patches/patch-setup.py
diff -u pkgsrc/lang/python310/patches/patch-setup.py:1.7 pkgsrc/lang/python310/patches/patch-setup.py:1.8
--- pkgsrc/lang/python310/patches/patch-setup.py:1.7 Mon Oct 23 06:36:00 2023
+++ pkgsrc/lang/python310/patches/patch-setup.py Sat Jan 13 04:24:28 2024
@@ -1,4 +1,4 @@
-$NetBSD: patch-setup.py,v 1.7 2023/10/23 06:36:00 wiz Exp $
+$NetBSD: patch-setup.py,v 1.8 2024/01/13 04:24:28 riastradh Exp $
Disable certain modules, so they can be built as separate packages.
Do not look for ncursesw.
@@ -7,8 +7,11 @@ which will get transformed to panel in b
Don't search for modules in PREFIX. Fixes build failure when py-setuptools
are installed.
Enable cross-build by setting sys._home and sys.path to build directory
+Disable circuitous readline detection which tries to outsmart pkgsrc's
+static choice of libreadline and (fake-)ncurses and trips over its elven
+shoelaces when cross-compiling.
---- setup.py.orig 2022-03-23 20:12:04.000000000 +0000
+--- setup.py.orig 2023-08-24 12:46:25.000000000 +0000
+++ setup.py
@@ -1,5 +1,11 @@
# Autodetecting setup.py script for building the Python extensions
@@ -64,7 +67,7 @@ Enable cross-build by setting sys._home
def find_file(filename, std_dirs, paths):
"""Searches for the directory where a given file is located,
and returns a possibly-empty list of additional directories, or None
-@@ -823,15 +841,15 @@ class PyBuildExt(build_ext):
+@@ -822,15 +840,15 @@ class PyBuildExt(build_ext):
add_dir_to_list(dir_list, directory)
def configure_compiler(self):
@@ -89,7 +92,7 @@ Enable cross-build by setting sys._home
self.add_multiarch_paths()
self.add_ldflags_cppflags()
-@@ -879,6 +897,9 @@ class PyBuildExt(build_ext):
+@@ -878,6 +896,9 @@ class PyBuildExt(build_ext):
self.lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32']
if MACOS:
@@ -99,16 +102,82 @@ Enable cross-build by setting sys._home
# This should work on any unixy platform ;-)
# If the user has bothered specifying additional -I and -L flags
# in OPT and LDFLAGS we might as well use them here.
-@@ -1106,8 +1127,6 @@ class PyBuildExt(build_ext):
- # use the same library for the readline and curses modules.
- if 'curses' in readline_termcap_library:
- curses_library = readline_termcap_library
+@@ -1067,71 +1088,10 @@ class PyBuildExt(build_ext):
+ def detect_readline_curses(self):
+ # readline
+ readline_termcap_library = ""
+- curses_library = ""
+- # Cannot use os.popen here in py3k.
+- tmpfile = os.path.join(self.build_temp, 'readline_termcap_lib')
+- if not os.path.exists(self.build_temp):
+- os.makedirs(self.build_temp)
+- # Determine if readline is already linked against curses or tinfo.
+- if sysconfig.get_config_var('HAVE_LIBREADLINE'):
+- if sysconfig.get_config_var('WITH_EDITLINE'):
+- readline_lib = 'edit'
+- else:
+- readline_lib = 'readline'
+- do_readline = self.compiler.find_library_file(self.lib_dirs,
+- readline_lib)
+- if CROSS_COMPILING:
+- ret = run_command("%s -d %s | grep '(NEEDED)' > %s"
+- % (sysconfig.get_config_var('READELF'),
+- do_readline, tmpfile))
+- elif find_executable('ldd'):
+- ret = run_command("ldd %s > %s" % (do_readline, tmpfile))
+- else:
+- ret = 1
+- if ret == 0:
+- with open(tmpfile) as fp:
+- for ln in fp:
+- if 'curses' in ln:
+- readline_termcap_library = re.sub(
+- r'.*lib(n?cursesw?)\.so.*', r'\1', ln
+- ).rstrip()
+- break
+- # termcap interface split out from ncurses
+- if 'tinfo' in ln:
+- readline_termcap_library = 'tinfo'
+- break
+- if os.path.exists(tmpfile):
+- os.unlink(tmpfile)
+- else:
+- do_readline = False
+- # Issue 7384: If readline is already linked against curses,
+- # use the same library for the readline and curses modules.
+- if 'curses' in readline_termcap_library:
+- curses_library = readline_termcap_library
- elif self.compiler.find_library_file(self.lib_dirs, 'ncursesw'):
- curses_library = 'ncursesw'
- # Issue 36210: OSS provided ncurses does not link on AIX
- # Use IBM supplied 'curses' for successful build of _curses
- elif AIX and self.compiler.find_library_file(self.lib_dirs, 'curses'):
-@@ -1211,8 +1230,7 @@ class PyBuildExt(build_ext):
+- # Issue 36210: OSS provided ncurses does not link on AIX
+- # Use IBM supplied 'curses' for successful build of _curses
+- elif AIX and self.compiler.find_library_file(self.lib_dirs, 'curses'):
+- curses_library = 'curses'
+- elif self.compiler.find_library_file(self.lib_dirs, 'ncurses'):
+- curses_library = 'ncurses'
+- elif self.compiler.find_library_file(self.lib_dirs, 'curses'):
+- curses_library = 'curses'
++ curses_library = "ncurses"
++ do_readline = True
++ readline_lib = 'readline'
+
+- if MACOS:
+- os_release = int(os.uname()[2].split('.')[0])
+- dep_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
+- if (dep_target and
+- (tuple(int(n) for n in dep_target.split('.')[0:2])
+- < (10, 5) ) ):
+- os_release = 8
+- if os_release < 9:
+- # MacOSX 10.4 has a broken readline. Don't try to build
+- # the readline module unless the user has installed a fixed
+- # readline package
+- if find_file('readline/rlconf.h', self.inc_dirs, []) is None:
+- do_readline = False
+ if do_readline:
+ if MACOS and os_release < 9:
+ # In every directory on the search path search for a dynamic
+@@ -1213,8 +1173,7 @@ class PyBuildExt(build_ext):
# If the curses module is enabled, check for the panel module
# _curses_panel needs some form of ncurses
skip_curses_panel = True if AIX else False
@@ -118,7 +187,7 @@ Enable cross-build by setting sys._home
self.add(Extension('_curses_panel', ['_curses_panel.c'],
include_dirs=curses_includes,
define_macros=curses_defines,
-@@ -1457,6 +1475,31 @@ class PyBuildExt(build_ext):
+@@ -1459,6 +1418,31 @@ class PyBuildExt(build_ext):
dbm_order = ['gdbm']
# The standard Unix dbm module:
if not CYGWIN:
@@ -150,7 +219,7 @@ Enable cross-build by setting sys._home
config_args = [arg.strip("'")
for arg in sysconfig.get_config_var("CONFIG_ARGS").split()]
dbm_args = [arg for arg in config_args
-@@ -1468,7 +1511,7 @@ class PyBuildExt(build_ext):
+@@ -1470,7 +1454,7 @@ class PyBuildExt(build_ext):
dbmext = None
for cand in dbm_order:
if cand == "ndbm":
@@ -159,7 +228,7 @@ Enable cross-build by setting sys._home
# Some systems have -lndbm, others have -lgdbm_compat,
# others don't have either
if self.compiler.find_library_file(self.lib_dirs,
-@@ -2328,10 +2371,7 @@ class PyBuildExt(build_ext):
+@@ -2333,10 +2317,7 @@ class PyBuildExt(build_ext):
sources = ['_decimal/_decimal.c']
depends = ['_decimal/docstrings.h']
else:
@@ -171,7 +240,7 @@ Enable cross-build by setting sys._home
libraries = ['m']
sources = [
'_decimal/_decimal.c',
-@@ -2747,7 +2787,7 @@ def main():
+@@ -2752,7 +2733,7 @@ def main():
# If you change the scripts installed here, you also need to
# check the PyBuildScripts command above, and change the links
# created by the bininstall target in Makefile.pre.in
Index: pkgsrc/lang/python311/Makefile
diff -u pkgsrc/lang/python311/Makefile:1.23 pkgsrc/lang/python311/Makefile:1.24
--- pkgsrc/lang/python311/Makefile:1.23 Thu Dec 28 13:12:24 2023
+++ pkgsrc/lang/python311/Makefile Sat Jan 13 04:24:28 2024
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.23 2023/12/28 13:12:24 thor Exp $
+# $NetBSD: Makefile,v 1.24 2024/01/13 04:24:28 riastradh Exp $
.include "dist.mk"
@@ -38,6 +38,7 @@ USE_CC_FEATURES+= c11
GNU_CONFIGURE= yes
CONFIGURE_ARGS+= --enable-shared
CONFIGURE_ARGS+= --with-openssl=${BUILDLINK_PREFIX.openssl}
+CONFIGURE_ARGS+= --with-readline=readline # XXX editline?
CONFIGURE_ARGS+= --with-system-expat
CONFIGURE_ARGS+= --with-system-ffi
CONFIGURE_ARGS+= --without-ensurepip
Index: pkgsrc/lang/python311/distinfo
diff -u pkgsrc/lang/python311/distinfo:1.12 pkgsrc/lang/python311/distinfo:1.13
--- pkgsrc/lang/python311/distinfo:1.12 Mon Dec 11 10:23:42 2023
+++ pkgsrc/lang/python311/distinfo Sat Jan 13 04:24:28 2024
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.12 2023/12/11 10:23:42 adam Exp $
+$NetBSD: distinfo,v 1.13 2024/01/13 04:24:28 riastradh Exp $
BLAKE2s (Python-3.11.7.tar.xz) = bd74ee6c5197164ba2646db27f640928e7a445fb1f6723051faa4a0d14c11549
SHA512 (Python-3.11.7.tar.xz) = 11e06f2ffe1f66888cb5b4e9f607de815294d6863a77eda6ec6d7c724ef158df9f51881f4a956d4a6fa973c2fb6fd031d495e3496e9b0bb53793fb1cc8434c63
@@ -10,4 +10,4 @@ SHA1 (patch-Lib_lib2to3_pgen2_driver.py)
SHA1 (patch-Lib_sysconfig.py) = bc6d91bf8f7121456b26ea7f080f588c96f2596f
SHA1 (patch-Makefile.pre.in) = fdb5794d112f422a1f28aa9f8b179dc05520f9e1
SHA1 (patch-configure) = a6d9a00ff160581245bc30d1b0d2ec0e9da8fb0b
-SHA1 (patch-setup.py) = a601ce207f5e61d15503c8781e925353d1e516b9
+SHA1 (patch-setup.py) = 874b114febf51181509593a272ad5cdd4acaf3b4
Index: pkgsrc/lang/python311/patches/patch-setup.py
diff -u pkgsrc/lang/python311/patches/patch-setup.py:1.2 pkgsrc/lang/python311/patches/patch-setup.py:1.3
--- pkgsrc/lang/python311/patches/patch-setup.py:1.2 Mon Oct 23 06:36:00 2023
+++ pkgsrc/lang/python311/patches/patch-setup.py Sat Jan 13 04:24:28 2024
@@ -1,4 +1,4 @@
-$NetBSD: patch-setup.py,v 1.2 2023/10/23 06:36:00 wiz Exp $
+$NetBSD: patch-setup.py,v 1.3 2024/01/13 04:24:28 riastradh Exp $
Disable certain modules, so they can be built as separate packages.
Do not look for ncursesw.
@@ -8,8 +8,11 @@ Don't search for modules in PREFIX. Fixe
are installed.
Enable cross-build by setting sys._home and sys.path to build directory
Module _crypt might need -lcrypt (taken from Python 3.10).
+Disable circuitous readline detection which tries to outsmart pkgsrc's
+static choice of libreadline and (fake-)ncurses and trips over its elven
+shoelaces when cross-compiling.
---- setup.py.orig 2022-10-24 17:35:39.000000000 +0000
+--- setup.py.orig 2023-12-04 17:56:29.000000000 +0000
+++ setup.py
@@ -1,5 +1,11 @@
# Autodetecting setup.py script for building the Python extensions
@@ -100,16 +103,82 @@ Module _crypt might need -lcrypt (taken
# This should work on any unixy platform ;-)
# If the user has bothered specifying additional -I and -L flags
# in OPT and LDFLAGS we might as well use them here.
-@@ -1074,8 +1095,6 @@ class PyBuildExt(build_ext):
- # use the same library for the readline and curses modules.
- if 'curses' in readline_termcap_library:
- curses_library = readline_termcap_library
+@@ -1036,71 +1057,10 @@ class PyBuildExt(build_ext):
+ def detect_readline_curses(self):
+ # readline
+ readline_termcap_library = ""
+- curses_library = ""
+- # Cannot use os.popen here in py3k.
+- tmpfile = os.path.join(self.build_temp, 'readline_termcap_lib')
+- if not os.path.exists(self.build_temp):
+- os.makedirs(self.build_temp)
+- # Determine if readline is already linked against curses or tinfo.
+- if sysconfig.get_config_var('HAVE_LIBREADLINE'):
+- if sysconfig.get_config_var('WITH_EDITLINE'):
+- readline_lib = 'edit'
+- else:
+- readline_lib = 'readline'
+- do_readline = self.compiler.find_library_file(self.lib_dirs,
+- readline_lib)
+- if CROSS_COMPILING:
+- ret = run_command("%s -d %s | grep '(NEEDED)' > %s"
+- % (sysconfig.get_config_var('READELF'),
+- do_readline, tmpfile))
+- elif find_executable('ldd'):
+- ret = run_command("ldd %s > %s" % (do_readline, tmpfile))
+- else:
+- ret = 1
+- if ret == 0:
+- with open(tmpfile) as fp:
+- for ln in fp:
+- if 'curses' in ln:
+- readline_termcap_library = re.sub(
+- r'.*lib(n?cursesw?)\.so.*', r'\1', ln
+- ).rstrip()
+- break
+- # termcap interface split out from ncurses
+- if 'tinfo' in ln:
+- readline_termcap_library = 'tinfo'
+- break
+- if os.path.exists(tmpfile):
+- os.unlink(tmpfile)
+- else:
+- do_readline = False
+- # Issue 7384: If readline is already linked against curses,
+- # use the same library for the readline and curses modules.
+- if 'curses' in readline_termcap_library:
+- curses_library = readline_termcap_library
- elif self.compiler.find_library_file(self.lib_dirs, 'ncursesw'):
- curses_library = 'ncursesw'
- # Issue 36210: OSS provided ncurses does not link on AIX
- # Use IBM supplied 'curses' for successful build of _curses
- elif AIX and self.compiler.find_library_file(self.lib_dirs, 'curses'):
-@@ -1166,8 +1185,7 @@ class PyBuildExt(build_ext):
+- # Issue 36210: OSS provided ncurses does not link on AIX
+- # Use IBM supplied 'curses' for successful build of _curses
+- elif AIX and self.compiler.find_library_file(self.lib_dirs, 'curses'):
+- curses_library = 'curses'
+- elif self.compiler.find_library_file(self.lib_dirs, 'ncurses'):
+- curses_library = 'ncurses'
+- elif self.compiler.find_library_file(self.lib_dirs, 'curses'):
+- curses_library = 'curses'
++ curses_library = "ncurses"
++ do_readline = True
++ readline_lib = 'readline'
+
+- if MACOS:
+- os_release = int(os.uname()[2].split('.')[0])
+- dep_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
+- if (dep_target and
+- (tuple(int(n) for n in dep_target.split('.')[0:2])
+- < (10, 5) ) ):
+- os_release = 8
+- if os_release < 9:
+- # MacOSX 10.4 has a broken readline. Don't try to build
+- # the readline module unless the user has installed a fixed
+- # readline package
+- if find_file('readline/rlconf.h', self.inc_dirs, []) is None:
+- do_readline = False
+ if do_readline:
+ readline_libs = [readline_lib]
+ if readline_termcap_library:
+@@ -1169,8 +1129,7 @@ class PyBuildExt(build_ext):
# If the curses module is enabled, check for the panel module
# _curses_panel needs some form of ncurses
skip_curses_panel = True if AIX else False
@@ -119,7 +188,7 @@ Module _crypt might need -lcrypt (taken
self.add(Extension('_curses_panel', ['_curses_panel.c'],
include_dirs=curses_includes,
define_macros=curses_defines,
-@@ -1176,7 +1194,11 @@ class PyBuildExt(build_ext):
+@@ -1179,7 +1138,11 @@ class PyBuildExt(build_ext):
self.missing.append('_curses_panel')
def detect_crypt(self):
@@ -132,7 +201,7 @@ Module _crypt might need -lcrypt (taken
def detect_dbm_gdbm(self):
# Modules that provide persistent dictionary-like semantics. You will
-@@ -1199,6 +1221,31 @@ class PyBuildExt(build_ext):
+@@ -1202,6 +1165,31 @@ class PyBuildExt(build_ext):
# The standard Unix dbm module:
if not CYGWIN:
@@ -164,7 +233,7 @@ Module _crypt might need -lcrypt (taken
config_args = [arg.strip("'")
for arg in sysconfig.get_config_var("CONFIG_ARGS").split()]
dbm_args = [arg for arg in config_args
-@@ -1616,7 +1663,7 @@ def main():
+@@ -1619,7 +1607,7 @@ def main():
# If you change the scripts installed here, you also need to
# check the PyBuildScripts command above, and change the links
# created by the bininstall target in Makefile.pre.in
Index: pkgsrc/lang/python39/distinfo
diff -u pkgsrc/lang/python39/distinfo:1.37 pkgsrc/lang/python39/distinfo:1.38
--- pkgsrc/lang/python39/distinfo:1.37 Fri Nov 10 09:48:39 2023
+++ pkgsrc/lang/python39/distinfo Sat Jan 13 04:24:28 2024
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.37 2023/11/10 09:48:39 nia Exp $
+$NetBSD: distinfo,v 1.38 2024/01/13 04:24:28 riastradh Exp $
BLAKE2s (Python-3.9.18.tar.xz) = 429256eb52e94427ae86302633ce8b01ba42d37c44c59e89fa0ae09b721da63f
SHA512 (Python-3.9.18.tar.xz) = aab155aca757d298394eddb91ff9a8f239665bd46feb495c6b6f735bbcb7489c05c858cc4cd08f1575c24f293b33492d763e9a140d92f0b2b0cc81a165a677c7
@@ -21,4 +21,4 @@ SHA1 (patch-Modules_socketmodule.h) = 87
SHA1 (patch-Python_thread__pthread.h) = 25609f722ac9c17a49023ddc6882545d9d7798ff
SHA1 (patch-configure) = 944b8bb9601fd064333305778fb57997ce0ac531
SHA1 (patch-pyconfig.h.in) = 2f06af7358690b46eaff404226b898962b049a0e
-SHA1 (patch-setup.py) = dab93079027f8ac6a259c9e683d35fe7b66c57e5
+SHA1 (patch-setup.py) = 185090e3497763ca271316b5ff4df7f1e72d1c14
Index: pkgsrc/lang/python39/patches/patch-setup.py
diff -u pkgsrc/lang/python39/patches/patch-setup.py:1.10 pkgsrc/lang/python39/patches/patch-setup.py:1.11
--- pkgsrc/lang/python39/patches/patch-setup.py:1.10 Mon Oct 23 06:36:01 2023
+++ pkgsrc/lang/python39/patches/patch-setup.py Sat Jan 13 04:24:29 2024
@@ -1,4 +1,4 @@
-$NetBSD: patch-setup.py,v 1.10 2023/10/23 06:36:01 wiz Exp $
+$NetBSD: patch-setup.py,v 1.11 2024/01/13 04:24:29 riastradh Exp $
Disable certain modules, so they can be built as separate packages.
Do not look for ncursesw.
@@ -7,8 +7,11 @@ which will get transformed to panel in b
Don't search for modules in PREFIX. Fixes build failure when py-setuptools
are installed.
Enable cross-build by setting sys._home and sys.path to build directory
+Disable circuitous readline detection which tries to outsmart pkgsrc's
+static choice of libreadline and (fake-)ncurses and trips over its elven
+shoelaces when cross-compiling.
---- setup.py.orig 2022-03-23 21:12:08.000000000 +0000
+--- setup.py.orig 2023-08-24 17:59:28.000000000 +0000
+++ setup.py
@@ -1,5 +1,11 @@
# Autodetecting setup.py script for building the Python extensions
@@ -100,16 +103,75 @@ Enable cross-build by setting sys._home
# This should work on any unixy platform ;-)
# If the user has bothered specifying additional -I and -L flags
# in OPT and LDFLAGS we might as well use them here.
-@@ -1006,8 +1026,6 @@ class PyBuildExt(build_ext):
- # use the same library for the readline and curses modules.
- if 'curses' in readline_termcap_library:
- curses_library = readline_termcap_library
+@@ -971,65 +991,10 @@ class PyBuildExt(build_ext):
+
+ def detect_readline_curses(self):
+ # readline
+- do_readline = self.compiler.find_library_file(self.lib_dirs, 'readline')
++ do_readline = True
+ readline_termcap_library = ""
+- curses_library = ""
+- # Cannot use os.popen here in py3k.
+- tmpfile = os.path.join(self.build_temp, 'readline_termcap_lib')
+- if not os.path.exists(self.build_temp):
+- os.makedirs(self.build_temp)
+- # Determine if readline is already linked against curses or tinfo.
+- if do_readline:
+- if CROSS_COMPILING:
+- ret = run_command("%s -d %s | grep '(NEEDED)' > %s"
+- % (sysconfig.get_config_var('READELF'),
+- do_readline, tmpfile))
+- elif find_executable('ldd'):
+- ret = run_command("ldd %s > %s" % (do_readline, tmpfile))
+- else:
+- ret = 1
+- if ret == 0:
+- with open(tmpfile) as fp:
+- for ln in fp:
+- if 'curses' in ln:
+- readline_termcap_library = re.sub(
+- r'.*lib(n?cursesw?)\.so.*', r'\1', ln
+- ).rstrip()
+- break
+- # termcap interface split out from ncurses
+- if 'tinfo' in ln:
+- readline_termcap_library = 'tinfo'
+- break
+- if os.path.exists(tmpfile):
+- os.unlink(tmpfile)
+- # Issue 7384: If readline is already linked against curses,
+- # use the same library for the readline and curses modules.
+- if 'curses' in readline_termcap_library:
+- curses_library = readline_termcap_library
- elif self.compiler.find_library_file(self.lib_dirs, 'ncursesw'):
- curses_library = 'ncursesw'
- # Issue 36210: OSS provided ncurses does not link on AIX
- # Use IBM supplied 'curses' for successful build of _curses
- elif AIX and self.compiler.find_library_file(self.lib_dirs, 'curses'):
-@@ -1109,8 +1127,7 @@ class PyBuildExt(build_ext):
+- # Issue 36210: OSS provided ncurses does not link on AIX
+- # Use IBM supplied 'curses' for successful build of _curses
+- elif AIX and self.compiler.find_library_file(self.lib_dirs, 'curses'):
+- curses_library = 'curses'
+- elif self.compiler.find_library_file(self.lib_dirs, 'ncurses'):
+- curses_library = 'ncurses'
+- elif self.compiler.find_library_file(self.lib_dirs, 'curses'):
+- curses_library = 'curses'
++ curses_library = "ncurses"
+
+- if MACOS:
+- os_release = int(os.uname()[2].split('.')[0])
+- dep_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
+- if (dep_target and
+- (tuple(int(n) for n in dep_target.split('.')[0:2])
+- < (10, 5) ) ):
+- os_release = 8
+- if os_release < 9:
+- # MacOSX 10.4 has a broken readline. Don't try to build
+- # the readline module unless the user has installed a fixed
+- # readline package
+- if find_file('readline/rlconf.h', self.inc_dirs, []) is None:
+- do_readline = False
+ if do_readline:
+ if MACOS and os_release < 9:
+ # In every directory on the search path search for a dynamic
+@@ -1109,8 +1074,7 @@ class PyBuildExt(build_ext):
# If the curses module is enabled, check for the panel module
# _curses_panel needs some form of ncurses
skip_curses_panel = True if AIX else False
@@ -119,7 +181,7 @@ Enable cross-build by setting sys._home
self.add(Extension('_curses_panel', ['_curses_panel.c'],
include_dirs=curses_includes,
define_macros=curses_defines,
-@@ -1361,6 +1378,31 @@ class PyBuildExt(build_ext):
+@@ -1361,6 +1325,31 @@ class PyBuildExt(build_ext):
dbm_order = ['gdbm']
# The standard Unix dbm module:
if not CYGWIN:
@@ -151,7 +213,7 @@ Enable cross-build by setting sys._home
config_args = [arg.strip("'")
for arg in sysconfig.get_config_var("CONFIG_ARGS").split()]
dbm_args = [arg for arg in config_args
-@@ -1372,7 +1414,7 @@ class PyBuildExt(build_ext):
+@@ -1372,7 +1361,7 @@ class PyBuildExt(build_ext):
dbmext = None
for cand in dbm_order:
if cand == "ndbm":
@@ -160,7 +222,7 @@ Enable cross-build by setting sys._home
# Some systems have -lndbm, others have -lgdbm_compat,
# others don't have either
if self.compiler.find_library_file(self.lib_dirs,
-@@ -2209,10 +2251,7 @@ class PyBuildExt(build_ext):
+@@ -2209,10 +2198,7 @@ class PyBuildExt(build_ext):
sources = ['_decimal/_decimal.c']
depends = ['_decimal/docstrings.h']
else:
@@ -172,7 +234,7 @@ Enable cross-build by setting sys._home
libraries = ['m']
sources = [
'_decimal/_decimal.c',
-@@ -2597,7 +2636,7 @@ def main():
+@@ -2597,7 +2583,7 @@ def main():
# If you change the scripts installed here, you also need to
# check the PyBuildScripts command above, and change the links
# created by the bininstall target in Makefile.pre.in
Home |
Main Index |
Thread Index |
Old Index