[svn] GnuPG - r5458 - in trunk: . scripts
svn author wk
cvs at cvs.gnupg.org
Mon Oct 18 20:19:45 CEST 2010
Author: wk
Date: 2010-10-18 20:19:45 +0200 (Mon, 18 Oct 2010)
New Revision: 5458
Added:
trunk/scripts/potomo
Modified:
trunk/ChangeLog
trunk/Makefile.am
Log:
Install the mo files on W32 platforms
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2010-10-18 15:17:23 UTC (rev 5457)
+++ trunk/ChangeLog 2010-10-18 18:19:45 UTC (rev 5458)
@@ -1,3 +1,7 @@
+2010-10-18 Werner Koch <wk at g10code.com>
+
+ * Makefile.am (install-data-hook): Add W32 specific hook.
+
2010-10-08 Werner Koch <wk at g10code.com>
* configure.ac: Add option --enable-dirmngr-auto-start.
Modified: trunk/Makefile.am
===================================================================
--- trunk/Makefile.am 2010-10-18 15:17:23 UTC (rev 5457)
+++ trunk/Makefile.am 2010-10-18 18:19:45 UTC (rev 5458)
@@ -22,7 +22,7 @@
AUTOMAKE_OPTIONS = dist-bzip2 no-dist-gzip
DISTCHECK_CONFIGURE_FLAGS = --enable-symcryptrun --enable-mailto
-EXTRA_DIST = scripts/config.rpath autogen.sh README.SVN
+EXTRA_DIST = scripts/config.rpath scripts/potomo autogen.sh README.SVN
DISTCLEANFILES = g10defs.h
if BUILD_GPGSM
@@ -93,7 +93,19 @@
dist-hook:
echo "$(VERSION)" > $(distdir)/VERSION
+if HAVE_W32_SYSTEM
+install-data-hook:
+ set -e; \
+ for i in $$($(top_srcdir)/scripts/potomo \
+ --get-linguas $(top_srcdir)/po) ; do \
+ $(MKDIR_P) "$(DESTDIR)$(localedir)/$$i/LC_MESSAGES" || true; \
+ rm -f "$(DESTDIR)$(localedir)/$$i/LC_MESSAGES/gnupg2.mo" \
+ 2>/dev/null || true; \
+ $(top_srcdir)/scripts/potomo $(top_srcdir)/po/$$i.po \
+ "$(DESTDIR)$(localedir)/$$i/LC_MESSAGES/gnupg2.mo" ; \
+ done
+endif
+
stowinstall:
$(MAKE) $(AM_MAKEFLAGS) install prefix=/usr/local/stow/gnupg
-
Added: trunk/scripts/potomo
===================================================================
--- trunk/scripts/potomo (rev 0)
+++ trunk/scripts/potomo 2010-10-18 18:19:45 UTC (rev 5458)
@@ -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
Property changes on: trunk/scripts/potomo
___________________________________________________________________
Added: svn:executable
+ *
More information about the Gnupg-commits
mailing list