#!/usr/bin/make -f

export REPACK_SH=$(CURDIR)/debian/repack.sh

UPSTREAM_VERSION=$(shell dpkg-parsechangelog | grep 'Version:' | sed 's/^Version:\s\(.*\)\(~ds[0-9]*\)-.*/\1/')

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

export CFLAGS+=$(CPPFLAGS)
export CXXFLAGS+=$(CPPFLAGS)

%:
	dh $@ --parallel --with=autoreconf,python2

override_dh_auto_install:
	dh_auto_install
	find debian/tmp -type f -name "*.la" -ls -delete
	cd debian/tmp/usr/share/doc/lives-$(UPSTREAM_VERSION) && \
		rm \
			ChangeLog \
			FEATURES \
			BUGS \
			AUTHORS
	rm -rf \
	 debian/tmp/usr/lib/lives/plugins/effects/realtime/weed/data/.svn/ \
	 debian/tmp/usr/lib/lives/plugins/effects/realtime/weed/icons/.svn/
	find debian/tmp/usr/lib/lives -type d -empty -delete
	chmod a-x \
		debian/tmp/usr/lib/lives/plugins/effects/realtime/weed/data/fourKlives/songs/*.txt

override_dh_strip:
	dh_strip -plibweed0 --dbg-package=libweed-dbg
	dh_strip -plives --dbg-package=lives-dbg
	dh_strip --remaining-packages

get-orig-source:
	uscan --force-download
