1 .SUFFIXES: .mo .po .pot .po8
3 CONTROL = `if test -e familiar/control1; then echo control1; else echo control; fi`
5 # use ipkg-build or ipkg-deb-build
6 IPKG_BUILD := ipkg-build
8 TRANSLATION_SITE := http://www.iro.umontreal.ca/~gnutra/maint
15 BINPACKAGE := $(PACKAGE)
18 mo-files = $(patsubst %,$(DIR_PO)/%.mo,$(LINGUAS))
19 po-files = $(patsubst %,$(DIR_PO)/%.po,$(LINGUAS))
21 ifeq ($(shell if [ -f $(PACKAGE).desktop.in ]; then echo present; fi;),present)
22 desktop-files += $(PACKAGE).desktop
25 ifneq ($(EXTRA_DESKTOPS),)
26 desktop-files += $(patsubst %.desktop.in,%.desktop,$(EXTRA_DESKTOPS))
31 all-desktop: $(desktop-files)
34 if [ "$(ENABLE_NLS)" != "no" ]; then \
35 if [ "x$(LINGUAS)" != "x" ]; then \
36 for i in $(LINGUAS); do mkdir -p $(DESTDIR)$(PREFIX)/share/locale/$$i/LC_MESSAGES; install -m 644 $(DIR_PO)/$$i.mo $(DESTDIR)$(PREFIX)/share/locale/$$i/LC_MESSAGES/$(PACKAGE).mo; done \
41 if [ "$(ENABLE_NLS)" != "no" ]; then \
46 CTYPE=`grep "^\"Content-Type:" $< | sed 's/^.*charset=//;s/\\\\.*//'`; sed "s/\(Content-Type: .*=\)$$CTYPE/\1UTF-8/" < $< | iconv -f $${CTYPE} -t UTF-8 >$@
48 update-po: $(po-files) extract-po
50 dist-prep: update-po freshen-po
53 ifeq ($(CVSBUILD),yes)
60 ( SOURCES="$(SOURCES)"; for DESK in $(PACKAGE).desktop.in $(EXTRA_DESKTOPS); do if [ -f $$DESK ]; then intltool-extract --type=gettext/ini $$DESK; SOURCES="$$SOURCES $${DESK}.h"; fi; done; if [ "x$$SOURCES" != "x" ]; then xgettext --add-comments=TRANSLATORS: -k_ -kN_ -o $(DIR_PO)/$(PACKAGE).pot.new $$SOURCES; fi )
61 if [ -f $(DIR_PO)/$(PACKAGE).pot.new ]; then if cmp -s $(DIR_PO)/$(PACKAGE).pot.new $(PACKAGE).pot; then rm $(DIR_PO)/$(PACKAGE).pot.new; else mv $(DIR_PO)/$(PACKAGE).pot.new $(DIR_PO)/$(PACKAGE).pot; fi; fi
63 clean: clean-po clean-dist-translation
67 for i in $(desktop-files); do if [ -f $$i.in ]; then rm -f $$i; rm -f $$i.in.h; fi; done
69 %.desktop: %.desktop.in $(patsubst %,$(DIR_PO)/%.po,$(LINGUAS))
70 intltool-merge -u -d $(DIR_PO) $< $@
75 cd tmp-po; for LANG in $(LINGUAS); do wget $(TRANSLATION_SITE)/$(PACKAGE)/$$LANG.po; done
76 for LANG in $(LINGUAS); do if [ ! -f $(DIR_PO)/$$LANG.po ] || ! cmp -s $(DIR_PO)/$$LANG.po tmp-po/$$LANG.po ; then mv tmp-po/$$LANG.po $(DIR_PO)/$$LANG.po; echo "Updated $$LANG translation"; fi; done
79 # ------------------------------------------------------------------------
81 MAINTAINER = $(shell grep 'Maintainer: ' familiar/$(CONTROL) | cut -d ' ' -f 2-)
87 transdist := familiar/dist-translation
88 templates := $(BUILD)/familiar
89 ipkglist := translation-ipkgs.txt
91 clean-dist-translation:
92 rm -rf $(transdist) $(ipkglist)
94 real-translation-package: all-mo
95 rm -rf $(transdist) $(ipkglist)
96 for LINGUA in $(LINGUAS); do \
97 i=$$(echo $$LINGUA | tr '[A-Z_]' '[a-z+]'); \
98 mkdir -p $(transdist)/$$i/CONTROL; \
99 mkdir -p $(transdist)/$$i$(PREFIX)/share/locale/$$LINGUA/LC_MESSAGES; \
100 install -m 644 po/$$LINGUA.mo $(transdist)/$$i$(PREFIX)/share/locale/$$LINGUA/LC_MESSAGES/$(PACKAGE).mo; \
101 sed -e "s/<maintainer>/$(MAINTAINER)/;s/<package>/$(BINPACKAGE)/;s/<version>/$(VERSION)/;s/<language>/$$i/;s!<source>!$(SOURCE)!" $(templates)/control.translation > $(transdist)/$$i/CONTROL/control; \
102 install $(templates)/postinst.translation $(transdist)/$$i/CONTROL/postinst; \
103 $(IPKG_BUILD) -g 0 -o 0 $(transdist)/$$i | sed 's/^Packaged .*into //; t 1; d; : 1; s:.*/::' >> $(ipkglist); \
107 make PREFIX=/usr real-translation-package