xfs
[Top] [All Lists]

[RESEND] [PATCH 1/2] [GETTEXT]: Make build system look more like automak

To: xfs@xxxxxxxxxxx
Subject: [RESEND] [PATCH 1/2] [GETTEXT]: Make build system look more like automake gettext
From: Arkadiusz Miśkiewicz <arekm@xxxxxxxx>
Date: Thu, 29 Jan 2009 10:53:39 +0100
Cc: Arkadiusz Miśkiewicz <arekm@xxxxxxxx>
In-reply-to: <1233222212-2785-1-git-send-email-arekm@xxxxxxxx>
References: <1233222212-2785-1-git-send-email-arekm@xxxxxxxx>
configure.in: Find all *.c files using find so no need to update
po/Makefile manually (previous method leads to problems like when
someone adds new .c file and forgets to update Makefile - then
translations are removed after update).

po/Makefile: Use automaticly found .c files. Add update-po target.
Show translation statistics when processing po files. Turn on msgfmt
validation (-c).

How to update translations now?

 $ ./configure
 $ cd po; make update-po
 $ vim your.po
 $ make

Signed-off-by: Arkadiusz Miśkiewicz <arekm@xxxxxxxx>
---
 configure.in         |    4 ++
 include/builddefs.in |    1 +
 include/buildrules   |   22 +++++++++---
 po/Makefile          |   91 +-------------------------------------------------
 4 files changed, 22 insertions(+), 96 deletions(-)


That's fixed version of the patch (typo at configure.in).

diff --git a/configure.in b/configure.in
index 6bd2421..dce20dc 100644
--- a/configure.in
+++ b/configure.in
@@ -35,6 +35,10 @@ AC_ARG_ENABLE(lib64,
        enable_lib64=no)
 AC_SUBST(enable_lib64)
 
+# Find localized files
+LOCALIZED_FILES=`find ${srcdir} -name '*.c' -type f | xargs`;
+AC_SUBST(LOCALIZED_FILES)
+
 AC_PACKAGE_GLOBALS(xfsprogs)
 AC_PACKAGE_UTILITIES(xfsprogs)
 AC_MULTILIB($enable_lib64)
diff --git a/include/builddefs.in b/include/builddefs.in
index f07d8d6..49e2722 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -74,6 +74,7 @@ MAKEDEPEND    = @makedepend@
 MSGFMT         = @msgfmt@
 MSGMERGE       = @msgmerge@
 XGETTEXT       = @xgettext@
+LOCALIZED_FILES        = @LOCALIZED_FILES@
 
 RPM            = @rpm@
 RPMBUILD       = @rpmbuild@
diff --git a/include/buildrules b/include/buildrules
index 1047ec3..f2a3372 100644
--- a/include/buildrules
+++ b/include/buildrules
@@ -42,14 +42,24 @@ ifdef POTHEAD
 $(POTHEAD): $(XGETTEXTFILES)
        $(XGETTEXT) --language=C --keyword=_ --keyword=N_ -o $@ $(XGETTEXTFILES)
 
-# Generate temp .po files, to check whether translations need updating.
-# Not by default, due to gettext output differences between versions.
-%.po: $(POTHEAD)
-#      $(MSGMERGE) -o $@.tmpo $@ $(POTHEAD)
-#      if ! diff $@.tmpo $@ >/dev/null; then echo "$@ dated, see $@.tmpo"; fi
+# Update translations
+update-po: $(POTHEAD) $(wildcard $(TOPDIR)/po/*.po)
+       catalogs=$(wildcard $(TOPDIR)/po/*.po); \
+       for cat in $$catalogs; do \
+         lang=`basename $$cat .po`; \
+         mv $$lang.po $$lang.old.po; \
+         echo "$$lang:"; \
+         if $(MSGMERGE) $$lang.old.po $(POTHEAD) -o $$lang.po; then \
+           rm -f $$lang.old.po; \
+         else \
+           echo "msgmerge for $$lang failed!"; \
+           rm -f $$lang.po; \
+           mv $$lang.old.po $$lang.po; \
+         fi; \
+       done
 
 %.mo: %.po
-       $(MSGFMT) -o $@ $<
+       $(MSGFMT) -c --statistics -o $@ $<
 endif
 
 source :
diff --git a/po/Makefile b/po/Makefile
index c6ccf60..0cf2e87 100644
--- a/po/Makefile
+++ b/po/Makefile
@@ -11,96 +11,7 @@ LSRCFILES = $(LINGUAS:%=%.po) $(POTHEAD)
 LDIRT = $(POTHEAD)
 
 # TODO: db/ logprint/
-XGETTEXTFILES =        \
-               $(TOPDIR)/copy/xfs_copy.c \
-               $(TOPDIR)/estimate/xfs_estimate.c \
-               $(TOPDIR)/growfs/xfs_growfs.c \
-               $(TOPDIR)/io/attr.c \
-               $(TOPDIR)/io/bmap.c \
-               $(TOPDIR)/io/fadvise.c \
-               $(TOPDIR)/io/file.c \
-               $(TOPDIR)/io/freeze.c \
-               $(TOPDIR)/io/fsync.c \
-               $(TOPDIR)/io/getrusage.c \
-               $(TOPDIR)/io/imap.c \
-               $(TOPDIR)/io/init.c \
-               $(TOPDIR)/io/inject.c \
-               $(TOPDIR)/io/madvise.c \
-               $(TOPDIR)/io/mincore.c \
-               $(TOPDIR)/io/mmap.c \
-               $(TOPDIR)/io/open.c \
-               $(TOPDIR)/io/parent.c \
-               $(TOPDIR)/io/pread.c \
-               $(TOPDIR)/io/prealloc.c \
-               $(TOPDIR)/io/pwrite.c \
-               $(TOPDIR)/io/resblks.c \
-               $(TOPDIR)/io/sendfile.c \
-               $(TOPDIR)/io/shutdown.c \
-               $(TOPDIR)/io/truncate.c \
-               $(TOPDIR)/libdisk/dm.c \
-               $(TOPDIR)/libdisk/drivers.c \
-               $(TOPDIR)/libdisk/evms.c \
-               $(TOPDIR)/libdisk/fstype.c \
-               $(TOPDIR)/libdisk/lvm.c \
-               $(TOPDIR)/libdisk/md.c \
-               $(TOPDIR)/libdisk/pttype.c \
-               $(TOPDIR)/libdisk/xvm.c \
-               $(TOPDIR)/libxcmd/command.c \
-               $(TOPDIR)/libxcmd/help.c \
-               $(TOPDIR)/libxcmd/input.c \
-               $(TOPDIR)/libxcmd/paths.c \
-               $(TOPDIR)/libxcmd/projects.c \
-               $(TOPDIR)/libxcmd/quit.c \
-               $(TOPDIR)/libxfs/darwin.c \
-               $(TOPDIR)/libxfs/freebsd.c \
-               $(TOPDIR)/libxfs/init.c \
-               $(TOPDIR)/libxfs/irix.c \
-               $(TOPDIR)/libxfs/linux.c \
-               $(TOPDIR)/libxfs/rdwr.c \
-               $(TOPDIR)/libxfs/trans.c \
-               $(TOPDIR)/libxfs/util.c \
-               $(TOPDIR)/libxlog/util.c \
-               $(TOPDIR)/mkfs/proto.c \
-               $(TOPDIR)/mkfs/xfs_mkfs.c \
-               $(TOPDIR)/quota/edit.c \
-               $(TOPDIR)/quota/free.c \
-               $(TOPDIR)/quota/init.c \
-               $(TOPDIR)/quota/path.c \
-               $(TOPDIR)/quota/project.c \
-               $(TOPDIR)/quota/quot.c \
-               $(TOPDIR)/quota/quota.c \
-               $(TOPDIR)/quota/report.c \
-               $(TOPDIR)/quota/state.c \
-               $(TOPDIR)/quota/util.c \
-               $(TOPDIR)/repair/agheader.c \
-               $(TOPDIR)/repair/attr_repair.c \
-               $(TOPDIR)/repair/avl.c \
-               $(TOPDIR)/repair/avl64.c \
-               $(TOPDIR)/repair/bmap.c \
-               $(TOPDIR)/repair/dino_chunks.c \
-               $(TOPDIR)/repair/dinode.c \
-               $(TOPDIR)/repair/dir.c \
-               $(TOPDIR)/repair/dir2.c \
-               $(TOPDIR)/repair/incore.c \
-               $(TOPDIR)/repair/incore_ext.c \
-               $(TOPDIR)/repair/incore_ino.c \
-               $(TOPDIR)/repair/init.c \
-               $(TOPDIR)/repair/phase1.c \
-               $(TOPDIR)/repair/phase2.c \
-               $(TOPDIR)/repair/phase3.c \
-               $(TOPDIR)/repair/phase4.c \
-               $(TOPDIR)/repair/phase5.c \
-               $(TOPDIR)/repair/phase6.c \
-               $(TOPDIR)/repair/phase7.c \
-               $(TOPDIR)/repair/prefetch.c \
-               $(TOPDIR)/repair/progress.c \
-               $(TOPDIR)/repair/rt.c \
-               $(TOPDIR)/repair/sb.c \
-               $(TOPDIR)/repair/scan.c \
-               $(TOPDIR)/repair/threads.c \
-               $(TOPDIR)/repair/versions.c \
-               $(TOPDIR)/repair/xfs_repair.c \
-               $(TOPDIR)/rtcp/xfs_rtcp.c
+XGETTEXTFILES =        $(LOCALIZED_FILES)
 
 default: $(POTHEAD) $(LINGUAS:%=%.mo)
 
-- 
1.6.1.1

<Prev in Thread] Current Thread [Next in Thread>