diff options
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | Makefile.am | 15 | ||||
-rw-r--r-- | NEWS | 1 | ||||
-rwxr-xr-x | potomo | 64 | ||||
-rw-r--r-- | src/err-codes.h.in | 3 | ||||
-rw-r--r-- | src/gpg-error.c | 6 | ||||
-rw-r--r-- | src/init.c | 21 |
7 files changed, 120 insertions, 2 deletions
@@ -1,3 +1,15 @@ +2010-10-20 Werner Koch <[email protected]> + + * potomo: New. Copied from GnuPG. + * Makefile.am (install-data-hook) [W32]: New. + + * src/init.c (get_locale_dir): Strip the "bin" part. + * src/gpg-error.c (get_locale_dir): Ditto. + +2010-09-30 Werner Koch <[email protected]> + + * src/err-codes.h.in: Add GPG_ERR_FULLY_CANCELED. + 2010-09-16 Werner Koch <[email protected]> * src/w32-gettext.c (module_init): Do not set a constructur if not diff --git a/Makefile.am b/Makefile.am index e55cd9f..d0d3000 100644 --- a/Makefile.am +++ b/Makefile.am @@ -20,7 +20,8 @@ ACLOCAL_AMFLAGS = -I m4 AUTOMAKE_OPTIONS = dist-bzip2 -EXTRA_DIST = autogen.sh config.rpath libgpg-error.spec.in COPYING COPYING.LIB +EXTRA_DIST = autogen.sh config.rpath libgpg-error.spec.in COPYING COPYING.LIB \ + potomo if LANGUAGES_SOME lang_subdirs = lang @@ -36,6 +37,18 @@ dist-hook: $(top_srcdir)/libgpg-error.spec.in > $(distdir)/libgpg-error.spec @set -e; echo "$(VERSION)" > $(distdir)/VERSION +if HAVE_W32_SYSTEM +install-data-hook: + set -e; \ + for i in $$($(top_srcdir)/potomo --get-linguas $(top_srcdir)/po); do \ + $(MKDIR_P) "$(DESTDIR)$(localedir)/$$i/LC_MESSAGES" || true; \ + rm -f "$(DESTDIR)$(localedir)/$$i/LC_MESSAGES/libgpg-error.mo" \ + 2>/dev/null || true; \ + $(top_srcdir)/potomo $(top_srcdir)/po/$$i.po \ + "$(DESTDIR)$(localedir)/$$i/LC_MESSAGES/libgpg-error.mo" ; \ + done +endif + stowinstall: $(MAKE) $(AM_MAKEFLAGS) install prefix=/usr/local/stow/libgpg-error @@ -7,6 +7,7 @@ Noteworthy changes in version 1.10 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GPG_ERR_NOT_INITIALIZED NEW. GPG_ERR_MISSING_ISSUER_CERT NEW. + GPG_ERR_FULLY_CANCELED NEW. Noteworthy changes in version 1.9 (2010-07-21) @@ -0,0 +1,64 @@ +#!/bin/sh +# potomo - Convert a .po file to an utf-8 encoded .mo file. +# Copyright 2008 g10 Code GmbH +# Copyright 2010 Free Software Foundation, Inc. +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This file is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# This script is used to create the mo files for applications using +# the simple gettext implementation provided by libgpg-error. That +# gettext can only cope with utf-8 encoded mo files; thus we make this +# sure while creating the mo. A conversion is not done if the source +# file does not exist or if it is not newer than the mo file. + +if [ "$1" = "--get-linguas" -a $# -eq 2 ]; then + if [ ! -f "$2/LINGUAS" ]; then + echo "potomo: directory '$2' has no LINGUAS file" >&2 + exit 1 + fi + echo $(sed -e "/^#/d" -e "s/#.*//" "$2"/LINGUAS) + exit 0 +fi + +if [ $# -ne 2 ]; then + echo "usage: potomo INFILE.PO OUTFILE.MO" >&2 + echo " potomo --get-linguas DIR" >&2 + exit 1 +fi +infile="$1" +outfile="$2" + +if [ ! -f "$infile" ]; then + echo "potomo: '$infile' not found - ignored" 2>&1 + exit 0 +fi + +if [ "$outfile" -nt "$infile" ]; then + echo "potomo: '$outfile' is newer than source - keeping" 2>&1 + exit 0 +fi + +# Note that we could use the newer msgconv. However this tool was not +# widely available back in 2008. + +fromset=`sed -n '/^"Content-Type:/ s/.*charset=\([a-zA-Z0-9_-]*\).*/\1/p' \ + "$infile"` + +case "$fromset" in + utf8|utf-8|UTF8|UTF-8) + echo "potomo: '$infile' keeping $fromset" >&2 + msgfmt --output-file="$outfile" "$infile" + ;; + *) + echo "potomo: '$infile' converting from $fromset to utf-8" >&2 + iconv --silent --from-code=$fromset --to-code=utf-8 < "$infile" |\ + sed "/^\"Content-Type:/ s/charset=[a-zA-Z0-9_-]*/charset=utf-8/"|\ + msgfmt --output-file="$outfile" - + ;; +esac diff --git a/src/err-codes.h.in b/src/err-codes.h.in index 092880c..501c5e2 100644 --- a/src/err-codes.h.in +++ b/src/err-codes.h.in @@ -215,8 +215,9 @@ 183 GPG_ERR_LIMIT_REACHED Limit reached 184 GPG_ERR_NOT_INITIALIZED Not initialized 185 GPG_ERR_MISSING_ISSUER_CERT Missing issuer certificate -# 186 to 198 are free to be used. +# 186 to 197 are free to be used. +198 GPG_ERR_FULLY_CANCELED Operation fully cancelled 199 GPG_ERR_UNFINISHED Operation not yet finished 200 GPG_ERR_BUFFER_TOO_SHORT Buffer too short diff --git a/src/gpg-error.c b/src/gpg-error.c index 4b3c19a..fa868ae 100644 --- a/src/gpg-error.c +++ b/src/gpg-error.c @@ -131,6 +131,12 @@ get_locale_dir (void) p = strrchr (result, '\\'); if (p) *p = 0; + /* If we are installed below "bin" strip that part and + use the top directory instead. */ + p = strrchr (result, '\\'); + if (p && !strcmp (p+1, "bin")) + *p = 0; + /* Append the static part. */ strcat (result, SLDIR); } } @@ -235,6 +235,27 @@ get_locale_dir (void) p = strrchr (result, '\\'); if (p) *p = 0; + /* If we are installed below "bin" strip that part and + use the top directory instead. + + Background: Under Windows we don't install GnuPG + below bin/ but in the top directory with only share/, + lib/, and etc/ below it. One of the reasons is to + keep the the length of the filenames at bay so not to + increase the limited length of the PATH envvar. + Another and more important reason, however, is that + the very first GPG versions on W32 were installed + into a flat directory structure and for best + compatibility with these versions we didn't changed + that later. For WindowsCE we can right away install + it under bin, though. The hack with detection of the + bin directory part allows us to eventually migrate to + such a directory layout under plain Windows without + the need to change libgpg-error. */ + p = strrchr (result, '\\'); + if (p && !strcmp (p+1, "bin")) + *p = 0; + /* Append the static part. */ strcat (result, SLDIR); } } |