#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2003-2008 Jonas Smedegaard <dr@jones.dk>
# Description: Main Debian packaging script for HTML::Lint
#
# 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 2, 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/>.

# See debian/README.cdbs-tweaks for info on local overrides
include /usr/share/cdbs/1/rules/upstream-tarball.mk
include /usr/share/cdbs/1/rules/utils.mk
include /usr/share/cdbs/1/rules/debhelper.mk
# Put perlmodule.mk after debhelper.mk to dh_clean temp files not in MANIFEST
include /usr/share/cdbs/1/class/perl-makemaker.mk

# Silence optional build-dependencies to ease backporting
CDBS_BUILD_DEPENDS_rules_upstream-tarball =
CDBS_BUILD_DEPENDS_rules_utils_copyright-check =

DEB_UPSTREAM_PACKAGE = HTML-Lint
DEB_UPSTREAM_URL = http://www.cpan.org/modules/by-module/HTML
DEB_UPSTREAM_TARBALL_MD5 = 13e14932f7b63db5e5dc54f608148c34

DEB_INSTALL_MANPAGES_weblint-perl := debian/weblint.1

common-build-indep::
	txt2man -p debian/weblint.txt > debian/weblint.1

common-binary-post-install-indep::
	mv debian/libhtml-lint-perl/usr/bin debian/weblint-perl/usr

clean::
	rm -f debian/weblint.1

# Needed both by upstream build process and at runtime
#TODO: Automatically include these to debian/control Depends: line
dependencies = libhtml-parser-perl (>= 3.47), libhtml-tagset-perl (>= 3.03)

# Needed by upstream build process
CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), $(dependencies), libtest-pod-perl (>= 0.95), libtest-pod-coverage-perl (>= 1.04)

# Needed by pur packaging routines
CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), txt2man

# Fix double cdbs build-dependencies
CDBS_BUILD_DEPENDS := $(shell echo '$(CDBS_BUILD_DEPENDS)' | sed -e '/\bcdbs (>= 0.4.39)/ s/ *,* *\bcdbs (>= \(0.4.23-1.1\)) *,* */, /g' -e 's/^ *, *//' -e 's/ *, *$$//')
