void-packages/srcpkgs/python/files/Python-2.7.6-xcompile.patch
2013-11-18 23:19:53 +01:00

105 lines
4.3 KiB
Diff

--- Makefile.pre.in
+++ Makefile.pre.in
@@ -227,6 +227,7 @@ LIBFFI_INCLUDEDIR= @LIBFFI_INCLUDEDIR@
##########################################################################
# Parser
PGEN= Parser/pgen$(EXE)
+PGEN= Parser/pgen$(EXE)
PSRCS= \
Parser/acceler.c \
@@ -593,7 +595,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)
+ $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
$(GRAMMAR_C): $(GRAMMAR_H) $(GRAMMAR_INPUT) $(PGENSRCS)
$(MAKE) $(GRAMMAR_H)
touch $(GRAMMAR_C)
@@ -1000,12 +1002,12 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
$(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
$(DESTDIR)$(LIBDEST)/distutils/tests ; \
fi
- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
$(PYTHON_FOR_BUILD) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
-d $(LIBDEST) -f \
-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
$(DESTDIR)$(LIBDEST)
- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
$(PYTHON_FOR_BUILD) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
-d $(LIBDEST) -f \
-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
@@ -1133,11 +1135,13 @@ 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) \
- --root=$(DESTDIR)/
+ --install-scripts=$(DESTDIR)$(BINDIR) \
+ --install-platlib=$(DESTDIR)$(DESTSHARED) \
+ --root=/
-rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata.py*
# Here are a couple of targets for MacOSX again, to install a full
--- setup.py.orig 2013-11-10 08:36:41.000000000 +0100
+++ setup.py 2013-11-18 21:27:27.222000786 +0100
@@ -17,7 +17,7 @@ from distutils.command.install import in
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
@@ -324,6 +324,9 @@ class PyBuildExt(build_ext):
# Don't try to load extensions for cross builds
if cross_compiling:
+ self.announce(
+ 'WARNING: skipping import check for cross-compiled: "%s"' %
+ ext.name)
return
try:
@@ -478,7 +481,7 @@ class PyBuildExt(build_ext):
for directory in reversed(options.dirs):
add_dir_to_list(dir_list, directory)
- if os.path.normpath(sys.prefix) != '/usr' \
+ if os.path.normpath(sys.prefix) != '/usr' and not cross_compiling \
and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
# OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework
# (PYTHONFRAMEWORK is set) to avoid # linking problems when
@@ -554,6 +557,11 @@ class PyBuildExt(build_ext):
if host_platform in ['darwin', 'beos']:
math_libs = []
+ # Insert libraries and headers from XBPS_CROSS_BASE
+ if 'XBPS_CROSS_BASE' in os.environ:
+ lib_dirs += [os.environ['XBPS_CROSS_BASE'] + '/usr/lib']
+ inc_dirs += [os.environ['XBPS_CROSS_BASE'] + '/usr/include']
+
# XXX Omitted modules: gl, pure, dl, SGI-specific modules
#
@@ -2020,6 +2028,11 @@ class PyBuildExt(build_ext):
# Pass empty CFLAGS because we'll just append the resulting
# CFLAGS to Python's; -g or -O2 is to be avoided.
+ if cross_compiling:
+ cmd = "cd %s && env CFLAGS='' '%s/configure' --host=%s --build=%s %s" \
+ % (ffi_builddir, ffi_srcdir, os.environ.get('HOSTARCH'),
+ os.environ.get('BUILDARCH'), " ".join(config_args))
+ else:
cmd = "cd %s && env CFLAGS='' '%s/configure' %s" \
% (ffi_builddir, ffi_srcdir, " ".join(config_args))