#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

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

# This is the debhelper compatibility version to use.
export DH_COMPAT=4

PYTHON_VERSION=$(shell /usr/bin/python -V 2>&1 | /usr/bin/perl -le 'print "$$1.$$2" if <> =~m/^Python\s+(\d+)\.(\d+)(\.\d+)*/')

build:

clean:
	dh_testdir
	dh_testroot
	rm -rf build/
	dh_clean

install: build

	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	# Commands to install the package into debian/expression
	chmod +x ./setup.py
	./setup.py install --prefix=$(CURDIR)/debian/expression/usr \
		        --install-lib $(CURDIR)/debian/expression/usr/lib/expression/modules \
			--install-data $(CURDIR)/debian/expression/usr/share
	mv $(CURDIR)/debian/expression/usr/bin/expression-server \
		$(CURDIR)/debian/expression/usr/sbin/expression-server
	patch $(CURDIR)/debian/expression/usr/sbin/expression-server < \
		$(CURDIR)/debian/patches/expression-server
	mkdir -p $(CURDIR)/debian/expression/usr/share/expression/xslt
	cp vhosts/system/xslt/site.xsl $(CURDIR)/debian/expression/usr/share/expression/xslt/

	
# Build architecture-independent files here.
binary-arch: build install
	

# Build architecture-dependent files here.
binary-indep: build install
	dh_testdir
	dh_testroot
	cp $(CURDIR)/debian/config.xml $(CURDIR)/debian/expression/etc/expression/
	dh_installdocs
	dh_installxmlcatalogs
	dh_installinit
	dh_installexamples
	dh_installmenu
	dh_installmime
	dh_installman
	dh_installchangelogs 
	dh_link
	dh_compress
	dh_fixperms
	dh_python
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install
