summary refs log tree commit diff
path: root/Makefile.am
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-08-25 22:16:37 +0200
committerLudovic Courtès <ludo@gnu.org>2019-08-25 22:48:41 +0200
commit61a224adc3426d9fd0932b755205642650e89367 (patch)
tree1e162ec3c7d2c0d4bb6863c0297b15a8b4e63f1b /Makefile.am
parent0b859092a7346f3b4d0a3a4dac878fd64fd70b79 (diff)
downloadguix-61a224adc3426d9fd0932b755205642650e89367.tar.gz
maint: Add 'download-po' rule.
* Makefile.am (make-download-po-rule): New definition.
Add top-level 'eval' and calls to 'make-download-po-rule' to generate
'download-po.DOMAIN' rules.
(download-po): New rule.
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am33
1 files changed, 33 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index 0bd85e8fcf..fa6bf8fe80 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -851,6 +851,39 @@ cuirass-jobs.scm: $(GOBJECTS)
 .PHONY: clean-go make-go as-derivation
 .PHONY: update-guix-package update-NEWS release
 
+# Downloading up-to-date PO files.
+
+# make-download-po-rule DOMAIN DIRECTORY [FILE-NAME-PREFIX]
+define make-download-po-rule
+
+download-po.$(1):
+	if [ -f "$(top_srcdir)/$(2)/LINGUAS" ]; then				\
+	  LINGUAS="`grep -v '^[[:blank:]]*#' < $(top_srcdir)/$(2)/LINGUAS`" ;	\
+	else									\
+	  LINGUAS="`(cd $(top_srcdir)/$(2);					\
+	    for i in *.po; do echo $$$$i; done) | cut -d . -f 2`" ;		\
+	fi ;									\
+	for lang in $$$$LINGUAS; do						\
+	  if wget -nv -O "$(top_srcdir)/$(2)/$(3)$$$$lang.po.tmp"		\
+	     "https://translationproject.org/latest/$(1)/$$$$lang.po" ;		\
+	  then									\
+	    mv "$(top_srcdir)/$(2)/$(3)$$$$lang.po"{.tmp,} ;			\
+	  else									\
+	    rm "$(top_srcdir)/$(2)/$(3)$$$$lang.po.tmp" ;			\
+	  fi ;									\
+	done
+
+.PHONY: download-po.$(1)
+
+endef
+
+$(eval $(call make-download-po-rule,guix,po/guix))
+$(eval $(call make-download-po-rule,guix-packages,po/packages))
+$(eval $(call make-download-po-rule,guix-manual,po/doc,guix-manual.))
+
+download-po: $(foreach domain,guix guix-packages guix-manual,download-po.$(domain))
+.PHONY: download-po
+
 ## -------------- ##
 ## Silent rules.  ##
 ## -------------- ##