#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
# export DH_VERBOSE=1

CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)
CFLAGS:=$(shell dpkg-buildflags --get CFLAGS) $(CPPFLAGS)
CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS) $(CPPFLAGS)
LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)
GNUARCH:=$(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

%:
	dh $@  --buildsystem=cmake

override_dh_auto_configure:
#	dh_auto_configure -- -DENABLE_LZ4_PLUGIN=ON -DENABLE_BZIP2_PLUGIN=ON -DENABLE_BITSHUFFLE_PLUGIN=ON -DCMAKE_INSTALL_LIBDIR=$(DEST)/usr/lib/$(GNUARCH)/hdf5
	dh_auto_configure -- -DH5PL_SOURCE_DIR="$(CURDIR)" -DH5PL_RESOURCES_DIR="$(CURDIR)/config/cmake"  -DPL_PACKAGE_NAME="pl"   -DBSHUF_PACKAGE_NAME="bshuf"  -DLZ4_PACKAGE_NAME="lz4"   -DBZ2_PACKAGE_NAME="bz2"  -DENABLE_BSHUF=ON -DENABLE_BLOSC=OFF   -DENABLE_BZIP2=OFF -DENABLE_JPEG=OFF  -DENABLE_LZF=OFF  -DENABLE_LZ4=ON  -DENABLE_MAFISC=OFF -DENABLE_ZFP=OFF   -DHDF5_PACKAGE_NAME=hdf5 -DCMAKE_INSTALL_LIBDIR=$(DEST)/usr/lib/$(GNUARCH)/hdf5

override_dh_auto_install:
	dh_numpy
	dh_numpy3
	dh_auto_install
	mkdir -p $(CURDIR)/debian/tmp/usr/lib/$(GNUARCH)/hdf5/plugins/
	cp $(CURDIR)/debian/tmp/usr/lib/plugin/*.so  $(CURDIR)/debian/tmp/usr/lib/$(GNUARCH)/hdf5/plugins/