#!/usr/bin/make -f
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export PYBUILD_NAME=xgboost
#export CC=cuda-gcc
#export CXX=cuda-g++

%:
	dh $@ -Scmake --with python3

#execute_before_dh_auto_configure:
#	cp -rv debian/gputreeshap $(CURDIR)
#	# patch the cmake file
#	sed -e '20,$$d' -i gputreeshap/CMakeLists.txt

#override_dh_auto_configure:
#	dh_auto_configure -- \
#		-DUSE_CUDA=ON -DBUILD_WITH_CUDA_CUB=ON -DUSE_NCCL=ON

execute_after_dh_auto_configure:
	dh_auto_configure -Spybuild -- -d python-package/ --system=pyproject

execute_after_dh_auto_build:
	dh_auto_build -Spybuild -- -d python-package/ --system=pyproject

execute_after_dh_auto_install:
	dh_auto_install -Spybuild -- -d python-package/ --system=pyproject
	mkdir -p debian/tmp/usr/lib/python3/dist-packages/xgboost/lib/
	ln -s ../../../../$(DEB_HOST_MULTIARCH)/libxgboost.so.0 \
	   debian/tmp/usr/lib/python3/dist-packages/xgboost/lib/libxgboost.so

execute_after_dh_auto_clean:
	dh_auto_clean -Spybuild -- -d python-package/ --system=pyproject
	-$(RM) xgboost
	-$(RM) -rf lib

override_dh_python3:
	dh_python3
	-$(RM) debian/tmp/usr/lib/python3/dist-packages/xgboost/lib/libxgboost.cpy*
	-$(RM) debian/python3-xgboost/usr/lib/python3/dist-packages/xgboost/lib/libxgboost.cpy*
