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 SED_REPLACE=sed -e 's/@PACKAGE@/$(PACKAGE)/g' -e 's/@SRCPACKAGE@/$(SRCPACKAGE)/g' -e 's/@OLDPACKAGE@/$(OLDPACKAGE)/g' -e 's/@FORGENAME@/$(FORGENAME)/g'
26 include /usr/share/dpatch/dpatch.make
28 ENABLED_PLUGINS=$(shell sh $(CURDIR)/utils/list-enabled-plugins.sh)
30 PPOSTINST=$(foreach i,$(ENABLED_PLUGINS),debian/$(PACKAGE)-plugin-$i.postinst)
31 PPRERM=$(foreach i,$(ENABLED_PLUGINS),debian/$(PACKAGE)-plugin-$i.prerm)
33 CRONDFILES=$(patsubst packaging/cron.d/%,debian/$(OLDPACKAGE)-%.cron.d,$(wildcard packaging/cron.d/[a-z]*))
34 PCRONDFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/cron.d/[a-z]*),debian/$(PACKAGE)-plugin-$i.cron.d))
36 DIRSFILES=$(patsubst packaging/dirs/%,debian/$(OLDPACKAGE)-%.dirs,$(wildcard packaging/dirs/[a-z]*))
37 PDIRSFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/dirs/[a-z]*),debian/$(PACKAGE)-plugin-$i.dirs))
39 LINKSFILES=$(patsubst packaging/links/%,debian/$(OLDPACKAGE)-%.links,$(wildcard packaging/links/[a-z]*))
40 PLINKSFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/links/[a-z]*),debian/$(PACKAGE)-plugin-$i.links))
42 INSTALLFILES=$(patsubst packaging/install/%,debian/$(OLDPACKAGE)-%.install,$(wildcard packaging/install/[a-z]*))
43 PINSTALLFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/install/[a-z]*),debian/$(PACKAGE)-plugin-$i.install))
45 DOCSFILES=$(patsubst packaging/docs/%,debian/$(OLDPACKAGE)-%.docs,$(wildcard packaging/docs/[a-z]*)) \
46 $(patsubst packaging/docs/%,debian/$(PACKAGE)-%.docs,$(wildcard packaging/docs/[a-z]*))
47 PDOCSFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/docs/[a-z]*),debian/$(PACKAGE)-plugin-$i.docs))
49 POFILES=$(patsubst debian/dsf-po/%,debian/po/%,$(wildcard debian/dsf-po/*) debian/po/POTFILES.in)
52 @echo "ENABLED_PLUGINS=$(ENABLED_PLUGINS)"
54 @echo "PPOSTINST=$(PPOSTINST)"
55 @echo "PPRERM=$(PPRERM)"
57 @echo "CRONDFILES=$(CRONDFILES)"
58 @echo "DIRSFILES=$(DIRSFILES)"
59 @echo "LINKSFILES=$(LINKSFILES)"
60 @echo "INSTALLFILES=$(INSTALLFILES)"
61 @echo "DOCSFILES=$(DOCSFILES)"
63 @echo "PCRONDFILES=$(PCRONDFILES)"
64 @echo "PDIRSFILES=$(PDIRSFILES)"
65 @echo "PLINKSFILES=$(PLINKSFILES)"
66 @echo "PINSTALLFILES=$(PINSTALLFILES)"
67 @echo "PDOCSFILES=$(PDOCSFILES)"
70 sh $(CURDIR)/deb-specific/manage-uufiles.sh clean
73 conffiles: $(PPOSTINST) $(PPRERM) $(CRONDFILES) $(DIRSFILES) $(LINKSFILES) $(INSTALLFILES) $(DOCSFILES) $(PCRONDFILES) $(PDIRSFILES) $(PLINKSFILES) $(PINSTALLFILES) $(PDOCSFILES) debian/control
75 debian/$(PACKAGE)-plugin-%.postinst:
76 export PLUGLONGNAME="`cat $(CURDIR)/plugins/$*/NAME`"; $(SED_REPLACE) -e 's/@PLUGSHORTNAME@/$*/g' -e "s/@PLUGLONGNAME@/$$PLUGLONGNAME/g" $(CURDIR)/debian/dsf-in/plugin.postinst > $@
78 debian/$(PACKAGE)-plugin-%.prerm:
79 export PLUGLONGNAME="`cat $(CURDIR)/plugins/$*/NAME`"; $(SED_REPLACE) -e 's/@PLUGSHORTNAME@/$*/g' -e "s/@PLUGLONGNAME@/$$PLUGLONGNAME/g" $(CURDIR)/debian/dsf-in/plugin.prerm > $@
81 debian/$(PACKAGE)-plugin-%.cron.d:
82 $(SED_REPLACE) -e 's/\$$FFUSER/$(OLDPACKAGE)/g' $(CURDIR)/plugins/$*/packaging/cron.d/plugin-$* > $@
84 debian/$(OLDPACKAGE)-%.cron.d:
85 (cat $(CURDIR)/packaging/cron.d/00phpcron ; $(SED_REPLACE) -e 's/\$$FFUSER/$(OLDPACKAGE)/g' $(CURDIR)/packaging/cron.d/$*) | $(SED_REPLACE) > $@
87 debian/$(PACKAGE)-plugin-%.dirs:
88 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/dirs/plugin-$* > $@
90 debian/$(OLDPACKAGE)-%.dirs:
91 $(SED_REPLACE) $(CURDIR)/packaging/dirs/$* > $@
93 debian/$(PACKAGE)-plugin-%.links:
94 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/links/plugin-$* > $@
96 debian/$(OLDPACKAGE)-%.links:
97 $(SED_REPLACE) $(CURDIR)/packaging/links/$* > $@
99 debian/$(PACKAGE)-plugin-%.install:
100 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/install/plugin-$* > $@
102 debian/$(OLDPACKAGE)-%.install:
103 $(SED_REPLACE) $(CURDIR)/packaging/install/$* > $@
105 debian/$(PACKAGE)-plugin-%.docs:
106 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/docs/plugin-$* > $@
108 debian/$(OLDPACKAGE)-%.docs:
109 $(SED_REPLACE) $(CURDIR)/packaging/docs/$* > $@
110 debian/$(PACKAGE)-%.docs:
111 $(SED_REPLACE) $(CURDIR)/packaging/docs/$* > $@
113 debian/control: $(wildcard packaging/control/*) $(wildcard plugins/*/packaging/control/[1-9][0-9][0-9]*)
114 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) > $@
115 @echo Enabled plugins: $(ENABLED_PLUGINS)
116 @echo Skipped plugins: $(shell $(CURDIR)/utils/list-enabled-plugins.sh --disabled)
117 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) >> $@
119 debian/po/templates.pot: $(wildcard debian/dsf-in/*.templates.dsfh-in) $(wildcard debian/dsf-helper/*.templates)
120 @debconf-updatepo --podir=debian/dsf-po
123 cat $(patsubst debian/po/%,debian/dsf-po/%,$@) | $(SED_REPLACE) > $@
127 build: patch remove-binary-files debian/po/templates.pot conffiles
130 # Build man pages from Docbook sources
131 cat debian/dsf-in/config.sgml | $(SED_REPLACE) > debian/$(PACKAGE)-config.sgml
132 cat debian/dsf-in/common.manpages | $(SED_REPLACE) > debian/$(OLDPACKAGE)-common.manpages
133 /usr/bin/docbook-to-man debian/cvssh.sgml > cvssh.1
134 /usr/bin/docbook-to-man debian/$(PACKAGE)-config.sgml > $(PACKAGE)-config.1
136 # Build README.Debian from template
137 cat debian/README.Debian.tmpl | $(SED_REPLACE) > debian/README.Debian
139 # Uudecode binary files
140 sh $(CURDIR)/deb-specific/manage-uufiles.sh decode
142 # Build gettext *.mo files
143 utils/manage-translations.sh build
145 # Build FHS-compatible Apache config files (generates contents of etc/httpd.conf.d-fhs/ etc.)
146 utils/manage-apache-config.sh build
148 # Preprocess files with DSF-Helper
149 perl $(CURDIR)/deb-specific/dsf-helper.pl
151 clean: remove-binary-files unpatch
154 rm -f $(CURDIR)/debian/*.cron.d
155 rm -f $(CURDIR)/debian/*.dirs
156 rm -f $(CURDIR)/debian/*.links
157 rm -f $(CURDIR)/debian/*.install
158 rm -f $(CURDIR)/debian/*.docs
159 rm -f $(CURDIR)/debian/$(PACKAGE)-config.sgml
160 rm -f $(CURDIR)/debian/$(OLDPACKAGE)-common.manpages
161 rm -f cvssh.1 $(PACKAGE)-config.1
162 rm -f $(CURDIR)/debian/README.Debian
167 perl $(CURDIR)/deb-specific/dsf-helper.pl --clean
173 -e 's!@PKGNAME@!${WHICH_FORGE}!g' \
174 -e 's!@PKGVERSION@!${WHICH_VERSION}!g' \
175 -e 's!@PLUCKERNAME@!${WHICH_TYPE}!g' \
176 <$(CURDIR)/deb-specific/pkginfo.inc.php \
177 >$(CURDIR)/debian/$(OLDPACKAGE)-common/usr/share/$(OLDPACKAGE)/common/pkginfo.inc.php
180 chmod 755 $(CURDIR)/debian/*/*/*/*/bin/* $(CURDIR)/debian/*/*/*/*/cronjobs/* \
181 $(CURDIR)/debian/*/bin/* $(CURDIR)/debian/*/usr/share/*/plugins/*/bin/* \
182 $(CURDIR)/debian/*/usr/share/*/plugins/*/cronjobs/*
183 chmod 644 $(CURDIR)/debian/$(OLDPACKAGE)-db-postgresql/usr/share/$(OLDPACKAGE)/cronjobs/*.inc
185 chmod 755 $(CURDIR)/debian/$(OLDPACKAGE)-db-postgresql/usr/share/*/db/*.php
187 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/*/www/scm/viewvc/bin/cgi/viewvc-strace.sh
189 find $(CURDIR)/debian/$(OLDPACKAGE)-common/usr/share/*/common/docman/engine/ -type f -name \*.php -not -name \*.inc.php -exec chmod 0755 {} \;
190 find $(CURDIR)/debian/$(OLDPACKAGE)-common/usr/share/*/common/docman/engine/ -type f -name \*.sh -exec chmod 0755 {} \;
192 rm -f $(CURDIR)/debian/$(PACKAGE)-plugin-scm*/usr/share/*/plugins/scm*/*/README
193 chmod 755 $(CURDIR)/debian/$(PACKAGE)-plugin-scmcvs/usr/share/*/plugins/scmcvs/sbin/*
195 # Rename config files
196 mv $(CURDIR)/debian/$(OLDPACKAGE)-common/etc/$(PACKAGE)/config.ini-fhs $(CURDIR)/debian/$(OLDPACKAGE)-common/etc/$(PACKAGE)/config.ini
197 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
198 cp $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/$(OLDPACKAGE)/etc/httpd.conf-fhs $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf
199 mv $(CURDIR)/debian/$(OLDPACKAGE)-common/usr/share/$(OLDPACKAGE)/etc/templates/httpd.vhosts $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2-vhosts/etc/$(OLDPACKAGE)/templates/
201 # Remove those that need to be generated at install time
202 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/secrets.inc
203 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/vhost-list.inc
204 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/vhost-main.inc
205 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/vhost-projects.inc
207 # Remove Windows files
208 rm -rf $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/*/www/scm/viewvc/windows
210 rm -f $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/*/www/themes/$(OLDPACKAGE)/COPYING
212 # Remove Snoopy class from binary packages (provided by libphp-snoopy)
213 find $(addprefix $(CURDIR)/debian/,$(shell dh_listpackages)) -name Snoopy.class.php | xargs -r rm
215 # Remove NuSOAP class from binary packages (provided by libnusoap-php)
216 find $(addprefix $(CURDIR)/debian/,$(shell dh_listpackages)) -name nusoap.php | xargs -r rm
218 # Remove potential SCM artefacts from binary packages
219 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
221 # Also remove uuencoded files
222 find $(addprefix $(CURDIR)/debian/,$(shell dh_listpackages)) -name \*.uu | xargs -r rm