summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Spacek <pspacek@redhat.com>2016-11-14 10:27:15 +0100
committerMartin Basti <mbasti@redhat.com>2016-11-22 16:14:50 +0100
commitd40c376ccc1ec9292df0306134c7bfdfd096566e (patch)
tree9d079a90897ac71ef3734e073a55d34845dda57b
parent4842231074683ff68be50b147560f5383aa305b6 (diff)
downloadfreeipa-d40c376ccc1ec9292df0306134c7bfdfd096566e.tar.gz
freeipa-d40c376ccc1ec9292df0306134c7bfdfd096566e.tar.xz
freeipa-d40c376ccc1ec9292df0306134c7bfdfd096566e.zip
Build: support strip-po target for translations
The target was added to top-level Makefile.am as well so the maintainer does not need to jump between directories when doing Zanata pull/push and strip-po. https://fedorahosted.org/freeipa/ticket/6418 Reviewed-By: Martin Basti <mbasti@redhat.com> Reviewed-By: Christian Heimes <cheimes@redhat.com> Reviewed-By: Lukas Slebodnik <lslebodn@redhat.com>
-rw-r--r--.gitignore1
-rw-r--r--Makefile.am4
-rw-r--r--configure.ac7
-rw-r--r--po/Makefile.hack.in20
4 files changed, 32 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index a043a2976..be027df0b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,7 @@
/ABOUT-NLS
/po/*.gmo
/po/*~
+/po/Makefile.hack
/po/Makefile.in.in
/po/Makevars.template
/po/POTFILES
diff --git a/Makefile.am b/Makefile.am
index 21b6782a6..80f708b1d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -188,3 +188,7 @@ bdist_wheel: $(WHEELDISTDIR)
wheel_bundle: $(WHEELBUNDLEDIR) bdist_wheel
$(PYTHON) -m pip wheel --wheel-dir $(WHEELBUNDLEDIR) $(WHEELDISTDIR)/*.whl
+
+.PHONY:
+strip-po:
+ $(MAKE) -C po strip-po
diff --git a/configure.ac b/configure.ac
index 87117d5c0..385836e0a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -296,6 +296,12 @@ AC_PROG_MKDIR_P
AC_PROG_AWK
AC_PROG_SED
+AC_PATH_PROG(MSGATTRIB, msgattrib, [no])
+if test "x$MSGATTRIB" = "xno"; then
+ AC_MSG_ERROR([msgattrib not found, install gettext])
+fi
+AC_SUBST([MSGATTRIB])
+
dnl ---------------------------------------------------------------------------
dnl IPA platform
dnl ---------------------------------------------------------------------------
@@ -525,6 +531,7 @@ AC_CONFIG_FILES([
ipatests/Makefile
ipatests/man/Makefile
po/Makefile.in
+ po/Makefile.hack
util/Makefile
])
diff --git a/po/Makefile.hack.in b/po/Makefile.hack.in
new file mode 100644
index 000000000..09f4eef47
--- /dev/null
+++ b/po/Makefile.hack.in
@@ -0,0 +1,20 @@
+# Auxiliary target for translation maintainer:
+# Strip untranslated strings and comments with code lines from the po files
+# to make them smaller before storage in SCM.
+
+DISTFILES.common.extra3 = Makefile.hack.in
+
+MSGATTRIB = @MSGATTRIB@
+
+.PHONY: strip-po
+strip-po:
+ for po_file in $(POFILES); do \
+ $(MSGATTRIB) --translated --no-fuzzy --no-location $$po_file > $$po_file.tmp || exit 1; \
+ mv $$po_file.tmp $$po_file || exit 1; \
+ done
+ export FILES_TO_REMOVE=`find $(srcdir) -name '*.po' -empty` || exit 1; \
+ if [ "$$FILES_TO_REMOVE" != "" ]; then \
+ rm -v $$FILES_TO_REMOVE || exit 1; \
+ echo; echo Please remove the deleted files from LINGUAS!; echo; \
+ fi
+