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 # Replace macros present in the files for forge's name
14 SED_REPLACE=sed -e 's/@PACKAGE@/$(PACKAGE)/g' -e 's/@SRCPACKAGE@/$(SRCPACKAGE)/g' -e 's/@OLDPACKAGE@/$(OLDPACKAGE)/g' -e 's/@FORGENAME@/$(FORGENAME)/g'
19 include /usr/share/dpatch/dpatch.make
21 # The substitutions bellow can be quite tricky, so use 'debian/rules testpat' to check if it's OK
23 # generate a list of all .postinst filenames for all plugins which contain a 'NAME' file
24 PPOSTINST=$(patsubst plugins/%/NAME, debian/$(PACKAGE)-plugin-%.postinst, $(wildcard plugins/*/NAME))
26 # generate a list of all .prerm filenames for all plugins which contain a 'NAME' file
27 PPRERM=$(patsubst plugins/%/NAME, debian/$(PACKAGE)-plugin-%.prerm, $(wildcard plugins/*/NAME))
30 CRONDFILES=$(patsubst packaging/cron.d/%, debian/$(OLDPACKAGE)-%.cron.d, $(wildcard packaging/cron.d/[a-z]*))
32 # plugins 'cron.d' files
33 PCRONDFILES=$(patsubst %, debian/$(PACKAGE)-%.cron.d, $(shell ls plugins/*/packaging/cron.d/[a-z]* | sed 's,.*/,,'))
37 DIRSFILES=$(patsubst packaging/dirs/%, debian/$(OLDPACKAGE)-%.dirs, $(wildcard packaging/dirs/[a-z]*))
39 # plugins 'dirs' files
40 PDIRSFILES=$(patsubst %, debian/$(PACKAGE)-%.dirs, $(shell ls plugins/*/packaging/dirs/[a-z]* | sed 's,.*/,,'))
44 LINKSFILES=$(patsubst packaging/links/%, debian/$(OLDPACKAGE)-%.links, $(wildcard packaging/links/[a-z]*))
46 # plugins 'links' files
47 PLINKSFILES=$(patsubst %, debian/$(PACKAGE)-%.links, $(shell ls plugins/*/packaging/links/[a-z]* | sed 's,.*/,,'))
51 INSTALLFILES=$(patsubst packaging/install/%, debian/$(OLDPACKAGE)-%.install, $(wildcard packaging/install/[a-z]*))
53 # plugins 'install' files
54 PINSTALLFILES=$(patsubst %, debian/$(PACKAGE)-%.install, $(shell ls plugins/*/packaging/install/[a-z]* | sed 's,.*/,,'))
58 DOCSFILES=$(patsubst packaging/docs/%, debian/$(OLDPACKAGE)-%.docs, $(wildcard packaging/docs/[a-z]*)) \
59 $(patsubst packaging/docs/%, debian/$(PACKAGE)-%.docs, $(wildcard packaging/docs/[a-z]*))
61 # plugins 'docs' files
62 PDOCSFILES=$(patsubst %, debian/$(PACKAGE)-%.docs, $(shell ls plugins/*/packaging/docs/[a-z]* | sed 's,.*/,,'))
65 PEXAMPLESFILES=$(patsubst %, debian/$(PACKAGE)-%.examples, $(shell ls plugins/*/packaging/examples/[a-z]* | sed 's,.*/,,'))
69 POFILES=$(patsubst debian/dsf-po/%, debian/po/%, $(wildcard debian/dsf-po/*) debian/po/POTFILES.in)
71 # Displays the variables to check if globbing and substitutions are correct
73 @echo "PPOSTINST=$(PPOSTINST)"
74 @echo "PPRERM=$(PPRERM)"
76 @echo "CRONDFILES=$(CRONDFILES)"
77 @echo "DIRSFILES=$(DIRSFILES)"
78 @echo "LINKSFILES=$(LINKSFILES)"
79 @echo "INSTALLFILES=$(INSTALLFILES)"
80 @echo "DOCSFILES=$(DOCSFILES)"
82 @echo "PCRONDFILES=$(PCRONDFILES)"
83 @echo "PDIRSFILES=$(PDIRSFILES)"
84 @echo "PLINKSFILES=$(PLINKSFILES)"
85 @echo "PINSTALLFILES=$(PINSTALLFILES)"
86 @echo "PDOCSFILES=$(PDOCSFILES)"
87 @echo "PEXAMPLESFILES=$(PEXAMPLESFILES)"
90 sh $(CURDIR)/deb-specific/manage-uufiles.sh clean
93 conffiles: $(PPOSTINST) $(PPRERM) $(CRONDFILES) $(DIRSFILES) $(LINKSFILES) $(INSTALLFILES) $(DOCSFILES) $(PCRONDFILES) $(PDIRSFILES) $(PLINKSFILES) $(PINSTALLFILES) $(PDOCSFILES) $(PEXAMPLESFILES) debian/control
95 # Construct the plugin's 'postinst' script out of a template in debian/dsf-in/plugin.postinst
96 debian/$(PACKAGE)-plugin-%.postinst:
97 export PLUGLONGNAME="`cat $(CURDIR)/plugins/$*/NAME`"; \
98 $(SED_REPLACE) -e 's/@PLUGSHORTNAME@/$*/g' -e "s/@PLUGLONGNAME@/$$PLUGLONGNAME/g" $(CURDIR)/debian/dsf-in/plugin.postinst > $@
100 # Construct the plugin's 'prerm' script out of a template in debian/dsf-in/plugin.prerm
101 debian/$(PACKAGE)-plugin-%.prerm:
102 export PLUGLONGNAME="`cat $(CURDIR)/plugins/$*/NAME`"; \
103 $(SED_REPLACE) -e 's/@PLUGSHORTNAME@/$*/g' -e "s/@PLUGLONGNAME@/$$PLUGLONGNAME/g" $(CURDIR)/debian/dsf-in/plugin.prerm > $@
105 # Perform substitutions in plugin's cron.d file
106 debian/$(PACKAGE)-plugin-%.cron.d:
107 $(SED_REPLACE) -e 's/\$$FFUSER/$(OLDPACKAGE)/g' $(CURDIR)/plugins/$*/packaging/cron.d/plugin-$* > $@
109 # Add a prefix and perform substitutions on the main cron.d files
110 debian/$(OLDPACKAGE)-%.cron.d:
111 (cat $(CURDIR)/packaging/cron.d/00phpcron ; $(SED_REPLACE) -e 's/\$$FFUSER/$(OLDPACKAGE)/g' $(CURDIR)/packaging/cron.d/$*) | $(SED_REPLACE) > $@
113 # Perform subsitutions on 'dirs', 'links', 'install', 'docs' files
114 debian/$(PACKAGE)-plugin-%.dirs:
115 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/dirs/plugin-$* > $@
117 debian/$(OLDPACKAGE)-%.dirs:
118 $(SED_REPLACE) $(CURDIR)/packaging/dirs/$* > $@
120 debian/$(PACKAGE)-plugin-%.links:
121 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/links/plugin-$* > $@
123 debian/$(OLDPACKAGE)-%.links:
124 $(SED_REPLACE) $(CURDIR)/packaging/links/$* > $@
126 debian/$(PACKAGE)-plugin-%.install:
127 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/install/plugin-$* > $@
129 debian/$(OLDPACKAGE)-%.install:
130 $(SED_REPLACE) $(CURDIR)/packaging/install/$* > $@
132 debian/$(PACKAGE)-plugin-%.docs:
133 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/docs/plugin-$* > $@
134 debian/$(OLDPACKAGE)-%.docs:
135 $(SED_REPLACE) $(CURDIR)/packaging/docs/$* > $@
136 debian/$(PACKAGE)-%.docs:
137 $(SED_REPLACE) $(CURDIR)/packaging/docs/$* > $@
139 debian/$(PACKAGE)-plugin-%.examples:
140 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/examples/plugin-$* > $@
142 # Construct the control file
143 debian/control: $(wildcard packaging/control/*) $(wildcard plugins/*/packaging/control/[1-9][0-9][0-9]*)
144 ls $(CURDIR)/packaging/control/[0-9][0-9][0-9]* $(CURDIR)/plugins/*/packaging/control/[1-9][0-9][0-9]* | grep -v shortdesc | grep -v scmcpold | \
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) > $@
164 build: patch remove-binary-files debian/po/templates.pot conffiles
167 # Build man pages from Docbook sources
168 cat debian/dsf-in/config.sgml | $(SED_REPLACE) > debian/$(PACKAGE)-config.sgml
169 cat debian/dsf-in/common.manpages | $(SED_REPLACE) > debian/$(OLDPACKAGE)-common.manpages
170 /usr/bin/docbook-to-man debian/cvssh.sgml > cvssh.1
171 /usr/bin/docbook-to-man debian/$(PACKAGE)-config.sgml > $(PACKAGE)-config.1
173 # Build README.Debian from template
174 cat debian/README.Debian.tmpl | $(SED_REPLACE) > debian/README.Debian
176 # Uudecode binary files
177 sh $(CURDIR)/deb-specific/manage-uufiles.sh decode
179 # Build gettext *.mo files
180 utils/manage-translations.sh build
182 # Build FHS-compatible Apache config files
183 utils/manage-apache-config.sh build
185 # Preprocess files with DSF-Helper
186 perl $(CURDIR)/deb-specific/dsf-helper.pl
189 clean: remove-binary-files unpatch
192 rm -f $(CURDIR)/debian/*.cron.d
193 rm -f $(CURDIR)/debian/*.dirs
194 rm -f $(CURDIR)/debian/*.links
195 rm -f $(CURDIR)/debian/*.install
196 rm -f $(CURDIR)/debian/*.docs
197 rm -f $(CURDIR)/debian/*.examples
198 rm -f $(CURDIR)/debian/$(PACKAGE)-config.sgml
199 rm -f $(CURDIR)/debian/$(OLDPACKAGE)-common.manpages
200 rm -f cvssh.1 $(PACKAGE)-config.1
201 rm -f $(CURDIR)/debian/README.Debian
206 perl $(CURDIR)/deb-specific/dsf-helper.pl --clean
213 chmod 755 $(CURDIR)/debian/*/*/*/*/bin/* $(CURDIR)/debian/*/*/*/*/cronjobs/* \
214 $(CURDIR)/debian/*/bin/* $(CURDIR)/debian/*/usr/share/*/plugins/*/bin/* \
215 $(CURDIR)/debian/*/usr/share/*/plugins/*/cronjobs/*
216 chmod 644 $(CURDIR)/debian/$(OLDPACKAGE)-db-postgresql/usr/share/$(OLDPACKAGE)/cronjobs/*.inc
218 chmod 755 $(CURDIR)/debian/$(OLDPACKAGE)-db-postgresql/usr/share/*/db/*.php
220 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/*/www/scm/viewvc/bin/cgi/viewvc-strace.sh
222 find $(CURDIR)/debian/$(OLDPACKAGE)-common/usr/share/*/common/docman/engine/ -type f -name \*.php -not -name \*.inc.php -exec chmod 0755 {} \;
223 find $(CURDIR)/debian/$(OLDPACKAGE)-common/usr/share/*/common/docman/engine/ -type f -name \*.sh -exec chmod 0755 {} \;
225 rm -f $(CURDIR)/debian/$(PACKAGE)-plugin-scm*/usr/share/*/plugins/scm*/*/README
226 chmod 755 $(CURDIR)/debian/$(PACKAGE)-plugin-scmcvs/usr/share/*/plugins/scmcvs/sbin/*
228 # Rename config files
229 mv $(CURDIR)/debian/$(OLDPACKAGE)-common/etc/$(PACKAGE)/config.ini-fhs $(CURDIR)/debian/$(OLDPACKAGE)-common/etc/$(PACKAGE)/config.ini
230 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
231 cp $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/$(OLDPACKAGE)/etc/httpd.conf-fhs $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf
233 # Remove those that need to be generated at install time
234 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/secrets.inc
235 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/vhost-list.inc
236 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/vhost-main.inc
237 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/vhost-projects.inc
239 # Remove Windows files
240 rm -rf $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/*/www/scm/viewvc/windows
242 rm -f $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/*/www/themes/$(OLDPACKAGE)/COPYING
244 # Remove Snoopy class from binary packages (provided by libphp-snoopy)
245 find $(addprefix $(CURDIR)/debian/, $(shell dh_listpackages)) -name Snoopy.class.php | xargs -r rm
247 # Remove NuSOAP class from binary packages (provided by libnusoap-php)
248 find $(addprefix $(CURDIR)/debian/, $(shell dh_listpackages)) -name nusoap.php | xargs -r rm
250 # Remove potential SCM artefacts from binary packages
251 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
253 # Also remove uuencoded files
254 find $(addprefix $(CURDIR)/debian/, $(shell dh_listpackages)) -name \*.uu | xargs -r rm