ソースを参照

fix cross-compile at least from x86 to x86_64

Waldemar Brodkorb 15 年 前
コミット
f53612bc74

+ 10 - 8
package/python/Makefile

@@ -15,18 +15,20 @@ PKG_SITES:=		http://www.python.org/ftp/python/3.1.1/
 DISTFILES=		Python-${PKG_VERSION}.tgz
 WRKDIST=		${WRKDIR}/Python-${PKG_VERSION}
 
+DISMOD:=		readline _curses _curses_panel _tkinter nis
+
 include ${TOPDIR}/mk/package.mk
 
 $(eval $(call PKG_template,PYTHON,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 
 MAKE_ENV+=		OPT="$(TARGET_CFLAGS)" \
-			HOSTPYTHON=hostpython \
-			HOSTPGEN=hostpgen \
-			CROSS_COMPILE=yes
+			HOSTPYTHON=./hostpython \
+			HOSTPGEN=./Parser/hostpgen \
+			PYTHON_DISABLE_MODULES="$(DISMOD)"
 
 CONFIGURE_STYLE:=	gnu
 CONFIGURE_ENV+=		OPT="$(TARGET_CFLAGS)"
-CONFGIURE_ARGS:=	--with-threads \
+CONFIGURE_ARGS:=	--with-threads \
 			--with-system-ffi \
 			--without-cxx-main
 BUILD_STYLE:=		auto
@@ -39,10 +41,10 @@ pre-configure:
 		--prefix=$(STAGING_TOOLS) \
 	);
 	$(MAKE) -C ${WRKBUILD} python Parser/pgen
-	${CP} ${WRKBUILD}/Parser/pgen ${STAGING_TOOLS}/bin/hostpgen
-	${CP} ${WRKBUILD}/python ${STAGING_TOOLS}/bin/hostpython
-	PATH='${TARGET_PATH}' \
-	$(MAKE) -C ${WRKBUILD} HOSTPYTHON="hostpython" sharedmods install
+	${CP} ${WRKBUILD}/Parser/pgen ${STAGING_TOOLS}/bin/pgen
+	${CP} ${WRKBUILD}/python ${STAGING_TOOLS}/bin/python
+	${CP} ${WRKBUILD}/Parser/pgen ${WRKBUILD}/Parser/hostpgen
+	${CP} ${WRKBUILD}/python ${WRKBUILD}/hostpython
 	$(MAKE) -C ${WRKBUILD} distclean
 
 post-install:

+ 10 - 1
package/python/patches/patch-Makefile_pre_in

@@ -1,5 +1,14 @@
 --- Python-3.1.1.orig/Makefile.pre.in	2009-06-12 00:54:11.000000000 +0200
-+++ Python-3.1.1/Makefile.pre.in	2009-09-23 21:48:18.000000000 +0200
++++ Python-3.1.1/Makefile.pre.in	2009-09-28 19:01:13.167748736 +0200
+@@ -52,7 +52,7 @@ INSTALL_DATA=	@INSTALL_DATA@
+ # Shared libraries must be installed with executable mode on some systems;
+ # rather than figuring out exactly which, we always give them executable mode.
+ # Also, making them read-only seems to be a good idea...
+-INSTALL_SHARED= ${INSTALL} -m 555
++INSTALL_SHARED= ${INSTALL} -m 755
+ 
+ MAKESETUP=      $(srcdir)/Modules/makesetup
+ 
 @@ -177,6 +177,7 @@ LIBOBJS=	@LIBOBJS@
  
  PYTHON=		python$(EXE)

+ 83 - 0
package/python/patches/patch-setup_py

@@ -0,0 +1,83 @@
+--- Python-3.1.1.orig/setup.py	2009-08-12 20:39:44.000000000 +0200
++++ Python-3.1.1/setup.py	2009-09-28 19:12:33.550271196 +0200
+@@ -255,36 +255,6 @@ class PyBuildExt(build_ext):
+         # cached.  Clear that cache before trying to import.
+         sys.path_importer_cache.clear()
+ 
+-        try:
+-            imp.load_dynamic(ext.name, ext_filename)
+-        except ImportError as why:
+-            self.failed.append(ext.name)
+-            self.announce('*** WARNING: renaming "%s" since importing it'
+-                          ' failed: %s' % (ext.name, why), level=3)
+-            assert not self.inplace
+-            basename, tail = os.path.splitext(ext_filename)
+-            newname = basename + "_failed" + tail
+-            if os.path.exists(newname):
+-                os.remove(newname)
+-            os.rename(ext_filename, newname)
+-
+-            # XXX -- This relies on a Vile HACK in
+-            # distutils.command.build_ext.build_extension().  The
+-            # _built_objects attribute is stored there strictly for
+-            # use here.
+-            # If there is a failure, _built_objects may not be there,
+-            # so catch the AttributeError and move on.
+-            try:
+-                for filename in self._built_objects:
+-                    os.remove(filename)
+-            except AttributeError:
+-                self.announce('unable to remove files (ignored)')
+-        except:
+-            exc_type, why, tb = sys.exc_info()
+-            self.announce('*** WARNING: importing extension "%s" '
+-                          'failed with %s: %s' % (ext.name, exc_type, why),
+-                          level=3)
+-            self.failed.append(ext.name)
+ 
+     def get_platform(self):
+         # Get value of sys.platform
+@@ -295,8 +265,8 @@ 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_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.
+@@ -332,20 +302,22 @@ class PyBuildExt(build_ext):
+                     for directory in reversed(options.dirs):
+                         add_dir_to_list(dir_list, directory)
+ 
+-        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"))
++        #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"))
+ 
+         # 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 + [
++        #    '/lib64', '/usr/lib64',
++        #    '/lib', '/usr/lib',
++        #    ]
++        #inc_dirs = self.compiler.include_dirs + ['/usr/include']
++        inc_dirs = self.compiler.include_dirs
++        lib_dirs = self.compiler.library_dirs
+         exts = []
+         missing = []
+