# 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'
+DH=dh --with quilt
+
default:
@echo $(PACKAGE)
-include /usr/share/dpatch/dpatch.make
-
# The substitutions bellow can be quite tricky, so use 'debian/rules testpat' to check if it's OK
-
-ENABLED_PLUGINS=$(shell $(CURDIR)/utils/list-enabled-plugins.sh)
+ENABLED_PLUGINS:=$(shell sh $(CURDIR)/utils/list-enabled-plugins.sh || echo error)
+ifeq (${ENABLED_PLUGINS},error)
+$(error list-enabled-plugins.sh failed)
+endif
PPOSTINST=$(foreach i,$(ENABLED_PLUGINS),debian/$(PACKAGE)-plugin-$i.postinst)
PPRERM=$(foreach i,$(ENABLED_PLUGINS),debian/$(PACKAGE)-plugin-$i.prerm)
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/debian/[a-z]*.triggers),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)
@echo "LINKSFILES=$(LINKSFILES)"
@echo "INSTALLFILES=$(INSTALLFILES)"
@echo "DOCSFILES=$(DOCSFILES)"
+ @echo "READMEFILES=$(READMEFILES)"
@echo ""
@echo "PCRONDFILES=$(PCRONDFILES)"
@echo "PDIRSFILES=$(PDIRSFILES)"
sh $(CURDIR)/deb-specific/manage-uufiles.sh clean
.PHONY: conffiles
-conffiles: $(PPOSTINST) $(PPRERM) $(CRONDFILES) $(DIRSFILES) $(LINKSFILES) $(INSTALLFILES) $(DOCSFILES) $(PCRONDFILES) $(PDIRSFILES) $(PLINKSFILES) $(PINSTALLFILES) $(PDOCSFILES) $(PEXAMPLESFILES) debian/control
+conffiles: $(PPOSTINST) $(PPRERM) $(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:
export PLUGLONGNAME="`cat $(CURDIR)/plugins/$*/NAME`"; \
- $(SED_REPLACE) -e 's/@PLUGSHORTNAME@/$*/g' -e "s/@PLUGLONGNAME@/$$PLUGLONGNAME/g" $(CURDIR)/debian/dsf-in/plugin.postinst > $@
+ [ -e $(CURDIR)/plugins/$*/debian/plugin-$*.postinst ] \
+ && $(SED_REPLACE) -e 's/@PLUGSHORTNAME@/$*/g' -e "s/@PLUGLONGNAME@/$$PLUGLONGNAME/g" $(CURDIR)/plugins/$*/debian/plugin-$*.postinst > $@ \
+ || $(SED_REPLACE) -e 's/@PLUGSHORTNAME@/$*/g' -e "s/@PLUGLONGNAME@/$$PLUGLONGNAME/g" $(CURDIR)/debian/dsf-in/plugin.postinst > $@
# Construct the plugin's 'prerm' script out of a template in debian/dsf-in/plugin.prerm
debian/$(PACKAGE)-plugin-%.prerm:
export PLUGLONGNAME="`cat $(CURDIR)/plugins/$*/NAME`"; \
- $(SED_REPLACE) -e 's/@PLUGSHORTNAME@/$*/g' -e "s/@PLUGLONGNAME@/$$PLUGLONGNAME/g" $(CURDIR)/debian/dsf-in/plugin.prerm > $@
+ [ -e $(CURDIR)/plugins/$*/debian/plugin-$*.prerm ] \
+ && $(SED_REPLACE) -e 's/@PLUGSHORTNAME@/$*/g' -e "s/@PLUGLONGNAME@/$$PLUGLONGNAME/g" $(CURDIR)/plugins/$*/debian/plugin-$*.prerm > $@ \
+ || $(SED_REPLACE) -e 's/@PLUGSHORTNAME@/$*/g' -e "s/@PLUGLONGNAME@/$$PLUGLONGNAME/g" $(CURDIR)/debian/dsf-in/plugin.prerm > $@
# Perform substitutions in plugin's cron.d file
debian/$(PACKAGE)-plugin-%.cron.d:
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' files
+# Perform subsitutions on 'dirs', 'links', 'install', 'docs', 'triggers' files
debian/$(PACKAGE)-plugin-%.dirs:
$(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/dirs/plugin-$* > $@
debian/$(PACKAGE)-plugin-%.install:
$(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/install/plugin-$* > $@
+debian/$(PACKAGE)-plugin-%.triggers:
+ $(SED_REPLACE) $(CURDIR)/plugins/$*/debian/plugin-$*.triggers > $@
+
debian/$(OLDPACKAGE)-%.install:
$(SED_REPLACE) $(CURDIR)/packaging/install/$* > $@
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) > $@
+ 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 $(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) >> $@
+ @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)
debian/po/%:
cat $(patsubst debian/po/%, debian/dsf-po/%, $@) | $(SED_REPLACE) > $@
-.PHONY: patch
+override_dh_auto_build:
-build: patch remove-binary-files debian/po/templates.pot conffiles
- dh $@
+build: remove-binary-files debian/po/templates.pot conffiles
+ $(DH) $@
# Build man pages from Docbook sources
cat debian/dsf-in/config.sgml | $(SED_REPLACE) > debian/$(PACKAGE)-config.sgml
# Build gettext *.mo files
utils/manage-translations.sh build
-# Build FHS-compatible Apache config files
+# 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: remove-binary-files unpatch
- dh $@
+clean: remove-binary-files
+ $(DH) $@
rm -f $(CURDIR)/debian/*.cron.d
rm -f $(CURDIR)/debian/*.dirs
rm -f $(CURDIR)/debian/*.install
rm -f $(CURDIR)/debian/*.docs
rm -f $(CURDIR)/debian/*.examples
+ 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
+ rm -f cvssh.1 $(PACKAGE)-config.1 200403251.sql
rm -f $(CURDIR)/debian/README.Debian
rm -rf locales
- rm -f $(POFILES)
+ rm -f $(POFILES) $(PPOSTINST) $(PPRERM)
perl $(CURDIR)/deb-specific/dsf-helper.pl --clean
+ rm -f $(PPOSTINST)
+ rm -f $(PPRERM)
+ rm -fr $(CURDIR)/etc/httpd.conf.d-fhs/ $(CURDIR)/etc/httpd.conf.d-opt/ $(CURDIR)/etc/httpd.conf.d-usrlocal/
install: build
- dh $@
+ $(DH) $@
sed \
-e 's!@PKGNAME@!${WHICH_FORGE}!g' \
# Rename config files
mv $(CURDIR)/debian/$(OLDPACKAGE)-common/etc/$(PACKAGE)/config.ini-fhs $(CURDIR)/debian/$(OLDPACKAGE)-common/etc/$(PACKAGE)/config.ini
- 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
+ mkdir -p $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf.d
+ 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/
+ 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/
cp $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/$(OLDPACKAGE)/etc/httpd.conf-fhs $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/etc/$(OLDPACKAGE)/httpd.conf
# Remove those that need to be generated at install time
# Remove Windows files
rm -rf $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/*/www/scm/viewvc/windows
- rm -f $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/*/www/themes/$(OLDPACKAGE)/COPYING
+# Remove extra copies of the GNU GPLv2
+ rm -f $(CURDIR)/debian/$(OLDPACKAGE)-web-apache2/usr/share/*/www/themes/*/COPYING
# Remove Snoopy class from binary packages (provided by libphp-snoopy)
find $(addprefix $(CURDIR)/debian/, $(shell dh_listpackages)) -name Snoopy.class.php | xargs -r rm
binary: install
%:
- dh $@
+ $(DH) $@