diff --git a/Makefile.pre.in b/Makefile.pre.in index bcd83bf..5e54a0d 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -191,6 +191,7 @@ UNICODE_OBJS= @UNICODE_OBJS@ PYTHON= python$(EXE) BUILDPYTHON= python$(BUILDEXE) +HOSTPYTHON= ./$(BUILDPYTHON) PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@ _PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@ @@ -231,6 +232,7 @@ LIBFFI_INCLUDEDIR= @LIBFFI_INCLUDEDIR@ ########################################################################## # Parser PGEN= Parser/pgen$(EXE) +HOSTPGEN= $(PGEN) PSRCS= \ Parser/acceler.c \ @@ -461,6 +463,7 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt esac; \ $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ + PYTHONXCPREFIX='$(DESTDIR)$(prefix)' \ $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build # Build static library @@ -598,7 +601,7 @@ Modules/pwdmodule.o: $(srcdir)/Modules/pwdmodule.c $(srcdir)/Modules/posixmodule $(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGENSRCS) @$(MKDIR_P) Include $(MAKE) $(PGEN) - $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) + $(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) $(GRAMMAR_C): $(GRAMMAR_H) $(GRAMMAR_INPUT) $(PGENSRCS) $(MAKE) $(GRAMMAR_H) touch $(GRAMMAR_C) @@ -1142,7 +1145,9 @@ libainstall: all python-config # Install the dynamically loadable modules # This goes into $(exec_prefix) sharedinstall: sharedmods + CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \ + --skip-build \ --prefix=$(prefix) \ --install-scripts=$(BINDIR) \ --install-platlib=$(DESTSHARED) \ diff --git a/setup.py b/setup.py index a46bf35..528e9df 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ from distutils.command.install_lib import install_lib from distutils.spawn import find_executable -cross_compiling = "_PYTHON_HOST_PLATFORM" in os.environ +cross_compiling = ("_PYTHON_HOST_PLATFORM" in os.environ) or ('PYTHONXCPREFIX' in os.environ) def get_platform(): # cross build @@ -292,6 +292,14 @@ class PyBuildExt(build_ext): (ext.name, sys.exc_info()[1])) self.failed.append(ext.name) return + + # Inport check will not work when cross-compiling. + if os.environ.has_key('PYTHONXCPREFIX'): + self.announce( + 'WARNING: skipping inport check for cross-compiled: "%s"' % + ext.name) + return + # Workaround for Mac OS X: The Carbon-based modules cannot be # reliably imported into a command-line Python if 'Carbon' in ext.extra_link_args: