diff options
Diffstat (limited to 'meta/recipes-devtools/flex/flex/crosscompile.patch')
-rw-r--r-- | meta/recipes-devtools/flex/flex/crosscompile.patch | 214 |
1 files changed, 0 insertions, 214 deletions
diff --git a/meta/recipes-devtools/flex/flex/crosscompile.patch b/meta/recipes-devtools/flex/flex/crosscompile.patch deleted file mode 100644 index 14463d93f4..0000000000 --- a/meta/recipes-devtools/flex/flex/crosscompile.patch +++ /dev/null | |||
@@ -1,214 +0,0 @@ | |||
1 | Add this patch from https://github.com/westes/flex/pull/153 with minor changes | ||
2 | to fix cross compilation. | ||
3 | |||
4 | Upstream-Status: Submitted | ||
5 | Signed-off-by: Ross Burton <ross.burton@intel.com> | ||
6 | |||
7 | From 52d4a3ca249be984614d9204dcc7b957bc04b2ac Mon Sep 17 00:00:00 2001 | ||
8 | From: Alastair Hughes <hobbitalastair@gmail.com> | ||
9 | Date: Fri, 6 Jan 2017 19:06:03 +1300 | ||
10 | Subject: [PATCH] build: support cross compiling | ||
11 | |||
12 | Check for cross compiling. If cross compiling, build stage1flex using a | ||
13 | custom link command. | ||
14 | We also override LDADD since that adds the replacement implementations | ||
15 | that are cross compiled, and instead always use the replacement library | ||
16 | implementations. | ||
17 | |||
18 | We don't use BUILD_OBJEXT and BUILD_EXEEXT since it seems that automake | ||
19 | does not support these. | ||
20 | |||
21 | Fixes #78. | ||
22 | |||
23 | Signed-off-by: Alastair Hughes <hobbitalastair@gmail.com> | ||
24 | Signed-off-by: Ross Burton <ross.burton@intel.com> | ||
25 | --- | ||
26 | configure.ac | 3 ++ | ||
27 | m4/ax_prog_cc_for_build.m4 | 125 +++++++++++++++++++++++++++++++++++++++++++++ | ||
28 | src/Makefile.am | 17 ++++++ | ||
29 | 3 files changed, 145 insertions(+) | ||
30 | create mode 100644 m4/ax_prog_cc_for_build.m4 | ||
31 | |||
32 | diff --git a/configure.ac b/configure.ac | ||
33 | index 901339f..2a7dce2 100644 | ||
34 | --- a/configure.ac | ||
35 | +++ b/configure.ac | ||
36 | @@ -42,6 +42,7 @@ AM_GNU_GETTEXT_VERSION([0.19]) | ||
37 | AC_PROG_YACC | ||
38 | AM_PROG_LEX | ||
39 | AC_PROG_CC | ||
40 | +AX_PROG_CC_FOR_BUILD | ||
41 | AC_PROG_CXX | ||
42 | AM_PROG_CC_C_O | ||
43 | AC_PROG_LN_S | ||
44 | @@ -75,6 +76,8 @@ AC_ARG_ENABLE([bootstrap], | ||
45 | [], [enable_bootstrap=yes]) | ||
46 | AM_CONDITIONAL([ENABLE_BOOTSTRAP], [test "x$enable_bootstrap" = xyes]) | ||
47 | |||
48 | +AM_CONDITIONAL([CROSS], [test "x$cross_compiling" = xyes]) | ||
49 | + | ||
50 | AC_PATH_PROG([BISON], bison, no) | ||
51 | AS_IF([test "$BISON" != no],[], | ||
52 | [ AC_SUBST([BISON], [\${top_srcdir}/build-aux/missing bison]) | ||
53 | diff --git a/m4/ax_prog_cc_for_build.m4 b/m4/ax_prog_cc_for_build.m4 | ||
54 | new file mode 100644 | ||
55 | index 0000000..77fd346 | ||
56 | --- /dev/null | ||
57 | +++ b/m4/ax_prog_cc_for_build.m4 | ||
58 | @@ -0,0 +1,125 @@ | ||
59 | +# =========================================================================== | ||
60 | +# http://www.gnu.org/software/autoconf-archive/ax_prog_cc_for_build.html | ||
61 | +# =========================================================================== | ||
62 | +# | ||
63 | +# SYNOPSIS | ||
64 | +# | ||
65 | +# AX_PROG_CC_FOR_BUILD | ||
66 | +# | ||
67 | +# DESCRIPTION | ||
68 | +# | ||
69 | +# This macro searches for a C compiler that generates native executables, | ||
70 | +# that is a C compiler that surely is not a cross-compiler. This can be | ||
71 | +# useful if you have to generate source code at compile-time like for | ||
72 | +# example GCC does. | ||
73 | +# | ||
74 | +# The macro sets the CC_FOR_BUILD and CPP_FOR_BUILD macros to anything | ||
75 | +# needed to compile or link (CC_FOR_BUILD) and preprocess (CPP_FOR_BUILD). | ||
76 | +# The value of these variables can be overridden by the user by specifying | ||
77 | +# a compiler with an environment variable (like you do for standard CC). | ||
78 | +# | ||
79 | +# It also sets BUILD_EXEEXT and BUILD_OBJEXT to the executable and object | ||
80 | +# file extensions for the build platform, and GCC_FOR_BUILD to `yes' if | ||
81 | +# the compiler we found is GCC. All these variables but GCC_FOR_BUILD are | ||
82 | +# substituted in the Makefile. | ||
83 | +# | ||
84 | +# LICENSE | ||
85 | +# | ||
86 | +# Copyright (c) 2008 Paolo Bonzini <bonzini@gnu.org> | ||
87 | +# | ||
88 | +# Copying and distribution of this file, with or without modification, are | ||
89 | +# permitted in any medium without royalty provided the copyright notice | ||
90 | +# and this notice are preserved. This file is offered as-is, without any | ||
91 | +# warranty. | ||
92 | + | ||
93 | +#serial 8 | ||
94 | + | ||
95 | +AU_ALIAS([AC_PROG_CC_FOR_BUILD], [AX_PROG_CC_FOR_BUILD]) | ||
96 | +AC_DEFUN([AX_PROG_CC_FOR_BUILD], [dnl | ||
97 | +AC_REQUIRE([AC_PROG_CC])dnl | ||
98 | +AC_REQUIRE([AC_PROG_CPP])dnl | ||
99 | +AC_REQUIRE([AC_EXEEXT])dnl | ||
100 | +AC_REQUIRE([AC_CANONICAL_HOST])dnl | ||
101 | + | ||
102 | +dnl Use the standard macros, but make them use other variable names | ||
103 | +dnl | ||
104 | +pushdef([ac_cv_prog_CPP], ac_cv_build_prog_CPP)dnl | ||
105 | +pushdef([ac_cv_prog_gcc], ac_cv_build_prog_gcc)dnl | ||
106 | +pushdef([ac_cv_prog_cc_works], ac_cv_build_prog_cc_works)dnl | ||
107 | +pushdef([ac_cv_prog_cc_cross], ac_cv_build_prog_cc_cross)dnl | ||
108 | +pushdef([ac_cv_prog_cc_g], ac_cv_build_prog_cc_g)dnl | ||
109 | +pushdef([ac_cv_exeext], ac_cv_build_exeext)dnl | ||
110 | +pushdef([ac_cv_objext], ac_cv_build_objext)dnl | ||
111 | +pushdef([ac_exeext], ac_build_exeext)dnl | ||
112 | +pushdef([ac_objext], ac_build_objext)dnl | ||
113 | +pushdef([CC], CC_FOR_BUILD)dnl | ||
114 | +pushdef([CPP], CPP_FOR_BUILD)dnl | ||
115 | +pushdef([CFLAGS], CFLAGS_FOR_BUILD)dnl | ||
116 | +pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl | ||
117 | +pushdef([LDFLAGS], LDFLAGS_FOR_BUILD)dnl | ||
118 | +pushdef([host], build)dnl | ||
119 | +pushdef([host_alias], build_alias)dnl | ||
120 | +pushdef([host_cpu], build_cpu)dnl | ||
121 | +pushdef([host_vendor], build_vendor)dnl | ||
122 | +pushdef([host_os], build_os)dnl | ||
123 | +pushdef([ac_cv_host], ac_cv_build)dnl | ||
124 | +pushdef([ac_cv_host_alias], ac_cv_build_alias)dnl | ||
125 | +pushdef([ac_cv_host_cpu], ac_cv_build_cpu)dnl | ||
126 | +pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl | ||
127 | +pushdef([ac_cv_host_os], ac_cv_build_os)dnl | ||
128 | +pushdef([ac_cpp], ac_build_cpp)dnl | ||
129 | +pushdef([ac_compile], ac_build_compile)dnl | ||
130 | +pushdef([ac_link], ac_build_link)dnl | ||
131 | + | ||
132 | +save_cross_compiling=$cross_compiling | ||
133 | +save_ac_tool_prefix=$ac_tool_prefix | ||
134 | +cross_compiling=no | ||
135 | +ac_tool_prefix= | ||
136 | + | ||
137 | +AC_PROG_CC | ||
138 | +AC_PROG_CPP | ||
139 | +AC_EXEEXT | ||
140 | + | ||
141 | +ac_tool_prefix=$save_ac_tool_prefix | ||
142 | +cross_compiling=$save_cross_compiling | ||
143 | + | ||
144 | +dnl Restore the old definitions | ||
145 | +dnl | ||
146 | +popdef([ac_link])dnl | ||
147 | +popdef([ac_compile])dnl | ||
148 | +popdef([ac_cpp])dnl | ||
149 | +popdef([ac_cv_host_os])dnl | ||
150 | +popdef([ac_cv_host_vendor])dnl | ||
151 | +popdef([ac_cv_host_cpu])dnl | ||
152 | +popdef([ac_cv_host_alias])dnl | ||
153 | +popdef([ac_cv_host])dnl | ||
154 | +popdef([host_os])dnl | ||
155 | +popdef([host_vendor])dnl | ||
156 | +popdef([host_cpu])dnl | ||
157 | +popdef([host_alias])dnl | ||
158 | +popdef([host])dnl | ||
159 | +popdef([LDFLAGS])dnl | ||
160 | +popdef([CPPFLAGS])dnl | ||
161 | +popdef([CFLAGS])dnl | ||
162 | +popdef([CPP])dnl | ||
163 | +popdef([CC])dnl | ||
164 | +popdef([ac_objext])dnl | ||
165 | +popdef([ac_exeext])dnl | ||
166 | +popdef([ac_cv_objext])dnl | ||
167 | +popdef([ac_cv_exeext])dnl | ||
168 | +popdef([ac_cv_prog_cc_g])dnl | ||
169 | +popdef([ac_cv_prog_cc_cross])dnl | ||
170 | +popdef([ac_cv_prog_cc_works])dnl | ||
171 | +popdef([ac_cv_prog_gcc])dnl | ||
172 | +popdef([ac_cv_prog_CPP])dnl | ||
173 | + | ||
174 | +dnl Finally, set Makefile variables | ||
175 | +dnl | ||
176 | +BUILD_EXEEXT=$ac_build_exeext | ||
177 | +BUILD_OBJEXT=$ac_build_objext | ||
178 | +AC_SUBST(BUILD_EXEEXT)dnl | ||
179 | +AC_SUBST(BUILD_OBJEXT)dnl | ||
180 | +AC_SUBST([CFLAGS_FOR_BUILD])dnl | ||
181 | +AC_SUBST([CPPFLAGS_FOR_BUILD])dnl | ||
182 | +AC_SUBST([LDFLAGS_FOR_BUILD])dnl | ||
183 | +]) | ||
184 | diff --git a/src/Makefile.am b/src/Makefile.am | ||
185 | index 3b5e362..05fe8d3 100644 | ||
186 | --- a/src/Makefile.am | ||
187 | +++ b/src/Makefile.am | ||
188 | @@ -22,7 +22,24 @@ stage1flex_SOURCES = \ | ||
189 | scan.l \ | ||
190 | $(COMMON_SOURCES) | ||
191 | |||
192 | +if CROSS | ||
193 | +stage1flex_LDADD = | ||
194 | +stage1flex_SOURCES += \ | ||
195 | + ../lib/malloc.c \ | ||
196 | + ../lib/realloc.c \ | ||
197 | + ../lib/reallocarray.c | ||
198 | +stage1flex_LINK = $(LIBTOOL) --tag=CC --mode=link $(CC_FOR_BUILD) \ | ||
199 | + $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ | ||
200 | + | ||
201 | +$(stage1flex_OBJECTS): CC=$(CC_FOR_BUILD) | ||
202 | +$(stage1flex_OBJECTS): CFLAGS=$(CFLAGS_FOR_BUILD) | ||
203 | +$(stage1flex_OBJECTS): CPP=$(CPP_FOR_BUILD) | ||
204 | +$(stage1flex_OBJECTS): CPPFLAGS=$(CPPFLAGS_FOR_BUILD) | ||
205 | +$(stage1flex_OBJECTS): LDFLAGS=$(LDFLAGS_FOR_BUILD) | ||
206 | +else | ||
207 | stage1flex_CFLAGS = $(AM_CFLAGS) | ||
208 | +stage1flex_LINK = $(LINK) | ||
209 | +endif | ||
210 | |||
211 | flex_SOURCES = \ | ||
212 | $(COMMON_SOURCES) | ||
213 | -- | ||
214 | 2.8.1 | ||