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'
28 ENABLED_PLUGINS:=$(shell sh $(CURDIR)/utils/list-enabled-plugins.sh || echo error)
29 ifeq (${ENABLED_PLUGINS},error)
30 $(error list-enabled-plugins.sh failed)
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 PTRIGGERSFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/debian/[a-z]*.triggers),debian/$(PACKAGE)-plugin-$i.triggers))
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 READMEFILES=$(patsubst packaging/readme/%,debian/$(OLDPACKAGE)-%.README.Debian,$(wildcard packaging/readme/[a-z]*)) \
55 $(patsubst packaging/readme/%,debian/$(PACKAGE)-%.README.Debian,$(wildcard packaging/readme/[a-z]*))
57 POFILES=$(patsubst debian/dsf-po/%,debian/po/%,$(wildcard debian/dsf-po/*) debian/po/POTFILES.in)
60 @echo "ENABLED_PLUGINS=$(ENABLED_PLUGINS)"
62 @echo "PPOSTINST=$(PPOSTINST)"
63 @echo "PPRERM=$(PPRERM)"
65 @echo "CRONDFILES=$(CRONDFILES)"
66 @echo "DIRSFILES=$(DIRSFILES)"
67 @echo "LINKSFILES=$(LINKSFILES)"
68 @echo "INSTALLFILES=$(INSTALLFILES)"
69 @echo "DOCSFILES=$(DOCSFILES)"
70 @echo "READMEFILES=$(READMEFILES)"
72 @echo "PCRONDFILES=$(PCRONDFILES)"
73 @echo "PDIRSFILES=$(PDIRSFILES)"
74 @echo "PLINKSFILES=$(PLINKSFILES)"
75 @echo "PINSTALLFILES=$(PINSTALLFILES)"
76 @echo "PDOCSFILES=$(PDOCSFILES)"
79 sh $(CURDIR)/deb-specific/manage-uufiles.sh clean
82 conffiles: $(PPOSTINST) $(PPRERM) $(CRONDFILES) $(DIRSFILES) $(LINKSFILES) $(INSTALLFILES) $(DOCSFILES) $(READMEFILES) $(PCRONDFILES) $(PDIRSFILES) $(PLINKSFILES) $(PINSTALLFILES) $(PDOCSFILES) $(PTRIGGERSFILES) debian/control
84 debian/$(PACKAGE)-plugin-%.postinst:
85 PLUGLONGNAME="$$(cat '$(CURDIR)/plugins/$*/NAME')"; \
86 test -n "$$PLUGLONGNAME" || exit 1; \
87 srcf='$(CURDIR)/plugins/$*/debian/plugin-$*.postinst'; \
88 test -e "$$srcf" || srcf='$(CURDIR)/debian/dsf-in/plugin.postinst'; \
90 -e 's/@PLUGSHORTNAME@/$*/g' \
91 -e "s/@PLUGLONGNAME@/$$PLUGLONGNAME/g" \
92 "$$srcf" >$@ || (rm -f $@; exit 1)
94 debian/$(PACKAGE)-plugin-%.prerm:
95 PLUGLONGNAME="$$(cat '$(CURDIR)/plugins/$*/NAME')"; \
96 test -n "$$PLUGLONGNAME" || exit 1; \
97 srcf='$(CURDIR)/plugins/$*/debian/plugin-$*.prerm'; \
98 test -e "$$srcf" || srcf='$(CURDIR)/debian/dsf-in/plugin.prerm'; \
100 -e 's/@PLUGSHORTNAME@/$*/g' \
101 -e "s/@PLUGLONGNAME@/$$PLUGLONGNAME/g" \
102 "$$srcf" >$@ || (rm -f $@; exit 1)
104 debian/$(PACKAGE)-plugin-%.cron.d:
105 $(SED_REPLACE) -e 's/\$$FFUSER/$(OLDPACKAGE)/g' $(CURDIR)/plugins/$*/packaging/cron.d/plugin-$* > $@
107 debian/$(OLDPACKAGE)-%.cron.d:
108 (cat $(CURDIR)/packaging/cron.d/00phpcron ; $(SED_REPLACE) -e 's/\$$FFUSER/$(OLDPACKAGE)/g' $(CURDIR)/packaging/cron.d/$*) | $(SED_REPLACE) > $@
110 # Perform subsitutions on 'dirs', 'links', 'install', 'docs', 'triggers' files
111 debian/$(PACKAGE)-plugin-%.dirs:
112 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/dirs/plugin-$* > $@
114 debian/$(OLDPACKAGE)-%.dirs:
115 $(SED_REPLACE) $(CURDIR)/packaging/dirs/$* > $@
117 debian/$(PACKAGE)-plugin-%.links:
118 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/links/plugin-$* > $@
120 debian/$(OLDPACKAGE)-%.links:
121 $(SED_REPLACE) $(CURDIR)/packaging/links/$* > $@
123 debian/$(PACKAGE)-plugin-%.install:
124 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/install/plugin-$* > $@
126 debian/$(PACKAGE)-plugin-%.triggers:
127 $(SED_REPLACE) $(CURDIR)/plugins/$*/debian/plugin-$*.triggers > $@
129 debian/$(OLDPACKAGE)-%.install:
130 $(SED_REPLACE) $(CURDIR)/packaging/install/$* > $@
132 debian/$(PACKAGE)-plugin-%.docs:
133 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/docs/plugin-$* > $@
135 debian/$(OLDPACKAGE)-%.docs:
136 $(SED_REPLACE) $(CURDIR)/packaging/docs/$* > $@
137 debian/$(PACKAGE)-%.docs:
138 $(SED_REPLACE) $(CURDIR)/packaging/docs/$* > $@
140 debian/$(OLDPACKAGE)-%.README.Debian:
141 $(SED_REPLACE) $(CURDIR)/packaging/readme/$* > $@
142 debian/$(PACKAGE)-%.README.Debian:
143 $(SED_REPLACE) $(CURDIR)/packaging/readme/$* > $@
145 debian/control: $(wildcard packaging/control/*) $(wildcard plugins/*/packaging/control/[1-9][0-9][0-9]*)
146 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) > $@
147 @echo Enabled plugins: $(ENABLED_PLUGINS)
148 @echo Skipped plugins: $(shell sh $(CURDIR)/utils/list-enabled-plugins.sh --disabled)
149 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) >> $@
151 debian/po/templates.pot: $(wildcard debian/dsf-in/*.templates.dsfh-in) $(wildcard debian/dsf-helper/*.templates)
152 @debconf-updatepo --podir=debian/dsf-po
155 cat $(patsubst debian/po/%,debian/dsf-po/%,$@) | $(SED_REPLACE) > $@
157 build: remove-binary-files debian/po/templates.pot conffiles
160 # Build man pages from Docbook sources
161 cat debian/dsf-in/config.sgml | $(SED_REPLACE) > debian/$(PACKAGE)-config.sgml
162 cat debian/dsf-in/common.manpages | $(SED_REPLACE) > debian/$(OLDPACKAGE)-common.manpages
163 /usr/bin/docbook-to-man debian/cvssh.sgml > cvssh.1
164 /usr/bin/docbook-to-man debian/$(PACKAGE)-config.sgml > $(PACKAGE)-config.1
166 # Build README.Debian from template
167 cat debian/README.Debian.tmpl | $(SED_REPLACE) > debian/README.Debian
169 # Uudecode binary files
170 sh $(CURDIR)/deb-specific/manage-uufiles.sh decode
172 # Build gettext *.mo files
173 utils/manage-translations.sh build
175 # Build FHS-compatible Apache config files (generates contents of etc/httpd.conf.d-fhs/ etc.)
176 utils/manage-apache-config.sh build
178 # Preprocess files with DSF-Helper
179 perl $(CURDIR)/deb-specific/dsf-helper.pl
181 clean: remove-binary-files
184 rm -f $(CURDIR)/debian/*.cron.d
185 rm -f $(CURDIR)/debian/*.dirs
186 rm -f $(CURDIR)/debian/*.links
187 rm -f $(CURDIR)/debian/*.install
188 rm -f $(CURDIR)/debian/*.docs
189 rm -f $(CURDIR)/debian/*.README.Debian
190 rm -f $(CURDIR)/debian/$(PACKAGE)-config.sgml
191 rm -f $(CURDIR)/debian/$(OLDPACKAGE)-common.manpages
192 rm -f cvssh.1 $(PACKAGE)-config.1
193 rm -f $(CURDIR)/debian/README.Debian
196 rm -f $(POFILES) $(PPOSTINST) $(PPRERM)
198 perl $(CURDIR)/deb-specific/dsf-helper.pl --clean
205 -e 's!@PKGNAME@!${WHICH_FORGE}!g' \
206 -e 's!@PKGVERSION@!${WHICH_VERSION}!g' \
207 -e 's!@PLUCKERNAME@!${WHICH_TYPE}!g' \
208 <$(CURDIR)/deb-specific/pkginfo.inc.php \
209 >$(CURDIR)/debian/$(OLDPACKAGE)-common/usr/share/$(OLDPACKAGE)/common/pkginfo.inc.php
212 chmod 755 $(CURDIR)/debian/*/*/*/*/bin/* $(CURDIR)/debian/*/*/*/*/cronjobs/* \
213 $(CURDIR)/debian/*/bin/* $(CURDIR)/debian/*/usr/share/*/plugins/*/bin/* \
214 $(CURDIR)/debian/*/usr/share/*/plugins/*/cronjobs/*
215 chmod 644 $(CURDIR)/debian/$(OLDPACKAGE)-db-postgresql/usr/share/$(OLDPACKAGE)/cronjobs/*.inc
217 chmod 755 $(CURDIR)/debian/$(OLDPACKAGE)-db-postgresql/usr/share/*/db/*.php
219 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/*/www/scm/viewvc/bin/cgi/viewvc-strace.sh
221 find $(CURDIR)/debian/$(OLDPACKAGE)-common/usr/share/*/common/docman/engine/ -type f -name \*.php -not -name \*.inc.php -exec chmod 0755 {} \;
222 find $(CURDIR)/debian/$(OLDPACKAGE)-common/usr/share/*/common/docman/engine/ -type f -name \*.sh -exec chmod 0755 {} \;
224 rm -f $(CURDIR)/debian/$(PACKAGE)-plugin-scm*/usr/share/*/plugins/scm*/*/README
225 chmod 755 $(CURDIR)/debian/$(PACKAGE)-plugin-scmcvs/usr/share/*/plugins/scmcvs/sbin/*
227 # Rename config files
228 mv $(CURDIR)/debian/$(OLDPACKAGE)-common/etc/$(PACKAGE)/config.ini-fhs $(CURDIR)/debian/$(OLDPACKAGE)-common/etc/$(PACKAGE)/config.ini
229 mkdir -p $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d
230 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/
231 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/
232 cp $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/$(OLDPACKAGE)/etc/httpd.conf-fhs $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf
233 mv $(CURDIR)/debian/$(OLDPACKAGE)-common/usr/share/$(OLDPACKAGE)/etc/templates/httpd.vhosts $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2-vhosts/etc/$(OLDPACKAGE)/templates/
235 # Remove those that need to be generated at install time
236 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/secrets.inc
237 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/vhost-list.inc
238 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/vhost-main.inc
239 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/vhost-projects.inc
241 # Remove Windows files
242 rm -rf $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/*/www/scm/viewvc/windows
244 # Remove extra copies of the GNU GPLv2
245 rm -f $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/*/www/themes/*/COPYING
247 # Remove Snoopy class from binary packages (provided by libphp-snoopy)
248 find $(addprefix $(CURDIR)/debian/,$(shell dh_listpackages)) -name Snoopy.class.php | xargs -r rm
250 # Remove NuSOAP class from binary packages (provided by libnusoap-php)
251 find $(addprefix $(CURDIR)/debian/,$(shell dh_listpackages)) -name nusoap.php | xargs -r rm
253 # Remove potential SCM artefacts from binary packages
254 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
256 # Also remove uuencoded files
257 find $(addprefix $(CURDIR)/debian/,$(shell dh_listpackages)) -name \*.uu | xargs -r rm
259 binary binary-arch binary-indep: install