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).diff -r1.29 -r1.30 pkgsrc/lang/python310/Makefile
(riastradh)
@@ -1,247 +1,248 @@ | @@ -1,247 +1,248 @@ | |||
1 | # $NetBSD: Makefile,v 1.29 2023/11/23 12:43:35 jperkin Exp $ | 1 | # $NetBSD: Makefile,v 1.30 2024/01/13 04:24:28 riastradh Exp $ | |
2 | 2 | |||
3 | .include "dist.mk" | 3 | .include "dist.mk" | |
4 | 4 | |||
5 | PKGNAME= python310-${PY_DISTVERSION} | 5 | PKGNAME= python310-${PY_DISTVERSION} | |
6 | PKGREVISION= 4 | 6 | PKGREVISION= 4 | |
7 | CATEGORIES= lang python | 7 | CATEGORIES= lang python | |
8 | 8 | |||
9 | MAINTAINER= pkgsrc-users@NetBSD.org | 9 | MAINTAINER= pkgsrc-users@NetBSD.org | |
10 | HOMEPAGE= https://www.python.org/ | 10 | HOMEPAGE= https://www.python.org/ | |
11 | COMMENT= Interpreted, interactive, object-oriented programming language | 11 | COMMENT= Interpreted, interactive, object-oriented programming language | |
12 | LICENSE= python-software-foundation | 12 | LICENSE= python-software-foundation | |
13 | 13 | |||
14 | CONFLICTS+= python-[0-9]* | 14 | CONFLICTS+= python-[0-9]* | |
15 | CONFLICTS+= py310-cElementTree-[0-9]* | 15 | CONFLICTS+= py310-cElementTree-[0-9]* | |
16 | CONFLICTS+= py310-curses-[0-9]* | 16 | CONFLICTS+= py310-curses-[0-9]* | |
17 | CONFLICTS+= py310-cursespanel-[0-9]* | 17 | CONFLICTS+= py310-cursespanel-[0-9]* | |
18 | CONFLICTS+= py310-expat-[0-9]* | 18 | CONFLICTS+= py310-expat-[0-9]* | |
19 | CONFLICTS+= py310-readline-[0-9]* | 19 | CONFLICTS+= py310-readline-[0-9]* | |
20 | CONFLICTS+= py310-sqlite3-[0-9]* | 20 | CONFLICTS+= py310-sqlite3-[0-9]* | |
21 | SUPERSEDES+= py310-cElementTree-[0-9]* | 21 | SUPERSEDES+= py310-cElementTree-[0-9]* | |
22 | SUPERSEDES+= py310-curses-[0-9]* | 22 | SUPERSEDES+= py310-curses-[0-9]* | |
23 | SUPERSEDES+= py310-cursespanel-[0-9]* | 23 | SUPERSEDES+= py310-cursespanel-[0-9]* | |
24 | SUPERSEDES+= py310-expat-[0-9]* | 24 | SUPERSEDES+= py310-expat-[0-9]* | |
25 | SUPERSEDES+= py310-readline-[0-9]* | 25 | SUPERSEDES+= py310-readline-[0-9]* | |
26 | SUPERSEDES+= py310-sqlite3-[0-9]* | 26 | SUPERSEDES+= py310-sqlite3-[0-9]* | |
27 | 27 | |||
28 | PLIST_AWK= -f ${PKGSRCDIR}/lang/python/plist-python.awk | 28 | PLIST_AWK= -f ${PKGSRCDIR}/lang/python/plist-python.awk | |
29 | PLIST_AWK_ENV+= PYVERS=310 | 29 | PLIST_AWK_ENV+= PYVERS=310 | |
30 | PRINT_PLIST_AWK+= /^[^@]/ && /[^\/]+\.pyc$$/ { | 30 | PRINT_PLIST_AWK+= /^[^@]/ && /[^\/]+\.pyc$$/ { | |
31 | PRINT_PLIST_AWK+= sub(/__pycache__\//, "") | 31 | PRINT_PLIST_AWK+= sub(/__pycache__\//, "") | |
32 | PRINT_PLIST_AWK+= sub(/\.cpython-310/, "")} | 32 | PRINT_PLIST_AWK+= sub(/\.cpython-310/, "")} | |
33 | PRINT_PLIST_AWK+= /^[^@]/ && /[^\/]+\.opt-1.pyc$$/ { | 33 | PRINT_PLIST_AWK+= /^[^@]/ && /[^\/]+\.opt-1.pyc$$/ { | |
34 | PRINT_PLIST_AWK+= sub(/.opt-[12].pyc$$/, ".pyo")} | 34 | PRINT_PLIST_AWK+= sub(/.opt-[12].pyc$$/, ".pyo")} | |
35 | 35 | |||
36 | USE_LANGUAGES= c c++ | 36 | USE_LANGUAGES= c c++ | |
37 | USE_TOOLS+= pkg-config | 37 | USE_TOOLS+= pkg-config | |
38 | GNU_CONFIGURE= yes | 38 | GNU_CONFIGURE= yes | |
39 | CONFIGURE_ARGS+= --enable-shared | 39 | CONFIGURE_ARGS+= --enable-shared | |
40 | CONFIGURE_ARGS+= --with-openssl=${BUILDLINK_PREFIX.openssl} | 40 | CONFIGURE_ARGS+= --with-openssl=${BUILDLINK_PREFIX.openssl} | |
41 | CONFIGURE_ARGS+= --with-readline=readline # XXX editline? | |||
41 | CONFIGURE_ARGS+= --with-system-expat | 42 | CONFIGURE_ARGS+= --with-system-expat | |
42 | CONFIGURE_ARGS+= --with-system-ffi | 43 | CONFIGURE_ARGS+= --with-system-ffi | |
43 | CONFIGURE_ARGS+= --without-ensurepip | 44 | CONFIGURE_ARGS+= --without-ensurepip | |
44 | CONFIGURE_ENV+= OPT=${CFLAGS:M*:Q} | 45 | CONFIGURE_ENV+= OPT=${CFLAGS:M*:Q} | |
45 | CONFIGURE_ENV+= ac_cv_path_mkdir=${TOOLS_PATH.mkdir} | 46 | CONFIGURE_ENV+= ac_cv_path_mkdir=${TOOLS_PATH.mkdir} | |
46 | PKGCONFIG_OVERRIDE+= Misc/python.pc.in Misc/python-embed.pc.in | 47 | PKGCONFIG_OVERRIDE+= Misc/python.pc.in Misc/python-embed.pc.in | |
47 | 48 | |||
48 | # NetBSD-8 curses has enough support for py-curses | 49 | # NetBSD-8 curses has enough support for py-curses | |
49 | USE_CURSES= getsyx wide | 50 | USE_CURSES= getsyx wide | |
50 | # But we build as ncurses still to get the full feature set easily | 51 | # But we build as ncurses still to get the full feature set easily | |
51 | FAKE_NCURSES= yes | 52 | FAKE_NCURSES= yes | |
52 | 53 | |||
53 | PTHREAD_OPTS+= require | 54 | PTHREAD_OPTS+= require | |
54 | .include "../../mk/pthread.buildlink3.mk" | 55 | .include "../../mk/pthread.buildlink3.mk" | |
55 | 56 | |||
56 | .include "../../mk/bsd.prefs.mk" | 57 | .include "../../mk/bsd.prefs.mk" | |
57 | 58 | |||
58 | .if ${USE_CROSS_COMPILE:U:tl} == "yes" | 59 | .if ${USE_CROSS_COMPILE:U:tl} == "yes" | |
59 | TOOL_DEPENDS+= ${PKGNAME}:../../${PKGPATH} | 60 | TOOL_DEPENDS+= ${PKGNAME}:../../${PKGPATH} | |
60 | CONFIGURE_ARGS+= PYTHON_FOR_BUILD=${TOOLBASE:Q}/bin/python3.10 | 61 | CONFIGURE_ARGS+= PYTHON_FOR_BUILD=${TOOLBASE:Q}/bin/python3.10 | |
61 | CONFIGURE_ARGS+= MACHDEP=${PY_PLATNAME} | 62 | CONFIGURE_ARGS+= MACHDEP=${PY_PLATNAME} | |
62 | CONFIGURE_ARGS+= ac_sys_system=${OPSYS} | 63 | CONFIGURE_ARGS+= ac_sys_system=${OPSYS} | |
63 | . if ${OPSYS} == "OSF1" | 64 | . if ${OPSYS} == "OSF1" | |
64 | CONFIGURE_ARGS+= ac_cv_buggy_getaddrinfo=true | 65 | CONFIGURE_ARGS+= ac_cv_buggy_getaddrinfo=true | |
65 | . else | 66 | . else | |
66 | CONFIGURE_ARGS+= ac_cv_buggy_getaddrinfo=false | 67 | CONFIGURE_ARGS+= ac_cv_buggy_getaddrinfo=false | |
67 | . endif | 68 | . endif | |
68 | CONFIGURE_ARGS.NetBSD+= ac_cv_file__dev_ptmx=yes | 69 | CONFIGURE_ARGS.NetBSD+= ac_cv_file__dev_ptmx=yes | |
69 | CONFIGURE_ARGS.NetBSD+= ac_cv_file__dev_ptc=no | 70 | CONFIGURE_ARGS.NetBSD+= ac_cv_file__dev_ptc=no | |
70 | ALL_ENV+= \ | 71 | ALL_ENV+= \ | |
71 | _PYTHON_HOST_PLATFORM=${LOWER_OPSYS}-${MACHINE_GNU_ARCH} | 72 | _PYTHON_HOST_PLATFORM=${LOWER_OPSYS}-${MACHINE_GNU_ARCH} | |
72 | ALL_ENV+= \ | 73 | ALL_ENV+= \ | |
73 | _PYTHON_PROJECT_BASE=${WRKSRC:Q} | 74 | _PYTHON_PROJECT_BASE=${WRKSRC:Q} | |
74 | ALL_ENV+= \ | 75 | ALL_ENV+= \ | |
75 | _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_${PY_PLATNAME:Q} | 76 | _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_${PY_PLATNAME:Q} | |
76 | .endif | 77 | .endif | |
77 | 78 | |||
78 | # http://bugs.python.org/issue13241 | 79 | # http://bugs.python.org/issue13241 | |
79 | .if !empty(MACHINE_PLATFORM:MDarwin-1[12].*) | 80 | .if !empty(MACHINE_PLATFORM:MDarwin-1[12].*) | |
80 | PKGSRC_COMPILER= clang | 81 | PKGSRC_COMPILER= clang | |
81 | PKG_CC= clang | 82 | PKG_CC= clang | |
82 | PKG_CXX= clang++ | 83 | PKG_CXX= clang++ | |
83 | .endif | 84 | .endif | |
84 | 85 | |||
85 | # Used in socketmodule.c to determine if a sethostname declaration is required | 86 | # Used in socketmodule.c to determine if a sethostname declaration is required | |
86 | CFLAGS.SunOS+= -DPKGSRC_OPSYS_VERSION=${OPSYS_VERSION} | 87 | CFLAGS.SunOS+= -DPKGSRC_OPSYS_VERSION=${OPSYS_VERSION} | |
87 | LIBS.SunOS+= -lrt # fdatasync() | 88 | LIBS.SunOS+= -lrt # fdatasync() | |
88 | .if ${OPSYS} == "SunOS" && ${OPSYS_VERSION} < 051100 | 89 | .if ${OPSYS} == "SunOS" && ${OPSYS_VERSION} < 051100 | |
89 | SUBST_CLASSES+= setup | 90 | SUBST_CLASSES+= setup | |
90 | SUBST_MESSAGE.setup= Replacing crypt with crypt_i | 91 | SUBST_MESSAGE.setup= Replacing crypt with crypt_i | |
91 | SUBST_STAGE.setup= pre-configure | 92 | SUBST_STAGE.setup= pre-configure | |
92 | SUBST_FILES.setup= setup.py | 93 | SUBST_FILES.setup= setup.py | |
93 | SUBST_SED.setup= -e "s,'crypt','crypt_i'," | 94 | SUBST_SED.setup= -e "s,'crypt','crypt_i'," | |
94 | .endif | 95 | .endif | |
95 | 96 | |||
96 | PY_VER_SUFFIX= 3.10 | 97 | PY_VER_SUFFIX= 3.10 | |
97 | 98 | |||
98 | .if ${OPSYS} == "Darwin" | 99 | .if ${OPSYS} == "Darwin" | |
99 | USE_TOOLS+= gmake | 100 | USE_TOOLS+= gmake | |
100 | .endif | 101 | .endif | |
101 | 102 | |||
102 | .include "platname.mk" | 103 | .include "platname.mk" | |
103 | PLIST_SUBST+= PY_PLATNAME=${PY_PLATNAME:Q} | 104 | PLIST_SUBST+= PY_PLATNAME=${PY_PLATNAME:Q} | |
104 | 105 | |||
105 | # For Xcode 5 and up, we need to search the SDK path for headers, otherwise | 106 | # For Xcode 5 and up, we need to search the SDK path for headers, otherwise | |
106 | # certain modules will not be built. | 107 | # certain modules will not be built. | |
107 | .if ${OPSYS} == "Darwin" && exists(${OSX_SDK_PATH:Q}/usr/include) | 108 | .if ${OPSYS} == "Darwin" && exists(${OSX_SDK_PATH:Q}/usr/include) | |
108 | CFLAGS+= -I${OSX_SDK_PATH:Q}/usr/include | 109 | CFLAGS+= -I${OSX_SDK_PATH:Q}/usr/include | |
109 | .endif | 110 | .endif | |
110 | 111 | |||
111 | PLIST_VARS+= nis | 112 | PLIST_VARS+= nis | |
112 | .for incdir in ${_OPSYS_INCLUDE_DIRS} | 113 | .for incdir in ${_OPSYS_INCLUDE_DIRS} | |
113 | . if (exists(${incdir}/rpc/rpc.h) || exists(${incdir}/tirpc/rpc/rpc.h)) | 114 | . if (exists(${incdir}/rpc/rpc.h) || exists(${incdir}/tirpc/rpc/rpc.h)) | |
114 | HAVE_RPC_H= yes | 115 | HAVE_RPC_H= yes | |
115 | . endif | 116 | . endif | |
116 | . if (exists(${incdir}/rpcsvc/yp_prot.h) || exists(${incdir}/nsl/rpcsvc/yp_prot.h)) | 117 | . if (exists(${incdir}/rpcsvc/yp_prot.h) || exists(${incdir}/nsl/rpcsvc/yp_prot.h)) | |
117 | HAVE_YP_PROT_H= yes | 118 | HAVE_YP_PROT_H= yes | |
118 | . endif | 119 | . endif | |
119 | .endfor | 120 | .endfor | |
120 | .if (${HAVE_RPC_H:Uno} == yes && ${HAVE_YP_PROT_H:Uno} == yes) | 121 | .if (${HAVE_RPC_H:Uno} == yes && ${HAVE_YP_PROT_H:Uno} == yes) | |
121 | PLIST.nis= yes | 122 | PLIST.nis= yes | |
122 | .endif | 123 | .endif | |
123 | 124 | |||
124 | PLIST_SUBST+= PY_VER_SUFFIX=${PY_VER_SUFFIX:Q} | 125 | PLIST_SUBST+= PY_VER_SUFFIX=${PY_VER_SUFFIX:Q} | |
125 | 126 | |||
126 | PRINT_PLIST_AWK+= { gsub(/${PY_PLATNAME}/, "$${PY_PLATNAME}") } | 127 | PRINT_PLIST_AWK+= { gsub(/${PY_PLATNAME}/, "$${PY_PLATNAME}") } | |
127 | PRINT_PLIST_AWK+= { gsub(/python${PY_VER_SUFFIX}/, \ | 128 | PRINT_PLIST_AWK+= { gsub(/python${PY_VER_SUFFIX}/, \ | |
128 | "python$${PY_VER_SUFFIX}") } | 129 | "python$${PY_VER_SUFFIX}") } | |
129 | 130 | |||
130 | TEST_TARGET= test | 131 | TEST_TARGET= test | |
131 | INSTALL_TARGET= altinstall | 132 | INSTALL_TARGET= altinstall | |
132 | 133 | |||
133 | REPLACE_INTERPRETER+= python | 134 | REPLACE_INTERPRETER+= python | |
134 | REPLACE.python.old= .*python[^ ]* | 135 | REPLACE.python.old= .*python[^ ]* | |
135 | REPLACE.python.new= ${PREFIX}/bin/python${PY_VER_SUFFIX} | 136 | REPLACE.python.new= ${PREFIX}/bin/python${PY_VER_SUFFIX} | |
136 | REPLACE_FILES.python+= Lib/base64.py | 137 | REPLACE_FILES.python+= Lib/base64.py | |
137 | REPLACE_FILES.python+= Lib/cProfile.py | 138 | REPLACE_FILES.python+= Lib/cProfile.py | |
138 | REPLACE_FILES.python+= Lib/cgi.py | 139 | REPLACE_FILES.python+= Lib/cgi.py | |
139 | REPLACE_FILES.python+= Lib/encodings/rot_13.py | 140 | REPLACE_FILES.python+= Lib/encodings/rot_13.py | |
140 | REPLACE_FILES.python+= Lib/idlelib/pyshell.py | 141 | REPLACE_FILES.python+= Lib/idlelib/pyshell.py | |
141 | REPLACE_FILES.python+= Lib/keyword.py | 142 | REPLACE_FILES.python+= Lib/keyword.py | |
142 | REPLACE_FILES.python+= Lib/lib2to3/pgen2/token.py | 143 | REPLACE_FILES.python+= Lib/lib2to3/pgen2/token.py | |
143 | REPLACE_FILES.python+= Lib/lib2to3/tests/data/different_encoding.py | 144 | REPLACE_FILES.python+= Lib/lib2to3/tests/data/different_encoding.py | |
144 | REPLACE_FILES.python+= Lib/lib2to3/tests/data/false_encoding.py | 145 | REPLACE_FILES.python+= Lib/lib2to3/tests/data/false_encoding.py | |
145 | REPLACE_FILES.python+= Lib/lib2to3/tests/pytree_idempotency.py | 146 | REPLACE_FILES.python+= Lib/lib2to3/tests/pytree_idempotency.py | |
146 | REPLACE_FILES.python+= Lib/pdb.py | 147 | REPLACE_FILES.python+= Lib/pdb.py | |
147 | REPLACE_FILES.python+= Lib/platform.py | 148 | REPLACE_FILES.python+= Lib/platform.py | |
148 | REPLACE_FILES.python+= Lib/profile.py | 149 | REPLACE_FILES.python+= Lib/profile.py | |
149 | REPLACE_FILES.python+= Lib/pydoc.py | 150 | REPLACE_FILES.python+= Lib/pydoc.py | |
150 | REPLACE_FILES.python+= Lib/quopri.py | 151 | REPLACE_FILES.python+= Lib/quopri.py | |
151 | REPLACE_FILES.python+= Lib/smtpd.py | 152 | REPLACE_FILES.python+= Lib/smtpd.py | |
152 | REPLACE_FILES.python+= Lib/smtplib.py | 153 | REPLACE_FILES.python+= Lib/smtplib.py | |
153 | REPLACE_FILES.python+= Lib/tabnanny.py | 154 | REPLACE_FILES.python+= Lib/tabnanny.py | |
154 | REPLACE_FILES.python+= Lib/tarfile.py | 155 | REPLACE_FILES.python+= Lib/tarfile.py | |
155 | REPLACE_FILES.python+= Lib/test/bisect_cmd.py | 156 | REPLACE_FILES.python+= Lib/test/bisect_cmd.py | |
156 | REPLACE_FILES.python+= Lib/test/crashers/recursive_call.py | 157 | REPLACE_FILES.python+= Lib/test/crashers/recursive_call.py | |
157 | REPLACE_FILES.python+= Lib/test/curses_tests.py | 158 | REPLACE_FILES.python+= Lib/test/curses_tests.py | |
158 | REPLACE_FILES.python+= Lib/test/re_tests.py | 159 | REPLACE_FILES.python+= Lib/test/re_tests.py | |
159 | REPLACE_FILES.python+= Lib/test/regrtest.py | 160 | REPLACE_FILES.python+= Lib/test/regrtest.py | |
160 | REPLACE_FILES.python+= Lib/timeit.py | 161 | REPLACE_FILES.python+= Lib/timeit.py | |
161 | REPLACE_FILES.python+= Lib/trace.py | 162 | REPLACE_FILES.python+= Lib/trace.py | |
162 | REPLACE_FILES.python+= Lib/turtledemo/__main__.py | 163 | REPLACE_FILES.python+= Lib/turtledemo/__main__.py | |
163 | REPLACE_FILES.python+= Lib/turtledemo/bytedesign.py | 164 | REPLACE_FILES.python+= Lib/turtledemo/bytedesign.py | |
164 | REPLACE_FILES.python+= Lib/turtledemo/clock.py | 165 | REPLACE_FILES.python+= Lib/turtledemo/clock.py | |
165 | REPLACE_FILES.python+= Lib/turtledemo/forest.py | 166 | REPLACE_FILES.python+= Lib/turtledemo/forest.py | |
166 | REPLACE_FILES.python+= Lib/turtledemo/fractalcurves.py | 167 | REPLACE_FILES.python+= Lib/turtledemo/fractalcurves.py | |
167 | REPLACE_FILES.python+= Lib/turtledemo/lindenmayer.py | 168 | REPLACE_FILES.python+= Lib/turtledemo/lindenmayer.py | |
168 | REPLACE_FILES.python+= Lib/turtledemo/minimal_hanoi.py | 169 | REPLACE_FILES.python+= Lib/turtledemo/minimal_hanoi.py | |
169 | REPLACE_FILES.python+= Lib/turtledemo/paint.py | 170 | REPLACE_FILES.python+= Lib/turtledemo/paint.py | |
170 | REPLACE_FILES.python+= Lib/turtledemo/peace.py | 171 | REPLACE_FILES.python+= Lib/turtledemo/peace.py | |
171 | REPLACE_FILES.python+= Lib/turtledemo/penrose.py | 172 | REPLACE_FILES.python+= Lib/turtledemo/penrose.py | |
172 | REPLACE_FILES.python+= Lib/turtledemo/planet_and_moon.py | 173 | REPLACE_FILES.python+= Lib/turtledemo/planet_and_moon.py | |
173 | REPLACE_FILES.python+= Lib/turtledemo/sorting_animate.py | 174 | REPLACE_FILES.python+= Lib/turtledemo/sorting_animate.py | |
174 | REPLACE_FILES.python+= Lib/turtledemo/tree.py | 175 | REPLACE_FILES.python+= Lib/turtledemo/tree.py | |
175 | REPLACE_FILES.python+= Lib/turtledemo/yinyang.py | 176 | REPLACE_FILES.python+= Lib/turtledemo/yinyang.py | |
176 | REPLACE_FILES.python+= Lib/uu.py | 177 | REPLACE_FILES.python+= Lib/uu.py | |
177 | REPLACE_FILES.python+= Lib/webbrowser.py | 178 | REPLACE_FILES.python+= Lib/webbrowser.py | |
178 | 179 | |||
179 | REPLACE_SH+= Misc/python-config.sh.in | 180 | REPLACE_SH+= Misc/python-config.sh.in | |
180 | 181 | |||
181 | # XXX: It might be needed to add manually more paths like ${PREFIX}/qt5/lib | 182 | # XXX: It might be needed to add manually more paths like ${PREFIX}/qt5/lib | |
182 | # Test: python -c 'from ctypes.util import find_library; print(find_library("ffi"));' | 183 | # Test: python -c 'from ctypes.util import find_library; print(find_library("ffi"));' | |
183 | SUBST_CLASSES+= findlib | 184 | SUBST_CLASSES+= findlib | |
184 | SUBST_MESSAGE.findlib= Fixing find_library(). | 185 | SUBST_MESSAGE.findlib= Fixing find_library(). | |
185 | SUBST_STAGE.findlib= pre-configure | 186 | SUBST_STAGE.findlib= pre-configure | |
186 | SUBST_FILES.findlib= Lib/ctypes/macholib/dyld.py | 187 | SUBST_FILES.findlib= Lib/ctypes/macholib/dyld.py | |
187 | SUBST_FILES.findlib+= Lib/ctypes/util.py | 188 | SUBST_FILES.findlib+= Lib/ctypes/util.py | |
188 | SUBST_FILES.findlib+= Lib/distutils/unixccompiler.py | 189 | SUBST_FILES.findlib+= Lib/distutils/unixccompiler.py | |
189 | SUBST_SED.findlib= -e 's,/usr/local,${PREFIX},' | 190 | SUBST_SED.findlib= -e 's,/usr/local,${PREFIX},' | |
190 | SUBST_SED.findlib+= -e "s!\('-Wl,-t'\)!'${COMPILER_RPATH_FLAG}${PREFIX}/lib', '-L${PREFIX}/lib', \1!" | 191 | SUBST_SED.findlib+= -e "s!\('-Wl,-t'\)!'${COMPILER_RPATH_FLAG}${PREFIX}/lib', '-L${PREFIX}/lib', \1!" | |
191 | SUBST_NOOP_OK.findlib= yes | 192 | SUBST_NOOP_OK.findlib= yes | |
192 | 193 | |||
193 | SUBST_CLASSES+= pkgversion | 194 | SUBST_CLASSES+= pkgversion | |
194 | SUBST_STAGE.pkgversion= pre-configure | 195 | SUBST_STAGE.pkgversion= pre-configure | |
195 | SUBST_FILES.pkgversion= Lib/lib2to3/pgen2/driver.py | 196 | SUBST_FILES.pkgversion= Lib/lib2to3/pgen2/driver.py | |
196 | SUBST_VARS.pkgversion= PKGVERSION_NOREV | 197 | SUBST_VARS.pkgversion= PKGVERSION_NOREV | |
197 | 198 | |||
198 | .include "options.mk" | 199 | .include "options.mk" | |
199 | 200 | |||
200 | CHECK_INTERPRETER_SKIP= lib/python${PY_VER_SUFFIX}/venv/scripts/posix/pydoc | 201 | CHECK_INTERPRETER_SKIP= lib/python${PY_VER_SUFFIX}/venv/scripts/posix/pydoc | |
201 | CHECK_INTERPRETER_SKIP+= lib/python${PY_VER_SUFFIX}/test/ziptestdata/exe_with_z64 | 202 | CHECK_INTERPRETER_SKIP+= lib/python${PY_VER_SUFFIX}/test/ziptestdata/exe_with_z64 | |
202 | CHECK_INTERPRETER_SKIP+= lib/python${PY_VER_SUFFIX}/test/ziptestdata/exe_with_zip | 203 | CHECK_INTERPRETER_SKIP+= lib/python${PY_VER_SUFFIX}/test/ziptestdata/exe_with_zip | |
203 | CHECK_INTERPRETER_SKIP+= lib/python${PY_VER_SUFFIX}/test/ziptestdata/header.sh | 204 | CHECK_INTERPRETER_SKIP+= lib/python${PY_VER_SUFFIX}/test/ziptestdata/header.sh | |
204 | 205 | |||
205 | # contain CONFIGURE_ARGS and CONFIGURE_ENV | 206 | # contain CONFIGURE_ARGS and CONFIGURE_ENV | |
206 | CHECK_WRKREF_SKIP+= lib/python${PY_VER_SUFFIX}/_sysconfigdata* | 207 | CHECK_WRKREF_SKIP+= lib/python${PY_VER_SUFFIX}/_sysconfigdata* | |
207 | CHECK_WRKREF_SKIP+= lib/python${PY_VER_SUFFIX}/__pycache__/_sysconfigdata* | 208 | CHECK_WRKREF_SKIP+= lib/python${PY_VER_SUFFIX}/__pycache__/_sysconfigdata* | |
208 | CHECK_WRKREF_SKIP+= lib/python${PY_VER_SUFFIX}/config-${PY_VER_SUFFIX}/Makefile | 209 | CHECK_WRKREF_SKIP+= lib/python${PY_VER_SUFFIX}/config-${PY_VER_SUFFIX}/Makefile | |
209 | 210 | |||
210 | # Avoid error: Cannot generate ./Include/opcode.h, python not found ! | 211 | # Avoid error: Cannot generate ./Include/opcode.h, python not found ! | |
211 | post-configure: | 212 | post-configure: | |
212 | touch ${WRKSRC}/Include/opcode.h | 213 | touch ${WRKSRC}/Include/opcode.h | |
213 | 214 | |||
214 | .if ${OPSYS} == "HPUX" | 215 | .if ${OPSYS} == "HPUX" | |
215 | post-install: hpux-postinstall | 216 | post-install: hpux-postinstall | |
216 | .PHONY: hpux-postinstall | 217 | .PHONY: hpux-postinstall | |
217 | hpux-postinstall: | 218 | hpux-postinstall: | |
218 | ${LN} -fs ${DESTDIR}${PREFIX}/lib/libpython3.10.sl \ | 219 | ${LN} -fs ${DESTDIR}${PREFIX}/lib/libpython3.10.sl \ | |
219 | ${DESTDIR}${PREFIX}/lib/libpython3.10.sl.1.0 | 220 | ${DESTDIR}${PREFIX}/lib/libpython3.10.sl.1.0 | |
220 | .endif | 221 | .endif | |
221 | 222 | |||
222 | INSTALLATION_DIRS+= lib/python${PY_VER_SUFFIX}/site-packages | 223 | INSTALLATION_DIRS+= lib/python${PY_VER_SUFFIX}/site-packages | |
223 | 224 | |||
224 | pre-install: setuptools-preinstall | 225 | pre-install: setuptools-preinstall | |
225 | .PHONY: setuptools-preinstall | 226 | .PHONY: setuptools-preinstall | |
226 | setuptools-preinstall: | 227 | setuptools-preinstall: | |
227 | ${INSTALL_DATA} ${.CURDIR}/../../devel/py-setuptools/files/_distutils_system_mod \ | 228 | ${INSTALL_DATA} ${.CURDIR}/../../devel/py-setuptools/files/_distutils_system_mod \ | |
228 | ${DESTDIR}${PREFIX}/lib/python${PY_VER_SUFFIX}/site-packages/_distutils_system_mod.py | 229 | ${DESTDIR}${PREFIX}/lib/python${PY_VER_SUFFIX}/site-packages/_distutils_system_mod.py | |
229 | 230 | |||
230 | .include "../../archivers/bzip2/buildlink3.mk" | 231 | .include "../../archivers/bzip2/buildlink3.mk" | |
231 | .include "../../archivers/xz/buildlink3.mk" | 232 | .include "../../archivers/xz/buildlink3.mk" | |
232 | .include "../../databases/sqlite3/buildlink3.mk" | 233 | .include "../../databases/sqlite3/buildlink3.mk" | |
233 | .include "../../devel/gettext-lib/buildlink3.mk" | 234 | .include "../../devel/gettext-lib/buildlink3.mk" | |
234 | .if ${USE_BUILTIN.gettext:U:tl} == no | 235 | .if ${USE_BUILTIN.gettext:U:tl} == no | |
235 | CONFIGURE_ENV+= ac_cv_lib_intl_textdomain=yes | 236 | CONFIGURE_ENV+= ac_cv_lib_intl_textdomain=yes | |
236 | .endif | 237 | .endif | |
237 | .include "../../devel/libffi/buildlink3.mk" | 238 | .include "../../devel/libffi/buildlink3.mk" | |
238 | .include "../../devel/libuuid/buildlink3.mk" | 239 | .include "../../devel/libuuid/buildlink3.mk" | |
239 | .include "../../devel/readline/buildlink3.mk" | 240 | .include "../../devel/readline/buildlink3.mk" | |
240 | .include "../../devel/zlib/buildlink3.mk" | 241 | .include "../../devel/zlib/buildlink3.mk" | |
241 | .include "../../security/openssl/buildlink3.mk" | 242 | .include "../../security/openssl/buildlink3.mk" | |
242 | .include "../../textproc/expat/buildlink3.mk" | 243 | .include "../../textproc/expat/buildlink3.mk" | |
243 | .include "../../mk/bdb.buildlink3.mk" | 244 | .include "../../mk/bdb.buildlink3.mk" | |
244 | .include "../../mk/curses.buildlink3.mk" | 245 | .include "../../mk/curses.buildlink3.mk" | |
245 | .include "../../mk/dlopen.buildlink3.mk" | 246 | .include "../../mk/dlopen.buildlink3.mk" | |
246 | .include "../../mk/oss.buildlink3.mk" | 247 | .include "../../mk/oss.buildlink3.mk" | |
247 | .include "../../mk/bsd.pkg.mk" | 248 | .include "../../mk/bsd.pkg.mk" |
@@ -1,19 +1,19 @@ | @@ -1,19 +1,19 @@ | |||
1 | $NetBSD: distinfo,v 1.27 2023/11/10 09:48:40 nia Exp $ | 1 | $NetBSD: distinfo,v 1.28 2024/01/13 04:24:28 riastradh Exp $ | |
2 | 2 | |||
3 | BLAKE2s (Python-3.10.13.tar.xz) = c714daeb2437980ce940e76db70f037d844bcddc06dddb6ac966cef281a2b514 | 3 | BLAKE2s (Python-3.10.13.tar.xz) = c714daeb2437980ce940e76db70f037d844bcddc06dddb6ac966cef281a2b514 | |
4 | SHA512 (Python-3.10.13.tar.xz) = 7579772e501486b2b07f78142082dee1e99c7643640098860ac0cf2ca87daf7588b0c00b1db1960146b37f56a6ed98fd08297c25c9a19b612cf6e6a258984da8 | 4 | SHA512 (Python-3.10.13.tar.xz) = 7579772e501486b2b07f78142082dee1e99c7643640098860ac0cf2ca87daf7588b0c00b1db1960146b37f56a6ed98fd08297c25c9a19b612cf6e6a258984da8 | |
5 | Size (Python-3.10.13.tar.xz) = 19663088 bytes | 5 | Size (Python-3.10.13.tar.xz) = 19663088 bytes | |
6 | SHA1 (patch-Lib_ctypes_util.py) = 3dec1b6b7a36e46cbfa0dfcd71c5e7fac9f60764 | 6 | SHA1 (patch-Lib_ctypes_util.py) = 3dec1b6b7a36e46cbfa0dfcd71c5e7fac9f60764 | |
7 | SHA1 (patch-Lib_distutils_unixccompiler.py) = 8a91e8f4f86517a62408c3a10ed5eb50c4091fbf | 7 | SHA1 (patch-Lib_distutils_unixccompiler.py) = 8a91e8f4f86517a62408c3a10ed5eb50c4091fbf | |
8 | SHA1 (patch-Lib_lib2to3_pgen2_driver.py) = 593c4e93c5653ab400f0a98b91db92630c0a7390 | 8 | SHA1 (patch-Lib_lib2to3_pgen2_driver.py) = 593c4e93c5653ab400f0a98b91db92630c0a7390 | |
9 | SHA1 (patch-Lib_sysconfig.py) = bc6d91bf8f7121456b26ea7f080f588c96f2596f | 9 | SHA1 (patch-Lib_sysconfig.py) = bc6d91bf8f7121456b26ea7f080f588c96f2596f | |
10 | SHA1 (patch-Lib_test_test__shutil.py) = 2eb724d490544e77610a19a07dc0f9336dba3e2f | 10 | SHA1 (patch-Lib_test_test__shutil.py) = 2eb724d490544e77610a19a07dc0f9336dba3e2f | |
11 | SHA1 (patch-Makefile.pre.in) = 932a89313e8f26c435675f2487eb2141876a5f5a | 11 | SHA1 (patch-Makefile.pre.in) = 932a89313e8f26c435675f2487eb2141876a5f5a | |
12 | SHA1 (patch-Modules_clinic_posixmodule.c.h) = 3729243da6b4df47a956db9b784b056189c6403e | 12 | SHA1 (patch-Modules_clinic_posixmodule.c.h) = 3729243da6b4df47a956db9b784b056189c6403e | |
13 | SHA1 (patch-Modules_posixmodule.c) = 1a1b866c9190fda8ca9c547085614b0f1d5469e1 | 13 | SHA1 (patch-Modules_posixmodule.c) = 1a1b866c9190fda8ca9c547085614b0f1d5469e1 | |
14 | SHA1 (patch-Modules_socketmodule.c) = 3e2db474b4ef08edd25528465605fff1d3d0f61b | 14 | SHA1 (patch-Modules_socketmodule.c) = 3e2db474b4ef08edd25528465605fff1d3d0f61b | |
15 | SHA1 (patch-Modules_socketmodule.h) = 8761c7238bc74e45adefb6e647dc3b39b7bdd81c | 15 | SHA1 (patch-Modules_socketmodule.h) = 8761c7238bc74e45adefb6e647dc3b39b7bdd81c | |
16 | SHA1 (patch-Python_thread__pthread.h) = b8efa178380fe48da4a0bf2bfa906851a314824e | 16 | SHA1 (patch-Python_thread__pthread.h) = b8efa178380fe48da4a0bf2bfa906851a314824e | |
17 | SHA1 (patch-configure) = 8ffe98e51407d10e46e7d1531f2e0e0b58e1cfa6 | 17 | SHA1 (patch-configure) = 8ffe98e51407d10e46e7d1531f2e0e0b58e1cfa6 | |
18 | SHA1 (patch-pyconfig.h.in) = 1ab77914315acbf0352d242ed66200bea54548f6 | 18 | SHA1 (patch-pyconfig.h.in) = 1ab77914315acbf0352d242ed66200bea54548f6 | |
19 | SHA1 (patch-setup.py) = 5ab776a53ad361fdea9004817a7157743ab42db7 | 19 | SHA1 (patch-setup.py) = 5d1907202ad38286b92f41a553f34cf87c965213 |
@@ -1,182 +1,251 @@ | @@ -1,182 +1,251 @@ | |||
1 | $NetBSD: patch-setup.py,v 1.7 2023/10/23 06:36:00 wiz Exp $ | 1 | $NetBSD: patch-setup.py,v 1.8 2024/01/13 04:24:28 riastradh Exp $ | |
2 | 2 | |||
3 | Disable certain modules, so they can be built as separate packages. | 3 | Disable certain modules, so they can be built as separate packages. | |
4 | Do not look for ncursesw. | 4 | Do not look for ncursesw. | |
5 | Assume panel_library is correct; this is a fix for ncurses' gnupanel | 5 | Assume panel_library is correct; this is a fix for ncurses' gnupanel | |
6 | which will get transformed to panel in buildlink. | 6 | which will get transformed to panel in buildlink. | |
7 | Don't search for modules in PREFIX. Fixes build failure when py-setuptools | 7 | Don't search for modules in PREFIX. Fixes build failure when py-setuptools | |
8 | are installed. | 8 | are installed. | |
9 | Enable cross-build by setting sys._home and sys.path to build directory | 9 | Enable cross-build by setting sys._home and sys.path to build directory | |
10 | Disable circuitous readline detection which tries to outsmart pkgsrc's | |||
11 | static choice of libreadline and (fake-)ncurses and trips over its elven | |||
12 | shoelaces when cross-compiling. | |||
10 | 13 | |||
11 | --- setup.py.orig 2022-03-23 20:12:04.000000000 +0000 | 14 | --- setup.py.orig 2023-08-24 12:46:25.000000000 +0000 | |
12 | +++ setup.py | 15 | +++ setup.py | |
13 | @@ -1,5 +1,11 @@ | 16 | @@ -1,5 +1,11 @@ | |
14 | # Autodetecting setup.py script for building the Python extensions | 17 | # Autodetecting setup.py script for building the Python extensions | |
15 | 18 | |||
16 | +import sys | 19 | +import sys | |
17 | +sys._home = __file__[:-len('/setup.py')] | 20 | +sys._home = __file__[:-len('/setup.py')] | |
18 | +sys.path.append(__file__[:-len('/setup.py')] + '/Lib') | 21 | +sys.path.append(__file__[:-len('/setup.py')] + '/Lib') | |
19 | +with open('pybuilddir.txt') as pybuilddir: | 22 | +with open('pybuilddir.txt') as pybuilddir: | |
20 | + sys.path.append(__file__[:-len('/setup.py')] + '/' + next(pybuilddir)) | 23 | + sys.path.append(__file__[:-len('/setup.py')] + '/' + next(pybuilddir)) | |
21 | + | 24 | + | |
22 | import argparse | 25 | import argparse | |
23 | import importlib._bootstrap | 26 | import importlib._bootstrap | |
24 | import importlib.machinery | 27 | import importlib.machinery | |
25 | @@ -13,6 +19,7 @@ import warnings | 28 | @@ -13,6 +19,7 @@ import warnings | |
26 | from glob import glob, escape | 29 | from glob import glob, escape | |
27 | import _osx_support | 30 | import _osx_support | |
28 | 31 | |||
29 | +sys.path = [p for p in sys.path if not re.compile('^' + sys.base_prefix + '/lib').match(p)] | 32 | +sys.path = [p for p in sys.path if not re.compile('^' + sys.base_prefix + '/lib').match(p)] | |
30 | 33 | |||
31 | try: | 34 | try: | |
32 | import subprocess | 35 | import subprocess | |
33 | @@ -45,6 +52,7 @@ with warnings.catch_warnings(): | 36 | @@ -45,6 +52,7 @@ with warnings.catch_warnings(): | |
34 | DeprecationWarning | 37 | DeprecationWarning | |
35 | ) | 38 | ) | |
36 | 39 | |||
37 | + from distutils import text_file | 40 | + from distutils import text_file | |
38 | from distutils.command.build_ext import build_ext | 41 | from distutils.command.build_ext import build_ext | |
39 | from distutils.command.build_scripts import build_scripts | 42 | from distutils.command.build_scripts import build_scripts | |
40 | from distutils.command.install import install | 43 | from distutils.command.install import install | |
41 | @@ -58,7 +66,7 @@ with warnings.catch_warnings(): | 44 | @@ -58,7 +66,7 @@ with warnings.catch_warnings(): | |
42 | TEST_EXTENSIONS = (sysconfig.get_config_var('TEST_MODULES') == 'yes') | 45 | TEST_EXTENSIONS = (sysconfig.get_config_var('TEST_MODULES') == 'yes') | |
43 | 46 | |||
44 | # This global variable is used to hold the list of modules to be disabled. | 47 | # This global variable is used to hold the list of modules to be disabled. | |
45 | -DISABLED_MODULE_LIST = [] | 48 | -DISABLED_MODULE_LIST = [] | |
46 | +DISABLED_MODULE_LIST = ["_gdbm", "_tkinter", "xxlimited"] | 49 | +DISABLED_MODULE_LIST = ["_gdbm", "_tkinter", "xxlimited"] | |
47 | 50 | |||
48 | # --list-module-names option used by Tools/scripts/generate_module_names.py | 51 | # --list-module-names option used by Tools/scripts/generate_module_names.py | |
49 | LIST_MODULE_NAMES = False | 52 | LIST_MODULE_NAMES = False | |
50 | @@ -249,6 +257,16 @@ def grep_headers_for(function, headers): | 53 | @@ -249,6 +257,16 @@ def grep_headers_for(function, headers): | |
51 | return False | 54 | return False | |
52 | 55 | |||
53 | 56 | |||
54 | +def grep_headers_for(function, headers): | 57 | +def grep_headers_for(function, headers): | |
55 | + for header in headers: | 58 | + for header in headers: | |
56 | + try: | 59 | + try: | |
57 | + with open(header, 'r') as f: | 60 | + with open(header, 'r') as f: | |
58 | + if function in f.read(): | 61 | + if function in f.read(): | |
59 | + return True | 62 | + return True | |
60 | + except UnicodeDecodeError: | 63 | + except UnicodeDecodeError: | |
61 | + pass | 64 | + pass | |
62 | + return False | 65 | + return False | |
63 | + | 66 | + | |
64 | def find_file(filename, std_dirs, paths): | 67 | def find_file(filename, std_dirs, paths): | |
65 | """Searches for the directory where a given file is located, | 68 | """Searches for the directory where a given file is located, | |
66 | and returns a possibly-empty list of additional directories, or None | 69 | and returns a possibly-empty list of additional directories, or None | |
67 | @@ -823,15 +841,15 @@ class PyBuildExt(build_ext): | 70 | @@ -822,15 +840,15 @@ class PyBuildExt(build_ext): | |
68 | add_dir_to_list(dir_list, directory) | 71 | add_dir_to_list(dir_list, directory) | |
69 | 72 | |||
70 | def configure_compiler(self): | 73 | def configure_compiler(self): | |
71 | - # Ensure that /usr/local is always used, but the local build | 74 | - # Ensure that /usr/local is always used, but the local build | |
72 | - # directories (i.e. '.' and 'Include') must be first. See issue | 75 | - # directories (i.e. '.' and 'Include') must be first. See issue | |
73 | - # 10520. | 76 | - # 10520. | |
74 | - if not CROSS_COMPILING: | 77 | - if not CROSS_COMPILING: | |
75 | - add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') | 78 | - add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') | |
76 | - add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') | 79 | - add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') | |
77 | - # only change this for cross builds for 3.3, issues on Mageia | 80 | - # only change this for cross builds for 3.3, issues on Mageia | |
78 | - if CROSS_COMPILING: | 81 | - if CROSS_COMPILING: | |
79 | - self.add_cross_compiling_paths() | 82 | - self.add_cross_compiling_paths() | |
80 | + # Add the buildlink directories for pkgsrc | 83 | + # Add the buildlink directories for pkgsrc | |
81 | + if os.environ.get('BUILDLINK_DIR'): | 84 | + if os.environ.get('BUILDLINK_DIR'): | |
82 | + dir = os.environ['BUILDLINK_DIR'] | 85 | + dir = os.environ['BUILDLINK_DIR'] | |
83 | + libdir = dir + '/lib' | 86 | + libdir = dir + '/lib' | |
84 | + incdir = dir + '/include' | 87 | + incdir = dir + '/include' | |
85 | + if libdir not in self.compiler.library_dirs: | 88 | + if libdir not in self.compiler.library_dirs: | |
86 | + self.compiler.library_dirs.insert(0, libdir) | 89 | + self.compiler.library_dirs.insert(0, libdir) | |
87 | + if incdir not in self.compiler.include_dirs: | 90 | + if incdir not in self.compiler.include_dirs: | |
88 | + self.compiler.include_dirs.insert(0, incdir) | 91 | + self.compiler.include_dirs.insert(0, incdir) | |
89 | self.add_multiarch_paths() | 92 | self.add_multiarch_paths() | |
90 | self.add_ldflags_cppflags() | 93 | self.add_ldflags_cppflags() | |
91 | 94 | |||
92 | @@ -879,6 +897,9 @@ class PyBuildExt(build_ext): | 95 | @@ -878,6 +896,9 @@ class PyBuildExt(build_ext): | |
93 | self.lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32'] | 96 | self.lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32'] | |
94 | 97 | |||
95 | if MACOS: | 98 | if MACOS: | |
96 | + self.inc_dirs.append(macosx_sdk_root() + '/usr/include') | 99 | + self.inc_dirs.append(macosx_sdk_root() + '/usr/include') | |
97 | + self.lib_dirs.append(macosx_sdk_root() + '/usr/lib') | 100 | + self.lib_dirs.append(macosx_sdk_root() + '/usr/lib') | |
98 | + | 101 | + | |
99 | # This should work on any unixy platform ;-) | 102 | # This should work on any unixy platform ;-) | |
100 | # If the user has bothered specifying additional -I and -L flags | 103 | # If the user has bothered specifying additional -I and -L flags | |
101 | # in OPT and LDFLAGS we might as well use them here. | 104 | # in OPT and LDFLAGS we might as well use them here. | |
102 | @@ -1106,8 +1127,6 @@ class PyBuildExt(build_ext): | 105 | @@ -1067,71 +1088,10 @@ class PyBuildExt(build_ext): | |
103 | # use the same library for the readline and curses modules. | 106 | def detect_readline_curses(self): | |
104 | if 'curses' in readline_termcap_library: | 107 | # readline | |
105 | curses_library = readline_termcap_library | 108 | readline_termcap_library = "" | |
109 | - curses_library = "" | |||
110 | - # Cannot use os.popen here in py3k. | |||
111 | - tmpfile = os.path.join(self.build_temp, 'readline_termcap_lib') | |||
112 | - if not os.path.exists(self.build_temp): | |||
113 | - os.makedirs(self.build_temp) | |||
114 | - # Determine if readline is already linked against curses or tinfo. | |||
115 | - if sysconfig.get_config_var('HAVE_LIBREADLINE'): | |||
116 | - if sysconfig.get_config_var('WITH_EDITLINE'): | |||
117 | - readline_lib = 'edit' | |||
118 | - else: | |||
119 | - readline_lib = 'readline' | |||
120 | - do_readline = self.compiler.find_library_file(self.lib_dirs, | |||
121 | - readline_lib) | |||
122 | - if CROSS_COMPILING: | |||
123 | - ret = run_command("%s -d %s | grep '(NEEDED)' > %s" | |||
124 | - % (sysconfig.get_config_var('READELF'), | |||
125 | - do_readline, tmpfile)) | |||
126 | - elif find_executable('ldd'): | |||
127 | - ret = run_command("ldd %s > %s" % (do_readline, tmpfile)) | |||
128 | - else: | |||
129 | - ret = 1 | |||
130 | - if ret == 0: | |||
131 | - with open(tmpfile) as fp: | |||
132 | - for ln in fp: | |||
133 | - if 'curses' in ln: | |||
134 | - readline_termcap_library = re.sub( | |||
135 | - r'.*lib(n?cursesw?)\.so.*', r'\1', ln | |||
136 | - ).rstrip() | |||
137 | - break | |||
138 | - # termcap interface split out from ncurses | |||
139 | - if 'tinfo' in ln: | |||
140 | - readline_termcap_library = 'tinfo' | |||
141 | - break | |||
142 | - if os.path.exists(tmpfile): | |||
143 | - os.unlink(tmpfile) | |||
144 | - else: | |||
145 | - do_readline = False | |||
146 | - # Issue 7384: If readline is already linked against curses, | |||
147 | - # use the same library for the readline and curses modules. | |||
148 | - if 'curses' in readline_termcap_library: | |||
149 | - curses_library = readline_termcap_library | |||
106 | - elif self.compiler.find_library_file(self.lib_dirs, 'ncursesw'): | 150 | - elif self.compiler.find_library_file(self.lib_dirs, 'ncursesw'): | |
107 | - curses_library = 'ncursesw' | 151 | - curses_library = 'ncursesw' | |
108 | # Issue 36210: OSS provided ncurses does not link on AIX | 152 | - # Issue 36210: OSS provided ncurses does not link on AIX | |
109 | # Use IBM supplied 'curses' for successful build of _curses | 153 | - # Use IBM supplied 'curses' for successful build of _curses | |
110 | elif AIX and self.compiler.find_library_file(self.lib_dirs, 'curses'): | 154 | - elif AIX and self.compiler.find_library_file(self.lib_dirs, 'curses'): | |
111 | @@ -1211,8 +1230,7 @@ class PyBuildExt(build_ext): | 155 | - curses_library = 'curses' | |
156 | - elif self.compiler.find_library_file(self.lib_dirs, 'ncurses'): | |||
157 | - curses_library = 'ncurses' | |||
158 | - elif self.compiler.find_library_file(self.lib_dirs, 'curses'): | |||
159 | - curses_library = 'curses' | |||
160 | + curses_library = "ncurses" | |||
161 | + do_readline = True | |||
162 | + readline_lib = 'readline' | |||
163 | ||||
164 | - if MACOS: | |||
165 | - os_release = int(os.uname()[2].split('.')[0]) | |||
166 | - dep_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') | |||
167 | - if (dep_target and | |||
168 | - (tuple(int(n) for n in dep_target.split('.')[0:2]) | |||
169 | - < (10, 5) ) ): | |||
170 | - os_release = 8 | |||
171 | - if os_release < 9: | |||
172 | - # MacOSX 10.4 has a broken readline. Don't try to build | |||
173 | - # the readline module unless the user has installed a fixed | |||
174 | - # readline package | |||
175 | - if find_file('readline/rlconf.h', self.inc_dirs, []) is None: | |||
176 | - do_readline = False | |||
177 | if do_readline: | |||
178 | if MACOS and os_release < 9: | |||
179 | # In every directory on the search path search for a dynamic | |||
180 | @@ -1213,8 +1173,7 @@ class PyBuildExt(build_ext): | |||
112 | # If the curses module is enabled, check for the panel module | 181 | # If the curses module is enabled, check for the panel module | |
113 | # _curses_panel needs some form of ncurses | 182 | # _curses_panel needs some form of ncurses | |
114 | skip_curses_panel = True if AIX else False | 183 | skip_curses_panel = True if AIX else False | |
115 | - if (curses_enabled and not skip_curses_panel and | 184 | - if (curses_enabled and not skip_curses_panel and | |
116 | - self.compiler.find_library_file(self.lib_dirs, panel_library)): | 185 | - self.compiler.find_library_file(self.lib_dirs, panel_library)): | |
117 | + if curses_enabled and not skip_curses_panel: | 186 | + if curses_enabled and not skip_curses_panel: | |
118 | self.add(Extension('_curses_panel', ['_curses_panel.c'], | 187 | self.add(Extension('_curses_panel', ['_curses_panel.c'], | |
119 | include_dirs=curses_includes, | 188 | include_dirs=curses_includes, | |
120 | define_macros=curses_defines, | 189 | define_macros=curses_defines, | |
121 | @@ -1457,6 +1475,31 @@ class PyBuildExt(build_ext): | 190 | @@ -1459,6 +1418,31 @@ class PyBuildExt(build_ext): | |
122 | dbm_order = ['gdbm'] | 191 | dbm_order = ['gdbm'] | |
123 | # The standard Unix dbm module: | 192 | # The standard Unix dbm module: | |
124 | if not CYGWIN: | 193 | if not CYGWIN: | |
125 | + # Top half based on find_file | 194 | + # Top half based on find_file | |
126 | + def find_ndbm_h(dirs): | 195 | + def find_ndbm_h(dirs): | |
127 | + ret = None | 196 | + ret = None | |
128 | + if MACOS: | 197 | + if MACOS: | |
129 | + sysroot = macosx_sdk_root() | 198 | + sysroot = macosx_sdk_root() | |
130 | + for dir in dirs: | 199 | + for dir in dirs: | |
131 | + f = os.path.join(dir, 'ndbm.h') | 200 | + f = os.path.join(dir, 'ndbm.h') | |
132 | + if MACOS and is_macosx_sdk_path(dir): | 201 | + if MACOS and is_macosx_sdk_path(dir): | |
133 | + f = os.path.join(sysroot, dir[1:], 'ndbm.h') | 202 | + f = os.path.join(sysroot, dir[1:], 'ndbm.h') | |
134 | + if not os.path.exists(f): | 203 | + if not os.path.exists(f): | |
135 | + continue | 204 | + continue | |
136 | + | 205 | + | |
137 | + ret = True | 206 | + ret = True | |
138 | + input = text_file.TextFile(f) | 207 | + input = text_file.TextFile(f) | |
139 | + while True: | 208 | + while True: | |
140 | + line = input.readline() | 209 | + line = input.readline() | |
141 | + if not line: | 210 | + if not line: | |
142 | + break | 211 | + break | |
143 | + if re.search('This file is part of GDBM', line): | 212 | + if re.search('This file is part of GDBM', line): | |
144 | + ret = None | 213 | + ret = None | |
145 | + break | 214 | + break | |
146 | + input.close() | 215 | + input.close() | |
147 | + break | 216 | + break | |
148 | + return ret | 217 | + return ret | |
149 | + | 218 | + | |
150 | config_args = [arg.strip("'") | 219 | config_args = [arg.strip("'") | |
151 | for arg in sysconfig.get_config_var("CONFIG_ARGS").split()] | 220 | for arg in sysconfig.get_config_var("CONFIG_ARGS").split()] | |
152 | dbm_args = [arg for arg in config_args | 221 | dbm_args = [arg for arg in config_args | |
153 | @@ -1468,7 +1511,7 @@ class PyBuildExt(build_ext): | 222 | @@ -1470,7 +1454,7 @@ class PyBuildExt(build_ext): | |
154 | dbmext = None | 223 | dbmext = None | |
155 | for cand in dbm_order: | 224 | for cand in dbm_order: | |
156 | if cand == "ndbm": | 225 | if cand == "ndbm": | |
157 | - if find_file("ndbm.h", self.inc_dirs, []) is not None: | 226 | - if find_file("ndbm.h", self.inc_dirs, []) is not None: | |
158 | + if find_ndbm_h(self.inc_dirs) is not None: | 227 | + if find_ndbm_h(self.inc_dirs) is not None: | |
159 | # Some systems have -lndbm, others have -lgdbm_compat, | 228 | # Some systems have -lndbm, others have -lgdbm_compat, | |
160 | # others don't have either | 229 | # others don't have either | |
161 | if self.compiler.find_library_file(self.lib_dirs, | 230 | if self.compiler.find_library_file(self.lib_dirs, | |
162 | @@ -2328,10 +2371,7 @@ class PyBuildExt(build_ext): | 231 | @@ -2333,10 +2317,7 @@ class PyBuildExt(build_ext): | |
163 | sources = ['_decimal/_decimal.c'] | 232 | sources = ['_decimal/_decimal.c'] | |
164 | depends = ['_decimal/docstrings.h'] | 233 | depends = ['_decimal/docstrings.h'] | |
165 | else: | 234 | else: | |
166 | - include_dirs = [os.path.abspath(os.path.join(self.srcdir, | 235 | - include_dirs = [os.path.abspath(os.path.join(self.srcdir, | |
167 | - 'Modules', | 236 | - 'Modules', | |
168 | - '_decimal', | 237 | - '_decimal', | |
169 | - 'libmpdec'))] | 238 | - 'libmpdec'))] | |
170 | + include_dirs = ['Modules/_decimal/libmpdec'] | 239 | + include_dirs = ['Modules/_decimal/libmpdec'] | |
171 | libraries = ['m'] | 240 | libraries = ['m'] | |
172 | sources = [ | 241 | sources = [ | |
173 | '_decimal/_decimal.c', | 242 | '_decimal/_decimal.c', | |
174 | @@ -2747,7 +2787,7 @@ def main(): | 243 | @@ -2752,7 +2733,7 @@ def main(): | |
175 | # If you change the scripts installed here, you also need to | 244 | # If you change the scripts installed here, you also need to | |
176 | # check the PyBuildScripts command above, and change the links | 245 | # check the PyBuildScripts command above, and change the links | |
177 | # created by the bininstall target in Makefile.pre.in | 246 | # created by the bininstall target in Makefile.pre.in | |
178 | - scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3", | 247 | - scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3", | |
179 | + scripts = ["Tools/scripts/pydoc3", | 248 | + scripts = ["Tools/scripts/pydoc3", | |
180 | "Tools/scripts/2to3"] | 249 | "Tools/scripts/2to3"] | |
181 | ) | 250 | ) | |
182 | 251 |
@@ -1,251 +1,252 @@ | @@ -1,251 +1,252 @@ | |||
1 | # $NetBSD: Makefile,v 1.23 2023/12/28 13:12:24 thor Exp $ | 1 | # $NetBSD: Makefile,v 1.24 2024/01/13 04:24:28 riastradh Exp $ | |
2 | 2 | |||
3 | .include "dist.mk" | 3 | .include "dist.mk" | |
4 | 4 | |||
5 | PKGNAME= python311-${PY_DISTVERSION} | 5 | PKGNAME= python311-${PY_DISTVERSION} | |
6 | CATEGORIES= lang python | 6 | CATEGORIES= lang python | |
7 | 7 | |||
8 | MAINTAINER= pkgsrc-users@NetBSD.org | 8 | MAINTAINER= pkgsrc-users@NetBSD.org | |
9 | HOMEPAGE= https://www.python.org/ | 9 | HOMEPAGE= https://www.python.org/ | |
10 | COMMENT= Interpreted, interactive, object-oriented programming language | 10 | COMMENT= Interpreted, interactive, object-oriented programming language | |
11 | LICENSE= python-software-foundation | 11 | LICENSE= python-software-foundation | |
12 | 12 | |||
13 | CONFLICTS+= python-[0-9]* | 13 | CONFLICTS+= python-[0-9]* | |
14 | CONFLICTS+= py311-cElementTree-[0-9]* | 14 | CONFLICTS+= py311-cElementTree-[0-9]* | |
15 | CONFLICTS+= py311-curses-[0-9]* | 15 | CONFLICTS+= py311-curses-[0-9]* | |
16 | CONFLICTS+= py311-cursespanel-[0-9]* | 16 | CONFLICTS+= py311-cursespanel-[0-9]* | |
17 | CONFLICTS+= py311-expat-[0-9]* | 17 | CONFLICTS+= py311-expat-[0-9]* | |
18 | CONFLICTS+= py311-readline-[0-9]* | 18 | CONFLICTS+= py311-readline-[0-9]* | |
19 | CONFLICTS+= py311-sqlite3-[0-9]* | 19 | CONFLICTS+= py311-sqlite3-[0-9]* | |
20 | SUPERSEDES+= py311-cElementTree-[0-9]* | 20 | SUPERSEDES+= py311-cElementTree-[0-9]* | |
21 | SUPERSEDES+= py311-curses-[0-9]* | 21 | SUPERSEDES+= py311-curses-[0-9]* | |
22 | SUPERSEDES+= py311-cursespanel-[0-9]* | 22 | SUPERSEDES+= py311-cursespanel-[0-9]* | |
23 | SUPERSEDES+= py311-expat-[0-9]* | 23 | SUPERSEDES+= py311-expat-[0-9]* | |
24 | SUPERSEDES+= py311-readline-[0-9]* | 24 | SUPERSEDES+= py311-readline-[0-9]* | |
25 | SUPERSEDES+= py311-sqlite3-[0-9]* | 25 | SUPERSEDES+= py311-sqlite3-[0-9]* | |
26 | 26 | |||
27 | PLIST_AWK= -f ${PKGSRCDIR}/lang/python/plist-python.awk | 27 | PLIST_AWK= -f ${PKGSRCDIR}/lang/python/plist-python.awk | |
28 | PLIST_AWK_ENV+= PYVERS=311 | 28 | PLIST_AWK_ENV+= PYVERS=311 | |
29 | PRINT_PLIST_AWK+= /^[^@]/ && /[^\/]+\.pyc$$/ { | 29 | PRINT_PLIST_AWK+= /^[^@]/ && /[^\/]+\.pyc$$/ { | |
30 | PRINT_PLIST_AWK+= sub(/__pycache__\//, "") | 30 | PRINT_PLIST_AWK+= sub(/__pycache__\//, "") | |
31 | PRINT_PLIST_AWK+= sub(/\.cpython-311/, "")} | 31 | PRINT_PLIST_AWK+= sub(/\.cpython-311/, "")} | |
32 | PRINT_PLIST_AWK+= /^[^@]/ && /[^\/]+\.opt-1.pyc$$/ { | 32 | PRINT_PLIST_AWK+= /^[^@]/ && /[^\/]+\.opt-1.pyc$$/ { | |
33 | PRINT_PLIST_AWK+= sub(/.opt-[12].pyc$$/, ".pyo")} | 33 | PRINT_PLIST_AWK+= sub(/.opt-[12].pyc$$/, ".pyo")} | |
34 | 34 | |||
35 | USE_LANGUAGES= c c++ | 35 | USE_LANGUAGES= c c++ | |
36 | USE_TOOLS+= pkg-config | 36 | USE_TOOLS+= pkg-config | |
37 | USE_CC_FEATURES+= c11 | 37 | USE_CC_FEATURES+= c11 | |
38 | GNU_CONFIGURE= yes | 38 | GNU_CONFIGURE= yes | |
39 | CONFIGURE_ARGS+= --enable-shared | 39 | CONFIGURE_ARGS+= --enable-shared | |
40 | CONFIGURE_ARGS+= --with-openssl=${BUILDLINK_PREFIX.openssl} | 40 | CONFIGURE_ARGS+= --with-openssl=${BUILDLINK_PREFIX.openssl} | |
41 | CONFIGURE_ARGS+= --with-readline=readline # XXX editline? | |||
41 | CONFIGURE_ARGS+= --with-system-expat | 42 | CONFIGURE_ARGS+= --with-system-expat | |
42 | CONFIGURE_ARGS+= --with-system-ffi | 43 | CONFIGURE_ARGS+= --with-system-ffi | |
43 | CONFIGURE_ARGS+= --without-ensurepip | 44 | CONFIGURE_ARGS+= --without-ensurepip | |
44 | CONFIGURE_ENV+= OPT=${CFLAGS:M*:Q} | 45 | CONFIGURE_ENV+= OPT=${CFLAGS:M*:Q} | |
45 | CONFIGURE_ENV+= ac_cv_path_mkdir=${TOOLS_PATH.mkdir} | 46 | CONFIGURE_ENV+= ac_cv_path_mkdir=${TOOLS_PATH.mkdir} | |
46 | PKGCONFIG_OVERRIDE+= Misc/python.pc.in Misc/python-embed.pc.in | 47 | PKGCONFIG_OVERRIDE+= Misc/python.pc.in Misc/python-embed.pc.in | |
47 | 48 | |||
48 | # NetBSD-8 curses has enough support for py-curses | 49 | # NetBSD-8 curses has enough support for py-curses | |
49 | USE_CURSES= getsyx wide | 50 | USE_CURSES= getsyx wide | |
50 | # But we build as ncurses still to get the full feature set easily | 51 | # But we build as ncurses still to get the full feature set easily | |
51 | FAKE_NCURSES= yes | 52 | FAKE_NCURSES= yes | |
52 | 53 | |||
53 | PTHREAD_OPTS+= require | 54 | PTHREAD_OPTS+= require | |
54 | .include "../../mk/pthread.buildlink3.mk" | 55 | .include "../../mk/pthread.buildlink3.mk" | |
55 | 56 | |||
56 | .include "../../mk/bsd.prefs.mk" | 57 | .include "../../mk/bsd.prefs.mk" | |
57 | 58 | |||
58 | .if ${USE_CROSS_COMPILE:U:tl} == yes | 59 | .if ${USE_CROSS_COMPILE:U:tl} == yes | |
59 | TOOL_DEPENDS+= ${PKGNAME}:../../${PKGPATH} | 60 | TOOL_DEPENDS+= ${PKGNAME}:../../${PKGPATH} | |
60 | CONFIGURE_ARGS+= --with-build-python=${TOOLBASE:Q}/bin/python3.11 | 61 | CONFIGURE_ARGS+= --with-build-python=${TOOLBASE:Q}/bin/python3.11 | |
61 | CONFIGURE_ARGS+= MACHDEP=${PY_PLATNAME} | 62 | CONFIGURE_ARGS+= MACHDEP=${PY_PLATNAME} | |
62 | CONFIGURE_ARGS+= \ | 63 | CONFIGURE_ARGS+= \ | |
63 | _PYTHON_HOST_PLATFORM=${LOWER_OPSYS}-${MACHINE_GNU_ARCH} | 64 | _PYTHON_HOST_PLATFORM=${LOWER_OPSYS}-${MACHINE_GNU_ARCH} | |
64 | CONFIGURE_ARGS+= ac_sys_system=${OPSYS} | 65 | CONFIGURE_ARGS+= ac_sys_system=${OPSYS} | |
65 | . if ${OPSYS} == "OSF1" | 66 | . if ${OPSYS} == "OSF1" | |
66 | CONFIGURE_ARGS+= ac_cv_buggy_getaddrinfo=true | 67 | CONFIGURE_ARGS+= ac_cv_buggy_getaddrinfo=true | |
67 | . else | 68 | . else | |
68 | CONFIGURE_ARGS+= ac_cv_buggy_getaddrinfo=false | 69 | CONFIGURE_ARGS+= ac_cv_buggy_getaddrinfo=false | |
69 | . endif | 70 | . endif | |
70 | CONFIGURE_ARGS.NetBSD+= ac_cv_file__dev_ptmx=yes | 71 | CONFIGURE_ARGS.NetBSD+= ac_cv_file__dev_ptmx=yes | |
71 | CONFIGURE_ARGS.NetBSD+= ac_cv_file__dev_ptc=no | 72 | CONFIGURE_ARGS.NetBSD+= ac_cv_file__dev_ptc=no | |
72 | .endif | 73 | .endif | |
73 | 74 | |||
74 | # http://bugs.python.org/issue13241 | 75 | # http://bugs.python.org/issue13241 | |
75 | .if ${MACHINE_PLATFORM:MDarwin-1[12].*} | 76 | .if ${MACHINE_PLATFORM:MDarwin-1[12].*} | |
76 | PKGSRC_COMPILER= clang | 77 | PKGSRC_COMPILER= clang | |
77 | PKG_CC= clang | 78 | PKG_CC= clang | |
78 | PKG_CXX= clang++ | 79 | PKG_CXX= clang++ | |
79 | .endif | 80 | .endif | |
80 | 81 | |||
81 | # Used in socketmodule.c to determine if a sethostname declaration is required | 82 | # Used in socketmodule.c to determine if a sethostname declaration is required | |
82 | CFLAGS.SunOS+= -DPKGSRC_OPSYS_VERSION=${OPSYS_VERSION} | 83 | CFLAGS.SunOS+= -DPKGSRC_OPSYS_VERSION=${OPSYS_VERSION} | |
83 | LIBS.SunOS+= -lrt # fdatasync() | 84 | LIBS.SunOS+= -lrt # fdatasync() | |
84 | .if ${OPSYS} == "SunOS" && ${OPSYS_VERSION} < 051100 | 85 | .if ${OPSYS} == "SunOS" && ${OPSYS_VERSION} < 051100 | |
85 | SUBST_CLASSES+= setup | 86 | SUBST_CLASSES+= setup | |
86 | SUBST_MESSAGE.setup= Replacing crypt with crypt_i | 87 | SUBST_MESSAGE.setup= Replacing crypt with crypt_i | |
87 | SUBST_STAGE.setup= pre-configure | 88 | SUBST_STAGE.setup= pre-configure | |
88 | SUBST_FILES.setup= setup.py | 89 | SUBST_FILES.setup= setup.py | |
89 | SUBST_SED.setup= -e "s,'crypt','crypt_i'," | 90 | SUBST_SED.setup= -e "s,'crypt','crypt_i'," | |
90 | .endif | 91 | .endif | |
91 | 92 | |||
92 | PY_VER_SUFFIX= 3.11 | 93 | PY_VER_SUFFIX= 3.11 | |
93 | 94 | |||
94 | .if ${OPSYS} == "Darwin" | 95 | .if ${OPSYS} == "Darwin" | |
95 | USE_TOOLS+= gmake | 96 | USE_TOOLS+= gmake | |
96 | .endif | 97 | .endif | |
97 | 98 | |||
98 | .include "platname.mk" | 99 | .include "platname.mk" | |
99 | PLIST_SUBST+= PY_PLATNAME=${PY_PLATNAME:Q} | 100 | PLIST_SUBST+= PY_PLATNAME=${PY_PLATNAME:Q} | |
100 | 101 | |||
101 | # For Xcode 5 and up, we need to search the SDK path for headers, otherwise | 102 | # For Xcode 5 and up, we need to search the SDK path for headers, otherwise | |
102 | # certain modules will not be built. | 103 | # certain modules will not be built. | |
103 | .if ${OPSYS} == "Darwin" && exists(${OSX_SDK_PATH:Q}/usr/include) | 104 | .if ${OPSYS} == "Darwin" && exists(${OSX_SDK_PATH:Q}/usr/include) | |
104 | CFLAGS+= -I${OSX_SDK_PATH:Q}/usr/include | 105 | CFLAGS+= -I${OSX_SDK_PATH:Q}/usr/include | |
105 | .endif | 106 | .endif | |
106 | 107 | |||
107 | LDFLAGS.SunOS+= -lresolv | 108 | LDFLAGS.SunOS+= -lresolv | |
108 | 109 | |||
109 | PLIST_VARS+= dbm nis | 110 | PLIST_VARS+= dbm nis | |
110 | .if ${OPSYS} != "Linux" | 111 | .if ${OPSYS} != "Linux" | |
111 | PLIST.dbm= yes | 112 | PLIST.dbm= yes | |
112 | .endif | 113 | .endif | |
113 | .for incdir in ${_OPSYS_INCLUDE_DIRS} | 114 | .for incdir in ${_OPSYS_INCLUDE_DIRS} | |
114 | . if exists(${incdir}/rpc/rpc.h) | 115 | . if exists(${incdir}/rpc/rpc.h) | |
115 | HAVE_RPC_H= yes | 116 | HAVE_RPC_H= yes | |
116 | . elif exists(${incdir}/tirpc/rpc/rpc.h) | 117 | . elif exists(${incdir}/tirpc/rpc/rpc.h) | |
117 | CPPFLAGS+= -I${incdir}/tirpc | 118 | CPPFLAGS+= -I${incdir}/tirpc | |
118 | HAVE_RPC_H= yes | 119 | HAVE_RPC_H= yes | |
119 | . endif | 120 | . endif | |
120 | . if exists(${incdir}/rpcsvc/yp_prot.h) | 121 | . if exists(${incdir}/rpcsvc/yp_prot.h) | |
121 | HAVE_YP_PROT_H= yes | 122 | HAVE_YP_PROT_H= yes | |
122 | . elif exists(${incdir}/nsl/rpcsvc/yp_prot.h) | 123 | . elif exists(${incdir}/nsl/rpcsvc/yp_prot.h) | |
123 | CPPFLAGS+= -I${incdir}/nsl | 124 | CPPFLAGS+= -I${incdir}/nsl | |
124 | HAVE_YP_PROT_H= yes | 125 | HAVE_YP_PROT_H= yes | |
125 | . endif | 126 | . endif | |
126 | .endfor | 127 | .endfor | |
127 | .if (${HAVE_RPC_H:Uno} == yes && ${HAVE_YP_PROT_H:Uno} == yes) | 128 | .if (${HAVE_RPC_H:Uno} == yes && ${HAVE_YP_PROT_H:Uno} == yes) | |
128 | PLIST.nis= yes | 129 | PLIST.nis= yes | |
129 | .endif | 130 | .endif | |
130 | 131 | |||
131 | PLIST_SUBST+= PY_VER_SUFFIX=${PY_VER_SUFFIX:Q} | 132 | PLIST_SUBST+= PY_VER_SUFFIX=${PY_VER_SUFFIX:Q} | |
132 | 133 | |||
133 | PRINT_PLIST_AWK+= { gsub(/${PY_PLATNAME}/, "$${PY_PLATNAME}") } | 134 | PRINT_PLIST_AWK+= { gsub(/${PY_PLATNAME}/, "$${PY_PLATNAME}") } | |
134 | PRINT_PLIST_AWK+= { gsub(/python${PY_VER_SUFFIX}/, \ | 135 | PRINT_PLIST_AWK+= { gsub(/python${PY_VER_SUFFIX}/, \ | |
135 | "python$${PY_VER_SUFFIX}") } | 136 | "python$${PY_VER_SUFFIX}") } | |
136 | 137 | |||
137 | TEST_TARGET= test | 138 | TEST_TARGET= test | |
138 | INSTALL_TARGET= altinstall | 139 | INSTALL_TARGET= altinstall | |
139 | 140 | |||
140 | REPLACE_INTERPRETER+= python | 141 | REPLACE_INTERPRETER+= python | |
141 | REPLACE.python.old= .*python[^ ]* | 142 | REPLACE.python.old= .*python[^ ]* | |
142 | REPLACE.python.new= ${PREFIX}/bin/python${PY_VER_SUFFIX} | 143 | REPLACE.python.new= ${PREFIX}/bin/python${PY_VER_SUFFIX} | |
143 | REPLACE_FILES.python+= Lib/base64.py | 144 | REPLACE_FILES.python+= Lib/base64.py | |
144 | REPLACE_FILES.python+= Lib/cProfile.py | 145 | REPLACE_FILES.python+= Lib/cProfile.py | |
145 | REPLACE_FILES.python+= Lib/cgi.py | 146 | REPLACE_FILES.python+= Lib/cgi.py | |
146 | REPLACE_FILES.python+= Lib/encodings/rot_13.py | 147 | REPLACE_FILES.python+= Lib/encodings/rot_13.py | |
147 | REPLACE_FILES.python+= Lib/idlelib/pyshell.py | 148 | REPLACE_FILES.python+= Lib/idlelib/pyshell.py | |
148 | REPLACE_FILES.python+= Lib/lib2to3/pgen2/token.py | 149 | REPLACE_FILES.python+= Lib/lib2to3/pgen2/token.py | |
149 | REPLACE_FILES.python+= Lib/lib2to3/tests/data/different_encoding.py | 150 | REPLACE_FILES.python+= Lib/lib2to3/tests/data/different_encoding.py | |
150 | REPLACE_FILES.python+= Lib/lib2to3/tests/data/false_encoding.py | 151 | REPLACE_FILES.python+= Lib/lib2to3/tests/data/false_encoding.py | |
151 | REPLACE_FILES.python+= Lib/lib2to3/tests/pytree_idempotency.py | 152 | REPLACE_FILES.python+= Lib/lib2to3/tests/pytree_idempotency.py | |
152 | REPLACE_FILES.python+= Lib/pdb.py | 153 | REPLACE_FILES.python+= Lib/pdb.py | |
153 | REPLACE_FILES.python+= Lib/platform.py | 154 | REPLACE_FILES.python+= Lib/platform.py | |
154 | REPLACE_FILES.python+= Lib/profile.py | 155 | REPLACE_FILES.python+= Lib/profile.py | |
155 | REPLACE_FILES.python+= Lib/pydoc.py | 156 | REPLACE_FILES.python+= Lib/pydoc.py | |
156 | REPLACE_FILES.python+= Lib/quopri.py | 157 | REPLACE_FILES.python+= Lib/quopri.py | |
157 | REPLACE_FILES.python+= Lib/smtpd.py | 158 | REPLACE_FILES.python+= Lib/smtpd.py | |
158 | REPLACE_FILES.python+= Lib/smtplib.py | 159 | REPLACE_FILES.python+= Lib/smtplib.py | |
159 | REPLACE_FILES.python+= Lib/tabnanny.py | 160 | REPLACE_FILES.python+= Lib/tabnanny.py | |
160 | REPLACE_FILES.python+= Lib/tarfile.py | 161 | REPLACE_FILES.python+= Lib/tarfile.py | |
161 | REPLACE_FILES.python+= Lib/test/bisect_cmd.py | 162 | REPLACE_FILES.python+= Lib/test/bisect_cmd.py | |
162 | REPLACE_FILES.python+= Lib/test/crashers/recursive_call.py | 163 | REPLACE_FILES.python+= Lib/test/crashers/recursive_call.py | |
163 | REPLACE_FILES.python+= Lib/test/curses_tests.py | 164 | REPLACE_FILES.python+= Lib/test/curses_tests.py | |
164 | REPLACE_FILES.python+= Lib/test/re_tests.py | 165 | REPLACE_FILES.python+= Lib/test/re_tests.py | |
165 | REPLACE_FILES.python+= Lib/test/regrtest.py | 166 | REPLACE_FILES.python+= Lib/test/regrtest.py | |
166 | REPLACE_FILES.python+= Lib/timeit.py | 167 | REPLACE_FILES.python+= Lib/timeit.py | |
167 | REPLACE_FILES.python+= Lib/trace.py | 168 | REPLACE_FILES.python+= Lib/trace.py | |
168 | REPLACE_FILES.python+= Lib/turtledemo/__main__.py | 169 | REPLACE_FILES.python+= Lib/turtledemo/__main__.py | |
169 | REPLACE_FILES.python+= Lib/turtledemo/bytedesign.py | 170 | REPLACE_FILES.python+= Lib/turtledemo/bytedesign.py | |
170 | REPLACE_FILES.python+= Lib/turtledemo/clock.py | 171 | REPLACE_FILES.python+= Lib/turtledemo/clock.py | |
171 | REPLACE_FILES.python+= Lib/turtledemo/forest.py | 172 | REPLACE_FILES.python+= Lib/turtledemo/forest.py | |
172 | REPLACE_FILES.python+= Lib/turtledemo/fractalcurves.py | 173 | REPLACE_FILES.python+= Lib/turtledemo/fractalcurves.py | |
173 | REPLACE_FILES.python+= Lib/turtledemo/lindenmayer.py | 174 | REPLACE_FILES.python+= Lib/turtledemo/lindenmayer.py | |
174 | REPLACE_FILES.python+= Lib/turtledemo/minimal_hanoi.py | 175 | REPLACE_FILES.python+= Lib/turtledemo/minimal_hanoi.py | |
175 | REPLACE_FILES.python+= Lib/turtledemo/paint.py | 176 | REPLACE_FILES.python+= Lib/turtledemo/paint.py | |
176 | REPLACE_FILES.python+= Lib/turtledemo/peace.py | 177 | REPLACE_FILES.python+= Lib/turtledemo/peace.py | |
177 | REPLACE_FILES.python+= Lib/turtledemo/penrose.py | 178 | REPLACE_FILES.python+= Lib/turtledemo/penrose.py | |
178 | REPLACE_FILES.python+= Lib/turtledemo/planet_and_moon.py | 179 | REPLACE_FILES.python+= Lib/turtledemo/planet_and_moon.py | |
179 | REPLACE_FILES.python+= Lib/turtledemo/sorting_animate.py | 180 | REPLACE_FILES.python+= Lib/turtledemo/sorting_animate.py | |
180 | REPLACE_FILES.python+= Lib/turtledemo/tree.py | 181 | REPLACE_FILES.python+= Lib/turtledemo/tree.py | |
181 | REPLACE_FILES.python+= Lib/turtledemo/yinyang.py | 182 | REPLACE_FILES.python+= Lib/turtledemo/yinyang.py | |
182 | REPLACE_FILES.python+= Lib/uu.py | 183 | REPLACE_FILES.python+= Lib/uu.py | |
183 | REPLACE_FILES.python+= Lib/webbrowser.py | 184 | REPLACE_FILES.python+= Lib/webbrowser.py | |
184 | 185 | |||
185 | # XXX: It might be needed to add manually more paths like ${PREFIX}/qt5/lib | 186 | # XXX: It might be needed to add manually more paths like ${PREFIX}/qt5/lib | |
186 | # Test: python -c 'from ctypes.util import find_library; print(find_library("ffi"));' | 187 | # Test: python -c 'from ctypes.util import find_library; print(find_library("ffi"));' | |
187 | SUBST_CLASSES+= findlib | 188 | SUBST_CLASSES+= findlib | |
188 | SUBST_MESSAGE.findlib= Fixing find_library(). | 189 | SUBST_MESSAGE.findlib= Fixing find_library(). | |
189 | SUBST_STAGE.findlib= pre-configure | 190 | SUBST_STAGE.findlib= pre-configure | |
190 | SUBST_FILES.findlib= Lib/ctypes/macholib/dyld.py | 191 | SUBST_FILES.findlib= Lib/ctypes/macholib/dyld.py | |
191 | SUBST_FILES.findlib+= Lib/ctypes/util.py | 192 | SUBST_FILES.findlib+= Lib/ctypes/util.py | |
192 | SUBST_FILES.findlib+= Lib/distutils/unixccompiler.py | 193 | SUBST_FILES.findlib+= Lib/distutils/unixccompiler.py | |
193 | SUBST_SED.findlib= -e 's,/usr/local,${PREFIX},' | 194 | SUBST_SED.findlib= -e 's,/usr/local,${PREFIX},' | |
194 | SUBST_SED.findlib+= -e "s!\('-Wl,-t'\)!'${COMPILER_RPATH_FLAG}${PREFIX}/lib', '-L${PREFIX}/lib', \1!" | 195 | SUBST_SED.findlib+= -e "s!\('-Wl,-t'\)!'${COMPILER_RPATH_FLAG}${PREFIX}/lib', '-L${PREFIX}/lib', \1!" | |
195 | SUBST_NOOP_OK.findlib= yes | 196 | SUBST_NOOP_OK.findlib= yes | |
196 | 197 | |||
197 | SUBST_CLASSES+= pkgversion | 198 | SUBST_CLASSES+= pkgversion | |
198 | SUBST_STAGE.pkgversion= pre-configure | 199 | SUBST_STAGE.pkgversion= pre-configure | |
199 | SUBST_FILES.pkgversion= Lib/lib2to3/pgen2/driver.py | 200 | SUBST_FILES.pkgversion= Lib/lib2to3/pgen2/driver.py | |
200 | SUBST_VARS.pkgversion= PKGVERSION_NOREV | 201 | SUBST_VARS.pkgversion= PKGVERSION_NOREV | |
201 | 202 | |||
202 | .include "options.mk" | 203 | .include "options.mk" | |
203 | 204 | |||
204 | CHECK_INTERPRETER_SKIP= lib/python${PY_VER_SUFFIX}/venv/scripts/posix/pydoc | 205 | CHECK_INTERPRETER_SKIP= lib/python${PY_VER_SUFFIX}/venv/scripts/posix/pydoc | |
205 | CHECK_INTERPRETER_SKIP+= lib/python${PY_VER_SUFFIX}/test/ziptestdata/exe_with_z64 | 206 | CHECK_INTERPRETER_SKIP+= lib/python${PY_VER_SUFFIX}/test/ziptestdata/exe_with_z64 | |
206 | CHECK_INTERPRETER_SKIP+= lib/python${PY_VER_SUFFIX}/test/ziptestdata/exe_with_zip | 207 | CHECK_INTERPRETER_SKIP+= lib/python${PY_VER_SUFFIX}/test/ziptestdata/exe_with_zip | |
207 | CHECK_INTERPRETER_SKIP+= lib/python${PY_VER_SUFFIX}/test/ziptestdata/header.sh | 208 | CHECK_INTERPRETER_SKIP+= lib/python${PY_VER_SUFFIX}/test/ziptestdata/header.sh | |
208 | 209 | |||
209 | # contain CONFIGURE_ARGS and CONFIGURE_ENV | 210 | # contain CONFIGURE_ARGS and CONFIGURE_ENV | |
210 | CHECK_WRKREF_SKIP+= lib/python${PY_VER_SUFFIX}/_sysconfigdata* | 211 | CHECK_WRKREF_SKIP+= lib/python${PY_VER_SUFFIX}/_sysconfigdata* | |
211 | CHECK_WRKREF_SKIP+= lib/python${PY_VER_SUFFIX}/__pycache__/_sysconfigdata* | 212 | CHECK_WRKREF_SKIP+= lib/python${PY_VER_SUFFIX}/__pycache__/_sysconfigdata* | |
212 | CHECK_WRKREF_SKIP+= lib/python${PY_VER_SUFFIX}/config-${PY_VER_SUFFIX}/Makefile | 213 | CHECK_WRKREF_SKIP+= lib/python${PY_VER_SUFFIX}/config-${PY_VER_SUFFIX}/Makefile | |
213 | 214 | |||
214 | # Avoid error: Cannot generate ./Include/opcode.h, python not found ! | 215 | # Avoid error: Cannot generate ./Include/opcode.h, python not found ! | |
215 | post-configure: | 216 | post-configure: | |
216 | touch ${WRKSRC}/Include/opcode.h | 217 | touch ${WRKSRC}/Include/opcode.h | |
217 | 218 | |||
218 | .if ${OPSYS} == "HPUX" | 219 | .if ${OPSYS} == "HPUX" | |
219 | post-install: hpux-postinstall | 220 | post-install: hpux-postinstall | |
220 | .PHONY: hpux-postinstall | 221 | .PHONY: hpux-postinstall | |
221 | hpux-postinstall: | 222 | hpux-postinstall: | |
222 | ${LN} -fs ${DESTDIR}${PREFIX}/lib/libpython3.11.sl \ | 223 | ${LN} -fs ${DESTDIR}${PREFIX}/lib/libpython3.11.sl \ | |
223 | ${DESTDIR}${PREFIX}/lib/libpython3.11.sl.1.0 | 224 | ${DESTDIR}${PREFIX}/lib/libpython3.11.sl.1.0 | |
224 | .endif | 225 | .endif | |
225 | 226 | |||
226 | INSTALLATION_DIRS+= lib/python${PY_VER_SUFFIX}/site-packages | 227 | INSTALLATION_DIRS+= lib/python${PY_VER_SUFFIX}/site-packages | |
227 | 228 | |||
228 | pre-install: setuptools-preinstall | 229 | pre-install: setuptools-preinstall | |
229 | .PHONY: setuptools-preinstall | 230 | .PHONY: setuptools-preinstall | |
230 | setuptools-preinstall: | 231 | setuptools-preinstall: | |
231 | ${INSTALL_DATA} ${.CURDIR}/../../devel/py-setuptools/files/_distutils_system_mod \ | 232 | ${INSTALL_DATA} ${.CURDIR}/../../devel/py-setuptools/files/_distutils_system_mod \ | |
232 | ${DESTDIR}${PREFIX}/lib/python${PY_VER_SUFFIX}/site-packages/_distutils_system_mod.py | 233 | ${DESTDIR}${PREFIX}/lib/python${PY_VER_SUFFIX}/site-packages/_distutils_system_mod.py | |
233 | 234 | |||
234 | .include "../../archivers/bzip2/buildlink3.mk" | 235 | .include "../../archivers/bzip2/buildlink3.mk" | |
235 | .include "../../archivers/xz/buildlink3.mk" | 236 | .include "../../archivers/xz/buildlink3.mk" | |
236 | .include "../../databases/sqlite3/buildlink3.mk" | 237 | .include "../../databases/sqlite3/buildlink3.mk" | |
237 | .include "../../devel/gettext-lib/buildlink3.mk" | 238 | .include "../../devel/gettext-lib/buildlink3.mk" | |
238 | .if ${USE_BUILTIN.gettext:U:tl} == no | 239 | .if ${USE_BUILTIN.gettext:U:tl} == no | |
239 | CONFIGURE_ENV+= ac_cv_lib_intl_textdomain=yes | 240 | CONFIGURE_ENV+= ac_cv_lib_intl_textdomain=yes | |
240 | .endif | 241 | .endif | |
241 | .include "../../devel/libffi/buildlink3.mk" | 242 | .include "../../devel/libffi/buildlink3.mk" | |
242 | .include "../../devel/libuuid/buildlink3.mk" | 243 | .include "../../devel/libuuid/buildlink3.mk" | |
243 | .include "../../devel/readline/buildlink3.mk" | 244 | .include "../../devel/readline/buildlink3.mk" | |
244 | .include "../../devel/zlib/buildlink3.mk" | 245 | .include "../../devel/zlib/buildlink3.mk" | |
245 | .include "../../security/openssl/buildlink3.mk" | 246 | .include "../../security/openssl/buildlink3.mk" | |
246 | .include "../../textproc/expat/buildlink3.mk" | 247 | .include "../../textproc/expat/buildlink3.mk" | |
247 | .include "../../mk/bdb.buildlink3.mk" | 248 | .include "../../mk/bdb.buildlink3.mk" | |
248 | .include "../../mk/curses.buildlink3.mk" | 249 | .include "../../mk/curses.buildlink3.mk" | |
249 | .include "../../mk/dlopen.buildlink3.mk" | 250 | .include "../../mk/dlopen.buildlink3.mk" | |
250 | .include "../../mk/oss.buildlink3.mk" | 251 | .include "../../mk/oss.buildlink3.mk" | |
251 | .include "../../mk/bsd.pkg.mk" | 252 | .include "../../mk/bsd.pkg.mk" |
@@ -1,13 +1,13 @@ | @@ -1,13 +1,13 @@ | |||
1 | $NetBSD: distinfo,v 1.12 2023/12/11 10:23:42 adam Exp $ | 1 | $NetBSD: distinfo,v 1.13 2024/01/13 04:24:28 riastradh Exp $ | |
2 | 2 | |||
3 | BLAKE2s (Python-3.11.7.tar.xz) = bd74ee6c5197164ba2646db27f640928e7a445fb1f6723051faa4a0d14c11549 | 3 | BLAKE2s (Python-3.11.7.tar.xz) = bd74ee6c5197164ba2646db27f640928e7a445fb1f6723051faa4a0d14c11549 | |
4 | SHA512 (Python-3.11.7.tar.xz) = 11e06f2ffe1f66888cb5b4e9f607de815294d6863a77eda6ec6d7c724ef158df9f51881f4a956d4a6fa973c2fb6fd031d495e3496e9b0bb53793fb1cc8434c63 | 4 | SHA512 (Python-3.11.7.tar.xz) = 11e06f2ffe1f66888cb5b4e9f607de815294d6863a77eda6ec6d7c724ef158df9f51881f4a956d4a6fa973c2fb6fd031d495e3496e9b0bb53793fb1cc8434c63 | |
5 | Size (Python-3.11.7.tar.xz) = 20074108 bytes | 5 | Size (Python-3.11.7.tar.xz) = 20074108 bytes | |
6 | SHA1 (patch-Include_pymacro.h) = 271a891892dca1a3aaa3bedcae626a68a36cae0b | 6 | SHA1 (patch-Include_pymacro.h) = 271a891892dca1a3aaa3bedcae626a68a36cae0b | |
7 | SHA1 (patch-Lib_ctypes_util.py) = 3dec1b6b7a36e46cbfa0dfcd71c5e7fac9f60764 | 7 | SHA1 (patch-Lib_ctypes_util.py) = 3dec1b6b7a36e46cbfa0dfcd71c5e7fac9f60764 | |
8 | SHA1 (patch-Lib_distutils_unixccompiler.py) = 8a91e8f4f86517a62408c3a10ed5eb50c4091fbf | 8 | SHA1 (patch-Lib_distutils_unixccompiler.py) = 8a91e8f4f86517a62408c3a10ed5eb50c4091fbf | |
9 | SHA1 (patch-Lib_lib2to3_pgen2_driver.py) = 593c4e93c5653ab400f0a98b91db92630c0a7390 | 9 | SHA1 (patch-Lib_lib2to3_pgen2_driver.py) = 593c4e93c5653ab400f0a98b91db92630c0a7390 | |
10 | SHA1 (patch-Lib_sysconfig.py) = bc6d91bf8f7121456b26ea7f080f588c96f2596f | 10 | SHA1 (patch-Lib_sysconfig.py) = bc6d91bf8f7121456b26ea7f080f588c96f2596f | |
11 | SHA1 (patch-Makefile.pre.in) = fdb5794d112f422a1f28aa9f8b179dc05520f9e1 | 11 | SHA1 (patch-Makefile.pre.in) = fdb5794d112f422a1f28aa9f8b179dc05520f9e1 | |
12 | SHA1 (patch-configure) = a6d9a00ff160581245bc30d1b0d2ec0e9da8fb0b | 12 | SHA1 (patch-configure) = a6d9a00ff160581245bc30d1b0d2ec0e9da8fb0b | |
13 | SHA1 (patch-setup.py) = a601ce207f5e61d15503c8781e925353d1e516b9 | 13 | SHA1 (patch-setup.py) = 874b114febf51181509593a272ad5cdd4acaf3b4 |
@@ -1,175 +1,244 @@ | @@ -1,175 +1,244 @@ | |||
1 | $NetBSD: patch-setup.py,v 1.2 2023/10/23 06:36:00 wiz Exp $ | 1 | $NetBSD: patch-setup.py,v 1.3 2024/01/13 04:24:28 riastradh Exp $ | |
2 | 2 | |||
3 | Disable certain modules, so they can be built as separate packages. | 3 | Disable certain modules, so they can be built as separate packages. | |
4 | Do not look for ncursesw. | 4 | Do not look for ncursesw. | |
5 | Assume panel_library is correct; this is a fix for ncurses' gnupanel | 5 | Assume panel_library is correct; this is a fix for ncurses' gnupanel | |
6 | which will get transformed to panel in buildlink. | 6 | which will get transformed to panel in buildlink. | |
7 | Don't search for modules in PREFIX. Fixes build failure when py-setuptools | 7 | Don't search for modules in PREFIX. Fixes build failure when py-setuptools | |
8 | are installed. | 8 | are installed. | |
9 | Enable cross-build by setting sys._home and sys.path to build directory | 9 | Enable cross-build by setting sys._home and sys.path to build directory | |
10 | Module _crypt might need -lcrypt (taken from Python 3.10). | 10 | Module _crypt might need -lcrypt (taken from Python 3.10). | |
11 | Disable circuitous readline detection which tries to outsmart pkgsrc's | |||
12 | static choice of libreadline and (fake-)ncurses and trips over its elven | |||
13 | shoelaces when cross-compiling. | |||
11 | 14 | |||
12 | --- setup.py.orig 2022-10-24 17:35:39.000000000 +0000 | 15 | --- setup.py.orig 2023-12-04 17:56:29.000000000 +0000 | |
13 | +++ setup.py | 16 | +++ setup.py | |
14 | @@ -1,5 +1,11 @@ | 17 | @@ -1,5 +1,11 @@ | |
15 | # Autodetecting setup.py script for building the Python extensions | 18 | # Autodetecting setup.py script for building the Python extensions | |
16 | 19 | |||
17 | +import sys | 20 | +import sys | |
18 | +sys._home = __file__[:-len('/setup.py')] | 21 | +sys._home = __file__[:-len('/setup.py')] | |
19 | +sys.path.append(__file__[:-len('/setup.py')] + '/Lib') | 22 | +sys.path.append(__file__[:-len('/setup.py')] + '/Lib') | |
20 | +with open('pybuilddir.txt') as pybuilddir: | 23 | +with open('pybuilddir.txt') as pybuilddir: | |
21 | + sys.path.append(__file__[:-len('/setup.py')] + '/' + next(pybuilddir)) | 24 | + sys.path.append(__file__[:-len('/setup.py')] + '/' + next(pybuilddir)) | |
22 | + | 25 | + | |
23 | import argparse | 26 | import argparse | |
24 | import importlib._bootstrap | 27 | import importlib._bootstrap | |
25 | import importlib.machinery | 28 | import importlib.machinery | |
26 | @@ -14,6 +20,7 @@ import warnings | 29 | @@ -14,6 +20,7 @@ import warnings | |
27 | from glob import glob, escape | 30 | from glob import glob, escape | |
28 | import _osx_support | 31 | import _osx_support | |
29 | 32 | |||
30 | +sys.path = [p for p in sys.path if not re.compile('^' + sys.base_prefix + '/lib').match(p)] | 33 | +sys.path = [p for p in sys.path if not re.compile('^' + sys.base_prefix + '/lib').match(p)] | |
31 | 34 | |||
32 | try: | 35 | try: | |
33 | import subprocess | 36 | import subprocess | |
34 | @@ -46,6 +53,7 @@ with warnings.catch_warnings(): | 37 | @@ -46,6 +53,7 @@ with warnings.catch_warnings(): | |
35 | DeprecationWarning | 38 | DeprecationWarning | |
36 | ) | 39 | ) | |
37 | 40 | |||
38 | + from distutils import text_file | 41 | + from distutils import text_file | |
39 | from distutils.command.build_ext import build_ext | 42 | from distutils.command.build_ext import build_ext | |
40 | from distutils.command.build_scripts import build_scripts | 43 | from distutils.command.build_scripts import build_scripts | |
41 | from distutils.command.install import install | 44 | from distutils.command.install import install | |
42 | @@ -56,7 +64,7 @@ with warnings.catch_warnings(): | 45 | @@ -56,7 +64,7 @@ with warnings.catch_warnings(): | |
43 | 46 | |||
44 | 47 | |||
45 | # This global variable is used to hold the list of modules to be disabled. | 48 | # This global variable is used to hold the list of modules to be disabled. | |
46 | -DISABLED_MODULE_LIST = [] | 49 | -DISABLED_MODULE_LIST = [] | |
47 | +DISABLED_MODULE_LIST = ["_gdbm", "_tkinter", "xxlimited"] | 50 | +DISABLED_MODULE_LIST = ["_gdbm", "_tkinter", "xxlimited"] | |
48 | 51 | |||
49 | # --list-module-names option used by Tools/scripts/generate_module_names.py | 52 | # --list-module-names option used by Tools/scripts/generate_module_names.py | |
50 | LIST_MODULE_NAMES = False | 53 | LIST_MODULE_NAMES = False | |
51 | @@ -230,6 +238,16 @@ def grep_headers_for(function, headers): | 54 | @@ -230,6 +238,16 @@ def grep_headers_for(function, headers): | |
52 | return False | 55 | return False | |
53 | 56 | |||
54 | 57 | |||
55 | +def grep_headers_for(function, headers): | 58 | +def grep_headers_for(function, headers): | |
56 | + for header in headers: | 59 | + for header in headers: | |
57 | + try: | 60 | + try: | |
58 | + with open(header, 'r') as f: | 61 | + with open(header, 'r') as f: | |
59 | + if function in f.read(): | 62 | + if function in f.read(): | |
60 | + return True | 63 | + return True | |
61 | + except UnicodeDecodeError: | 64 | + except UnicodeDecodeError: | |
62 | + pass | 65 | + pass | |
63 | + return False | 66 | + return False | |
64 | + | 67 | + | |
65 | def find_file(filename, std_dirs, paths): | 68 | def find_file(filename, std_dirs, paths): | |
66 | """Searches for the directory where a given file is located, | 69 | """Searches for the directory where a given file is located, | |
67 | and returns a possibly-empty list of additional directories, or None | 70 | and returns a possibly-empty list of additional directories, or None | |
68 | @@ -843,15 +861,15 @@ class PyBuildExt(build_ext): | 71 | @@ -843,15 +861,15 @@ class PyBuildExt(build_ext): | |
69 | add_dir_to_list(dir_list, directory) | 72 | add_dir_to_list(dir_list, directory) | |
70 | 73 | |||
71 | def configure_compiler(self): | 74 | def configure_compiler(self): | |
72 | - # Ensure that /usr/local is always used, but the local build | 75 | - # Ensure that /usr/local is always used, but the local build | |
73 | - # directories (i.e. '.' and 'Include') must be first. See issue | 76 | - # directories (i.e. '.' and 'Include') must be first. See issue | |
74 | - # 10520. | 77 | - # 10520. | |
75 | - if not CROSS_COMPILING: | 78 | - if not CROSS_COMPILING: | |
76 | - add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') | 79 | - add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') | |
77 | - add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') | 80 | - add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') | |
78 | - # only change this for cross builds for 3.3, issues on Mageia | 81 | - # only change this for cross builds for 3.3, issues on Mageia | |
79 | - if CROSS_COMPILING: | 82 | - if CROSS_COMPILING: | |
80 | - self.add_cross_compiling_paths() | 83 | - self.add_cross_compiling_paths() | |
81 | + # Add the buildlink directories for pkgsrc | 84 | + # Add the buildlink directories for pkgsrc | |
82 | + if os.environ.get('BUILDLINK_DIR'): | 85 | + if os.environ.get('BUILDLINK_DIR'): | |
83 | + dir = os.environ['BUILDLINK_DIR'] | 86 | + dir = os.environ['BUILDLINK_DIR'] | |
84 | + libdir = dir + '/lib' | 87 | + libdir = dir + '/lib' | |
85 | + incdir = dir + '/include' | 88 | + incdir = dir + '/include' | |
86 | + if libdir not in self.compiler.library_dirs: | 89 | + if libdir not in self.compiler.library_dirs: | |
87 | + self.compiler.library_dirs.insert(0, libdir) | 90 | + self.compiler.library_dirs.insert(0, libdir) | |
88 | + if incdir not in self.compiler.include_dirs: | 91 | + if incdir not in self.compiler.include_dirs: | |
89 | + self.compiler.include_dirs.insert(0, incdir) | 92 | + self.compiler.include_dirs.insert(0, incdir) | |
90 | self.add_multiarch_paths() | 93 | self.add_multiarch_paths() | |
91 | self.add_ldflags_cppflags() | 94 | self.add_ldflags_cppflags() | |
92 | 95 | |||
93 | @@ -899,6 +917,9 @@ class PyBuildExt(build_ext): | 96 | @@ -899,6 +917,9 @@ class PyBuildExt(build_ext): | |
94 | self.lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32'] | 97 | self.lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32'] | |
95 | 98 | |||
96 | if MACOS: | 99 | if MACOS: | |
97 | + self.inc_dirs.append(macosx_sdk_root() + '/usr/include') | 100 | + self.inc_dirs.append(macosx_sdk_root() + '/usr/include') | |
98 | + self.lib_dirs.append(macosx_sdk_root() + '/usr/lib') | 101 | + self.lib_dirs.append(macosx_sdk_root() + '/usr/lib') | |
99 | + | 102 | + | |
100 | # This should work on any unixy platform ;-) | 103 | # This should work on any unixy platform ;-) | |
101 | # If the user has bothered specifying additional -I and -L flags | 104 | # If the user has bothered specifying additional -I and -L flags | |
102 | # in OPT and LDFLAGS we might as well use them here. | 105 | # in OPT and LDFLAGS we might as well use them here. | |
103 | @@ -1074,8 +1095,6 @@ class PyBuildExt(build_ext): | 106 | @@ -1036,71 +1057,10 @@ class PyBuildExt(build_ext): | |
104 | # use the same library for the readline and curses modules. | 107 | def detect_readline_curses(self): | |
105 | if 'curses' in readline_termcap_library: | 108 | # readline | |
106 | curses_library = readline_termcap_library | 109 | readline_termcap_library = "" | |
110 | - curses_library = "" | |||
111 | - # Cannot use os.popen here in py3k. | |||
112 | - tmpfile = os.path.join(self.build_temp, 'readline_termcap_lib') | |||
113 | - if not os.path.exists(self.build_temp): | |||
114 | - os.makedirs(self.build_temp) | |||
115 | - # Determine if readline is already linked against curses or tinfo. | |||
116 | - if sysconfig.get_config_var('HAVE_LIBREADLINE'): | |||
117 | - if sysconfig.get_config_var('WITH_EDITLINE'): | |||
118 | - readline_lib = 'edit' | |||
119 | - else: | |||
120 | - readline_lib = 'readline' | |||
121 | - do_readline = self.compiler.find_library_file(self.lib_dirs, | |||
122 | - readline_lib) | |||
123 | - if CROSS_COMPILING: | |||
124 | - ret = run_command("%s -d %s | grep '(NEEDED)' > %s" | |||
125 | - % (sysconfig.get_config_var('READELF'), | |||
126 | - do_readline, tmpfile)) | |||
127 | - elif find_executable('ldd'): | |||
128 | - ret = run_command("ldd %s > %s" % (do_readline, tmpfile)) | |||
129 | - else: | |||
130 | - ret = 1 | |||
131 | - if ret == 0: | |||
132 | - with open(tmpfile) as fp: | |||
133 | - for ln in fp: | |||
134 | - if 'curses' in ln: | |||
135 | - readline_termcap_library = re.sub( | |||
136 | - r'.*lib(n?cursesw?)\.so.*', r'\1', ln | |||
137 | - ).rstrip() | |||
138 | - break | |||
139 | - # termcap interface split out from ncurses | |||
140 | - if 'tinfo' in ln: | |||
141 | - readline_termcap_library = 'tinfo' | |||
142 | - break | |||
143 | - if os.path.exists(tmpfile): | |||
144 | - os.unlink(tmpfile) | |||
145 | - else: | |||
146 | - do_readline = False | |||
147 | - # Issue 7384: If readline is already linked against curses, | |||
148 | - # use the same library for the readline and curses modules. | |||
149 | - if 'curses' in readline_termcap_library: | |||
150 | - curses_library = readline_termcap_library | |||
107 | - elif self.compiler.find_library_file(self.lib_dirs, 'ncursesw'): | 151 | - elif self.compiler.find_library_file(self.lib_dirs, 'ncursesw'): | |
108 | - curses_library = 'ncursesw' | 152 | - curses_library = 'ncursesw' | |
109 | # Issue 36210: OSS provided ncurses does not link on AIX | 153 | - # Issue 36210: OSS provided ncurses does not link on AIX | |
110 | # Use IBM supplied 'curses' for successful build of _curses | 154 | - # Use IBM supplied 'curses' for successful build of _curses | |
111 | elif AIX and self.compiler.find_library_file(self.lib_dirs, 'curses'): | 155 | - elif AIX and self.compiler.find_library_file(self.lib_dirs, 'curses'): | |
112 | @@ -1166,8 +1185,7 @@ class PyBuildExt(build_ext): | 156 | - curses_library = 'curses' | |
157 | - elif self.compiler.find_library_file(self.lib_dirs, 'ncurses'): | |||
158 | - curses_library = 'ncurses' | |||
159 | - elif self.compiler.find_library_file(self.lib_dirs, 'curses'): | |||
160 | - curses_library = 'curses' | |||
161 | + curses_library = "ncurses" | |||
162 | + do_readline = True | |||
163 | + readline_lib = 'readline' | |||
164 | ||||
165 | - if MACOS: | |||
166 | - os_release = int(os.uname()[2].split('.')[0]) | |||
167 | - dep_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') | |||
168 | - if (dep_target and | |||
169 | - (tuple(int(n) for n in dep_target.split('.')[0:2]) | |||
170 | - < (10, 5) ) ): | |||
171 | - os_release = 8 | |||
172 | - if os_release < 9: | |||
173 | - # MacOSX 10.4 has a broken readline. Don't try to build | |||
174 | - # the readline module unless the user has installed a fixed | |||
175 | - # readline package | |||
176 | - if find_file('readline/rlconf.h', self.inc_dirs, []) is None: | |||
177 | - do_readline = False | |||
178 | if do_readline: | |||
179 | readline_libs = [readline_lib] | |||
180 | if readline_termcap_library: | |||
181 | @@ -1169,8 +1129,7 @@ class PyBuildExt(build_ext): | |||
113 | # If the curses module is enabled, check for the panel module | 182 | # If the curses module is enabled, check for the panel module | |
114 | # _curses_panel needs some form of ncurses | 183 | # _curses_panel needs some form of ncurses | |
115 | skip_curses_panel = True if AIX else False | 184 | skip_curses_panel = True if AIX else False | |
116 | - if (curses_enabled and not skip_curses_panel and | 185 | - if (curses_enabled and not skip_curses_panel and | |
117 | - self.compiler.find_library_file(self.lib_dirs, panel_library)): | 186 | - self.compiler.find_library_file(self.lib_dirs, panel_library)): | |
118 | + if curses_enabled and not skip_curses_panel: | 187 | + if curses_enabled and not skip_curses_panel: | |
119 | self.add(Extension('_curses_panel', ['_curses_panel.c'], | 188 | self.add(Extension('_curses_panel', ['_curses_panel.c'], | |
120 | include_dirs=curses_includes, | 189 | include_dirs=curses_includes, | |
121 | define_macros=curses_defines, | 190 | define_macros=curses_defines, | |
122 | @@ -1176,7 +1194,11 @@ class PyBuildExt(build_ext): | 191 | @@ -1179,7 +1138,11 @@ class PyBuildExt(build_ext): | |
123 | self.missing.append('_curses_panel') | 192 | self.missing.append('_curses_panel') | |
124 | 193 | |||
125 | def detect_crypt(self): | 194 | def detect_crypt(self): | |
126 | - self.addext(Extension('_crypt', ['_cryptmodule.c'])) | 195 | - self.addext(Extension('_crypt', ['_cryptmodule.c'])) | |
127 | + if self.compiler.find_library_file(self.lib_dirs, 'crypt'): | 196 | + if self.compiler.find_library_file(self.lib_dirs, 'crypt'): | |
128 | + libs = ['crypt'] | 197 | + libs = ['crypt'] | |
129 | + else: | 198 | + else: | |
130 | + libs = [] | 199 | + libs = [] | |
131 | + self.addext(Extension('_crypt', ['_cryptmodule.c'], libraries=libs)) | 200 | + self.addext(Extension('_crypt', ['_cryptmodule.c'], libraries=libs)) | |
132 | 201 | |||
133 | def detect_dbm_gdbm(self): | 202 | def detect_dbm_gdbm(self): | |
134 | # Modules that provide persistent dictionary-like semantics. You will | 203 | # Modules that provide persistent dictionary-like semantics. You will | |
135 | @@ -1199,6 +1221,31 @@ class PyBuildExt(build_ext): | 204 | @@ -1202,6 +1165,31 @@ class PyBuildExt(build_ext): | |
136 | 205 | |||
137 | # The standard Unix dbm module: | 206 | # The standard Unix dbm module: | |
138 | if not CYGWIN: | 207 | if not CYGWIN: | |
139 | + # Top half based on find_file | 208 | + # Top half based on find_file | |
140 | + def find_ndbm_h(dirs): | 209 | + def find_ndbm_h(dirs): | |
141 | + ret = None | 210 | + ret = None | |
142 | + if MACOS: | 211 | + if MACOS: | |
143 | + sysroot = macosx_sdk_root() | 212 | + sysroot = macosx_sdk_root() | |
144 | + for dir in dirs: | 213 | + for dir in dirs: | |
145 | + f = os.path.join(dir, 'ndbm.h') | 214 | + f = os.path.join(dir, 'ndbm.h') | |
146 | + if MACOS and is_macosx_sdk_path(dir): | 215 | + if MACOS and is_macosx_sdk_path(dir): | |
147 | + f = os.path.join(sysroot, dir[1:], 'ndbm.h') | 216 | + f = os.path.join(sysroot, dir[1:], 'ndbm.h') | |
148 | + if not os.path.exists(f): | 217 | + if not os.path.exists(f): | |
149 | + continue | 218 | + continue | |
150 | + | 219 | + | |
151 | + ret = True | 220 | + ret = True | |
152 | + input = text_file.TextFile(f) | 221 | + input = text_file.TextFile(f) | |
153 | + while True: | 222 | + while True: | |
154 | + line = input.readline() | 223 | + line = input.readline() | |
155 | + if not line: | 224 | + if not line: | |
156 | + break | 225 | + break | |
157 | + if re.search('This file is part of GDBM', line): | 226 | + if re.search('This file is part of GDBM', line): | |
158 | + ret = None | 227 | + ret = None | |
159 | + break | 228 | + break | |
160 | + input.close() | 229 | + input.close() | |
161 | + break | 230 | + break | |
162 | + return ret | 231 | + return ret | |
163 | + | 232 | + | |
164 | config_args = [arg.strip("'") | 233 | config_args = [arg.strip("'") | |
165 | for arg in sysconfig.get_config_var("CONFIG_ARGS").split()] | 234 | for arg in sysconfig.get_config_var("CONFIG_ARGS").split()] | |
166 | dbm_args = [arg for arg in config_args | 235 | dbm_args = [arg for arg in config_args | |
167 | @@ -1616,7 +1663,7 @@ def main(): | 236 | @@ -1619,7 +1607,7 @@ def main(): | |
168 | # If you change the scripts installed here, you also need to | 237 | # If you change the scripts installed here, you also need to | |
169 | # check the PyBuildScripts command above, and change the links | 238 | # check the PyBuildScripts command above, and change the links | |
170 | # created by the bininstall target in Makefile.pre.in | 239 | # created by the bininstall target in Makefile.pre.in | |
171 | - scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3", | 240 | - scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3", | |
172 | + scripts = ["Tools/scripts/pydoc3", | 241 | + scripts = ["Tools/scripts/pydoc3", | |
173 | "Tools/scripts/2to3"] | 242 | "Tools/scripts/2to3"] | |
174 | ) | 243 | ) | |
175 | 244 |
@@ -1,24 +1,24 @@ | @@ -1,24 +1,24 @@ | |||
1 | $NetBSD: distinfo,v 1.37 2023/11/10 09:48:39 nia Exp $ | 1 | $NetBSD: distinfo,v 1.38 2024/01/13 04:24:28 riastradh Exp $ | |
2 | 2 | |||
3 | BLAKE2s (Python-3.9.18.tar.xz) = 429256eb52e94427ae86302633ce8b01ba42d37c44c59e89fa0ae09b721da63f | 3 | BLAKE2s (Python-3.9.18.tar.xz) = 429256eb52e94427ae86302633ce8b01ba42d37c44c59e89fa0ae09b721da63f | |
4 | SHA512 (Python-3.9.18.tar.xz) = aab155aca757d298394eddb91ff9a8f239665bd46feb495c6b6f735bbcb7489c05c858cc4cd08f1575c24f293b33492d763e9a140d92f0b2b0cc81a165a677c7 | 4 | SHA512 (Python-3.9.18.tar.xz) = aab155aca757d298394eddb91ff9a8f239665bd46feb495c6b6f735bbcb7489c05c858cc4cd08f1575c24f293b33492d763e9a140d92f0b2b0cc81a165a677c7 | |
5 | Size (Python-3.9.18.tar.xz) = 19673928 bytes | 5 | Size (Python-3.9.18.tar.xz) = 19673928 bytes | |
6 | SHA1 (patch-Lib_ctypes_util.py) = 032cc99ebad93ddddfd89073c60424a952e3faa3 | 6 | SHA1 (patch-Lib_ctypes_util.py) = 032cc99ebad93ddddfd89073c60424a952e3faa3 | |
7 | SHA1 (patch-Lib_distutils_sysconfig.py) = 6822eafb4dfded86d7f7353831816aeb8119e6cf | 7 | SHA1 (patch-Lib_distutils_sysconfig.py) = 6822eafb4dfded86d7f7353831816aeb8119e6cf | |
8 | SHA1 (patch-Lib_distutils_unixccompiler.py) = 2e65a8dd5dd3fe25957206c062106fa7a6fc4e69 | 8 | SHA1 (patch-Lib_distutils_unixccompiler.py) = 2e65a8dd5dd3fe25957206c062106fa7a6fc4e69 | |
9 | SHA1 (patch-Lib_lib2to3_pgen2_driver.py) = 5d6dab14197f27363394ff1aeee22a8ced8026d2 | 9 | SHA1 (patch-Lib_lib2to3_pgen2_driver.py) = 5d6dab14197f27363394ff1aeee22a8ced8026d2 | |
10 | SHA1 (patch-Lib_sysconfig.py) = a4f009ed73ebbd9d9c4bf7e12b7981182ed8fd7c | 10 | SHA1 (patch-Lib_sysconfig.py) = a4f009ed73ebbd9d9c4bf7e12b7981182ed8fd7c | |
11 | SHA1 (patch-Lib_test_test__shutil.py) = 7b01da9cbfd9b7cd1bb88424d91964cf52ea72df | 11 | SHA1 (patch-Lib_test_test__shutil.py) = 7b01da9cbfd9b7cd1bb88424d91964cf52ea72df | |
12 | SHA1 (patch-Makefile.pre.in) = dd5ff571ac9fe2dc2e41fa678261d8e3648ac908 | 12 | SHA1 (patch-Makefile.pre.in) = dd5ff571ac9fe2dc2e41fa678261d8e3648ac908 | |
13 | SHA1 (patch-Modules___hashopenssl.c) = d7157254630259b2073e67a921edf0dfe151e32a | 13 | SHA1 (patch-Modules___hashopenssl.c) = d7157254630259b2073e67a921edf0dfe151e32a | |
14 | SHA1 (patch-Modules___ssl.c) = f241ba148e4c244a641386be5ac07817b03f04f7 | 14 | SHA1 (patch-Modules___ssl.c) = f241ba148e4c244a641386be5ac07817b03f04f7 | |
15 | SHA1 (patch-Modules_clinic_posixmodule.c.h) = 66ce8a2fec0ee4df7cb1f814dd4c40d144d1407f | 15 | SHA1 (patch-Modules_clinic_posixmodule.c.h) = 66ce8a2fec0ee4df7cb1f814dd4c40d144d1407f | |
16 | SHA1 (patch-Modules_makesetup) = a06786eebffadecedba5e3a50a9785fb47613567 | 16 | SHA1 (patch-Modules_makesetup) = a06786eebffadecedba5e3a50a9785fb47613567 | |
17 | SHA1 (patch-Modules_nismodule.c) = 1bafe9b06359586d027a77011b103877590d947d | 17 | SHA1 (patch-Modules_nismodule.c) = 1bafe9b06359586d027a77011b103877590d947d | |
18 | SHA1 (patch-Modules_posixmodule.c) = cc90b73913f7759efba2e136ff04161444f49f27 | 18 | SHA1 (patch-Modules_posixmodule.c) = cc90b73913f7759efba2e136ff04161444f49f27 | |
19 | SHA1 (patch-Modules_socketmodule.c) = 5c894f2291cdf0dd355671a1878863e0342207de | 19 | SHA1 (patch-Modules_socketmodule.c) = 5c894f2291cdf0dd355671a1878863e0342207de | |
20 | SHA1 (patch-Modules_socketmodule.h) = 8761c7238bc74e45adefb6e647dc3b39b7bdd81c | 20 | SHA1 (patch-Modules_socketmodule.h) = 8761c7238bc74e45adefb6e647dc3b39b7bdd81c | |
21 | SHA1 (patch-Python_thread__pthread.h) = 25609f722ac9c17a49023ddc6882545d9d7798ff | 21 | SHA1 (patch-Python_thread__pthread.h) = 25609f722ac9c17a49023ddc6882545d9d7798ff | |
22 | SHA1 (patch-configure) = 944b8bb9601fd064333305778fb57997ce0ac531 | 22 | SHA1 (patch-configure) = 944b8bb9601fd064333305778fb57997ce0ac531 | |
23 | SHA1 (patch-pyconfig.h.in) = 2f06af7358690b46eaff404226b898962b049a0e | 23 | SHA1 (patch-pyconfig.h.in) = 2f06af7358690b46eaff404226b898962b049a0e | |
24 | SHA1 (patch-setup.py) = dab93079027f8ac6a259c9e683d35fe7b66c57e5 | 24 | SHA1 (patch-setup.py) = 185090e3497763ca271316b5ff4df7f1e72d1c14 |
@@ -1,183 +1,245 @@ | @@ -1,183 +1,245 @@ | |||
1 | $NetBSD: patch-setup.py,v 1.10 2023/10/23 06:36:01 wiz Exp $ | 1 | $NetBSD: patch-setup.py,v 1.11 2024/01/13 04:24:29 riastradh Exp $ | |
2 | 2 | |||
3 | Disable certain modules, so they can be built as separate packages. | 3 | Disable certain modules, so they can be built as separate packages. | |
4 | Do not look for ncursesw. | 4 | Do not look for ncursesw. | |
5 | Assume panel_library is correct; this is a fix for ncurses' gnupanel | 5 | Assume panel_library is correct; this is a fix for ncurses' gnupanel | |
6 | which will get transformed to panel in buildlink. | 6 | which will get transformed to panel in buildlink. | |
7 | Don't search for modules in PREFIX. Fixes build failure when py-setuptools | 7 | Don't search for modules in PREFIX. Fixes build failure when py-setuptools | |
8 | are installed. | 8 | are installed. | |
9 | Enable cross-build by setting sys._home and sys.path to build directory | 9 | Enable cross-build by setting sys._home and sys.path to build directory | |
10 | Disable circuitous readline detection which tries to outsmart pkgsrc's | |||
11 | static choice of libreadline and (fake-)ncurses and trips over its elven | |||
12 | shoelaces when cross-compiling. | |||
10 | 13 | |||
11 | --- setup.py.orig 2022-03-23 21:12:08.000000000 +0000 | 14 | --- setup.py.orig 2023-08-24 17:59:28.000000000 +0000 | |
12 | +++ setup.py | 15 | +++ setup.py | |
13 | @@ -1,5 +1,11 @@ | 16 | @@ -1,5 +1,11 @@ | |
14 | # Autodetecting setup.py script for building the Python extensions | 17 | # Autodetecting setup.py script for building the Python extensions | |
15 | 18 | |||
16 | +import sys | 19 | +import sys | |
17 | +sys._home = __file__[:-len('/setup.py')] | 20 | +sys._home = __file__[:-len('/setup.py')] | |
18 | +sys.path.append(__file__[:-len('/setup.py')] + '/Lib') | 21 | +sys.path.append(__file__[:-len('/setup.py')] + '/Lib') | |
19 | +with open('pybuilddir.txt') as pybuilddir: | 22 | +with open('pybuilddir.txt') as pybuilddir: | |
20 | + sys.path.append(__file__[:-len('/setup.py')] + '/' + next(pybuilddir)) | 23 | + sys.path.append(__file__[:-len('/setup.py')] + '/' + next(pybuilddir)) | |
21 | + | 24 | + | |
22 | import argparse | 25 | import argparse | |
23 | import importlib._bootstrap | 26 | import importlib._bootstrap | |
24 | import importlib.machinery | 27 | import importlib.machinery | |
25 | @@ -11,6 +17,7 @@ import sysconfig | 28 | @@ -11,6 +17,7 @@ import sysconfig | |
26 | from glob import glob, escape | 29 | from glob import glob, escape | |
27 | import _osx_support | 30 | import _osx_support | |
28 | 31 | |||
29 | +sys.path = [p for p in sys.path if not re.compile('^' + sys.base_prefix + '/lib').match(p)] | 32 | +sys.path = [p for p in sys.path if not re.compile('^' + sys.base_prefix + '/lib').match(p)] | |
30 | 33 | |||
31 | try: | 34 | try: | |
32 | import subprocess | 35 | import subprocess | |
33 | @@ -30,7 +37,7 @@ except ImportError: | 36 | @@ -30,7 +37,7 @@ except ImportError: | |
34 | SUBPROCESS_BOOTSTRAP = True | 37 | SUBPROCESS_BOOTSTRAP = True | |
35 | 38 | |||
36 | 39 | |||
37 | -from distutils import log | 40 | -from distutils import log | |
38 | +from distutils import log, text_file | 41 | +from distutils import log, text_file | |
39 | from distutils.command.build_ext import build_ext | 42 | from distutils.command.build_ext import build_ext | |
40 | from distutils.command.build_scripts import build_scripts | 43 | from distutils.command.build_scripts import build_scripts | |
41 | from distutils.command.install import install | 44 | from distutils.command.install import install | |
42 | @@ -44,7 +51,7 @@ from distutils.spawn import find_executa | 45 | @@ -44,7 +51,7 @@ from distutils.spawn import find_executa | |
43 | TEST_EXTENSIONS = True | 46 | TEST_EXTENSIONS = True | |
44 | 47 | |||
45 | # This global variable is used to hold the list of modules to be disabled. | 48 | # This global variable is used to hold the list of modules to be disabled. | |
46 | -DISABLED_MODULE_LIST = [] | 49 | -DISABLED_MODULE_LIST = [] | |
47 | +DISABLED_MODULE_LIST = ["_gdbm", "_tkinter", "xxlimited"] | 50 | +DISABLED_MODULE_LIST = ["_gdbm", "_tkinter", "xxlimited"] | |
48 | 51 | |||
49 | 52 | |||
50 | def get_platform(): | 53 | def get_platform(): | |
51 | @@ -227,6 +234,16 @@ def grep_headers_for(function, headers): | 54 | @@ -227,6 +234,16 @@ def grep_headers_for(function, headers): | |
52 | return True | 55 | return True | |
53 | return False | 56 | return False | |
54 | 57 | |||
55 | +def grep_headers_for(function, headers): | 58 | +def grep_headers_for(function, headers): | |
56 | + for header in headers: | 59 | + for header in headers: | |
57 | + try: | 60 | + try: | |
58 | + with open(header, 'r') as f: | 61 | + with open(header, 'r') as f: | |
59 | + if function in f.read(): | 62 | + if function in f.read(): | |
60 | + return True | 63 | + return True | |
61 | + except UnicodeDecodeError: | 64 | + except UnicodeDecodeError: | |
62 | + pass | 65 | + pass | |
63 | + return False | 66 | + return False | |
64 | + | 67 | + | |
65 | def find_file(filename, std_dirs, paths): | 68 | def find_file(filename, std_dirs, paths): | |
66 | """Searches for the directory where a given file is located, | 69 | """Searches for the directory where a given file is located, | |
67 | and returns a possibly-empty list of additional directories, or None | 70 | and returns a possibly-empty list of additional directories, or None | |
68 | @@ -733,15 +750,15 @@ class PyBuildExt(build_ext): | 71 | @@ -733,15 +750,15 @@ class PyBuildExt(build_ext): | |
69 | add_dir_to_list(dir_list, directory) | 72 | add_dir_to_list(dir_list, directory) | |
70 | 73 | |||
71 | def configure_compiler(self): | 74 | def configure_compiler(self): | |
72 | - # Ensure that /usr/local is always used, but the local build | 75 | - # Ensure that /usr/local is always used, but the local build | |
73 | - # directories (i.e. '.' and 'Include') must be first. See issue | 76 | - # directories (i.e. '.' and 'Include') must be first. See issue | |
74 | - # 10520. | 77 | - # 10520. | |
75 | - if not CROSS_COMPILING: | 78 | - if not CROSS_COMPILING: | |
76 | - add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') | 79 | - add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') | |
77 | - add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') | 80 | - add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') | |
78 | - # only change this for cross builds for 3.3, issues on Mageia | 81 | - # only change this for cross builds for 3.3, issues on Mageia | |
79 | - if CROSS_COMPILING: | 82 | - if CROSS_COMPILING: | |
80 | - self.add_cross_compiling_paths() | 83 | - self.add_cross_compiling_paths() | |
81 | + # Add the buildlink directories for pkgsrc | 84 | + # Add the buildlink directories for pkgsrc | |
82 | + if os.environ.get('BUILDLINK_DIR'): | 85 | + if os.environ.get('BUILDLINK_DIR'): | |
83 | + dir = os.environ['BUILDLINK_DIR'] | 86 | + dir = os.environ['BUILDLINK_DIR'] | |
84 | + libdir = dir + '/lib' | 87 | + libdir = dir + '/lib' | |
85 | + incdir = dir + '/include' | 88 | + incdir = dir + '/include' | |
86 | + if libdir not in self.compiler.library_dirs: | 89 | + if libdir not in self.compiler.library_dirs: | |
87 | + self.compiler.library_dirs.insert(0, libdir) | 90 | + self.compiler.library_dirs.insert(0, libdir) | |
88 | + if incdir not in self.compiler.include_dirs: | 91 | + if incdir not in self.compiler.include_dirs: | |
89 | + self.compiler.include_dirs.insert(0, incdir) | 92 | + self.compiler.include_dirs.insert(0, incdir) | |
90 | self.add_multiarch_paths() | 93 | self.add_multiarch_paths() | |
91 | self.add_ldflags_cppflags() | 94 | self.add_ldflags_cppflags() | |
92 | 95 | |||
93 | @@ -789,6 +806,9 @@ class PyBuildExt(build_ext): | 96 | @@ -789,6 +806,9 @@ class PyBuildExt(build_ext): | |
94 | self.lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32'] | 97 | self.lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32'] | |
95 | 98 | |||
96 | if MACOS: | 99 | if MACOS: | |
97 | + self.inc_dirs.append(macosx_sdk_root() + '/usr/include') | 100 | + self.inc_dirs.append(macosx_sdk_root() + '/usr/include') | |
98 | + self.lib_dirs.append(macosx_sdk_root() + '/usr/lib') | 101 | + self.lib_dirs.append(macosx_sdk_root() + '/usr/lib') | |
99 | + | 102 | + | |
100 | # This should work on any unixy platform ;-) | 103 | # This should work on any unixy platform ;-) | |
101 | # If the user has bothered specifying additional -I and -L flags | 104 | # If the user has bothered specifying additional -I and -L flags | |
102 | # in OPT and LDFLAGS we might as well use them here. | 105 | # in OPT and LDFLAGS we might as well use them here. | |
103 | @@ -1006,8 +1026,6 @@ class PyBuildExt(build_ext): | 106 | @@ -971,65 +991,10 @@ class PyBuildExt(build_ext): | |
104 | # use the same library for the readline and curses modules. | 107 | ||
105 | if 'curses' in readline_termcap_library: | 108 | def detect_readline_curses(self): | |
106 | curses_library = readline_termcap_library | 109 | # readline | |
110 | - do_readline = self.compiler.find_library_file(self.lib_dirs, 'readline') | |||
111 | + do_readline = True | |||
112 | readline_termcap_library = "" | |||
113 | - curses_library = "" | |||
114 | - # Cannot use os.popen here in py3k. | |||
115 | - tmpfile = os.path.join(self.build_temp, 'readline_termcap_lib') | |||
116 | - if not os.path.exists(self.build_temp): | |||
117 | - os.makedirs(self.build_temp) | |||
118 | - # Determine if readline is already linked against curses or tinfo. | |||
119 | - if do_readline: | |||
120 | - if CROSS_COMPILING: | |||
121 | - ret = run_command("%s -d %s | grep '(NEEDED)' > %s" | |||
122 | - % (sysconfig.get_config_var('READELF'), | |||
123 | - do_readline, tmpfile)) | |||
124 | - elif find_executable('ldd'): | |||
125 | - ret = run_command("ldd %s > %s" % (do_readline, tmpfile)) | |||
126 | - else: | |||
127 | - ret = 1 | |||
128 | - if ret == 0: | |||
129 | - with open(tmpfile) as fp: | |||
130 | - for ln in fp: | |||
131 | - if 'curses' in ln: | |||
132 | - readline_termcap_library = re.sub( | |||
133 | - r'.*lib(n?cursesw?)\.so.*', r'\1', ln | |||
134 | - ).rstrip() | |||
135 | - break | |||
136 | - # termcap interface split out from ncurses | |||
137 | - if 'tinfo' in ln: | |||
138 | - readline_termcap_library = 'tinfo' | |||
139 | - break | |||
140 | - if os.path.exists(tmpfile): | |||
141 | - os.unlink(tmpfile) | |||
142 | - # Issue 7384: If readline is already linked against curses, | |||
143 | - # use the same library for the readline and curses modules. | |||
144 | - if 'curses' in readline_termcap_library: | |||
145 | - curses_library = readline_termcap_library | |||
107 | - elif self.compiler.find_library_file(self.lib_dirs, 'ncursesw'): | 146 | - elif self.compiler.find_library_file(self.lib_dirs, 'ncursesw'): | |
108 | - curses_library = 'ncursesw' | 147 | - curses_library = 'ncursesw' | |
109 | # Issue 36210: OSS provided ncurses does not link on AIX | 148 | - # Issue 36210: OSS provided ncurses does not link on AIX | |
110 | # Use IBM supplied 'curses' for successful build of _curses | 149 | - # Use IBM supplied 'curses' for successful build of _curses | |
111 | elif AIX and self.compiler.find_library_file(self.lib_dirs, 'curses'): | 150 | - elif AIX and self.compiler.find_library_file(self.lib_dirs, 'curses'): | |
112 | @@ -1109,8 +1127,7 @@ class PyBuildExt(build_ext): | 151 | - curses_library = 'curses' | |
152 | - elif self.compiler.find_library_file(self.lib_dirs, 'ncurses'): | |||
153 | - curses_library = 'ncurses' | |||
154 | - elif self.compiler.find_library_file(self.lib_dirs, 'curses'): | |||
155 | - curses_library = 'curses' | |||
156 | + curses_library = "ncurses" | |||
157 | ||||
158 | - if MACOS: | |||
159 | - os_release = int(os.uname()[2].split('.')[0]) | |||
160 | - dep_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') | |||
161 | - if (dep_target and | |||
162 | - (tuple(int(n) for n in dep_target.split('.')[0:2]) | |||
163 | - < (10, 5) ) ): | |||
164 | - os_release = 8 | |||
165 | - if os_release < 9: | |||
166 | - # MacOSX 10.4 has a broken readline. Don't try to build | |||
167 | - # the readline module unless the user has installed a fixed | |||
168 | - # readline package | |||
169 | - if find_file('readline/rlconf.h', self.inc_dirs, []) is None: | |||
170 | - do_readline = False | |||
171 | if do_readline: | |||
172 | if MACOS and os_release < 9: | |||
173 | # In every directory on the search path search for a dynamic | |||
174 | @@ -1109,8 +1074,7 @@ class PyBuildExt(build_ext): | |||
113 | # If the curses module is enabled, check for the panel module | 175 | # If the curses module is enabled, check for the panel module | |
114 | # _curses_panel needs some form of ncurses | 176 | # _curses_panel needs some form of ncurses | |
115 | skip_curses_panel = True if AIX else False | 177 | skip_curses_panel = True if AIX else False | |
116 | - if (curses_enabled and not skip_curses_panel and | 178 | - if (curses_enabled and not skip_curses_panel and | |
117 | - self.compiler.find_library_file(self.lib_dirs, panel_library)): | 179 | - self.compiler.find_library_file(self.lib_dirs, panel_library)): | |
118 | + if curses_enabled and not skip_curses_panel: | 180 | + if curses_enabled and not skip_curses_panel: | |
119 | self.add(Extension('_curses_panel', ['_curses_panel.c'], | 181 | self.add(Extension('_curses_panel', ['_curses_panel.c'], | |
120 | include_dirs=curses_includes, | 182 | include_dirs=curses_includes, | |
121 | define_macros=curses_defines, | 183 | define_macros=curses_defines, | |
122 | @@ -1361,6 +1378,31 @@ class PyBuildExt(build_ext): | 184 | @@ -1361,6 +1325,31 @@ class PyBuildExt(build_ext): | |
123 | dbm_order = ['gdbm'] | 185 | dbm_order = ['gdbm'] | |
124 | # The standard Unix dbm module: | 186 | # The standard Unix dbm module: | |
125 | if not CYGWIN: | 187 | if not CYGWIN: | |
126 | + # Top half based on find_file | 188 | + # Top half based on find_file | |
127 | + def find_ndbm_h(dirs): | 189 | + def find_ndbm_h(dirs): | |
128 | + ret = None | 190 | + ret = None | |
129 | + if MACOS: | 191 | + if MACOS: | |
130 | + sysroot = macosx_sdk_root() | 192 | + sysroot = macosx_sdk_root() | |
131 | + for dir in dirs: | 193 | + for dir in dirs: | |
132 | + f = os.path.join(dir, 'ndbm.h') | 194 | + f = os.path.join(dir, 'ndbm.h') | |
133 | + if MACOS and is_macosx_sdk_path(dir): | 195 | + if MACOS and is_macosx_sdk_path(dir): | |
134 | + f = os.path.join(sysroot, dir[1:], 'ndbm.h') | 196 | + f = os.path.join(sysroot, dir[1:], 'ndbm.h') | |
135 | + if not os.path.exists(f): | 197 | + if not os.path.exists(f): | |
136 | + continue | 198 | + continue | |
137 | + | 199 | + | |
138 | + ret = True | 200 | + ret = True | |
139 | + input = text_file.TextFile(f) | 201 | + input = text_file.TextFile(f) | |
140 | + while True: | 202 | + while True: | |
141 | + line = input.readline() | 203 | + line = input.readline() | |
142 | + if not line: | 204 | + if not line: | |
143 | + break | 205 | + break | |
144 | + if re.search('This file is part of GDBM', line): | 206 | + if re.search('This file is part of GDBM', line): | |
145 | + ret = None | 207 | + ret = None | |
146 | + break | 208 | + break | |
147 | + input.close() | 209 | + input.close() | |
148 | + break | 210 | + break | |
149 | + return ret | 211 | + return ret | |
150 | + | 212 | + | |
151 | config_args = [arg.strip("'") | 213 | config_args = [arg.strip("'") | |
152 | for arg in sysconfig.get_config_var("CONFIG_ARGS").split()] | 214 | for arg in sysconfig.get_config_var("CONFIG_ARGS").split()] | |
153 | dbm_args = [arg for arg in config_args | 215 | dbm_args = [arg for arg in config_args | |
154 | @@ -1372,7 +1414,7 @@ class PyBuildExt(build_ext): | 216 | @@ -1372,7 +1361,7 @@ class PyBuildExt(build_ext): | |
155 | dbmext = None | 217 | dbmext = None | |
156 | for cand in dbm_order: | 218 | for cand in dbm_order: | |
157 | if cand == "ndbm": | 219 | if cand == "ndbm": | |
158 | - if find_file("ndbm.h", self.inc_dirs, []) is not None: | 220 | - if find_file("ndbm.h", self.inc_dirs, []) is not None: | |
159 | + if find_ndbm_h(self.inc_dirs) is not None: | 221 | + if find_ndbm_h(self.inc_dirs) is not None: | |
160 | # Some systems have -lndbm, others have -lgdbm_compat, | 222 | # Some systems have -lndbm, others have -lgdbm_compat, | |
161 | # others don't have either | 223 | # others don't have either | |
162 | if self.compiler.find_library_file(self.lib_dirs, | 224 | if self.compiler.find_library_file(self.lib_dirs, | |
163 | @@ -2209,10 +2251,7 @@ class PyBuildExt(build_ext): | 225 | @@ -2209,10 +2198,7 @@ class PyBuildExt(build_ext): | |
164 | sources = ['_decimal/_decimal.c'] | 226 | sources = ['_decimal/_decimal.c'] | |
165 | depends = ['_decimal/docstrings.h'] | 227 | depends = ['_decimal/docstrings.h'] | |
166 | else: | 228 | else: | |
167 | - include_dirs = [os.path.abspath(os.path.join(self.srcdir, | 229 | - include_dirs = [os.path.abspath(os.path.join(self.srcdir, | |
168 | - 'Modules', | 230 | - 'Modules', | |
169 | - '_decimal', | 231 | - '_decimal', | |
170 | - 'libmpdec'))] | 232 | - 'libmpdec'))] | |
171 | + include_dirs = ['Modules/_decimal/libmpdec'] | 233 | + include_dirs = ['Modules/_decimal/libmpdec'] | |
172 | libraries = ['m'] | 234 | libraries = ['m'] | |
173 | sources = [ | 235 | sources = [ | |
174 | '_decimal/_decimal.c', | 236 | '_decimal/_decimal.c', | |
175 | @@ -2597,7 +2636,7 @@ def main(): | 237 | @@ -2597,7 +2583,7 @@ def main(): | |
176 | # If you change the scripts installed here, you also need to | 238 | # If you change the scripts installed here, you also need to | |
177 | # check the PyBuildScripts command above, and change the links | 239 | # check the PyBuildScripts command above, and change the links | |
178 | # created by the bininstall target in Makefile.pre.in | 240 | # created by the bininstall target in Makefile.pre.in | |
179 | - scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3", | 241 | - scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3", | |
180 | + scripts = ["Tools/scripts/pydoc3", | 242 | + scripts = ["Tools/scripts/pydoc3", | |
181 | "Tools/scripts/2to3"] | 243 | "Tools/scripts/2to3"] | |
182 | ) | 244 | ) | |
183 | 245 |