3 # GNU copyright 1997 to 1999 by Joey Hess (sample file)
4 # Copyright 2000 to 2002 by Roland Mas and Christian Bayle for the Sourceforge package
5 # Copyright 2002 to 2008 by Roland Mas and Christian Bayle for the Gforge package
6 # Copyright 2008 to 2010 by Roland Mas and Christian Bayle for the FusionForge package
10 SRCPACKAGE=fusionforge
13 # Identify this FusionForge version
14 # keep type intact and change forge in derivates,
15 # unless there are deep changes (type is used for
16 # the Forge-Identification meta header)
17 WHICH_TYPE=FusionForge
18 WHICH_FORGE=FusionForge
19 WHICH_VERSION:=$(shell dpkg-parsechangelog | sed -n '/^Version: /s///p')
21 # Replace macros present in the files for forge's name
22 SED_REPLACE=sed -e 's/@PACKAGE@/$(PACKAGE)/g' -e 's/@SRCPACKAGE@/$(SRCPACKAGE)/g' -e 's/@OLDPACKAGE@/$(OLDPACKAGE)/g' -e 's/@FORGENAME@/$(FORGENAME)/g'
29 # The substitutions bellow can be quite tricky, so use 'debian/rules testpat' to check if it's OK
30 ENABLED_PLUGINS:=$(shell sh $(CURDIR)/utils/list-enabled-plugins.sh || echo error)
31 ifeq (${ENABLED_PLUGINS},error)
32 $(error list-enabled-plugins.sh failed)
35 PPOSTINST=$(foreach i,$(ENABLED_PLUGINS),debian/$(PACKAGE)-plugin-$i.postinst)
36 PPRERM=$(foreach i,$(ENABLED_PLUGINS),debian/$(PACKAGE)-plugin-$i.prerm)
38 CRONDFILES=$(patsubst packaging/cron.d/%,debian/$(OLDPACKAGE)-%.cron.d,$(wildcard packaging/cron.d/[a-z]*))
39 PCRONDFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/cron.d/[a-z]*),debian/$(PACKAGE)-plugin-$i.cron.d))
41 DIRSFILES=$(patsubst packaging/dirs/%,debian/$(OLDPACKAGE)-%.dirs,$(wildcard packaging/dirs/[a-z]*))
42 PDIRSFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/dirs/[a-z]*),debian/$(PACKAGE)-plugin-$i.dirs))
44 LINKSFILES=$(patsubst packaging/links/%,debian/$(OLDPACKAGE)-%.links,$(wildcard packaging/links/[a-z]*))
45 PLINKSFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/links/[a-z]*),debian/$(PACKAGE)-plugin-$i.links))
47 INSTALLFILES=$(patsubst packaging/install/%,debian/$(OLDPACKAGE)-%.install,$(wildcard packaging/install/[a-z]*))
48 PINSTALLFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/install/[a-z]*),debian/$(PACKAGE)-plugin-$i.install))
50 PTRIGGERSFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/debian/[a-z]*.triggers),debian/$(PACKAGE)-plugin-$i.triggers))
52 DOCSFILES=$(patsubst packaging/docs/%,debian/$(OLDPACKAGE)-%.docs,$(wildcard packaging/docs/[a-z]*)) \
53 $(patsubst packaging/docs/%,debian/$(PACKAGE)-%.docs,$(wildcard packaging/docs/[a-z]*))
54 PDOCSFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/docs/[a-z]*),debian/$(PACKAGE)-plugin-$i.docs))
56 PEXAMPLESSFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/examples/[a-z]*),debian/$(PACKAGE)-plugin-$i.examples))
57 READMEFILES=$(patsubst packaging/readme/%,debian/$(OLDPACKAGE)-%.README.Debian,$(wildcard packaging/readme/[a-z]*)) \
58 $(patsubst packaging/readme/%,debian/$(PACKAGE)-%.README.Debian,$(wildcard packaging/readme/[a-z]*))
60 POFILES=$(patsubst debian/dsf-po/%,debian/po/%,$(wildcard debian/dsf-po/*) debian/po/POTFILES.in)
62 # Displays the variables to check if globbing and substitutions are correct
64 @echo "ENABLED_PLUGINS=$(ENABLED_PLUGINS)"
66 @echo "PPOSTINST=$(PPOSTINST)"
67 @echo "PPRERM=$(PPRERM)"
69 @echo "CRONDFILES=$(CRONDFILES)"
70 @echo "DIRSFILES=$(DIRSFILES)"
71 @echo "LINKSFILES=$(LINKSFILES)"
72 @echo "INSTALLFILES=$(INSTALLFILES)"
73 @echo "DOCSFILES=$(DOCSFILES)"
74 @echo "READMEFILES=$(READMEFILES)"
76 @echo "PCRONDFILES=$(PCRONDFILES)"
77 @echo "PDIRSFILES=$(PDIRSFILES)"
78 @echo "PLINKSFILES=$(PLINKSFILES)"
79 @echo "PINSTALLFILES=$(PINSTALLFILES)"
80 @echo "PDOCSFILES=$(PDOCSFILES)"
81 @echo "PEXAMPLESFILES=$(PEXAMPLESFILES)"
84 sh $(CURDIR)/deb-specific/manage-uufiles.sh clean
87 conffiles: $(PPOSTINST) $(PPRERM) $(CRONDFILES) $(DIRSFILES) $(LINKSFILES) $(INSTALLFILES) $(DOCSFILES) $(READMEFILES) $(PCRONDFILES) $(PDIRSFILES) $(PLINKSFILES) $(PINSTALLFILES) $(PDOCSFILES) $(PTRIGGERSFILES) $(PEXAMPLESFILES) debian/control
89 # Construct the plugin's 'postinst' script out of a template in debian/dsf-in/plugin.postinst
90 debian/$(PACKAGE)-plugin-%.postinst:
91 PLUGLONGNAME="$$(cat '$(CURDIR)/plugins/$*/NAME')"; \
92 test -n "$$PLUGLONGNAME" || exit 1; \
93 srcf='$(CURDIR)/plugins/$*/debian/plugin-$*.postinst'; \
94 test -e "$$srcf" || srcf='$(CURDIR)/debian/dsf-in/plugin.postinst'; \
96 -e 's/@PLUGSHORTNAME@/$*/g' \
97 -e "s/@PLUGLONGNAME@/$$PLUGLONGNAME/g" \
98 "$$srcf" >$@ || (rm -f $@; exit 1)
100 # Construct the plugin's 'prerm' script out of a template in debian/dsf-in/plugin.prerm
101 debian/$(PACKAGE)-plugin-%.prerm:
102 PLUGLONGNAME="$$(cat '$(CURDIR)/plugins/$*/NAME')"; \
103 test -n "$$PLUGLONGNAME" || exit 1; \
104 srcf='$(CURDIR)/plugins/$*/debian/plugin-$*.prerm'; \
105 test -e "$$srcf" || srcf='$(CURDIR)/debian/dsf-in/plugin.prerm'; \
107 -e 's/@PLUGSHORTNAME@/$*/g' \
108 -e "s/@PLUGLONGNAME@/$$PLUGLONGNAME/g" \
109 "$$srcf" >$@ || (rm -f $@; exit 1)
111 # Perform substitutions in plugin's cron.d file
112 debian/$(PACKAGE)-plugin-%.cron.d:
113 $(SED_REPLACE) -e 's/\$$FFUSER/$(OLDPACKAGE)/g' $(CURDIR)/plugins/$*/packaging/cron.d/plugin-$* > $@
115 # Add a prefix and perform substitutions on the main cron.d files
116 debian/$(OLDPACKAGE)-%.cron.d:
117 (cat $(CURDIR)/packaging/cron.d/00phpcron ; $(SED_REPLACE) -e 's/\$$FFUSER/$(OLDPACKAGE)/g' $(CURDIR)/packaging/cron.d/$*) | $(SED_REPLACE) > $@
119 # Perform subsitutions on 'dirs', 'links', 'install', 'docs', 'triggers' files
120 debian/$(PACKAGE)-plugin-%.dirs:
121 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/dirs/plugin-$* > $@
123 debian/$(OLDPACKAGE)-%.dirs:
124 $(SED_REPLACE) $(CURDIR)/packaging/dirs/$* > $@
126 debian/$(PACKAGE)-plugin-%.links:
127 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/links/plugin-$* > $@
129 debian/$(OLDPACKAGE)-%.links:
130 $(SED_REPLACE) $(CURDIR)/packaging/links/$* > $@
132 debian/$(PACKAGE)-plugin-%.install:
133 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/install/plugin-$* > $@
135 debian/$(PACKAGE)-plugin-%.triggers:
136 $(SED_REPLACE) $(CURDIR)/plugins/$*/debian/plugin-$*.triggers > $@
138 debian/$(OLDPACKAGE)-%.install:
139 $(SED_REPLACE) $(CURDIR)/packaging/install/$* > $@
141 debian/$(PACKAGE)-plugin-%.docs:
142 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/docs/plugin-$* > $@
143 debian/$(OLDPACKAGE)-%.docs:
144 $(SED_REPLACE) $(CURDIR)/packaging/docs/$* > $@
145 debian/$(PACKAGE)-%.docs:
146 $(SED_REPLACE) $(CURDIR)/packaging/docs/$* > $@
148 debian/$(PACKAGE)-plugin-%.examples:
149 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/examples/plugin-$* > $@
151 debian/$(OLDPACKAGE)-%.README.Debian:
152 $(SED_REPLACE) $(CURDIR)/packaging/readme/$* > $@
153 debian/$(PACKAGE)-%.README.Debian:
154 $(SED_REPLACE) $(CURDIR)/packaging/readme/$* > $@
156 # Construct the control file
157 debian/control: $(wildcard packaging/control/*) $(wildcard plugins/*/packaging/control/[1-9][0-9][0-9]*) $(wildcard plugins/*/etc/*.ini)
158 ls $(CURDIR)/packaging/control/[0-9][0-9][0-9]* | grep -v shortdesc | \
159 while read file ; do \
161 if [ -f $${file}.shortdesc ] ; then \
162 cat $(CURDIR)/packaging/control/AAAdesc; \
164 cat $${file}.shortdesc; \
167 done | $(SED_REPLACE) > $@
168 @echo Enabled plugins: $(ENABLED_PLUGINS)
169 @echo Skipped plugins: $(shell sh $(CURDIR)/utils/list-enabled-plugins.sh --disabled)
170 for plugin in $(ENABLED_PLUGINS) ; do \
171 ls plugins/$$plugin/packaging/control/[1-9][0-9][0-9]plugin-$$plugin ; \
173 while read file ; do \
175 if [ -f $${file}.shortdesc ] ; then \
176 cat $(CURDIR)/packaging/control/AAAdesc; \
178 cat $${file}.shortdesc; \
181 done | $(SED_REPLACE) >> $@
183 # Update the translation of package descriptions fields
184 debian/po/templates.pot: $(wildcard debian/dsf-in/*.templates.dsfh-in) $(wildcard debian/dsf-helper/*.templates)
185 @debconf-updatepo --podir=debian/dsf-po
188 cat $(patsubst debian/po/%, debian/dsf-po/%, $@) | $(SED_REPLACE) > $@
190 override_dh_auto_build:
192 build: remove-binary-files debian/po/templates.pot conffiles
195 # Build man pages from Docbook sources
196 cat debian/dsf-in/common.manpages | $(SED_REPLACE) > debian/$(OLDPACKAGE)-common.manpages
197 /usr/bin/docbook-to-man debian/cvssh.sgml > cvssh.1
199 # Build README.Debian from template
200 cat debian/README.Debian.tmpl | $(SED_REPLACE) > debian/README.Debian
202 # Uudecode binary files
203 sh $(CURDIR)/deb-specific/manage-uufiles.sh decode
205 # Build gettext *.mo files
206 utils/manage-translations.sh build
208 # Build FHS-compatible Apache config files (generates contents of etc/httpd.conf.d-fhs/ etc.)
209 utils/manage-apache-config.sh build
211 # Update SQL for list of country codes
212 utils/ffcountries.pl > 200403251.sql
214 # Preprocess files with DSF-Helper
215 perl $(CURDIR)/deb-specific/dsf-helper.pl
217 clean: remove-binary-files
220 rm -f $(CURDIR)/debian/*.cron.d
221 rm -f $(CURDIR)/debian/*.dirs
222 rm -f $(CURDIR)/debian/*.links
223 rm -f $(CURDIR)/debian/*.install
224 rm -f $(CURDIR)/debian/*.docs
225 rm -f $(CURDIR)/debian/*.examples
226 rm -f $(CURDIR)/debian/*.README.Debian
227 rm -f $(CURDIR)/debian/$(PACKAGE)-config.sgml
228 rm -f $(CURDIR)/debian/$(OLDPACKAGE)-common.manpages
229 rm -f cvssh.1 $(PACKAGE)-config.1 200403251.sql
230 rm -f $(CURDIR)/debian/README.Debian
233 rm -f $(POFILES) $(PPOSTINST) $(PPRERM)
235 perl $(CURDIR)/deb-specific/dsf-helper.pl --clean
239 rm -fr $(CURDIR)/etc/httpd.conf.d-fhs/ $(CURDIR)/etc/httpd.conf.d-opt/ $(CURDIR)/etc/httpd.conf.d-usrlocal/
245 -e 's!@PKGNAME@!${WHICH_FORGE}!g' \
246 -e 's!@PKGVERSION@!${WHICH_VERSION}!g' \
247 -e 's!@PLUCKERNAME@!${WHICH_TYPE}!g' \
248 <$(CURDIR)/deb-specific/pkginfo.inc.php \
249 >$(CURDIR)/debian/$(OLDPACKAGE)-common/usr/share/$(OLDPACKAGE)/common/pkginfo.inc.php
252 chmod 755 $(CURDIR)/debian/*/*/*/*/bin/* $(CURDIR)/debian/*/*/*/*/cronjobs/* \
253 $(CURDIR)/debian/*/bin/* $(CURDIR)/debian/*/usr/share/*/plugins/*/bin/* \
254 $(CURDIR)/debian/*/usr/share/*/plugins/*/cronjobs/*
255 chmod 644 $(CURDIR)/debian/$(OLDPACKAGE)-db-postgresql/usr/share/$(OLDPACKAGE)/cronjobs/*.inc
257 chmod 755 $(CURDIR)/debian/$(OLDPACKAGE)-db-postgresql/usr/share/*/db/*.php
259 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/*/www/scm/viewvc/bin/cgi/viewvc-strace.sh
261 find $(CURDIR)/debian/$(OLDPACKAGE)-common/usr/share/*/common/docman/engine/ -type f -name \*.php -not -name \*.inc.php -exec chmod 0755 {} \;
262 find $(CURDIR)/debian/$(OLDPACKAGE)-common/usr/share/*/common/docman/engine/ -type f -name \*.sh -exec chmod 0755 {} \;
264 rm -f $(CURDIR)/debian/$(PACKAGE)-plugin-scm*/usr/share/*/plugins/scm*/*/README
265 chmod 755 $(CURDIR)/debian/$(PACKAGE)-plugin-scmcvs/usr/share/*/plugins/scmcvs/sbin/*
267 # Rename config files
268 mv $(CURDIR)/debian/$(OLDPACKAGE)-common/etc/$(PACKAGE)/config.ini-fhs $(CURDIR)/debian/$(OLDPACKAGE)-common/etc/$(PACKAGE)/config.ini
269 mkdir -p $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d
270 cp $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/$(OLDPACKAGE)/etc/httpd.conf.d-fhs/*.conf $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/
271 cp $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/$(OLDPACKAGE)/etc/httpd.conf.d-fhs/*.inc $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/
272 cp $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/$(OLDPACKAGE)/etc/httpd.conf-fhs $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf
274 # Remove those that need to be generated at install time
275 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/secrets.inc
276 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/vhost-list.inc
277 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/vhost-main.inc
278 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/vhost-projects.inc
280 # Remove Windows files
281 rm -rf $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/*/www/scm/viewvc/windows
283 # Remove extra copies of the GNU GPLv2
284 rm -f $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/*/www/themes/*/COPYING
286 # Remove Snoopy class from binary packages (provided by libphp-snoopy)
287 find $(addprefix $(CURDIR)/debian/, $(shell dh_listpackages)) -name Snoopy.class.php | xargs -r rm
289 # Remove NuSOAP class from binary packages (provided by libnusoap-php)
290 find $(addprefix $(CURDIR)/debian/, $(shell dh_listpackages)) -name nusoap.php | xargs -r rm
292 # Remove potential SCM artefacts from binary packages
293 find $(addprefix $(CURDIR)/debian/, $(shell dh_listpackages)) -name .svn -or -name {arch} -or -name .arch-ids -or -name .bzr -or -name .cvsignore | xargs -r rm -rf
295 # Also remove uuencoded files
296 find $(addprefix $(CURDIR)/debian/, $(shell dh_listpackages)) -name \*.uu | xargs -r rm