]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/gpe-conf/files/Makefile.translation
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / gpe-conf / files / Makefile.translation
1 .SUFFIXES: .mo .po .pot .po8
2
3 CONTROL = `if test -e familiar/control1; then echo control1; else echo control; fi`
4
5 # use ipkg-build or ipkg-deb-build
6 IPKG_BUILD := ipkg-build
7
8 TRANSLATION_SITE := http://www.iro.umontreal.ca/~gnutra/maint
9
10 ifeq ($(DIR_PO),)
11 DIR_PO := po
12 endif
13
14 ifeq ($(BINPACKAGE),)
15 BINPACKAGE := $(PACKAGE)
16 endif
17
18 mo-files = $(patsubst %,$(DIR_PO)/%.mo,$(LINGUAS))
19 po-files = $(patsubst %,$(DIR_PO)/%.po,$(LINGUAS))
20
21 ifeq ($(shell if [ -f $(PACKAGE).desktop.in ]; then echo present; fi;),present)
22 desktop-files += $(PACKAGE).desktop
23 endif
24
25 ifneq ($(EXTRA_DESKTOPS),)
26 desktop-files += $(patsubst %.desktop.in,%.desktop,$(EXTRA_DESKTOPS))
27 endif
28
29 all-mo: $(mo-files)
30
31 all-desktop: $(desktop-files)
32
33 install-mo: all-mo
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 \
37                 fi; \
38         fi;
39
40 .po8.mo:;
41         if [ "$(ENABLE_NLS)" != "no" ]; then \
42                 msgfmt -o $@ $<; \
43         fi;
44
45 .po.po8:;
46         CTYPE=`grep "^\"Content-Type:" $< | sed 's/^.*charset=//;s/\\\\.*//'`; sed "s/\(Content-Type: .*=\)$$CTYPE/\1UTF-8/" < $< | iconv -f $${CTYPE} -t UTF-8 >$@
47
48 update-po: $(po-files) extract-po
49
50 dist-prep: update-po freshen-po
51 # empty
52
53 ifeq ($(CVSBUILD),yes)
54 ipkg-prep: freshen-po
55 # empty
56 endif
57
58 extract-po:
59         mkdir -p $(DIR_PO)
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
62
63 clean: clean-po clean-dist-translation
64
65 clean-po:
66         rm -rf $(DIR_PO)/*.mo
67         for i in $(desktop-files); do if [ -f $$i.in ]; then rm -f $$i; rm -f $$i.in.h; fi; done
68
69 %.desktop: %.desktop.in $(patsubst %,$(DIR_PO)/%.po,$(LINGUAS))
70         intltool-merge -u -d $(DIR_PO) $< $@
71
72 freshen-po:
73         rm -rf tmp-po
74         mkdir tmp-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
77         rm -rf tmp-po
78
79 # ------------------------------------------------------------------------
80
81 MAINTAINER = $(shell grep 'Maintainer: ' familiar/$(CONTROL) | cut -d ' ' -f 2-)
82
83 ifndef BUILD
84 BUILD = ../build
85 endif
86
87 transdist := familiar/dist-translation
88 templates := $(BUILD)/familiar
89 ipkglist  := translation-ipkgs.txt
90
91 clean-dist-translation:
92         rm -rf $(transdist) $(ipkglist)
93
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); \
104         done
105
106 translation-ipkg:
107         make PREFIX=/usr real-translation-package