summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python/python/01-use-proper-tools-for-cross-build.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/python/python/01-use-proper-tools-for-cross-build.patch')
-rw-r--r--meta/recipes-devtools/python/python/01-use-proper-tools-for-cross-build.patch116
1 files changed, 116 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python/01-use-proper-tools-for-cross-build.patch b/meta/recipes-devtools/python/python/01-use-proper-tools-for-cross-build.patch
new file mode 100644
index 0000000000..e89faa4fb0
--- /dev/null
+++ b/meta/recipes-devtools/python/python/01-use-proper-tools-for-cross-build.patch
@@ -0,0 +1,116 @@
1# We need to ensure our host tools get run during build, not the freshly
2# built cross-tools (this will not work), so we introduce HOSTPYTHON and HOSTPGEN.
3# Signed-Off: Michael 'Mickey' Lauer <mickey@vanille-media.de>
4
5Index: Python-2.6.1/Makefile.pre.in
6===================================================================
7--- Python-2.6.1.orig/Makefile.pre.in
8+++ Python-2.6.1/Makefile.pre.in
9@@ -175,6 +175,7 @@ UNICODE_OBJS= @UNICODE_OBJS@
10
11 PYTHON= python$(EXE)
12 BUILDPYTHON= python$(BUILDEXE)
13+HOSTPYTHON= $(BUILDPYTHON)
14
15 # The task to run while instrument when building the profile-opt target
16 PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
17@@ -205,7 +206,7 @@ GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
18 ##########################################################################
19 # Parser
20 PGEN= Parser/pgen$(EXE)
21-
22+HOSTPGEN= $(PGEN)$(EXE)
23 POBJS= \
24 Parser/acceler.o \
25 Parser/grammar1.o \
26@@ -394,8 +395,8 @@ platform: $(BUILDPYTHON)
27 # Build the shared modules
28 sharedmods: $(BUILDPYTHON)
29 @case $$MAKEFLAGS in \
30- *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
31- *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
32+ *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \
33+ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \
34 esac
35
36 # Build static library
37@@ -513,7 +514,7 @@ Modules/python.o: $(srcdir)/Modules/pyth
38
39 $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
40 -@$(INSTALL) -d Include
41- -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
42+ -$(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
43
44 $(PGEN): $(PGENOBJS)
45 $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
46@@ -879,23 +880,23 @@ libinstall: build_all $(srcdir)/Lib/$(PL
47 done
48 $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
49 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
50- ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
51+ $(HOSTPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
52 -d $(LIBDEST) -f \
53 -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
54 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
55- ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
56+ $(HOSTPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
57 -d $(LIBDEST) -f \
58 -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
59 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
60- ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
61+ $(HOSTPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
62 -d $(LIBDEST)/site-packages -f \
63 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
64 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
65- ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
66+ $(HOSTPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
67 -d $(LIBDEST)/site-packages -f \
68 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
69 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
70- ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
71+ $(HOSTPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
72
73 # Create the PLATDIR source directory, if one wasn't distributed..
74 $(srcdir)/Lib/$(PLATDIR):
75@@ -993,7 +994,7 @@ libainstall: all
76 # Install the dynamically loadable modules
77 # This goes into $(exec_prefix)
78 sharedinstall:
79- $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
80+ $(RUNSHARED) $(HOSTPYTHON) -E $(srcdir)/setup.py install \
81 --prefix=$(prefix) \
82 --install-scripts=$(BINDIR) \
83 --install-platlib=$(DESTSHARED) \
84Index: Python-2.6.1/setup.py
85===================================================================
86--- Python-2.6.1.orig/setup.py
87+++ Python-2.6.1/setup.py
88@@ -276,6 +276,7 @@ class PyBuildExt(build_ext):
89 self.failed.append(ext.name)
90 self.announce('*** WARNING: renaming "%s" since importing it'
91 ' failed: %s' % (ext.name, why), level=3)
92+ return
93 assert not self.inplace
94 basename, tail = os.path.splitext(ext_filename)
95 newname = basename + "_failed" + tail
96@@ -310,8 +311,8 @@ class PyBuildExt(build_ext):
97
98 def detect_modules(self):
99 # Ensure that /usr/local is always used
100- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
101- add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
102+ # add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
103+ # add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
104
105 # Add paths specified in the environment variables LDFLAGS and
106 # CPPFLAGS for header and library files.
107@@ -410,6 +411,9 @@ class PyBuildExt(build_ext):
108
109 # XXX Omitted modules: gl, pure, dl, SGI-specific modules
110
111+ lib_dirs = [ os.getenv( "STAGING_LIBDIR" ) ]
112+ inc_dirs = [ os.getenv( "STAGING_INCDIR" ) ]
113+
114 #
115 # The following modules are all pretty straightforward, and compile
116 # on pretty much any POSIXish platform.