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 DOCSFILES=$(patsubst packaging/docs/%,debian/$(OLDPACKAGE)-%.docs,$(wildcard packaging/docs/[a-z]*)) \
51 $(patsubst packaging/docs/%,debian/$(PACKAGE)-%.docs,$(wildcard packaging/docs/[a-z]*))
52 PDOCSFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/docs/[a-z]*),debian/$(PACKAGE)-plugin-$i.docs))
54 PEXAMPLESSFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/examples/[a-z]*),debian/$(PACKAGE)-plugin-$i.examples))
55 READMEFILES=$(patsubst packaging/readme/%,debian/$(OLDPACKAGE)-%.README.Debian,$(wildcard packaging/readme/[a-z]*)) \
56 $(patsubst packaging/readme/%,debian/$(PACKAGE)-%.README.Debian,$(wildcard packaging/readme/[a-z]*))
58 POFILES=$(patsubst debian/dsf-po/%,debian/po/%,$(wildcard debian/dsf-po/*) debian/po/POTFILES.in)
60 # Displays the variables to check if globbing and substitutions are correct
62 @echo "ENABLED_PLUGINS=$(ENABLED_PLUGINS)"
64 @echo "PPOSTINST=$(PPOSTINST)"
65 @echo "PPRERM=$(PPRERM)"
67 @echo "CRONDFILES=$(CRONDFILES)"
68 @echo "DIRSFILES=$(DIRSFILES)"
69 @echo "LINKSFILES=$(LINKSFILES)"
70 @echo "INSTALLFILES=$(INSTALLFILES)"
71 @echo "DOCSFILES=$(DOCSFILES)"
72 @echo "READMEFILES=$(READMEFILES)"
74 @echo "PCRONDFILES=$(PCRONDFILES)"
75 @echo "PDIRSFILES=$(PDIRSFILES)"
76 @echo "PLINKSFILES=$(PLINKSFILES)"
77 @echo "PINSTALLFILES=$(PINSTALLFILES)"
78 @echo "PDOCSFILES=$(PDOCSFILES)"
79 @echo "PEXAMPLESFILES=$(PEXAMPLESFILES)"
82 sh $(CURDIR)/deb-specific/manage-uufiles.sh clean
85 conffiles: $(PPOSTINST) $(PPRERM) $(CRONDFILES) $(DIRSFILES) $(LINKSFILES) $(INSTALLFILES) $(DOCSFILES) $(READMEFILES) $(PCRONDFILES) $(PDIRSFILES) $(PLINKSFILES) $(PINSTALLFILES) $(PDOCSFILES) $(PEXAMPLESFILES) debian/control
87 # Construct the plugin's 'postinst' script out of a template in debian/dsf-in/plugin.postinst
88 debian/$(PACKAGE)-plugin-%.postinst:
89 export PLUGLONGNAME="`cat $(CURDIR)/plugins/$*/NAME`"; \
90 $(SED_REPLACE) -e 's/@PLUGSHORTNAME@/$*/g' -e "s/@PLUGLONGNAME@/$$PLUGLONGNAME/g" $(CURDIR)/debian/dsf-in/plugin.postinst > $@
92 # Construct the plugin's 'prerm' script out of a template in debian/dsf-in/plugin.prerm
93 debian/$(PACKAGE)-plugin-%.prerm:
94 export PLUGLONGNAME="`cat $(CURDIR)/plugins/$*/NAME`"; \
95 $(SED_REPLACE) -e 's/@PLUGSHORTNAME@/$*/g' -e "s/@PLUGLONGNAME@/$$PLUGLONGNAME/g" $(CURDIR)/debian/dsf-in/plugin.prerm > $@
97 # Perform substitutions in plugin's cron.d file
98 debian/$(PACKAGE)-plugin-%.cron.d:
99 $(SED_REPLACE) -e 's/\$$FFUSER/$(OLDPACKAGE)/g' $(CURDIR)/plugins/$*/packaging/cron.d/plugin-$* > $@
101 # Add a prefix and perform substitutions on the main cron.d files
102 debian/$(OLDPACKAGE)-%.cron.d:
103 (cat $(CURDIR)/packaging/cron.d/00phpcron ; $(SED_REPLACE) -e 's/\$$FFUSER/$(OLDPACKAGE)/g' $(CURDIR)/packaging/cron.d/$*) | $(SED_REPLACE) > $@
105 # Perform subsitutions on 'dirs', 'links', 'install', 'docs' files
106 debian/$(PACKAGE)-plugin-%.dirs:
107 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/dirs/plugin-$* > $@
109 debian/$(OLDPACKAGE)-%.dirs:
110 $(SED_REPLACE) $(CURDIR)/packaging/dirs/$* > $@
112 debian/$(PACKAGE)-plugin-%.links:
113 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/links/plugin-$* > $@
115 debian/$(OLDPACKAGE)-%.links:
116 $(SED_REPLACE) $(CURDIR)/packaging/links/$* > $@
118 debian/$(PACKAGE)-plugin-%.install:
119 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/install/plugin-$* > $@
121 debian/$(OLDPACKAGE)-%.install:
122 $(SED_REPLACE) $(CURDIR)/packaging/install/$* > $@
124 debian/$(PACKAGE)-plugin-%.docs:
125 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/docs/plugin-$* > $@
126 debian/$(OLDPACKAGE)-%.docs:
127 $(SED_REPLACE) $(CURDIR)/packaging/docs/$* > $@
128 debian/$(PACKAGE)-%.docs:
129 $(SED_REPLACE) $(CURDIR)/packaging/docs/$* > $@
131 debian/$(PACKAGE)-plugin-%.examples:
132 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/examples/plugin-$* > $@
134 debian/$(OLDPACKAGE)-%.README.Debian:
135 $(SED_REPLACE) $(CURDIR)/packaging/readme/$* > $@
136 debian/$(PACKAGE)-%.README.Debian:
137 $(SED_REPLACE) $(CURDIR)/packaging/readme/$* > $@
139 # Construct the control file
140 debian/control: $(wildcard packaging/control/*) $(wildcard plugins/*/packaging/control/[1-9][0-9][0-9]*) $(wildcard plugins/*/etc/*.ini)
141 ls $(CURDIR)/packaging/control/[0-9][0-9][0-9]* | grep -v shortdesc | \
142 while read file ; do \
144 if [ -f $${file}.shortdesc ] ; then \
145 cat $(CURDIR)/packaging/control/AAAdesc; \
147 cat $${file}.shortdesc; \
150 done | $(SED_REPLACE) > $@
151 @echo Enabled plugins: $(ENABLED_PLUGINS)
152 @echo Skipped plugins: $(shell sh $(CURDIR)/utils/list-enabled-plugins.sh --disabled)
153 for plugin in $(ENABLED_PLUGINS) ; do \
154 ls plugins/$$plugin/packaging/control/[1-9][0-9][0-9]plugin-$$plugin ; \
156 while read file ; do \
158 if [ -f $${file}.shortdesc ] ; then \
159 cat $(CURDIR)/packaging/control/AAAdesc; \
161 cat $${file}.shortdesc; \
164 done | $(SED_REPLACE) >> $@
166 # Update the translation of package descriptions fields
167 debian/po/templates.pot: $(wildcard debian/dsf-in/*.templates.dsfh-in) $(wildcard debian/dsf-helper/*.templates)
168 @debconf-updatepo --podir=debian/dsf-po
171 cat $(patsubst debian/po/%, debian/dsf-po/%, $@) | $(SED_REPLACE) > $@
173 build: remove-binary-files debian/po/templates.pot conffiles
176 # Build man pages from Docbook sources
177 cat debian/dsf-in/config.sgml | $(SED_REPLACE) > debian/$(PACKAGE)-config.sgml
178 cat debian/dsf-in/common.manpages | $(SED_REPLACE) > debian/$(OLDPACKAGE)-common.manpages
179 /usr/bin/docbook-to-man debian/cvssh.sgml > cvssh.1
180 /usr/bin/docbook-to-man debian/$(PACKAGE)-config.sgml > $(PACKAGE)-config.1
182 # Build README.Debian from template
183 cat debian/README.Debian.tmpl | $(SED_REPLACE) > debian/README.Debian
185 # Uudecode binary files
186 sh $(CURDIR)/deb-specific/manage-uufiles.sh decode
188 # Build gettext *.mo files
189 utils/manage-translations.sh build
191 # Build FHS-compatible Apache config files (generates contents of etc/httpd.conf.d-fhs/ etc.)
192 utils/manage-apache-config.sh build
194 # Preprocess files with DSF-Helper
195 perl $(CURDIR)/deb-specific/dsf-helper.pl
197 clean: remove-binary-files
200 rm -f $(CURDIR)/debian/*.cron.d
201 rm -f $(CURDIR)/debian/*.dirs
202 rm -f $(CURDIR)/debian/*.links
203 rm -f $(CURDIR)/debian/*.install
204 rm -f $(CURDIR)/debian/*.docs
205 rm -f $(CURDIR)/debian/*.examples
206 rm -f $(CURDIR)/debian/*.README.Debian
207 rm -f $(CURDIR)/debian/$(PACKAGE)-config.sgml
208 rm -f $(CURDIR)/debian/$(OLDPACKAGE)-common.manpages
209 rm -f cvssh.1 $(PACKAGE)-config.1
210 rm -f $(CURDIR)/debian/README.Debian
213 rm -f $(POFILES) $(PPOSTINST) $(PPRERM)
215 perl $(CURDIR)/deb-specific/dsf-helper.pl --clean
219 rm -fr $(CURDIR)/etc/httpd.conf.d-fhs/ $(CURDIR)/etc/httpd.conf.d-opt/ $(CURDIR)/etc/httpd.conf.d-usrlocal/
225 -e 's!@PKGNAME@!${WHICH_FORGE}!g' \
226 -e 's!@PKGVERSION@!${WHICH_VERSION}!g' \
227 -e 's!@PLUCKERNAME@!${WHICH_TYPE}!g' \
228 <$(CURDIR)/deb-specific/pkginfo.inc.php \
229 >$(CURDIR)/debian/$(OLDPACKAGE)-common/usr/share/$(OLDPACKAGE)/common/pkginfo.inc.php
232 chmod 755 $(CURDIR)/debian/*/*/*/*/bin/* $(CURDIR)/debian/*/*/*/*/cronjobs/* \
233 $(CURDIR)/debian/*/bin/* $(CURDIR)/debian/*/usr/share/*/plugins/*/bin/* \
234 $(CURDIR)/debian/*/usr/share/*/plugins/*/cronjobs/*
235 chmod 644 $(CURDIR)/debian/$(OLDPACKAGE)-db-postgresql/usr/share/$(OLDPACKAGE)/cronjobs/*.inc
237 chmod 755 $(CURDIR)/debian/$(OLDPACKAGE)-db-postgresql/usr/share/*/db/*.php
239 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/*/www/scm/viewvc/bin/cgi/viewvc-strace.sh
241 find $(CURDIR)/debian/$(OLDPACKAGE)-common/usr/share/*/common/docman/engine/ -type f -name \*.php -not -name \*.inc.php -exec chmod 0755 {} \;
242 find $(CURDIR)/debian/$(OLDPACKAGE)-common/usr/share/*/common/docman/engine/ -type f -name \*.sh -exec chmod 0755 {} \;
244 rm -f $(CURDIR)/debian/$(PACKAGE)-plugin-scm*/usr/share/*/plugins/scm*/*/README
245 chmod 755 $(CURDIR)/debian/$(PACKAGE)-plugin-scmcvs/usr/share/*/plugins/scmcvs/sbin/*
247 # Rename config files
248 mv $(CURDIR)/debian/$(OLDPACKAGE)-common/etc/$(PACKAGE)/config.ini-fhs $(CURDIR)/debian/$(OLDPACKAGE)-common/etc/$(PACKAGE)/config.ini
249 mkdir -p $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d
250 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/
251 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/
252 cp $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/$(OLDPACKAGE)/etc/httpd.conf-fhs $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf
254 # Remove those that need to be generated at install time
255 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/secrets.inc
256 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/vhost-list.inc
257 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/vhost-main.inc
258 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/vhost-projects.inc
260 # Remove Windows files
261 rm -rf $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/*/www/scm/viewvc/windows
263 # Remove extra copies of the GNU GPLv2
264 rm -f $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/*/www/themes/*/COPYING
266 # Remove Snoopy class from binary packages (provided by libphp-snoopy)
267 find $(addprefix $(CURDIR)/debian/, $(shell dh_listpackages)) -name Snoopy.class.php | xargs -r rm
269 # Remove NuSOAP class from binary packages (provided by libnusoap-php)
270 find $(addprefix $(CURDIR)/debian/, $(shell dh_listpackages)) -name nusoap.php | xargs -r rm
272 # Remove potential SCM artefacts from binary packages
273 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
275 # Also remove uuencoded files
276 find $(addprefix $(CURDIR)/debian/, $(shell dh_listpackages)) -name \*.uu | xargs -r rm