From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19768 invoked by alias); 29 Jul 2004 15:55:31 -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 19760 invoked from network); 29 Jul 2004 15:55:30 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 29 Jul 2004 15:55:30 -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 i6TFtUe3025660 for ; Thu, 29 Jul 2004 11:55:30 -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 i6TFtTa29153; Thu, 29 Jul 2004 11:55:29 -0400 Received: from gnu.org (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 099B92B9D; Thu, 29 Jul 2004 11:55:24 -0400 (EDT) Message-ID: <41091DEB.9020904@gnu.org> Date: Thu, 29 Jul 2004 15:55: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 Cc: Tom Tromey Subject: [patch/rfc] Enable PO files. Content-Type: multipart/mixed; boundary="------------090805000108010005080504" X-SW-Source: 2004-07/txt/msg00442.txt.bz2 This is a multi-part message in MIME format. --------------090805000108010005080504 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 513 Hello, http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gdb&pr=761 I went shopping for solutions and found that GCC: - generated the catalog (instead of hard wiring it in configure.in) - the output is put in the _build_ directory (instead of RO srcdir) and more-or-less borrowed the code. However, GCC's code also: - insisted on using ../intl/ I didn't borrow that - GDB will still use an installed intl/ (I'm wondering if its time to boot intl/ out of GDB's distro). Andrew --------------090805000108010005080504 Content-Type: text/plain; name="diffs" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diffs" Content-length: 9013 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. (diststuff): Add $(PACKAGE).pot and $(CATALOGS) (GDB_CFLAGS): Update -DLOCALEDIR to use $(localedir). (XGETTEXT, GMSGFMT, MSGMERGE, PACKAGE, CATALOGS): Define. * configure.in: Generate CATALOGS and LINGUAS from contents of src/gdb/po/ directory. * 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 29 Jul 2004 15:36:34 -0000 @@ -29,6 +29,7 @@ libdir = @libdir@ tooldir = $(libdir)/$(target_alias) datadir = @datadir@ +localedir = $(datadir)/locale 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 29 Jul 2004 15:36:34 -0000 @@ -42,10 +42,67 @@ 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. ]) + +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 +114,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= Index: po/gdbtext =================================================================== RCS file: po/gdbtext diff -N po/gdbtext --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ po/gdbtext 29 Jul 2004 15:36:34 -0000 @@ -0,0 +1,38 @@ +#!/bin/sh -e + +if test $# -lt 3 +then + echo "Usage: $0 ..." 1>&2 + exit 0 +fi + +xgettext=$1 ; shift +package=$1 ; shift + +for d in "$@" +do + __directories="$__directories --directory=$d" +done + +for d in "$@" +do + ( + cd $d + find * \ + -name '*-stub.c' -prune -o \ + -name 'testsuite' -prune -o \ + -name 'init.c' -prune -o \ + -name '*.[hc]' -print + ) +done | ${xgettext} \ + --default-domain=${package} \ + --copyright-holder="Free Software Foundation, Inc." \ + --add-comments \ + --files-from=- \ + --force-po \ + --debug \ + --language=c \ + --keyword=_ \ + --keyword=N_ \ + ${__directories} \ + -o po/${package}.pot --------------090805000108010005080504--