| @@ -1,114 +1,113 @@ | | | @@ -1,114 +1,113 @@ |
1 | $NetBSD: patch-am,v 1.21 2016/07/26 16:44:28 kamil Exp $ | | 1 | $NetBSD: patch-am,v 1.22 2017/01/26 23:10:35 wiz Exp $ |
2 | | | 2 | |
3 | Disabled modules for normal build: | | 3 | Disabled modules for normal build: |
4 | bsddb | | 4 | bsddb |
| | | 5 | bsddb185 |
5 | curses | | 6 | curses |
6 | curses_panel | | 7 | curses_panel |
7 | elementtree | | 8 | elementtree |
8 | sqlite3 | | 9 | sqlite3 |
9 | tkinter | | 10 | tkinter |
10 | gdbm | | 11 | gdbm |
11 | pyexpat | | 12 | pyexpat |
12 | readline | | 13 | readline |
13 | {linux,oss,sun}audiodev | | 14 | {linux,oss,sun}audiodev |
14 | spwd | | 15 | spwd |
15 | Those have separate packages where needed. | | 16 | Those have separate packages where needed. |
16 | | | 17 | |
17 | Only check the BUILDLINK_DIR for libraries etc, do not pick up random | | 18 | Only check the BUILDLINK_DIR for libraries etc, do not pick up random |
18 | headers and libraries from the system. | | 19 | headers and libraries from the system. |
19 | | | 20 | |
20 | Build the _ssl module with pkgsrc choiced OpenSSL. | | 21 | Build the _ssl module with pkgsrc choiced OpenSSL. |
21 | | | 22 | |
22 | Build the 1.85 compat module all the time against the BDB version of choice. | | | |
23 | | | | |
24 | cygwin 2.7.3-no-libm.patch | | 23 | cygwin 2.7.3-no-libm.patch |
25 | | | 24 | |
26 | --- setup.py.orig 2016-06-25 21:49:32.000000000 +0000 | | 25 | --- setup.py.orig 2016-06-25 21:49:32.000000000 +0000 |
27 | +++ setup.py | | 26 | +++ setup.py |
28 | @@ -33,7 +33,7 @@ host_platform = get_platform() | | 27 | @@ -33,7 +33,7 @@ |
29 | COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS")) | | 28 | COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS")) |
30 | | | 29 | |
31 | # This global variable is used to hold the list of modules to be disabled. | | 30 | # This global variable is used to hold the list of modules to be disabled. |
32 | -disabled_module_list = [] | | 31 | -disabled_module_list = [] |
33 | +disabled_module_list = ["_bsddb", "_curses", "_curses_panel", "_elementtree", "_sqlite3", "_tkinter", "gdbm", "pyexpat", "readline", "linuxaudiodev", "ossaudiodev", "spwd", "sunaudiodev"] | | 32 | +disabled_module_list = ["_bsddb", "bsddb185", "_curses", "_curses_panel", "_elementtree", "_sqlite3", "_tkinter", "gdbm", "pyexpat", "readline", "linuxaudiodev", "ossaudiodev", "spwd", "sunaudiodev"] |
34 | | | 33 | |
35 | def add_dir_to_list(dirlist, dir): | | 34 | def add_dir_to_list(dirlist, dir): |
36 | """Add the directory 'dir' to the list 'dirlist' (at the front) if | | 35 | """Add the directory 'dir' to the list 'dirlist' (at the front) if |
37 | @@ -454,10 +454,15 @@ class PyBuildExt(build_ext): | | 36 | @@ -454,10 +454,15 @@ |
38 | os.unlink(tmpfile) | | 37 | os.unlink(tmpfile) |
39 | | | 38 | |
40 | def detect_modules(self): | | 39 | def detect_modules(self): |
41 | - # Ensure that /usr/local is always used | | 40 | - # Ensure that /usr/local is always used |
42 | - if not cross_compiling: | | 41 | - if not cross_compiling: |
43 | - add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') | | 42 | - add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') |
44 | - add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') | | 43 | - add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') |
45 | + # Add the buildlink directories for pkgsrc | | 44 | + # Add the buildlink directories for pkgsrc |
46 | + if os.environ.has_key('BUILDLINK_DIR'): | | 45 | + if os.environ.has_key('BUILDLINK_DIR'): |
47 | + dir = os.environ['BUILDLINK_DIR'] | | 46 | + dir = os.environ['BUILDLINK_DIR'] |
48 | + libdir = dir + '/lib' | | 47 | + libdir = dir + '/lib' |
49 | + incdir = dir + '/include' | | 48 | + incdir = dir + '/include' |
50 | + if libdir not in self.compiler.library_dirs: | | 49 | + if libdir not in self.compiler.library_dirs: |
51 | + self.compiler.library_dirs.insert(0, libdir) | | 50 | + self.compiler.library_dirs.insert(0, libdir) |
52 | + if incdir not in self.compiler.include_dirs: | | 51 | + if incdir not in self.compiler.include_dirs: |
53 | + self.compiler.include_dirs.insert(0, incdir) | | 52 | + self.compiler.include_dirs.insert(0, incdir) |
54 | if cross_compiling: | | 53 | if cross_compiling: |
55 | self.add_gcc_paths() | | 54 | self.add_gcc_paths() |
56 | self.add_multiarch_paths() | | 55 | self.add_multiarch_paths() |
57 | @@ -569,7 +574,7 @@ class PyBuildExt(build_ext): | | 56 | @@ -569,7 +574,7 @@ |
58 | | | 57 | |
59 | # Check for MacOS X, which doesn't need libm.a at all | | 58 | # Check for MacOS X, which doesn't need libm.a at all |
60 | math_libs = ['m'] | | 59 | math_libs = ['m'] |
61 | - if host_platform in ['darwin', 'beos']: | | 60 | - if host_platform in ['darwin', 'beos']: |
62 | + if host_platform in ['darwin', 'beos', 'cygwin']: | | 61 | + if host_platform in ['darwin', 'beos', 'cygwin']: |
63 | math_libs = [] | | 62 | math_libs = [] |
64 | | | 63 | |
65 | # XXX Omitted modules: gl, pure, dl, SGI-specific modules | | 64 | # XXX Omitted modules: gl, pure, dl, SGI-specific modules |
66 | @@ -809,11 +814,10 @@ class PyBuildExt(build_ext): | | 65 | @@ -809,11 +814,10 @@ |
67 | libraries=math_libs) ) | | 66 | libraries=math_libs) ) |
68 | # Detect SSL support for the socket module (via _ssl) | | 67 | # Detect SSL support for the socket module (via _ssl) |
69 | search_for_ssl_incs_in = [ | | 68 | search_for_ssl_incs_in = [ |
70 | - '/usr/local/ssl/include', | | 69 | - '/usr/local/ssl/include', |
71 | - '/usr/contrib/ssl/include/' | | 70 | - '/usr/contrib/ssl/include/' |
72 | + '@SSLBASE@/include' | | 71 | + '@SSLBASE@/include' |
73 | ] | | 72 | ] |
74 | - ssl_incs = find_file('openssl/ssl.h', inc_dirs, | | 73 | - ssl_incs = find_file('openssl/ssl.h', inc_dirs, |
75 | - search_for_ssl_incs_in | | 74 | - search_for_ssl_incs_in |
76 | + ssl_incs = find_file('openssl/ssl.h', [], | | 75 | + ssl_incs = find_file('openssl/ssl.h', [], |
77 | + search_for_ssl_incs_in + inc_dirs | | 76 | + search_for_ssl_incs_in + inc_dirs |
78 | ) | | 77 | ) |
79 | if ssl_incs is not None: | | 78 | if ssl_incs is not None: |
80 | krb5_h = find_file('krb5.h', inc_dirs, | | 79 | krb5_h = find_file('krb5.h', inc_dirs, |
81 | @@ -821,9 +825,7 @@ class PyBuildExt(build_ext): | | 80 | @@ -821,9 +825,7 @@ |
82 | if krb5_h: | | 81 | if krb5_h: |
83 | ssl_incs += krb5_h | | 82 | ssl_incs += krb5_h |
84 | ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs, | | 83 | ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs, |
85 | - ['/usr/local/ssl/lib', | | 84 | - ['/usr/local/ssl/lib', |
86 | - '/usr/contrib/ssl/lib/' | | 85 | - '/usr/contrib/ssl/lib/' |
87 | - ] ) | | 86 | - ] ) |
88 | + [] ) | | 87 | + [] ) |
89 | | | 88 | |
90 | if (ssl_incs is not None and | | 89 | if (ssl_incs is not None and |
91 | ssl_libs is not None): | | 90 | ssl_libs is not None): |
92 | @@ -842,7 +844,7 @@ class PyBuildExt(build_ext): | | 91 | @@ -842,7 +844,7 @@ |
93 | | | 92 | |
94 | # look for the openssl version header on the compiler search path. | | 93 | # look for the openssl version header on the compiler search path. |
95 | opensslv_h = find_file('openssl/opensslv.h', [], | | 94 | opensslv_h = find_file('openssl/opensslv.h', [], |
96 | - inc_dirs + search_for_ssl_incs_in) | | 95 | - inc_dirs + search_for_ssl_incs_in) |
97 | + search_for_ssl_incs_in + inc_dirs) | | 96 | + search_for_ssl_incs_in + inc_dirs) |
98 | if opensslv_h: | | 97 | if opensslv_h: |
99 | name = os.path.join(opensslv_h[0], 'openssl/opensslv.h') | | 98 | name = os.path.join(opensslv_h[0], 'openssl/opensslv.h') |
100 | if host_platform == 'darwin' and is_macosx_sdk_path(name): | | 99 | if host_platform == 'darwin' and is_macosx_sdk_path(name): |
101 | @@ -942,175 +944,6 @@ class PyBuildExt(build_ext): | | 100 | @@ -942,175 +944,6 @@ |
102 | else: | | 101 | else: |
103 | raise ValueError("unknown major BerkeleyDB version", major) | | 102 | raise ValueError("unknown major BerkeleyDB version", major) |
104 | | | 103 | |
105 | - # construct a list of paths to look for the header file in on | | 104 | - # construct a list of paths to look for the header file in on |
106 | - # top of the normal inc_dirs. | | 105 | - # top of the normal inc_dirs. |
107 | - db_inc_paths = [ | | 106 | - db_inc_paths = [ |
108 | - '/usr/include/db4', | | 107 | - '/usr/include/db4', |
109 | - '/usr/local/include/db4', | | 108 | - '/usr/local/include/db4', |
110 | - '/opt/sfw/include/db4', | | 109 | - '/opt/sfw/include/db4', |
111 | - '/usr/include/db3', | | 110 | - '/usr/include/db3', |
112 | - '/usr/local/include/db3', | | 111 | - '/usr/local/include/db3', |
113 | - '/opt/sfw/include/db3', | | 112 | - '/opt/sfw/include/db3', |
114 | - # Fink defaults (http://fink.sourceforge.net/) | | 113 | - # Fink defaults (http://fink.sourceforge.net/) |
| @@ -264,61 +263,67 @@ cygwin 2.7.3-no-libm.patch | | | @@ -264,61 +263,67 @@ cygwin 2.7.3-no-libm.patch |
264 | - runtime_library_dirs=dblib_dir, | | 263 | - runtime_library_dirs=dblib_dir, |
265 | - include_dirs=db_incs, | | 264 | - include_dirs=db_incs, |
266 | - libraries=dblibs)) | | 265 | - libraries=dblibs)) |
267 | - else: | | 266 | - else: |
268 | - if db_setup_debug: print "db: no appropriate library found" | | 267 | - if db_setup_debug: print "db: no appropriate library found" |
269 | - db_incs = None | | 268 | - db_incs = None |
270 | - dblibs = [] | | 269 | - dblibs = [] |
271 | - dblib_dir = None | | 270 | - dblib_dir = None |
272 | - missing.append('_bsddb') | | 271 | - missing.append('_bsddb') |
273 | - | | 272 | - |
274 | # The sqlite interface | | 273 | # The sqlite interface |
275 | sqlite_setup_debug = False # verbose debug prints from this script? | | 274 | sqlite_setup_debug = False # verbose debug prints from this script? |
276 | | | 275 | |
277 | @@ -1227,35 +1060,39 @@ class PyBuildExt(build_ext): | | 276 | @@ -1216,46 +1049,32 @@ |
278 | # we do not build this one. Otherwise this build will pick up | | 277 | else: |
279 | # the more recent berkeleydb's db.h file first in the include path | | 278 | missing.append('_sqlite3') |
280 | # when attempting to compile and it will fail. | | 279 | |
| | | 280 | - # Look for Berkeley db 1.85. Note that it is built as a different |
| | | 281 | - # module name so it can be included even when later versions are |
| | | 282 | - # available. A very restrictive search is performed to avoid |
| | | 283 | - # accidentally building this module with a later version of the |
| | | 284 | - # underlying db library. May BSD-ish Unixes incorporate db 1.85 |
| | | 285 | - # symbols into libc and place the include file in /usr/include. |
| | | 286 | - # |
| | | 287 | - # If the better bsddb library can be built (db_incs is defined) |
| | | 288 | - # we do not build this one. Otherwise this build will pick up |
| | | 289 | - # the more recent berkeleydb's db.h file first in the include path |
| | | 290 | - # when attempting to compile and it will fail. |
281 | - f = "/usr/include/db.h" | | 291 | - f = "/usr/include/db.h" |
282 | - | | 292 | - |
283 | - if host_platform == 'darwin': | | 293 | - if host_platform == 'darwin': |
284 | - if is_macosx_sdk_path(f): | | 294 | - if is_macosx_sdk_path(f): |
285 | - sysroot = macosx_sdk_root() | | 295 | - sysroot = macosx_sdk_root() |
286 | - f = os.path.join(sysroot, f[1:]) | | 296 | - f = os.path.join(sysroot, f[1:]) |
287 | - | | 297 | - |
288 | - if os.path.exists(f) and not db_incs: | | 298 | - if os.path.exists(f) and not db_incs: |
289 | - data = open(f).read() | | 299 | - data = open(f).read() |
290 | - m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data) | | 300 | - m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data) |
291 | - if m is not None: | | 301 | - if m is not None: |
292 | - # bingo - old version used hash file format version 2 | | 302 | - # bingo - old version used hash file format version 2 |
293 | - ### XXX this should be fixed to not be platform-dependent | | 303 | - ### XXX this should be fixed to not be platform-dependent |
294 | - ### but I don't have direct access to an osf1 platform and | | 304 | - ### but I don't have direct access to an osf1 platform and |
295 | - ### seemed to be muffing the search somehow | | 305 | - ### seemed to be muffing the search somehow |
296 | - libraries = host_platform == "osf1" and ['db'] or None | | 306 | - libraries = host_platform == "osf1" and ['db'] or None |
297 | - if libraries is not None: | | 307 | - if libraries is not None: |
298 | - exts.append(Extension('bsddb185', ['bsddbmodule.c'], | | 308 | - exts.append(Extension('bsddb185', ['bsddbmodule.c'], |
299 | - libraries=libraries)) | | 309 | - libraries=libraries)) |
300 | - else: | | 310 | - else: |
301 | - exts.append(Extension('bsddb185', ['bsddbmodule.c'])) | | 311 | - exts.append(Extension('bsddb185', ['bsddbmodule.c'])) |
302 | - else: | | 312 | - else: |
303 | - missing.append('bsddb185') | | 313 | - missing.append('bsddb185') |
304 | + libraries = os.getenv("PY_BDB_TYPE", "") | | 314 | - else: |
305 | + if libraries: | | | |
306 | + exts.append(Extension('bsddb185', ['bsddbmodule.c'], | | | |
307 | + libraries=['db'])) | | | |
308 | else: | | | |
309 | - missing.append('bsddb185') | | 315 | - missing.append('bsddb185') |
310 | + exts.append(Extension('bsddb185', ['bsddbmodule.c'])) | | 316 | - |
311 | | | | |
312 | dbm_order = ['gdbm'] | | 317 | dbm_order = ['gdbm'] |
313 | # The standard Unix dbm module: | | 318 | # The standard Unix dbm module: |
314 | if host_platform not in ['cygwin']: | | 319 | if host_platform not in ['cygwin']: |
315 | + ## Top half based on find_file | | 320 | + ## Top half based on find_file |
316 | + def find_ndbm_h(dirs): | | 321 | + def find_ndbm_h(dirs): |
317 | + ret = None | | 322 | + ret = None |
318 | + if sys.platform == 'darwin': | | 323 | + if sys.platform == 'darwin': |
319 | + sysroot = macosx_sdk_root() | | 324 | + sysroot = macosx_sdk_root() |
320 | + for dir in dirs: | | 325 | + for dir in dirs: |
321 | + f = os.path.join(dir, 'ndbm.h') | | 326 | + f = os.path.join(dir, 'ndbm.h') |
322 | + if sys.platform == 'darwin' and is_macosx_sdk_path(dir): | | 327 | + if sys.platform == 'darwin' and is_macosx_sdk_path(dir): |
323 | + f = os.path.join(sysroot, dir[1:], 'ndbm.h') | | 328 | + f = os.path.join(sysroot, dir[1:], 'ndbm.h') |
324 | + if not os.path.exists(f): continue | | 329 | + if not os.path.exists(f): continue |
| @@ -328,62 +333,62 @@ cygwin 2.7.3-no-libm.patch | | | @@ -328,62 +333,62 @@ cygwin 2.7.3-no-libm.patch |
328 | + while 1: | | 333 | + while 1: |
329 | + line = input.readline() | | 334 | + line = input.readline() |
330 | + if not line: break | | 335 | + if not line: break |
331 | + if re.search('This file is part of GDBM', line): | | 336 | + if re.search('This file is part of GDBM', line): |
332 | + ret = None | | 337 | + ret = None |
333 | + break | | 338 | + break |
334 | + input.close() | | 339 | + input.close() |
335 | + break | | 340 | + break |
336 | + return ret | | 341 | + return ret |
337 | + | | 342 | + |
338 | config_args = [arg.strip("'") | | 343 | config_args = [arg.strip("'") |
339 | for arg in sysconfig.get_config_var("CONFIG_ARGS").split()] | | 344 | for arg in sysconfig.get_config_var("CONFIG_ARGS").split()] |
340 | dbm_args = [arg for arg in config_args | | 345 | dbm_args = [arg for arg in config_args |
341 | @@ -1267,7 +1104,7 @@ class PyBuildExt(build_ext): | | 346 | @@ -1267,7 +1086,7 @@ |
342 | dbmext = None | | 347 | dbmext = None |
343 | for cand in dbm_order: | | 348 | for cand in dbm_order: |
344 | if cand == "ndbm": | | 349 | if cand == "ndbm": |
345 | - if find_file("ndbm.h", inc_dirs, []) is not None: | | 350 | - if find_file("ndbm.h", inc_dirs, []) is not None: |
346 | + if find_ndbm_h(inc_dirs) is not None: | | 351 | + if find_ndbm_h(inc_dirs) is not None: |
347 | # Some systems have -lndbm, others have -lgdbm_compat, | | 352 | # Some systems have -lndbm, others have -lgdbm_compat, |
348 | # others don't have either | | 353 | # others don't have either |
349 | if self.compiler.find_library_file(lib_dirs, | | 354 | if self.compiler.find_library_file(lib_dirs, |
350 | @@ -1311,18 +1148,14 @@ class PyBuildExt(build_ext): | | 355 | @@ -1311,18 +1130,14 @@ |
351 | libraries = gdbm_libs) | | 356 | libraries = gdbm_libs) |
352 | break | | 357 | break |
353 | elif cand == "bdb": | | 358 | elif cand == "bdb": |
354 | - if db_incs is not None: | | 359 | - if db_incs is not None: |
355 | - print "building dbm using bdb" | | 360 | - print "building dbm using bdb" |
356 | - dbmext = Extension('dbm', ['dbmmodule.c'], | | 361 | - dbmext = Extension('dbm', ['dbmmodule.c'], |
357 | - library_dirs=dblib_dir, | | 362 | - library_dirs=dblib_dir, |
358 | - runtime_library_dirs=dblib_dir, | | 363 | - runtime_library_dirs=dblib_dir, |
359 | - include_dirs=db_incs, | | 364 | - include_dirs=db_incs, |
360 | - define_macros=[ | | 365 | - define_macros=[ |
361 | - ('HAVE_BERKDB_H', None), | | 366 | - ('HAVE_BERKDB_H', None), |
362 | - ('DB_DBM_HSEARCH', None), | | 367 | - ('DB_DBM_HSEARCH', None), |
363 | - ], | | 368 | - ], |
364 | - libraries=dblibs) | | 369 | - libraries=dblibs) |
365 | - break | | 370 | - break |
366 | + print "building dbm using bdb" | | 371 | + print "building dbm using bdb" |
367 | + dbmext = Extension('dbm', ['dbmmodule.c'], | | 372 | + dbmext = Extension('dbm', ['dbmmodule.c'], |
368 | + define_macros=[ | | 373 | + define_macros=[ |
369 | + ('HAVE_BERKDB_H', None), | | 374 | + ('HAVE_BERKDB_H', None), |
370 | + ('DB_DBM_HSEARCH', None), | | 375 | + ('DB_DBM_HSEARCH', None), |
371 | + ], | | 376 | + ], |
372 | + libraries=["db"]) | | 377 | + libraries=["db"]) |
373 | + break | | 378 | + break |
374 | if dbmext is not None: | | 379 | if dbmext is not None: |
375 | exts.append(dbmext) | | 380 | exts.append(dbmext) |
376 | else: | | 381 | else: |
377 | @@ -2250,9 +2083,9 @@ def main(): | | 382 | @@ -2250,9 +2065,9 @@ |
378 | ext_modules=[Extension('_struct', ['_struct.c'])], | | 383 | ext_modules=[Extension('_struct', ['_struct.c'])], |
379 | | | 384 | |
380 | # Scripts to install | | 385 | # Scripts to install |
381 | - scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle', | | 386 | - scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle', |
382 | - 'Tools/scripts/2to3', | | 387 | - 'Tools/scripts/2to3', |
383 | - 'Lib/smtpd.py'] | | 388 | - 'Lib/smtpd.py'] |
384 | + scripts = ['Tools/scripts/pydoc2.7', | | 389 | + scripts = ['Tools/scripts/pydoc2.7', |
385 | + 'Tools/scripts/2to3-2.7', | | 390 | + 'Tools/scripts/2to3-2.7', |
386 | + 'Tools/scripts/smtpd2.7.py'] | | 391 | + 'Tools/scripts/smtpd2.7.py'] |
387 | ) | | 392 | ) |
388 | | | 393 | |
389 | # --install-platlib | | 394 | # --install-platlib |