debian swirl logo

Back to the packages list srtp

#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2007, 2008, 2010, 2011, 2013 Jonas Smedegaard
# 
# Description: Main Debian packaging script for libSRTP
#
# 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/autotools.mk
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/rules/utils.mk
include /usr/share/cdbs/1/rules/upstream-tarball.mk
include /usr/share/hardening-includes/hardening.make

# Update this checksum when new releases occur, to catch silent server side file content forges
DEB_UPSTREAM_TARBALL_MD5 = f706820bb54a4ff805c3f04f31a13082

DEB_UPSTREAM_URL = https://github.com/cisco/libsrtp/archive
#DEB_UPSTREAM_TARBALL_BASENAME = $(DEB_UPSTREAM_TARBALL_VERSION)
DEB_UPSTREAM_TARBALL_BASENAME = 7713d5706524f9f1ee94fd6b55125357e63656d5
DEB_UPSTREAM_REPACKAGE_EXCLUDES = ./CVS .cvsignore ./doc/rfc*.txt ./doc/draft*.txt ./doc/*.pdf ./releases/
DEB_UPSTREAM_TARBALL_SRCDIR = libsrtp-7713d5706524f9f1ee94fd6b55125357e63656d5

# Needed by upstream testsuite
CDBS_BUILD_DEPENDS += , procps, psmisc, miscfiles

DEB_CONFIGURE_EXTRA_FLAGS = --disable-stdout --enable-syslog
ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
DEB_CONFIGURE_EXTRA_FLAGS += --enable-debug
else
DEB_CONFIGURE_EXTRA_FLAGS += --disable-debug
endif

ifeq ($(DEB_HOST_ARCH_CPU),sparc)
CFLAGS += -DFORCE_64BIT_ALIGN
endif

CFLAGS += -D_REENTRANT

# Tighten security - more info at http://wiki.debian.org/Hardening
CDBS_BUILD_DEPENDS += , hardening-includes
CFLAGS += $(HARDENING_CFLAGS)
LDFLAGS += $(HARDENING_LDFLAGS)

# ...except this, causing "relocation [...]; recompile with -fPIC" failure
DEB_BUILD_HARDENING_PIE:= 0

# Reapply default strong optimizations unless noopt in DEB_BUILD_OPTIONS
CFLAGS += $(if $(filter noopt,$(DEB_BUILD_OPTIONS))-O0,-O4 -fexpensive-optimizations -funroll-loops)

DEB_MAKE_CLEAN_TARGET = superclean
DEB_MAKE_CHECK_TARGET = runtest

# preserve (and restore) upstream-shipped files tampered with
upstreamtmpfiles = doc/Makefile crypto/Makefile doc/Doxyfile
pre-build:: debian/stamp-upstreamtmpstuff
debian/stamp-upstreamtmpstuff: debian/stamp-copyright-check
		for file in $(upstreamtmpfiles); do \
			[ ! -e $$file ] || cp -np $$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

# generate (and cleanup) documentation
CDBS_BUILD_DEPENDS += , doxygen-latex | doxygen
CDBS_BUILD_DEPENDS += , doxygen-latex | texlive-latex-recommended
CDBS_BUILD_DEPENDS += , texlive-fonts-recommended
DEB_INSTALL_DOCS_srtp-docs += doc/*.txt doc/*.pdf
DEB_COMPRESS_EXCLUDE += .pdf
build/srtp-docs::
		[ -f debian/stamp-make-docs ] || $(DEB_MAKE_INVOKE) libsrtpdoc
		touch debian/stamp-make-docs
clean::
		rm -f doc/*.pdf
		rm -f debian/stamp-make-docs

# Ensure test script is executable
post-patches::
		chmod +x test/rtpw_test.sh

# Let d-shlibs calculate development package dependencies
#  and handle shared library install
CDBS_BUILD_DEPENDS += , d-shlibs
binary-post-install/libsrtp0::
		d-shlibmove --commit \
			--movedev "debian/tmp/usr/include/srtp/*" usr/include/srtp/ \
			debian/tmp/usr/lib/libsrtp.so

Builds:

libsrtp0-dev
secure rtp (srtp) and ust reference implementations - development files
libsrtp0
secure rtp (srtp) and ust reference implementations - shared library
srtp-docs
secure rtp (srtp) and ust reference implementations - documentation
srtp-utils
secure rtp (srtp) and ust reference implementations - utilities