From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from smtprelay06.ispgateway.de ([80.67.31.102]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1RokNh-0006pH-6e for ptxdist@pengutronix.de; Sun, 22 Jan 2012 00:30:19 +0100 Received: from [93.104.153.52] (helo=galilei.fritz.box) by smtprelay06.ispgateway.de with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1RokNg-0004EO-Hp for ptxdist@pengutronix.de; Sun, 22 Jan 2012 00:29:56 +0100 From: Bernhard Walle Date: Sun, 22 Jan 2012 00:29:48 +0100 Message-Id: <1327188588-65053-1-git-send-email-bernhard@bwalle.de> Subject: [ptxdist] [PATCH] host-localedef: Fix on Darwin Reply-To: ptxdist@pengutronix.de List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: ptxdist-bounces@pengutronix.de Errors-To: ptxdist-bounces@pengutronix.de To: ptxdist@pengutronix.de 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. Signed-off-by: Bernhard Walle --- ...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 +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 +--- + 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 *); + + + /* 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 +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 +--- + 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 +-#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 +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 + 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 , and + 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 +--- + 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 ++#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 ++#else ++ ++#include ++ ++/* 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 ++#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 ++ ++/* 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 +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 +--- + 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 ]) + 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 +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 +--- + 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