Lines 372-380
Link Here
|
372 |
|
372 |
|
373 |
def detect_modules(self): |
373 |
def detect_modules(self): |
374 |
global disable_ssl |
374 |
global disable_ssl |
|
|
375 |
|
376 |
# We must respect the user specified sysroot! |
377 |
sysroot=os.getenv('PYTHON_SYSROOT') |
378 |
if sysroot is None: |
379 |
sysroot='' |
380 |
|
375 |
# Ensure that /usr/local is always used |
381 |
# Ensure that /usr/local is always used |
376 |
add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') |
382 |
add_dir_to_list(self.compiler.library_dirs, sysroot+'/usr/local/lib') |
377 |
add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') |
383 |
add_dir_to_list(self.compiler.include_dirs, sysroot+'/usr/local/include') |
378 |
|
384 |
|
379 |
# Add paths specified in the environment variables LDFLAGS and |
385 |
# Add paths specified in the environment variables LDFLAGS and |
380 |
# CPPFLAGS for header and library files. |
386 |
# CPPFLAGS for header and library files. |
Lines 410-421
Link Here
|
410 |
for directory in reversed(options.dirs): |
416 |
for directory in reversed(options.dirs): |
411 |
add_dir_to_list(dir_list, directory) |
417 |
add_dir_to_list(dir_list, directory) |
412 |
|
418 |
|
413 |
if os.path.normpath(sys.prefix) != '/usr': |
419 |
if os.path.normpath(sys.prefix) != '/usr' and sysroot == '': |
414 |
add_dir_to_list(self.compiler.library_dirs, |
420 |
add_dir_to_list(self.compiler.library_dirs, |
415 |
sysconfig.get_config_var("LIBDIR")) |
421 |
sysconfig.get_config_var("LIBDIR")) |
416 |
add_dir_to_list(self.compiler.include_dirs, |
422 |
add_dir_to_list(self.compiler.include_dirs, |
417 |
sysconfig.get_config_var("INCLUDEDIR")) |
423 |
sysconfig.get_config_var("INCLUDEDIR")) |
418 |
|
424 |
|
|
|
425 |
# We should always look into sysroot/usr/include and consider |
426 |
# also the lib dirs there for searching for files |
427 |
add_dir_to_list(self.compiler.include_dirs, sysroot+'/usr/include') |
428 |
add_dir_to_list(self.compiler.library_dirs, sysroot+'/lib') |
429 |
add_dir_to_list(self.compiler.library_dirs, sysroot+'/lib64') |
430 |
add_dir_to_list(self.compiler.library_dirs, sysroot+'/usr/lib') |
431 |
add_dir_to_list(self.compiler.library_dirs, sysroot+'/usr/lib64') |
432 |
|
419 |
try: |
433 |
try: |
420 |
have_unicode = unicode |
434 |
have_unicode = unicode |
421 |
except NameError: |
435 |
except NameError: |
Lines 424-434
Link Here
|
424 |
# lib_dirs and inc_dirs are used to search for files; |
438 |
# lib_dirs and inc_dirs are used to search for files; |
425 |
# if a file is found in one of those directories, it can |
439 |
# if a file is found in one of those directories, it can |
426 |
# be assumed that no additional -I,-L directives are needed. |
440 |
# be assumed that no additional -I,-L directives are needed. |
427 |
lib_dirs = self.compiler.library_dirs + [ |
441 |
lib_dirs = self.compiler.library_dirs |
428 |
'/lib64', '/usr/lib64', |
442 |
inc_dirs = self.compiler.include_dirs |
429 |
'/lib', '/usr/lib', |
|
|
430 |
] |
431 |
inc_dirs = self.compiler.include_dirs + ['/usr/include'] |
432 |
exts = [] |
443 |
exts = [] |
433 |
missing = [] |
444 |
missing = [] |
434 |
|
445 |
|
Lines 677-687
Link Here
|
677 |
elif curses_library: |
688 |
elif curses_library: |
678 |
readline_libs.append(curses_library) |
689 |
readline_libs.append(curses_library) |
679 |
elif self.compiler.find_library_file(lib_dirs + |
690 |
elif self.compiler.find_library_file(lib_dirs + |
680 |
['/usr/@@GENTOO_LIBDIR@@/termcap'], |
691 |
[sysroot+'/usr/@@GENTOO_LIBDIR@@/termcap'], |
681 |
'termcap'): |
692 |
'termcap'): |
682 |
readline_libs.append('termcap') |
693 |
readline_libs.append('termcap') |
683 |
exts.append( Extension('readline', ['readline.c'], |
694 |
exts.append( Extension('readline', ['readline.c'], |
684 |
library_dirs=['/usr/@@GENTOO_LIBDIR@@/termcap'], |
695 |
library_dirs=[sysroot+'/usr/@@GENTOO_LIBDIR@@/termcap'], |
685 |
extra_link_args=readline_extra_link_args, |
696 |
extra_link_args=readline_extra_link_args, |
686 |
libraries=readline_libs) ) |
697 |
libraries=readline_libs) ) |
687 |
else: |
698 |
else: |
Lines 706-725
Link Here
|
706 |
depends = ['socketmodule.h']) ) |
717 |
depends = ['socketmodule.h']) ) |
707 |
# Detect SSL support for the socket module (via _ssl) |
718 |
# Detect SSL support for the socket module (via _ssl) |
708 |
search_for_ssl_incs_in = [ |
719 |
search_for_ssl_incs_in = [ |
709 |
'/usr/local/ssl/include', |
720 |
sysroot+'/usr/local/ssl/include', |
710 |
'/usr/contrib/ssl/include/' |
721 |
sysroot+'/usr/contrib/ssl/include/' |
711 |
] |
722 |
] |
712 |
ssl_incs = find_file('openssl/ssl.h', inc_dirs, |
723 |
ssl_incs = find_file('openssl/ssl.h', inc_dirs, |
713 |
search_for_ssl_incs_in |
724 |
search_for_ssl_incs_in |
714 |
) |
725 |
) |
715 |
if ssl_incs is not None and not disable_ssl: |
726 |
if ssl_incs is not None and not disable_ssl: |
716 |
krb5_h = find_file('krb5.h', inc_dirs, |
727 |
krb5_h = find_file('krb5.h', inc_dirs, |
717 |
['/usr/kerberos/include']) |
728 |
[sysroot+'/usr/kerberos/include']) |
718 |
if krb5_h: |
729 |
if krb5_h: |
719 |
ssl_incs += krb5_h |
730 |
ssl_incs += krb5_h |
720 |
ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs, |
731 |
ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs, |
721 |
['/usr/local/ssl/lib', |
732 |
[sysroot+'/usr/local/ssl/lib', |
722 |
'/usr/contrib/ssl/lib/' |
733 |
sysroot+'/usr/contrib/ssl/lib/' |
723 |
] ) |
734 |
] ) |
724 |
|
735 |
|
725 |
if (ssl_incs is not None and |
736 |
if (ssl_incs is not None and |
Lines 837-869
Link Here
|
837 |
# construct a list of paths to look for the header file in on |
848 |
# construct a list of paths to look for the header file in on |
838 |
# top of the normal inc_dirs. |
849 |
# top of the normal inc_dirs. |
839 |
db_inc_paths = [ |
850 |
db_inc_paths = [ |
840 |
'/usr/include/db4', |
851 |
sysroot+'/usr/include/db4', |
841 |
'/usr/local/include/db4', |
852 |
sysroot+'/usr/local/include/db4', |
842 |
'/opt/sfw/include/db4', |
853 |
sysroot+'/opt/sfw/include/db4', |
843 |
'/usr/include/db3', |
854 |
sysroot+'/usr/include/db3', |
844 |
'/usr/local/include/db3', |
855 |
sysroot+'/usr/local/include/db3', |
845 |
'/opt/sfw/include/db3', |
856 |
sysroot+'/opt/sfw/include/db3', |
846 |
# Fink defaults (http://fink.sourceforge.net/) |
857 |
# Fink defaults (http://fink.sourceforge.net/) |
847 |
'/sw/include/db4', |
858 |
sysroot+'/sw/include/db4', |
848 |
'/sw/include/db3', |
859 |
sysroot+'/sw/include/db3', |
849 |
] |
860 |
] |
850 |
# 4.x minor number specific paths |
861 |
# 4.x minor number specific paths |
851 |
for x in gen_db_minor_ver_nums(4): |
862 |
for x in gen_db_minor_ver_nums(4): |
852 |
db_inc_paths.append('/usr/include/db4%d' % x) |
863 |
db_inc_paths.append(sysroot+'/usr/include/db4%d' % x) |
853 |
db_inc_paths.append('/usr/include/db4.%d' % x) |
864 |
db_inc_paths.append(sysroot+'/usr/include/db4.%d' % x) |
854 |
db_inc_paths.append('/usr/local/BerkeleyDB.4.%d/include' % x) |
865 |
db_inc_paths.append(sysroot+'/usr/local/BerkeleyDB.4.%d/include' % x) |
855 |
db_inc_paths.append('/usr/local/include/db4%d' % x) |
866 |
db_inc_paths.append(sysroot+'/usr/local/include/db4%d' % x) |
856 |
db_inc_paths.append('/pkg/db-4.%d/include' % x) |
867 |
db_inc_paths.append(sysroot+'/pkg/db-4.%d/include' % x) |
857 |
db_inc_paths.append('/opt/db-4.%d/include' % x) |
868 |
db_inc_paths.append(sysroot+'/opt/db-4.%d/include' % x) |
858 |
# MacPorts default (http://www.macports.org/) |
869 |
# MacPorts default (http://www.macports.org/) |
859 |
db_inc_paths.append('/opt/local/include/db4%d' % x) |
870 |
db_inc_paths.append('/opt/local/include/db4%d' % x) |
860 |
# 3.x minor number specific paths |
871 |
# 3.x minor number specific paths |
861 |
for x in gen_db_minor_ver_nums(3): |
872 |
for x in gen_db_minor_ver_nums(3): |
862 |
db_inc_paths.append('/usr/include/db3%d' % x) |
873 |
db_inc_paths.append(sysroot+'/usr/include/db3%d' % x) |
863 |
db_inc_paths.append('/usr/local/BerkeleyDB.3.%d/include' % x) |
874 |
db_inc_paths.append(sysroot+'/usr/local/BerkeleyDB.3.%d/include' % x) |
864 |
db_inc_paths.append('/usr/local/include/db3%d' % x) |
875 |
db_inc_paths.append(sysroot+'/usr/local/include/db3%d' % x) |
865 |
db_inc_paths.append('/pkg/db-3.%d/include' % x) |
876 |
db_inc_paths.append(sysroot+'/pkg/db-3.%d/include' % x) |
866 |
db_inc_paths.append('/opt/db-3.%d/include' % x) |
877 |
db_inc_paths.append(sysroot+'/opt/db-3.%d/include' % x) |
867 |
|
878 |
|
868 |
# Add some common subdirectories for Sleepycat DB to the list, |
879 |
# Add some common subdirectories for Sleepycat DB to the list, |
869 |
# based on the standard include directories. This way DB3/4 gets |
880 |
# based on the standard include directories. This way DB3/4 gets |