distribution/packages/lang/Python3/patches/Python3-0201-xcompile.patch
fewtarius b2d76a6e53
* Deprecate and remove Python2 thanks to @CoreELEC as an upstream.
* Optimize mupen64plus, plus-nx, and yabasanshiro a bit
* Misc OS updates and bug fixes.
2022-02-27 18:34:12 -05:00

51 lines
1.9 KiB
Diff

--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -633,10 +633,12 @@ sharedmods: $(BUILDPYTHON) pybuilddir.tx
esac; \
echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
_TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
+ PYTHONXCPREFIX='$(DESTDIR)$(prefix)' \
DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" \
$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build"; \
$(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
@@ -1750,8 +1752,10 @@ libainstall: @DEF_MAKE_RULE@ python-conf
# Install the dynamically loadable modules
# This goes into $(exec_prefix)
sharedinstall: sharedmods
+ 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: