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 POFILES=$(patsubst debian/dsf-po/%, debian/po/%, $(wildcard debian/dsf-po/*) debian/po/POTFILES.in)
67 # Displays the variables to check if globbing and substitutions are correct
69 @echo "PPOSTINST=$(PPOSTINST)"
70 @echo "PPRERM=$(PPRERM)"
72 @echo "CRONDFILES=$(CRONDFILES)"
73 @echo "DIRSFILES=$(DIRSFILES)"
74 @echo "LINKSFILES=$(LINKSFILES)"
75 @echo "INSTALLFILES=$(INSTALLFILES)"
76 @echo "DOCSFILES=$(DOCSFILES)"
78 @echo "PCRONDFILES=$(PCRONDFILES)"
79 @echo "PDIRSFILES=$(PDIRSFILES)"
80 @echo "PLINKSFILES=$(PLINKSFILES)"
81 @echo "PINSTALLFILES=$(PINSTALLFILES)"
82 @echo "PDOCSFILES=$(PDOCSFILES)"
85 sh $(CURDIR)/deb-specific/manage-uufiles.sh clean
88 conffiles: $(PPOSTINST) $(PPRERM) $(CRONDFILES) $(DIRSFILES) $(LINKSFILES) $(INSTALLFILES) $(DOCSFILES) $(PCRONDFILES) $(PDIRSFILES) $(PLINKSFILES) $(PINSTALLFILES) $(PDOCSFILES) debian/control
90 # Construct the plugin's 'postinst' script out of a template in debian/dsf-in/plugin.postinst
91 debian/$(PACKAGE)-plugin-%.postinst:
92 export PLUGLONGNAME="`cat $(CURDIR)/plugins/$*/NAME`"; \
93 $(SED_REPLACE) -e 's/@PLUGSHORTNAME@/$*/g' -e "s/@PLUGLONGNAME@/$$PLUGLONGNAME/g" $(CURDIR)/debian/dsf-in/plugin.postinst > $@
95 # Construct the plugin's 'prerm' script out of a template in debian/dsf-in/plugin.prerm
96 debian/$(PACKAGE)-plugin-%.prerm:
97 export PLUGLONGNAME="`cat $(CURDIR)/plugins/$*/NAME`"; \
98 $(SED_REPLACE) -e 's/@PLUGSHORTNAME@/$*/g' -e "s/@PLUGLONGNAME@/$$PLUGLONGNAME/g" $(CURDIR)/debian/dsf-in/plugin.prerm > $@
100 # Perform substitutions in plugin's cron.d file
101 debian/$(PACKAGE)-plugin-%.cron.d:
102 $(SED_REPLACE) -e 's/\$$FFUSER/$(OLDPACKAGE)/g' $(CURDIR)/plugins/$*/packaging/cron.d/plugin-$* > $@
104 # Add a prefix and perform substitutions on the main cron.d files
105 debian/$(OLDPACKAGE)-%.cron.d:
106 (cat $(CURDIR)/packaging/cron.d/00phpcron ; $(SED_REPLACE) -e 's/\$$FFUSER/$(OLDPACKAGE)/g' $(CURDIR)/packaging/cron.d/$*) | $(SED_REPLACE) > $@
108 # Perform subsitutions on 'dirs', 'links', 'install', 'docs' files
109 debian/$(PACKAGE)-plugin-%.dirs:
110 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/dirs/plugin-$* > $@
112 debian/$(OLDPACKAGE)-%.dirs:
113 $(SED_REPLACE) $(CURDIR)/packaging/dirs/$* > $@
115 debian/$(PACKAGE)-plugin-%.links:
116 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/links/plugin-$* > $@
118 debian/$(OLDPACKAGE)-%.links:
119 $(SED_REPLACE) $(CURDIR)/packaging/links/$* > $@
121 debian/$(PACKAGE)-plugin-%.install:
122 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/install/plugin-$* > $@
124 debian/$(OLDPACKAGE)-%.install:
125 $(SED_REPLACE) $(CURDIR)/packaging/install/$* > $@
127 debian/$(PACKAGE)-plugin-%.docs:
128 $(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/docs/plugin-$* > $@
129 debian/$(OLDPACKAGE)-%.docs:
130 $(SED_REPLACE) $(CURDIR)/packaging/docs/$* > $@
131 debian/$(PACKAGE)-%.docs:
132 $(SED_REPLACE) $(CURDIR)/packaging/docs/$* > $@
134 # Construct the control file
135 debian/control: $(wildcard packaging/control/*) $(wildcard plugins/*/packaging/control/[1-9][0-9][0-9]*)
136 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 | \
139 if [ -f $${file}.shortdesc ] ; then \
140 cat $(CURDIR)/packaging/control/AAAdesc; \
142 cat $${file}.shortdesc; \
145 done | $(SED_REPLACE) > $@
147 # Update the translation of package descriptions fields
148 debian/po/templates.pot: $(wildcard debian/dsf-in/*.templates.dsfh-in) $(wildcard debian/dsf-helper/*.templates)
149 @debconf-updatepo --podir=debian/dsf-po
152 cat $(patsubst debian/po/%, debian/dsf-po/%, $@) | $(SED_REPLACE) > $@
156 build: patch remove-binary-files debian/po/templates.pot conffiles
159 # Build man pages from Docbook sources
160 cat debian/dsf-in/config.sgml | $(SED_REPLACE) > debian/$(PACKAGE)-config.sgml
161 cat debian/dsf-in/common.manpages | $(SED_REPLACE) > debian/$(OLDPACKAGE)-common.manpages
162 /usr/bin/docbook-to-man debian/cvssh.sgml > cvssh.1
163 /usr/bin/docbook-to-man debian/$(PACKAGE)-config.sgml > $(PACKAGE)-config.1
165 # Build README.Debian from template
166 cat debian/README.Debian.tmpl | $(SED_REPLACE) > debian/README.Debian
168 # Uudecode binary files
169 sh $(CURDIR)/deb-specific/manage-uufiles.sh decode
171 # Build gettext *.mo files
172 utils/manage-translations.sh build
174 # Build FHS-compatible Apache config files
175 utils/manage-apache-config.sh build
177 # Preprocess files with DSF-Helper
178 perl $(CURDIR)/deb-specific/dsf-helper.pl
181 clean: remove-binary-files unpatch
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/$(PACKAGE)-config.sgml
190 rm -f $(CURDIR)/debian/$(OLDPACKAGE)-common.manpages
191 rm -f cvssh.1 $(PACKAGE)-config.1
192 rm -f $(CURDIR)/debian/README.Debian
197 perl $(CURDIR)/deb-specific/dsf-helper.pl --clean
204 chmod 755 $(CURDIR)/debian/*/*/*/*/bin/* $(CURDIR)/debian/*/*/*/*/cronjobs/* \
205 $(CURDIR)/debian/*/bin/* $(CURDIR)/debian/*/usr/share/*/plugins/*/bin/* \
206 $(CURDIR)/debian/*/usr/share/*/plugins/*/cronjobs/*
207 chmod 644 $(CURDIR)/debian/$(OLDPACKAGE)-db-postgresql/usr/share/$(OLDPACKAGE)/cronjobs/*.inc
209 chmod 755 $(CURDIR)/debian/$(OLDPACKAGE)-db-postgresql/usr/share/*/db/*.php
211 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/*/www/scm/viewvc/bin/cgi/viewvc-strace.sh
213 find $(CURDIR)/debian/$(OLDPACKAGE)-common/usr/share/*/common/docman/engine/ -type f -name \*.php -not -name \*.inc.php -exec chmod 0755 {} \;
214 find $(CURDIR)/debian/$(OLDPACKAGE)-common/usr/share/*/common/docman/engine/ -type f -name \*.sh -exec chmod 0755 {} \;
216 rm -f $(CURDIR)/debian/$(PACKAGE)-plugin-scm*/usr/share/*/plugins/scm*/*/README
217 chmod 755 $(CURDIR)/debian/$(PACKAGE)-plugin-scmcvs/usr/share/*/plugins/scmcvs/sbin/*
219 # Rename config files
220 mv $(CURDIR)/debian/$(OLDPACKAGE)-common/etc/$(PACKAGE)/config.ini-fhs $(CURDIR)/debian/$(OLDPACKAGE)-common/etc/$(PACKAGE)/config.ini
221 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
222 cp $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/$(OLDPACKAGE)/etc/httpd.conf-fhs $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf
224 # Remove those that need to be generated at install time
225 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/secrets.inc
226 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/vhost-list.inc
227 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/vhost-main.inc
228 rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d/vhost-projects.inc
230 # Remove Windows files
231 rm -rf $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/*/www/scm/viewvc/windows
233 rm -f $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/*/www/themes/$(OLDPACKAGE)/COPYING
235 # Remove Snoopy class from binary packages (provided by libphp-snoopy)
236 find $(addprefix $(CURDIR)/debian/, $(shell dh_listpackages)) -name Snoopy.class.php | xargs -r rm
238 # Remove NuSOAP class from binary packages (provided by libnusoap-php)
239 find $(addprefix $(CURDIR)/debian/, $(shell dh_listpackages)) -name nusoap.php | xargs -r rm
241 # Remove potential SCM artefacts from binary packages
242 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
244 # Also remove uuencoded files
245 find $(addprefix $(CURDIR)/debian/, $(shell dh_listpackages)) -name \*.uu | xargs -r rm