diff options
author | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2010-12-26 10:28:49 +0100 |
---|---|---|
committer | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2011-01-25 08:59:57 +0100 |
commit | e3418f69cf2f17d54dfb521adedbe8abf6e35927 (patch) | |
tree | aa465725122a3ac95ba4656e31cfd129b8bb0609 /package/python/python-2.7-004-no-host-headers-libs.patch | |
parent | b06e7ac4e135a01ddb8914c779dff2bda25e00b1 (diff) |
python: convert to autotargets, bump to 2.7.1, many improvements
This commit does a number of changes and improvements to the Python
interpreter package :
* It converts the .mk file to the AUTOTARGETS infrastructure. Even
though Python uses only autoconf and not automake, the AUTOTARGETS
is a fairly good fit for the Python interpreter, so we make use of
it.
* It bumps the version to 2.7.1. As this is a minor release compared
to 2.7, there are no particular changes needed because of this
bump. All changes done to the package are cleanups and improvements
unrelated to the version bump.
* It uses the system libffi. Until now, Python was building its own
libffi (a library used by interprets to build code that makes
function call at runtime). Using the Python internal libffi was not
working as Python was not passing the appropriate arguments down to
libffi ./configure script. And it sounded better to use a
system-wide libffi, that could potentially be used by other
packages as well. This libffi is needed for the ctypes Python
module.
* Remove all "depends on BR2_PACKAGE_PYTHON" by moving all
Python-related options under a "if BR2_PACKAGE_PYTHON ... endif"
condition.
* Make the installation of pre-compiled Python modules (.pyc) the
default, since they are smaller and do not need to be compiled on
the target. It is still possible to install uncompiled modules, or
both the uncompiled and pre-compiled versions.
* The options to select the set of Python modules to compile has been
moved to a submenu.
* The codecscjk (Japanese, Korean and Chinese codecs) module is no
longer enabled by default.
* The commented options for gdbm and nis in Python have been
removed. Those were not supported, so let's get rid of unused code.
* The option for the tkinker module in Python has been removed, since
we don't have a package for Tk in Buildroot.
* Options for the bzip2, sqlite and zlib modules have been added,
since those modules have external dependencies.
* The set of patches has been completely reworked and extended, with
more fine-grained patches and newer functionalities. The patches
are split in two categories:
- Patches that make various modifications to the Python build
system to support cross-compilation or make some minor
modifications. Those patches are numbered from 0 to 100.
- Patches that add configuration options to the Python build
system in order to enable/disable the compilation of Python
extensions or modules (test modules, pydoc, lib2to3, sqlite, tk,
curses, expat, codecs-cjk, nis, unicodedata, database modules,
ssl, bzip2, zlib). These patches are numbered from 100 to 200.
All features of the previous four patches are preserved, but they
are organized differently and the patches have been renamed. This
makes it difficult to see the differences from the existing
patches.
* The host Python interpreter is now installed in $(HOST_DIR), since
it is used to build third party Python modules.
* The BR2_PACKAGE_PYTHON_DEV option is removed since
BR2_HAVE_DEVFILES already does the necessary work.
* The "make -i install" workaround introduced by Maxime Ripard is no
longer needed. It was caused by the compilation of the tests that
required the unicodedata module (which wasn't built in the host
Python interpreter). Since we no longer compile the Python tests,
the problem doesn't exist anymore and we can avoid this "-i"
option.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'package/python/python-2.7-004-no-host-headers-libs.patch')
-rw-r--r-- | package/python/python-2.7-004-no-host-headers-libs.patch | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/package/python/python-2.7-004-no-host-headers-libs.patch b/package/python/python-2.7-004-no-host-headers-libs.patch new file mode 100644 index 000000000..033776d46 --- /dev/null +++ b/package/python/python-2.7-004-no-host-headers-libs.patch @@ -0,0 +1,97 @@ +Do not look at host headers/libraries in cross-compile mode + +When we are cross-compiling, setup.py should never look in /usr or +/usr/local to find headers or libraries. A later patch adds a +mechanism to tell setup.py to look in a specific directory for headers +and libraries. + +Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> +--- + setup.py | 39 +++++++++++++++++++++------------------ + 1 file changed, 21 insertions(+), 18 deletions(-) + +Index: Python-2.7.1/setup.py +=================================================================== +--- Python-2.7.1.orig/setup.py ++++ Python-2.7.1/setup.py +@@ -351,8 +351,9 @@ + + def detect_modules(self): + # Ensure that /usr/local is always used +- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') +- add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') ++ if os.environ.get('CROSS_COMPILING') != 'yes': ++ add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') ++ add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') + + # Add paths specified in the environment variables LDFLAGS and + # CPPFLAGS for header and library files. +@@ -388,17 +389,6 @@ + for directory in reversed(options.dirs): + add_dir_to_list(dir_list, directory) + +- if os.path.normpath(sys.prefix) != '/usr' \ +- and not sysconfig.get_config_var('PYTHONFRAMEWORK'): +- # OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework +- # (PYTHONFRAMEWORK is set) to avoid # linking problems when +- # building a framework with different architectures than +- # the one that is currently installed (issue #7473) +- add_dir_to_list(self.compiler.library_dirs, +- sysconfig.get_config_var("LIBDIR")) +- add_dir_to_list(self.compiler.include_dirs, +- sysconfig.get_config_var("INCLUDEDIR")) +- + try: + have_unicode = unicode + except NameError: +@@ -407,11 +397,16 @@ + # lib_dirs and inc_dirs are used to search for files; + # if a file is found in one of those directories, it can + # be assumed that no additional -I,-L directives are needed. +- lib_dirs = self.compiler.library_dirs + [ +- '/lib64', '/usr/lib64', +- '/lib', '/usr/lib', +- ] +- inc_dirs = self.compiler.include_dirs + ['/usr/include'] ++ lib_dirs = self.compiler.library_dirs ++ inc_dirs = self.compiler.include_dirs ++ ++ if os.environ.get('CROSS_COMPILING') != 'yes': ++ lib_dirs += [ ++ '/lib64', '/usr/lib64', ++ '/lib', '/usr/lib', ++ ] ++ inc_dirs += ['/usr/include'] ++ + exts = [] + missing = [] + +@@ -844,6 +839,9 @@ + db_inc_paths.append('/pkg/db-3.%d/include' % x) + db_inc_paths.append('/opt/db-3.%d/include' % x) + ++ if os.environ.get('CROSS_COMPILING') == 'yes': ++ db_inc_paths = [] ++ + # Add some common subdirectories for Sleepycat DB to the list, + # based on the standard include directories. This way DB3/4 gets + # picked up when it is installed in a non-standard prefix and +@@ -996,6 +994,9 @@ + MIN_SQLITE_VERSION = ".".join([str(x) + for x in MIN_SQLITE_VERSION_NUMBER]) + ++ if os.environ.get('CROSS_COMPILING') == 'yes': ++ sqlite_inc_paths = [] ++ + # Scan the default include directories before the SQLite specific + # ones. This allows one to override the copy of sqlite on OSX, + # where /usr/include contains an old version of sqlite. +@@ -1095,6 +1096,8 @@ + # the more recent berkeleydb's db.h file first in the include path + # when attempting to compile and it will fail. + f = "/usr/include/db.h" ++ if os.environ.get('CROSS_COMPILING') == 'yes': ++ f = '' + + if sys.platform == 'darwin': + if is_macosx_sdk_path(f): |