pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/lang Rework bdb detection: Since we're using buildlink...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/291268f4c673
branches:  trunk
changeset: 472901:291268f4c673
user:      recht <recht%pkgsrc.org@localhost>
date:      Tue Apr 13 22:48:41 2004 +0000

description:
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:

 lang/python23-pth/Makefile         |    4 +-
 lang/python23-pth/distinfo         |    4 +-
 lang/python23-pth/patches/patch-am |  323 +++++++++++++++++++++++++++++++-----
 lang/python23/Makefile.common      |   50 +---
 lang/python23/distinfo             |    4 +-
 lang/python23/patches/patch-am     |  323 +++++++++++++++++++++++++++++++-----
 6 files changed, 567 insertions(+), 141 deletions(-)

diffs (truncated from 832 to 300 lines):

diff -r b6948868a4d2 -r 291268f4c673 lang/python23-pth/Makefile
--- a/lang/python23-pth/Makefile        Tue Apr 13 22:04:15 2004 +0000
+++ b/lang/python23-pth/Makefile        Tue Apr 13 22:48:41 2004 +0000
@@ -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 -r b6948868a4d2 -r 291268f4c673 lang/python23-pth/distinfo
--- a/lang/python23-pth/distinfo        Tue Apr 13 22:04:15 2004 +0000
+++ b/lang/python23-pth/distinfo        Tue Apr 13 22:48:41 2004 +0000
@@ -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-af) = 2989a1975c8ea435903eafc9add57cb7c4d7de14
 SHA1 (patch-ah) = 4bc95e775a2b3f4f1997d0779c561db2e9e7b575
 SHA1 (patch-al) = 2dfed1a40493b571e3477cfb56c2d0ed1b1deddf
-SHA1 (patch-am) = 74e8d87ecd4cb17634e992a985393c72193b2892
+SHA1 (patch-am) = eda4c6161b4237e1281cc6b82b26c5195444dcff
 SHA1 (patch-ba) = dd8f89952d7f40c9a979e362758775f093e047bc
diff -r b6948868a4d2 -r 291268f4c673 lang/python23-pth/patches/patch-am
--- a/lang/python23-pth/patches/patch-am        Tue Apr 13 22:04:15 2004 +0000
+++ b/lang/python23-pth/patches/patch-am        Tue Apr 13 22:48:41 2004 +0000
@@ -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 @@
  
          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



Home | Main Index | Thread Index | Old Index