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'
27 include /usr/share/dpatch/dpatch.make
29 # The substitutions bellow can be quite tricky, so use 'debian/rules testpat' to check if it's OK
31 ENABLED_PLUGINS=$(shell sh $(CURDIR)/utils/list-enabled-plugins.sh)
33 PPOSTINST=$(foreach i,$(ENABLED_PLUGINS),debian/$(PACKAGE)-plugin-$i.postinst)
34 PPRERM=$(foreach i,$(ENABLED_PLUGINS),debian/$(PACKAGE)-plugin-$i.prerm)
36 CRONDFILES=$(patsubst packaging/cron.d/%,debian/$(OLDPACKAGE)-%.cron.d,$(wildcard packaging/cron.d/[a-z]*))
37 PCRONDFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/cron.d/[a-z]*),debian/$(PACKAGE)-plugin-$i.cron.d))
39 DIRSFILES=$(patsubst packaging/dirs/%,debian/$(OLDPACKAGE)-%.dirs,$(wildcard packaging/dirs/[a-z]*))
40 PDIRSFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/dirs/[a-z]*),debian/$(PACKAGE)-plugin-$i.dirs))
42 LINKSFILES=$(patsubst packaging/links/%,debian/$(OLDPACKAGE)-%.links,$(wildcard packaging/links/[a-z]*))
43 PLINKSFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/links/[a-z]*),debian/$(PACKAGE)-plugin-$i.links))
45 INSTALLFILES=$(patsubst packaging/install/%,debian/$(OLDPACKAGE)-%.install,$(wildcard packaging/install/[a-z]*))
46 PINSTALLFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/install/[a-z]*),debian/$(PACKAGE)-plugin-$i.install))
48 DOCSFILES=$(patsubst packaging/docs/%,debian/$(OLDPACKAGE)-%.docs,$(wildcard packaging/docs/[a-z]*)) \
49 $(patsubst packaging/docs/%,debian/$(PACKAGE)-%.docs,$(wildcard packaging/docs/[a-z]*))
50 PDOCSFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/docs/[a-z]*),debian/$(PACKAGE)-plugin-$i.docs))
52 PEXAMPLESSFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/examples/[a-z]*),debian/$(PACKAGE)-plugin-$i.examples))
54 POFILES=$(patsubst debian/dsf-po/%,debian/po/%,$(wildcard debian/dsf-po/*) debian/po/POTFILES.in)
56 # Displays the variables to check if globbing and substitutions are correct
58 @echo "ENABLED_PLUGINS=$(ENABLED_PLUGINS)"
60 @echo "PPOSTINST=$(PPOSTINST)"
61 @echo "PPRERM=$(PPRERM)"
63 @echo "CRONDFILES=$(CRONDFILES)"
64 @echo "DIRSFILES=$(DIRSFILES)"
65 @echo "LINKSFILES=$(LINKSFILES)"
66 @echo "INSTALLFILES=$(INSTALLFILES)"
67 @echo "DOCSFILES=$(DOCSFILES)"
69 @echo "PCRONDFILES=$(PCRONDFILES)"
70 @echo "PDIRSFILES=$(PDIRSFILES)"
71 @echo "PLINKSFILES=$(PLINKSFILES)"
72 @echo "PINSTALLFILES=$(PINSTALLFILES)"
73 @echo "PDOCSFILES=$(PDOCSFILES)"
74 @echo "PEXAMPLESFILES=$(PEXAMPLESFILES)"
77 sh $(CURDIR)/deb-specific/manage-uufiles.sh clean
80 conffiles: $(PPOSTINST) $(PPRERM) $(CRONDFILES) $(DIRSFILES) $(LINKSFILES) $(INSTALLFILES) $(DOCSFILES) $(PCRONDFILES) $(PDIRSFILES) $(PLINKSFILES) $(PINSTALLFILES) $(PDOCSFILES) $(PEXAMPLESFILES) debian/control
82 # Construct the plugin's 'postinst' script out of a template in debian/dsf-in/plugin.postinst
83 debian/$(PACKAGE)-plugin-%.postinst:
84 export PLUGLONGNAME="`cat $(CURDIR)/plugins/$*/NAME`"; \
85 $(SED_REPLACE) -e 's/@PLUGSHORTNAME@/$*/g' -e "s/@PLUGLONGNAME@/$$PLUGLONGNAME/g" $(CURDIR)/debian/dsf-in/plugin.postinst > $@
87 # Construct the plugin's 'prerm' script out of a template in debian/dsf-in/plugin.prerm
88 debian/$(PACKAGE)-plugin-%.prerm:
89 export PLUGLONGNAME="`cat $(CURDIR)/plugins/$*/NAME`"; \
90 $(SED_REPLACE) -e 's/@PLUGSHORTNAME@/$*/g' -e "s/@PLUGLONGNAME@/$$PLUGLONGNAME/g" $(CURDIR)/debian/dsf-in/plugin.prerm > $@
92 # Perform substitutions in plugin's cron.d file
93 debian/$(PACKAGE)-plugin-%.cron.d:
94 $(SED_REPLACE) -e 's/\$$FFUSER/$(OLDPACKAGE)/g' $(CURDIR)/plugins/$*/packaging/cron.d/plugin-$* > $@
96 # Add a prefix and perform substitutions on the main cron.d files
97 debian/$(OLDPACKAGE)-%.cron.d:
98 (cat $(CURDIR)/packaging/cron.d/00phpcron ; $(SED_REPLACE) -e 's/\$$FFUSER/$(OLDPACKAGE)/g' $(CURDIR)/packaging/cron.d/$*) | $(SED_REPLACE) > $@
100 # Perform subsitutions on 'dirs', 'links', 'install', 'docs' files
101 debian/$(PACKAGE)-plugin-%.dirs:
102 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/dirs/plugin-$* > $@
104 debian/$(OLDPACKAGE)-%.dirs:
105 $(SED_REPLACE) $(CURDIR)/packaging/dirs/$* > $@
107 debian/$(PACKAGE)-plugin-%.links:
108 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/links/plugin-$* > $@
110 debian/$(OLDPACKAGE)-%.links:
111 $(SED_REPLACE) $(CURDIR)/packaging/links/$* > $@
113 debian/$(PACKAGE)-plugin-%.install:
114 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/install/plugin-$* > $@
116 debian/$(OLDPACKAGE)-%.install:
117 $(SED_REPLACE) $(CURDIR)/packaging/install/$* > $@
119 debian/$(PACKAGE)-plugin-%.docs:
120 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/docs/plugin-$* > $@
121 debian/$(OLDPACKAGE)-%.docs:
122 $(SED_REPLACE) $(CURDIR)/packaging/docs/$* > $@
123 debian/$(PACKAGE)-%.docs:
124 $(SED_REPLACE) $(CURDIR)/packaging/docs/$* > $@
126 debian/$(PACKAGE)-plugin-%.examples:
127 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/examples/plugin-$* > $@
129 # Construct the control file
130 debian/control: $(wildcard packaging/control/*) $(wildcard plugins/*/packaging/control/[1-9][0-9][0-9]*) $(wildcard plugins/*/etc/*.ini)
131 ls $(CURDIR)/packaging/control/[0-9][0-9][0-9]* | grep -v shortdesc | while read file ; do cat $${file}; if [ -f $${file}.shortdesc ] ; then cat $(CURDIR)/packaging/control/AAAdesc; echo ' .'; cat $${file}.shortdesc; fi; echo ''; done | $(SED_REPLACE) > $@
132 @echo Enabled plugins: $(ENABLED_PLUGINS)
133 @echo Skipped plugins: $(shell $(CURDIR)/utils/list-enabled-plugins.sh --disabled)
134 for plugin in $(ENABLED_PLUGINS) ; do ls plugins/$$plugin/packaging/control/[1-9][0-9][0-9]plugin-$$plugin ; done | while read file ; do cat $${file}; if [ -f $${file}.shortdesc ] ; then cat $(CURDIR)/packaging/control/AAAdesc; echo ' .'; cat $${file}.shortdesc; fi; echo ''; done | $(SED_REPLACE) >> $@
136 # Update the translation of package descriptions fields
137 debian/po/templates.pot: $(wildcard debian/dsf-in/*.templates.dsfh-in) $(wildcard debian/dsf-helper/*.templates)
138 @debconf-updatepo --podir=debian/dsf-po
141 cat $(patsubst debian/po/%, debian/dsf-po/%, $@) | $(SED_REPLACE) > $@
145 build: patch remove-binary-files debian/po/templates.pot conffiles
148 # Build man pages from Docbook sources
149 cat debian/dsf-in/config.sgml | $(SED_REPLACE) > debian/$(PACKAGE)-config.sgml
150 cat debian/dsf-in/common.manpages | $(SED_REPLACE) > debian/$(OLDPACKAGE)-common.manpages
151 /usr/bin/docbook-to-man debian/cvssh.sgml > cvssh.1
152 /usr/bin/docbook-to-man debian/$(PACKAGE)-config.sgml > $(PACKAGE)-config.1
154 # Build README.Debian from template
155 cat debian/README.Debian.tmpl | $(SED_REPLACE) > debian/README.Debian
157 # Uudecode binary files
158 sh $(CURDIR)/deb-specific/manage-uufiles.sh decode
160 # Build gettext *.mo files
161 utils/manage-translations.sh build
163 # Build FHS-compatible Apache config files (generates contents of etc/httpd.conf.d-fhs/ etc.)
164 utils/manage-apache-config.sh build
166 # Preprocess files with DSF-Helper
167 perl $(CURDIR)/deb-specific/dsf-helper.pl
170 clean: remove-binary-files unpatch
173 rm -f $(CURDIR)/debian/*.cron.d
174 rm -f $(CURDIR)/debian/*.dirs
175 rm -f $(CURDIR)/debian/*.links
176 rm -f $(CURDIR)/debian/*.install
177 rm -f $(CURDIR)/debian/*.docs
178 rm -f $(CURDIR)/debian/*.examples
179 rm -f $(CURDIR)/debian/$(PACKAGE)-config.sgml
180 rm -f $(CURDIR)/debian/$(OLDPACKAGE)-common.manpages
181 rm -f cvssh.1 $(PACKAGE)-config.1
182 rm -f $(CURDIR)/debian/README.Debian
187 perl $(CURDIR)/deb-specific/dsf-helper.pl --clean
194 -e 's!@PKGNAME@!${WHICH_FORGE}!g' \
195 -e 's!@PKGVERSION@!${WHICH_VERSION}!g' \
196 -e 's!@PLUCKERNAME@!${WHICH_TYPE}!g' \
197 <$(CURDIR)/deb-specific/pkginfo.inc.php \
198 >$(CURDIR)/debian/$(OLDPACKAGE)-common/usr/share/$(OLDPACKAGE)/common/pkginfo.inc.php
201 chmod 755 $(CURDIR)/debian/*/*/*/*/bin/* $(CURDIR)/debian/*/*/*/*/cronjobs/* \
202 $(CURDIR)/debian/*/bin/* $(CURDIR)/debian/*/usr/share/*/plugins/*/bin/* \
203 $(CURDIR)/debian/*/usr/share/*/plugins/*/cronjobs/*
204 chmod 644 $(CURDIR)/debian/$(OLDPACKAGE)-db-postgresql/usr/share/$(OLDPACKAGE)/cronjobs/*.inc
206 chmod 755 $(CURDIR)/debian/$(OLDPACKAGE)-db-postgresql/usr/share/*/db/*.php
208 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/*/www/scm/viewvc/bin/cgi/viewvc-strace.sh
210 find $(CURDIR)/debian/$(OLDPACKAGE)-common/usr/share/*/common/docman/engine/ -type f -name \*.php -not -name \*.inc.php -exec chmod 0755 {} \;
211 find $(CURDIR)/debian/$(OLDPACKAGE)-common/usr/share/*/common/docman/engine/ -type f -name \*.sh -exec chmod 0755 {} \;
213 rm -f $(CURDIR)/debian/$(PACKAGE)-plugin-scm*/usr/share/*/plugins/scm*/*/README
214 chmod 755 $(CURDIR)/debian/$(PACKAGE)-plugin-scmcvs/usr/share/*/plugins/scmcvs/sbin/*
216 # Rename config files
217 mv $(CURDIR)/debian/$(OLDPACKAGE)-common/etc/$(PACKAGE)/config.ini-fhs $(CURDIR)/debian/$(OLDPACKAGE)-common/etc/$(PACKAGE)/config.ini
218 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
219 cp $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/$(OLDPACKAGE)/etc/httpd.conf-fhs $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf
221 # Remove those that need to be generated at install time
222 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/secrets.inc
223 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/vhost-list.inc
224 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/vhost-main.inc
225 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/vhost-projects.inc
227 # Remove Windows files
228 rm -rf $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/*/www/scm/viewvc/windows
230 rm -f $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/*/www/themes/$(OLDPACKAGE)/COPYING
232 # Remove Snoopy class from binary packages (provided by libphp-snoopy)
233 find $(addprefix $(CURDIR)/debian/, $(shell dh_listpackages)) -name Snoopy.class.php | xargs -r rm
235 # Remove NuSOAP class from binary packages (provided by libnusoap-php)
236 find $(addprefix $(CURDIR)/debian/, $(shell dh_listpackages)) -name nusoap.php | xargs -r rm
238 # Remove potential SCM artefacts from binary packages
239 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
241 # Also remove uuencoded files
242 find $(addprefix $(CURDIR)/debian/, $(shell dh_listpackages)) -name \*.uu | xargs -r rm