1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337
|
#!/usr/bin/make -f
# GNU copyright 1997 to 1999 by Joey Hess (sample file)
# Copyright 2000 to 2002 by Roland Mas and Christian Bayle for the Sourceforge package
# Copyright 2002 to 2008 by Roland Mas and Christian Bayle for the Gforge package
# Copyright 2008 to 2014 by Roland Mas and Christian Bayle for the FusionForge package
# Copyright (C) 2014 Sylvain Beucler
OLDPACKAGE=gforge
PACKAGE=fusionforge
SRCPACKAGE=fusionforge
FORGENAME=FusionForge
SOURCE_PATH:=$(shell utils/forge_get_config_basic fhs source_path)
BINARY_PATH:=$(shell utils/forge_get_config_basic fhs binary_path)
PLUGINS_PATH:=$(shell utils/forge_get_config_basic fhs plugins_path)
DATA_PATH:=$(shell utils/forge_get_config_basic fhs data_path)
CONFIG_PATH:=$(shell utils/forge_get_config_basic fhs config_path)
LOG_PATH:=$(shell utils/forge_get_config_basic fhs log_path)
CHROOT_PATH:=$(shell utils/forge_get_config_basic fhs chroot)
# Identify this FusionForge version
# keep type intact and change forge in derivates,
# unless there are deep changes (type is used for
# the Forge-Identification meta header)
WHICH_TYPE=FusionForge
WHICH_FORGE=FusionForge
WHICH_VERSION:=$(shell dpkg-parsechangelog | sed -n '/^Version: /s///p')
# Replace macros present in the files for forge's name
SED_REPLACE=sed -e 's/@PACKAGE@/$(PACKAGE)/g' -e 's/@SRCPACKAGE@/$(SRCPACKAGE)/g' -e 's/@OLDPACKAGE@/$(OLDPACKAGE)/g' -e 's/@FORGENAME@/$(FORGENAME)/g' -e 's:@SOURCE_PATH@:$(SOURCE_PATH):g' -e 's:@BINARY_PATH@:$(BINARY_PATH):g' -e 's:@PLUGINS_PATH@:$(PLUGINS_PATH):g' -e 's:@DATA_PATH@:$(DATA_PATH):g' -e 's:@CONFIG_PATH@:$(CONFIG_PATH):g' -e 's:@LOG_PATH@:$(LOG_PATH):g' -e 's:@CHROOT_PATH@:$(CHROOT_PATH):g'
DH=dh --with quilt
default:
@echo $(PACKAGE) $(SOURCE_PATH)
# The substitutions below can be quite tricky, so use 'debian/rules testpat' to check if it's OK
ENABLED_PLUGINS:=$(shell sh $(CURDIR)/utils/list-enabled-plugins.sh || echo error)
ifeq (${ENABLED_PLUGINS},error)
$(error list-enabled-plugins.sh failed)
endif
# Development plugins that we package:
#ENABLED_PLUGINS+=mailman
PPOSTINST=$(foreach i,$(ENABLED_PLUGINS),debian/$(PACKAGE)-plugin-$i.postinst)
PPREINST=$(foreach i,$(ENABLED_PLUGINS),debian/$(PACKAGE)-plugin-$i.preinst)
PPRERM=$(foreach i,$(ENABLED_PLUGINS),debian/$(PACKAGE)-plugin-$i.prerm)
PPOSTRM=$(foreach i,$(ENABLED_PLUGINS),debian/$(PACKAGE)-plugin-$i.postrm)
CRONDFILES=$(patsubst packaging/cron.d/%,debian/$(OLDPACKAGE)-%.cron.d,$(wildcard packaging/cron.d/[a-z]*))
PCRONDFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/cron.d/[a-z]*),debian/$(PACKAGE)-plugin-$i.cron.d))
DIRSFILES=$(patsubst packaging/dirs/%,debian/$(OLDPACKAGE)-%.dirs,$(wildcard packaging/dirs/[a-z]*))
PDIRSFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/dirs/[a-z]*),debian/$(PACKAGE)-plugin-$i.dirs))
LINKSFILES=$(patsubst packaging/links/%,debian/$(OLDPACKAGE)-%.links,$(wildcard packaging/links/[a-z]*))
PLINKSFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/links/[a-z]*),debian/$(PACKAGE)-plugin-$i.links))
INSTALLFILES=$(patsubst packaging/install/%,debian/$(OLDPACKAGE)-%.install,$(wildcard packaging/install/[a-z]*))
PINSTALLFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/install/[a-z]*),debian/$(PACKAGE)-plugin-$i.install))
PTRIGGERSFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/triggers/[a-z]*),debian/$(PACKAGE)-plugin-$i.triggers))
DOCSFILES=$(patsubst packaging/docs/%,debian/$(OLDPACKAGE)-%.docs,$(wildcard packaging/docs/[a-z]*)) \
$(patsubst packaging/docs/%,debian/$(PACKAGE)-%.docs,$(wildcard packaging/docs/[a-z]*))
PDOCSFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/docs/[a-z]*),debian/$(PACKAGE)-plugin-$i.docs))
PEXAMPLESSFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/examples/[a-z]*),debian/$(PACKAGE)-plugin-$i.examples))
READMEFILES=$(patsubst packaging/readme/%,debian/$(OLDPACKAGE)-%.README.Debian,$(wildcard packaging/readme/[a-z]*)) \
$(patsubst packaging/readme/%,debian/$(PACKAGE)-%.README.Debian,$(wildcard packaging/readme/[a-z]*))
POFILES=$(patsubst debian/dsf-po/%,debian/po/%,$(wildcard debian/dsf-po/*) debian/po/POTFILES.in)
# Displays the variables to check if globbing and substitutions are correct
testpat:
@echo "ENABLED_PLUGINS=$(ENABLED_PLUGINS)"
@echo ""
@echo "PPOSTINST=$(PPOSTINST)"
@echo "PPREINST=$(PPREINST)"
@echo "PPRERM=$(PPRERM)"
@echo "PPOSTRM=$(PPOSTRM)"
@echo ""
@echo "CRONDFILES=$(CRONDFILES)"
@echo "DIRSFILES=$(DIRSFILES)"
@echo "LINKSFILES=$(LINKSFILES)"
@echo "INSTALLFILES=$(INSTALLFILES)"
@echo "DOCSFILES=$(DOCSFILES)"
@echo "READMEFILES=$(READMEFILES)"
@echo ""
@echo "PCRONDFILES=$(PCRONDFILES)"
@echo "PDIRSFILES=$(PDIRSFILES)"
@echo "PLINKSFILES=$(PLINKSFILES)"
@echo "PINSTALLFILES=$(PINSTALLFILES)"
@echo "PDOCSFILES=$(PDOCSFILES)"
@echo "PEXAMPLESFILES=$(PEXAMPLESFILES)"
.PHONY: conffiles
conffiles: $(PPOSTINST) $(PPREINST) $(PPRERM) $(PPOSTRM) $(CRONDFILES) $(DIRSFILES) $(LINKSFILES) $(INSTALLFILES) $(DOCSFILES) $(READMEFILES) $(PCRONDFILES) $(PDIRSFILES) $(PLINKSFILES) $(PINSTALLFILES) $(PDOCSFILES) $(PTRIGGERSFILES) $(PEXAMPLESFILES) debian/control
# Construct the plugin's 'postinst' script out of a template in debian/dsf-in/plugin.postinst
debian/$(PACKAGE)-plugin-%.postinst:
# if [ -e debian/dsf-in/plugin-$*.postinst.in ]; then
$(SED_REPLACE) -e 's/@PLUGSHORTNAME@/$*/g' \
-e '/#DEBHELPER#/r debian/dsf-in/plugin-$*.postinst.in' \
debian/dsf-in/plugin.postinst > $@ ;
# fi
# Construct the plugin's 'preinst' script out of a template in debian/dsf-in/plugin.preinst
debian/$(PACKAGE)-plugin-%.preinst:
if [ -e debian/dsf-in/plugin-$*.preinst.in ]; then \
$(SED_REPLACE) -e 's/@PLUGSHORTNAME@/$*/g' \
-e '/#DEBHELPER#/r debian/dsf-in/plugin-$*.preinst.in' \
debian/dsf-in/plugin.preinst > $@ ; \
fi
# Construct the plugin's 'prerm' script out of a template in debian/dsf-in/plugin.prerm
debian/$(PACKAGE)-plugin-%.prerm:
if [ -e debian/dsf-in/plugin-$*.prerm.in ]; then \
$(SED_REPLACE) -e 's/@PLUGSHORTNAME@/$*/g' \
-e '/#DEBHELPER#/r debian/dsf-in/plugin-$*.prerm.in' \
debian/dsf-in/plugin.prerm > $@ ; \
fi
# Construct the plugin's 'postrm' script out of a template in debian/dsf-in/plugin.postrm
debian/$(PACKAGE)-plugin-%.postrm:
if [ -e debian/dsf-in/plugin-$*.postrm.in ]; then \
$(SED_REPLACE) -e 's/@PLUGSHORTNAME@/$*/g' \
-e '/#DEBHELPER#/r debian/dsf-in/plugin-$*.postrm.in' \
debian/dsf-in/plugin.postrm > $@ ; \
fi
# Perform substitutions in plugin's cron.d file
debian/$(PACKAGE)-plugin-%.cron.d:
$(SED_REPLACE) -e 's/\$$FFUSER/$(OLDPACKAGE)/g' $(CURDIR)/plugins/$*/packaging/cron.d/plugin-$* > $@
# Add a prefix and perform substitutions on the main cron.d files
debian/$(OLDPACKAGE)-%.cron.d:
(cat $(CURDIR)/packaging/cron.d/00phpcron ; $(SED_REPLACE) -e 's/\$$FFUSER/$(OLDPACKAGE)/g' $(CURDIR)/packaging/cron.d/$*) | $(SED_REPLACE) > $@
# Perform subsitutions on 'dirs', 'links', 'install', 'docs', 'triggers' files
debian/$(PACKAGE)-plugin-%.dirs:
$(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/dirs/plugin-$* > $@
debian/$(OLDPACKAGE)-%.dirs:
$(SED_REPLACE) $(CURDIR)/packaging/dirs/$* > $@
debian/$(PACKAGE)-plugin-%.links:
$(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/links/plugin-$* > $@
debian/$(OLDPACKAGE)-%.links:
$(SED_REPLACE) $(CURDIR)/packaging/links/$* > $@
debian/$(PACKAGE)-plugin-%.install:
dh_quilt_patch
$(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/install/plugin-$* > $@
debian/$(PACKAGE)-plugin-%.triggers:
$(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/triggers/plugin-$* > $@
debian/$(OLDPACKAGE)-%.install:
$(SED_REPLACE) $(CURDIR)/packaging/install/$* > $@
debian/$(PACKAGE)-plugin-%.docs:
$(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/docs/plugin-$* > $@
debian/$(OLDPACKAGE)-%.docs:
$(SED_REPLACE) $(CURDIR)/packaging/docs/$* > $@
debian/$(PACKAGE)-%.docs:
$(SED_REPLACE) $(CURDIR)/packaging/docs/$* > $@
debian/$(PACKAGE)-plugin-%.examples:
$(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/examples/plugin-$* > $@
debian/$(OLDPACKAGE)-%.README.Debian:
$(SED_REPLACE) $(CURDIR)/packaging/readme/$* > $@
debian/$(PACKAGE)-%.README.Debian:
$(SED_REPLACE) $(CURDIR)/packaging/readme/$* > $@
# Construct the control file
debian/control: $(wildcard packaging/control/*) $(wildcard plugins/*/packaging/control/[1-9][0-9][0-9]*) $(wildcard plugins/*/etc/*.ini)
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) > $@
@echo Enabled plugins: $(ENABLED_PLUGINS)
@echo Skipped plugins: $(shell sh $(CURDIR)/utils/list-enabled-plugins.sh --disabled)
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) >> $@
# Update the translation of package descriptions fields
debian/po/templates.pot: $(wildcard debian/dsf-in/*.templates.dsfh-in) $(wildcard debian/dsf-helper/*.templates)
@debconf-updatepo --podir=debian/dsf-po
debian/po/%:
cat $(patsubst debian/po/%, debian/dsf-po/%, $@) | $(SED_REPLACE) > $@
override_dh_auto_build:
build: debian/po/templates.pot conffiles
$(DH) $@
# Build man pages from Docbook sources
cat debian/dsf-in/common.manpages | $(SED_REPLACE) > debian/$(OLDPACKAGE)-common.manpages
/usr/bin/docbook-to-man debian/cvssh.sgml > cvssh.1
# Build README.Debian from template
cat debian/README.Debian.tmpl | $(SED_REPLACE) > debian/README.Debian
# Build gettext *.mo files
utils/manage-translations.sh build
# Build FHS-compatible Apache config files (generates contents of etc/httpd.conf.d-fhs/ etc.)
utils/manage-apache-config.sh build
# Update SQL for list of country codes
utils/ffcountries.pl > 200403251.sql
# Preprocess files with DSF-Helper
perl $(CURDIR)/deb-specific/dsf-helper.pl
clean:
$(DH) $@
rm -f $(CURDIR)/debian/*.cron.d
rm -f $(CURDIR)/debian/*.dirs
rm -f $(CURDIR)/debian/*.links
rm -f $(CURDIR)/debian/*.install
rm -f $(CURDIR)/debian/*.docs
rm -f $(CURDIR)/debian/*.examples
rm -f $(CURDIR)/debian/*.triggers
rm -f $(CURDIR)/debian/*.README.Debian
rm -f $(CURDIR)/debian/$(PACKAGE)-config.sgml
rm -f $(CURDIR)/debian/$(OLDPACKAGE)-common.manpages
rm -f cvssh.1 $(PACKAGE)-config.1 200403251.sql
rm -f $(CURDIR)/debian/README.Debian
rm -rf locales
rm -f $(POFILES) $(PPOSTINST) $(PPREINST) $(PPRERM) $(PPOSTRM)
perl $(CURDIR)/deb-specific/dsf-helper.pl --clean
rm -fr $(CURDIR)/etc/httpd.conf.d-fhs/ $(CURDIR)/etc/httpd.conf.d-fhsrh/ \
$(CURDIR)/etc/httpd.conf.d-opt/ $(CURDIR)/etc/httpd.conf.d-usrlocal/
# Remove mailman files (plugin is in development and not in PLUGINS)
rm -f debian/fusionforge-plugin-mailman.*
# Remove authcas files (plugin is "disabled for Debian until phpCAS gets packaged")
# Necessary if called after patches are applied (typically after a build)
rm -f debian/fusionforge-plugin-authcas.*
install: build
$(DH) $@
sed \
-e 's!@PKGNAME@!${WHICH_FORGE}!g' \
-e 's!@PKGVERSION@!${WHICH_VERSION}!g' \
-e 's!@PLUCKERNAME@!${WHICH_TYPE}!g' \
<$(CURDIR)/common/pkginfo.inc.php.template \
>$(CURDIR)/debian/$(OLDPACKAGE)-common/$(SOURCE_PATH)/common/pkginfo.inc.php
# Fix permissions
chmod 755 $(CURDIR)/debian/*/*/*/*/bin/* $(CURDIR)/debian/*/*/*/*/cronjobs/* \
$(CURDIR)/debian/*/bin/* $(CURDIR)/debian/*/$(PLUGINS_PATH)/*/bin/* \
$(CURDIR)/debian/*/usr/share/*/plugins/*/cronjobs/*
chmod 644 $(CURDIR)/debian/$(OLDPACKAGE)-db-postgresql/$(SOURCE_PATH)/cronjobs/*.inc
# Allow plugin activate/deactivate from plugin manager
chmod 2775 $(CURDIR)/debian/$(OLDPACKAGE)-common/$(SOURCE_PATH)/www/plugins/
chgrp www-data $(CURDIR)/debian/$(OLDPACKAGE)-common/$(SOURCE_PATH)/www/plugins/
chmod 2775 $(CURDIR)/debian/$(OLDPACKAGE)-common/$(CONFIG_PATH)/plugins/
chgrp www-data $(CURDIR)/debian/$(OLDPACKAGE)-common/$(CONFIG_PATH)/plugins/
rm $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/$(SOURCE_PATH)/www/scm/viewvc/bin/cgi/viewvc-strace.sh
find $(CURDIR)/debian/$(OLDPACKAGE)-common/$(SOURCE_PATH)/common/docman/engine/ -type f -name \*.php -not -name \*.inc.php -exec chmod 0755 {} \;
find $(CURDIR)/debian/$(OLDPACKAGE)-common/$(SOURCE_PATH)/common/docman/engine/ -type f -name \*.sh -exec chmod 0755 {} \;
rm -f $(CURDIR)/debian/$(PACKAGE)-plugin-scm*/$(PLUGINS_PATH)/scm*/*/README
chmod 755 $(CURDIR)/debian/$(PACKAGE)-plugin-scmcvs/$(PLUGINS_PATH)/scmcvs/sbin/*
# Rename config files
mv $(CURDIR)/debian/$(OLDPACKAGE)-common/etc/$(PACKAGE)/config.ini-fhs $(CURDIR)/debian/$(OLDPACKAGE)-common/etc/$(PACKAGE)/config.ini
mkdir -p $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/$(CONFIG_PATH)/httpd.conf.d
cp -v $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/$(SOURCE_PATH)/etc/httpd.conf.d-fhs/*.conf $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/$(CONFIG_PATH)/httpd.conf.d/
cp -v $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/$(SOURCE_PATH)/etc/httpd.conf.d-fhs/*.inc $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/$(CONFIG_PATH)/httpd.conf.d/
cp $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/$(SOURCE_PATH)/etc/httpd.conf-fhs $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/$(CONFIG_PATH)/httpd.conf
# Remove those that need to be generated at install time
grep -l {[a-z_]*/[a-z_]*} $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/$(CONFIG_PATH)/httpd.conf.d/* | xargs rm
# Remove Windows files
rm -rf $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/*/www/scm/viewvc/windows
# Remove extra copies of the GNU GPLv2
rm -f $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/*/www/themes/*/COPYING
# Replace Snoopy class from binary packages using libphp-snoopy (/usr/share/php/libphp-snoopy/Snoopy.class.php)
# Using ../../... links because lintian and DP 10.5 say so, surprisingly without justification
ln -nfs ../../../../php/libphp-snoopy/Snoopy.class.php debian/fusionforge-plugin-scmcvs/$(PLUGINS_PATH)/scmcvs/common/Snoopy.class.php
ln -nfs ../../../../../../../php/libphp-snoopy/Snoopy.class.php debian/fusionforge-plugin-scmhook/$(PLUGINS_PATH)/scmhook/library/scmgit/hooks/committracker/Snoopy.class.php
ln -nfs ../../../../../../../php/libphp-snoopy/Snoopy.class.php debian/fusionforge-plugin-scmhook/$(PLUGINS_PATH)/scmhook/library/scmsvn/hooks/committracker/Snoopy.class.php
# Remove NuSOAP class from binary packages (provided by libnusoap-php)
find $(addprefix debian/, $(shell dh_listpackages)) -name nusoap.php | xargs -r rm
# Remove some Jquery files from binary packages (provided by libjs-jquery*)
for i in jquery jquery-ui jquery-tipsy; do find $(addprefix $(CURDIR)/debian/, $(shell dh_listpackages)) -type d -path */vendor/$$i ; done | xargs -r rm -rf
# Remove potential SCM artefacts from binary packages
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
# Replace @FOO@ macros with their values
(find $(addprefix $(CURDIR)/debian/, $(shell dh_listpackages)) -type f -\( -name \*.pl -or -name \*.php -or -name \*.sh -or -name \*.conf -or -name \*.sql -or -name *.rsyslog -\) ; grep -rl '^#! ?/usr/bin/perl' $(addprefix $(CURDIR)/debian/, $(shell dh_listpackages)) ; grep -rl '#! ?/usr/bin/php' $(addprefix $(CURDIR)/debian/, $(shell dh_listpackages))) | sort -u | xargs $(SED_REPLACE) -i
binary: install
%:
$(DH) $@
|