#!/usr/bin/make -f # -*- mode: makefile; coding: utf-8 -*- # Copyright 2012-2017 Jonas Smedegaard # Description: Main Debian packaging script for CiderWebmail # # 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 3, 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/class/perl-makemaker.mk include /usr/share/cdbs/1/rules/debhelper.mk pkg = ciderwebmail # Needed by upstream build and (always/often) at runtime perl-deps = moose log-dispatch parse-recdescent mail-imapclient perl-deps += log-dispatch-config catalyst-plugin-log-dispatch yaml perl-deps += yaml-libyaml json-xs catalyst-view-petal petal-utils perl-deps += datetime datetime-format-mail mime-tools try-tiny try-tiny-smartcatch perl-deps += email-simple email-sender email-valid email-address-xs perl-deps += regexp-common text-iconv perl-deps += text-autoformat io-socket-ssl net-managesieve clone html-tidy perl-deps += uri locale-maketext-gettext list-moreutils data-ical perl-deps += datetime-format-iso8601 crypt-util crypt-cbc crypt-rijndael perl-deps += crypt-random-source mime-base64-urlsafe html-defang perl-deps += moosex-role-withoverloading catalyst catalyst-deps = authentication-credential-http plugin-configloader catalyst-deps += plugin-static-simple plugin-stacktrace catalyst-deps += plugin-authentication plugin-session-store-fastmmap catalyst-deps += plugin-session-state-cookie model-dbic-schema catalyst-deps += action-renderview action-renderview deps = $(patsubst %,$(comma) lib%-perl,$(perl-deps)) deps += $(patsubst %,$(comma) libcatalyst-%-perl,$(catalyst-deps)) deps-recommend = libdbd-sqlite3-perl # Needed by upstream testsuite (undeclared in Makefile.PL) deps-test = libtest-xpath-perl # Needed by upstream build # * Drop libcatalyst-devel-perl when upstream does proper packaging bdeps = libmodule-install-perl, libcatalyst-devel-perl # Needed (always/often/seldom) at runtime # * libauthen-sasl-perl needed for secure Managesieve connections depends = adduser recommends = libauthen-sasl-perl recommends +=, default-mta | mail-transport-agent suggests = libfcgi-perl, libfcgi-procmanager-perl suggests +=, dovecot | imap-server, imapproxy CDBS_BUILD_DEPENDS +=, $(deps), $(deps-recommend), $(bdeps), $(deps-test) CDBS_DEPENDS_$(pkg) = $(deps), $(depends) CDBS_RECOMMENDS_$(pkg) = $(deps-recommend), $(recommends) CDBS_SUGGESTS_$(pkg) = $(suggests) DEB_INSTALL_EXAMPLES_$(pkg) = ciderwebmail.yml script/update_schema.sh # Avoid virtually empty TODO file DEB_INSTALL_DOCS_ALL := $(filter-out TODO,$(DEB_INSTALL_DOCS_ALL)) # (Re)generate localized templates CDBS_BUILD_DEPENDS +=, gettext langs := $(shell \ find root/locale -mindepth 1 -maxdepth 1 -type d -printf '%f\n') configure/$(pkg):: debian/stamp-mktemplates debian/stamp-mktemplates: pre-build for lang in $(langs); do \ stem=root/locale/$$lang/LC_MESSAGES/CiderWebmail; \ msgfmt -o $$stem.mo $$stem.po; \ done cd root/templates && perl ./template.pl touch $@ clean:: find root/locale -type f -name '*.mo' -delete rm -f debian/stamp-mktemplates # Install config files binary-install/$(pkg):: mkdir -p $(cdbs_curdestdir)etc/$(pkg) touch $(cdbs_curdestdir)etc/$(pkg)/custom.css # Install binaries in project-specific dir and drop their manpages binary-post-install/$(pkg):: mkdir -p $(cdbs_curdestdir)usr/share/$(pkg)/bin mv $(cdbs_curdestdir)usr/bin $(cdbs_curdestdir)usr/share/$(pkg)/ rm -rf $(cdbs_curdestdir)usr/share/man/man1 # Replace config with symlinks binary-post-install/$(pkg):: rm -rf $(cdbs_curdestdir)usr/share/$(pkg)/root/static/css/custom.css ln -sT /etc/ciderwebmail/custom.css $(cdbs_curdestdir)usr/share/$(pkg)/root/static/css/custom.css # Drop excess files bogusly handled by upstream install routines binary-post-install/$(pkg):: rm -rf $(cdbs_curdestdir)usr/share/perl5/CiderWebmail/.pc rm -rf $(cdbs_curdestdir)usr/share/perl5/CiderWebmail/root rm -f $(cdbs_curdestdir)usr/share/perl5/CiderWebmail/.gitignore rm -f $(cdbs_curdestdir)usr/share/perl5/CiderWebmail/LICENSE rm -f $(cdbs_curdestdir)usr/share/perl5/CiderWebmail/TODO rm -f $(cdbs_curdestdir)usr/share/perl5/CiderWebmail/ciderwebmail.yml rm -f $(cdbs_curdestdir)usr/share/perl5/CiderWebmail/root/templates/template.pl rm -f $(cdbs_curdestdir)usr/share/ciderwebmail/root/templates/template.pl