debian swirl logo

Back to the packages list sympa

#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2008-2010, Jonas Smedegaard 
# Copyright © 2010, Stefan Hornburg (Racke) 
# Description: Main Debian packaging script for SYMPA
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see .

include /usr/share/cdbs/1/rules/upstream-tarball.mk
include /usr/share/cdbs/1/rules/utils.mk
include /usr/share/cdbs/1/class/autotools.mk
include /usr/share/cdbs/1/rules/debhelper.mk

PERL = /usr/bin/perl

SCRIPTS = p12topem.pl testldap.pl load_subscribers.pl orphan_killer.pl \
		crypt_passwd.pl init_comment.pl arc2webarc.pl

DEB_UPSTREAM_URL = http://www.sympa.org/distribution
DEB_UPSTREAM_TARBALL_MD5 = 297f31cd74d5e4f5b2dd5d1e35e81fd0
DEB_UPSTREAM_TARBALL_BASENAME_MANGLE = s/~beta(\d+)$$/b.$$1/

# non-DFSG license limited to "authorized use only"
DEB_UPSTREAM_REPACKAGE_EXCLUDES += ./src/etc/ca-bundle.crt
# copyright-protected but inlicensed
DEB_UPSTREAM_REPACKAGE_EXCLUDES += ./po/it.po ./po/oc.po
# unused sources cluttering authorship/licensing tracking
DEB_UPSTREAM_REPACKAGE_EXCLUDES += ./po*.gmo

DEB_CONFIGURE_PREFIX = /usr/lib/sympa
DEB_CONFIGURE_EXTRA_FLAGS = \
		--enable-fhs \
		--sysconfdir=/etc/sympa \
		--with-sbindir=/usr/lib/sympa/bin \
		--with-cgidir=/usr/lib/cgi-bin/sympa \
		--datadir=/usr/share \
		--localedir=/usr/lib/sympa/locale \
		--mandir=/usr/share/man \
		--with-initdir=/etc/init.d \
		--with-docdir=/usr/share/doc/sympa \
		--with-perl=$(PERL) \
		--with-user=sympa --with-group=sympa \
		--with-sendmail_aliases=/etc/mail/sympa/aliases \
		--with-virtual_aliases=/etc/mail/sympa/virtual

DEB_MAKE_INSTALL_TARGET = install DESTDIR="$(DEB_DESTDIR)"

DEB_INSTALL_EXAMPLES_sympa = debian/examples/tulp2sympa

man8basenames = alias_manager archived bounced sympa
DEB_INSTALL_MANPAGES_sympa = $(man8basenames:%=doc/man8/%.8)

DEB_UPDATE_RCD_PARAMS = defaults 50
DEB_FIXPERMS_EXCLUDE = /usr/lib/sympa/bin/queue /usr/lib/sympa/bin/bouncequeue

# “maintainer-clean” target will also remove po{,-wwsympa}/{stamp-po,*.gmo} files
DEB_MAKE_CLEAN_TARGET = maintainer-clean

upstreamtmpfiles += src/etc/list_aliases.tt2 src/lib/Sympa/Constants.pm sympa.spec
upstreamtmpfiles += po-wwsympa/stamp-po po/stamp-po
pre-build:: debian/stamp-upstreamtmpstuff
debian/stamp-upstreamtmpstuff:
		for file in $(upstreamtmpfiles); do \
			[ ! -e $$file ] || [ -e $$file.upstream ] || mv $$file $$file.upstream; \
		done
		touch $@
clean::
		for file in $(upstreamtmpfiles); do \
			[ ! -e $$file.upstream ] || mv -f $$file.upstream $$file; \
		done
		rm -f debian/stamp-upstreamtmpstuff

clean::
		debconf-updatepo
		rm -f data_structure.version

# FIXME: test if SYMPA actually work with a symlink here
pre-build::
		touch src/etc/ca-bundle.crt
binary-post-install/sympa::
		rm -f $(DEB_DESTDIR)/usr/share/$(cdbs_curpkg)/default/ca-bundle.crt
		ln -s -T /etc/ssl/certs/ca-certificates.crt $(DEB_DESTDIR)/usr/share/$(cdbs_curpkg)/default/ca-bundle.crt
clean::
		rm -f src/etc/ca-bundle.crt

# Prepare SQL scripts for use with dbconfig
#  * Strip initial commands to create and connect to database
#  * Strip commands to drop stuff at install time
build/sympa::
		mkdir -p debian/dbconfig-common/install
		perl -n \
			-e '/^CREATE\s+TABLE\s+\w+\s+\(\s*$$/ and $$ok++;' \
			-e 'print if $$ok;' \
			src/etc/script/create_db.mysql \
			> debian/dbconfig-common/install/mysql
		perl -n \
			-e '/^CREATE\s+TABLE\s+\w+\s+\(\s*$$/ and $$ok++;' \
			-e 'print if $$ok;' \
			src/etc/script/create_db.Pg \
			> debian/dbconfig-common/install/postgres
		install -m 0644 src/etc/script/create_db.SQLite \
			debian/dbconfig-common/install/sqlite
		ln -sf sqlite debian/dbconfig-common/install/sqlite3
	# Safety check, as above makes assumptions on SQL coding style
		if egrep -i '(\bcreate[[:space:]]database|\bdrop\b)' debian/dbconfig-common/install/*; then \
			echo "ERROR: SQL install script possibly contains bad commands!"; \
			echo "       Please inspect debian/dbconfig-common/install/*"; \
			echo "       and adjust debian/rules."; \
			exit 1; \
		fi
	# Building sympa_wizard manpage
	pod2man --center "" --date "" --release "" --section= 8 \
			src/sympa_wizard.pl.in -o debian/sympa_wizard.8
		
clean::
	# Be cautious: we might add other subdirs here by hand later
		rm -f debian/dbconfig-common/install/*
		[ ! -e debian/dbconfig-common ] || \
			rmdir --ignore-fail-on-non-empty debian/dbconfig-common/install debian/dbconfig-common
	# Remove generated sympa_wizard manpage
		rm -f debian/sympa_wizard.8

# Remove unnecessary files
binary-post-install/sympa::
		rm -f "$(DEB_DESTDIR)"/usr/share/doc/$(cdbs_curpkg)/examples/sample/*.conf \
			"$(DEB_DESTDIR)"/usr/lib/cgi-bin/$(cdbs_curpkg)/mime.types

# SOAP client script not necessary for operation (#496515)
		rm "$(DEB_DESTDIR)/usr/share/$(cdbs_curpkg)/bin/sympa_soap_client.pl"

# Remove run directory as the init script deals with that
		rmdir "$(DEB_DESTDIR)/var/run/$(cdbs_curpkg)" "$(DEB_DESTDIR)"/var/run

# Remove configuration files shipped with sympa
		rm "$(DEB_DESTDIR)/etc/$(cdbs_curpkg)/sympa.conf"
		rm "$(DEB_DESTDIR)/etc/$(cdbs_curpkg)/wwsympa.conf"

# Move upstream sample dir below Debian example dir
		cd "$(DEB_DESTDIR)/usr/share/doc/$(cdbs_curpkg)" && mv sample/ examples/

# Rename example file topics.conf -> topics.us.conf
		mv "$(DEB_DESTDIR)"/usr/share/doc/$(cdbs_curpkg)/examples/config/topics.conf \
			"$(DEB_DESTDIR)"/usr/share/doc/$(cdbs_curpkg)/examples/config/topics.us.conf

# We cannot handle /etc/sympa/data_structure.version as a conffile
		rm -f "$(DEB_DESTDIR)"/etc/sympa/data_structure.version

# Fix permissions on SQL schemas
		chmod -x "$(DEB_DESTDIR)"/usr/share/$(cdbs_curpkg)/bin/create_db.*

# Needed both by upstream build (or test) process and at runtime
common-depends = libdbi-perl (>= 1.48), libarchive-zip-perl (>= 1.05)
common-depends += , libmailtools-perl (>= 1.51), libmsgcat-perl (>= 1.0), libmime-tools-perl
common-depends += , perl (>= 5.8), libio-stringy-perl, libnet-ldap-perl, libcgi-fast-perl
common-depends += , libintl-perl, libmime-charset-perl, libmime-encwords-perl, libtemplate-perl
common-depends += , libxml-libxml-perl, perl-modules (>= 5.10) | libcgi-pm-perl (>= 3.35)
common-depends += , libhtml-stripscripts-parser-perl (>= 1.0), libhtml-tree-perl, libhtml-format-perl
common-depends += , mhonarc, libregexp-common-perl

# Needed by packaging routines
CDBS_BUILD_DEPENDS += , $(common-depends)
CDBS_BUILD_DEPENDS += , debconf-utils, po-debconf

# Needed (always/often) at runtime
CDBS_DEPENDS = $(common-depends)
CDBS_DEPENDS += , default-mta | mail-transport-agent, ca-certificates
CDBS_DEPENDS += , sysklogd (>= 1.3-27) | system-log-daemon
CDBS_DEPENDS += , lsb-base, adduser, debconf | debconf-2.0, dbconfig-common
CDBS_DEPENDS += , libdbd-mysql-perl (>= 4.007), libdbd-pg-perl
CDBS_DEPENDS += , libdbd-sybase-perl, libdbd-sqlite3-perl, sqlite3
CDBS_DEPENDS += , libfcgi-perl, libfile-copy-recursive-perl (>= 0.36), libnet-netmask-perl
CDBS_DEPENDS += , libterm-progressbar-perl, libmime-lite-html-perl, libunicode-linebreak-perl
CDBS_DEPENDS += , libsoap-lite-perl

CDBS_RECOMMENDS = libfile-nfslock-perl, libio-socket-ssl-perl, libsoap-lite-perl
CDBS_RECOMMENDS += , libcrypt-ciphersaber-perl, libmail-dkim-perl (>= 0.36)
CDBS_RECOMMENDS += , libapache2-mod-fcgid, apache2-suexec

CDBS_SUGGESTS = libauthcas-perl (>= 1.4), libdbd-oracle-perl (>= 0.90), libtext-wrap-perl

Builds:

sympa
modern mailing list manager