tazpkg view Makefile @ rev 955

modules/search: allow search file with dash at start: tazpkg -sf "-spi"
author Aleksej Bobylev <al.bobylev@gmail.com>
date Fri Dec 22 00:02:54 2017 +0200 (2017-12-22)
parents 4fa1ea055f78
children e6f7a109cfe3
line source
1 # Makefile for TazPkg.
2 #
3 prefix ?= /usr
4 exec_prefix ?= $(prefix)
5 bindir ?= $(exec_prefix)/bin
6 libexecdir ?= $(exec_prefix)/libexec
7 datarootdir ?= $(prefix)/share
8 sysconfdir ?= /etc
9 docdir ?= $(datarootdir)/doc/tazpkg
10 libdir ?= $(exec_prefix)/lib
11 localedir ?= $(datarootdir)/locale
12 iconsdir ?= $(datarootdir)/icons
14 CC ?= gcc
15 DESTDIR ?=
16 LINGUAS ?= de el es fr ja pl pt_BR ru sv zh_CN zh_TW
17 MODULES := $(shell ls modules)
19 VERSION := 5.0
20 ICONS = $(DESTDIR)$(iconsdir)/hicolor/32x32
22 tmpdir = tar-install/tazpkg-$(VERSION)
23 tarball = tazpkg-$(VERSION).tar.gz
25 .PHONY: all pot msgmerge msgfmt install uninstall clean targz help
27 all: msgfmt notify
28 mkdir build
29 cp -a tazpkg tazpkg-box tazpkg-notify \
30 modules/* tazpanel/pkgs.cgi tazpanel/pkgs.css \
31 doc/tazpkg.*.html build
32 ./stripall.sh
34 # Substitute "@@MODULES@@" with modules path
35 find build -type f -exec sed -i "s|@@MODULES@@|$(libexecdir)/tazpkg|g" \{\} \;
37 # i18n.
39 pot:
40 xgettext -o po/tazpkg.pot -L Shell \
41 --package-name=TazPkg \
42 --package-version="$(VERSION)" -kaction -ktitle -kdie -k_ -k_n -k_p:1,2 \
43 tazpkg \
44 $(foreach module, $(MODULES), modules/$(module) ) \
45 tazpkg-box tazpkg-notify tazpanel/pkgs.cgi
47 msgmerge:
48 @for l in $(LINGUAS); do \
49 if [ -f "po/$$l.po" ]; then \
50 echo -n "Updating $$l po file."; \
51 msgmerge -U po/$$l.po po/tazpkg.pot ; \
52 fi; \
53 done
55 msgfmt:
56 @for l in $(LINGUAS); do \
57 if [ -f "po/$$l.po" ]; then \
58 echo -n "Compiling tazpkg $$l mo file... "; \
59 mkdir -p po/mo/$$l/LC_MESSAGES; \
60 msgfmt -o po/mo/$$l/LC_MESSAGES/tazpkg.mo \
61 po/$$l.po ; \
62 echo "done"; \
63 fi; \
64 done;
66 notify:
67 $(CC) tazpkg-notification.c -o tazpkg-notification $(CFLAGS) \
68 $(shell pkg-config --cflags --libs libnotify)
71 # Installation.
73 install: msgfmt
74 # TazPkg command line interface
75 install -m 0755 -d $(DESTDIR)$(bindir)
76 install -m 0755 build/tazpkg $(DESTDIR)$(bindir)
78 # TazPkg modules
79 install -m 0755 -d $(DESTDIR)$(libexecdir)/tazpkg
80 $(foreach module, $(MODULES), install -m 0755 build/$(module) $(DESTDIR)$(libexecdir)/tazpkg;)
82 # TazPkg-box GUI
83 install -m 0755 build/tazpkg-notify $(DESTDIR)$(bindir)
84 install -m 0755 tazpkg-notification $(DESTDIR)$(libexecdir)
85 install -m 0755 build/tazpkg-box $(DESTDIR)$(bindir)
87 # Configuration files
88 install -m 0755 -d $(DESTDIR)$(sysconfdir)/slitaz
89 install -m 0644 tazpkg.conf $(DESTDIR)$(sysconfdir)/slitaz
90 sed -i "s|@@sysconfdir@@|$(sysconfdir)|g" $(DESTDIR)$(sysconfdir)/slitaz/tazpkg.conf
92 # Documentation
93 install -m 0755 -d $(DESTDIR)$(docdir)
94 cp -a build/tazpkg.*.html $(DESTDIR)$(docdir)
95 ln -sf tazpkg.en.html $(DESTDIR)$(docdir)/tazpkg.html
97 # TazPanel files
98 install -m 0755 -d $(DESTDIR)/var/www/tazpanel/menu.d
99 install -m 0755 build/pkgs.cgi $(DESTDIR)/var/www/tazpanel
100 ln -fs ../pkgs.cgi $(DESTDIR)/var/www/tazpanel/menu.d/pkgs
101 install -m 0755 -d $(DESTDIR)/var/www/tazpanel/styles/default
102 install -m 0644 build/gz/pkgs.css.gz $(DESTDIR)/var/www/tazpanel/styles/default
104 # The i18n files
105 install -m 0755 -d $(DESTDIR)$(localedir)
106 cp -a po/mo/* $(DESTDIR)$(localedir)
108 # Desktop integration
109 install -m 0755 -d $(DESTDIR)$(datarootdir)/applications
110 install -m 0644 applications/*.desktop $(DESTDIR)$(datarootdir)/applications
111 #cp -a mime $(DESTDIR)$(datarootdir) # moved to shared-mime-info package
113 # Default icons
114 install -m 0755 -d $(ICONS)/apps
115 install -m 0755 -d $(ICONS)/actions
116 install -m 0755 -d $(ICONS)/status
117 install -m 0644 pixmaps/tazpkg.png $(ICONS)/apps
118 install -m 0644 pixmaps/tazpkg-up.png $(ICONS)/actions
119 install -m 0644 pixmaps/tazpkg-installed.png $(ICONS)/status
120 #ln -fs tazpkg.png $(ICONS)/apps/TazPkg.png # icon for Yad
122 # TazPkg Notify XDG autostart
123 mkdir -p $(DESTDIR)$(sysconfdir)/xdg
124 cp -a xdg/autostart $(DESTDIR)$(sysconfdir)/xdg
127 # Uninstallation and clean-up commands.
129 uninstall:
130 rm -f $(DESTDIR)$(bindir)/tazpkg
131 rm -rf $(DESTDIR)$(libexecdir)/tazpkg
133 rm -f $(DESTDIR)$(bindir)/tazpkg-notify
134 rm -f $(DESTDIR)$(bindir)/tazpkg-box
136 rm -f $(DESTDIR)$(sysconfdir)/slitaz/tazpkg.conf
138 rm -rf $(DESTDIR)$(docdir)/tazpkg*.html
139 rm $(DESTDIR)$(docdir)
141 rm -f $(DESTDIR)/var/www/tazpanel/pkgs.cgi
142 rm -f $(DESTDIR)/var/www/tazpanel/menu.d/pkgs
143 rm -f $(DESTDIR)/var/www/tazpanel/styles/default/pkgs.css
145 rm -rf $(DESTDIR)$(localedir)/*/LC_MESSAGES/tazpkg.mo
147 rm -f $(DESTDIR)$(datarootdir)/applications/tazpkg-*.desktop
148 rm -f $(DESTDIR)$(datarootdir)/applications/tazpanel-pkgs.desktop
150 rm -f $(ICONS)/apps/tazpkg.png
151 rm -f $(ICONS)/actions/tazpkg-up.png
152 rm -f $(ICONS)/status/tazpkg-installed.png
154 rm -f $(DESTDIR)$(sysconfdir)/xdg/autostart/tazpkg-notify.desktop
157 clean:
158 rm -rf build
159 rm -rf _pkg
160 rm -rf tar-install
161 rm -rf po/mo
162 rm -f po/*~
163 rm -f po/*.mo
166 targz:
167 rm -rf ${tmpdir}
168 mkdir -p ${tmpdir}
170 make DESTDIR=${tmpdir} install
172 cd tar-install ; \
173 tar -cvzf ${tarball} tazpkg-$(VERSION) ; \
174 cd -
176 @echo "** Tarball successfully created in tar-install/${tarball}"
179 help:
180 @echo "make [ pot | msgmerge | msgfmt | all | install | uninstall | clear | targz ]"