Merge branch 'for-2011.02/python-bump' of git://git.busybox.net/~tpetazzoni/git/buildroot

This commit is contained in:
Peter Korsgaard 2011-01-25 16:24:46 +01:00
commit 0eef30440e
42 changed files with 1799 additions and 403 deletions

View File

@ -437,6 +437,12 @@ ifneq ($(BR2_HAVE_DOCUMENTATION),y)
rm -rf $(TARGET_DIR)/usr/doc $(TARGET_DIR)/usr/share/doc
rm -rf $(TARGET_DIR)/usr/share/gtk-doc
-rmdir $(TARGET_DIR)/usr/share 2>/dev/null
endif
ifeq ($(BR2_PACKAGE_PYTHON_PY_ONLY),y)
find $(TARGET_DIR)/usr/lib/ -name '*.pyc' -print0 | xargs -0 rm -f
endif
ifeq ($(BR2_PACKAGE_PYTHON_PYC_ONLY),y)
find $(TARGET_DIR)/usr/lib/ -name '*.py' -print0 | xargs -0 rm -f
endif
find $(TARGET_DIR) -type f -perm +111 '!' -name 'libthread_db*.so*' | \
xargs $(STRIPCMD) 2>/dev/null || true

View File

@ -294,6 +294,7 @@ source "package/libraw1394/Config.in"
source "package/tslib/Config.in"
source "package/libusb/Config.in"
source "package/libusb-compat/Config.in"
source "package/python-serial/Config.in"
endmenu
if BROKEN
@ -327,6 +328,7 @@ source "package/libcap/Config.in"
source "package/libdaemon/Config.in"
source "package/libelf/Config.in"
source "package/libevent/Config.in"
source "package/libffi/Config.in"
source "package/libglib2/Config.in"
source "package/liboil/Config.in"
source "package/libsigc/Config.in"

View File

@ -200,7 +200,7 @@ endif
#
ifndef $(2)_INSTALL_CMDS
define $(2)_INSTALL_CMDS
$(HOST_MAKE_ENV) $(MAKE) -C $$($$(PKG)_SRCDIR) install
$(HOST_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) -C $$($$(PKG)_SRCDIR) install
endef
endif

9
package/libffi/Config.in Normal file
View File

@ -0,0 +1,9 @@
config BR2_PACKAGE_LIBFFI
bool "libffi"
help
The libffi library provides a portable, high level
programming interface to various calling conventions. This
allows a programmer to call any function specified by a call
interface description at run-time.
http://sourceware.org/libffi/

33
package/libffi/libffi.mk Normal file
View File

@ -0,0 +1,33 @@
#############################################################
#
# libffi
#
#############################################################
LIBFFI_VERSION = 3.0.9
LIBFFI_SITE = ftp://sources.redhat.com/pub/libffi/
LIBFFI_INSTALL_STAGING = YES
# Move the headers to the usual location, and adjust the .pc file
# accordingly
define LIBFFI_MOVE_STAGING_HEADERS
mv $(STAGING_DIR)/usr/lib/libffi-*/include/*.h $(STAGING_DIR)/usr/include/
sed -i '/^includedir.*/d' $(STAGING_DIR)/usr/lib/pkgconfig/libffi.pc
rm -rf $(TARGET_DIR)/usr/lib/libffi-*
endef
LIBFFI_POST_INSTALL_STAGING_HOOKS += LIBFFI_MOVE_STAGING_HEADERS
# Similar for target headers
define LIBFFI_MOVE_TARGET_HEADERS
install -d $(TARGET_DIR)/usr/include/
mv $(TARGET_DIR)/usr/lib/libffi-*/include/*.h $(TARGET_DIR)/usr/include/
sed -i '/^includedir.*/d' $(TARGET_DIR)/usr/lib/pkgconfig/libffi.pc
rm -rf $(TARGET_DIR)/usr/lib/libffi-*
endef
LIBFFI_POST_INSTALL_TARGET_HOOKS += LIBFFI_MOVE_TARGET_HEADERS
$(eval $(call AUTOTARGETS,package,libffi))

View File

@ -32,6 +32,7 @@ source "package/multimedia/mpd/Config.in"
source "package/multimedia/mpg123/Config.in"
source "package/multimedia/mplayer/Config.in"
source "package/multimedia/musepack/Config.in"
source "package/multimedia/python-mad/Config.in"
source "package/multimedia/speex/Config.in"
source "package/multimedia/swfdec/Config.in"
source "package/multimedia/festival/Config.in"

View File

@ -0,0 +1,9 @@
config BR2_PACKAGE_PYTHON_MAD
bool "python-mad"
depends on BR2_PACKAGE_PYTHON
select BR2_PACKAGE_LIBMAD
help
python-mad is a Python binding for the MAD library, a
high-quality integer-only MPEG decoder.
http://spacepants.org/src/pymad/

View File

@ -0,0 +1,41 @@
#############################################################
#
# python-mad
#
#############################################################
PYTHON_MAD_VERSION = 0.6
PYTHON_MAD_SOURCE = pymad-$(PYTHON_MAD_VERSION).tar.gz
PYTHON_MAD_SITE = http://spacepants.org/src/pymad/download/
PYTHON_MAD_DEPENDENCIES = python libmad
ifeq ($(BR2_ENDIAN),"LITTLE")
PYTHON_MAD_ENDIAN=little
else
PYTHON_MAD_ENDIAN=big
endif
define PYTHON_MAD_CONFIGURE_CMDS
echo "endian = $(PYTHON_MAD_ENDIAN)" > $(@D)/Setup
echo "mad_libs = mad" >> $(@D)/Setup
echo "mad_lib_dir = $(STAGING_DIR)/usr/lib" >> $(@D)/Setup
echo "mad_include_dir = $(STAGING_DIR)/usr/include" >> $(@D)/Setup
endef
define PYTHON_MAD_BUILD_CMDS
(cd $(@D); \
CC="$(TARGET_CC)" \
CFLAGS="$(TARGET_CFLAGS)" \
LDSHARED="$(TARGET_CC) -shared" \
LDFLAGS="$(TARGET_LDFLAGS)" \
$(HOST_DIR)/usr/bin/python setup.py build_ext \
--include-dirs=$(STAGING_DIR)/usr/include/python$(PYTHON_VERSION_MAJOR))
(cd $(@D); $(HOST_DIR)/usr/bin/python setup.py build)
endef
define PYTHON_MAD_INSTALL_TARGET_CMDS
(cd $(@D); $(HOST_DIR)/usr/bin/python setup.py install --prefix=$(TARGET_DIR)/usr)
endef
$(eval $(call GENTARGETS,package,python-mad))

View File

@ -0,0 +1,8 @@
config BR2_PACKAGE_PYTHON_SERIAL
bool "python-serial"
depends on BR2_PACKAGE_PYTHON
help
python-serial is a Python library to access serial ports.
http://pyserial.sf.net

View File

@ -0,0 +1,21 @@
#############################################################
#
# python-serial
#
#############################################################
PYTHON_SERIAL_VERSION = 2.5
PYTHON_SERIAL_SOURCE = pyserial-$(PYTHON_SERIAL_VERSION).tar.gz
PYTHON_SERIAL_SITE = http://pypi.python.org/packages/source/p/pyserial/
PYTHON_SERIAL_DEPENDENCIES = python
define PYTHON_SERIAL_BUILD_CMDS
(cd $(@D); $(HOST_DIR)/usr/bin/python setup.py build)
endef
define PYTHON_SERIAL_INSTALL_TARGET_CMDS
(cd $(@D); $(HOST_DIR)/usr/bin/python setup.py install --prefix=$(TARGET_DIR)/usr)
endef
$(eval $(call GENTARGETS,package,python-serial))

View File

@ -1,6 +1,7 @@
config BR2_PACKAGE_PYTHON
bool "python"
depends on BR2_USE_WCHAR
select BR2_PACKAGE_LIBFFI
help
The python language interpreter.
@ -9,17 +10,11 @@ config BR2_PACKAGE_PYTHON
comment "python requires a toolchain with WCHAR support"
depends on !BR2_USE_WCHAR
config BR2_PACKAGE_PYTHON_DEV
depends on BR2_PACKAGE_PYTHON
bool "development files on target"
help
If enabled, development files (headers and static libpython) will be
installed on the target.
if BR2_PACKAGE_PYTHON
choice
prompt "Module format to install"
depends on BR2_PACKAGE_PYTHON
default BR2_PACKAGE_PYTHON_PY_ONLY
prompt "python module format to install"
default BR2_PACKAGE_PYTHON_PYC_ONLY
help
Select Python module format to install on target (py, pyc or both)
@ -34,51 +29,40 @@ config BR2_PACKAGE_PYTHON_PY_PYC
endchoice
menu "core python modules"
comment "The following modules are unusual or require extra libraries"
depends on BR2_PACKAGE_PYTHON
config BR2_PACKAGE_PYTHON_BZIP2
select BR2_PACKAGE_BZIP2
bool "bzip2 module"
help
bzip2 module for Python
config BR2_PACKAGE_PYTHON_BSDDB
depends on BR2_PACKAGE_PYTHON
select BR2_PACKAGE_BERKELEYDB
bool "bsddb module"
help
bsddb module for Python.
config BR2_PACKAGE_PYTHON_CODECSCJK
depends on BR2_PACKAGE_PYTHON
bool "codecscjk module"
default y
help
Chinese/Japanese/Korean codecs module for Python (large).
config BR2_PACKAGE_PYTHON_CURSES
depends on BR2_PACKAGE_PYTHON
select BR2_PACKAGE_NCURSES
bool "curses module"
help
curses module for Python.
# config BR2_PACKAGE_PYTHON_GDBM
# depends on BR2_PACKAGE_PYTHON
# bool "gdbm module"
# help
# gdbm module for Python.
# config BR2_PACKAGE_PYTHON_NIS
# depends on BR2_PACKAGE_PYTHON
# bool "nis module"
# help
# nis module for Python.
config BR2_PACKAGE_PYTHON_PYEXPAT
depends on BR2_PACKAGE_PYTHON
select BR2_PACKAGE_EXPAT
bool "pyexpat"
help
pyexpat module for Python.
config BR2_PACKAGE_PYTHON_READLINE
depends on BR2_PACKAGE_PYTHON
select BR2_PACKAGE_READLINE
bool "readline"
help
@ -86,22 +70,29 @@ config BR2_PACKAGE_PYTHON_READLINE
editing in the Python shell).
config BR2_PACKAGE_PYTHON_SSL
depends on BR2_PACKAGE_PYTHON
select BR2_PACKAGE_OPENSSL
bool "ssl"
help
_ssl module for Python (required for https in urllib etc).
config BR2_PACKAGE_PYTHON_TKINTER
depends on BR2_PACKAGE_PYTHON
select BR2_PACKAGE_TCL
bool "tkinter module"
help
tkinter module for Python.
config BR2_PACKAGE_PYTHON_UNICODEDATA
depends on BR2_PACKAGE_PYTHON
bool "unicodedata module"
default y
help
Unicode character database (used by stringprep module) (large).
config BR2_PACKAGE_PYTHON_SQLITE
bool "sqlite module"
select BR2_PACKAGE_SQLITE
help
SQLite database support
config BR2_PACKAGE_PYTHON_ZLIB
bool "zlib module"
select BR2_PACKAGE_ZLIB
help
zlib support in Python
endmenu
endif

View File

@ -1,106 +0,0 @@
diff -rduNp Python-2.4.2.orig/Makefile.pre.in Python-2.4.2/Makefile.pre.in
--- Python-2.4.2.orig/Makefile.pre.in 2005-03-29 01:23:01.000000000 +0200
+++ Python-2.4.2/Makefile.pre.in 2007-01-22 19:37:08.000000000 +0100
@@ -162,6 +162,7 @@ UNICODE_OBJS= @UNICODE_OBJS@
PYTHON= python$(EXE)
BUILDPYTHON= python$(BUILDEXE)
+HOSTPYTHON= $(BUILDPYTHON)
# === Definitions added by makesetup ===
@@ -188,7 +189,7 @@ GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
##########################################################################
# Parser
PGEN= Parser/pgen$(EXE)
-
+HOSTPGEN= $(PGEN)$(EXE)
POBJS= \
Parser/acceler.o \
Parser/grammar1.o \
@@ -320,8 +321,8 @@ platform: $(BUILDPYTHON)
# Build the shared modules
sharedmods: $(BUILDPYTHON)
case $$MAKEFLAGS in \
- *-s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
- *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
+ *-s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \
+ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \
esac
# buildno should really depend on something like LIBRARY_SRC
@@ -442,7 +443,7 @@ Modules/ccpython.o: $(srcdir)/Modules/cc
$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
- -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
+ -$(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
$(PGEN): $(PGENOBJS)
$(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
@@ -719,19 +720,19 @@ libinstall: $(BUILDPYTHON) $(srcdir)/Lib
done
$(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
+ $(HOSTPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
-d $(LIBDEST) -f \
-x 'badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
+ $(HOSTPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
-d $(LIBDEST) -f \
-x 'badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
+ $(HOSTPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
-d $(LIBDEST)/site-packages -f \
-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
+ $(HOSTPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
-d $(LIBDEST)/site-packages -f \
-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
@@ -826,7 +827,7 @@ libainstall: all
# Install the dynamically loadable modules
# This goes into $(exec_prefix)
sharedinstall:
- $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
+ $(RUNSHARED) $(HOSTPYTHON) -E $(srcdir)/setup.py install \
--prefix=$(prefix) \
--install-scripts=$(BINDIR) \
--install-platlib=$(DESTSHARED) \
diff -rduNp Python-2.4.2.orig/setup.py Python-2.4.2/setup.py
--- Python-2.4.2.orig/setup.py 2005-03-09 23:27:24.000000000 +0100
+++ Python-2.4.2/setup.py 2007-01-22 19:37:08.000000000 +0100
@@ -204,6 +204,7 @@ class PyBuildExt(build_ext):
try:
imp.load_dynamic(ext.name, ext_filename)
except ImportError, why:
+ return
self.announce('*** WARNING: renaming "%s" since importing it'
' failed: %s' % (ext.name, why), level=3)
assert not self.inplace
@@ -239,8 +240,6 @@ class PyBuildExt(build_ext):
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')
# Add paths to popular package managers on OS X/darwin
if sys.platform == "darwin":
@@ -251,12 +250,6 @@ class PyBuildExt(build_ext):
add_dir_to_list(self.compiler.library_dirs, '/opt/local/lib')
add_dir_to_list(self.compiler.include_dirs, '/opt/local/include')
- if os.path.normpath(sys.prefix) != '/usr':
- 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:

View File

@ -1,36 +0,0 @@
--- Python-2.4.2-001/setup.py 2007-01-23 16:18:37.000000000 +0100
+++ Python-2.4.2/setup.py 2007-01-23 16:26:43.000000000 +0100
@@ -239,7 +239,18 @@
return sys.platform
def detect_modules(self):
- # Ensure that /usr/local is always used
+ try:
+ modules_include_dirs = os.environ["PYTHON_MODULES_INCLUDE"].split()
+ except KeyError:
+ modules_include_dirs = ['/usr/include']
+ try:
+ modules_lib_dirs = os.environ["PYTHON_MODULES_LIB"].split()
+ except KeyError:
+ modules_lib_dirs = ['/usr/lib']
+ for dir in modules_include_dirs:
+ add_dir_to_list(self.compiler.include_dirs, dir)
+ for dir in modules_lib_dirs:
+ add_dir_to_list(self.compiler.library_dirs, dir)
# Add paths to popular package managers on OS X/darwin
if sys.platform == "darwin":
@@ -258,11 +269,8 @@
# 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
exts = []
platform = self.get_platform()

View File

@ -1,37 +0,0 @@
diff -rduNp Python-2.4.2-002/setup.py Python-2.4.2/setup.py
--- Python-2.4.2-002/setup.py 2007-01-22 19:41:47.000000000 +0100
+++ Python-2.4.2/setup.py 2007-01-22 19:47:25.000000000 +0100
@@ -15,7 +15,14 @@ from distutils.command.install import in
from distutils.command.install_lib import install_lib
# This global variable is used to hold the list of modules to be disabled.
-disabled_module_list = []
+try:
+ disabled_module_list = os.environ["PYTHON_DISABLE_MODULES"].split()
+except KeyError:
+ disabled_module_list = []
+try:
+ disable_ssl = os.environ["PYTHON_DISABLE_SSL"]
+except KeyError:
+ disable_ssl = 0
def add_dir_to_list(dirlist, dir):
"""Add the directory 'dir' to the list 'dirlist' (at the front) if
@@ -247,6 +254,7 @@ class PyBuildExt(build_ext):
return sys.platform
def detect_modules(self):
+ global disable_ssl
try:
modules_include_dirs = os.environ["PYTHON_MODULES_INCLUDE"].split()
except KeyError:
@@ -468,7 +476,8 @@ class PyBuildExt(build_ext):
] )
if (ssl_incs is not None and
- ssl_libs is not None):
+ ssl_libs is not None and
+ not disable_ssl):
exts.append( Extension('_ssl', ['_ssl.c'],
include_dirs = ssl_incs,
library_dirs = ssl_libs,

View File

@ -1,18 +0,0 @@
diff -rduNp Python-2.4.2-010/Python/import.c Python-2.4.2/Python/import.c
--- Python-2.4.2-010/Python/import.c 2005-09-14 20:15:03.000000000 +0200
+++ Python-2.4.2/Python/import.c 2007-01-22 19:49:18.000000000 +0100
@@ -822,8 +822,12 @@ static void
write_compiled_module(PyCodeObject *co, char *cpathname, long mtime)
{
FILE *fp;
-
- fp = open_exclusive(cpathname);
+ char *py_dontcompile = getenv("PYTHON_DONTCOMPILE");
+
+ if (!py_dontcompile)
+ fp = open_exclusive(cpathname);
+ else
+ fp = NULL;
if (fp == NULL) {
if (Py_VerboseFlag)
PySys_WriteStderr(

View File

@ -0,0 +1,153 @@
Add support in Python build system to specify host tools
Python needs a Python interpreter and a "pgen" program to build
itself. Unfortunately, the Python build system assumes that it can use
the interpreter and pgen program it has just built to build
itself. Obviously, this cannot work in cross-compilation mode since
the interpreter and the pgen program have been built for the target.
Therefore, this patch adds support in the Python build system for the
new PYTHON_FOR_BUILD and PGEN_FOR_BUILD variables, so that we can
point Python ./configure script to the Python interpreter and pgen
program that have been previously built for the host.
Patch ported to python2.7 by Maxime Ripard <ripard@archos.com>, and
later significantly reworked by Thomas Petazzoni
<thomas.petazzoni@free-electrons.com>, with some inspiration taken
from the Python patches of the PTXdist project.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
Makefile.pre.in | 32 +++++++++++++++++---------------
configure.in | 17 +++++++++++++++++
2 files changed, 34 insertions(+), 15 deletions(-)
Index: Python-2.7.1/Makefile.pre.in
===================================================================
--- Python-2.7.1.orig/Makefile.pre.in
+++ Python-2.7.1/Makefile.pre.in
@@ -178,7 +178,8 @@
UNICODE_OBJS= @UNICODE_OBJS@
PYTHON= python$(EXE)
-BUILDPYTHON= python$(BUILDEXE)
+BUILDPYTHON= ./python$(BUILDEXE)
+PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@
# The task to run while instrument when building the profile-opt target
PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
@@ -210,7 +211,8 @@
##########################################################################
# Parser
-PGEN= Parser/pgen$(EXE)
+BUILDPGEN= Parser/pgen$(EXE)
+PGEN_FOR_BUILD=@PGEN_FOR_BUILD@
POBJS= \
Parser/acceler.o \
@@ -404,8 +406,8 @@
# Build the shared modules
sharedmods: $(BUILDPYTHON)
@case $$MAKEFLAGS in \
- *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
- *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
+ *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py -q build;; \
+ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py build;; \
esac
# Build static library
@@ -536,12 +538,12 @@
$(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
-$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
+$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN_FOR_BUILD) $(GRAMMAR_INPUT)
-@$(INSTALL) -d Include
- -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
+ -$(PGEN_FOR_BUILD) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
-$(PGEN): $(PGENOBJS)
- $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
+$(BUILDPGEN): $(PGENOBJS)
+ $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(BUILDPGEN)
Parser/grammar.o: $(srcdir)/Parser/grammar.c \
$(srcdir)/Include/token.h \
@@ -921,25 +923,25 @@
done
$(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
+ $(PYTHON_FOR_BUILD) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
-d $(LIBDEST) -f \
-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
$(DESTDIR)$(LIBDEST)
PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
+ $(PYTHON_FOR_BUILD) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
-d $(LIBDEST) -f \
-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
$(DESTDIR)$(LIBDEST)
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
+ $(PYTHON_FOR_BUILD) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
-d $(LIBDEST)/site-packages -f \
-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
+ $(PYTHON_FOR_BUILD) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
-d $(LIBDEST)/site-packages -f \
-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
+ $(PYTHON_FOR_BUILD) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
# Create the PLATDIR source directory, if one wasn't distributed..
$(srcdir)/Lib/$(PLATDIR):
@@ -1044,7 +1046,7 @@
# Install the dynamically loadable modules
# This goes into $(exec_prefix)
sharedinstall: sharedmods
- $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
+ $(RUNSHARED) $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py install \
--prefix=$(prefix) \
--install-scripts=$(BINDIR) \
--install-platlib=$(DESTSHARED) \
@@ -1183,7 +1185,7 @@
find . -name '*.gc??' -exec rm -f {} ';'
clobber: clean profile-removal
- -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
+ -rm -f $(BUILDPYTHON) $(BUILDPGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
tags TAGS \
config.cache config.log pyconfig.h Modules/config.c
-rm -rf build platform
Index: Python-2.7.1/configure.in
===================================================================
--- Python-2.7.1.orig/configure.in
+++ Python-2.7.1/configure.in
@@ -4291,6 +4291,23 @@
done
AC_MSG_RESULT(done)
+if test "$cross_compiling" = "yes"; then
+ AC_MSG_CHECKING(python for build)
+ PYTHON_FOR_BUILD="${PYTHON_FOR_BUILD}"
+ AC_MSG_RESULT($PYTHON_FOR_BUILD)
+ AC_MSG_CHECKING(pgen for build)
+ PGEN_FOR_BUILD="${PGEN_FOR_BUILD}"
+ AC_MSG_RESULT($PGEN_FOR_BUILD)
+else
+ PYTHON_FOR_BUILD='$(BUILDPYTHON)'
+ PGEN_FOR_BUILD='$(BUILDPGEN)'
+fi
+
+AC_SUBST(PYTHON_FOR_BUILD)
+AC_SUBST(PGEN_FOR_BUILD)
+AC_ARG_VAR(PYTHON_FOR_BUILD,[build system Python])
+AC_ARG_VAR(PGEN_FOR_BUILD,[build system Python pgen])
+
# generate output files
AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc)
AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix])

View File

@ -0,0 +1,55 @@
Pass a CROSS_COMPILING variable to setup.py
The setup.py script in the Python source code plays a significant role
in the Python build process. It is responsible for building all the
modules and extensions, and due to this, does various checks that need
to be adjusted when we are cross-compiling.
For that reason, this patch makes sure that a CROSS_COMPILING variable
is passed in the environment of the setup.py script. Later patches in
the stack make use of this variable.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
Makefile.pre.in | 6 +++---
configure.in | 3 +++
2 files changed, 6 insertions(+), 3 deletions(-)
Index: Python-2.7.1/Makefile.pre.in
===================================================================
--- Python-2.7.1.orig/Makefile.pre.in
+++ Python-2.7.1/Makefile.pre.in
@@ -406,8 +406,8 @@
# Build the shared modules
sharedmods: $(BUILDPYTHON)
@case $$MAKEFLAGS in \
- *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py -q build;; \
- *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py build;; \
+ *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' CROSS_COMPILING=@CROSS_COMPILING@ $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py -q build;; \
+ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' CROSS_COMPILING=@CROSS_COMPILING@ $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py build;; \
esac
# Build static library
@@ -1046,7 +1046,7 @@
# Install the dynamically loadable modules
# This goes into $(exec_prefix)
sharedinstall: sharedmods
- $(RUNSHARED) $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py install \
+ $(RUNSHARED) CROSS_COMPILING=@CROSS_COMPILING@ $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py install \
--prefix=$(prefix) \
--install-scripts=$(BINDIR) \
--install-platlib=$(DESTSHARED) \
Index: Python-2.7.1/configure.in
===================================================================
--- Python-2.7.1.orig/configure.in
+++ Python-2.7.1/configure.in
@@ -4308,6 +4308,9 @@
AC_ARG_VAR(PYTHON_FOR_BUILD,[build system Python])
AC_ARG_VAR(PGEN_FOR_BUILD,[build system Python pgen])
+CROSS_COMPILING=$cross_compiling
+AC_SUBST(CROSS_COMPILING)
+
# generate output files
AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc)
AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix])

View File

@ -0,0 +1,26 @@
Disable import check when cross-compiling
Once Python has compiled an extension (i.e some C code, potentially
linked to a library), it tries to import it. This cannot work in
cross-compilation mode, so we just disable this check.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
setup.py | 4 ++++
1 file changed, 4 insertions(+)
Index: Python-2.7.1/setup.py
===================================================================
--- Python-2.7.1.orig/setup.py
+++ Python-2.7.1/setup.py
@@ -304,6 +304,10 @@
self.announce('WARNING: skipping import check for Cygwin-based "%s"'
% ext.name)
return
+ if os.environ.get('CROSS_COMPILING') == 'yes':
+ self.announce('WARNING: skipping import check for cross compiled "%s"'
+ % ext.name)
+ return
ext_filename = os.path.join(
self.build_lib,
self.get_ext_filename(self.get_ext_fullname(ext.name)))

View File

@ -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):

View File

@ -0,0 +1,38 @@
Tell setup.py the location of headers/libraries
Allow the libraries detection routine to look for headers and libs in
other directories than /usr/include or /usr/lib through the
environment variables PYTHON_MODULES_INCLUDE and PYTHON_MODULES_LIB.
We can then use it to look for libraries in the buildroot staging
directory.
Patch ported to python2.7 by Maxime Ripard <ripard@archos.com>
---
setup.py | 13 +++++++++++++
1 file changed, 13 insertions(+)
Index: Python-2.7.1/setup.py
===================================================================
--- Python-2.7.1.orig/setup.py
+++ Python-2.7.1/setup.py
@@ -350,6 +350,19 @@
return sys.platform
def detect_modules(self):
+ try:
+ modules_include_dirs = os.environ["PYTHON_MODULES_INCLUDE"].split()
+ except KeyError:
+ modules_include_dirs = ['/usr/include']
+ try:
+ modules_lib_dirs = os.environ["PYTHON_MODULES_LIB"].split()
+ except KeyError:
+ modules_include_dirs = ['/usr/lib']
+ for dir in modules_include_dirs:
+ add_dir_to_list(self.compiler.include_dirs, dir)
+ for dir in modules_lib_dirs:
+ add_dir_to_list(self.compiler.library_dirs, dir)
+
# Ensure that /usr/local is always used
if os.environ.get('CROSS_COMPILING') != 'yes':
add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')

View File

@ -0,0 +1,102 @@
Add infrastructure to disable the build of certain extensions
Some of the extensions part of the Python core have dependencies on
external libraries (sqlite, tk, etc.) or are relatively big and not
necessarly always useful (CJK codecs for example). By extensions, we
mean part of Python modules that are written in C and therefore
compiled to binary code.
Therefore, we introduce a small infrastructure that allows to disable
some of those extensions. This can be done inside the configure.in by
adding values to the DISABLED_EXTENSIONS variable (which is a
word-separated list of extensions).
The implementation works as follow :
* configure.in defines a DISABLED_EXTENSIONS variable, which is
substituted (so that when Makefile.pre is generated from
Makefile.pre.in, the value of the variable is substituted). For
now, this DISABLED_EXTENSIONS variable is empty, later patches will
use it.
* Makefile.pre.in passes the DISABLED_EXTENSIONS value down to the
variables passed in the environment when calling the setup.py
script that actually builds and installs those extensions.
* setup.py is modified so that the existing "disabled_module_list" is
filled with those pre-disabled extensions listed in
DISABLED_EXTENSIONS.
Patch ported to python2.7 by Maxime Ripard <ripard@archos.com>, and
then extended by Thomas Petazzoni
<thomas.petazzoni@free-electrons.com>.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
Makefile.pre.in | 8 +++++---
configure.in | 2 ++
setup.py | 5 ++++-
3 files changed, 11 insertions(+), 4 deletions(-)
Index: Python-2.7.1/Makefile.pre.in
===================================================================
--- Python-2.7.1.orig/Makefile.pre.in
+++ Python-2.7.1/Makefile.pre.in
@@ -141,6 +141,8 @@
# configure script arguments
CONFIG_ARGS= @CONFIG_ARGS@
+# disabled extensions
+DISABLED_EXTENSIONS= @DISABLED_EXTENSIONS@
# Subdirectories with code
SRCDIRS= @SRCDIRS@
@@ -406,8 +408,8 @@
# Build the shared modules
sharedmods: $(BUILDPYTHON)
@case $$MAKEFLAGS in \
- *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' CROSS_COMPILING=@CROSS_COMPILING@ $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py -q build;; \
- *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' CROSS_COMPILING=@CROSS_COMPILING@ $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py build;; \
+ *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' CROSS_COMPILING=@CROSS_COMPILING@ DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py -q build;; \
+ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' CROSS_COMPILING=@CROSS_COMPILING@ DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py build;; \
esac
# Build static library
@@ -1046,7 +1048,7 @@
# Install the dynamically loadable modules
# This goes into $(exec_prefix)
sharedinstall: sharedmods
- $(RUNSHARED) CROSS_COMPILING=@CROSS_COMPILING@ $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py install \
+ $(RUNSHARED) CROSS_COMPILING=@CROSS_COMPILING@ DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py install \
--prefix=$(prefix) \
--install-scripts=$(BINDIR) \
--install-platlib=$(DESTSHARED) \
Index: Python-2.7.1/configure.in
===================================================================
--- Python-2.7.1.orig/configure.in
+++ Python-2.7.1/configure.in
@@ -2084,6 +2084,8 @@
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+AC_SUBST(DISABLED_EXTENSIONS)
+
# Check for use of the system expat library
AC_MSG_CHECKING(for --with-system-expat)
AC_ARG_WITH(system_expat,
Index: Python-2.7.1/setup.py
===================================================================
--- Python-2.7.1.orig/setup.py
+++ Python-2.7.1/setup.py
@@ -21,7 +21,10 @@
COMPILED_WITH_PYDEBUG = hasattr(sys, 'gettotalrefcount')
# This global variable is used to hold the list of modules to be disabled.
-disabled_module_list = []
+try:
+ disabled_module_list = sysconfig.get_config_var("DISABLED_EXTENSIONS").split(" ")
+except KeyError:
+ disabled_module_list = list()
def add_dir_to_list(dirlist, dir):
"""Add the directory 'dir' to the list 'dirlist' (at the front) if

View File

@ -0,0 +1,40 @@
Do not generate .pyo files
By default, the Python installation byte-compiles all modules in two
forms: the normal bytecode (.pyc) and an optimized bytecode (.pyo).
According to
http://www.network-theory.co.uk/docs/pytut/CompiledPythonfiles.html,
the optimization do not do anything useful, and generating both the
"non-optimized" and "optimized" bytecode variants takes time.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
Makefile.pre.in | 9 ---------
1 file changed, 9 deletions(-)
Index: Python-2.7.1/Makefile.pre.in
===================================================================
--- Python-2.7.1.orig/Makefile.pre.in
+++ Python-2.7.1/Makefile.pre.in
@@ -929,20 +929,11 @@
-d $(LIBDEST) -f \
-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
$(DESTDIR)$(LIBDEST)
- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- $(PYTHON_FOR_BUILD) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
- -d $(LIBDEST) -f \
- -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
- $(DESTDIR)$(LIBDEST)
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
$(PYTHON_FOR_BUILD) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
-d $(LIBDEST)/site-packages -f \
-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- $(PYTHON_FOR_BUILD) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
- -d $(LIBDEST)/site-packages -f \
- -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
$(PYTHON_FOR_BUILD) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
# Create the PLATDIR source directory, if one wasn't distributed..

View File

@ -0,0 +1,65 @@
Make sure setup.py reads the correct CONFIG_ARGS
The setup.py script that builds and installs all the Python modules
shipped with the interpreter looks at the CONFIG_ARGS variable stored
in the "sysconfig" module to look at the ./configure options and
adjust its behaviour accordingly.
Unfortunately, when cross-compiling, the value of CONFIG_ARGS returned
by the sysconfig are the one passed to the ./configure script of the
*host* Python and not the one we're currently building for the target.
In order to avoid that, we re-initialize the values in the sysconfig
module by re-reading the environment at the beginning of the setup.py
script, and we make sure that the CONFIG_ARGS variable is actually
part of the environment of setup.py.
See the beginning of
http://article.gmane.org/gmane.comp.python.devel/99772 for the
inspiration.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
Makefile.pre.in | 6 +++---
setup.py | 3 +++
2 files changed, 6 insertions(+), 3 deletions(-)
Index: Python-2.7.1/Makefile.pre.in
===================================================================
--- Python-2.7.1.orig/Makefile.pre.in
+++ Python-2.7.1/Makefile.pre.in
@@ -408,8 +408,8 @@
# Build the shared modules
sharedmods: $(BUILDPYTHON)
@case $$MAKEFLAGS in \
- *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' CROSS_COMPILING=@CROSS_COMPILING@ DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py -q build;; \
- *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' CROSS_COMPILING=@CROSS_COMPILING@ DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py build;; \
+ *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' CROSS_COMPILING=@CROSS_COMPILING@ DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" CONFIG_ARGS="$(CONFIG_ARGS)" $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py -q build;; \
+ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' CROSS_COMPILING=@CROSS_COMPILING@ DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" CONFIG_ARGS="$(CONFIG_ARGS)" $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py build;; \
esac
# Build static library
@@ -1039,7 +1039,7 @@
# Install the dynamically loadable modules
# This goes into $(exec_prefix)
sharedinstall: sharedmods
- $(RUNSHARED) CROSS_COMPILING=@CROSS_COMPILING@ DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py install \
+ $(RUNSHARED) CROSS_COMPILING=@CROSS_COMPILING@ DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" CONFIG_ARGS="$(CONFIG_ARGS)" $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py install \
--prefix=$(prefix) \
--install-scripts=$(BINDIR) \
--install-platlib=$(DESTSHARED) \
Index: Python-2.7.1/setup.py
===================================================================
--- Python-2.7.1.orig/setup.py
+++ Python-2.7.1/setup.py
@@ -20,6 +20,9 @@
# Were we compiled --with-pydebug or with #define Py_DEBUG?
COMPILED_WITH_PYDEBUG = hasattr(sys, 'gettotalrefcount')
+sysconfig.get_config_vars()
+sysconfig._CONFIG_VARS.update(os.environ)
+
# This global variable is used to hold the list of modules to be disabled.
try:
disabled_module_list = sysconfig.get_config_var("DISABLED_EXTENSIONS").split(" ")

View File

@ -0,0 +1,25 @@
Use a symlink between python and pythonVERSION
By default, a hard link is used between /usr/bin/python and
/usr/bin/pythonVERSION. Using hard links for such things is fairly
uncommon, so let's make a symbolic link instead.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
Makefile.pre.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: Python-2.7.1/Makefile.pre.in
===================================================================
--- Python-2.7.1.orig/Makefile.pre.in
+++ Python-2.7.1/Makefile.pre.in
@@ -791,7 +791,7 @@
then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON); \
else true; \
fi
- (cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON))
+ (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)$(EXE) $(PYTHON))
-rm -f $(DESTDIR)$(BINDIR)/python-config
(cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python-config)
-test -d $(DESTDIR)$(LIBPC) || $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(LIBPC)

View File

@ -0,0 +1,76 @@
Change the location of pyconfig.h
The Python interpreter has a really strange behaviour: at *runtime*,
it reads a Makefile and a header file named pyconfig.h to get some
information about the configuration.
The Makefile is located in usr/lib/python2.7/config, which is fine
since this location is kept on the target.
However, by default, the pyconfig.h is installed in
usr/include/python2.7, but we completely remove the usr/include
directory for the target. Since making an exception just for
pyconfig.h is annoying, this patch also installs pyconfig.h to
usr/lib/python2.7/config, and modifies the sysconfig module so that it
looks in this location instead of usr/include.
The pyconfig.h is still kept in usr/include/python2.7, because it is
needed in the $(STAGING_DIR) when building third-party Python
extensions that contain C code.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
Lib/distutils/sysconfig.py | 3 ++-
Lib/sysconfig.py | 2 +-
Makefile.pre.in | 3 ++-
3 files changed, 5 insertions(+), 3 deletions(-)
Index: Python-2.7.1/Lib/distutils/sysconfig.py
===================================================================
--- Python-2.7.1.orig/Lib/distutils/sysconfig.py
+++ Python-2.7.1/Lib/distutils/sysconfig.py
@@ -193,7 +193,8 @@
else:
inc_dir = project_base
else:
- inc_dir = get_python_inc(plat_specific=1)
+ lib_dir = get_python_lib(plat_specific=1, standard_lib=1)
+ inc_dir = os.path.join(lib_dir, "config")
if get_python_version() < '2.2':
config_h = 'config.h'
else:
Index: Python-2.7.1/Lib/sysconfig.py
===================================================================
--- Python-2.7.1.orig/Lib/sysconfig.py
+++ Python-2.7.1/Lib/sysconfig.py
@@ -371,7 +371,7 @@
else:
inc_dir = _PROJECT_BASE
else:
- inc_dir = get_path('platinclude')
+ inc_dir = os.path.join(get_path('stdlib'), "config")
return os.path.join(inc_dir, 'pyconfig.h')
def get_scheme_names():
Index: Python-2.7.1/Makefile.pre.in
===================================================================
--- Python-2.7.1.orig/Makefile.pre.in
+++ Python-2.7.1/Makefile.pre.in
@@ -967,7 +967,6 @@
echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
$(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
done
- $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
# Install the library and miscellaneous stuff needed for extending/embedding
# This goes into $(exec_prefix)
@@ -1001,6 +1000,8 @@
$(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o
$(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
$(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
+ $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(LIBPL)/pyconfig.h
+ $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
$(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
$(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
$(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config

View File

@ -0,0 +1,75 @@
Remove runtime library paths
For some extensions (bsddb, sqlite and dbm), Python setup.py script
hardcode a runtime path (rpath) into the extension. However, this
runtime path is incorrect (because it points to the location of the
library directory on the development machine) and useless (because on
the target, all useful libraries are in a standard directory searched
by the dynamic loader). For those reasons, we just get rid of the
runtime paths in cross-compilation mode.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
setup.py | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
Index: Python-2.7.1/setup.py
===================================================================
--- Python-2.7.1.orig/setup.py
+++ Python-2.7.1/setup.py
@@ -977,6 +977,12 @@
print "bsddb lib dir:", dblib_dir, " inc dir:", db_incdir
db_incs = [db_incdir]
dblibs = [dblib]
+
+ if os.environ.get('CROSS_COMPILING') == 'yes':
+ bsddb_runtime_library_dir = None
+ else:
+ bsddb_runtime_library_dir = dblib_dir
+
# We add the runtime_library_dirs argument because the
# BerkeleyDB lib we're linking against often isn't in the
# system dynamic library search path. This is usually
@@ -986,7 +992,7 @@
exts.append(Extension('_bsddb', ['_bsddb.c'],
depends = ['bsddb.h'],
library_dirs=dblib_dir,
- runtime_library_dirs=dblib_dir,
+ runtime_library_dirs=bsddb_runtime_library_dir,
include_dirs=db_incs,
libraries=dblibs))
else:
@@ -1092,12 +1098,17 @@
else:
sqlite_extra_link_args = ()
+ if os.environ.get('CROSS_COMPILING') == 'yes':
+ sqlite_runtime_library_dirs = None
+ else:
+ sqlite_runtime_library_dirs = sqlite_libdir
+
exts.append(Extension('_sqlite3', sqlite_srcs,
define_macros=sqlite_defines,
include_dirs=["Modules/_sqlite",
sqlite_incdir],
library_dirs=sqlite_libdir,
- runtime_library_dirs=sqlite_libdir,
+ runtime_library_dirs=sqlite_runtime_library_dirs,
extra_link_args=sqlite_extra_link_args,
libraries=["sqlite3",]))
else:
@@ -1198,9 +1209,13 @@
elif cand == "bdb":
if db_incs is not None:
print "building dbm using bdb"
+ if os.environ.get('CROSS_COMPILING') == 'yes':
+ db_runtime_library_dir = None
+ else:
+ db_runtime_library_dir = dblib_dir
dbmext = Extension('dbm', ['dbmmodule.c'],
library_dirs=dblib_dir,
- runtime_library_dirs=dblib_dir,
+ runtime_library_dirs=db_runtime_library_dir,
include_dirs=db_incs,
define_macros=[
('HAVE_BERKDB_H', None),

View File

@ -0,0 +1,55 @@
Use correct mechanism to determine 32/64 bits
Python setup.py builds certain extensions (dl and imageop) only on 32
bits architecture. However, to test whether the architecture is 32
bits or not, it was looking at the sys.maxint value of the host Python
interpreter... which might run on a 64 bits architecture even though
the target is 32 bits, or which might run on a 32 bits architecture
even though the target is 64 bits.
Therefore, we introduce a is_arch_64_bits() function, which looks at
the pyconfig.h file generated by ./configure for the value of
SIZEOF_LONG to determine if the architecture is 32 or 64 bits.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
setup.py | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
Index: Python-2.7.1/setup.py
===================================================================
--- Python-2.7.1.orig/setup.py
+++ Python-2.7.1/setup.py
@@ -29,6 +29,14 @@
except KeyError:
disabled_module_list = list()
+def is_arch_64_bits():
+ data = open('pyconfig.h').read()
+ m = re.search(r"#s*define\s+SIZEOF_LONG\s+4\s*", data)
+ if m is None:
+ return True
+ else:
+ return False
+
def add_dir_to_list(dirlist, dir):
"""Add the directory 'dir' to the list 'dirlist' (at the front) if
1) 'dir' is not already in 'dirlist'
@@ -608,7 +616,7 @@
exts.append( Extension('audioop', ['audioop.c']) )
# Disabled on 64-bit platforms
- if sys.maxint != 9223372036854775807L:
+ if not is_arch_64_bits():
# Operations on images
exts.append( Extension('imageop', ['imageop.c']) )
else:
@@ -1424,7 +1432,7 @@
missing.append('_codecs_%s' % loc)
# Dynamic loading module
- if sys.maxint == 0x7fffffff:
+ if not is_arch_64_bits():
# This requires sizeof(int) == sizeof(long) == sizeof(char*)
dl_inc = find_file('dlfcn.h', [], inc_dirs)
if (dl_inc is not None) and (platform not in ['atheos']):

View File

@ -0,0 +1,84 @@
Add an option to disable installation of test modules
The Python standard distribution comes with many test modules, that
are not necessarly useful on embedded targets.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
Makefile.pre.in | 40 +++++++++++++++++++++++++++-------------
configure.in | 6 ++++++
2 files changed, 33 insertions(+), 13 deletions(-)
Index: Python-2.7.1/Makefile.pre.in
===================================================================
--- Python-2.7.1.orig/Makefile.pre.in
+++ Python-2.7.1/Makefile.pre.in
@@ -851,23 +851,37 @@
plat-mac/lib-scriptpackages/SystemEvents \
plat-mac/lib-scriptpackages/Terminal
PLATMACPATH=:plat-mac:plat-mac/lib-scriptpackages
-LIBSUBDIRS= lib-tk lib-tk/test lib-tk/test/test_tkinter \
- lib-tk/test/test_ttk site-packages test test/data \
- test/decimaltestdata test/xmltestdata \
- test/tracedmodules \
+LIBSUBDIRS= lib-tk \
+ site-packages \
encodings compiler hotshot \
- email email/mime email/test email/test/data \
- json json/tests \
- sqlite3 sqlite3/test \
- logging bsddb bsddb/test csv importlib wsgiref \
- lib2to3 lib2to3/fixes lib2to3/pgen2 lib2to3/tests \
- lib2to3/tests/data lib2to3/tests/data/fixers lib2to3/tests/data/fixers/myfixes \
- ctypes ctypes/test ctypes/macholib idlelib idlelib/Icons \
- distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
+ email email/mime \
+ json \
+ sqlite3 \
+ logging bsddb csv importlib wsgiref \
+ lib2to3 lib2to3/fixes lib2to3/pgen2 \
+ ctypes ctypes/macholib idlelib idlelib/Icons \
+ distutils distutils/command $(XMLLIBSUBDIRS) \
multiprocessing multiprocessing/dummy \
- unittest unittest/test \
+ unittest \
lib-old \
curses pydoc_data $(MACHDEPS)
+
+ifeq (@TEST_MODULES@,yes)
+LIBSUBDIRS += lib-tk/test lib-tk/test/test_tkinter \
+ lib-tk/test/test_ttk test test/data \
+ test/decimaltestdata test/xmltestdata \
+ test/tracedmodules \
+ email/test email/test/data \
+ sqlite3/test \
+ bsddb/test \
+ lib2to3/tests \
+ lib2to3/tests/data \
+ lib2to3/tests/data/fixers \
+ lib2to3/tests/data/fixers/myfixes \
+ ctypes/test distutils/tests \
+ unittest/test
+endif
+
libinstall: build_all $(srcdir)/Lib/$(PLATDIR)
@for i in $(SCRIPTDIR) $(LIBDEST); \
do \
Index: Python-2.7.1/configure.in
===================================================================
--- Python-2.7.1.orig/configure.in
+++ Python-2.7.1/configure.in
@@ -2393,6 +2393,12 @@
fi
+AC_SUBST(TEST_MODULES)
+
+AC_ARG_ENABLE(test-modules,
+ AS_HELP_STRING([--disable-test-modules], [disable test modules]),
+ [ TEST_MODULES="${enableval}" ], [ TEST_MODULES=yes ])
+
# Check for enable-ipv6
AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
AC_MSG_CHECKING([if --enable-ipv6 is specified])

View File

@ -0,0 +1,81 @@
Add an option to disable pydoc
It removes 0.5 MB of data from the target plus the pydoc script
itself.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
Makefile.pre.in | 6 +++++-
configure.in | 5 +++++
setup.py | 10 +++++++---
3 files changed, 17 insertions(+), 4 deletions(-)
Index: Python-2.7.1/Makefile.pre.in
===================================================================
--- Python-2.7.1.orig/Makefile.pre.in
+++ Python-2.7.1/Makefile.pre.in
@@ -864,7 +864,7 @@
multiprocessing multiprocessing/dummy \
unittest \
lib-old \
- curses pydoc_data $(MACHDEPS)
+ curses $(MACHDEPS)
ifeq (@TEST_MODULES@,yes)
LIBSUBDIRS += lib-tk/test lib-tk/test/test_tkinter \
@@ -882,6 +882,10 @@
unittest/test
endif
+ifeq (@PYDOC@,yes)
+LIBSUBDIRS += pydoc_data
+endif
+
libinstall: build_all $(srcdir)/Lib/$(PLATDIR)
@for i in $(SCRIPTDIR) $(LIBDEST); \
do \
Index: Python-2.7.1/configure.in
===================================================================
--- Python-2.7.1.orig/configure.in
+++ Python-2.7.1/configure.in
@@ -2392,6 +2392,11 @@
esac])
fi
+AC_SUBST(PYDOC)
+
+AC_ARG_ENABLE(pydoc,
+ AS_HELP_STRING([--disable-pydoc], [disable pydoc]),
+ [ PYDOC="${enableval}" ], [ PYDOC=yes ])
AC_SUBST(TEST_MODULES)
Index: Python-2.7.1/setup.py
===================================================================
--- Python-2.7.1.orig/setup.py
+++ Python-2.7.1/setup.py
@@ -2072,6 +2072,12 @@
# turn off warnings when deprecated modules are imported
import warnings
warnings.filterwarnings("ignore",category=DeprecationWarning)
+
+ scripts = ['Tools/scripts/idle', 'Tools/scripts/2to3',
+ 'Lib/smtpd.py']
+ if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"):
+ scripts += [ 'Tools/scripts/pydoc' ]
+
setup(# PyPI Metadata (PEP 301)
name = "Python",
version = sys.version.split()[0],
@@ -2092,9 +2098,7 @@
ext_modules=[Extension('_struct', ['_struct.c'])],
# Scripts to install
- scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle',
- 'Tools/scripts/2to3',
- 'Lib/smtpd.py']
+ scripts = scripts,
)
# --install-platlib

View File

@ -0,0 +1,99 @@
Add an option to disable lib2to3
lib2to3 is a library to convert Python 2.x code to Python 3.x. As
such, it is probably not very useful on embedded system targets.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
Makefile.pre.in | 24 +++++++++++++++++-------
configure.in | 6 ++++++
setup.py | 5 +++--
3 files changed, 26 insertions(+), 9 deletions(-)
Index: Python-2.7.1/Makefile.pre.in
===================================================================
--- Python-2.7.1.orig/Makefile.pre.in
+++ Python-2.7.1/Makefile.pre.in
@@ -856,9 +856,7 @@
encodings compiler hotshot \
email email/mime \
json \
- sqlite3 \
logging bsddb csv importlib wsgiref \
- lib2to3 lib2to3/fixes lib2to3/pgen2 \
ctypes ctypes/macholib idlelib idlelib/Icons \
distutils distutils/command $(XMLLIBSUBDIRS) \
multiprocessing multiprocessing/dummy \
@@ -872,12 +870,7 @@
test/decimaltestdata test/xmltestdata \
test/tracedmodules \
email/test email/test/data \
- sqlite3/test \
bsddb/test \
- lib2to3/tests \
- lib2to3/tests/data \
- lib2to3/tests/data/fixers \
- lib2to3/tests/data/fixers/myfixes \
ctypes/test distutils/tests \
unittest/test
endif
@@ -886,6 +879,23 @@
LIBSUBDIRS += pydoc_data
endif
+ifeq (@LIB2TO3@,yes)
+LIBSUBDIRS += lib2to3 lib2to3/fixes lib2to3/pgen2
+ifeq (@TEST_MODULES@,yes)
+LIBSUBDIRS += lib2to3/tests \
+ lib2to3/tests/data \
+ lib2to3/tests/data/fixers \
+ lib2to3/tests/data/fixers/myfixes
+endif
+endif
+
+ifeq (@SQLITE3@,yes)
+LIBSUBDIRS += sqlite3
+ifeq (@TEST_MODULES@,yes)
+LIBSUBDIRS += sqlite3/test
+endif
+endif
+
libinstall: build_all $(srcdir)/Lib/$(PLATDIR)
@for i in $(SCRIPTDIR) $(LIBDEST); \
do \
Index: Python-2.7.1/configure.in
===================================================================
--- Python-2.7.1.orig/configure.in
+++ Python-2.7.1/configure.in
@@ -2404,6 +2404,12 @@
AS_HELP_STRING([--disable-test-modules], [disable test modules]),
[ TEST_MODULES="${enableval}" ], [ TEST_MODULES=yes ])
+AC_SUBST(LIB2TO3)
+
+AC_ARG_ENABLE(lib2to3,
+ AS_HELP_STRING([--disable-lib2to3], [disable lib2to3]),
+ [ LIB2TO3="${enableval}" ], [ LIB2TO3=yes ])
+
# Check for enable-ipv6
AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
AC_MSG_CHECKING([if --enable-ipv6 is specified])
Index: Python-2.7.1/setup.py
===================================================================
--- Python-2.7.1.orig/setup.py
+++ Python-2.7.1/setup.py
@@ -2073,10 +2073,11 @@
import warnings
warnings.filterwarnings("ignore",category=DeprecationWarning)
- scripts = ['Tools/scripts/idle', 'Tools/scripts/2to3',
- 'Lib/smtpd.py']
+ scripts = ['Tools/scripts/idle', 'Lib/smtpd.py']
if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"):
scripts += [ 'Tools/scripts/pydoc' ]
+ if not '--disable-lib2to3' in sysconfig.get_config_var("CONFIG_ARGS"):
+ scripts += [ 'Tools/scripts/2to3' ]
setup(# PyPI Metadata (PEP 301)
name = "Python",

View File

@ -0,0 +1,28 @@
Add option to disable the sqlite3 module
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
configure.in | 9 +++++++++
1 file changed, 9 insertions(+)
Index: Python-2.7.1/configure.in
===================================================================
--- Python-2.7.1.orig/configure.in
+++ Python-2.7.1/configure.in
@@ -2392,6 +2392,15 @@
esac])
fi
+AC_SUBST(SQLITE3)
+AC_ARG_ENABLE(sqlite3,
+ AS_HELP_STRING([--disable-sqlite3], [disable sqlite3]),
+ [ SQLITE3="${enableval}" ], [ SQLITE3=yes ])
+
+if test "$SQLITE3" = "no" ; then
+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _sqlite3"
+fi
+
AC_SUBST(PYDOC)
AC_ARG_ENABLE(pydoc,

View File

@ -0,0 +1,68 @@
Add an option to disable the tk module
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
Makefile.pre.in | 14 ++++++++++----
configure.in | 9 +++++++++
2 files changed, 19 insertions(+), 4 deletions(-)
Index: Python-2.7.1/Makefile.pre.in
===================================================================
--- Python-2.7.1.orig/Makefile.pre.in
+++ Python-2.7.1/Makefile.pre.in
@@ -851,8 +851,7 @@
plat-mac/lib-scriptpackages/SystemEvents \
plat-mac/lib-scriptpackages/Terminal
PLATMACPATH=:plat-mac:plat-mac/lib-scriptpackages
-LIBSUBDIRS= lib-tk \
- site-packages \
+LIBSUBDIRS= site-packages \
encodings compiler hotshot \
email email/mime \
json \
@@ -865,8 +864,7 @@
curses $(MACHDEPS)
ifeq (@TEST_MODULES@,yes)
-LIBSUBDIRS += lib-tk/test lib-tk/test/test_tkinter \
- lib-tk/test/test_ttk test test/data \
+LIBSUBDIRS += test test/data \
test/decimaltestdata test/xmltestdata \
test/tracedmodules \
email/test email/test/data \
@@ -896,6 +894,14 @@
endif
endif
+ifeq (@TK@,yes)
+LIBSUBDIRS += lib-tk
+ifeq (@TEST_MODULES@,yes)
+LIBSUBDIRS += lib-tk/test lib-tk/test/test_tkinter \
+ lib-tk/test/test_ttk
+endif
+endif
+
libinstall: build_all $(srcdir)/Lib/$(PLATDIR)
@for i in $(SCRIPTDIR) $(LIBDEST); \
do \
Index: Python-2.7.1/configure.in
===================================================================
--- Python-2.7.1.orig/configure.in
+++ Python-2.7.1/configure.in
@@ -2401,6 +2401,15 @@
DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _sqlite3"
fi
+AC_SUBST(TK)
+AC_ARG_ENABLE(tk,
+ AS_HELP_STRING([--disable-tk], [disable tk]),
+ [ TK="${enableval}" ], [ TK=yes ])
+
+if test "$TK" = "no"; then
+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _tkinter"
+fi
+
AC_SUBST(PYDOC)
AC_ARG_ENABLE(pydoc,

View File

@ -0,0 +1,53 @@
Add an option to disable the curses module
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
Makefile.pre.in | 6 +++++-
configure.in | 9 +++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
Index: Python-2.7.1/Makefile.pre.in
===================================================================
--- Python-2.7.1.orig/Makefile.pre.in
+++ Python-2.7.1/Makefile.pre.in
@@ -861,7 +861,7 @@
multiprocessing multiprocessing/dummy \
unittest \
lib-old \
- curses $(MACHDEPS)
+ $(MACHDEPS)
ifeq (@TEST_MODULES@,yes)
LIBSUBDIRS += test test/data \
@@ -902,6 +902,10 @@
endif
endif
+ifeq (@CURSES@,yes)
+LIBSUBDIRS += curses
+endif
+
libinstall: build_all $(srcdir)/Lib/$(PLATDIR)
@for i in $(SCRIPTDIR) $(LIBDEST); \
do \
Index: Python-2.7.1/configure.in
===================================================================
--- Python-2.7.1.orig/configure.in
+++ Python-2.7.1/configure.in
@@ -2410,6 +2410,15 @@
DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _tkinter"
fi
+AC_SUBST(CURSES)
+AC_ARG_ENABLE(curses,
+ AS_HELP_STRING([--disable-curses], [disable curses]),
+ [ CURSES="${enableval}" ], [ CURSES=yes ])
+
+if test "$CURSES" = "no"; then
+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _curses _curses_panel"
+fi
+
AC_SUBST(PYDOC)
AC_ARG_ENABLE(pydoc,

View File

@ -0,0 +1,84 @@
Add an option to disable expat
This patch replaces the existing --with-system-expat option with a
--with-expat={system,builtin,none} option, which allows to tell Python
whether we want to use the system expat (already installed), the expat
builtin the Python sources, or no expat at all (which disables the
installation of XML modules).
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
Makefile.pre.in | 6 +++++-
configure.in | 18 +++++++++++++-----
setup.py | 2 +-
3 files changed, 19 insertions(+), 7 deletions(-)
Index: Python-2.7.1/Makefile.pre.in
===================================================================
--- Python-2.7.1.orig/Makefile.pre.in
+++ Python-2.7.1/Makefile.pre.in
@@ -857,7 +857,7 @@
json \
logging bsddb csv importlib wsgiref \
ctypes ctypes/macholib idlelib idlelib/Icons \
- distutils distutils/command $(XMLLIBSUBDIRS) \
+ distutils distutils/command \
multiprocessing multiprocessing/dummy \
unittest \
lib-old \
@@ -906,6 +906,10 @@
LIBSUBDIRS += curses
endif
+ifeq (@EXPAT@,yes)
+LIBSUBDIRS += $(XMLLIBSUBDIRS)
+endif
+
libinstall: build_all $(srcdir)/Lib/$(PLATDIR)
@for i in $(SCRIPTDIR) $(LIBDEST); \
do \
Index: Python-2.7.1/configure.in
===================================================================
--- Python-2.7.1.orig/configure.in
+++ Python-2.7.1/configure.in
@@ -2087,13 +2087,21 @@
AC_SUBST(DISABLED_EXTENSIONS)
# Check for use of the system expat library
-AC_MSG_CHECKING(for --with-system-expat)
-AC_ARG_WITH(system_expat,
- AS_HELP_STRING([--with-system-expat], [build pyexpat module using an installed expat library]),
+AC_MSG_CHECKING(for --with-expat)
+AC_ARG_WITH(expat,
+ AS_HELP_STRING([--with-expat], [select which expat version to use: system, builtin, none]),
[],
- [with_system_expat="no"])
+ [with_expat="builtin"])
-AC_MSG_RESULT($with_system_expat)
+AC_MSG_RESULT($with_expat)
+
+if test "$with_expat" != "none"; then
+ EXPAT=yes
+else
+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} pyexpat"
+ EXPAT=no
+fi
+AC_SUBST(EXPAT)
# Check for use of the system libffi library
AC_MSG_CHECKING(for --with-system-ffi)
Index: Python-2.7.1/setup.py
===================================================================
--- Python-2.7.1.orig/setup.py
+++ Python-2.7.1/setup.py
@@ -1383,7 +1383,7 @@
#
# More information on Expat can be found at www.libexpat.org.
#
- if '--with-system-expat' in sysconfig.get_config_var("CONFIG_ARGS"):
+ if '--with-expat=system' in sysconfig.get_config_var("CONFIG_ARGS"):
expat_inc = []
define_macros = []
expat_lib = ['expat']

View File

@ -0,0 +1,25 @@
Add an option to disable CJK codecs
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
configure.in | 6 ++++++
1 file changed, 6 insertions(+)
Index: Python-2.7.1/configure.in
===================================================================
--- Python-2.7.1.orig/configure.in
+++ Python-2.7.1/configure.in
@@ -2409,6 +2409,12 @@
DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _sqlite3"
fi
+AC_ARG_ENABLE(codecs-cjk,
+ AS_HELP_STRING([--disable-codecs-cjk], [disable CJK codecs]),
+ [ if test "$enableval" = "no"; then
+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _codecs_kr _codecs_jp _codecs_cn _codecs_tw _codecs_hk"
+ fi])
+
AC_SUBST(TK)
AC_ARG_ENABLE(tk,
AS_HELP_STRING([--disable-tk], [disable tk]),

View File

@ -0,0 +1,28 @@
Add an option to disable NIS
NIS is not necessarily available in uClibc, so we need an option to
not compile support for it.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
configure.in | 6 ++++++
1 file changed, 6 insertions(+)
Index: Python-2.7.1/configure.in
===================================================================
--- Python-2.7.1.orig/configure.in
+++ Python-2.7.1/configure.in
@@ -2415,6 +2415,12 @@
DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _codecs_kr _codecs_jp _codecs_cn _codecs_tw _codecs_hk"
fi])
+AC_ARG_ENABLE(nis,
+ AS_HELP_STRING([--disable-nis], [disable NIS]),
+ [ if test "$enableval" = "no"; then
+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} nis"
+ fi])
+
AC_SUBST(TK)
AC_ARG_ENABLE(tk,
AS_HELP_STRING([--disable-tk], [disable tk]),

View File

@ -0,0 +1,25 @@
Add an option to disable unicodedata
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
configure.in | 6 ++++++
1 file changed, 6 insertions(+)
Index: Python-2.7.1/configure.in
===================================================================
--- Python-2.7.1.orig/configure.in
+++ Python-2.7.1/configure.in
@@ -2421,6 +2421,12 @@
DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} nis"
fi])
+AC_ARG_ENABLE(unicodedata,
+ AS_HELP_STRING([--disable-unicodedata], [disable unicodedata]),
+ [ if test "$enableval" = "no"; then
+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} unicodedata"
+ fi])
+
AC_SUBST(TK)
AC_ARG_ENABLE(tk,
AS_HELP_STRING([--disable-tk], [disable tk]),

View File

@ -0,0 +1,81 @@
Add an option to disable bsddb
bsddb has an external dependency on Berkeley DB. Since we want to be
able to build Python without it, this patch adds an option to disable
the build/installation of this Python module.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
Makefile.pre.in | 10 ++++++++--
configure.in | 22 ++++++++++++++++++++++
2 files changed, 30 insertions(+), 2 deletions(-)
Index: Python-2.7.1/Makefile.pre.in
===================================================================
--- Python-2.7.1.orig/Makefile.pre.in
+++ Python-2.7.1/Makefile.pre.in
@@ -855,7 +855,7 @@
encodings compiler hotshot \
email email/mime \
json \
- logging bsddb csv importlib wsgiref \
+ logging csv importlib wsgiref \
ctypes ctypes/macholib idlelib idlelib/Icons \
distutils distutils/command \
multiprocessing multiprocessing/dummy \
@@ -868,7 +868,6 @@
test/decimaltestdata test/xmltestdata \
test/tracedmodules \
email/test email/test/data \
- bsddb/test \
ctypes/test distutils/tests \
unittest/test
endif
@@ -910,6 +909,13 @@
LIBSUBDIRS += $(XMLLIBSUBDIRS)
endif
+ifeq (@BSDDB@,yes)
+LIBSUBDIRS += bsddb
+ifeq (@TEST_MODULES@,yes)
+LIBSUBDIRS += bsddb/test
+endif
+endif
+
libinstall: build_all $(srcdir)/Lib/$(PLATDIR)
@for i in $(SCRIPTDIR) $(LIBDEST); \
do \
Index: Python-2.7.1/configure.in
===================================================================
--- Python-2.7.1.orig/configure.in
+++ Python-2.7.1/configure.in
@@ -2421,6 +2421,28 @@
DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} nis"
fi])
+AC_ARG_ENABLE(dbm,
+ AS_HELP_STRING([--disable-dbm], [disable DBM]),
+ [ if test "$enableval" = "no"; then
+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} dbm"
+ fi])
+
+AC_ARG_ENABLE(gdbm,
+ AS_HELP_STRING([--disable-gdbm], [disable GDBM]),
+ [ if test "$enableval" = "no"; then
+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} gdbm"
+ fi])
+
+AC_SUBST(BSDDB)
+AC_ARG_ENABLE(bsddb,
+ AS_HELP_STRING([--disable-bsddb], [disable BerkeyleyDB]),
+ [ if test "$enableval" = "no"; then
+ BSDDB=no
+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} bsddb"
+ else
+ BSDDB=yes
+ fi], [ BSDDB=yes ])
+
AC_ARG_ENABLE(unicodedata,
AS_HELP_STRING([--disable-unicodedata], [disable unicodedata]),
[ if test "$enableval" = "no"; then

View File

@ -0,0 +1,25 @@
Add an option to disable the ssl module
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
configure.in | 6 ++++++
1 file changed, 6 insertions(+)
Index: Python-2.7.1/configure.in
===================================================================
--- Python-2.7.1.orig/configure.in
+++ Python-2.7.1/configure.in
@@ -2421,6 +2421,12 @@
DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} nis"
fi])
+AC_ARG_ENABLE(ssl,
+ AS_HELP_STRING([--disable-ssl], [disable SSL]),
+ [ if test "$enableval" = "no"; then
+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} ssl"
+ fi])
+
AC_ARG_ENABLE(dbm,
AS_HELP_STRING([--disable-dbm], [disable DBM]),
[ if test "$enableval" = "no"; then

View File

@ -0,0 +1,24 @@
Add an option to disable the bz2 module
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
configure.in | 6 ++++++
1 file changed, 6 insertions(+)
Index: Python-2.7.1/configure.in
===================================================================
--- Python-2.7.1.orig/configure.in
+++ Python-2.7.1/configure.in
@@ -2427,6 +2427,12 @@
DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} ssl"
fi])
+AC_ARG_ENABLE(bz2,
+ AS_HELP_STRING([--disable-bz2], [disable BZIP2]),
+ [ if test "$enableval" = "no"; then
+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} bz2"
+ fi])
+
AC_ARG_ENABLE(dbm,
AS_HELP_STRING([--disable-dbm], [disable DBM]),
[ if test "$enableval" = "no"; then

View File

@ -0,0 +1,24 @@
Add an option to disable the zlib module
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
configure.in | 6 ++++++
1 file changed, 6 insertions(+)
Index: Python-2.7.1/configure.in
===================================================================
--- Python-2.7.1.orig/configure.in
+++ Python-2.7.1/configure.in
@@ -2433,6 +2433,12 @@
DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} bz2"
fi])
+AC_ARG_ENABLE(zlib,
+ AS_HELP_STRING([--disable-zlib], [disable ZLIB]),
+ [ if test "$enableval" = "no"; then
+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} zlib"
+ fi])
+
AC_ARG_ENABLE(dbm,
AS_HELP_STRING([--disable-dbm], [disable DBM]),
[ if test "$enableval" = "no"; then

View File

@ -3,210 +3,146 @@
# python
#
#############################################################
PYTHON_VERSION=2.4.5
PYTHON_VERSION_MAJOR=2.4
PYTHON_SOURCE:=Python-$(PYTHON_VERSION).tar.bz2
PYTHON_SITE:=http://python.org/ftp/python/$(PYTHON_VERSION)
PYTHON_DIR:=$(BUILD_DIR)/Python-$(PYTHON_VERSION)
PYTHON_CAT:=$(BZCAT)
PYTHON_BINARY:=python
PYTHON_TARGET_BINARY:=usr/bin/python$(PYTHON_VERSION_MAJOR)
PYTHON_DEPS:=
PYTHON_SITE_PACKAGE_DIR=$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages
PYTHON_VERSION_MAJOR = 2.7
PYTHON_VERSION = $(PYTHON_VERSION_MAJOR).1
PYTHON_SOURCE = Python-$(PYTHON_VERSION).tar.bz2
PYTHON_SITE = http://python.org/ftp/python/$(PYTHON_VERSION)
BR2_PYTHON_DISABLED_MODULES=dbm zipfile
# Python needs itself and a "pgen" program to build itself, both being
# provided in the Python sources. So in order to cross-compile Python,
# we need to build a host Python first. This host Python is also
# installed in $(HOST_DIR), as it is needed when cross-compiling
# third-party Python modules.
HOST_PYTHON_CONF_OPT += \
--without-cxx-main \
--disable-sqlite3 \
--disable-tk \
--with-expat=none \
--disable-curses \
--disable-codecs-cjk \
--disable-nis \
--disable-unicodedata \
--disable-dbm \
--disable-gdbm \
--disable-bsddb \
--disable-test-modules \
--disable-bz2 \
--disable-zlib \
--disable-ssl
HOST_PYTHON_MAKE_ENV = \
PYTHON_MODULES_INCLUDE=$(HOST_DIR)/usr/include \
PYTHON_MODULES_LIB="$(HOST_DIR)/lib $(HOST_DIR)/usr/lib"
HOST_PYTHON_AUTORECONF = YES
PYTHON_DEPENDENCIES = host-python libffi
PYTHON_INSTALL_STAGING = YES
ifeq ($(BR2_PACKAGE_PYTHON_READLINE),y)
PYTHON_DEPS += readline
else
BR2_PYTHON_DISABLED_MODULES += readline
PYTHON_DEPENDENCIES += readline
endif
ifeq ($(BR2_PACKAGE_PYTHON_CURSES),y)
PYTHON_DEPS += ncurses
PYTHON_DEPENDENCIES += ncurses
else
BR2_PYTHON_DISABLED_MODULES += _curses _curses_panel
PYTHON_CONF_OPT += --disable-curses
endif
ifeq ($(BR2_PACKAGE_PYTHON_PYEXPAT),y)
PYTHON_DEPS += expat
PYTHON_DEPENDENCIES += expat
PYTHON_CONF_OPT += --with-expat=system
else
BR2_PYTHON_DISABLED_MODULES += pyexpat
endif
ifeq ($(BR2_PACKAGE_PYTHON_GDBM),y)
PYTHON_DEPS += gdbm
else
BR2_PYTHON_DISABLED_MODULES += gdbm
PYTHON_CONF_OPT += --with-expat=none
endif
ifeq ($(BR2_PACKAGE_PYTHON_BSDDB),y)
PYTHON_DEPS += berkeleydb
PYTHON_DEPENDENCIES += berkeleydb
else
BR2_PYTHON_DISABLED_MODULES += bsddb
PYTHON_CONF_OPT += --disable-bsddb
endif
ifeq ($(BR2_PACKAGE_PYTHON_TKINTER),y)
PYTHON_DEPS += tcl
ifeq ($(BR2_PACKAGE_PYTHON_SQLITE),y)
PYTHON_DEPENDENCIES += sqlite
else
BR2_PYTHON_DISABLED_MODULES += _tkinter
PYTHON_CONF_OPT += --disable-sqlite3
endif
ifeq ($(BR2_PACKAGE_PYTHON_SSL),y)
PYTHON_DEPS += openssl
endif
ifneq ($(BR2_PACKAGE_PYTHON_NIS),y)
BR2_PYTHON_DISABLED_MODULES += nis
PYTHON_DEPENDENCIES += openssl
else
PYTHON_CONF_OPT += --disable-ssl
endif
ifneq ($(BR2_PACKAGE_PYTHON_CODECSCJK),y)
BR2_PYTHON_DISABLED_MODULES += _codecs_kr _codecs_jp _codecs_cn _codecs_tw _codecs_hk
PYTHON_CONF_OPT += --disable-codecs-cjk
endif
ifneq ($(BR2_PACKAGE_PYTHON_UNICODEDATA),y)
BR2_PYTHON_DISABLED_MODULES += unicodedata
PYTHON_CONF_OPT += --disable-unicodedata
endif
$(DL_DIR)/$(PYTHON_SOURCE):
$(call DOWNLOAD,$(PYTHON_SITE),$(PYTHON_SOURCE))
python-source: $(DL_DIR)/$(PYTHON_SOURCE)
$(PYTHON_DIR)/.unpacked: $(DL_DIR)/$(PYTHON_SOURCE)
$(PYTHON_CAT) $(DL_DIR)/$(PYTHON_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
touch $@
$(PYTHON_DIR)/.patched: $(PYTHON_DIR)/.unpacked
toolchain/patch-kernel.sh $(PYTHON_DIR) package/python/ python-$(PYTHON_VERSION_MAJOR)-\*.patch
touch $@
$(PYTHON_DIR)/.hostpython: $(PYTHON_DIR)/.patched
(cd $(PYTHON_DIR); rm -rf config.cache; \
CC="$(HOSTCC)" OPT="-O2" \
./configure $(QUIET) \
--with-cxx=no \
$(DISABLE_NLS) && \
$(MAKE) python Parser/pgen && \
mv python hostpython && \
mv Parser/pgen Parser/hostpgen && \
$(MAKE) distclean \
) && \
touch $@
$(PYTHON_DIR)/.configured: $(PYTHON_DIR)/.hostpython
(cd $(PYTHON_DIR); rm -rf config.cache; \
$(TARGET_CONFIGURE_OPTS) \
$(TARGET_CONFIGURE_ARGS) \
OPT="$(TARGET_CFLAGS)" \
./configure $(QUIET) \
--target=$(GNU_TARGET_NAME) \
--host=$(GNU_TARGET_NAME) \
--build=$(GNU_HOST_NAME) \
--prefix=/usr \
--sysconfdir=/etc \
--with-cxx=no \
--enable-shared \
$(DISABLE_IPV6) \
$(DISABLE_NLS) \
)
touch $@
$(PYTHON_DIR)/$(PYTHON_BINARY): $(PYTHON_DIR)/.configured
ifneq ($(BR2_PACKAGE_PYTHON_SSL),y)
export PYTHON_DISABLE_SSL=1
ifeq ($(BR2_PACKAGE_PYTHON_BZIP2),y)
PYTHON_DEPENDENCIES += bzip2
else
PYTHON_CONF_OPT += --disable-bz2
endif
$(MAKE) CC="$(TARGET_CC)" -C $(PYTHON_DIR) DESTDIR=$(TARGET_DIR) \
PYTHON_MODULES_INCLUDE=$(STAGING_DIR)/usr/include \
PYTHON_MODULES_LIB="$(STAGING_DIR)/lib $(STAGING_DIR)/usr/lib" \
PYTHON_DISABLE_MODULES="$(BR2_PYTHON_DISABLED_MODULES)" \
HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen
$(TARGET_DIR)/$(PYTHON_TARGET_BINARY): $(PYTHON_DIR)/$(PYTHON_BINARY)
ifneq ($(BR2_PACKAGE_PYTHON_SSL),y)
export PYTHON_DISABLE_SSL=1
ifeq ($(BR2_PACKAGE_PYTHON_ZLIB),y)
PYTHON_DEPENDENCIES += zlib
else
PYTHON_CONF_OPT += --disable-zlib
endif
rm -rf $(PYTHON_DIR)/Lib/test
LD_LIBRARY_PATH=$(STAGING_DIR)/lib
$(MAKE) CC="$(TARGET_CC)" -C $(PYTHON_DIR) install \
DESTDIR=$(TARGET_DIR) CROSS_COMPILE=yes \
PYTHON_MODULES_INCLUDE=$(STAGING_DIR)/usr/include \
PYTHON_MODULES_LIB="$(STAGING_DIR)/lib $(STAGING_DIR)/usr/lib" \
PYTHON_DISABLE_MODULES="$(BR2_PYTHON_DISABLED_MODULES)" \
HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen && \
rm $(TARGET_DIR)/usr/bin/python && \
ln -s python$(PYTHON_VERSION_MAJOR) $(TARGET_DIR)/usr/bin/python && \
rm $(TARGET_DIR)/usr/bin/idle && \
rm $(TARGET_DIR)/usr/bin/pydoc && \
find $(TARGET_DIR)/usr/lib/ -name '*.pyo' -exec rm {} \; && \
rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \
$(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc \
$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/test
cp -dpr $(TARGET_DIR)/usr/include/python$(PYTHON_VERSION_MAJOR) $(STAGING_DIR)/usr/include/
mkdir -p $(STAGING_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)
cp -dpr $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/config $(STAGING_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/
ifeq ($(BR2_PACKAGE_PYTHON_PY_ONLY),y)
find $(TARGET_DIR)/usr/lib/ -name '*.pyc' -exec rm {} \;
endif
ifeq ($(BR2_PACKAGE_PYTHON_PYC_ONLY),y)
find $(TARGET_DIR)/usr/lib/ -name '*.py' -exec rm {} \;
endif
ifneq ($(BR2_PACKAGE_PYTHON_DEV),y)
rm -rf $(TARGET_DIR)/usr/include/python$(PYTHON_VERSION_MAJOR)
rm -rf $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/config
endif
ifneq ($(BR2_PACKAGE_PYTHON_BSDDB),y)
rm -rf $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/bsddb
endif
ifneq ($(BR2_PACKAGE_PYTHON_CURSES),y)
rm -rf $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/curses
endif
ifneq ($(BR2_PACKAGE_PYTHON_TKINTER),y)
rm -rf $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/lib-tk
endif
touch -c $@
PYTHON_CONF_ENV += \
PYTHON_FOR_BUILD=$(HOST_PYTHON_DIR)/python \
PGEN_FOR_BUILD=$(HOST_PYTHON_DIR)/Parser/pgen \
ac_cv_have_long_long_format=yes
python: $(PYTHON_DEPS) $(TARGET_DIR)/$(PYTHON_TARGET_BINARY)
PYTHON_CONF_OPT += \
--without-cxx-main \
--without-doc-strings \
--with-system-ffi \
--disable-pydoc \
--disable-test-modules \
--disable-lib2to3 \
--disable-gdbm \
--disable-tk \
--disable-nis \
--disable-dbm
python-clean:
-$(MAKE) -C $(PYTHON_DIR) distclean
rm -f $(PYTHON_DIR)/.configured $(TARGET_DIR)/$(PYTHON_TARGET_BINARY)
-rm -rf $(TARGET_DIR)/usr/lib/python* $(TARGET_DIR)/usr/include/python*
-rm -f $(STAGING_DIR)/usr/lib/libpython$(PYTHON_VERSION_MAJOR).so
PYTHON_MAKE_ENV = \
PYTHON_MODULES_INCLUDE=$(STAGING_DIR)/usr/include \
PYTHON_MODULES_LIB="$(STAGING_DIR)/lib $(STAGING_DIR)/usr/lib"
python-dirclean:
rm -rf $(PYTHON_DIR)
#### LIBPYTHON
LIBPYTHON_BINARY:=libpython$(PYTHON_VERSION_MAJOR).so
libpython: python $(TARGET_DIR)/usr/lib/$(LIBPYTHON_BINARY)
$(STAGING_DIR)/usr/lib/$(LIBPYTHON_BINARY): $(TARGET_DIR)/$(PYTHON_TARGET_BINARY)
cp -dpr $(PYTHON_DIR)/$(LIBPYTHON_BINARY).* $(STAGING_DIR)/usr/lib
(\
cd $(STAGING_DIR)/usr/lib ; \
rm -f $(LIBPYTHON_BINARY) ; \
ln -s `basename \`ls libpython*.so.*\`` $(LIBPYTHON_BINARY) \
)
$(TARGET_DIR)/usr/lib/$(LIBPYTHON_BINARY): $(STAGING_DIR)/usr/lib/$(LIBPYTHON_BINARY)
cp -dpr $(STAGING_DIR)/usr/lib/$(LIBPYTHON_BINARY).* $(TARGET_DIR)/usr/lib
(\
cd $(TARGET_DIR)/usr/lib ; \
rm -f $(LIBPYTHON_BINARY) ; \
ln -s `basename \`ls libpython*.so.*\`` $(LIBPYTHON_BINARY) \
)
#############################################################
#
# Toplevel Makefile options
# Development files removal
#
#############################################################
ifeq ($(BR2_PACKAGE_PYTHON),y)
TARGETS+=python
define PYTHON_REMOVE_DEVFILES
rm -f $(TARGET_DIR)/usr/bin/python$(PYTHON_VERSION_MAJOR)-config
rm -f $(TARGET_DIR)/usr/bin/python-config
endef
ifneq ($(BR2_HAVE_DEVFILES),y)
PYTHON_POST_INSTALL_TARGET_HOOKS += PYTHON_REMOVE_DEVFILES
endif
#
# Remove useless files. In the config/ directory, only the Makefile
# and the pyconfig.h files are needed at runtime.
#
define PYTHON_REMOVE_USELESS_FILES
for i in `find $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/config/ \
-type f -not -name pyconfig.h -a -not -name Makefile` ; do \
rm -f $$i ; \
done
endef
PYTHON_POST_INSTALL_TARGET_HOOKS += PYTHON_REMOVE_USELESS_FILES
PYTHON_AUTORECONF = YES
$(eval $(call AUTOTARGETS,package,python))
$(eval $(call AUTOTARGETS,package,python,host))