-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
129 lines (115 loc) · 4.26 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# Makefile for TazInst.
# Check the README for more information.
#
PREFIX?=/usr
DOCDIR?=/usr/share/doc
DESTDIR?=
TAZPANEL?=/var/www/tazpanel
LINGUAS?=de el es fr it ja pt_BR ru sv zh_CN
PACKAGE = tazinst
VERSION := $(shell grep ^VERSION ${PACKAGE} | cut -d '=' -f 2)
TARBALL = $(PACKAGE)-$(VERSION).tar.gz
all:
# i18n.
pot:
xgettext -o po/tazinst/tazinst.pot -L Shell \
--package-name="TazInst" \
--package-version="$(VERSION)" \
-k_ -k_n \
./tazinst
xgettext -o po/slitaz-installer/slitaz-installer.pot -L Shell \
--package-name="slitaz-installer" \
--package-version="$(VERSION)" \
-k_ -k_n \
./slitaz-installer
xgettext -o po/installer/installer.pot -L Shell \
--package-name="installer.cgi" \
--package-version="$(VERSION)" \
-k_ -k_n \
./installer.cgi
msgmerge:
@for l in $(LINGUAS); do \
if [ -f "po/tazinst/$$l.po" ]; then \
echo -n "Updating tazinst $$l po file."; \
msgmerge -U po/tazinst/$$l.po po/tazinst/tazinst.pot ; \
fi;\
if [ -f "po/slitaz-installer/$$l.po" ]; then \
echo -n "Updating slitaz-installer $$l po file."; \
msgmerge -U po/slitaz-installer/$$l.po \
po/slitaz-installer/slitaz-installer.pot ; \
fi;\
if [ -f "po/installer/$$l.po" ]; then \
echo -n "Updating installer $$l po file."; \
msgmerge -U po/installer/$$l.po po/installer/installer.pot ; \
fi;\
done;
msgfmt:
@for l in $(LINGUAS); do \
if [ -f "po/tazinst/$$l.po" ]; then \
echo "Compiling tazinst $$l mo file..."; \
mkdir -p po/mo/$$l/LC_MESSAGES; \
msgfmt -o po/mo/$$l/LC_MESSAGES/tazinst.mo po/tazinst/$$l.po ; \
fi;\
if [ -f "po/slitaz-installer/$$l.po" ]; then \
echo "Compiling slitaz-installer $$l mo file..."; \
mkdir -p po/mo/$$l/LC_MESSAGES; \
msgfmt -o po/mo/$$l/LC_MESSAGES/slitaz-installer.mo \
po/slitaz-installer/$$l.po ; \
fi;\
if [ -f "po/installer/$$l.po" ]; then \
echo "Compiling installer $$l mo file..."; \
mkdir -p po/mo/$$l/LC_MESSAGES; \
msgfmt -o po/mo/$$l/LC_MESSAGES/installer.mo po/installer/$$l.po ; \
fi;\
done;
# Installation.
install: msgfmt
@echo "Installing Tazinst into $(DESTDIR)$(PREFIX)/sbin..."
mkdir -p $(DESTDIR)$(PREFIX)/sbin
install -m 0755 tazinst $(DESTDIR)$(PREFIX)/sbin
-[ "$(VERSION)" ] && sed -i 's/readonly VERSION=["0-9].*/readonly VERSION=$(VERSION)/' $(DESTDIR)$(PREFIX)/sbin/tazinst
@echo "Installing slitaz-installer into $(DESTDIR)$(PREFIX)/sbin..."
mkdir -p $(DESTDIR)$(PREFIX)/sbin
install -m 0755 slitaz-installer $(DESTDIR)$(PREFIX)/sbin
-[ "$(VERSION)" ] && sed -i 's/^VERSION=["0-9].*/VERSION=$(VERSION)/' $(DESTDIR)$(PREFIX)/sbin/slitaz-installer
@echo "Installing installer.cgi into $(DESTDIR)$(TAZPANEL)..."
mkdir -p $(DESTDIR)$(TAZPANEL)/menu.d
install -m 0755 installer.cgi $(DESTDIR)$(TAZPANEL)
-[ "$(VERSION)" ] && sed -i 's/^VERSION=["0-9].*/VERSION="$(VERSION)"/' $(DESTDIR)$(TAZPANEL)/installer.cgi
@echo "Installing installer.menu into $(DESTDIR)$(TAZPANEL)/menu.d..."
ln -fs ../installer.cgi $(DESTDIR)$(TAZPANEL)/menu.d/installer.cgi
@echo "Installing config file into $(DESTDIR)/etc/slitaz..."
mkdir -p $(DESTDIR)/etc/slitaz
install -m 0755 etc/tazinst.conf $(DESTDIR)/etc/slitaz
@echo "Installing Tazinst documentation..."
mkdir -p $(DESTDIR)$(DOCDIR)/tazinst
cp -a doc/* $(DESTDIR)$(DOCDIR)/tazinst
# i18n
mkdir -p $(DESTDIR)$(PREFIX)/share/locale
cp -a po/mo/* $(DESTDIR)$(PREFIX)/share/locale
# Desktop integration
@echo "Setting up desktop integration..."
mkdir -p $(DESTDIR)$(PREFIX)/share
cp -a applications $(DESTDIR)$(PREFIX)/share
# Uninstallation and tarball clean-up commands.
uninstall:
rm -f $(DESTDIR)/etc/slitaz/tazinst.conf
rm -f $(DESTDIR)$(PREFIX)/sbin/tazinst
rm -f $(DESTDIR)$(PREFIX)/sbin/slitaz_installer
rm -f $(DESTDIR)$(TAZPANEL)/installer.cgi
rm -f $(DESTDIR)$(TAZPANEL)/menu.d/installer.menu
rm -rf $(DESTDIR)$(DOCDIR)/tazinst
rm -rf $(DESTDIR)$(PREFIX)/share/locale/*/LC_MESSAGES/tazinst*.mo
rm -rf $(DESTDIR)$(PREFIX)/share/locale/*/LC_MESSAGES/slitaz-installer*.mo
rm -rf $(DESTDIR)$(PREFIX)/share/locale/*/LC_MESSAGES/installer*.mo
rm -f $(DESTDIR)$(PREFIX)/share/applications/tazinst.desktop
clean:
rm -rf _pkg
rm -rf po/mo
rm -f po/*/*~
dist-clean:
rm -rf $(DISTDIR)
# Build tarball and MD5 file for packaging.
dist: dist-clean
hg archive -t tgz $(TARBALL)
md5sum $(TARBALL) > $(PACKAGE)-$(VERSION).md5