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)
32 PPOSTINST=$(foreach i,$(ENABLED_PLUGINS),debian/$(PACKAGE)-plugin-$i.postinst)
33 PPRERM=$(foreach i,$(ENABLED_PLUGINS),debian/$(PACKAGE)-plugin-$i.prerm)
35 CRONDFILES=$(patsubst packaging/cron.d/%,debian/$(OLDPACKAGE)-%.cron.d,$(wildcard packaging/cron.d/[a-z]*))
36 PCRONDFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/cron.d/[a-z]*),debian/$(PACKAGE)-plugin-$i.cron.d))
38 DIRSFILES=$(patsubst packaging/dirs/%,debian/$(OLDPACKAGE)-%.dirs,$(wildcard packaging/dirs/[a-z]*))
39 PDIRSFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/dirs/[a-z]*),debian/$(PACKAGE)-plugin-$i.dirs))
41 LINKSFILES=$(patsubst packaging/links/%,debian/$(OLDPACKAGE)-%.links,$(wildcard packaging/links/[a-z]*))
42 PLINKSFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/links/[a-z]*),debian/$(PACKAGE)-plugin-$i.links))
44 INSTALLFILES=$(patsubst packaging/install/%,debian/$(OLDPACKAGE)-%.install,$(wildcard packaging/install/[a-z]*))
45 PINSTALLFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/install/[a-z]*),debian/$(PACKAGE)-plugin-$i.install))
47 DOCSFILES=$(patsubst packaging/docs/%,debian/$(OLDPACKAGE)-%.docs,$(wildcard packaging/docs/[a-z]*)) \
48 $(patsubst packaging/docs/%,debian/$(PACKAGE)-%.docs,$(wildcard packaging/docs/[a-z]*))
49 PDOCSFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/docs/[a-z]*),debian/$(PACKAGE)-plugin-$i.docs))
51 PEXAMPLESSFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/examples/[a-z]*),debian/$(PACKAGE)-plugin-$i.examples))
53 POFILES=$(patsubst debian/dsf-po/%,debian/po/%,$(wildcard debian/dsf-po/*) debian/po/POTFILES.in)
55 # Displays the variables to check if globbing and substitutions are correct
57 @echo "ENABLED_PLUGINS=$(ENABLED_PLUGINS)"
59 @echo "PPOSTINST=$(PPOSTINST)"
60 @echo "PPRERM=$(PPRERM)"
62 @echo "CRONDFILES=$(CRONDFILES)"
63 @echo "DIRSFILES=$(DIRSFILES)"
64 @echo "LINKSFILES=$(LINKSFILES)"
65 @echo "INSTALLFILES=$(INSTALLFILES)"
66 @echo "DOCSFILES=$(DOCSFILES)"
68 @echo "PCRONDFILES=$(PCRONDFILES)"
69 @echo "PDIRSFILES=$(PDIRSFILES)"
70 @echo "PLINKSFILES=$(PLINKSFILES)"
71 @echo "PINSTALLFILES=$(PINSTALLFILES)"
72 @echo "PDOCSFILES=$(PDOCSFILES)"
73 @echo "PEXAMPLESFILES=$(PEXAMPLESFILES)"
76 sh $(CURDIR)/deb-specific/manage-uufiles.sh clean
79 conffiles: $(PPOSTINST) $(PPRERM) $(CRONDFILES) $(DIRSFILES) $(LINKSFILES) $(INSTALLFILES) $(DOCSFILES) $(PCRONDFILES) $(PDIRSFILES) $(PLINKSFILES) $(PINSTALLFILES) $(PDOCSFILES) $(PEXAMPLESFILES) debian/control
81 # Construct the plugin's 'postinst' script out of a template in debian/dsf-in/plugin.postinst
82 debian/$(PACKAGE)-plugin-%.postinst:
83 export PLUGLONGNAME="`cat $(CURDIR)/plugins/$*/NAME`"; \
84 $(SED_REPLACE) -e 's/@PLUGSHORTNAME@/$*/g' -e "s/@PLUGLONGNAME@/$$PLUGLONGNAME/g" $(CURDIR)/debian/dsf-in/plugin.postinst > $@
86 # Construct the plugin's 'prerm' script out of a template in debian/dsf-in/plugin.prerm
87 debian/$(PACKAGE)-plugin-%.prerm:
88 export PLUGLONGNAME="`cat $(CURDIR)/plugins/$*/NAME`"; \
89 $(SED_REPLACE) -e 's/@PLUGSHORTNAME@/$*/g' -e "s/@PLUGLONGNAME@/$$PLUGLONGNAME/g" $(CURDIR)/debian/dsf-in/plugin.prerm > $@
91 # Perform substitutions in plugin's cron.d file
92 debian/$(PACKAGE)-plugin-%.cron.d:
93 $(SED_REPLACE) -e 's/\$$FFUSER/$(OLDPACKAGE)/g' $(CURDIR)/plugins/$*/packaging/cron.d/plugin-$* > $@
95 # Add a prefix and perform substitutions on the main cron.d files
96 debian/$(OLDPACKAGE)-%.cron.d:
97 (cat $(CURDIR)/packaging/cron.d/00phpcron ; $(SED_REPLACE) -e 's/\$$FFUSER/$(OLDPACKAGE)/g' $(CURDIR)/packaging/cron.d/$*) | $(SED_REPLACE) > $@
99 # Perform subsitutions on 'dirs', 'links', 'install', 'docs' files
100 debian/$(PACKAGE)-plugin-%.dirs:
101 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/dirs/plugin-$* > $@
103 debian/$(OLDPACKAGE)-%.dirs:
104 $(SED_REPLACE) $(CURDIR)/packaging/dirs/$* > $@
106 debian/$(PACKAGE)-plugin-%.links:
107 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/links/plugin-$* > $@
109 debian/$(OLDPACKAGE)-%.links:
110 $(SED_REPLACE) $(CURDIR)/packaging/links/$* > $@
112 debian/$(PACKAGE)-plugin-%.install:
113 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/install/plugin-$* > $@
115 debian/$(OLDPACKAGE)-%.install:
116 $(SED_REPLACE) $(CURDIR)/packaging/install/$* > $@
118 debian/$(PACKAGE)-plugin-%.docs:
119 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/docs/plugin-$* > $@
120 debian/$(OLDPACKAGE)-%.docs:
121 $(SED_REPLACE) $(CURDIR)/packaging/docs/$* > $@
122 debian/$(PACKAGE)-%.docs:
123 $(SED_REPLACE) $(CURDIR)/packaging/docs/$* > $@
125 debian/$(PACKAGE)-plugin-%.examples:
126 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/examples/plugin-$* > $@
128 # Construct the control file
129 debian/control: $(wildcard packaging/control/*) $(wildcard plugins/*/packaging/control/[1-9][0-9][0-9]*) $(wildcard plugins/*/etc/*.ini)
130 ls $(CURDIR)/packaging/control/[0-9][0-9][0-9]* | grep -v shortdesc | \
131 while read file ; do \
133 if [ -f $${file}.shortdesc ] ; then \
134 cat $(CURDIR)/packaging/control/AAAdesc; \
136 cat $${file}.shortdesc; \
139 done | $(SED_REPLACE) > $@
140 @echo Enabled plugins: $(ENABLED_PLUGINS)
141 @echo Skipped plugins: $(shell $(CURDIR)/utils/list-enabled-plugins.sh --disabled)
142 for plugin in $(ENABLED_PLUGINS) ; do \
143 ls plugins/$$plugin/packaging/control/[1-9][0-9][0-9]plugin-$$plugin ; \
145 while read file ; do \
147 if [ -f $${file}.shortdesc ] ; then \
148 cat $(CURDIR)/packaging/control/AAAdesc; \
150 cat $${file}.shortdesc; \
153 done | $(SED_REPLACE) >> $@
155 # Update the translation of package descriptions fields
156 debian/po/templates.pot: $(wildcard debian/dsf-in/*.templates.dsfh-in) $(wildcard debian/dsf-helper/*.templates)
157 @debconf-updatepo --podir=debian/dsf-po
160 cat $(patsubst debian/po/%, debian/dsf-po/%, $@) | $(SED_REPLACE) > $@
162 build: remove-binary-files debian/po/templates.pot conffiles
165 # Build man pages from Docbook sources
166 cat debian/dsf-in/config.sgml | $(SED_REPLACE) > debian/$(PACKAGE)-config.sgml
167 cat debian/dsf-in/common.manpages | $(SED_REPLACE) > debian/$(OLDPACKAGE)-common.manpages
168 /usr/bin/docbook-to-man debian/cvssh.sgml > cvssh.1
169 /usr/bin/docbook-to-man debian/$(PACKAGE)-config.sgml > $(PACKAGE)-config.1
171 # Build README.Debian from template
172 cat debian/README.Debian.tmpl | $(SED_REPLACE) > debian/README.Debian
174 # Uudecode binary files
175 sh $(CURDIR)/deb-specific/manage-uufiles.sh decode
177 # Build gettext *.mo files
178 utils/manage-translations.sh build
180 # Build FHS-compatible Apache config files (generates contents of etc/httpd.conf.d-fhs/ etc.)
181 utils/manage-apache-config.sh build
183 # Preprocess files with DSF-Helper
184 perl $(CURDIR)/deb-specific/dsf-helper.pl
186 clean: remove-binary-files
189 rm -f $(CURDIR)/debian/*.cron.d
190 rm -f $(CURDIR)/debian/*.dirs
191 rm -f $(CURDIR)/debian/*.links
192 rm -f $(CURDIR)/debian/*.install
193 rm -f $(CURDIR)/debian/*.docs
194 rm -f $(CURDIR)/debian/*.examples
195 rm -f $(CURDIR)/debian/$(PACKAGE)-config.sgml
196 rm -f $(CURDIR)/debian/$(OLDPACKAGE)-common.manpages
197 rm -f cvssh.1 $(PACKAGE)-config.1
198 rm -f $(CURDIR)/debian/README.Debian
203 perl $(CURDIR)/deb-specific/dsf-helper.pl --clean
207 rm -fr $(CURDIR)/etc/httpd.conf.d-fhs/ $(CURDIR)/etc/httpd.conf.d-opt/ $(CURDIR)/etc/httpd.conf.d-usrlocal/
213 -e 's!@PKGNAME@!${WHICH_FORGE}!g' \
214 -e 's!@PKGVERSION@!${WHICH_VERSION}!g' \
215 -e 's!@PLUCKERNAME@!${WHICH_TYPE}!g' \
216 <$(CURDIR)/deb-specific/pkginfo.inc.php \
217 >$(CURDIR)/debian/$(OLDPACKAGE)-common/usr/share/$(OLDPACKAGE)/common/pkginfo.inc.php
220 chmod 755 $(CURDIR)/debian/*/*/*/*/bin/* $(CURDIR)/debian/*/*/*/*/cronjobs/* \
221 $(CURDIR)/debian/*/bin/* $(CURDIR)/debian/*/usr/share/*/plugins/*/bin/* \
222 $(CURDIR)/debian/*/usr/share/*/plugins/*/cronjobs/*
223 chmod 644 $(CURDIR)/debian/$(OLDPACKAGE)-db-postgresql/usr/share/$(OLDPACKAGE)/cronjobs/*.inc
225 chmod 755 $(CURDIR)/debian/$(OLDPACKAGE)-db-postgresql/usr/share/*/db/*.php
227 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/*/www/scm/viewvc/bin/cgi/viewvc-strace.sh
229 find $(CURDIR)/debian/$(OLDPACKAGE)-common/usr/share/*/common/docman/engine/ -type f -name \*.php -not -name \*.inc.php -exec chmod 0755 {} \;
230 find $(CURDIR)/debian/$(OLDPACKAGE)-common/usr/share/*/common/docman/engine/ -type f -name \*.sh -exec chmod 0755 {} \;
232 rm -f $(CURDIR)/debian/$(PACKAGE)-plugin-scm*/usr/share/*/plugins/scm*/*/README
233 chmod 755 $(CURDIR)/debian/$(PACKAGE)-plugin-scmcvs/usr/share/*/plugins/scmcvs/sbin/*
235 # Rename config files
236 mv $(CURDIR)/debian/$(OLDPACKAGE)-common/etc/$(PACKAGE)/config.ini-fhs $(CURDIR)/debian/$(OLDPACKAGE)-common/etc/$(PACKAGE)/config.ini
237 cp -r $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/$(OLDPACKAGE)/etc/httpd.conf.d-fhs $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d
238 cp $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/$(OLDPACKAGE)/etc/httpd.conf-fhs $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf
240 # Remove those that need to be generated at install time
241 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/secrets.inc
242 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/vhost-list.inc
243 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/vhost-main.inc
244 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/vhost-projects.inc
246 # Remove Windows files
247 rm -rf $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/*/www/scm/viewvc/windows
249 rm -f $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/*/www/themes/$(OLDPACKAGE)/COPYING
251 # Remove Snoopy class from binary packages (provided by libphp-snoopy)
252 find $(addprefix $(CURDIR)/debian/, $(shell dh_listpackages)) -name Snoopy.class.php | xargs -r rm
254 # Remove NuSOAP class from binary packages (provided by libnusoap-php)
255 find $(addprefix $(CURDIR)/debian/, $(shell dh_listpackages)) -name nusoap.php | xargs -r rm
257 # Remove potential SCM artefacts from binary packages
258 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
260 # Also remove uuencoded files
261 find $(addprefix $(CURDIR)/debian/, $(shell dh_listpackages)) -name \*.uu | xargs -r rm