Patchwork [11/16] gettext: rework for osx and mingw32

login
register
mail settings
Submitter Yann Diorcet
Date Oct. 21, 2012, 3:37 p.m.
Message ID <1350833876-9499-11-git-send-email-diorcet.yann@gmail.com>
Download mbox | patch
Permalink /patch/193033/
State Accepted
Delegated to: Esben Haabendal
Headers show

Comments

Yann Diorcet - Oct. 21, 2012, 3:37 p.m.
From: Yann Diorcet <yann.diorcet@belledonne-communications.com>

---
 recipes/gettext/gettext-0.18.1.1/osx.patch |   49 ++++++++++++++++++++++++++++
 recipes/gettext/gettext.inc                |   39 +++++++++++++++++-----
 recipes/gettext/gettext_0.18.1.1.oe        |    1 +
 3 files changed, 81 insertions(+), 8 deletions(-)
 create mode 100644 recipes/gettext/gettext-0.18.1.1/osx.patch
Esben Haabendal - March 2, 2013, 4:25 p.m.
Yann Diorcet <diorcet.yann@gmail.com> writes:

> From: Yann Diorcet <yann.diorcet@belledonne-communications.com>
>
> ---
>  recipes/gettext/gettext-0.18.1.1/osx.patch |   49 ++++++++++++++++++++++++++++
>  recipes/gettext/gettext.inc                |   39 +++++++++++++++++-----
>  recipes/gettext/gettext_0.18.1.1.oe        |    1 +
>  3 files changed, 81 insertions(+), 8 deletions(-)
>  create mode 100644 recipes/gettext/gettext-0.18.1.1/osx.patch
>
> diff --git a/recipes/gettext/gettext-0.18.1.1/osx.patch b/recipes/gettext/gettext-0.18.1.1/osx.patch
> new file mode 100644
> index 0000000..7f90deb
> --- /dev/null
> +++ b/recipes/gettext/gettext-0.18.1.1/osx.patch
> @@ -0,0 +1,49 @@
> +diff -urN gettext-0.18.1.1/build-aux/install-reloc gettext-0.18.1.1.mod/build-aux/install-reloc
> +--- gettext-0.18.1.1/build-aux/install-reloc	2012-10-08 15:46:56.000000000 +0200
> ++++ gettext-0.18.1.1.mod/build-aux/install-reloc	2012-10-08 15:47:01.000000000 +0200
> +@@ -160,6 +160,8 @@
> +              "$srcdir"/canonicalize-lgpl.c \
> +              "$srcdir"/malloca.c \
> +              "$srcdir"/relocatable.c \
> ++             "$srcdir"/lstat.c \
> ++             "$srcdir"/stat.c \
> +              "$srcdir"/setenv.c \
> +              "$srcdir"/strerror.c \
> +              "$srcdir"/c-ctype.c \
> +diff -urN gettext-0.18.1.1/gettext-tools/Makefile.in gettext-0.18.1.1.mod/gettext-tools/Makefile.in
> +--- gettext-0.18.1.1/gettext-tools/Makefile.in	2010-06-06 22:12:33.000000000 +0200
> ++++ gettext-0.18.1.1.mod/gettext-tools/Makefile.in	2012-10-08 14:54:25.000000000 +0200
> +@@ -1248,7 +1248,7 @@
> + top_srcdir = @top_srcdir@
> + AUTOMAKE_OPTIONS = 1.5 gnu no-dependencies
> + ACLOCAL_AMFLAGS = -I m4 -I ../gettext-runtime/m4 -I ../m4 -I gnulib-m4 -I libgrep/gnulib-m4 -I libgettextpo/gnulib-m4
> +-SUBDIRS = doc intl gnulib-lib libgrep src libgettextpo po projects styles misc man m4 tests gnulib-tests examples
> ++SUBDIRS = doc intl gnulib-lib libgrep src libgettextpo po projects styles misc man m4 tests gnulib-tests
> + 
> + # Allow users to use "gnulib-tool --update".
> + 
> +diff -urN gettext-0.18.1.1/gettext-tools/configure gettext-0.18.1.1.mod/gettext-tools/configure
> +--- gettext-0.18.1.1/gettext-tools/configure	2010-06-06 22:12:20.000000000 +0200
> ++++ gettext-0.18.1.1.mod/gettext-tools/configure	2012-10-08 14:54:59.000000000 +0200
> +@@ -40606,7 +40606,9 @@
> + #include <stdlib.h>
> + #include <string.h> /* for strcpy */
> + /* The stpncpy prototype is missing in <string.h> on AIX 4.  */
> ++#ifndef stpncpy 
> + extern char *stpncpy (char *dest, const char *src, size_t n);
> ++#endif
> + int main () {
> +   const char *src = "Hello";
> +   char dest[10];
> +diff -urN gettext-0.18.1.1/gettext-tools/gnulib-lib/stpncpy.c gettext-0.18.1.1.mod/gettext-tools/gnulib-lib/stpncpy.c
> +--- gettext-0.18.1.1/gettext-tools/gnulib-lib/stpncpy.c	2010-05-24 11:42:47.000000000 +0200
> ++++ gettext-0.18.1.1.mod/gettext-tools/gnulib-lib/stpncpy.c	2012-10-08 15:00:12.000000000 +0200
> +@@ -25,7 +25,7 @@
> + #include <string.h>
> + 
> + #ifndef weak_alias
> +-# define __stpncpy stpncpy
> ++//# define __stpncpy stpncpy
> + #endif
> + 
> + /* Copy no more than N bytes of SRC to DST, returning a pointer past the
> diff --git a/recipes/gettext/gettext.inc b/recipes/gettext/gettext.inc
> index ae0ac8d..c54fae9 100644
> --- a/recipes/gettext/gettext.inc
> +++ b/recipes/gettext/gettext.inc
> @@ -5,13 +5,21 @@ HOMEPAGE = "http://www.gnu.org/software/gettext/gettext.html"
>  RECIPE_TYPES = "machine native sdk"
>  
>  inherit c++ autotools-autoreconf library make-vpath
> +DEPENDS_AUTORECONF = ""
>  
>  require conf/fetch/gnu.conf
>  SRC_URI = "${GNU_MIRROR}/gettext/gettext-${PV}.tar.gz"
>  
> -DEPENDS = "libiconv ${DEPENDS_HOST_OS} ${DEPENDS_SELF_NATIVE}"
> -DEPENDS_HOST_OS = "libdl libpthread libm libncurses"
> -DEPENDS_HOST_OS:HOST_OS_mingw32 = "libm libncurses"
> +DEPENDS = "libiconv ${DEPENDS_LIBDL} ${DEPENDS_LIBPTHREAD} libm ${DEPENDS_SELF_NATIVE}"
> +DEPENDS_LIBNCURSES = "libncurses"
> +DEPENDS_LIBNCURSES:TARGET_OS_mingw32 = ""
> +
> +DEPENDS_LIBDL = "libdl"
> +DEPENDS_LIBDL:TARGET_OS_mingw32 = ""
> +
> +DEPENDS_LIBPTHREAD = "libpthread"
> +DEPENDS_LIBPTHREAD:TARGET_OS_mingw32 = ""

All these TARGET_OS_mingw32 should be HOST_OS_mingw32.

> +
>  DEPENDS_SELF_NATIVE = "native:gettext"
>  DEPENDS_SELF_NATIVE:native = ""
>  
> @@ -24,7 +32,6 @@ EXTRA_OECONF += "\
>  --disable-dependency-tracking \
>  --disable-java --disable-native-java \
>  --disable-csharp \
> ---disable-nls \
>  --without-lispdir \
>  --disable-libasprintf \
>  --disable-acl \
> @@ -36,26 +43,42 @@ EXTRA_OECONF += "\
>  --without-emacs --without-git --without-cvs \
>  --with-included-glib \
>  "
> +
> +CFLAGS += "-O1"
> +
> +RECIPE_FLAGS += "nls"
> +EXTRA_OECONF += "${EXTRA_OECONF_NLS}"
> +EXTRA_OECONF_NLS = " --disable-nls"
> +EXTRA_OECONF_NLS:USE_nls = " --enable-nls"
> +EXTRA_OECONF_NLS:native = " --enable-nls"
> +EXTRA_OECONF_NLS:TARGET_OS_mingw32 = " --enable-nls"
> +EXTRA_OECONF_NLS:TARGET_OS_darwin = " --enable-nls"

TARGET_OS_mingw32 should be HOST_OS_mingw32 and TARGET_OS_darwin should
be HOST_KERNEL_darwin.

> +
>  EXTRA_OECONF += "${EXTRA_OECONF_GETTEXT}"
>  EXTRA_OECONF_GETTEXT = ""
>  EXTRA_OECONF_GETTEXT:native = "--disable-curses --with-included-gettext"
> -EXTRA_OECONF_GETTEXT:HOST_OS_mingw32 = "--with-included-gettext"
> +EXTRA_OECONF_GETTEXT:TARGET_OS_mingw32 = "--disable-curses --with-included-gettext"

s/TARGET/HOST/

>  
>  DEPENDS_${PN} = "libintl libgettextpo libgettextlib \
> -    libiconv libncurses libdl libm"
> +    libiconv ${DEPENDS_LIBNCURSES} ${DEPENDS_LIBDL} libm"
>  RDEPENDS_${PN} = "${DEPENDS_${PN}}"
>  
> +do_autoreconf () {
> +	bash ./autogen.sh --quick --skip-gnulib
> +}

I don't really like this.  Why is the do_autoreconf() from
autotools-autoreconf.oeclass not good enough?

> +
>  PACKAGES =+ "${PN}-utils"
>  FILES_${PN}-utils = "${bindir}/*"
>  FILES_${PN} += "${libdir}/gettext ${datadir}/gettext"
> +DEPENDS_${PN}-utils += "gettext"
>  
>  inherit auto-package-libs
>  AUTO_PACKAGE_LIBS = "intl gettextpo gettextlib gettextsrc"
>  AUTO_PACKAGE_LIBS_DEV_DEPENDS = "${PN}-dev_${PV}"
>  DEPENDS_${PN}-libintl += "libiconv"
>  DEPENDS_${PN}-libgettextpo += "libiconv"
> -DEPENDS_${PN}-libgettextlib += "libiconv libncurses"
> -DEPENDS_${PN}-libgettextsrc += "libgettextlib libiconv libncurses libdl libm"
> +DEPENDS_${PN}-libgettextlib += "libiconv ${DEPENDS_LIBNCURSES}"
> +DEPENDS_${PN}-libgettextsrc += "libgettextlib libiconv ${DEPENDS_LIBNCURSES} ${DEPENDS_LIBDL} libm"
>  FILES_${PN}-libintl += "${sharedlibdir}/preloadable_libintl${SOLIBSDEV}"
>  FILES_${PN}-libgettextlib += "${sharedlibdir}/libgettextlib${SOLIBSDEV}"
>  FILES_${PN}-libgettextsrc += "${sharedlibdir}/libgettextsrc${SOLIBSDEV}"
> diff --git a/recipes/gettext/gettext_0.18.1.1.oe b/recipes/gettext/gettext_0.18.1.1.oe
> index dfe630a..8918c50 100644
> --- a/recipes/gettext/gettext_0.18.1.1.oe
> +++ b/recipes/gettext/gettext_0.18.1.1.oe
> @@ -4,3 +4,4 @@ require gettext.inc
>  
>  SRC_URI += "file://ac-fix.patch"
>  SRC_URI += "file://gettext-0.18-gettextpo-woe32-memchr.patch"
> +SRC_URI:>TARGET_OS_darwin = " file://osx.patch"

s/TARGET/HOST/


/Esben
Esben Haabendal - March 2, 2013, 4:29 p.m.
Hi again

I reworked the patch a bit and have merged it to master.

/Esben

Patch

diff --git a/recipes/gettext/gettext-0.18.1.1/osx.patch b/recipes/gettext/gettext-0.18.1.1/osx.patch
new file mode 100644
index 0000000..7f90deb
--- /dev/null
+++ b/recipes/gettext/gettext-0.18.1.1/osx.patch
@@ -0,0 +1,49 @@ 
+diff -urN gettext-0.18.1.1/build-aux/install-reloc gettext-0.18.1.1.mod/build-aux/install-reloc
+--- gettext-0.18.1.1/build-aux/install-reloc	2012-10-08 15:46:56.000000000 +0200
++++ gettext-0.18.1.1.mod/build-aux/install-reloc	2012-10-08 15:47:01.000000000 +0200
+@@ -160,6 +160,8 @@
+              "$srcdir"/canonicalize-lgpl.c \
+              "$srcdir"/malloca.c \
+              "$srcdir"/relocatable.c \
++             "$srcdir"/lstat.c \
++             "$srcdir"/stat.c \
+              "$srcdir"/setenv.c \
+              "$srcdir"/strerror.c \
+              "$srcdir"/c-ctype.c \
+diff -urN gettext-0.18.1.1/gettext-tools/Makefile.in gettext-0.18.1.1.mod/gettext-tools/Makefile.in
+--- gettext-0.18.1.1/gettext-tools/Makefile.in	2010-06-06 22:12:33.000000000 +0200
++++ gettext-0.18.1.1.mod/gettext-tools/Makefile.in	2012-10-08 14:54:25.000000000 +0200
+@@ -1248,7 +1248,7 @@
+ top_srcdir = @top_srcdir@
+ AUTOMAKE_OPTIONS = 1.5 gnu no-dependencies
+ ACLOCAL_AMFLAGS = -I m4 -I ../gettext-runtime/m4 -I ../m4 -I gnulib-m4 -I libgrep/gnulib-m4 -I libgettextpo/gnulib-m4
+-SUBDIRS = doc intl gnulib-lib libgrep src libgettextpo po projects styles misc man m4 tests gnulib-tests examples
++SUBDIRS = doc intl gnulib-lib libgrep src libgettextpo po projects styles misc man m4 tests gnulib-tests
+ 
+ # Allow users to use "gnulib-tool --update".
+ 
+diff -urN gettext-0.18.1.1/gettext-tools/configure gettext-0.18.1.1.mod/gettext-tools/configure
+--- gettext-0.18.1.1/gettext-tools/configure	2010-06-06 22:12:20.000000000 +0200
++++ gettext-0.18.1.1.mod/gettext-tools/configure	2012-10-08 14:54:59.000000000 +0200
+@@ -40606,7 +40606,9 @@
+ #include <stdlib.h>
+ #include <string.h> /* for strcpy */
+ /* The stpncpy prototype is missing in <string.h> on AIX 4.  */
++#ifndef stpncpy 
+ extern char *stpncpy (char *dest, const char *src, size_t n);
++#endif
+ int main () {
+   const char *src = "Hello";
+   char dest[10];
+diff -urN gettext-0.18.1.1/gettext-tools/gnulib-lib/stpncpy.c gettext-0.18.1.1.mod/gettext-tools/gnulib-lib/stpncpy.c
+--- gettext-0.18.1.1/gettext-tools/gnulib-lib/stpncpy.c	2010-05-24 11:42:47.000000000 +0200
++++ gettext-0.18.1.1.mod/gettext-tools/gnulib-lib/stpncpy.c	2012-10-08 15:00:12.000000000 +0200
+@@ -25,7 +25,7 @@
+ #include <string.h>
+ 
+ #ifndef weak_alias
+-# define __stpncpy stpncpy
++//# define __stpncpy stpncpy
+ #endif
+ 
+ /* Copy no more than N bytes of SRC to DST, returning a pointer past the
diff --git a/recipes/gettext/gettext.inc b/recipes/gettext/gettext.inc
index ae0ac8d..c54fae9 100644
--- a/recipes/gettext/gettext.inc
+++ b/recipes/gettext/gettext.inc
@@ -5,13 +5,21 @@  HOMEPAGE = "http://www.gnu.org/software/gettext/gettext.html"
 RECIPE_TYPES = "machine native sdk"
 
 inherit c++ autotools-autoreconf library make-vpath
+DEPENDS_AUTORECONF = ""
 
 require conf/fetch/gnu.conf
 SRC_URI = "${GNU_MIRROR}/gettext/gettext-${PV}.tar.gz"
 
-DEPENDS = "libiconv ${DEPENDS_HOST_OS} ${DEPENDS_SELF_NATIVE}"
-DEPENDS_HOST_OS = "libdl libpthread libm libncurses"
-DEPENDS_HOST_OS:HOST_OS_mingw32 = "libm libncurses"
+DEPENDS = "libiconv ${DEPENDS_LIBDL} ${DEPENDS_LIBPTHREAD} libm ${DEPENDS_SELF_NATIVE}"
+DEPENDS_LIBNCURSES = "libncurses"
+DEPENDS_LIBNCURSES:TARGET_OS_mingw32 = ""
+
+DEPENDS_LIBDL = "libdl"
+DEPENDS_LIBDL:TARGET_OS_mingw32 = ""
+
+DEPENDS_LIBPTHREAD = "libpthread"
+DEPENDS_LIBPTHREAD:TARGET_OS_mingw32 = ""
+
 DEPENDS_SELF_NATIVE = "native:gettext"
 DEPENDS_SELF_NATIVE:native = ""
 
@@ -24,7 +32,6 @@  EXTRA_OECONF += "\
 --disable-dependency-tracking \
 --disable-java --disable-native-java \
 --disable-csharp \
---disable-nls \
 --without-lispdir \
 --disable-libasprintf \
 --disable-acl \
@@ -36,26 +43,42 @@  EXTRA_OECONF += "\
 --without-emacs --without-git --without-cvs \
 --with-included-glib \
 "
+
+CFLAGS += "-O1"
+
+RECIPE_FLAGS += "nls"
+EXTRA_OECONF += "${EXTRA_OECONF_NLS}"
+EXTRA_OECONF_NLS = " --disable-nls"
+EXTRA_OECONF_NLS:USE_nls = " --enable-nls"
+EXTRA_OECONF_NLS:native = " --enable-nls"
+EXTRA_OECONF_NLS:TARGET_OS_mingw32 = " --enable-nls"
+EXTRA_OECONF_NLS:TARGET_OS_darwin = " --enable-nls"
+
 EXTRA_OECONF += "${EXTRA_OECONF_GETTEXT}"
 EXTRA_OECONF_GETTEXT = ""
 EXTRA_OECONF_GETTEXT:native = "--disable-curses --with-included-gettext"
-EXTRA_OECONF_GETTEXT:HOST_OS_mingw32 = "--with-included-gettext"
+EXTRA_OECONF_GETTEXT:TARGET_OS_mingw32 = "--disable-curses --with-included-gettext"
 
 DEPENDS_${PN} = "libintl libgettextpo libgettextlib \
-    libiconv libncurses libdl libm"
+    libiconv ${DEPENDS_LIBNCURSES} ${DEPENDS_LIBDL} libm"
 RDEPENDS_${PN} = "${DEPENDS_${PN}}"
 
+do_autoreconf () {
+	bash ./autogen.sh --quick --skip-gnulib
+}
+
 PACKAGES =+ "${PN}-utils"
 FILES_${PN}-utils = "${bindir}/*"
 FILES_${PN} += "${libdir}/gettext ${datadir}/gettext"
+DEPENDS_${PN}-utils += "gettext"
 
 inherit auto-package-libs
 AUTO_PACKAGE_LIBS = "intl gettextpo gettextlib gettextsrc"
 AUTO_PACKAGE_LIBS_DEV_DEPENDS = "${PN}-dev_${PV}"
 DEPENDS_${PN}-libintl += "libiconv"
 DEPENDS_${PN}-libgettextpo += "libiconv"
-DEPENDS_${PN}-libgettextlib += "libiconv libncurses"
-DEPENDS_${PN}-libgettextsrc += "libgettextlib libiconv libncurses libdl libm"
+DEPENDS_${PN}-libgettextlib += "libiconv ${DEPENDS_LIBNCURSES}"
+DEPENDS_${PN}-libgettextsrc += "libgettextlib libiconv ${DEPENDS_LIBNCURSES} ${DEPENDS_LIBDL} libm"
 FILES_${PN}-libintl += "${sharedlibdir}/preloadable_libintl${SOLIBSDEV}"
 FILES_${PN}-libgettextlib += "${sharedlibdir}/libgettextlib${SOLIBSDEV}"
 FILES_${PN}-libgettextsrc += "${sharedlibdir}/libgettextsrc${SOLIBSDEV}"
diff --git a/recipes/gettext/gettext_0.18.1.1.oe b/recipes/gettext/gettext_0.18.1.1.oe
index dfe630a..8918c50 100644
--- a/recipes/gettext/gettext_0.18.1.1.oe
+++ b/recipes/gettext/gettext_0.18.1.1.oe
@@ -4,3 +4,4 @@  require gettext.inc
 
 SRC_URI += "file://ac-fix.patch"
 SRC_URI += "file://gettext-0.18-gettextpo-woe32-memchr.patch"
+SRC_URI:>TARGET_OS_darwin = " file://osx.patch"