debian swirl logo

Back to the packages list sipwitch

#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2011, 2012, 2013 Jonas Smedegaard 
# Description: Main Debian packaging script for GNU SIP Witch
#
# 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 .

# This needs to run (and thus be declared) before CDBS includes
debian/control:: debian/control.in
DEB_PHONY_RULES += debian/control.in
debian/control.in::
		sed -e 's/__LIBPKGNAME__/$(libpkgname)/g' debian/control.in

DEB_AUTO_UPDATE_LIBTOOL = pre
DEB_AUTO_UPDATE_AUTOCONF = 2.68
DEB_AUTO_UPDATE_AUTOHEADER = 2.68
DEB_AUTO_UPDATE_ACLOCAL = 1.11
DEB_AUTO_UPDATE_AUTOMAKE = 1.11
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/class/cmake.mk
include /usr/share/cdbs/1/rules/debhelper.mk

stem = sipwitch
major = $(firstword $(subst .,$(space),$(DEB_UPSTREAM_VERSION)))
libname = lib$(stem)
libpkgname = lib$(stem)$(major)
pkgconfigname = $(libname)
ucommon-major = 6

DEB_UPSTREAM_URL = http://ftp.gnu.org/gnu/sipwitch

CDBS_BUILD_DEPENDS += , libucommon-dev (>= $(ucommon-major)), libexosip2-dev
CDBS_BUILD_DEPENDS += , pkg-config, libavahi-client-dev

DEB_MAKE_CHECK_TARGET = check

devbinfiles = sipwitch-config
binfiles = sippasswd sipquery sipwitch
sbinfiles = sipw
cgifiles = sipwitch-cgi
DEB_INSTALL_MANPAGES_$(libname)-dev = $(patsubst %,debian/tmp/usr/share/man/man1/%.1,$(devbinfiles))
DEB_INSTALL_MANPAGES_$(stem) = $(patsubst %,debian/tmp/usr/share/man/man1/%.1,$(binfiles)) $(patsubst %,debian/tmp/usr/share/man/man8/%.8,$(sbinfiles))
DEB_INSTALL_MANPAGES_$(stem)-cgi = $(patsubst %,debian/tmp/usr/share/man/man8/%.8,$(cgifiles))
DEB_DH_INSTALL_ARGS_$(libname)-dev = --autodest $(patsubst %,usr/bin/%,$(devbinfiles))
DEB_DH_INSTALL_ARGS_$(stem) = --autodest $(patsubst %,usr/bin/%,$(binfiles)) $(patsubst %,usr/sbin/%,$(sbinfiles))
DEB_DH_INSTALL_ARGS_$(stem) += usr/lib/sipwitch/*.so etc
DEB_DH_INSTALL_ARGS_$(stem)-cgi = --autodest usr/lib/cgi-bin/ $(patsubst %,usr/bin/%,$(cgifiles))

# put aside upstream-shipped temp files during build but after copyright-check
upstreamtmpfiles = Makefile.in $(patsubst %,%/Makefile.in,common inc inc/sipwitch server test utils)
upstreamtmpfiles += aclocal.m4 autoconf/ltmain.sh configure sipwitch.spec
pre-build:: debian/stamp-upstreamtmpstuff
debian/stamp-upstreamtmpstuff: debian/stamp-copyright-check
		for file in $(upstreamtmpfiles); do \
			[ ! -e $$file ] || [ -e $$file.upstream ] || cp -a $$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 autogenerated files not also shipped upstream
clean::
		rm -rf m4

# TODO: Enable docs when sensible (i.e. not mainly doing illegal ../ucommon)
#DEB_INSTALL_DOCS_$(stem)-doc += doc/html
#common-build-indep:: debian/stamp-docs
#debian/stamp-docs:
#	rm -rf doc
#	doxygen Doxyfile
#	touch $@
#clean::
#	rm -rf doc
#	rm -f debian/stamp-docs

# Re-install initscript with debhelper to add pre- and postinst routines
install/$(stem)::
		mv debian/tmp/etc/init.d/$(stem) debian/$(stem).init
clean::
		rm -f debian/$(stem).init

# Let d-shlibs calculate development package dependencies
#  and handle shared library install
CDBS_BUILD_DEPENDS += , d-shlibs
binary-post-install/$(libpkgname):: debian/stamp-local-shlibs-$(libname)
debian/stamp-local-shlibs-$(libname): binary-install/$(libpkgname)
		d-shlibmove --commit \
			--devunversioned \
			--exclude-la \
			--override  s/$(libname)$(major)-dev/$(libname)-dev/ \
			--override  s/libucommon$(ucommon-major)-dev/libucommon-dev/ \
			--movedev "debian/tmp/usr/include/*" usr/include/ \
			$(patsubst %,--movedev debian/tmp/usr/lib/pkgconfig/%.pc usr/lib/pkgconfig,$(pkgconfigstems)) \
			$(patsubst %,--extralib debian/tmp/usr/lib/%.so,$(extralibnames)) \
			debian/tmp/usr/lib/$(libname).so
		touch $@
clean::
		rm -f debian/stamp-local-shlibs-$(libname)

Builds:

libsipwitch1-dbg
secure peer-to-peer sip voip server - debug symbols
libsipwitch1
secure peer-to-peer sip voip server - shared libraries
libsipwitch-dev
secure peer-to-peer sip voip server - development files
sipwitch-cgi
secure peer-to-peer sip voip server - cgi xml-rpc interface
sipwitch
secure peer-to-peer voip server for the sip protocol