#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright 2013, Vasudev Kamath <kamathvasudev@gmail.com>
# Copyright 2013-2016, Jonas Smedegaard <dr@jones.dk>
# Description: Main Debian packaging script for Catmandu
#
# 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 <http://www.gnu.org/licenses/>.

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 = $(DEB_SOURCE_PACKAGE)

DEB_UPSTREAM_PACKAGE = Catmandu
DEB_UPSTREAM_URL = http://www.cpan.org/authors/id/N/NI/NICS

# Build-depend unversioned on debhelper
#  TODO: Drop when adopted in cdbs
CDBS_BUILD_DEPENDS_rules_debhelper_v9 = debhelper

# Needed by upstream build and (always) at runtime
perl-deps = cgi-expand clone config-onion data-uuid file-slurp-tiny
perl-deps += hash-merge-simple io-handle-util www marpa-r2 module-info
perl-deps += moox-aliases sub-exporter try-tiny-byclass uri uri-template
deps = $(patsubst %,$(comma) lib%-perl, $(perl-deps))
deps +=, libapp-cmd-perl (>= 0.330)
deps +=, libdata-compare-perl (>= 0.22)
deps +=, libfile-find-rule-perl (>= 0.33)
deps +=, libjson-xs-perl (>= 2.300)
deps +=, liblist-moreutils-perl (>= 0.33)
deps +=, liblog-any-perl (>= 1.03)
deps +=, libmoo-perl (>= 1.004006)
deps +=, libtext-csv-perl (>= 1.21)
deps +=, libthrowable-perl (>= 0.200004)
deps +=, libyaml-libyaml-perl (>= 0.41)
deps +=, libnamespace-clean-perl (>= 0.24)

# Needed by upstream testsuite
deps-test = libtest-pod-perl
deps-test +=, libtest-deep-perl (>= 0.112)
deps-test +=, libtest-exception-perl (>= 0.32)
deps-test +=, perl (>= 5.19.5) | libtest-simple-perl (>= 0.99)

# Needed (often) at runtime
recommends = log-any-adapter-log4perl
recommends +=, liblog-log4perl-perl (>= 0.44)

CDBS_BUILD_DEPENDS +=, $(deps), $(deps-test)
CDBS_DEPENDS_$(pkg) = $(deps)
CDBS_RECOMMENDS_$(pkg) = $(recommends)

# drop empty man pages
binary-fixup/$(pkg)::
	find debian/$(pkg)/usr/share/man/man3 -type f -size 20c -delete
