Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 268887 | Differences between
and this patch

Collapse All | Expand All

(-)setup.py (-50 / +66 lines)
Lines 263-271 Link Here
263
263
264
    def detect_modules(self):
264
    def detect_modules(self):
265
        global disable_ssl
265
        global disable_ssl
266
267
	# We must respect the user specified sysroot!
268
	sysroot=os.getenv('SYSROOT')
269
	if sysroot is None:
270
		sysroot=''
271
	
266
        # Ensure that /usr/local is always used
272
        # Ensure that /usr/local is always used
267
        add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
273
        add_dir_to_list(self.compiler.library_dirs, sysroot+'/usr/local/lib')
268
        add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
274
        add_dir_to_list(self.compiler.include_dirs, sysroot+'/usr/local/include')
269
275
270
        # Add paths specified in the environment variables LDFLAGS and
276
        # Add paths specified in the environment variables LDFLAGS and
271
        # CPPFLAGS for header and library files.
277
        # CPPFLAGS for header and library files.
Lines 300-311 Link Here
300
                    for directory in reversed(options.dirs):
306
                    for directory in reversed(options.dirs):
301
                        add_dir_to_list(dir_list, directory)
307
                        add_dir_to_list(dir_list, directory)
302
308
303
        if os.path.normpath(sys.prefix) != '/usr':
309
        if os.path.normpath(sys.prefix) != '/usr/local':
304
            add_dir_to_list(self.compiler.library_dirs,
310
            add_dir_to_list(self.compiler.library_dirs,
305
                            sysconfig.get_config_var("LIBDIR"))
311
                            sysconfig.get_config_var("LIBDIR"))
306
            add_dir_to_list(self.compiler.include_dirs,
312
            add_dir_to_list(self.compiler.include_dirs,
307
                            sysconfig.get_config_var("INCLUDEDIR"))
313
                            sysconfig.get_config_var("INCLUDEDIR"))
308
314
315
	# We should always look into sysroot/usr/include and consider
316
	# also the lib dirs there for searching for files
317
	add_dir_to_list(self.compiler.include_dirs, sysroot+'/usr/include')
318
	add_dir_to_list(self.compiler.library_dirs, sysroot+'/lib')
319
	add_dir_to_list(self.compiler.library_dirs, sysroot+'/lib64')
320
	add_dir_to_list(self.compiler.library_dirs, sysroot+'/usr/lib')
321
	add_dir_to_list(self.compiler.library_dirs, sysroot+'/usr/lib64')
322
309
        try:
323
        try:
310
            have_unicode = unicode
324
            have_unicode = unicode
311
        except NameError:
325
        except NameError:
Lines 314-324 Link Here
314
        # lib_dirs and inc_dirs are used to search for files;
328
        # lib_dirs and inc_dirs are used to search for files;
315
        # if a file is found in one of those directories, it can
329
        # if a file is found in one of those directories, it can
316
        # be assumed that no additional -I,-L directives are needed.
330
        # be assumed that no additional -I,-L directives are needed.
317
        lib_dirs = self.compiler.library_dirs + [
331
        lib_dirs = self.compiler.library_dirs
318
            '/lib64', '/usr/lib64',
332
        inc_dirs = self.compiler.include_dirs
319
            '/lib', '/usr/lib',
320
            ]
321
        inc_dirs = self.compiler.include_dirs + ['/usr/include']
322
        exts = []
333
        exts = []
323
334
324
        config_h = sysconfig.get_config_h_filename()
335
        config_h = sysconfig.get_config_h_filename()
Lines 518-528 Link Here
518
            elif self.compiler.find_library_file(lib_dirs, 'curses'):
529
            elif self.compiler.find_library_file(lib_dirs, 'curses'):
519
                readline_libs.append('curses')
530
                readline_libs.append('curses')
520
            elif self.compiler.find_library_file(lib_dirs +
531
            elif self.compiler.find_library_file(lib_dirs +
521
                                               ['/usr/@@GENTOO_LIBDIR@@/termcap'],
532
                                               [sysroot+'/usr/@@GENTOO_LIBDIR@@/termcap'],
522
                                               'termcap'):
533
                                               'termcap'):
523
                readline_libs.append('termcap')
534
                readline_libs.append('termcap')
524
            exts.append( Extension('readline', ['readline.c'],
535
            exts.append( Extension('readline', ['readline.c'],
525
                                   library_dirs=['/usr/@@GENTOO_LIBDIR@@/termcap'],
536
                                   library_dirs=[sysroot+'/usr/@@GENTOO_LIBDIR@@/termcap'],
526
                                   extra_link_args=readline_extra_link_args,
537
                                   extra_link_args=readline_extra_link_args,
527
                                   libraries=readline_libs) )
538
                                   libraries=readline_libs) )
528
        if platform not in ['mac']:
539
        if platform not in ['mac']:
Lines 542-561 Link Here
542
                               depends = ['socketmodule.h']) )
553
                               depends = ['socketmodule.h']) )
543
        # Detect SSL support for the socket module (via _ssl)
554
        # Detect SSL support for the socket module (via _ssl)
544
        search_for_ssl_incs_in = [
555
        search_for_ssl_incs_in = [
545
                              '/usr/local/ssl/include',
556
                              sysroot+'/usr/local/ssl/include',
546
                              '/usr/contrib/ssl/include/'
557
                              sysroot+'/usr/contrib/ssl/include/'
547
                             ]
558
                             ]
548
        ssl_incs = find_file('openssl/ssl.h', inc_dirs,
559
        ssl_incs = find_file('openssl/ssl.h', inc_dirs,
549
                             search_for_ssl_incs_in
560
                             search_for_ssl_incs_in
550
                             )
561
                             )
551
        if ssl_incs is not None:
562
        if ssl_incs is not None:
552
            krb5_h = find_file('krb5.h', inc_dirs,
563
            krb5_h = find_file('krb5.h', inc_dirs,
553
                               ['/usr/kerberos/include'])
564
                               [sysroot+'/usr/kerberos/include'])
554
            if krb5_h:
565
            if krb5_h:
555
                ssl_incs += krb5_h
566
                ssl_incs += krb5_h
556
        ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
567
        ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
557
                                     ['/usr/local/ssl/lib',
568
                                     [sysroot+'/usr/local/ssl/lib',
558
                                      '/usr/contrib/ssl/lib/'
569
                                      sysroot+'/usr/contrib/ssl/lib/'
559
                                     ] )
570
                                     ] )
560
571
561
        if (ssl_incs is not None and
572
        if (ssl_incs is not None and
Lines 641-668 Link Here
641
        # construct a list of paths to look for the header file in on
652
        # construct a list of paths to look for the header file in on
642
        # top of the normal inc_dirs.
653
        # top of the normal inc_dirs.
643
        db_inc_paths = [
654
        db_inc_paths = [
644
            '/usr/include/db4.3',
655
            sysroot+'/usr/include/db4.3',
645
            '/usr/include/db4.2',
656
            sysroot+'/usr/include/db4.2',
646
            '/usr/include/db4.1',
657
            sysroot+'/usr/include/db4.1',
647
            '/usr/include/db4',
658
            sysroot+'/usr/include/db4',
648
            '/usr/include/db3.2',
659
            sysroot+'/usr/include/db3.2',
649
            '/usr/include/db3'
660
            sysroot+'/usr/include/db3'
650
        ]
661
        ]
651
        # 4.x minor number specific paths
662
        # 4.x minor number specific paths
652
        for x in range(max_db_ver[1]+1):
663
        for x in range(max_db_ver[1]+1):
653
            db_inc_paths.append('/usr/include/db4%d' % x)
664
            db_inc_paths.append(sysroot+'/usr/include/db4%d' % x)
654
            db_inc_paths.append('/usr/include/db4.%d' % x)
665
            db_inc_paths.append(sysroot+'/usr/include/db4.%d' % x)
655
            db_inc_paths.append('/usr/local/BerkeleyDB.4.%d/include' % x)
666
            db_inc_paths.append(sysroot+'/usr/local/BerkeleyDB.4.%d/include' % x)
656
            db_inc_paths.append('/usr/local/include/db4%d' % x)
667
            db_inc_paths.append(sysroot+'/usr/local/include/db4%d' % x)
657
            db_inc_paths.append('/pkg/db-4.%d/include' % x)
668
            db_inc_paths.append(sysroot+'/pkg/db-4.%d/include' % x)
658
            db_inc_paths.append('/opt/db-4.%d/include' % x)
669
            db_inc_paths.append(sysroot+'/opt/db-4.%d/include' % x)
659
        # 3.x minor number specific paths
670
        # 3.x minor number specific paths
660
        for x in (3,):
671
        for x in (3,):
661
            db_inc_paths.append('/usr/include/db3%d' % x)
672
            db_inc_paths.append(sysroot+'/usr/include/db3%d' % x)
662
            db_inc_paths.append('/usr/local/BerkeleyDB.3.%d/include' % x)
673
            db_inc_paths.append(sysroot+'/usr/local/BerkeleyDB.3.%d/include' % x)
663
            db_inc_paths.append('/usr/local/include/db3%d' % x)
674
            db_inc_paths.append(sysroot+'/usr/local/include/db3%d' % x)
664
            db_inc_paths.append('/pkg/db-3.%d/include' % x)
675
            db_inc_paths.append(sysroot+'/pkg/db-3.%d/include' % x)
665
            db_inc_paths.append('/opt/db-3.%d/include' % x)
676
            db_inc_paths.append(sysroot+'/opt/db-3.%d/include' % x)
666
677
667
        # Add some common subdirectories for Sleepycat DB to the list,
678
        # Add some common subdirectories for Sleepycat DB to the list,
668
        # based on the standard include directories. This way DB3/4 gets
679
        # based on the standard include directories. This way DB3/4 gets
Lines 781-792 Link Here
781
        # We hunt for #define SQLITE_VERSION "n.n.n"
792
        # We hunt for #define SQLITE_VERSION "n.n.n"
782
        # We need to find >= sqlite version 3.0.8
793
        # We need to find >= sqlite version 3.0.8
783
        sqlite_incdir = sqlite_libdir = None
794
        sqlite_incdir = sqlite_libdir = None
784
        sqlite_inc_paths = [ '/usr/include',
795
        sqlite_inc_paths = [ sysroot+'/usr/include',
785
                             '/usr/include/sqlite',
796
                             sysroot+'/usr/include/sqlite',
786
                             '/usr/include/sqlite3',
797
                             sysroot+'/usr/include/sqlite3',
787
                             '/usr/local/include',
798
                             sysroot+'/usr/local/include',
788
                             '/usr/local/include/sqlite',
799
                             sysroot+'/usr/local/include/sqlite',
789
                             '/usr/local/include/sqlite3',
800
                             sysroot+'/usr/local/include/sqlite3',
790
                           ]
801
                           ]
791
        MIN_SQLITE_VERSION_NUMBER = (3, 0, 8)
802
        MIN_SQLITE_VERSION_NUMBER = (3, 0, 8)
792
        MIN_SQLITE_VERSION = ".".join([str(x)
803
        MIN_SQLITE_VERSION = ".".join([str(x)
Lines 877-883 Link Here
877
        # we do not build this one.  Otherwise this build will pick up
888
        # we do not build this one.  Otherwise this build will pick up
878
        # the more recent berkeleydb's db.h file first in the include path
889
        # the more recent berkeleydb's db.h file first in the include path
879
        # when attempting to compile and it will fail.
890
        # when attempting to compile and it will fail.
880
        f = "/usr/include/db.h"
891
        f = sysroot+"/usr/include/db.h"
881
        if os.path.exists(f) and not db_incs:
892
        if os.path.exists(f) and not db_incs:
882
            data = open(f).read()
893
            data = open(f).read()
883
            m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data)
894
            m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data)
Lines 1038-1044 Link Here
1038
        # More information on Expat can be found at www.libexpat.org.
1049
        # More information on Expat can be found at www.libexpat.org.
1039
        #
1050
        #
1040
        # Use system expat
1051
        # Use system expat
1041
        expatinc = '/usr/include'
1052
        expatinc = sysroot+'/usr/include'
1042
        define_macros = []
1053
        define_macros = []
1043
1054
1044
        exts.append(Extension('pyexpat',
1055
        exts.append(Extension('pyexpat',
Lines 1219-1225 Link Here
1219
        # For 8.4a2, the X11 headers are not included. Rather than include a
1230
        # For 8.4a2, the X11 headers are not included. Rather than include a
1220
        # complicated search, this is a hard-coded path. It could bail out
1231
        # complicated search, this is a hard-coded path. It could bail out
1221
        # if X11 libs are not found...
1232
        # if X11 libs are not found...
1222
        include_dirs.append('/usr/X11R6/include')
1233
        include_dirs.append(sysroot+'/usr/X11R6/include')
1223
        frameworks = ['-framework', 'Tcl', '-framework', 'Tk']
1234
        frameworks = ['-framework', 'Tcl', '-framework', 'Tk']
1224
1235
1225
        ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
1236
        ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
Lines 1236-1241 Link Here
1236
    def detect_tkinter(self, inc_dirs, lib_dirs):
1247
    def detect_tkinter(self, inc_dirs, lib_dirs):
1237
        # The _tkinter module.
1248
        # The _tkinter module.
1238
1249
1250
	# We must respect the user specified sysroot!
1251
	sysroot=os.getenv('SYSROOT')
1252
	if sysroot is None:
1253
		sysroot=''
1254
	
1239
        # Rather than complicate the code below, detecting and building
1255
        # Rather than complicate the code below, detecting and building
1240
        # AquaTk is a separate method. Only one Tkinter will be built on
1256
        # AquaTk is a separate method. Only one Tkinter will be built on
1241
        # Darwin - either AquaTk, if it is found, or X11 based Tk.
1257
        # Darwin - either AquaTk, if it is found, or X11 based Tk.
Lines 1290-1306 Link Here
1290
        if platform == 'sunos5':
1306
        if platform == 'sunos5':
1291
            include_dirs.append('/usr/openwin/include')
1307
            include_dirs.append('/usr/openwin/include')
1292
            added_lib_dirs.append('/usr/openwin/lib')
1308
            added_lib_dirs.append('/usr/openwin/lib')
1293
        elif os.path.exists('/usr/X11R6/include'):
1309
        elif os.path.exists(sysroot+'/usr/X11R6/include'):
1294
            include_dirs.append('/usr/X11R6/include')
1310
            include_dirs.append(sysroot+'/usr/X11R6/include')
1295
            added_lib_dirs.append('/usr/X11R6/lib64')
1311
            added_lib_dirs.append(sysroot+'/usr/X11R6/lib64')
1296
            added_lib_dirs.append('/usr/X11R6/lib')
1312
            added_lib_dirs.append(sysroot+'/usr/X11R6/lib')
1297
        elif os.path.exists('/usr/X11R5/include'):
1313
        elif os.path.exists(sysroot+'/usr/X11R5/include'):
1298
            include_dirs.append('/usr/X11R5/include')
1314
            include_dirs.append(sysroot+'/usr/X11R5/include')
1299
            added_lib_dirs.append('/usr/X11R5/lib')
1315
            added_lib_dirs.append(sysroot+'/usr/X11R5/lib')
1300
        else:
1316
        else:
1301
            # Assume default location for X11
1317
            # Assume default location for X11
1302
            include_dirs.append('/usr/X11/include')
1318
            include_dirs.append(sysroot+'/usr/X11/include')
1303
            added_lib_dirs.append('/usr/X11/lib')
1319
            added_lib_dirs.append(sysroot+'/usr/X11/lib')
1304
1320
1305
        # If Cygwin, then verify that X is installed before proceeding
1321
        # If Cygwin, then verify that X is installed before proceeding
1306
        if platform == 'cygwin':
1322
        if platform == 'cygwin':

Return to bug 268887