summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/gettext
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2018-01-23 00:54:13 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-01-30 12:53:16 +0000
commitf3358ab1d7e76ef263d2f86e5fd675bdebb48764 (patch)
treefeae42e17ee1339e21ae206e7ced2197841e4a85 /meta/recipes-core/gettext
parente8df21679e88200280d2e110502782568ff65f7d (diff)
downloadpoky-f3358ab1d7e76ef263d2f86e5fd675bdebb48764.tar.gz
gettext: beat library detection into shape
For reasons I can't explain gettext uses several hundred lines of convoluted m4 to find the paths to a library. If we don't tell it where to find a library it will hunt around and potentially have host contamination as /usr/lib on the host is explicitly searched. If we tell it the prefix to a library then we get bad RPATHs in the binaries (such as /usr/lib/../lib), and the search assumes that it knows best about what the library directories are under that prefix (even when it's wrong). So, replace the lookup where possible with pkg-config calls (libxml2, glib, libcroco). libunistring doens't have a pkgconfig file so just don't use the system libunistring: the library is tiny anyway. (From OE-Core rev: 1ff35fbbdd50660b86f8e254685ae0c8338b6e11) (From OE-Core rev: e6c0f8eddf8ff4a6132934a69e0f3450d4843ece) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/gettext')
-rw-r--r--meta/recipes-core/gettext/gettext-0.19.8.1/use-pkgconfig.patch321
-rw-r--r--meta/recipes-core/gettext/gettext_0.19.8.1.bb9
2 files changed, 327 insertions, 3 deletions
diff --git a/meta/recipes-core/gettext/gettext-0.19.8.1/use-pkgconfig.patch b/meta/recipes-core/gettext/gettext-0.19.8.1/use-pkgconfig.patch
new file mode 100644
index 0000000000..6156a153f7
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-0.19.8.1/use-pkgconfig.patch
@@ -0,0 +1,321 @@
1For reasons which I just can't fathom gnulib doesn't use the expected tools to
2find libraries but badly reinvents the wheel. This will trivially lead to host
3contamination (explicit searches of /usr/lib) or incorrect RPATHs (bad
4canonicalisation resulting in relative paths).
5
6Simply delete all the crazy, and replace with a single call to pkg-config.
7
8Upstream-Status: Inappropriate (upstream still refuse to consider pkg-config)
9Signed-off-by: Ross Burton <ross.burton@intel.com>
10
11diff --git a/gnulib-local/m4/libcroco.m4 b/gnulib-local/m4/libcroco.m4
12index f79ea82f1..1f67274db 100644
13--- a/gettext-tools/gnulib-m4/libcroco.m4
14+++ b/gettext-tools/gnulib-m4/libcroco.m4
15@@ -8,6 +8,7 @@ dnl From Bruno Haible.
16
17 AC_DEFUN([gl_LIBCROCO],
18 [
19+ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
20 dnl libcroco depends on libglib.
21 AC_REQUIRE([gl_LIBGLIB])
22
23@@ -23,65 +24,10 @@ AC_DEFUN([gl_LIBCROCO],
24 LTLIBCROCO=
25 INCCROCO=
26 if test "$gl_cv_libcroco_use_included" != yes; then
27- dnl Figure out whether we can use a preinstalled libcroco-0.6, or have to
28- dnl use the included one.
29- AC_CACHE_VAL([gl_cv_libcroco], [
30- gl_cv_libcroco=no
31- gl_cv_LIBCROCO=
32- gl_cv_LTLIBCROCO=
33- gl_cv_INCCROCO=
34- gl_save_LIBS="$LIBS"
35- dnl Search for libcroco and define LIBCROCO_0_6, LTLIBCROCO_0_6 and
36- dnl INCCROCO_0_6 accordingly.
37- dnl Don't use croco-0.6-config nor pkg-config, since it doesn't work when
38- dnl cross-compiling or when the C compiler in use is different from the
39- dnl one that built the library.
40- AC_LIB_LINKFLAGS_BODY([croco-0.6], [glib-2.0])
41- LIBS="$gl_save_LIBS $LIBCROCO_0_6"
42- AC_TRY_LINK([#include <libcroco-config.h>],
43- [const char *version = LIBCROCO_VERSION; return !version;],
44- [gl_cv_libcroco=yes
45- gl_cv_LIBCROCO="$LIBCROCO_0_6"
46- gl_cv_LTLIBCROCO="$LTLIBCROCO_0_6"
47- ])
48- if test "$gl_cv_libcroco" != yes; then
49- gl_save_CPPFLAGS="$CPPFLAGS"
50- CPPFLAGS="$CPPFLAGS $INCCROCO_0_6"
51- AC_TRY_LINK([#include <libcroco-config.h>],
52- [const char *version = LIBCROCO_VERSION; return !version;],
53- [gl_cv_libcroco=yes
54- gl_cv_LIBCROCO="$LIBCROCO_0_6"
55- gl_cv_LTLIBCROCO="$LTLIBCROCO_0_6"
56- gl_cv_INCCROCO="$INCCROCO_0_6"
57- ])
58- if test "$gl_cv_libcroco" != yes; then
59- dnl Often the include files are installed in
60- dnl /usr/include/libcroco-0.6/libcroco.
61- AC_TRY_LINK([#include <libcroco-0.6/libcroco/libcroco-config.h>],
62- [const char *version = LIBCROCO_VERSION; return !version;],
63- [gl_ABSOLUTE_HEADER([libcroco-0.6/libcroco/libcroco-config.h])
64- libcroco_include_dir=`echo "$gl_cv_absolute_libcroco_0_6_libcroco_libcroco_config_h" | sed -e 's,.libcroco-config\.h$,,'`
65- if test -d "$libcroco_include_dir"; then
66- gl_cv_libcroco=yes
67- gl_cv_LIBCROCO="$LIBCROCO_0_6"
68- gl_cv_LTLIBCROCO="$LTLIBCROCO_0_6"
69- gl_cv_INCCROCO="-I$libcroco_include_dir"
70- fi
71- ])
72- fi
73- CPPFLAGS="$gl_save_CPPFLAGS"
74- fi
75- LIBS="$gl_save_LIBS"
76- ])
77- AC_MSG_CHECKING([for libcroco])
78- AC_MSG_RESULT([$gl_cv_libcroco])
79- if test $gl_cv_libcroco = yes; then
80- LIBCROCO="$gl_cv_LIBCROCO"
81- LTLIBCROCO="$gl_cv_LTLIBCROCO"
82- INCCROCO="$gl_cv_INCCROCO"
83- else
84- gl_cv_libcroco_use_included=yes
85- fi
86+ PKG_CHECK_MODULES([CROCO], [libcroco-0.6])
87+ LIBCROCO=$CROCO_LIBS
88+ LTLIBCROCO=$CROCO_LIBS
89+ INCCROCO=$CROCO_CFLAGS
90 fi
91 AC_SUBST([LIBCROCO])
92 AC_SUBST([LTLIBCROCO])
93diff --git a/gnulib-local/m4/libglib.m4 b/gnulib-local/m4/libglib.m4
94index 42e55e6fd..ab25a5b22 100644
95--- a/gettext-tools/gnulib-m4/libglib.m4
96+++ b/gettext-tools/gnulib-m4/libglib.m4
97@@ -8,6 +8,7 @@ dnl From Bruno Haible.
98
99 AC_DEFUN([gl_LIBGLIB],
100 [
101+ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
102 AC_MSG_CHECKING([whether included glib is requested])
103 AC_ARG_WITH([included-glib],
104 [ --with-included-glib use the glib2 included here],
105@@ -20,76 +21,10 @@ AC_DEFUN([gl_LIBGLIB],
106 LTLIBGLIB=
107 INCGLIB=
108 if test "$gl_cv_libglib_use_included" != yes; then
109- dnl Figure out whether we can use a preinstalled libglib-2.0, or have to use
110- dnl the included one.
111- AC_CACHE_VAL([gl_cv_libglib], [
112- gl_cv_libglib=no
113- gl_cv_LIBGLIB=
114- gl_cv_LTLIBGLIB=
115- gl_cv_INCGLIB=
116- gl_save_LIBS="$LIBS"
117- dnl Search for libglib2 and define LIBGLIB_2_0, LTLIBGLIB_2_0 and
118- dnl INCGLIB_2_0 accordingly.
119- dnl Don't use glib-config nor pkg-config, since it doesn't work when
120- dnl cross-compiling or when the C compiler in use is different from the
121- dnl one that built the library.
122- AC_LIB_LINKFLAGS_BODY([glib-2.0])
123- LIBS="$gl_save_LIBS $LIBGLIB_2_0"
124- AC_TRY_LINK([#include <glib.h>
125-#ifndef G_BEGIN_DECLS
126-error this glib.h includes a glibconfig.h from a glib version 1.x
127-#endif
128-],
129- [g_string_new ("foo");],
130- [gl_cv_libglib=yes
131- gl_cv_LIBGLIB="$LIBGLIB_2_0"
132- gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0"
133- ])
134- if test "$gl_cv_libglib" != yes; then
135- gl_save_CPPFLAGS="$CPPFLAGS"
136- CPPFLAGS="$CPPFLAGS $INCGLIB_2_0"
137- AC_TRY_LINK([#include <glib.h>
138-#ifndef G_BEGIN_DECLS
139-error this glib.h includes a glibconfig.h from a glib version 1.x
140-#endif
141-],
142- [g_string_new ("foo");],
143- [gl_cv_libglib=yes
144- gl_cv_LIBGLIB="$LIBGLIB_2_0"
145- gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0"
146- gl_cv_INCGLIB="$INCGLIB_2_0"
147- ])
148- if test "$gl_cv_libglib" != yes; then
149- dnl Often the include files are installed in /usr/include/glib-2.0
150- dnl and /usr/lib/glib-2.0/include.
151- if test -n "$LIBGLIB_2_0_PREFIX"; then
152- CPPFLAGS="$gl_save_CPPFLAGS -I$LIBGLIB_2_0_PREFIX/include/glib-2.0 -I$LIBGLIB_2_0_PREFIX/$acl_libdirstem/glib-2.0/include"
153- AC_TRY_LINK([#include <glib.h>
154-#ifndef G_BEGIN_DECLS
155-error this glib.h includes a glibconfig.h from a glib version 1.x
156-#endif
157-],
158- [g_string_new ("foo");],
159- [gl_cv_libglib=yes
160- gl_cv_LIBGLIB="$LIBGLIB_2_0"
161- gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0"
162- gl_cv_INCGLIB="-I$LIBGLIB_2_0_PREFIX/include/glib-2.0 -I$LIBGLIB_2_0_PREFIX/$acl_libdirstem/glib-2.0/include"
163- ])
164- fi
165- fi
166- CPPFLAGS="$gl_save_CPPFLAGS"
167- fi
168- LIBS="$gl_save_LIBS"
169- ])
170- AC_MSG_CHECKING([for glib])
171- AC_MSG_RESULT([$gl_cv_libglib])
172- if test $gl_cv_libglib = yes; then
173- LIBGLIB="$gl_cv_LIBGLIB"
174- LTLIBGLIB="$gl_cv_LTLIBGLIB"
175- INCGLIB="$gl_cv_INCGLIB"
176- else
177- gl_cv_libglib_use_included=yes
178- fi
179+ PKG_CHECK_MODULES([GLIB], [glib-2.0])
180+ LIBGLIB="$GLIB_LIBS"
181+ LTLIBGLIB="$GLIB_LIBS"
182+ INCGLIB="$GLIB_CFLAGS"
183 fi
184 AC_SUBST([LIBGLIB])
185 AC_SUBST([LTLIBGLIB])
186diff --git a/gnulib-local/m4/libxml.m4 b/gnulib-local/m4/libxml.m4
187index 480c700d2..cb39309d5 100644
188--- a/gettext-tools/gnulib-m4/libxml.m4
189+++ b/gettext-tools/gnulib-m4/libxml.m4
190@@ -8,6 +8,7 @@ dnl From Bruno Haible.
191
192 AC_DEFUN([gl_LIBXML],
193 [
194+ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
195 AC_REQUIRE([AM_ICONV_LINK])
196
197 AC_MSG_CHECKING([whether included libxml is requested])
198@@ -22,100 +22,10 @@ AC_DEFUN([gl_LIBXML],
199 LTLIBXML=
200 INCXML=
201 if test "$gl_cv_libxml_use_included" != yes; then
202- dnl Figure out whether we can use a preinstalled libxml2, or have to use
203- dnl the included one.
204- AC_CACHE_VAL([gl_cv_libxml], [
205- gl_cv_libxml=no
206- gl_cv_LIBXML=
207- gl_cv_LTLIBXML=
208- gl_cv_INCXML=
209- gl_save_LIBS="$LIBS"
210- LIBS="$LIBS $LIBICONV"
211- dnl Search for libxml2 and define LIBXML2, LTLIBXML2 and INCXML2
212- dnl accordingly.
213- dnl Don't use xml2-config nor pkg-config, since it doesn't work when
214- dnl cross-compiling or when the C compiler in use is different from the
215- dnl one that built the library.
216- dnl Use a test program that tries to invoke xmlFree. On Cygwin 1.7.x,
217- dnl libxml2 is built in such a way that uses of xmlFree work fine with
218- dnl -Wl,--enable-auto-import but lead to a link error with
219- dnl -Wl,--disable-auto-import.
220- AC_LIB_LINKFLAGS_BODY([xml2])
221- LIBS="$gl_save_LIBS $LIBXML2 $LIBICONV"
222- AC_TRY_LINK([#include <libxml/xmlversion.h>
223- #include <libxml/xmlmemory.h>
224- #include <libxml/xpath.h>
225- ],
226- [xmlCheckVersion (0);
227- xmlFree ((void *) 0);
228- xmlXPathSetContextNode ((void *)0, (void *)0);
229- ],
230- [gl_cv_libxml=yes
231- gl_cv_LIBXML="$LIBXML2 $LIBICONV"
232- gl_cv_LTLIBXML="$LTLIBXML2 $LTLIBICONV"
233- ])
234- if test "$gl_cv_libxml" != yes; then
235- gl_save_CPPFLAGS="$CPPFLAGS"
236- CPPFLAGS="$CPPFLAGS $INCXML2"
237- AC_TRY_LINK([#include <libxml/xmlversion.h>
238- #include <libxml/xmlmemory.h>
239- #include <libxml/xpath.h>
240- ],
241- [xmlCheckVersion (0);
242- xmlFree ((void *) 0);
243- xmlXPathSetContextNode ((void *)0, (void *)0);
244- ],
245- [gl_cv_libxml=yes
246- gl_cv_LIBXML="$LIBXML2 $LIBICONV"
247- gl_cv_LTLIBXML="$LTLIBXML2 $LTLIBICONV"
248- gl_cv_INCXML="$INCXML2"
249- ])
250- if test "$gl_cv_libxml" != yes; then
251- dnl Often the include files are installed in /usr/include/libxml2.
252- dnl In libxml2-2.5, <libxml/xmlversion.h> is self-contained.
253- dnl In libxml2-2.6, it includes <libxml/xmlexports.h> which is
254- dnl self-contained.
255- libxml2_include_dir=
256- AC_TRY_CPP([#include <libxml2/libxml/xmlexports.h>],
257- [gl_ABSOLUTE_HEADER([libxml2/libxml/xmlexports.h])
258- libxml2_include_dir=`echo "$gl_cv_absolute_libxml2_libxml_xmlexports_h" | sed -e 's,.libxml.xmlexports\.h$,,'`
259- ])
260- if test -z "$libxml2_include_dir"; then
261- AC_TRY_CPP([#include <libxml2/libxml/xmlversion.h>],
262- [gl_ABSOLUTE_HEADER([libxml2/libxml/xmlversion.h])
263- libxml2_include_dir=`echo "$gl_cv_absolute_libxml2_libxml_xmlversion_h" | sed -e 's,.libxml.xmlversion\.h$,,'`
264- ])
265- fi
266- if test -n "$libxml2_include_dir" && test -d "$libxml2_include_dir"; then
267- CPPFLAGS="$gl_save_CPPFLAGS -I$libxml2_include_dir"
268- AC_TRY_LINK([#include <libxml/xmlversion.h>
269- #include <libxml/xmlmemory.h>
270- #include <libxml/xpath.h>
271- ],
272- [xmlCheckVersion (0);
273- xmlFree ((void *) 0);
274- xmlXPathSetContextNode ((void *)0, (void *)0);
275- ],
276- [gl_cv_libxml=yes
277- gl_cv_LIBXML="$LIBXML2 $LIBICONV"
278- gl_cv_LTLIBXML="$LTLIBXML2 $LTLIBICONV"
279- gl_cv_INCXML="-I$libxml2_include_dir"
280- ])
281- fi
282- fi
283- CPPFLAGS="$gl_save_CPPFLAGS"
284- fi
285- LIBS="$gl_save_LIBS"
286- ])
287- AC_MSG_CHECKING([for libxml])
288- AC_MSG_RESULT([$gl_cv_libxml])
289- if test $gl_cv_libxml = yes; then
290- LIBXML="$gl_cv_LIBXML"
291- LTLIBXML="$gl_cv_LTLIBXML"
292- INCXML="$gl_cv_INCXML"
293- else
294- gl_cv_libxml_use_included=yes
295- fi
296+ PKG_CHECK_MODULES([XML], [libxml-2.0])
297+ LIBXML=$XML_LIBS
298+ LTLIBXML=$XML_LIBS
299+ INCXML=$XML_CFLAGS
300 fi
301 AC_SUBST([LIBXML])
302 AC_SUBST([LTLIBXML])
303diff --git a/gnulib-local/lib/term-styled-ostream.oo.c b/gnulib-local/lib/term-styled-ostream.oo.c
304index 81a407467..218565329 100644
305--- a/gettext-tools/gnulib-lib/term-styled-ostream.oo.c
306+++ b/gettext-tools/gnulib-lib/term-styled-ostream.oo.c
307@@ -25,4 +25,4 @@
308-#include <cr-om-parser.h>
309-#include <cr-sel-eng.h>
310-#include <cr-style.h>
311-#include <cr-rgb.h>
312+#include <libcroco/cr-om-parser.h>
313+#include <libcroco/cr-sel-eng.h>
314+#include <libcroco/cr-style.h>
315+#include <libcroco/cr-rgb.h>
316@@ -31 +31 @@
317-# include <cr-fonts.h>
318+# include <libcroco/cr-fonts.h>
319@@ -33 +33 @@
320-#include <cr-string.h>
321+#include <libcroco/cr-string.h>
diff --git a/meta/recipes-core/gettext/gettext_0.19.8.1.bb b/meta/recipes-core/gettext/gettext_0.19.8.1.bb
index 97083c0da2..68f5cc329a 100644
--- a/meta/recipes-core/gettext/gettext_0.19.8.1.bb
+++ b/meta/recipes-core/gettext/gettext_0.19.8.1.bb
@@ -17,12 +17,13 @@ SRC_URI = "${GNU_MIRROR}/gettext/gettext-${PV}.tar.gz \
17 file://parallel.patch \ 17 file://parallel.patch \
18 file://add-with-bisonlocaledir.patch \ 18 file://add-with-bisonlocaledir.patch \
19 file://cr-statement.c-timsort.h-fix-formatting-issues.patch \ 19 file://cr-statement.c-timsort.h-fix-formatting-issues.patch \
20 file://use-pkgconfig.patch \
20" 21"
21 22
22SRC_URI[md5sum] = "97e034cf8ce5ba73a28ff6c3c0638092" 23SRC_URI[md5sum] = "97e034cf8ce5ba73a28ff6c3c0638092"
23SRC_URI[sha256sum] = "ff942af0e438ced4a8b0ea4b0b6e0d6d657157c5e2364de57baa279c1c125c43" 24SRC_URI[sha256sum] = "ff942af0e438ced4a8b0ea4b0b6e0d6d657157c5e2364de57baa279c1c125c43"
24 25
25inherit autotools texinfo 26inherit autotools texinfo pkgconfig
26 27
27EXTRA_OECONF += "--without-lispdir \ 28EXTRA_OECONF += "--without-lispdir \
28 --disable-csharp \ 29 --disable-csharp \
@@ -39,14 +40,16 @@ EXTRA_OECONF_append_class-target = " \
39 --with-bisonlocaledir=${datadir}/locale \ 40 --with-bisonlocaledir=${datadir}/locale \
40" 41"
41 42
42PACKAGECONFIG ??= "croco glib libxml libunistring" 43PACKAGECONFIG ??= "croco glib libxml"
43PACKAGECONFIG_class-native = "" 44PACKAGECONFIG_class-native = ""
44PACKAGECONFIG_class-nativesdk = "" 45PACKAGECONFIG_class-nativesdk = ""
45 46
46PACKAGECONFIG[croco] = "--without-included-libcroco,--with-included-libcroco,libcroco" 47PACKAGECONFIG[croco] = "--without-included-libcroco,--with-included-libcroco,libcroco"
47PACKAGECONFIG[glib] = "--without-included-glib,--with-included-glib,glib-2.0" 48PACKAGECONFIG[glib] = "--without-included-glib,--with-included-glib,glib-2.0"
48PACKAGECONFIG[libxml] = "--without-included-libxml,--with-included-libxml,libxml2" 49PACKAGECONFIG[libxml] = "--without-included-libxml,--with-included-libxml,libxml2"
49PACKAGECONFIG[libunistring] = "--without-included-libunistring,--with-included-libunistring,libunistring" 50# Need paths here to avoid host contamination but this can cause RPATH warnings
51# or problems if $libdir isn't $prefix/lib.
52PACKAGECONFIG[libunistring] = "--with-libunistring-prefix=${STAGING_LIBDIR}/..,--with-included-libunistring,libunistring"
50PACKAGECONFIG[msgcat-curses] = "--with-libncurses-prefix=${STAGING_LIBDIR}/..,--disable-curses,ncurses," 53PACKAGECONFIG[msgcat-curses] = "--with-libncurses-prefix=${STAGING_LIBDIR}/..,--disable-curses,ncurses,"
51 54
52acpaths = '-I ${S}/gettext-runtime/m4 \ 55acpaths = '-I ${S}/gettext-runtime/m4 \