mirror of
git://git.yoctoproject.org/poky
synced 2026-04-02 02:49:11 +00:00
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>
This commit is contained in:
parent
e8df21679e
commit
f3358ab1d7
321
meta/recipes-core/gettext/gettext-0.19.8.1/use-pkgconfig.patch
Normal file
321
meta/recipes-core/gettext/gettext-0.19.8.1/use-pkgconfig.patch
Normal file
@ -0,0 +1,321 @@
|
||||
For reasons which I just can't fathom gnulib doesn't use the expected tools to
|
||||
find libraries but badly reinvents the wheel. This will trivially lead to host
|
||||
contamination (explicit searches of /usr/lib) or incorrect RPATHs (bad
|
||||
canonicalisation resulting in relative paths).
|
||||
|
||||
Simply delete all the crazy, and replace with a single call to pkg-config.
|
||||
|
||||
Upstream-Status: Inappropriate (upstream still refuse to consider pkg-config)
|
||||
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
||||
|
||||
diff --git a/gnulib-local/m4/libcroco.m4 b/gnulib-local/m4/libcroco.m4
|
||||
index f79ea82f1..1f67274db 100644
|
||||
--- a/gettext-tools/gnulib-m4/libcroco.m4
|
||||
+++ b/gettext-tools/gnulib-m4/libcroco.m4
|
||||
@@ -8,6 +8,7 @@ dnl From Bruno Haible.
|
||||
|
||||
AC_DEFUN([gl_LIBCROCO],
|
||||
[
|
||||
+ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
||||
dnl libcroco depends on libglib.
|
||||
AC_REQUIRE([gl_LIBGLIB])
|
||||
|
||||
@@ -23,65 +24,10 @@ AC_DEFUN([gl_LIBCROCO],
|
||||
LTLIBCROCO=
|
||||
INCCROCO=
|
||||
if test "$gl_cv_libcroco_use_included" != yes; then
|
||||
- dnl Figure out whether we can use a preinstalled libcroco-0.6, or have to
|
||||
- dnl use the included one.
|
||||
- AC_CACHE_VAL([gl_cv_libcroco], [
|
||||
- gl_cv_libcroco=no
|
||||
- gl_cv_LIBCROCO=
|
||||
- gl_cv_LTLIBCROCO=
|
||||
- gl_cv_INCCROCO=
|
||||
- gl_save_LIBS="$LIBS"
|
||||
- dnl Search for libcroco and define LIBCROCO_0_6, LTLIBCROCO_0_6 and
|
||||
- dnl INCCROCO_0_6 accordingly.
|
||||
- dnl Don't use croco-0.6-config nor pkg-config, since it doesn't work when
|
||||
- dnl cross-compiling or when the C compiler in use is different from the
|
||||
- dnl one that built the library.
|
||||
- AC_LIB_LINKFLAGS_BODY([croco-0.6], [glib-2.0])
|
||||
- LIBS="$gl_save_LIBS $LIBCROCO_0_6"
|
||||
- AC_TRY_LINK([#include <libcroco-config.h>],
|
||||
- [const char *version = LIBCROCO_VERSION; return !version;],
|
||||
- [gl_cv_libcroco=yes
|
||||
- gl_cv_LIBCROCO="$LIBCROCO_0_6"
|
||||
- gl_cv_LTLIBCROCO="$LTLIBCROCO_0_6"
|
||||
- ])
|
||||
- if test "$gl_cv_libcroco" != yes; then
|
||||
- gl_save_CPPFLAGS="$CPPFLAGS"
|
||||
- CPPFLAGS="$CPPFLAGS $INCCROCO_0_6"
|
||||
- AC_TRY_LINK([#include <libcroco-config.h>],
|
||||
- [const char *version = LIBCROCO_VERSION; return !version;],
|
||||
- [gl_cv_libcroco=yes
|
||||
- gl_cv_LIBCROCO="$LIBCROCO_0_6"
|
||||
- gl_cv_LTLIBCROCO="$LTLIBCROCO_0_6"
|
||||
- gl_cv_INCCROCO="$INCCROCO_0_6"
|
||||
- ])
|
||||
- if test "$gl_cv_libcroco" != yes; then
|
||||
- dnl Often the include files are installed in
|
||||
- dnl /usr/include/libcroco-0.6/libcroco.
|
||||
- AC_TRY_LINK([#include <libcroco-0.6/libcroco/libcroco-config.h>],
|
||||
- [const char *version = LIBCROCO_VERSION; return !version;],
|
||||
- [gl_ABSOLUTE_HEADER([libcroco-0.6/libcroco/libcroco-config.h])
|
||||
- libcroco_include_dir=`echo "$gl_cv_absolute_libcroco_0_6_libcroco_libcroco_config_h" | sed -e 's,.libcroco-config\.h$,,'`
|
||||
- if test -d "$libcroco_include_dir"; then
|
||||
- gl_cv_libcroco=yes
|
||||
- gl_cv_LIBCROCO="$LIBCROCO_0_6"
|
||||
- gl_cv_LTLIBCROCO="$LTLIBCROCO_0_6"
|
||||
- gl_cv_INCCROCO="-I$libcroco_include_dir"
|
||||
- fi
|
||||
- ])
|
||||
- fi
|
||||
- CPPFLAGS="$gl_save_CPPFLAGS"
|
||||
- fi
|
||||
- LIBS="$gl_save_LIBS"
|
||||
- ])
|
||||
- AC_MSG_CHECKING([for libcroco])
|
||||
- AC_MSG_RESULT([$gl_cv_libcroco])
|
||||
- if test $gl_cv_libcroco = yes; then
|
||||
- LIBCROCO="$gl_cv_LIBCROCO"
|
||||
- LTLIBCROCO="$gl_cv_LTLIBCROCO"
|
||||
- INCCROCO="$gl_cv_INCCROCO"
|
||||
- else
|
||||
- gl_cv_libcroco_use_included=yes
|
||||
- fi
|
||||
+ PKG_CHECK_MODULES([CROCO], [libcroco-0.6])
|
||||
+ LIBCROCO=$CROCO_LIBS
|
||||
+ LTLIBCROCO=$CROCO_LIBS
|
||||
+ INCCROCO=$CROCO_CFLAGS
|
||||
fi
|
||||
AC_SUBST([LIBCROCO])
|
||||
AC_SUBST([LTLIBCROCO])
|
||||
diff --git a/gnulib-local/m4/libglib.m4 b/gnulib-local/m4/libglib.m4
|
||||
index 42e55e6fd..ab25a5b22 100644
|
||||
--- a/gettext-tools/gnulib-m4/libglib.m4
|
||||
+++ b/gettext-tools/gnulib-m4/libglib.m4
|
||||
@@ -8,6 +8,7 @@ dnl From Bruno Haible.
|
||||
|
||||
AC_DEFUN([gl_LIBGLIB],
|
||||
[
|
||||
+ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
||||
AC_MSG_CHECKING([whether included glib is requested])
|
||||
AC_ARG_WITH([included-glib],
|
||||
[ --with-included-glib use the glib2 included here],
|
||||
@@ -20,76 +21,10 @@ AC_DEFUN([gl_LIBGLIB],
|
||||
LTLIBGLIB=
|
||||
INCGLIB=
|
||||
if test "$gl_cv_libglib_use_included" != yes; then
|
||||
- dnl Figure out whether we can use a preinstalled libglib-2.0, or have to use
|
||||
- dnl the included one.
|
||||
- AC_CACHE_VAL([gl_cv_libglib], [
|
||||
- gl_cv_libglib=no
|
||||
- gl_cv_LIBGLIB=
|
||||
- gl_cv_LTLIBGLIB=
|
||||
- gl_cv_INCGLIB=
|
||||
- gl_save_LIBS="$LIBS"
|
||||
- dnl Search for libglib2 and define LIBGLIB_2_0, LTLIBGLIB_2_0 and
|
||||
- dnl INCGLIB_2_0 accordingly.
|
||||
- dnl Don't use glib-config nor pkg-config, since it doesn't work when
|
||||
- dnl cross-compiling or when the C compiler in use is different from the
|
||||
- dnl one that built the library.
|
||||
- AC_LIB_LINKFLAGS_BODY([glib-2.0])
|
||||
- LIBS="$gl_save_LIBS $LIBGLIB_2_0"
|
||||
- AC_TRY_LINK([#include <glib.h>
|
||||
-#ifndef G_BEGIN_DECLS
|
||||
-error this glib.h includes a glibconfig.h from a glib version 1.x
|
||||
-#endif
|
||||
-],
|
||||
- [g_string_new ("foo");],
|
||||
- [gl_cv_libglib=yes
|
||||
- gl_cv_LIBGLIB="$LIBGLIB_2_0"
|
||||
- gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0"
|
||||
- ])
|
||||
- if test "$gl_cv_libglib" != yes; then
|
||||
- gl_save_CPPFLAGS="$CPPFLAGS"
|
||||
- CPPFLAGS="$CPPFLAGS $INCGLIB_2_0"
|
||||
- AC_TRY_LINK([#include <glib.h>
|
||||
-#ifndef G_BEGIN_DECLS
|
||||
-error this glib.h includes a glibconfig.h from a glib version 1.x
|
||||
-#endif
|
||||
-],
|
||||
- [g_string_new ("foo");],
|
||||
- [gl_cv_libglib=yes
|
||||
- gl_cv_LIBGLIB="$LIBGLIB_2_0"
|
||||
- gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0"
|
||||
- gl_cv_INCGLIB="$INCGLIB_2_0"
|
||||
- ])
|
||||
- if test "$gl_cv_libglib" != yes; then
|
||||
- dnl Often the include files are installed in /usr/include/glib-2.0
|
||||
- dnl and /usr/lib/glib-2.0/include.
|
||||
- if test -n "$LIBGLIB_2_0_PREFIX"; then
|
||||
- CPPFLAGS="$gl_save_CPPFLAGS -I$LIBGLIB_2_0_PREFIX/include/glib-2.0 -I$LIBGLIB_2_0_PREFIX/$acl_libdirstem/glib-2.0/include"
|
||||
- AC_TRY_LINK([#include <glib.h>
|
||||
-#ifndef G_BEGIN_DECLS
|
||||
-error this glib.h includes a glibconfig.h from a glib version 1.x
|
||||
-#endif
|
||||
-],
|
||||
- [g_string_new ("foo");],
|
||||
- [gl_cv_libglib=yes
|
||||
- gl_cv_LIBGLIB="$LIBGLIB_2_0"
|
||||
- gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0"
|
||||
- gl_cv_INCGLIB="-I$LIBGLIB_2_0_PREFIX/include/glib-2.0 -I$LIBGLIB_2_0_PREFIX/$acl_libdirstem/glib-2.0/include"
|
||||
- ])
|
||||
- fi
|
||||
- fi
|
||||
- CPPFLAGS="$gl_save_CPPFLAGS"
|
||||
- fi
|
||||
- LIBS="$gl_save_LIBS"
|
||||
- ])
|
||||
- AC_MSG_CHECKING([for glib])
|
||||
- AC_MSG_RESULT([$gl_cv_libglib])
|
||||
- if test $gl_cv_libglib = yes; then
|
||||
- LIBGLIB="$gl_cv_LIBGLIB"
|
||||
- LTLIBGLIB="$gl_cv_LTLIBGLIB"
|
||||
- INCGLIB="$gl_cv_INCGLIB"
|
||||
- else
|
||||
- gl_cv_libglib_use_included=yes
|
||||
- fi
|
||||
+ PKG_CHECK_MODULES([GLIB], [glib-2.0])
|
||||
+ LIBGLIB="$GLIB_LIBS"
|
||||
+ LTLIBGLIB="$GLIB_LIBS"
|
||||
+ INCGLIB="$GLIB_CFLAGS"
|
||||
fi
|
||||
AC_SUBST([LIBGLIB])
|
||||
AC_SUBST([LTLIBGLIB])
|
||||
diff --git a/gnulib-local/m4/libxml.m4 b/gnulib-local/m4/libxml.m4
|
||||
index 480c700d2..cb39309d5 100644
|
||||
--- a/gettext-tools/gnulib-m4/libxml.m4
|
||||
+++ b/gettext-tools/gnulib-m4/libxml.m4
|
||||
@@ -8,6 +8,7 @@ dnl From Bruno Haible.
|
||||
|
||||
AC_DEFUN([gl_LIBXML],
|
||||
[
|
||||
+ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
||||
AC_REQUIRE([AM_ICONV_LINK])
|
||||
|
||||
AC_MSG_CHECKING([whether included libxml is requested])
|
||||
@@ -22,100 +22,10 @@ AC_DEFUN([gl_LIBXML],
|
||||
LTLIBXML=
|
||||
INCXML=
|
||||
if test "$gl_cv_libxml_use_included" != yes; then
|
||||
- dnl Figure out whether we can use a preinstalled libxml2, or have to use
|
||||
- dnl the included one.
|
||||
- AC_CACHE_VAL([gl_cv_libxml], [
|
||||
- gl_cv_libxml=no
|
||||
- gl_cv_LIBXML=
|
||||
- gl_cv_LTLIBXML=
|
||||
- gl_cv_INCXML=
|
||||
- gl_save_LIBS="$LIBS"
|
||||
- LIBS="$LIBS $LIBICONV"
|
||||
- dnl Search for libxml2 and define LIBXML2, LTLIBXML2 and INCXML2
|
||||
- dnl accordingly.
|
||||
- dnl Don't use xml2-config nor pkg-config, since it doesn't work when
|
||||
- dnl cross-compiling or when the C compiler in use is different from the
|
||||
- dnl one that built the library.
|
||||
- dnl Use a test program that tries to invoke xmlFree. On Cygwin 1.7.x,
|
||||
- dnl libxml2 is built in such a way that uses of xmlFree work fine with
|
||||
- dnl -Wl,--enable-auto-import but lead to a link error with
|
||||
- dnl -Wl,--disable-auto-import.
|
||||
- AC_LIB_LINKFLAGS_BODY([xml2])
|
||||
- LIBS="$gl_save_LIBS $LIBXML2 $LIBICONV"
|
||||
- AC_TRY_LINK([#include <libxml/xmlversion.h>
|
||||
- #include <libxml/xmlmemory.h>
|
||||
- #include <libxml/xpath.h>
|
||||
- ],
|
||||
- [xmlCheckVersion (0);
|
||||
- xmlFree ((void *) 0);
|
||||
- xmlXPathSetContextNode ((void *)0, (void *)0);
|
||||
- ],
|
||||
- [gl_cv_libxml=yes
|
||||
- gl_cv_LIBXML="$LIBXML2 $LIBICONV"
|
||||
- gl_cv_LTLIBXML="$LTLIBXML2 $LTLIBICONV"
|
||||
- ])
|
||||
- if test "$gl_cv_libxml" != yes; then
|
||||
- gl_save_CPPFLAGS="$CPPFLAGS"
|
||||
- CPPFLAGS="$CPPFLAGS $INCXML2"
|
||||
- AC_TRY_LINK([#include <libxml/xmlversion.h>
|
||||
- #include <libxml/xmlmemory.h>
|
||||
- #include <libxml/xpath.h>
|
||||
- ],
|
||||
- [xmlCheckVersion (0);
|
||||
- xmlFree ((void *) 0);
|
||||
- xmlXPathSetContextNode ((void *)0, (void *)0);
|
||||
- ],
|
||||
- [gl_cv_libxml=yes
|
||||
- gl_cv_LIBXML="$LIBXML2 $LIBICONV"
|
||||
- gl_cv_LTLIBXML="$LTLIBXML2 $LTLIBICONV"
|
||||
- gl_cv_INCXML="$INCXML2"
|
||||
- ])
|
||||
- if test "$gl_cv_libxml" != yes; then
|
||||
- dnl Often the include files are installed in /usr/include/libxml2.
|
||||
- dnl In libxml2-2.5, <libxml/xmlversion.h> is self-contained.
|
||||
- dnl In libxml2-2.6, it includes <libxml/xmlexports.h> which is
|
||||
- dnl self-contained.
|
||||
- libxml2_include_dir=
|
||||
- AC_TRY_CPP([#include <libxml2/libxml/xmlexports.h>],
|
||||
- [gl_ABSOLUTE_HEADER([libxml2/libxml/xmlexports.h])
|
||||
- libxml2_include_dir=`echo "$gl_cv_absolute_libxml2_libxml_xmlexports_h" | sed -e 's,.libxml.xmlexports\.h$,,'`
|
||||
- ])
|
||||
- if test -z "$libxml2_include_dir"; then
|
||||
- AC_TRY_CPP([#include <libxml2/libxml/xmlversion.h>],
|
||||
- [gl_ABSOLUTE_HEADER([libxml2/libxml/xmlversion.h])
|
||||
- libxml2_include_dir=`echo "$gl_cv_absolute_libxml2_libxml_xmlversion_h" | sed -e 's,.libxml.xmlversion\.h$,,'`
|
||||
- ])
|
||||
- fi
|
||||
- if test -n "$libxml2_include_dir" && test -d "$libxml2_include_dir"; then
|
||||
- CPPFLAGS="$gl_save_CPPFLAGS -I$libxml2_include_dir"
|
||||
- AC_TRY_LINK([#include <libxml/xmlversion.h>
|
||||
- #include <libxml/xmlmemory.h>
|
||||
- #include <libxml/xpath.h>
|
||||
- ],
|
||||
- [xmlCheckVersion (0);
|
||||
- xmlFree ((void *) 0);
|
||||
- xmlXPathSetContextNode ((void *)0, (void *)0);
|
||||
- ],
|
||||
- [gl_cv_libxml=yes
|
||||
- gl_cv_LIBXML="$LIBXML2 $LIBICONV"
|
||||
- gl_cv_LTLIBXML="$LTLIBXML2 $LTLIBICONV"
|
||||
- gl_cv_INCXML="-I$libxml2_include_dir"
|
||||
- ])
|
||||
- fi
|
||||
- fi
|
||||
- CPPFLAGS="$gl_save_CPPFLAGS"
|
||||
- fi
|
||||
- LIBS="$gl_save_LIBS"
|
||||
- ])
|
||||
- AC_MSG_CHECKING([for libxml])
|
||||
- AC_MSG_RESULT([$gl_cv_libxml])
|
||||
- if test $gl_cv_libxml = yes; then
|
||||
- LIBXML="$gl_cv_LIBXML"
|
||||
- LTLIBXML="$gl_cv_LTLIBXML"
|
||||
- INCXML="$gl_cv_INCXML"
|
||||
- else
|
||||
- gl_cv_libxml_use_included=yes
|
||||
- fi
|
||||
+ PKG_CHECK_MODULES([XML], [libxml-2.0])
|
||||
+ LIBXML=$XML_LIBS
|
||||
+ LTLIBXML=$XML_LIBS
|
||||
+ INCXML=$XML_CFLAGS
|
||||
fi
|
||||
AC_SUBST([LIBXML])
|
||||
AC_SUBST([LTLIBXML])
|
||||
diff --git a/gnulib-local/lib/term-styled-ostream.oo.c b/gnulib-local/lib/term-styled-ostream.oo.c
|
||||
index 81a407467..218565329 100644
|
||||
--- a/gettext-tools/gnulib-lib/term-styled-ostream.oo.c
|
||||
+++ b/gettext-tools/gnulib-lib/term-styled-ostream.oo.c
|
||||
@@ -25,4 +25,4 @@
|
||||
-#include <cr-om-parser.h>
|
||||
-#include <cr-sel-eng.h>
|
||||
-#include <cr-style.h>
|
||||
-#include <cr-rgb.h>
|
||||
+#include <libcroco/cr-om-parser.h>
|
||||
+#include <libcroco/cr-sel-eng.h>
|
||||
+#include <libcroco/cr-style.h>
|
||||
+#include <libcroco/cr-rgb.h>
|
||||
@@ -31 +31 @@
|
||||
-# include <cr-fonts.h>
|
||||
+# include <libcroco/cr-fonts.h>
|
||||
@@ -33 +33 @@
|
||||
-#include <cr-string.h>
|
||||
+#include <libcroco/cr-string.h>
|
||||
@ -17,12 +17,13 @@ SRC_URI = "${GNU_MIRROR}/gettext/gettext-${PV}.tar.gz \
|
||||
file://parallel.patch \
|
||||
file://add-with-bisonlocaledir.patch \
|
||||
file://cr-statement.c-timsort.h-fix-formatting-issues.patch \
|
||||
file://use-pkgconfig.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "97e034cf8ce5ba73a28ff6c3c0638092"
|
||||
SRC_URI[sha256sum] = "ff942af0e438ced4a8b0ea4b0b6e0d6d657157c5e2364de57baa279c1c125c43"
|
||||
|
||||
inherit autotools texinfo
|
||||
inherit autotools texinfo pkgconfig
|
||||
|
||||
EXTRA_OECONF += "--without-lispdir \
|
||||
--disable-csharp \
|
||||
@ -39,14 +40,16 @@ EXTRA_OECONF_append_class-target = " \
|
||||
--with-bisonlocaledir=${datadir}/locale \
|
||||
"
|
||||
|
||||
PACKAGECONFIG ??= "croco glib libxml libunistring"
|
||||
PACKAGECONFIG ??= "croco glib libxml"
|
||||
PACKAGECONFIG_class-native = ""
|
||||
PACKAGECONFIG_class-nativesdk = ""
|
||||
|
||||
PACKAGECONFIG[croco] = "--without-included-libcroco,--with-included-libcroco,libcroco"
|
||||
PACKAGECONFIG[glib] = "--without-included-glib,--with-included-glib,glib-2.0"
|
||||
PACKAGECONFIG[libxml] = "--without-included-libxml,--with-included-libxml,libxml2"
|
||||
PACKAGECONFIG[libunistring] = "--without-included-libunistring,--with-included-libunistring,libunistring"
|
||||
# Need paths here to avoid host contamination but this can cause RPATH warnings
|
||||
# or problems if $libdir isn't $prefix/lib.
|
||||
PACKAGECONFIG[libunistring] = "--with-libunistring-prefix=${STAGING_LIBDIR}/..,--with-included-libunistring,libunistring"
|
||||
PACKAGECONFIG[msgcat-curses] = "--with-libncurses-prefix=${STAGING_LIBDIR}/..,--disable-curses,ncurses,"
|
||||
|
||||
acpaths = '-I ${S}/gettext-runtime/m4 \
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user