Bläddra i källkod

fix python cross-compile, when a python host binary is available

Waldemar Brodkorb 12 år sedan
förälder
incheckning
1a3f7151d5

+ 4 - 3
package/python2/Makefile

@@ -5,11 +5,11 @@ include ${TOPDIR}/rules.mk
 
 PKG_NAME:=		python2
 PKG_VERSION:=		2.7.5
-PKG_RELEASE:=		1
+PKG_RELEASE:=		2
 PKG_MD5SUM:=		b4f01a1d0ba0b46b05c73b2ac909b1df
 PKG_DESCR:=		Python scripting language (Version 2)
 PKG_SECTION:=		lang
-PKG_BUILDDEP:=		libffi python2-host
+PKG_BUILDDEP:=		libffi python2-host autotool
 PKG_DEPENDS:=		libpthread libffi libgcc
 PKG_URL:=		http://www.python.org/
 PKG_SITES:=		http://www.python.org/ftp/python/${PKG_VERSION}/
@@ -84,6 +84,7 @@ $(eval $(call PKG_mod_template,PYTHON2_MOD_NCURSES,_curses))
 $(eval $(call PKG_mod_template,PYTHON2_MOD_SSL,_ssl))
 $(eval $(call PKG_mod_template,PYTHON2_MOD_READLINE,readline))
 
+AUTOTOOL_STYLE:=	autoreconf
 MAKE_ENV+=		HOSTPGEN=$(STAGING_HOST_DIR)/usr/bin/pgen
 CONFIGURE_ENV+=         ac_cv_have_long_long_format=yes \
 			ac_cv_file__dev_ptmx=yes \
@@ -118,7 +119,7 @@ python2-install: ${INSTALL_MODS_y} ${INSTALL_MODS_m}
 	${CP} ${WRKINST}/usr/lib/python2.7/* ${IDIR_PYTHON2}/usr/lib/python2.7
 	${CP} ${WRKINST}/usr/include/python2.7/pyconfig.h \
 		${IDIR_PYTHON2}/usr/include/python2.7
-	for i in zlib bz2 _curses _ssl gdbm _sqlite pyexpat readline; do \
+	@-for i in zlib bz2 _curses _ssl gdbm _sqlite pyexpat readline; do \
 		rm ${IDIR_PYTHON2}/usr/lib/python2.7/lib-dynload/$${i}*so; \
 	done
 

+ 1 - 1
package/python2/patches/patch-Makefile_pre_in

@@ -1,5 +1,5 @@
 --- Python-2.7.5.orig/Makefile.pre.in	2013-05-12 05:32:49.000000000 +0200
-+++ Python-2.7.5/Makefile.pre.in	2013-10-29 08:12:25.000000000 +0100
++++ Python-2.7.5/Makefile.pre.in	2013-10-30 14:10:07.000000000 +0100
 @@ -227,6 +227,7 @@ LIBFFI_INCLUDEDIR=	@LIBFFI_INCLUDEDIR@
  ##########################################################################
  # Parser

+ 34 - 4
package/python2/patches/patch-setup_py

@@ -1,5 +1,5 @@
 --- Python-2.7.5.orig/setup.py	2013-05-12 05:32:54.000000000 +0200
-+++ Python-2.7.5/setup.py	2013-10-29 07:33:37.000000000 +0100
++++ Python-2.7.5/setup.py	2013-10-30 14:18:23.000000000 +0100
 @@ -74,7 +74,7 @@ def find_file(filename, std_dirs, paths)
      'paths' is a list of additional locations to check; if the file is
          found in one of them, the resulting list will contain the directory.
@@ -54,7 +54,23 @@
              if os.path.join(sysroot, p[1:]) == dirname:
                  return [ p ]
  
-@@ -437,10 +437,12 @@ class PyBuildExt(build_ext):
+@@ -162,6 +162,7 @@ class PyBuildExt(build_ext):
+ 
+     def build_extensions(self):
+ 
++        self.compiler.library_dirs = []
+         # Detect which modules should be compiled
+         missing = self.detect_modules()
+ 
+@@ -281,6 +282,7 @@ class PyBuildExt(build_ext):
+ 
+     def build_extension(self, ext):
+ 
++
+         if ext.name == '_ctypes':
+             if not self.configure_ctypes(ext):
+                 return
+@@ -437,10 +439,12 @@ class PyBuildExt(build_ext):
  
      def detect_modules(self):
          # Ensure that /usr/local is always used
@@ -70,7 +86,7 @@
  
          # Add paths specified in the environment variables LDFLAGS and
          # CPPFLAGS for header and library files.
-@@ -477,7 +479,8 @@ class PyBuildExt(build_ext):
+@@ -477,7 +481,8 @@ class PyBuildExt(build_ext):
                          add_dir_to_list(dir_list, directory)
  
          if os.path.normpath(sys.prefix) != '/usr' \
@@ -80,7 +96,21 @@
              # 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
-@@ -530,7 +533,7 @@ class PyBuildExt(build_ext):
+@@ -495,8 +500,13 @@ class PyBuildExt(build_ext):
+         # 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.
++        if cross_compiling:
++            add_dir_to_list(self.compiler.library_dirs,
++                            sysconfig.get_config_var('srcdir'))
++
+         inc_dirs = self.compiler.include_dirs[:]
+         lib_dirs = self.compiler.library_dirs[:]
++
+         if not cross_compiling:
+             for d in (
+                 '/usr/include',
+@@ -530,7 +540,7 @@ class PyBuildExt(build_ext):
          if host_platform == 'hp-ux11':
              lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32']
  

+ 1 - 1
package/python3/Makefile

@@ -115,7 +115,7 @@ python3-install: ${INSTALL_MODS_y} ${INSTALL_MODS_m}
 	${CP} ${WRKINST}/usr/lib/python3.3/* ${IDIR_PYTHON3}/usr/lib/python3.3
 	${CP} ${WRKINST}/usr/include/python3.3m/pyconfig.h \
 		 ${IDIR_PYTHON3}/usr/include/python3.3m
-	for i in zlib _bz2 _curses _ssl _gdbm _sqlite pyexpat readline; do \
+	@-for i in zlib _bz2 _curses _ssl _gdbm _sqlite pyexpat readline; do \
 		rm ${IDIR_PYTHON3}/usr/lib/python3.3/lib-dynload/$${i}*so; \
 	done