#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2013-2015, 2017 Jonas Smedegaard <dr@jones.dk>
# Description: Main Debian packaging script for Type::Tiny
#
# 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/class/perl-makemaker.mk
include /usr/share/cdbs/1/rules/debhelper.mk

pkg = $(DEB_SOURCE_PACKAGE)

# Needed by upstream testsuite
# TODO: add Sub::Exporter::Lexical when in Debian
perl-deps-test = class-insideout moosex-types mousex-types test-fatal
perl-deps-test += moosex-types-common test-warnings match-simple
perl-deps-test += moosex-getopt devel-hide validation-class object-accessor
deps-test = $(patsubst %,$(comma) lib%-perl,$(perl-deps-test))
deps-test +=, perl (>= 5.21.6) | libtest-simple-perl (>= 1.001010) | libtest-tester-perl

# Needed by upstream testsuite and (always/seldom/by others) at runtime
depends-test = libexporter-tiny-perl
suggests-test = libdevel-stacktrace-perl
enhances-test = libfunction-parameters-perl
enhances-test +=, libmoo-perl, libmoose-perl, libmouse-perl

# Needed (often) at runtime
# * recent perl or recent Scalar::List::Utils needed for Sub::Util
recommends = libtype-tiny-xs-perl, libref-util-perl
recommends +=, perl (>= 5.21.4) | libscalar-list-utils-perl (>= 1.40)
suggests = libdevel-lexalias-perl

# Improves other packages
# TODO: get Type::Tie, Regexp::Util and Data::Validator in Debian
enhances = libtype-tie-perl, libregexp-util-perl, libreply-perl, perl
enhances +=, libparams-validationcompiler-perl, libdata-validator-perl

CDBS_BUILD_DEPENDS +=, $(deps), $(deps-test), $(depends-test), $(suggests-test), $(enhances-test)
CDBS_DEPENDS_$(pkg) = $(deps), $(depends-test)
CDBS_RECOMMENDS_$(pkg) = $(recommends)
CDBS_SUGGESTS_$(pkg) = $(suggests-test), $(suggests)
CDBS_ENHANCES_$(pkg) = $(enhances-test), $(enhances)

DEB_INSTALL_EXAMPLES_$(pkg) = examples/*
