#!/usr/bin/make -f
-# debian/rules that uses debhelper.
+
# 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 2003 by Roland Mas and Christian Bayle for the Gforge package
+# Copyright 2002 to 2008 by Roland Mas and Christian Bayle for the Gforge package
+# Copyright 2008 to 2009 by Roland Mas and Christian Bayle for the FusionForge package
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
+PACKAGE=gforge
+FORGENAME=FusionForge
-# This is the debhelper compatability version to use.
-export DH_COMPAT=4
+default:
+ @echo $(PACKAGE)
-PACKAGE=gforge
include /usr/share/dpatch/dpatch.make
+CRONDFILES=$(patsubst packaging/cron.d/%,debian/$(PACKAGE)-%.cron.d,$(wildcard packaging/cron.d/[a-z]*))
+DIRSFILES=$(patsubst packaging/dirs/%,debian/$(PACKAGE)-%.dirs,$(wildcard packaging/dirs/[a-z]*))
+INSTALLFILES=$(patsubst packaging/install/%,debian/$(PACKAGE)-%.install,$(wildcard packaging/install/[a-z]*))
+DOCSFILES=$(patsubst packaging/docs/pkgname%,debian/$(PACKAGE)%.docs,$(wildcard packaging/docs/pkgname*))
+POFILES=$(patsubst debian/dsf-po/%,debian/po/%,$(wildcard debian/dsf-po/*) debian/po/POTFILES.in)
+
remove-binary-files:
- # Remove files in contrib, especially binaries that break dpkg-source
-# find contrib/ -name CVS -prune -not -name CVS -or -type f | xargs rm -f
- # Also a few images
-# rm -f www/themes/gforge/images/es_*
sh $(CURDIR)/deb-specific/manage-uufiles.sh clean
-configure: configure-stamp debian/po/templates.pot
-configure-stamp: remove-binary-files
- dh_testdir
+.PHONY: conffiles
+conffiles: $(CRONDFILES) $(DIRSFILES) $(INSTALLFILES) $(DOCSFILES) debian/control
+
+debian/$(PACKAGE)-%.cron.d:
+ (cat $(CURDIR)/packaging/cron.d/00phpcron ; sed -e 's/\$$FFUSER/$(PACKAGE)/g' $(CURDIR)/packaging/cron.d/$*) > $@
+
+debian/$(PACKAGE)-%.dirs:
+ cp $(CURDIR)/packaging/dirs/$* $@
+
+debian/$(PACKAGE)-%.install:
+ cp $(CURDIR)/packaging/install/$* $@
- touch configure-stamp
+debian/%.docs:
+ cp $(CURDIR)/packaging/docs/$(patsubst $(PACKAGE)%,pkgname%,$*) $@
-debian/po/templates.pot: $(wildcard debian/*.templates) $(wildcard debian/*.templates.dsfh-in) $(wildcard debian/dsf-helper/*.templates)
- @debconf-updatepo
+debian/control: $(wildcard packaging/control/*)
+ ls $(CURDIR)/packaging/control/[0-9][0-9][0-9]* | grep -v shortdesc | grep -v scmcpold | while read file ; do cat $${file}; if [ -f $${file}.shortdesc ] ; then cat $(CURDIR)/packaging/control/AAAdesc; echo ' .'; cat $${file}.shortdesc; fi; echo ''; done | sed 's/@PACKAGE@/$(PACKAGE)/g' > $@
-build: configure-stamp build-stamp
-build-stamp: patch
- dh_testdir
+debian/po/templates.pot: $(wildcard debian/dsf-in/*.templates.dsfh-in) $(wildcard debian/dsf-helper/*.templates)
+ @debconf-updatepo --podir=debian/dsf-po
- # Build man pages from Docbook sources
+debian/po/%:
+ cat $(patsubst debian/po/%,debian/dsf-po/%,$@) | sed 's/@PACKAGE@/$(PACKAGE)/g' | sed 's/@FORGENAME@/$(FORGENAME)/g' > $@
+
+.PHONY: patch
+
+build: patch remove-binary-files debian/po/templates.pot conffiles
+ dh $@
+
+# Build man pages from Docbook sources
+ cat debian/dsf-in/config.sgml | sed 's/@PACKAGE@/$(PACKAGE)/g' | sed 's/@FORGENAME@/$(FORGENAME)/g' > debian/$(PACKAGE)-config.sgml
+ cat debian/dsf-in/common.manpages | sed 's/@PACKAGE@/$(PACKAGE)/g' | sed 's/@FORGENAME@/$(FORGENAME)/g' > debian/$(PACKAGE)-common.manpages
/usr/bin/docbook-to-man debian/cvssh.sgml > cvssh.1
- /usr/bin/docbook-to-man debian/gforge-config.sgml > gforge-config.1
+ /usr/bin/docbook-to-man debian/$(PACKAGE)-config.sgml > $(PACKAGE)-config.1
+
+# Build README.Debian from template
+ cat debian/README.Debian.tmpl | sed 's/@PACKAGE@/$(PACKAGE)/g' | sed 's/@FORGENAME@/$(FORGENAME)/g' > debian/README.Debian
- # Uudecode binary files
+# Uudecode binary files
sh $(CURDIR)/deb-specific/manage-uufiles.sh decode
- touch build-stamp
+# Build gettext *.mo files
+ utils/manage-translations.sh build
+
+# Preprocess files with DSF-Helper
+ perl $(CURDIR)/deb-specific/dsf-helper.pl
clean: remove-binary-files unpatch
- dh_testdir
- dh_testroot
- rm -f build-stamp configure-stamp
- rm -f cvssh.1 gforge-config.1
+ 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/$(PACKAGE)-config.sgml
+ rm -f $(CURDIR)/debian/$(PACKAGE)-common.manpages
+ rm -f cvssh.1 $(PACKAGE)-config.1
+ rm -f $(CURDIR)/debian/README.Debian
+ rm -rf locales
+
+ rm -f $(POFILES)
perl $(CURDIR)/deb-specific/dsf-helper.pl --clean
- dh_clean
install: build
- dh_testdir
- dh_testroot
- dh_clean -k
- dh_installdirs
+ dh $@
- # Preprocess files with DSF-Helper
- perl $(CURDIR)/deb-specific/dsf-helper.pl
+# Fix permissions
+ chmod 755 $(CURDIR)/debian/*/*/*/*/bin/* $(CURDIR)/debian/*/*/*/*/cronjobs/* \
+ $(CURDIR)/debian/*/bin/* $(CURDIR)/debian/*/usr/share/*/plugins/*/bin/* \
+ $(CURDIR)/debian/*/usr/share/*/plugins/*/cronjobs/*
+ chmod 644 $(CURDIR)/debian/$(PACKAGE)-db-postgresql/usr/share/$(PACKAGE)/cronjobs/*.inc
+
+ chmod 755 $(CURDIR)/debian/$(PACKAGE)-db-postgresql/usr/share/*/db/*.php
+
+ rm $(CURDIR)/debian/$(PACKAGE)-web-apache2/usr/share/*/www/scm/viewvc/bin/cgi/viewvc-strace.sh
+
+ find $(CURDIR)/debian/$(PACKAGE)-common/usr/share/*/common/docman/engine/ -type f -name \*.php -not -name \*.inc.php -exec chmod 0755 {} \;
+ find $(CURDIR)/debian/$(PACKAGE)-common/usr/share/*/common/docman/engine/ -type f -name \*.sh -exec chmod 0755 {} \;
+
+ rm -f $(CURDIR)/debian/$(PACKAGE)-plugin-scm*/usr/share/*/plugins/scm*/*/README
+ chmod 755 $(CURDIR)/debian/$(PACKAGE)-plugin-scmcvs/usr/share/*/plugins/scmcvs/sbin/*
+
+# Remove Windows files
+ rm -rf $(CURDIR)/debian/$(PACKAGE)-web-apache2/usr/share/*/www/scm/viewvc/windows
+
+ rm -f $(CURDIR)/debian/$(PACKAGE)-web-apache2/usr/share/*/www/themes/$(PACKAGE)/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
+
+# Remove NuSOAP class from binary packages (provided by libnusoap-php)
+ find $(addprefix $(CURDIR)/debian/,$(shell dh_listpackages)) -name nusoap.php | xargs -r rm
+
+# 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
+
+# Also remove uuencoded files
+ find $(addprefix $(CURDIR)/debian/,$(shell dh_listpackages)) -name \*.uu | xargs -r rm
+
+binary: install
- # gforge
- # (gforge is a meta-package and needs no files)
-
- # gforge-common
- install -m 644 etc/httpd.d/[0-9][0-9]* $(CURDIR)/debian/gforge-common/usr/share/gforge/etc/httpd.d/
- install -m 644 etc/httpd.d/httpd* $(CURDIR)/debian/gforge-common/usr/share/gforge/etc/httpd.d/
- install -m 644 etc/local.d/[0-9][0-9]* $(CURDIR)/debian/gforge-common/usr/share/gforge/etc/local.d/
- install -m 644 etc/templates/*\.* $(CURDIR)/debian/gforge-common/usr/share/gforge/etc/templates/
- install -m 755 setup $(CURDIR)/debian/gforge-common/usr/lib/gforge/bin/
- install -m 755 deb-specific/cvssh.pl $(CURDIR)/debian/gforge-common/bin/cvssh
- #
- install -m 755 deb-specific/install-chroot.sh $(CURDIR)/debian/gforge-common/usr/lib/gforge/bin/
- install -m 755 deb-specific/install-ssh.sh $(CURDIR)/debian/gforge-common/usr/lib/gforge/bin/
- install -m 755 utils/fill-in-the-blanks.pl $(CURDIR)/debian/gforge-common/usr/lib/gforge/bin/
- install -m 755 deb-specific/gforge-config $(CURDIR)/debian/gforge-common/usr/sbin/
- install -m 644 utils/include.pl $(CURDIR)/debian/gforge-common/usr/lib/gforge/lib/
- #
- install -m 755 deb-specific/user_dump_update.pl $(CURDIR)/debian/gforge-common/usr/lib/gforge/bin/
- install -m 755 deb-specific/group_dump_update.pl $(CURDIR)/debian/gforge-common/usr/lib/gforge/bin/
-# install -m 644 cronjobs/cvs-cron/default_page.php $(CURDIR)/debian/gforge-common/usr/lib/gforge/lib/
- install -m 755 deb-specific/ssh_dump_update.pl $(CURDIR)/debian/gforge-common/usr/lib/gforge/bin/
- #
- install -m 755 deb-specific/update-user-group-cvs.sh $(CURDIR)/debian/gforge-common/usr/lib/gforge/bin/
- #
- cp -r common $(CURDIR)/debian/gforge-common/usr/share/gforge/
- find $(CURDIR)/debian/gforge-common/usr/share/gforge/ -name CVS -type d | xargs rm -rf
- find $(CURDIR)/debian/gforge-common/usr/share/gforge/common -type d -exec chmod 0755 {} \;
- find $(CURDIR)/debian/gforge-common/usr/share/gforge/common -type f -exec chmod 0644 {} \;
-
- # gforge-web-apache
- install -m 644 $(CURDIR)/debian/gforge-web-apache.overrides $(CURDIR)/debian/gforge-web-apache/usr/share/lintian/overrides/gforge-web-apache
- cp -r www $(CURDIR)/debian/gforge-web-apache/usr/share/gforge/
- install -m 644 deb-specific/index_std.php $(CURDIR)/debian/gforge-web-apache/etc/gforge/custom/
- rm $(CURDIR)/debian/gforge-web-apache/usr/share/gforge/www/index_std.php
- find $(CURDIR)/debian/gforge-web-apache/usr/share/gforge/ -name CVS -type d | xargs rm -rf
- find $(CURDIR)/debian/gforge-web-apache -name \*.uu -type f | xargs rm -f
- find $(CURDIR)/debian/gforge-web-apache/usr/share/gforge/www -type d -exec chmod 0755 {} \;
- find $(CURDIR)/debian/gforge-web-apache/usr/share/gforge/www -type f -exec chmod 0644 {} \;
- # Remove empty theme directories
- for i in $(CURDIR)/debian/gforge-web-apache/usr/share/gforge/www/themes/* ; do [ -d $$i ] && [ $$(find $$i -type f | wc -l) = 0 ] && rm -rf $$i || true ; done
-
- install -o www-data -m 755 -d $(CURDIR)/debian/gforge-web-apache/var/cache/gforge
- install -m 755 utils/install-apache.sh $(CURDIR)/debian/gforge-web-apache/usr/lib/gforge/bin/
- install -m 755 deb-specific/create-vhosts.sh $(CURDIR)/debian/gforge-web-apache/usr/lib/gforge/bin/
- install -m 755 deb-specific/prepare-vhosts-file.pl $(CURDIR)/debian/gforge-web-apache/usr/lib/gforge/bin/
-
- # move some files from gforge-web-apache to gforge-common as there are needed by postgress upgrade
- # these files should be moved one day in common/
-
- mv $(CURDIR)/debian/gforge-web-apache/usr/share/gforge/www/include/languages \
- $(CURDIR)/debian/gforge-common/usr/share/gforge/www/include
- mv $(CURDIR)/debian/gforge-web-apache/usr/share/gforge/www/include/squal_pre.php \
- $(CURDIR)/debian/gforge-common/usr/share/gforge/www/include
- mv $(CURDIR)/debian/gforge-web-apache/usr/share/gforge/www/include/squal_exit.php \
- $(CURDIR)/debian/gforge-common/usr/share/gforge/www/include
- mv $(CURDIR)/debian/gforge-web-apache/usr/share/gforge/www/include/pre.php \
- $(CURDIR)/debian/gforge-common/usr/share/gforge/www/include
- mv $(CURDIR)/debian/gforge-web-apache/usr/share/gforge/www/include/BaseLanguage.class \
- $(CURDIR)/debian/gforge-common/usr/share/gforge/www/include
- mv $(CURDIR)/debian/gforge-web-apache/usr/share/gforge/www/include/vote_function.php \
- $(CURDIR)/debian/gforge-common/usr/share/gforge/www/include
-
- # gforge-db-postgresql
- install -m 644 $(CURDIR)/debian/gforge-db-postgresql.overrides $(CURDIR)/debian/gforge-db-postgresql/usr/share/lintian/overrides/gforge-db-postgresql
- install -m 644 deb-specific/sf-2.6-complete.sql $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/db/
- install -m 644 deb-specific/sf2.5-to-sf2.6.sql $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/db/
- #
- install -m 755 cronjobs/calculate_user_metric.php $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
- install -m 755 cronjobs/db_trove_maint.php $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
- install -m 755 cronjobs/project_cleanup.php $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
- install -m 755 cronjobs/rating_stats.php $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
- install -m 755 cronjobs/db_project_sums.php $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
- install -m 755 cronjobs/check_stale_tracker_items.php $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
- install -m 755 cronjobs/project_weekly_metric.php $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
- install -m 755 cronjobs/rotate_activity.php $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
- #
- install -m 755 cronjobs/site_stats.php $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
- install -m 644 cronjobs/stats_site.inc $(CURDIR)/debian/gforge-db-postgresql/usr/share/gforge/cronjobs/
- install -m 644 cronjobs/stats_projects.inc $(CURDIR)/debian/gforge-db-postgresql/usr/share/gforge/cronjobs/
- #
- install -m 755 cronjobs/db_stats_agg.php $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
- install -m 755 cronjobs/massmail.php $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
- install -m 755 cronjobs/vacuum.php $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
- install -m 755 deb-specific/stats_projects_logparse.pl $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
- install -m 755 deb-specific/get_news_notapproved.pl $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
- install -m 755 deb-specific/install-db.sh $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
- install -m 755 deb-specific/db-upgrade.pl $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
- install -m 644 deb-specific/sqlparser.pm $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/lib/
- install -m 644 deb-specific/sqlhelper.pm $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/lib/
- install -m 755 deb-specific/sf-add-skill $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
- install -m 755 deb-specific/register-theme $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
- install -m 755 deb-specific/unregister-theme $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
-
- install -m 755 deb-specific/register-plugin $(CURDIR)/debian/gforge-common/usr/lib/gforge/bin/
- install -m 755 deb-specific/unregister-plugin $(CURDIR)/debian/gforge-common/usr/lib/gforge/bin/
- #
- install -m 644 deb-specific/view_bug.sql $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/db/
- install -m 644 deb-specific/view_patch.sql $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/db/
- #
- install -m 644 db/20021125.sql $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/db/
- install -m 644 db/200212*.sql $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/db/
- install -m 644 db/2003*.sql $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/db/
- install -m 755 db/2004*php $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/db/
- install -m 644 db/2004*.sql $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/db/
- install -m 755 db/2005*php $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/db/
- install -m 644 db/2005*.sql $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/db/
-# install -m 644 db/timetracking-init.sql $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/db/
-
- # gforge-mta-exim
- install -m 755 deb-specific/install-exim.sh $(CURDIR)/debian/gforge-mta-exim/usr/lib/gforge/bin/
-
- # gforge-mta-exim4
- install -m 755 deb-specific/install-exim4.sh $(CURDIR)/debian/gforge-mta-exim4/usr/lib/gforge/bin/
-
- # gforge-mta-postfix
- install -m 755 deb-specific/install-postfix.sh $(CURDIR)/debian/gforge-mta-postfix/usr/lib/gforge/bin/
-
- # gforge-shell-ldap
- # not needed chroot is a symlink -> ../../../
- #cd $(CURDIR)/debian/gforge-shell-ldap/var/lib/gforge/chroot/var/lib/gforge/chroot && ln -s ../../../../home .
-
- # gforge-shell-postgresql
- install -m 755 deb-specific/install-nsspgsql.sh $(CURDIR)/debian/gforge-shell-postgresql/usr/lib/gforge/bin/
-
- # gforge-ftp-proftpd
- install -m 755 deb-specific/install-ftp.sh $(CURDIR)/debian/gforge-ftp-proftpd/usr/lib/gforge/bin/
- install -m 644 deb-specific/sf-proftpd.conf $(CURDIR)/debian/gforge-ftp-proftpd/etc/gforge/
-
- # gforge-ldap-openldap
- install -m 755 utils/ldap/sql2ldif.pl $(CURDIR)/debian/gforge-ldap-openldap/usr/lib/gforge/bin/
- install -m 755 deb-specific/install-ldap.sh $(CURDIR)/debian/gforge-ldap-openldap/usr/lib/gforge/bin/
- install -m 644 deb-specific/gforge.schema $(CURDIR)/debian/gforge-ldap-openldap/etc/gforge/
-
- # gforge-dns-bind9
- install -m 644 $(CURDIR)/debian/gforge-dns-bind9.overrides $(CURDIR)/debian/gforge-dns-bind9/usr/share/lintian/overrides/gforge-dns-bind9
- install -m 755 deb-specific/install-dns.sh $(CURDIR)/debian/gforge-dns-bind9/usr/lib/gforge/bin/
- install -m 644 deb-specific/dns.head.template $(CURDIR)/debian/gforge-dns-bind9/var/lib/gforge/bind/
- install -m 644 deb-specific/dns.simple.template $(CURDIR)/debian/gforge-dns-bind9/var/lib/gforge/bind/
- install -m 755 deb-specific/dns_conf.pl $(CURDIR)/debian/gforge-dns-bind9/usr/lib/gforge/bin/
-
- # gforge-lists-mailman
- install -m 755 deb-specific/create-mailing-lists.pl $(CURDIR)/debian/gforge-lists-mailman/usr/lib/gforge/bin/
- install -m 755 deb-specific/fix-mailing-lists.pl $(CURDIR)/debian/gforge-lists-mailman/usr/lib/gforge/bin/
-
-binary-indep: build install
- dh_testdir
- dh_testroot
- dh_installdebconf
- dh_installdocs
- #dh_installexamples
- #dh_installmenu
- #dh_installemacsen
- #dh_installpam
- #dh_installinit
- dh_installcron
- dh_installman
- #dh_installinfo
- #dh_undocumented
- dh_installchangelogs ChangeLog
- #dh_link
- dh_strip
- dh_compress
- #dh_fixperms
- #dh_makeshlibs
- dh_installdeb
- #dh_perl
- #dh_shlibdeps
- dh_gencontrol
- dh_md5sums
- dh_builddeb
-
-binary-arch: build install
- # (No architecture-dependent files for Gforge, doing nothing here)
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install configure remove-binary-files patch unpatch
+%:
+ dh $@