From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26975 invoked by alias); 30 Jul 2004 14:46:45 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 26965 invoked from network); 30 Jul 2004 14:46:43 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 30 Jul 2004 14:46:43 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.10/8.12.10) with ESMTP id i6UEkhe3013077 for ; Fri, 30 Jul 2004 10:46:43 -0400 Received: from localhost.redhat.com (porkchop.devel.redhat.com [172.16.58.2]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i6UEkha22051; Fri, 30 Jul 2004 10:46:43 -0400 Received: from gnu.org (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 896402B9D; Fri, 30 Jul 2004 10:46:38 -0400 (EDT) Message-ID: <410A5F4E.1000508@gnu.org> Date: Fri, 30 Jul 2004 14:46:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-GB; rv:1.4.1) Gecko/20040217 MIME-Version: 1.0 To: gdb-patches@sources.redhat.com Subject: Re: [patch/rfc] Enable PO files. References: <41091DEB.9020904@gnu.org> In-Reply-To: <41091DEB.9020904@gnu.org> Content-Type: multipart/mixed; boundary="------------090807000706090401000102" X-SW-Source: 2004-07/txt/msg00498.txt.bz2 This is a multi-part message in MIME format. --------------090807000706090401000102 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 638 I've committed the attached. The only difference from the original is that I fixed a problem with LOCALEDIR. The Makefile and C code ended up using different paths. I've also checked that it works (by hand) using a fake catalogue: > cagney@nettle$ LANGUAGE=au ./gdb --help > G'day, this is the GNU debugger. Usage: > > gdb [options] [executable-file [core-file or process-id]] > gdb [options] --args executable-file [inferior-arguments ...] We'll need an i18n.exp test but first we'll need a real catalogue :-) Next tasks are annotate the text, and get ourselves integrated into the translation process. enjoy, Andrew --------------090807000706090401000102 Content-Type: text/plain; name="diffs" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diffs" Content-length: 8155 2004-07-29 Andrew Cagney Fix PR i18n/761. * Makefile.in (.SUFFIXES): Add po .gmo, and .pox. (.PHONY): Add all-po install-po, uninstall-po, clean-po, $(PACKAGE).pot and update-po. (all-po, .po.gmo, .po.pox, install-po, $(PACKAGE).pot) (po/$(PACKAGE).pot, clean-po, uninstall-po, install-po) (update-po): New rules. (localedir): Define using autoconf. (diststuff): Add $(PACKAGE).pot and $(CATALOGS) (GDB_CFLAGS): Define LOCALEDIR using $(localedir). (XGETTEXT, GMSGFMT, MSGMERGE, PACKAGE, CATALOGS): Define. * configure.in: Generate CATALOGS and LINGUAS from contents of src/gdb/po/ directory. Set @localedir@ in Makefile.in. * configure: Re-generate. * po/gdbtext: New file Index: Makefile.in =================================================================== RCS file: /cvs/src/src/gdb/Makefile.in,v retrieving revision 1.597 diff -p -u -r1.597 Makefile.in --- Makefile.in 29 Jul 2004 15:13:05 -0000 1.597 +++ Makefile.in 30 Jul 2004 14:25:16 -0000 @@ -29,6 +29,7 @@ libdir = @libdir@ tooldir = $(libdir)/$(target_alias) datadir = @datadir@ +localedir = @localedir@ mandir = @mandir@ man1dir = $(mandir)/man1 man2dir = $(mandir)/man2 @@ -65,6 +66,13 @@ DLLTOOL = @DLLTOOL@ WINDRES = @WINDRES@ MIG = @MIG@ +XGETTEXT = @XGETTEXT@ +GMSGFMT = @GMSGFMT@ +MSGMERGE = msgmerge + +PACKAGE = @PACKAGE@ +CATALOGS = @CATALOGS@ + # If you are compiling with GCC, make sure that either 1) You have the # fixed include files where GCC can reach them, or 2) You use the # -traditional flag. Otherwise the ioctl calls in inflow.c @@ -317,7 +325,7 @@ CONFIG_UNINSTALL = @CONFIG_UNINSTALL@ # your system doesn't have fcntl.h in /usr/include (which is where it # should be according to Posix). DEFS = @DEFS@ -GDB_CFLAGS = -I. -I$(srcdir) -I$(srcdir)/config -DLOCALEDIR="\"$(prefix)/share/locale\"" $(DEFS) +GDB_CFLAGS = -I. -I$(srcdir) -I$(srcdir)/config -DLOCALEDIR="\"$(localedir)\"" $(DEFS) # M{H,T}_CFLAGS, if defined, have host- and target-dependent CFLAGS # from the config directory. @@ -1254,7 +1262,7 @@ do-maintainer-clean: @$(MAKE) $(FLAGS_TO_PASS) DO=maintainer-clean "DODIRS=$(SUBDIRS)" \ subdir_do -diststuff: $(DISTSTUFF) +diststuff: $(DISTSTUFF) $(PACKAGE).pot $(CATALOGS) cd doc; $(MAKE) $(MFLAGS) diststuff subdir_do: force @@ -1467,6 +1475,80 @@ v850ice.o: $(srcdir)/v850ice.c valprint.o: $(srcdir)/valprint.c $(CC) -c $(INTERNAL_WARN_CFLAGS) $(NO_WERROR_CFLAGS) $(srcdir)/valprint.c + +# Message files. Based on code in gcc/Makefile.in. + +# Rules for generating translated message descriptions. Disabled by +# autoconf if the tools are not available. + +.SUFFIXES: .po .gmo .pox .pot +.PHONY: all-po install-po uninstall-po clean-po update-po $(PACKAGE).pot + +all-po: $(CATALOGS) + +# This notation should be acceptable to all Make implementations used +# by people who are interested in updating .po files. +update-po: $(CATALOGS:.gmo=.pox) + +# N.B. We do not attempt to copy these into $(srcdir). The snapshot +# script does that. +.po.gmo: + -test -d po || mkdir po + $(GMSGFMT) --statistics -o $@ $< + +# The new .po has to be gone over by hand, so we deposit it into +# build/po with a different extension. If build/po/$(PACKAGE).pot +# exists, use it (it was just created), else use the one in srcdir. +.po.pox: + -test -d po || mkdir po + $(MSGMERGE) $< `if test -f po/$(PACKAGE).pot; \ + then echo po/$(PACKAGE).pot; \ + else echo $(srcdir)/po/$(PACKAGE).pot; fi` -o $@ + +# This rule has to look for .gmo modules in both srcdir and the cwd, +# and has to check that we actually have a catalog for each language, +# in case they weren't built or included with the distribution. +install-po: + $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(datadir) + cats="$(CATALOGS)"; for cat in $$cats; do \ + lang=`basename $$cat | sed 's/\.gmo$$//'`; \ + if [ -f $$cat ]; then :; \ + elif [ -f $(srcdir)/$$cat ]; then cat=$(srcdir)/$$cat; \ + else continue; \ + fi; \ + dir=$(localedir)/$$lang/LC_MESSAGES; \ + echo $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$$dir; \ + $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$$dir || exit 1; \ + echo $(INSTALL_DATA) $$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \ + $(INSTALL_DATA) $$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \ + done +uninstall-po: + cats="$(CATALOGS)"; for cat in $$cats; do \ + lang=`basename $$cat | sed 's/\.gmo$$//'`; \ + if [ -f $$cat ]; then :; \ + elif [ -f $(srcdir)/$$cat ]; then cat=$(srcdir)/$$cat; \ + else continue; \ + fi; \ + dir=$(localedir)/$$lang/LC_MESSAGES; \ + rm -f $(DESTDIR)$$dir/$(PACKAGE).mo; \ + done +# Delete po/*.gmo only if we are not building in the source directory. +clean-po: + -if [ ! -f Makefile.in ]; then rm -f po/*.gmo; fi + +# Rule for regenerating the message template (gdb.pot). Instead of +# forcing everyone to edit POTFILES.in, which proved impractical, this +# rule has no dependencies and always regenerates gdb.pot. This is +# relatively harmless since the .po files do not directly depend on +# it. The .pot file is left in the build directory. Since GDB's +# Makefile lacks a cannonical list of sources (missing xm, tm and nm +# files) force this rule. +$(PACKAGE).pot: po/$(PACKAGE).pot +po/$(PACKAGE).pot: force + -test -d po || mkdir po + sh -e $(srcdir)/po/gdbtext $(XGETTEXT) $(PACKAGE) . $(srcdir) + + # # YACC/LEX dependencies # Index: configure.in =================================================================== RCS file: /cvs/src/src/gdb/configure.in,v retrieving revision 1.158 diff -p -u -r1.158 configure.in --- configure.in 17 Jul 2004 11:24:24 -0000 1.158 +++ configure.in 30 Jul 2004 14:25:16 -0000 @@ -42,10 +42,70 @@ AC_CANONICAL_SYSTEM # 2.5x. AC_CHECK_TOOL(RANLIB, ranlib, :) +dnl List of object files and targets accumulated by configure. + +CONFIG_OBS= +CONFIG_DEPS= +CONFIG_SRCS= +ENABLE_CFLAGS= + +CONFIG_ALL= +CONFIG_CLEAN= +CONFIG_INSTALL= +CONFIG_UNINSTALL= + dnl Set up for gettext. PACKAGE is used when we call bindtextdomain. -ALL_LINGUAS= + CY_GNU_GETTEXT -AC_DEFINE(PACKAGE, "gdb", [Name of this package. ]) + +localedir='${datadir}/locale' +AC_SUBST(localedir) + +if test "x$POSUB" != x; then + + dnl Lifted from GCC's config/gettext.m4. + AC_MSG_CHECKING(for catalogs to be installed) + # Look for .po and .gmo files in the source directory. + CATALOGS= AC_SUBST(CATALOGS) + XLINGUAS= + for cat in $srcdir/po/*.gmo $srcdir/po/*.po; do + # If there aren't any .gmo files the shell will give us the + # literal string "../path/to/srcdir/po/*.gmo" which has to be + # weeded out. + case "$cat" in *\**) + continue;; + esac + # The quadruple backslash is collapsed to a double backslash + # by the backticks, then collapsed again by the double quotes, + # leaving us with one backslash in the sed expression (right + # before the dot that mustn't act as a wildcard). + cat=`echo $cat | sed -e "s!$srcdir/!!" -e "s!\\\\.po!.gmo!"` + lang=`echo $cat | sed -e 's!po/!!' -e "s!\\\\.gmo!!"` + # The user is allowed to set LINGUAS to a list of languages to + # install catalogs for. If it's empty that means "all of them." + if test "x$LINGUAS" = x; then + CATALOGS="$CATALOGS $cat" + XLINGUAS="$XLINGUAS $lang" + else + case "$LINGUAS" in *$lang*) + CATALOGS="$CATALOGS $cat" + XLINGUAS="$XLINGUAS $lang" + ;; + esac + fi + done + LINGUAS="$XLINGUAS" + AC_MSG_RESULT($LINGUAS) + + CONFIG_ALL="$CONFIG_ALL all-po" + CONFIG_CLEAN="$CONFIG_CLEAN clean-po" + CONFIG_INSTALL="$CONFIG_INSTALL install-po" + CONFIG_UNINSTALL="$CONFIG_UNINSTALL uninstall-po" +fi + +PACKAGE=gdb +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package. ]) +AC_SUBST(PACKAGE) debugdir=${libdir}/debug @@ -57,17 +117,6 @@ AC_DEFINE_DIR(DEBUGDIR, debugdir, [Global directory for separate debug files. ]) #AC_DEFINE_UNQUOTED(DEBUGDIR, "$debugdir"), -dnl List of object files added by configure. - -CONFIG_OBS= -CONFIG_DEPS= -CONFIG_SRCS= -ENABLE_CFLAGS= -CONFIG_ALL= -CONFIG_CLEAN= -CONFIG_INSTALL= -CONFIG_UNINSTALL= - AC_CONFIG_SUBDIRS(doc testsuite) configdirs= --------------090807000706090401000102--