debian swirl logo

Back to the packages list cipux-cat-web

#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright 2008-2010, Jonas Smedegaard 
# Description: Main Debian packaging script for cipux-cat-web
#
# 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/perl-build.mk
include /usr/share/cdbs/1/rules/debhelper.mk

pkg_lib = libcipux-cat-web-perl

DEB_UPSTREAM_PACKAGE = CipUX-CAT-Web
DEB_UPSTREAM_URL = http://release.cipux.org
DEB_UPSTREAM_TARBALL_MD5 = 2affaeacef291ccfb066bacf465c9018

# Install through debhelper.mk (not directly with perl-build.mk)
DEB_PERL_DESTDIR = $(cdbs_curdestdir)
DEB_DH_INSTALL_SOURCEDIR = $(DEB_PERL_DESTDIR)

# Build tests fail (require systemwide configfile and logfile installed)
DEB_BUILD_OPTIONS += nocheck

# Install apache snippet outside of apache conf.d to make it optional
# ...or no - install our own fork instead, limiting to only secure connections
binary-install/cipux-cat-web::
#	install -D -m 0644 etc/apache2/conf.d/cipux_apache.conf debian/$(cdbs_curpkg)/etc/cipux-cat-web/apache.conf
		install -D -m 0644 debian/apache.conf debian/$(cdbs_curpkg)/etc/cipux-cat-web/apache.conf
		install -D -m 0644 debian/lighttpd.conf debian/$(cdbs_curpkg)/etc/cipux-cat-web/lighttpd.conf

# Generate l10n files
binary-install/cipux-cat-web::
	DESTDIR= ../debian/cipux-cat-web/usr/share/cipux-cat-web; \
		for lang in $$(find po -name '*.po' -exec basename '{}' .po ';'); do \
			cd po && \
		DESTDIR= ../debian/cipux-cat-web/usr/share/cipux-cat-web perl -w -T ../debian/po2html.pl --source=C --target="$$lang" $$(find ../tpl/C -type f) && \
			cd ..; \
		done

# Add helper function to postinst and postrm
# (could probably be done more elegantly in either sed or perl...)
pre-build::
		for script in debian/cipux-cat-web.postinst debian/cipux-cat-web.postrm; do \
			perl -ne '/\@\@dpkg-daemon-helper\@\@/ and $$seen++; print unless $$seen' "$$script.in" > "$$script"; \
			cat debian/dpkg-daemon-helper >> "$$script"; \
			perl -ne 'print if $$seen; /\@\@dpkg-daemon-helper\@\@/ and $$seen++' "$$script.in" >> "$$script"; \
		done
clean::
		rm -f debian/cipux-cat-web.postinst debian/cipux-cat-web.postrm

# Move web content to subdir web/ to make room for future non-public files
binary-post-install/cipux-cat-web::
		mkdir debian/$(cdbs_curpkg)/usr/share/cipux-cat-web/web
		find debian/$(cdbs_curpkg)/usr/share/cipux-cat-web \
			-mindepth 1 -maxdepth 1 -not \
			-name web -not -name dpkg-daemon-helper \
			-exec mv -t debian/$(cdbs_curpkg)/usr/share/cipux-cat-web/web '{}' ';'

# Set permissions/group (#694145)
binary-fixup/cipux-cat-web::
		chgrp www-data debian/$(cdbs_curpkg)/etc/cipux-cat-web
		chmod 750 debian/$(cdbs_curpkg)/etc/cipux-cat-web

# Override upstream default: secure connection is unneeded to localhost
# Set permissions/group (#694145)
binary-fixup/libcipux-cat-web-perl::
	perl -i -pe "s|^(\h*catweb_rpc_server\h*= >\h*).*,\h*(#.*)?\$$|\$$1'http://localhost:8001/RPC2',|" \
			debian/$(cdbs_curpkg)/etc/cipux-cat-web/cipux-cat-web.conf
		chgrp www-data debian/$(cdbs_curpkg)/var/log/cipux-cat-web debian/$(cdbs_curpkg)/var/cache/cipux-cat-web debian/$(cdbs_curpkg)/etc/cipux-cat-web
		chmod 750 debian/$(cdbs_curpkg)/var/log/cipux-cat-web debian/$(cdbs_curpkg)/var/cache/cipux-cat-web debian/$(cdbs_curpkg)/etc/cipux-cat-web

# Ensure debconf PO files is in sync with templates
clean::
		debconf-updatepo
		sed -i \
		  -e "/^# Copyright/ s/THE PACKAGE'S COPYRIGHT HOLDER/Jonas Smedegaard /" \
		  -e '/^\(# This file\|"Project-Id-Version\)/ s/PACKAGE/$(DEB_SOURCE_PACKAGE)/' \
		  -e '/^"Project-Id-Version:/ s/VERSION/$(DEB_UPSTREAM_VERSION)/' \
		  debian/po/templates.pot

# Needed both by upstream build (or test) process and at runtime
common-depends = libcgi-formbuilder-perl, libcipux-perl, libdate-manip-perl, libcipux-rpc-client-perl, libtemplate-perl, libclass-std-perl, liblog-log4perl-perl, libreadonly-perl
CDBS_DEPENDS_$(pkg_lib) = $(common-depends)
CDBS_BUILD_DEPENDS += , $(common-depends)

# Needed by upstream build process
CDBS_BUILD_DEPENDS += , libmodule-build-cipux-perl (>= 0.2.5~)

# Needed by upstream tests
CDBS_BUILD_DEPENDS += , libtest-perl-critic-perl, libtest-pod-perl, libtest-pod-coverage-perl

# Needed by packaging routines
# * helper script po2html.pl needs libcipux-perl and liblocale-po-perl
CDBS_BUILD_DEPENDS += , po-debconf, liblocale-po-perl

# Needed (always/often/seldom) at runtime
# TODO: Raise suggestions to recommends when available in Debian
CDBS_DEPENDS_$(pkg_lib) += , libscalar-util-numeric-perl, liblocale-maketext-lexicon-perl
CDBS_DEPENDS_cipux-cat-web = $(pkg_lib), libclass-std-perl, libcipux-perl, libcgi-formbuilder-perl, libdate-manip-perl, libfrontier-rpc-perl, libtemplate-perl, debconf | debconf-2.0, apache2 | lighttpd | httpd-cgi
CDBS_RECOMMENDS_$(pkg_lib) = libmodule-list-pluggable-perl
CDBS_RECOMMENDS_cipux-cat-web = cipux-rpcd
CDBS_SUGGESTS_$(pkg_lib) = cipux-cat-web, libsys-info-os-perl

Builds:

cipux-cat-web
user and resource management framework cipux - web-based admin tools
libcipux-cat-web-perl
user and resource management framework cipux - web-based admin tools