#!/usr/bin/make -f
%:
	dh $@ --buildsystem cmake

override_dh_auto_configure:
	dh_auto_configure -- -DBUILD_EXTRAS=OFF -DBUILD_DEMOS=OFF -DBUILD_SHARED_LIBS=ON

override_dh_install:
	dh_install -X.la

# We make a dfsg tarball because upstream's includes several binary dll files
# and a pdf file without corresponding source.
# While we're at it, we cut out a lot of code that we just don't care about,
# like the Demos, Extras, and Glut folders.
get-orig-source:
	DFSGVER=$(shell dpkg-parsechangelog | sed -rne 's,^Version: ([^-]+).*,\1,p'); \
	VER=$(shell dpkg-parsechangelog | sed -rne 's,^Version: ([^+]+).*,\1,p'); \
	TMPDIR=`mktemp --directory`; \
	uscan --noconf --force-download --download-version=$$VER --destdir="$$TMPDIR" && \
	cd "$$TMPDIR" && \
	tar xfz bullet_$$VER.orig.tar.gz && \
	rm */*.dll */*.DLL */Glut/*.lib */*.pdf && \
	rm -r */Demos */Extras */Glut && \
	tar --owner=root --group=root --mode=a+rX -cf "$(CURDIR)/bullet_$$DFSGVER.orig.tar" */ && \
	xz "$(CURDIR)/bullet_$$DFSGVER.orig.tar" && \
	rm -rf "$$TMPDIR"
