#!/usr/bin/make -f

DH_VERBOSE = 1
DEB_HOST_ARCH_OS = $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
export DH_OPTIONS

PYVERS := $(shell pyversions -vr)

export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
export CLASSPATH=/usr/share/java/csv.jar:/usr/share/java/debug-disable.jar:/usr/share/java/itext.jar

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

override_dh_usrlocal:
	for el in `find $(CURDIR)/debian/tmp/usr/lib/*-linux-gnu/ -type l | grep "\.so"`; do \
		cp -avP $$el $(CURDIR)/debian/libmesos/usr/local/lib; \
	done

override_dh_autoreconf:
	dh_autoreconf --as-needed

CONFIGURE_FLAGS = "--enable-optimize -std=c++11"
overrride_dh_configure:
	dh_configure -- $(CONFIGURE_FLAGS)

override_dh_install:
	dh_install --list-missing -X.la -X.pyc -X.pyo
	cp -r $(CURDIR)/debian/etc/ $(CURDIR)/debian/mesos/
	install $(CURDIR)/debian/mesos-init-wrapper $(CURDIR)/debian/mesos/usr/bin
	install $(CURDIR)/src/java/target/*.jar $(CURDIR)/debian/mesos/usr/share/java

override_dh_installinit:
	install $(CURDIR)/debian/mesos-master $(CURDIR)/debian/mesos-slave $(CURDIR)/debian/mesos/etc/init.d

#override_dh_auto_configure:
#	dh_auto_configure -- \
#	--disable-silent-rules \
#	--disable-java \
#	--disable-python \
#	--disable-bundled-pip \
#	--disable-bundled-wheel \
#	--disable-bundled-distribute \
#	--disable-python-dependency-install \
#	--with-boost=/usr \
#	--with-glog=/usr \
#	--with-leveldb=/usr \
#	--with-libev=/usr \
#	--with-protobuf=/usr \
#	--with-zookeeper=/usr \
