From: Michael Olbrich <m.olbrich@pengutronix.de>
To: ptxdist@pengutronix.de
Subject: Re: [ptxdist] [PATCH] host-localedef: Fix on Darwin
Date: Tue, 7 Feb 2012 15:46:08 +0100 [thread overview]
Message-ID: <20120207144608.GJ32645@pengutronix.de> (raw)
In-Reply-To: <1327188588-65053-1-git-send-email-bernhard@bwalle.de>
On Sun, Jan 22, 2012 at 12:29:48AM +0100, Bernhard Walle wrote:
> This patch is by far the most ugly part of all of the Darwin patches.
> At least the md5sum of a locale-archive when generating a de_DE.UTF-8
> locale is identical...
>
> A first review, please.
We're creating the localedef package anyway, so I'd like to create a new
tarball with all the paches included.
I've pushed my current WIP to git://git.pengutronix.de/git/mol/localedef.git
please test. This contains most of your patches (or modified versions). For
the gettext stuff: we already have getttext-dummy package[1]. We can create
a host-getttext-dummy package from that.
Michael
[1] http://www.pengutronix.de/software/gettext-dummy/download/gettext-dummy-1.0.1.tar.bz2
> Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
> ---
> ...n-Fix-problem-with-__block-parameter-name.patch | 33 ++++
> ...ide-dummy-implementation-of-gettext-funct.patch | 45 +++++
> ...-some-locale-related-definitions-from-Lin.patch | 182 ++++++++++++++++++++
> ...004-Darwin-Compile-with-fnested-functions.patch | 37 ++++
> ...005-Use-own-implementation-of-__rawmemchr.patch | 40 +++++
> patches/localedef-eglibc-2.11.90-ptx1/autogen.sh | 1 +
> patches/localedef-eglibc-2.11.90-ptx1/series | 8 +
> 7 files changed, 346 insertions(+), 0 deletions(-)
> create mode 100644 patches/localedef-eglibc-2.11.90-ptx1/0001-Darwin-Fix-problem-with-__block-parameter-name.patch
> create mode 100644 patches/localedef-eglibc-2.11.90-ptx1/0002-Darwin-Provide-dummy-implementation-of-gettext-funct.patch
> create mode 100644 patches/localedef-eglibc-2.11.90-ptx1/0003-Darwin-Copy-some-locale-related-definitions-from-Lin.patch
> create mode 100644 patches/localedef-eglibc-2.11.90-ptx1/0004-Darwin-Compile-with-fnested-functions.patch
> create mode 100644 patches/localedef-eglibc-2.11.90-ptx1/0005-Use-own-implementation-of-__rawmemchr.patch
> create mode 120000 patches/localedef-eglibc-2.11.90-ptx1/autogen.sh
> create mode 100644 patches/localedef-eglibc-2.11.90-ptx1/series
>
> diff --git a/patches/localedef-eglibc-2.11.90-ptx1/0001-Darwin-Fix-problem-with-__block-parameter-name.patch b/patches/localedef-eglibc-2.11.90-ptx1/0001-Darwin-Fix-problem-with-__block-parameter-name.patch
> new file mode 100644
> index 0000000..a80321e
> --- /dev/null
> +++ b/patches/localedef-eglibc-2.11.90-ptx1/0001-Darwin-Fix-problem-with-__block-parameter-name.patch
> @@ -0,0 +1,33 @@
> +From: Bernhard Walle <bernhard@bwalle.de>
> +Date: Sat, 21 Jan 2012 22:00:14 +0100
> +Subject: [PATCH] Darwin: Fix problem with __block parameter name
> +
> +This fixes the following compile error:
> +
> +-------------------- 8< ---------------------------
> +./glibc/malloc/obstack.h:190: error: __block attribute can be specified
> +on variables only
> +In file included from glibc/locale/programs/charmap.c:32:
> +-------------------- >8 ---------------------------
> +
> +Compiler war gcc-4.2 [i686-apple-darwin11-gcc-4.2.1 (GCC) 4.2.1 (Apple
> +Inc. build 5666) (dot 3)].
> +
> +Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
> +---
> + eglibc/malloc/obstack.h | 2 +-
> + 1 files changed, 1 insertions(+), 1 deletions(-)
> +
> +diff --git a/eglibc/malloc/obstack.h b/eglibc/malloc/obstack.h
> +index 449070e..0c4f2e4 100644
> +--- a/eglibc/malloc/obstack.h
> ++++ b/eglibc/malloc/obstack.h
> +@@ -187,7 +187,7 @@ extern int _obstack_begin_1 (struct obstack *, int, int,
> + void (*) (void *, void *), void *);
> + extern int _obstack_memory_used (struct obstack *);
> +
> +-void obstack_free (struct obstack *__obstack, void *__block);
> ++void obstack_free (struct obstack *__obstack, void *);
> +
> + \f
> + /* Error handler called when `obstack_chunk_alloc' failed to allocate
> diff --git a/patches/localedef-eglibc-2.11.90-ptx1/0002-Darwin-Provide-dummy-implementation-of-gettext-funct.patch b/patches/localedef-eglibc-2.11.90-ptx1/0002-Darwin-Provide-dummy-implementation-of-gettext-funct.patch
> new file mode 100644
> index 0000000..9c3f005
> --- /dev/null
> +++ b/patches/localedef-eglibc-2.11.90-ptx1/0002-Darwin-Provide-dummy-implementation-of-gettext-funct.patch
> @@ -0,0 +1,45 @@
> +From: Bernhard Walle <bernhard@bwalle.de>
> +Date: Sat, 21 Jan 2012 23:00:43 +0100
> +Subject: [PATCH] Darwin: Provide dummy implementation of gettext functions
> +
> +It's just not worth the effort requiring gettext for building locales in
> +a cross build system. English error messages are sufficient.
> +
> +Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
> +---
> + include/libintl.h | 23 ++++++++++++++++++++++-
> + 1 files changed, 22 insertions(+), 1 deletions(-)
> +
> +diff --git a/include/libintl.h b/include/libintl.h
> +index 096aa8c..edf34eb 100644
> +--- a/include/libintl.h
> ++++ b/include/libintl.h
> +@@ -1,6 +1,27 @@
> + #ifdef HAVE_LIBINTL_H
> + #include_next <libintl.h>
> +-#endif
> ++#else
> ++
> ++#ifndef LIBINTL_H_
> ++#define LIBINTL_H_ 1
> ++
> ++// dummy implementations of gettext() and textdomain()
> ++//
> ++static inline char *gettext(const char *msgid)
> ++{
> ++ return (char *)msgid;
> ++}
> ++
> ++static inline char *textdomain (const char * domainname)
> ++{
> ++ static char current_domain[1024];
> ++ strncpy(current_domain, domainname, sizeof(current_domain));
> ++ current_domain[sizeof(current_domain)-1] = '\0';
> ++ return current_domain;
> ++}
> ++
> ++#endif /* LIBINTL_H_ */
> ++#endif /* !HAVE_LIBINTL_H */
> +
> + #ifndef _
> + #define _(X) (X)
> diff --git a/patches/localedef-eglibc-2.11.90-ptx1/0003-Darwin-Copy-some-locale-related-definitions-from-Lin.patch b/patches/localedef-eglibc-2.11.90-ptx1/0003-Darwin-Copy-some-locale-related-definitions-from-Lin.patch
> new file mode 100644
> index 0000000..fad815a
> --- /dev/null
> +++ b/patches/localedef-eglibc-2.11.90-ptx1/0003-Darwin-Copy-some-locale-related-definitions-from-Lin.patch
> @@ -0,0 +1,182 @@
> +From: Bernhard Walle <bernhard@bwalle.de>
> +Date: Sat, 21 Jan 2012 23:06:49 +0100
> +Subject: [PATCH] Darwin: Copy some locale-related definitions from Linux
> +
> +Darwin lacks support for GNU locale extensions like some LC_* macros
> +like LC_PAPER, all __LC_* macros. Also we have the problem that system
> +<nl_types.h> redefines _NL_ITEM.
> +
> +The function nl_langinfo() is not used in that source code, but its
> +declaration fails on Darwin because of the missing nl_item.
> +
> +The fix adds own versions of <bits/locale.h>, <locale.h> and
> +<nl_types.h> that just contain constants, no function definitions. That
> +should be quite safe. On Linux, the header are just including system
> +headers using include_next.
> +
> +Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
> +---
> + eglibc/locale/bits/locale.h | 46 +++++++++++++++++++++++++++++++++++++++++++
> + eglibc/locale/langinfo.h | 2 +
> + eglibc/locale/locale.h | 40 +++++++++++++++++++++++++++++++++++++
> + eglibc/locale/nl_types.h | 37 ++++++++++++++++++++++++++++++++++
> + 4 files changed, 125 insertions(+), 0 deletions(-)
> + create mode 100644 eglibc/locale/bits/locale.h
> + create mode 100644 eglibc/locale/locale.h
> + create mode 100644 eglibc/locale/nl_types.h
> +
> +diff --git a/eglibc/locale/bits/locale.h b/eglibc/locale/bits/locale.h
> +new file mode 100644
> +index 0000000..aac2823
> +--- /dev/null
> ++++ b/eglibc/locale/bits/locale.h
> +@@ -0,0 +1,46 @@
> ++/* Definition of locale category symbol values.
> ++ Copyright (C) 2001 Free Software Foundation, Inc.
> ++ This file is part of the GNU C Library.
> ++
> ++ The GNU C Library is free software; you can redistribute it and/or
> ++ modify it under the terms of the GNU Lesser General Public
> ++ License as published by the Free Software Foundation; either
> ++ version 2.1 of the License, or (at your option) any later version.
> ++
> ++ The GNU C Library is distributed in the hope that it will be useful,
> ++ but WITHOUT ANY WARRANTY; without even the implied warranty of
> ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> ++ Lesser General Public License for more details.
> ++
> ++ You should have received a copy of the GNU Lesser General Public
> ++ License along with the GNU C Library; if not, write to the Free
> ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
> ++ 02111-1307 USA. */
> ++
> ++#ifdef __linux__
> ++#include_next <bits/locale.h>
> ++#else
> ++
> ++#ifndef _BITS_LOCALE_H
> ++#define _BITS_LOCALE_H 1
> ++
> ++enum
> ++{
> ++ __LC_CTYPE = 0,
> ++ __LC_NUMERIC = 1,
> ++ __LC_TIME = 2,
> ++ __LC_COLLATE = 3,
> ++ __LC_MONETARY = 4,
> ++ __LC_MESSAGES = 5,
> ++ __LC_ALL = 6,
> ++ __LC_PAPER = 7,
> ++ __LC_NAME = 8,
> ++ __LC_ADDRESS = 9,
> ++ __LC_TELEPHONE = 10,
> ++ __LC_MEASUREMENT = 11,
> ++ __LC_IDENTIFICATION = 12
> ++};
> ++
> ++#endif /* bits/locale.h */
> ++
> ++#endif /* __linux__ */
> +diff --git a/eglibc/locale/langinfo.h b/eglibc/locale/langinfo.h
> +index 0a53365..4e4480e 100644
> +--- a/eglibc/locale/langinfo.h
> ++++ b/eglibc/locale/langinfo.h
> +@@ -581,7 +581,9 @@ enum
> + The string returned will not change until `setlocale' is called;
> + it is usually in read-only memory and cannot be modified. */
> +
> ++#ifdef __linux__
> + extern char *nl_langinfo (nl_item __item) __THROW;
> ++#endif
> +
> +
> + #ifdef __USE_XOPEN2K
> +diff --git a/eglibc/locale/locale.h b/eglibc/locale/locale.h
> +new file mode 100644
> +index 0000000..9e0b2de
> +--- /dev/null
> ++++ b/eglibc/locale/locale.h
> +@@ -0,0 +1,40 @@
> ++/*
> ++ This program is free software; you can redistribute it and/or modify
> ++ it under the terms of the GNU General Public License as published
> ++ by the Free Software Foundation; version 2 of the License, or
> ++ (at your option) any later version.
> ++
> ++ This program is distributed in the hope that it will be useful,
> ++ but WITHOUT ANY WARRANTY; without even the implied warranty of
> ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> ++ GNU General Public License for more details.
> ++
> ++ You should have received a copy of the GNU General Public License
> ++ along with this program; if not, write to the Free Software Foundation,
> ++ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
> ++
> ++#ifdef __linux__
> ++#include_next <locale.h>
> ++#else
> ++
> ++#include <bits/locale.h>
> ++
> ++/* These are the possibilities for the first argument to setlocale.
> ++ The code assumes that the lowest LC_* symbol has the value zero. */
> ++#define LC_CTYPE __LC_CTYPE
> ++#define LC_NUMERIC __LC_NUMERIC
> ++#define LC_TIME __LC_TIME
> ++#define LC_COLLATE __LC_COLLATE
> ++#define LC_MONETARY __LC_MONETARY
> ++#define LC_MESSAGES __LC_MESSAGES
> ++#define LC_ALL __LC_ALL
> ++#define LC_PAPER __LC_PAPER
> ++#define LC_NAME __LC_NAME
> ++#define LC_ADDRESS __LC_ADDRESS
> ++#define LC_TELEPHONE __LC_TELEPHONE
> ++#define LC_MEASUREMENT __LC_MEASUREMENT
> ++#define LC_IDENTIFICATION __LC_IDENTIFICATION
> ++
> ++char *setlocale(int category, const char *locale);
> ++
> ++#endif /* __linux__ */
> +diff --git a/eglibc/locale/nl_types.h b/eglibc/locale/nl_types.h
> +new file mode 100644
> +index 0000000..0425604
> +--- /dev/null
> ++++ b/eglibc/locale/nl_types.h
> +@@ -0,0 +1,37 @@
> ++
> ++#ifdef __linux__
> ++#include_next <nl_types.h>
> ++#else
> ++
> ++/* Copyright (C) 1996, 1997, 1999, 2003, 2004 Free Software Foundation, Inc.
> ++ This file is part of the GNU C Library.
> ++
> ++ The GNU C Library is free software; you can redistribute it and/or
> ++ modify it under the terms of the GNU Lesser General Public
> ++ License as published by the Free Software Foundation; either
> ++ version 2.1 of the License, or (at your option) any later version.
> ++
> ++ The GNU C Library is distributed in the hope that it will be useful,
> ++ but WITHOUT ANY WARRANTY; without even the implied warranty of
> ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> ++ Lesser General Public License for more details.
> ++
> ++ You should have received a copy of the GNU Lesser General Public
> ++ License along with the GNU C Library; if not, write to the Free
> ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
> ++ 02111-1307 USA. */
> ++
> ++#ifndef _NL_TYPES_H
> ++#define _NL_TYPES_H 1
> ++
> ++#include <features.h>
> ++
> ++/* The default message set used by the gencat program. */
> ++#define NL_SETD 1
> ++
> ++/* Value for FLAG parameter of `catgets' to say we want XPG4 compliance. */
> ++#define NL_CAT_LOCALE 1
> ++
> ++#endif /* nl_types.h */
> ++
> ++#endif /* __linux__ */
> diff --git a/patches/localedef-eglibc-2.11.90-ptx1/0004-Darwin-Compile-with-fnested-functions.patch b/patches/localedef-eglibc-2.11.90-ptx1/0004-Darwin-Compile-with-fnested-functions.patch
> new file mode 100644
> index 0000000..65f6aa0
> --- /dev/null
> +++ b/patches/localedef-eglibc-2.11.90-ptx1/0004-Darwin-Compile-with-fnested-functions.patch
> @@ -0,0 +1,37 @@
> +From: Bernhard Walle <bernhard@bwalle.de>
> +Date: Sat, 21 Jan 2012 23:40:16 +0100
> +Subject: [PATCH] Darwin: Compile with -fnested-functions
> +
> +glibc/locale/programs/ld-ctype.c:2948: error: nested functions are disabled, use -fnested-functions to re-enable
> +
> +Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
> +---
> + configure.ac | 8 ++++++++
> + 1 files changed, 8 insertions(+), 0 deletions(-)
> +
> +diff --git a/configure.ac b/configure.ac
> +index 85d3ca2..6f8d4b3 100644
> +--- a/configure.ac
> ++++ b/configure.ac
> +@@ -24,6 +24,7 @@ AC_CONFIG_HEADERS([config.h])
> + AC_EXEEXT
> + AC_PROG_CC
> + AC_PROG_LN_S
> ++AC_CANONICAL_HOST
> + AC_C_BIGENDIAN([AC_DEFINE([BUILD_BYTE_ORDER], [__BIG_ENDIAN],
> + [Define to your build machine's byte order])],
> + [AC_DEFINE([BUILD_BYTE_ORDER], [__LITTLE_ENDIAN])])
> +@@ -59,6 +60,13 @@ LOCAL_CHECK_VAR([program_invocation_short_name], [#include <errno.h>])
> + AC_CHECK_LIB([intl], [gettext])
> + AC_CHECK_LIB([posix4], [nanosleep])
> +
> ++# use -fnested-functions on Mac OS
> ++case ${host_os} in
> ++darwin*)
> ++ CFLAGS="${CFLAGS} -fnested-functions"
> ++ ;;
> ++esac
> ++
> + # These two macros are taken from GCC's config/acx.m4.
> + dnl Support the --with-pkgversion configure option.
> + dnl ACX_PKGVERSION(default-pkgversion)
> diff --git a/patches/localedef-eglibc-2.11.90-ptx1/0005-Use-own-implementation-of-__rawmemchr.patch b/patches/localedef-eglibc-2.11.90-ptx1/0005-Use-own-implementation-of-__rawmemchr.patch
> new file mode 100644
> index 0000000..97956a5
> --- /dev/null
> +++ b/patches/localedef-eglibc-2.11.90-ptx1/0005-Use-own-implementation-of-__rawmemchr.patch
> @@ -0,0 +1,40 @@
> +From: Bernhard Walle <bernhard@bwalle.de>
> +Date: Sat, 21 Jan 2012 23:48:27 +0100
> +Subject: [PATCH] Use own implementation of __rawmemchr()
> +
> +rawmemchr() and its alias __rawmemchr() are non-standard function.
> +For compatibility with non-GNU platforms, use a self-implemented
> +_rawmemchr().
> +
> +Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
> +---
> + eglibc/intl/explodename.c | 9 ++++++++-
> + 1 files changed, 8 insertions(+), 1 deletions(-)
> +
> +diff --git a/eglibc/intl/explodename.c b/eglibc/intl/explodename.c
> +index 321204d..c58abad 100644
> +--- a/eglibc/intl/explodename.c
> ++++ b/eglibc/intl/explodename.c
> +@@ -50,6 +50,13 @@ _nl_find_language (name)
> + return (char *) name;
> + }
> +
> ++static char *_rawmemchr(const void *s, int c)
> ++{
> ++ char *p = (unsigned char *)s;
> ++ while (*p != c)
> ++ p++;
> ++ return p;
> ++}
> +
> + int
> + _nl_explode_name (name, language, modifier, territory, codeset,
> +@@ -78,7 +85,7 @@ _nl_explode_name (name, language, modifier, territory, codeset,
> + if (*language == cp)
> + /* This does not make sense: language has to be specified. Use
> + this entry as it is without exploding. Perhaps it is an alias. */
> +- cp = __rawmemchr (*language, '\0');
> ++ cp = _rawmemchr (*language, '\0');
> + else if (cp[0] != '@')
> + {
> + if (cp[0] == '_')
> diff --git a/patches/localedef-eglibc-2.11.90-ptx1/autogen.sh b/patches/localedef-eglibc-2.11.90-ptx1/autogen.sh
> new file mode 120000
> index 0000000..9f8a4cb
> --- /dev/null
> +++ b/patches/localedef-eglibc-2.11.90-ptx1/autogen.sh
> @@ -0,0 +1 @@
> +../autogen.sh
> \ No newline at end of file
> diff --git a/patches/localedef-eglibc-2.11.90-ptx1/series b/patches/localedef-eglibc-2.11.90-ptx1/series
> new file mode 100644
> index 0000000..f1f5d21
> --- /dev/null
> +++ b/patches/localedef-eglibc-2.11.90-ptx1/series
> @@ -0,0 +1,8 @@
> +# generated by git-ptx-patches
> +#tag:base --start-number 1
> +0001-Darwin-Fix-problem-with-__block-parameter-name.patch
> +0002-Darwin-Provide-dummy-implementation-of-gettext-funct.patch
> +0003-Darwin-Copy-some-locale-related-definitions-from-Lin.patch
> +0004-Darwin-Compile-with-fnested-functions.patch
> +0005-Use-own-implementation-of-__rawmemchr.patch
> +# fa05ef2055e4fe1c9215d7660d438608 - git-ptx-patches magic
> --
> 1.7.7.4
>
>
> --
> ptxdist mailing list
> ptxdist@pengutronix.de
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
--
ptxdist mailing list
ptxdist@pengutronix.de
next prev parent reply other threads:[~2012-02-07 14:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-21 23:29 Bernhard Walle
2012-01-23 21:29 ` Andreas Bießmann
2012-01-23 22:02 ` Bernhard Walle
2012-02-07 14:46 ` Michael Olbrich [this message]
2012-02-07 14:53 ` Bernhard Walle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120207144608.GJ32645@pengutronix.de \
--to=m.olbrich@pengutronix.de \
--cc=ptxdist@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox