#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

%:
	dh $@ --parallel --with autoreconf

override_dh_auto_configure:
	dh_auto_configure -- --disable-static --disable-doc --disable-silent-rules

override_dh_installchangelogs:
	dh_installchangelogs NEWS


PKD  = $(abspath $(dir $(MAKEFILE_LIST)))
PKG  = $(word 2,$(shell dpkg-parsechangelog -l$(PKD)/changelog | grep ^Source))
VER ?= $(shell dpkg-parsechangelog -l$(PKD)/changelog | perl -ne 'print $$1 if m{^Version:\s+(?:\d+:)?(\d.*)(?:\-\d+.*)};')
.PHONY: get-orig-source
get-orig-source:  $(info I: $(PKG)_$(VER))
	/usr/bin/wget --tries=3 --timeout=40 --read-timeout=40 --continue -O libdvdcss_$(VER).orig.tar.bz2 \
          http://download.videolan.org/pub/libdvdcss/$(VER)/libdvdcss-$(VER).tar.bz2 \
        || /usr/bin/uscan --noconf --verbose --rename --destdir=$(CURDIR) --check-dirname-level=0 --force-download --download-current-version $(PKD)
