#!/usr/bin/make -f
export DEB_BUILD_MAINT_OPTIONS   = hardening=+all
export DEB_CXXFLAGS_MAINT_APPEND = -lpthread
export DEB_LDFLAGS_MAINT_APPEND  = -Wl,--as-needed
#export DPKG_GENSYMBOLS_CHECK_LEVEL = 0

%:
	dh $@ -Scmake

override_dh_auto_configure:
	mkdir third-party
	cd third-party; ln -s /usr/src/googletest googletest
	dh_auto_configure -- \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DUSE_REDIS=ON \
		-DUSE_IBVERBS=ON \
		-DUSE_MPI=ON \
		-DUSE_LIBUV=OFF \
		-DUSE_CUDA=OFF \
		-DUSE_NCCL=OFF \
		-DBUILD_TEST=OFF \
		-DBUILD_BENCHMARK=OFF \
		-DBUILD_SHARED_LIBS=ON

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	dh_auto_test
	-find obj-* -type f -name 'gloo_test' -executable -exec sh -c '{}' +
endif

override_dh_auto_clean:
	-$(RM) -rf third-party
