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

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

UPVER := $(shell dpkg-parsechangelog | grep ^Version | cut -d- -f1 | cut -d+ -f1)

%:
	dh $@

override_dh_auto_configure:
	./configure \
		--prefix=/usr \
		--destdir=$(CURDIR)/debian/node-sqlite3

override_dh_auto_test:
	# nothing

override_dh_install:
	dh_install
	dh_buildinfo

override_dh_auto_clean:
	-dh_auto_clean
	rm -rf build/ lib/sqlite3_bindings.node .lock-wscript

get-orig-source:
	wget http://registry.npmjs.org/sqlite3/-/sqlite3-$(UPVER).tgz
	tar xf sqlite3-$(UPVER).tgz
	rm -rf package/deps/
	tar cf node-sqlite3_$(UPVER)+ds1.orig.tar package/
	gzip -9 node-sqlite3_$(UPVER)+ds1.orig.tar
	rm -rf package/ sqlite3-$(UPVER).tgz
