From owner-freebsd-stable@FreeBSD.ORG Wed Sep 12 21:06:15 2012 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 46E491065686 for ; Wed, 12 Sep 2012 21:06:15 +0000 (UTC) (envelope-from jbeich@tormail.org) Received: from cpanel.centralhosts.net (cpanel.centralhosts.net [66.55.76.125]) by mx1.freebsd.org (Postfix) with ESMTP id 15F408FC1D for ; Wed, 12 Sep 2012 21:06:13 +0000 (UTC) Received: from ns4000818.ip-198-245-63.net ([198.245.63.147]:34145 helo=internal.tormail.org) by cpanel.centralhosts.net with esmtpsa (TLSv1:RC4-SHA:128) (Exim 4.77) (envelope-from ) id 1TAbiT-0000ma-Oo; Sun, 09 Sep 2012 03:14:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tormail.org; s=tm; h=Message-Id:X-TorMail-User:Content-Type:MIME-Version:References:Date:In-Reply-To:Subject:Cc:To:From; bh=TvgxCGKH83aN137W7k0W0XjRqB8hG/eiFjYxNNL7c9Y=; b=Ughga4ymrZ3VfRuVOGG2HIoZfc3JPNDr+xTeEDuaR3TwYtyYdveBLsNQLAPzxIyNZoLoPum+vobP0Rh4iB0GK4m7IdWGaLCbUUyzffESscdDEslV1q/zik8NOsJ5akZ7SB6RavNn187kvCI+BqDkAmB7mJ7MI8/ghm4bpy3ndnk=; Received: from jbeich by internal.tormail.org with local (Exim 4.63) (envelope-from ) id 1TAbjH-00087E-6x; Sun, 09 Sep 2012 07:14:57 +0000 From: Jan Beich To: Zhihao Yuan In-Reply-To: (Zhihao Yuan's message of "Sat, 8 Sep 2012 07:27:59 -0500") Date: Sun, 09 Sep 2012 00:14:24 -0700 References: <504B206E.7000409@gmx.us> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-TorMail-User: jbeich Message-Id: <1TAbjH-00087E-6x@internal.tormail.org> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cpanel.centralhosts.net X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tormail.org Cc: Gabor Kovesdan , Mike Manilone , freebsd-stable@freebsd.org Subject: Re: A BSD-licensed internationalization solution? X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Sep 2012 21:06:15 -0000 --=-=-= Content-Type: text/plain Zhihao Yuan writes: >> >> Here are many applications using GNU gettext to provide an >> internationalized user interface. But I found that there isn't a >> BSD-licensed gettext. (so BSD apps do not have internationalization?) >> >> Is there one? Then I can just switch from gettext to that. > > libintl is LGPL, we don't have license issues against it. There is BSD licensed libintl, though. It seems to work fine with GPL gettext/msgfmt tools and no recompilation (libmap.conf trick). # grep for "citrus" http://www.netbsd.org/docs/software/3rdparty/ --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=libintl_freebsd.diff Content-Description: integrate libintl into base Index: lib/Makefile =================================================================== --- lib/Makefile (revision 240180) +++ lib/Makefile (working copy) @@ -37,6 +37,7 @@ SUBDIR_ORDERED= ${_csu} \ libcrypt \ libelf \ ${_libiconv_modules} \ + ${_libintl} \ libkvm \ msun \ libmd \ @@ -166,6 +167,7 @@ _librpcsec_gss= librpcsec_gss .if ${MK_ICONV} != "no" _libiconv_modules= libiconv_modules +_libintl= libintl .endif .if ${MK_IPX} != "no" Index: lib/libc/iconv/Symbol.map =================================================================== --- lib/libc/iconv/Symbol.map (revision 240180) +++ lib/libc/iconv/Symbol.map (working copy) @@ -39,6 +39,7 @@ FBSDprivate_1.0 { _citrus_bcs_strtoul; _citrus_bcs_tolower; _citrus_bcs_toupper; + _citrus_bcs_trunc_rws_len; _citrus_bcs_trunc_ws_len; _citrus_csmapper_open; _citrus_csmapper_close; Index: lib/libintl/Makefile =================================================================== RCS file: /cvsroot/src/lib/libintl/Makefile,v retrieving revision 1.6 diff -u -p -r1.6 Makefile --- lib/libintl/Makefile 14 May 2005 17:58:56 -0000 1.6 +++ lib/libintl/Makefile 9 Sep 2012 03:46:47 -0000 @@ -1,15 +1,13 @@ # $NetBSD: Makefile,v 1.6 2005/05/14 17:58:56 tshiozak Exp $ -.include - LIB= intl +SHLIB_MAJOR= 1 SRCS= gettext.c textdomain.c gettext_iconv.c gettext_dummy.c strhash.c \ sysdep.c plural_parser.c INCS= libintl.h -INCSDIR=/usr/include +CFLAGS+=-I${.CURDIR} -I${.CURDIR}/../libc -#CFLAGS+=-g -CPPFLAGS+=-I${.CURDIR} -I${.CURDIR}/../libc +NO_WCAST_ALIGN.clang= MAN= gettext.3 MLINKS= gettext.3 dgettext.3 gettext.3 dcgettext.3 \ Index: lib/libintl/gettext.c =================================================================== RCS file: /cvsroot/src/lib/libintl/gettext.c,v retrieving revision 1.28 diff -u -p -r1.28 gettext.c --- lib/libintl/gettext.c 30 Jul 2012 23:04:42 -0000 1.28 +++ lib/libintl/gettext.c 9 Sep 2012 03:46:47 -0000 @@ -290,7 +290,9 @@ validate(void *arg, struct mohandle *moh static __inline uint32_t calc_collision_step(uint32_t hashval, uint32_t hashsize) { - _DIAGASSERT(hashsize>2); +#ifdef DIAGNOSTIC + assert(hashsize > 2); +#endif return (hashval % (hashsize - 2)) + 1; } @@ -856,7 +856,7 @@ get_indexed_string(const char *str, size } #define _NGETTEXT_DEFAULT(msgid1, msgid2, n) \ - ((char *)__UNCONST((n) == 1 ? (msgid1) : (msgid2))) + __DECONST(char *, (n) == 1 ? (msgid1) : (msgid2)) char * dcngettext(const char *domainname, const char *msgid1, const char *msgid2, @@ -970,7 +970,7 @@ found: msgid = v; } - return (char *)__UNCONST(msgid); + return __DECONST(char *, msgid); fail: return _NGETTEXT_DEFAULT(msgid1, msgid2, n); Index: lib/libintl/gettext_iconv.c =================================================================== RCS file: /cvsroot/src/lib/libintl/gettext_iconv.c,v retrieving revision 1.8 diff -u -p -r1.8 gettext_iconv.c --- lib/libintl/gettext_iconv.c 18 Feb 2009 13:08:22 -0000 1.8 +++ lib/libintl/gettext_iconv.c 9 Sep 2012 05:57:56 -0000 @@ -55,7 +55,7 @@ static void *cacheroot; /* ARGSUSED1 */ static const struct cache * -cache_find(const char *msg, struct domainbinding *db) +cache_find(const char *msg, struct domainbinding *db __unused) { struct cache key; struct cache **c; Index: lib/libintl/libintl.h =================================================================== RCS file: /cvsroot/src/lib/libintl/libintl.h,v retrieving revision 1.4 diff -u -p -r1.4 libintl.h --- lib/libintl/libintl.h 14 Oct 2011 22:42:01 -0000 1.4 +++ lib/libintl/libintl.h 9 Sep 2012 03:46:47 -0000 @@ -31,6 +31,16 @@ #include +#define gettext libintl_gettext +#define dgettext libintl_dgettext +#define dcgettext libintl_dcgettext +#define ngettext libintl_ngettext +#define dngettext libintl_dngettext +#define dcngettext libintl_dcngettext +#define textdomain libintl_textdomain +#define bindtextdomain libintl_bindtextdomain +#define bind_textdomain_codeset libintl_bind_textdomain_codeset + __BEGIN_DECLS char *gettext(const char *) __format_arg(1); char *dgettext(const char *, const char *) __format_arg(2); Index: lib/libintl/plural_parser.c =================================================================== RCS file: /cvsroot/src/lib/libintl/plural_parser.c,v retrieving revision 1.2 diff -u -p -r1.2 plural_parser.c --- lib/libintl/plural_parser.c 17 Jan 2007 23:24:22 -0000 1.2 +++ lib/libintl/plural_parser.c 9 Sep 2012 03:46:48 -0000 @@ -34,10 +34,10 @@ __RCSID("$NetBSD: plural_parser.c,v 1.2 #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include "plural_parser.h" #if defined(TEST_TOKENIZER) || defined(TEST_PARSER) @@ -893,7 +893,7 @@ region_skip_ws(struct _region *r) size_t len = _region_size(r); str = _bcs_skip_ws_len(str, &len); - _region_init(r, __UNCONST(str), len); + _region_init(r, __DECONST(void *, str), len); } static void @@ -903,7 +903,7 @@ region_trunc_rws(struct _region *r) size_t len = _region_size(r); _bcs_trunc_rws_len(str, &len); - _region_init(r, __UNCONST(str), len); + _region_init(r, __DECONST(void *, str), len); } static int @@ -1028,7 +1028,7 @@ parse_plural(struct parser_element **rpe { struct _region r; - _region_init(&r, __UNCONST(str), len); + _region_init(&r, __DECONST(void *, str), len); if (find_plural_forms(&r)) return T_NOTFOUND; @@ -1090,7 +1090,7 @@ _gettext_parse_plural(struct gettext_plu unsigned long _gettext_calculate_plural(const struct gettext_plural *pe, unsigned long n) { - return calculate_plural((void *)__UNCONST(pe), n); + return calculate_plural(__DECONST(void *, pe), n); } void Index: lib/libintl/strhash.c =================================================================== RCS file: /cvsroot/src/lib/libintl/strhash.c,v retrieving revision 1.3 diff -u -p -r1.3 strhash.c --- lib/libintl/strhash.c 25 Sep 2007 08:19:09 -0000 1.3 +++ lib/libintl/strhash.c 9 Sep 2012 03:46:48 -0000 @@ -38,7 +38,7 @@ __RCSID("$NetBSD: strhash.c,v 1.3 2007/0 /* * string hash function by P.J.Weinberger. - * this implementation is derived from src/lib/libc/citrus/citrus_db_hash.c. + * this implementation is derived from src/lib/libc/iconv/citrus_db_hash.c. */ uint32_t /*ARGSUSED*/ Index: lib/libintl/textdomain.c =================================================================== RCS file: /cvsroot/src/lib/libintl/textdomain.c,v retrieving revision 1.13 diff -u -p -r1.13 textdomain.c --- lib/libintl/textdomain.c 21 Mar 2012 10:10:36 -0000 1.13 +++ lib/libintl/textdomain.c 9 Sep 2012 03:46:48 -0000 @@ -96,7 +96,7 @@ bindtextdomain(const char *domainname, c if (p) return (p->path); else - return (char *)__UNCONST(_PATH_TEXTDOMAIN); + return __DECONST(char *, _PATH_TEXTDOMAIN); } strlcpy(p->path, dirname, sizeof(p->path)); --=-=-=--