distribution/packages/lang/Python3/patches/Python3-0201-xcompile.patch

50 lines
1.8 KiB
Diff

--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -633,9 +633,11 @@ sharedmods: $(BUILDPYTHON) pybuilddir.tx
*) quiet="";; \
esac; \
echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
+ PYTHONXCPREFIX='$(DESTDIR)$(prefix)' \
DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" \
$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build"; \
$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
+ PYTHONXCPREFIX='$(DESTDIR)$(prefix)' \
$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
@@ -1750,8 +1752,10 @@ libainstall: @DEF_MAKE_RULE@ python-conf
# Install the dynamically loadable modules
# This goes into $(exec_prefix)
sharedinstall: all
+ CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
$(RUNSHARED) DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" \
$(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
+ --skip-build \
--prefix=$(prefix) \
--install-scripts=$(BINDIR) \
--install-platlib=$(DESTSHARED) \
--- a/setup.py
+++ b/setup.py
@@ -61,7 +61,7 @@ def get_platform():
return sys.platform
-CROSS_COMPILING = ("_PYTHON_HOST_PLATFORM" in os.environ)
+CROSS_COMPILING = ("_PYTHON_HOST_PLATFORM" in os.environ) or ('PYTHONXCPREFIX' in os.environ)
HOST_PLATFORM = get_platform()
MS_WINDOWS = (HOST_PLATFORM == 'win32')
CYGWIN = (HOST_PLATFORM == 'cygwin')
@@ -575,6 +575,13 @@ class PyBuildExt(build_ext):
ext.name, level=1)
return
+ # Import check will not work when cross-compiling.
+ if 'PYTHONXCPREFIX' in os.environ:
+ self.announce(
+ 'WARNING: skipping import 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: