python-texttable: update to 1.3.1
[void-packages.git] / srcpkgs / python / files / cross.patch
blob04a20a75dad79231582c79be402ff9426b90ea9b
1 --- Makefile.pre.in
2 +++ Makefile.pre.in
3 @@ -1000,12 +1002,12 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
4 $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
5 $(DESTDIR)$(LIBDEST)/distutils/tests ; \
6 fi
7 - PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
8 + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
9 $(PYTHON_FOR_BUILD) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
10 -d $(LIBDEST) -f \
11 -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
12 $(DESTDIR)$(LIBDEST)
13 - PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
14 + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
15 $(PYTHON_FOR_BUILD) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
16 -d $(LIBDEST) -f \
17 -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
18 @@ -1133,11 +1135,13 @@ libainstall: all python-config
19 # Install the dynamically loadable modules
20 # This goes into $(exec_prefix)
21 sharedinstall: sharedmods
22 + CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
23 $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
24 + --skip-build \
25 --prefix=$(prefix) \
26 - --install-scripts=$(BINDIR) \
27 - --install-platlib=$(DESTSHARED) \
28 - --root=$(DESTDIR)/
29 + --install-scripts=$(DESTDIR)$(BINDIR) \
30 + --install-platlib=$(DESTDIR)$(DESTSHARED) \
31 + --root=/
32 -rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata.py*
34 # Here are a couple of targets for MacOSX again, to install a full
35 --- setup.py.orig 2013-11-10 08:36:41.000000000 +0100
36 +++ setup.py 2013-11-18 21:27:27.222000786 +0100
37 @@ -17,7 +17,7 @@ from distutils.command.install import in
38 from distutils.command.install_lib import install_lib
39 from distutils.spawn import find_executable
41 -cross_compiling = "_PYTHON_HOST_PLATFORM" in os.environ
42 +cross_compiling = ("_PYTHON_HOST_PLATFORM" in os.environ) or ('PYTHONXCPREFIX' in os.environ)
44 def get_platform():
45 # cross build
46 @@ -324,6 +324,9 @@ class PyBuildExt(build_ext):
48 # Don't try to load extensions for cross builds
49 if cross_compiling:
50 + self.announce(
51 + 'WARNING: skipping import check for cross-compiled: "%s"' %
52 + ext.name)
53 return
55 try:
56 @@ -478,7 +481,7 @@ class PyBuildExt(build_ext):
57 for directory in reversed(options.dirs):
58 add_dir_to_list(dir_list, directory)
60 - if os.path.normpath(sys.prefix) != '/usr' \
61 + if os.path.normpath(sys.prefix) != '/usr' and not cross_compiling \
62 and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
63 # OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework
64 # (PYTHONFRAMEWORK is set) to avoid # linking problems when
65 @@ -554,6 +557,11 @@ class PyBuildExt(build_ext):
66 if host_platform in ['darwin', 'beos']:
67 math_libs = []
69 + # Insert libraries and headers from XBPS_CROSS_BASE
70 + if 'XBPS_CROSS_BASE' in os.environ:
71 + lib_dirs += [os.environ['XBPS_CROSS_BASE'] + '/usr/lib']
72 + inc_dirs += [os.environ['XBPS_CROSS_BASE'] + '/usr/include']
74 # XXX Omitted modules: gl, pure, dl, SGI-specific modules
77 @@ -2020,6 +2028,11 @@ class PyBuildExt(build_ext):
79 # Pass empty CFLAGS because we'll just append the resulting
80 # CFLAGS to Python's; -g or -O2 is to be avoided.
81 + if cross_compiling:
82 + cmd = "cd %s && env CFLAGS='' '%s/configure' --host=%s --build=%s %s" \
83 + % (ffi_builddir, ffi_srcdir, os.environ.get('HOSTARCH'),
84 + os.environ.get('BUILDARCH'), " ".join(config_args))
85 + else:
86 cmd = "cd %s && env CFLAGS='' '%s/configure' %s" \
87 % (ffi_builddir, ffi_srcdir, " ".join(config_args))