#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright 2011-2015, 2017-2018 Jonas Smedegaard <dr@jones.dk>
# Copyright 2011-2012 Florian Schlichting <fschlich@zedat.fu-berlin.de>
# Description: Main Debian packaging script for RDF::Trine
#
# 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 build and (always/often) at runtime
# * recent perl needed for List::Util >= 1.33
perl-deps = algorithm-combinatorics cache-lru dbd-sqlite3 dbi
perl-deps += dbix-connector error iri json log-log4perl moose
perl-deps += moosex-arrayref ossp-uuid set-scalar text-csv-xs text-table
perl-deps += uri www xml-commonns xml-namespace xml-sax
deps = $(patsubst %,$(comma) lib%-perl,$(perl-deps))
deps-recommend = librdf-perl

# Needed by upstream testsuite
deps-test = libtest-exception-perl, libtest-json-perl
deps-test +=, libtest-deep-perl

# Needed by upstream testsuite (and some also at runtime) except for
# profile builds. See README.source for details.
xdeps = librdf-query-perl
xdeps-recommend = librdf-trine-node-literal-xml-perl
xdeps-suggest = librdf-rdfa-parser-perl
# FIXME: include xdeps-suggest when bug#750946 is solved
deps-test += $(if $(DEB_BUILD_PROFILE),,$(strip \
 $(comma) $(xdeps)$(comma) $(xdeps-recommend)$(comma) $(FIXMExdeps-suggest)))

# Needed (often/seldom) at runtime
recommends = libxml-libxml-perl
suggests = libdbd-pg-perl, libdbd-mysql-perl, libredis-perl

CDBS_BUILD_DEPENDS +=, $(deps), $(deps-test), $(deps-recommend)
CDBS_DEPENDS_$(pkg) = $(deps)
CDBS_RECOMMENDS_$(pkg) = $(deps-recommend), $(xdeps-recommend), $(recommends)
CDBS_SUGGESTS_$(pkg) = $(suggests), $(xdeps-suggest)

# install binaries as sample files (and only as such)
DEB_INSTALL_EXAMPLES_$(pkg) += examples/* bin
install/$(pkg)::
	rm $(cdbs_curdestdir)usr/bin/*
	rmdir $(cdbs_curdestdir)usr/bin
