diff options
author | recht <recht@pkgsrc.org> | 2004-04-13 22:48:41 +0000 |
---|---|---|
committer | recht <recht@pkgsrc.org> | 2004-04-13 22:48:41 +0000 |
commit | 0f312c17dcd9a9cedac55611702cb33550dd6f9f (patch) | |
tree | 81b5a982678aa8df98c37803fa49efabb0fec3db /lang | |
parent | 2c29b0548dbaa32b6e119571cfeb05c623bd4b5d (diff) | |
download | pkgsrc-0f312c17dcd9a9cedac55611702cb33550dd6f9f.tar.gz |
Rework bdb detection: Since we're using buildlink we could save rely
on the variables it sets (eg. BDB_TYPE). While at bl3ify.
Thanks to minskim@ for fixes and testing.
Diffstat (limited to 'lang')
-rw-r--r-- | lang/python23-pth/Makefile | 4 | ||||
-rw-r--r-- | lang/python23-pth/distinfo | 4 | ||||
-rw-r--r-- | lang/python23-pth/patches/patch-am | 323 | ||||
-rw-r--r-- | lang/python23/Makefile.common | 50 | ||||
-rw-r--r-- | lang/python23/distinfo | 4 | ||||
-rw-r--r-- | lang/python23/patches/patch-am | 323 |
6 files changed, 567 insertions, 141 deletions
diff --git a/lang/python23-pth/Makefile b/lang/python23-pth/Makefile index ffec3b8cd93..c289dad490a 100644 --- a/lang/python23-pth/Makefile +++ b/lang/python23-pth/Makefile @@ -1,11 +1,11 @@ -# $NetBSD: Makefile,v 1.19 2004/03/26 02:27:42 wiz Exp $ +# $NetBSD: Makefile,v 1.20 2004/04/13 22:48:41 recht Exp $ # PKGNAME= python23-pth-2.3.3 PKGREVISION= 2 PTHREAD_OPTS= require -.include "../../mk/pthread.buildlink2.mk" +.include "../../mk/pthread.buildlink3.mk" .if ${PTHREAD_TYPE} == "pth" CONFIGURE_ARGS+= --with-pth .endif diff --git a/lang/python23-pth/distinfo b/lang/python23-pth/distinfo index c67dc95f3b3..ced088c0697 100644 --- a/lang/python23-pth/distinfo +++ b/lang/python23-pth/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.13 2004/04/09 23:10:36 recht Exp $ +$NetBSD: distinfo,v 1.14 2004/04/13 22:48:42 recht Exp $ SHA1 (Python-2.3.3.tgz) = 034d2e3ed011ea753d4fee7efab16e31029b1e5e Size (Python-2.3.3.tgz) = 8491380 bytes @@ -9,5 +9,5 @@ SHA1 (patch-ae) = 544af90b9b7c5eb5cbad0ba0cefa3d9496b5efe3 SHA1 (patch-af) = 2989a1975c8ea435903eafc9add57cb7c4d7de14 SHA1 (patch-ah) = 4bc95e775a2b3f4f1997d0779c561db2e9e7b575 SHA1 (patch-al) = 2dfed1a40493b571e3477cfb56c2d0ed1b1deddf -SHA1 (patch-am) = 74e8d87ecd4cb17634e992a985393c72193b2892 +SHA1 (patch-am) = eda4c6161b4237e1281cc6b82b26c5195444dcff SHA1 (patch-ba) = dd8f89952d7f40c9a979e362758775f093e047bc diff --git a/lang/python23-pth/patches/patch-am b/lang/python23-pth/patches/patch-am index 1770cc3a88c..e61b77b82ab 100644 --- a/lang/python23-pth/patches/patch-am +++ b/lang/python23-pth/patches/patch-am @@ -1,4 +1,4 @@ -$NetBSD: patch-am,v 1.4 2004/03/22 06:33:58 minskim Exp $ +$NetBSD: patch-am,v 1.5 2004/04/13 22:48:42 recht Exp $ --- setup.py.orig 2003-10-21 15:01:21.000000000 -0500 +++ setup.py @@ -52,64 +52,285 @@ $NetBSD: patch-am,v 1.4 2004/03/22 06:33:58 minskim Exp $ if (ssl_incs is not None and ssl_libs is not None): -@@ -515,6 +517,7 @@ class PyBuildExt(build_ext): - '/usr/include/db3', - )}, - } -+ db_try_this = {} +@@ -479,116 +481,162 @@ class PyBuildExt(build_ext): - db_search_order = db_try_this.keys() - db_search_order.sort() -@@ -562,9 +565,11 @@ class PyBuildExt(build_ext): + # when sorted in reverse order, keys for this dict must appear in the + # order you wish to search - e.g., search for db4 before db3 +- db_try_this = { +- 'db4': {'libs': ('db-4.2', 'db42', 'db-4.1', 'db41', 'db-4.0', 'db4',), +- 'libdirs': ('/usr/local/BerkeleyDB.4.2/lib', +- '/usr/local/BerkeleyDB.4.1/lib', +- '/usr/local/BerkeleyDB.4.0/lib', +- '/usr/local/lib', +- '/opt/sfw', +- '/sw/lib', +- ), +- 'incdirs': ('/usr/local/BerkeleyDB.4.2/include', +- '/usr/local/include/db42', +- '/usr/local/BerkeleyDB.4.1/include', +- '/usr/local/include/db41', +- '/usr/local/BerkeleyDB.4.0/include', +- '/usr/local/include/db4', +- '/opt/sfw/include/db4', +- '/sw/include/db4', +- '/usr/include/db4', +- )}, +- 'db3': {'libs': ('db-3.3', 'db-3.2', 'db-3.1', 'db3',), +- 'libdirs': ('/usr/local/BerkeleyDB.3.3/lib', +- '/usr/local/BerkeleyDB.3.2/lib', +- '/usr/local/BerkeleyDB.3.1/lib', +- '/usr/local/lib', +- '/opt/sfw/lib', +- '/sw/lib', +- ), +- 'incdirs': ('/usr/local/BerkeleyDB.3.3/include', +- '/usr/local/BerkeleyDB.3.2/include', +- '/usr/local/BerkeleyDB.3.1/include', +- '/usr/local/include/db3', +- '/opt/sfw/include/db3', +- '/sw/include/db3', +- '/usr/include/db3', +- )}, +- } +- +- db_search_order = db_try_this.keys() +- db_search_order.sort() +- db_search_order.reverse() ++ #db_try_this = { ++ #'db4': {'libs': ('db-4.2', 'db42', 'db-4.1', 'db41', 'db-4.0', 'db4',), ++ #'libdirs': ('/usr/local/BerkeleyDB.4.2/lib', ++ #'/usr/local/BerkeleyDB.4.1/lib', ++ #'/usr/local/BerkeleyDB.4.0/lib', ++ #'/usr/local/lib', ++ #'/opt/sfw', ++ #'/sw/lib', ++ #), ++ #'incdirs': ('/usr/local/BerkeleyDB.4.2/include', ++ #'/usr/local/include/db42', ++ #'/usr/local/BerkeleyDB.4.1/include', ++ #'/usr/local/include/db41', ++ #'/usr/local/BerkeleyDB.4.0/include', ++ #'/usr/local/include/db4', ++ #'/opt/sfw/include/db4', ++ #'/sw/include/db4', ++ #'/usr/include/db4', ++ #)}, ++ #'db3': {'libs': ('db-3.3', 'db-3.2', 'db-3.1', 'db3',), ++ #'libdirs': ('/usr/local/BerkeleyDB.3.3/lib', ++ #'/usr/local/BerkeleyDB.3.2/lib', ++ #'/usr/local/BerkeleyDB.3.1/lib', ++ #'/usr/local/lib', ++ #'/opt/sfw/lib', ++ #'/sw/lib', ++ #), ++ #'incdirs': ('/usr/local/BerkeleyDB.3.3/include', ++ #'/usr/local/BerkeleyDB.3.2/include', ++ #'/usr/local/BerkeleyDB.3.1/include', ++ #'/usr/local/include/db3', ++ #'/opt/sfw/include/db3', ++ #'/sw/include/db3', ++ #'/usr/include/db3', ++ #)}, ++ #} ++ ++ #db_search_order = db_try_this.keys() ++ #db_search_order.sort() ++ #db_search_order.reverse() ++ ++ #class found(Exception): pass ++ #try: ++ ## See whether there is a Sleepycat header in the standard ++ ## search path. ++ #std_dbinc = None ++ #for d in inc_dirs: ++ #f = os.path.join(d, "db.h") ++ #if os.path.exists(f): ++ #f = open(f).read() ++ #m = re.search(r"#define\WDB_VERSION_MAJOR\W([1-9]+)", f) ++ #if m: ++ #std_dbinc = 'db' + m.group(1) ++ #for dbkey in db_search_order: ++ #dbd = db_try_this[dbkey] ++ #for dblib in dbd['libs']: ++ ## Prefer version-specific includes over standard ++ ## include locations. ++ #db_incs = find_file('db.h', [], dbd['incdirs']) ++ #dblib_dir = find_library_file(self.compiler, ++ #dblib, ++ #lib_dirs, ++ #list(dbd['libdirs'])) ++ #if (db_incs or dbkey == std_dbinc) and \ ++ #dblib_dir is not None: ++ #dblibs = [dblib] ++ #raise found ++ #except found: ++ #dblibs = [dblib] ++ ## A default source build puts Berkeley DB in something like ++ ## /usr/local/Berkeley.3.3 and the lib dir under that isn't ++ ## normally on ld.so's search path, unless the sysadmin has hacked ++ ## /etc/ld.so.conf. We add the directory to runtime_library_dirs ++ ## so the proper -R/--rpath flags get passed to the linker. This ++ ## is usually correct and most trouble free, but may cause problems ++ ## in some unusual system configurations (e.g. the directory is on ++ ## an NFS server that goes away). ++ #exts.append(Extension('_bsddb', ['_bsddb.c'], ++ #library_dirs=dblib_dir, ++ #runtime_library_dirs=dblib_dir, ++ #include_dirs=db_incs, ++ #libraries=dblibs)) ++ #else: ++ #db_incs = None ++ #dblibs = [] ++ #dblib_dir = None + +- class found(Exception): pass ++ # Look for Berkeley db 1.85. Note that it is built as a different ++ # module name so it can be included even when later versions are ++ # available. A very restrictive search is performed to avoid ++ # accidentally building this module with a later version of the ++ # underlying db library. May BSD-ish Unixes incorporate db 1.85 ++ # symbols into libc and place the include file in /usr/include. ++ #f = "/usr/include/db.h" ++ #if os.path.exists(f): ++ #data = open(f).read() ++ #m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data) ++ #if m is not None: ++ ## bingo - old version used hash file format version 2 ++ #### XXX this should be fixed to not be platform-dependent ++ #### but I don't have direct access to an osf1 platform and ++ #### seemed to be muffing the search somehow ++ #libraries = platform == "osf1" and ['db'] or None ++ #if libraries is not None: ++ #exts.append(Extension('bsddb185', ['bsddbmodule.c'], ++ #libraries=libraries)) ++ #else: ++ #exts.append(Extension('bsddb185', ['bsddbmodule.c'])) ++ ++ # rely on pkgsrc for Berkeley DB ++ class NotFound(Exception): pass + try: +- # See whether there is a Sleepycat header in the standard +- # search path. +- std_dbinc = None +- for d in inc_dirs: +- f = os.path.join(d, "db.h") ++ bdb_type = os.environ['PY_BDB_TYPE'] ++ db_incs = [os.environ['PY_BDB_INCDIRS']] ++ dblib_dir = None ++ dblibs = None ++ ++ # check if need to use the db_185.h compat header ++ bsddb185_define_macros=[] ++ if bdb_type == "db2" or bdb_type == "db3" or bdb_type == "db4": ++ bsddb185_define_macros=[('HAVE_DB_185_H',1)] ++ dblib_dir = [os.environ['PY_BDB_LIBDIRS']] ++ ++ else: ++ # check if db_incs/db.h really is db 1.85 ++ f = "%s/db.h" % db_incs[0] ++ + if os.path.exists(f): +- f = open(f).read() +- m = re.search(r"#define\WDB_VERSION_MAJOR\W([1-9]+)", f) +- if m: +- std_dbinc = 'db' + m.group(1) +- for dbkey in db_search_order: +- dbd = db_try_this[dbkey] +- for dblib in dbd['libs']: +- # Prefer version-specific includes over standard +- # include locations. +- db_incs = find_file('db.h', [], dbd['incdirs']) +- dblib_dir = find_library_file(self.compiler, +- dblib, +- lib_dirs, +- list(dbd['libdirs'])) +- if (db_incs or dbkey == std_dbinc) and \ +- dblib_dir is not None: +- dblibs = [dblib] +- raise found +- except found: +- dblibs = [dblib] +- # A default source build puts Berkeley DB in something like +- # /usr/local/Berkeley.3.3 and the lib dir under that isn't +- # normally on ld.so's search path, unless the sysadmin has hacked +- # /etc/ld.so.conf. We add the directory to runtime_library_dirs +- # so the proper -R/--rpath flags get passed to the linker. This +- # is usually correct and most trouble free, but may cause problems +- # in some unusual system configurations (e.g. the directory is on +- # an NFS server that goes away). +- exts.append(Extension('_bsddb', ['_bsddb.c'], ++ data = open(f).read() ++ m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data) ++ if m is None: ++ # check for 1.85 compat header ++ if os.path.exists("%s/db_185.h" % db_incs[0]): ++ bsddb185_define_macros=[('HAVE_DB_185_H',1)] ++ else: ++ raise NotFound ++ try: ++ bltransform = os.environ['PY_BDB_TRANSFORM'] ++ m = re.search(r"l:db:(db.)\s*", bltransform) ++ if m is not None and m.group(1) is not None: ++ dblibs = [m.group(1)] ++ except: ++ pass ++ ++ # build the bsddb185 extension module ++ exts.append(Extension('bsddb185', ['bsddbmodule.c'], + library_dirs=dblib_dir, + runtime_library_dirs=dblib_dir, include_dirs=db_incs, ++ define_macros=bsddb185_define_macros, libraries=dblibs)) - else: -- db_incs = None -- dblibs = [] +- else: ++ except: + db_incs = None + dblibs = [] - dblib_dir = None -+ db_incs =['%%DB185_INCS%%'] -+ dblibs = ['%%DB185_LIBS%%'] -+ dblib_dir = ['%%DB185_LIBDIR%%'] -+ if len(dblibs) > 0 and dblibs[0] == '': -+ dblibs = [] - - - # Look for Berkeley db 1.85. Note that it is built as a different -@@ -573,21 +578,30 @@ class PyBuildExt(build_ext): - # accidentally building this module with a later version of the - # underlying db library. May BSD-ish Unixes incorporate db 1.85 - # symbols into libc and place the include file in /usr/include. +- +- +- # Look for Berkeley db 1.85. Note that it is built as a different +- # module name so it can be included even when later versions are +- # available. A very restrictive search is performed to avoid +- # accidentally building this module with a later version of the +- # underlying db library. May BSD-ish Unixes incorporate db 1.85 +- # symbols into libc and place the include file in /usr/include. - f = "/usr/include/db.h" -+ f = "%%DB185_H%%" - if os.path.exists(f): - data = open(f).read() - m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data) - if m is not None: -+ bsddb185_define_macros = [] -+ if f.split("/")[-1] == "db_185.h": -+ bsddb185_define_macros=[('HAVE_DB_185_H',1)] - # bingo - old version used hash file format version 2 - ### XXX this should be fixed to not be platform-dependent - ### but I don't have direct access to an osf1 platform and - ### seemed to be muffing the search somehow +- if os.path.exists(f): +- data = open(f).read() +- m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data) +- if m is not None: +- # bingo - old version used hash file format version 2 +- ### XXX this should be fixed to not be platform-dependent +- ### but I don't have direct access to an osf1 platform and +- ### seemed to be muffing the search somehow - libraries = platform == "osf1" and ['db'] or None -+ #libraries = platform == "osf1" and ['db'] or None -+ libraries = dblibs - if libraries is not None: - exts.append(Extension('bsddb185', ['bsddbmodule.c'], -+ library_dirs=dblib_dir, -+ runtime_library_dirs=dblib_dir, -+ include_dirs=db_incs, -+ define_macros=bsddb185_define_macros, - libraries=libraries)) - else: +- if libraries is not None: +- exts.append(Extension('bsddb185', ['bsddbmodule.c'], +- libraries=libraries)) +- else: - exts.append(Extension('bsddb185', ['bsddbmodule.c'])) -+ exts.append(Extension('bsddb185', ['bsddbmodule.c'], -+ define_macros=bsddb185_define_macros)) - +- ++ dblib_dir = None ++ # The standard Unix dbm module: if platform not in ['cygwin']: -@@ -770,7 +784,7 @@ class PyBuildExt(build_ext): + if find_file("ndbm.h", inc_dirs, []) is not None: +@@ -600,6 +648,13 @@ class PyBuildExt(build_ext): + exts.append( Extension('dbm', ['dbmmodule.c'], + define_macros=[('HAVE_NDBM_H',None)], + libraries = ndbm_libs ) ) ++ elif find_file("ndbm.h", db_incs, []) is not None: ++ exts.append( Extension('dbm', ['dbmmodule.c'], ++ library_dirs=dblib_dir, ++ runtime_library_dirs=dblib_dir, ++ include_dirs=db_incs, ++ define_macros=[('HAVE_NDBM_H',None)], ++ libraries=dblibs)) + elif (self.compiler.find_library_file(lib_dirs, 'gdbm') + and find_file("gdbm/ndbm.h", inc_dirs, []) is not None): + exts.append( Extension('dbm', ['dbmmodule.c'], +@@ -770,7 +825,7 @@ class PyBuildExt(build_ext): # Linux-specific modules exts.append( Extension('linuxaudiodev', ['linuxaudiodev.c']) ) @@ -118,7 +339,7 @@ $NetBSD: patch-am,v 1.4 2004/03/22 06:33:58 minskim Exp $ exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) ) if platform == 'sunos5': -@@ -1140,7 +1154,7 @@ def main(): +@@ -1140,7 +1195,7 @@ def main(): ext_modules=[Extension('struct', ['structmodule.c'])], # Scripts to install diff --git a/lang/python23/Makefile.common b/lang/python23/Makefile.common index 2b2bd3a9319..de87374936e 100644 --- a/lang/python23/Makefile.common +++ b/lang/python23/Makefile.common @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.common,v 1.7 2004/02/04 22:23:47 abs Exp $ +# $NetBSD: Makefile.common,v 1.8 2004/04/13 22:48:41 recht Exp $ # DISTNAME= Python-2.3.3 @@ -12,8 +12,7 @@ COMMENT= Interpreted, interactive, object-oriented programming language USE_LANGUAGES= c c++ USE_GCC_SHLIB= yes -USE_DB185= yes -USE_BUILDLINK2= yes +USE_BUILDLINK3= yes GNU_CONFIGURE= yes CONFIGURE_ARGS+= --enable-shared CONFIGURE_ARGS+= OPT="${CFLAGS}" @@ -68,34 +67,19 @@ PLIST_SUBST+= EXTRA_SO=${EXTRA_SO_SUBST} PLIST_SUBST+= OSSAUDIODEV=${OSSAUDIODEV_SUBST} # ensure that the bsddb185 module is built on all platforms -.include "../../databases/db/buildlink2.mk" - -SUBST_CLASSES+= setup -SUBST_MESSAGE.setup= "Fixing paths for db 1.85." -SUBST_STAGE.setup= post-patch -SUBST_FILES.setup= setup.py -SUBST_SED.setup= -e 's,%%DB185_H%%,${DB185_H},g' -SUBST_SED.setup+= -e 's,%%DB185_INCS%%,${DB185_INCS},g' -SUBST_SED.setup+= -e 's,%%DB185_LIBS%%,${DB185_LIBS},g' -SUBST_SED.setup+= -e 's,%%DB185_LIBDIR%%,${DB185_LIBDIR},g' - -DB185_LIBDIR= ${BUILDLINK_PREFIX.db}/lib - -.if !empty(BUILDLINK_CPPFLAGS.db) -LDFLAGS+= ${BUILDLINK_LDFLAGS.db} -DBINCDIR= ${BUILDLINK_CPPFLAGS.db:S/-I//} -DB185_INCS= ${DBINCDIR} -DB185_LIBS= ${BUILDLINK_LIBS.db:S/-l//} - -.if ${_NEED_DB2} == "YES" -DB185_H= ${DBINCDIR}/db_185.h +USE_DB185= yes +.include "../../mk/bdb.buildlink3.mk" +MAKE_ENV+= PY_BDB_TYPE=${BDB_TYPE} + +.if ${BDB_TYPE} == "native" +MAKE_ENV+= PY_BDB_INCDIRS=/usr/${_BDB_INCDIRS} .else -DB185_H= ${DBINCDIR}/db.h +MAKE_ENV+= PY_BDB_INCDIRS=${BDBBASE}/${BUILDLINK_INCDIRS.${BDB_TYPE}} +MAKE_ENV+= PY_BDB_LIBDIRS=${BDBBASE}/lib .endif -.else -DB185_H= /usr/include/db.h -DB185_INCS= /usr/include -DB185_LIBS= + +.if defined(BUILDLINK_TRANSFORM) +MAKE_ENV+= PY_BDB_TRANSFORM="${BUILDLINK_TRANSFORM}" .endif PLIST_SUBST+= PY_VER_SUFFIX=${PY_VER_SUFFIX} @@ -106,8 +90,8 @@ INSTALL_TARGET= altinstall post-extract: ${MV} ${WRKSRC}/Tools/scripts/pydoc ${WRKSRC}/Tools/scripts/pydoc${PY_VER_SUFFIX} -.include "../../archivers/bzip2/buildlink2.mk" -.include "../../devel/zlib/buildlink2.mk" -.include "../../security/openssl/buildlink2.mk" -.include "../../mk/ossaudio.buildlink2.mk" +.include "../../archivers/bzip2/buildlink3.mk" +.include "../../devel/zlib/buildlink3.mk" +.include "../../security/openssl/buildlink3.mk" +.include "../../mk/ossaudio.buildlink3.mk" .include "../../mk/bsd.pkg.mk" diff --git a/lang/python23/distinfo b/lang/python23/distinfo index bf4440170df..b8e2bac2b43 100644 --- a/lang/python23/distinfo +++ b/lang/python23/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.14 2004/04/09 10:48:09 recht Exp $ +$NetBSD: distinfo,v 1.15 2004/04/13 22:48:41 recht Exp $ SHA1 (Python-2.3.3.tgz) = 034d2e3ed011ea753d4fee7efab16e31029b1e5e Size (Python-2.3.3.tgz) = 8491380 bytes @@ -9,4 +9,4 @@ SHA1 (patch-ae) = 544af90b9b7c5eb5cbad0ba0cefa3d9496b5efe3 SHA1 (patch-af) = 2989a1975c8ea435903eafc9add57cb7c4d7de14 SHA1 (patch-ah) = 4bc95e775a2b3f4f1997d0779c561db2e9e7b575 SHA1 (patch-al) = 30941bb705d216d40d1bbdbaf68d6fb2a4714bd2 -SHA1 (patch-am) = 662ee4d158d4fe059f01c94a5647b00eab69603b +SHA1 (patch-am) = df5c858b32a9a5aa118c84f6742f9d3547c0c7f3 diff --git a/lang/python23/patches/patch-am b/lang/python23/patches/patch-am index fdc5c471360..e1f266589f5 100644 --- a/lang/python23/patches/patch-am +++ b/lang/python23/patches/patch-am @@ -1,4 +1,4 @@ -$NetBSD: patch-am,v 1.4 2004/03/22 06:33:58 minskim Exp $ +$NetBSD: patch-am,v 1.5 2004/04/13 22:48:41 recht Exp $ --- setup.py.orig 2003-10-21 15:01:21.000000000 -0500 +++ setup.py @@ -52,64 +52,285 @@ $NetBSD: patch-am,v 1.4 2004/03/22 06:33:58 minskim Exp $ if (ssl_incs is not None and ssl_libs is not None): -@@ -515,6 +517,7 @@ class PyBuildExt(build_ext): - '/usr/include/db3', - )}, - } -+ db_try_this = {} +@@ -479,116 +481,162 @@ class PyBuildExt(build_ext): - db_search_order = db_try_this.keys() - db_search_order.sort() -@@ -562,9 +565,11 @@ class PyBuildExt(build_ext): + # when sorted in reverse order, keys for this dict must appear in the + # order you wish to search - e.g., search for db4 before db3 +- db_try_this = { +- 'db4': {'libs': ('db-4.2', 'db42', 'db-4.1', 'db41', 'db-4.0', 'db4',), +- 'libdirs': ('/usr/local/BerkeleyDB.4.2/lib', +- '/usr/local/BerkeleyDB.4.1/lib', +- '/usr/local/BerkeleyDB.4.0/lib', +- '/usr/local/lib', +- '/opt/sfw', +- '/sw/lib', +- ), +- 'incdirs': ('/usr/local/BerkeleyDB.4.2/include', +- '/usr/local/include/db42', +- '/usr/local/BerkeleyDB.4.1/include', +- '/usr/local/include/db41', +- '/usr/local/BerkeleyDB.4.0/include', +- '/usr/local/include/db4', +- '/opt/sfw/include/db4', +- '/sw/include/db4', +- '/usr/include/db4', +- )}, +- 'db3': {'libs': ('db-3.3', 'db-3.2', 'db-3.1', 'db3',), +- 'libdirs': ('/usr/local/BerkeleyDB.3.3/lib', +- '/usr/local/BerkeleyDB.3.2/lib', +- '/usr/local/BerkeleyDB.3.1/lib', +- '/usr/local/lib', +- '/opt/sfw/lib', +- '/sw/lib', +- ), +- 'incdirs': ('/usr/local/BerkeleyDB.3.3/include', +- '/usr/local/BerkeleyDB.3.2/include', +- '/usr/local/BerkeleyDB.3.1/include', +- '/usr/local/include/db3', +- '/opt/sfw/include/db3', +- '/sw/include/db3', +- '/usr/include/db3', +- )}, +- } +- +- db_search_order = db_try_this.keys() +- db_search_order.sort() +- db_search_order.reverse() ++ #db_try_this = { ++ #'db4': {'libs': ('db-4.2', 'db42', 'db-4.1', 'db41', 'db-4.0', 'db4',), ++ #'libdirs': ('/usr/local/BerkeleyDB.4.2/lib', ++ #'/usr/local/BerkeleyDB.4.1/lib', ++ #'/usr/local/BerkeleyDB.4.0/lib', ++ #'/usr/local/lib', ++ #'/opt/sfw', ++ #'/sw/lib', ++ #), ++ #'incdirs': ('/usr/local/BerkeleyDB.4.2/include', ++ #'/usr/local/include/db42', ++ #'/usr/local/BerkeleyDB.4.1/include', ++ #'/usr/local/include/db41', ++ #'/usr/local/BerkeleyDB.4.0/include', ++ #'/usr/local/include/db4', ++ #'/opt/sfw/include/db4', ++ #'/sw/include/db4', ++ #'/usr/include/db4', ++ #)}, ++ #'db3': {'libs': ('db-3.3', 'db-3.2', 'db-3.1', 'db3',), ++ #'libdirs': ('/usr/local/BerkeleyDB.3.3/lib', ++ #'/usr/local/BerkeleyDB.3.2/lib', ++ #'/usr/local/BerkeleyDB.3.1/lib', ++ #'/usr/local/lib', ++ #'/opt/sfw/lib', ++ #'/sw/lib', ++ #), ++ #'incdirs': ('/usr/local/BerkeleyDB.3.3/include', ++ #'/usr/local/BerkeleyDB.3.2/include', ++ #'/usr/local/BerkeleyDB.3.1/include', ++ #'/usr/local/include/db3', ++ #'/opt/sfw/include/db3', ++ #'/sw/include/db3', ++ #'/usr/include/db3', ++ #)}, ++ #} ++ ++ #db_search_order = db_try_this.keys() ++ #db_search_order.sort() ++ #db_search_order.reverse() ++ ++ #class found(Exception): pass ++ #try: ++ ## See whether there is a Sleepycat header in the standard ++ ## search path. ++ #std_dbinc = None ++ #for d in inc_dirs: ++ #f = os.path.join(d, "db.h") ++ #if os.path.exists(f): ++ #f = open(f).read() ++ #m = re.search(r"#define\WDB_VERSION_MAJOR\W([1-9]+)", f) ++ #if m: ++ #std_dbinc = 'db' + m.group(1) ++ #for dbkey in db_search_order: ++ #dbd = db_try_this[dbkey] ++ #for dblib in dbd['libs']: ++ ## Prefer version-specific includes over standard ++ ## include locations. ++ #db_incs = find_file('db.h', [], dbd['incdirs']) ++ #dblib_dir = find_library_file(self.compiler, ++ #dblib, ++ #lib_dirs, ++ #list(dbd['libdirs'])) ++ #if (db_incs or dbkey == std_dbinc) and \ ++ #dblib_dir is not None: ++ #dblibs = [dblib] ++ #raise found ++ #except found: ++ #dblibs = [dblib] ++ ## A default source build puts Berkeley DB in something like ++ ## /usr/local/Berkeley.3.3 and the lib dir under that isn't ++ ## normally on ld.so's search path, unless the sysadmin has hacked ++ ## /etc/ld.so.conf. We add the directory to runtime_library_dirs ++ ## so the proper -R/--rpath flags get passed to the linker. This ++ ## is usually correct and most trouble free, but may cause problems ++ ## in some unusual system configurations (e.g. the directory is on ++ ## an NFS server that goes away). ++ #exts.append(Extension('_bsddb', ['_bsddb.c'], ++ #library_dirs=dblib_dir, ++ #runtime_library_dirs=dblib_dir, ++ #include_dirs=db_incs, ++ #libraries=dblibs)) ++ #else: ++ #db_incs = None ++ #dblibs = [] ++ #dblib_dir = None + +- class found(Exception): pass ++ # Look for Berkeley db 1.85. Note that it is built as a different ++ # module name so it can be included even when later versions are ++ # available. A very restrictive search is performed to avoid ++ # accidentally building this module with a later version of the ++ # underlying db library. May BSD-ish Unixes incorporate db 1.85 ++ # symbols into libc and place the include file in /usr/include. ++ #f = "/usr/include/db.h" ++ #if os.path.exists(f): ++ #data = open(f).read() ++ #m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data) ++ #if m is not None: ++ ## bingo - old version used hash file format version 2 ++ #### XXX this should be fixed to not be platform-dependent ++ #### but I don't have direct access to an osf1 platform and ++ #### seemed to be muffing the search somehow ++ #libraries = platform == "osf1" and ['db'] or None ++ #if libraries is not None: ++ #exts.append(Extension('bsddb185', ['bsddbmodule.c'], ++ #libraries=libraries)) ++ #else: ++ #exts.append(Extension('bsddb185', ['bsddbmodule.c'])) ++ ++ # rely on pkgsrc for Berkeley DB ++ class NotFound(Exception): pass + try: +- # See whether there is a Sleepycat header in the standard +- # search path. +- std_dbinc = None +- for d in inc_dirs: +- f = os.path.join(d, "db.h") ++ bdb_type = os.environ['PY_BDB_TYPE'] ++ db_incs = [os.environ['PY_BDB_INCDIRS']] ++ dblib_dir = None ++ dblibs = None ++ ++ # check if need to use the db_185.h compat header ++ bsddb185_define_macros=[] ++ if bdb_type == "db2" or bdb_type == "db3" or bdb_type == "db4": ++ bsddb185_define_macros=[('HAVE_DB_185_H',1)] ++ dblib_dir = [os.environ['PY_BDB_LIBDIRS']] ++ ++ else: ++ # check if db_incs/db.h really is db 1.85 ++ f = "%s/db.h" % db_incs[0] ++ + if os.path.exists(f): +- f = open(f).read() +- m = re.search(r"#define\WDB_VERSION_MAJOR\W([1-9]+)", f) +- if m: +- std_dbinc = 'db' + m.group(1) +- for dbkey in db_search_order: +- dbd = db_try_this[dbkey] +- for dblib in dbd['libs']: +- # Prefer version-specific includes over standard +- # include locations. +- db_incs = find_file('db.h', [], dbd['incdirs']) +- dblib_dir = find_library_file(self.compiler, +- dblib, +- lib_dirs, +- list(dbd['libdirs'])) +- if (db_incs or dbkey == std_dbinc) and \ +- dblib_dir is not None: +- dblibs = [dblib] +- raise found +- except found: +- dblibs = [dblib] +- # A default source build puts Berkeley DB in something like +- # /usr/local/Berkeley.3.3 and the lib dir under that isn't +- # normally on ld.so's search path, unless the sysadmin has hacked +- # /etc/ld.so.conf. We add the directory to runtime_library_dirs +- # so the proper -R/--rpath flags get passed to the linker. This +- # is usually correct and most trouble free, but may cause problems +- # in some unusual system configurations (e.g. the directory is on +- # an NFS server that goes away). +- exts.append(Extension('_bsddb', ['_bsddb.c'], ++ data = open(f).read() ++ m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data) ++ if m is None: ++ # check for 1.85 compat header ++ if os.path.exists("%s/db_185.h" % db_incs[0]): ++ bsddb185_define_macros=[('HAVE_DB_185_H',1)] ++ else: ++ raise NotFound ++ try: ++ bltransform = os.environ['PY_BDB_TRANSFORM'] ++ m = re.search(r"l:db:(db.)\s*", bltransform) ++ if m is not None and m.group(1) is not None: ++ dblibs = [m.group(1)] ++ except: ++ pass ++ ++ # build the bsddb185 extension module ++ exts.append(Extension('bsddb185', ['bsddbmodule.c'], + library_dirs=dblib_dir, + runtime_library_dirs=dblib_dir, include_dirs=db_incs, ++ define_macros=bsddb185_define_macros, libraries=dblibs)) - else: -- db_incs = None -- dblibs = [] +- else: ++ except: + db_incs = None + dblibs = [] - dblib_dir = None -+ db_incs =['%%DB185_INCS%%'] -+ dblibs = ['%%DB185_LIBS%%'] -+ dblib_dir = ['%%DB185_LIBDIR%%'] -+ if len(dblibs) > 0 and dblibs[0] == '': -+ dblibs = [] - - - # Look for Berkeley db 1.85. Note that it is built as a different -@@ -573,21 +578,30 @@ class PyBuildExt(build_ext): - # accidentally building this module with a later version of the - # underlying db library. May BSD-ish Unixes incorporate db 1.85 - # symbols into libc and place the include file in /usr/include. +- +- +- # Look for Berkeley db 1.85. Note that it is built as a different +- # module name so it can be included even when later versions are +- # available. A very restrictive search is performed to avoid +- # accidentally building this module with a later version of the +- # underlying db library. May BSD-ish Unixes incorporate db 1.85 +- # symbols into libc and place the include file in /usr/include. - f = "/usr/include/db.h" -+ f = "%%DB185_H%%" - if os.path.exists(f): - data = open(f).read() - m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data) - if m is not None: -+ bsddb185_define_macros = [] -+ if f.split("/")[-1] == "db_185.h": -+ bsddb185_define_macros=[('HAVE_DB_185_H',1)] - # bingo - old version used hash file format version 2 - ### XXX this should be fixed to not be platform-dependent - ### but I don't have direct access to an osf1 platform and - ### seemed to be muffing the search somehow +- if os.path.exists(f): +- data = open(f).read() +- m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data) +- if m is not None: +- # bingo - old version used hash file format version 2 +- ### XXX this should be fixed to not be platform-dependent +- ### but I don't have direct access to an osf1 platform and +- ### seemed to be muffing the search somehow - libraries = platform == "osf1" and ['db'] or None -+ #libraries = platform == "osf1" and ['db'] or None -+ libraries = dblibs - if libraries is not None: - exts.append(Extension('bsddb185', ['bsddbmodule.c'], -+ library_dirs=dblib_dir, -+ runtime_library_dirs=dblib_dir, -+ include_dirs=db_incs, -+ define_macros=bsddb185_define_macros, - libraries=libraries)) - else: +- if libraries is not None: +- exts.append(Extension('bsddb185', ['bsddbmodule.c'], +- libraries=libraries)) +- else: - exts.append(Extension('bsddb185', ['bsddbmodule.c'])) -+ exts.append(Extension('bsddb185', ['bsddbmodule.c'], -+ define_macros=bsddb185_define_macros)) - +- ++ dblib_dir = None ++ # The standard Unix dbm module: if platform not in ['cygwin']: -@@ -770,7 +784,7 @@ class PyBuildExt(build_ext): + if find_file("ndbm.h", inc_dirs, []) is not None: +@@ -600,6 +648,13 @@ class PyBuildExt(build_ext): + exts.append( Extension('dbm', ['dbmmodule.c'], + define_macros=[('HAVE_NDBM_H',None)], + libraries = ndbm_libs ) ) ++ elif find_file("ndbm.h", db_incs, []) is not None: ++ exts.append( Extension('dbm', ['dbmmodule.c'], ++ library_dirs=dblib_dir, ++ runtime_library_dirs=dblib_dir, ++ include_dirs=db_incs, ++ define_macros=[('HAVE_NDBM_H',None)], ++ libraries=dblibs)) + elif (self.compiler.find_library_file(lib_dirs, 'gdbm') + and find_file("gdbm/ndbm.h", inc_dirs, []) is not None): + exts.append( Extension('dbm', ['dbmmodule.c'], +@@ -770,7 +825,7 @@ class PyBuildExt(build_ext): # Linux-specific modules exts.append( Extension('linuxaudiodev', ['linuxaudiodev.c']) ) @@ -118,7 +339,7 @@ $NetBSD: patch-am,v 1.4 2004/03/22 06:33:58 minskim Exp $ exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) ) if platform == 'sunos5': -@@ -1140,7 +1154,7 @@ def main(): +@@ -1140,7 +1195,7 @@ def main(): ext_modules=[Extension('struct', ['structmodule.c'])], # Scripts to install |