#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk

export PYBUILD_NAME = spglib
export PYBUILD_SYSTEM = pyproject
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@ --buildsystem cmake --with python3

override_dh_auto_configure:
	dh_auto_configure -- -DSPGLIB_WITH_Fortran=ON

execute_after_dh_auto_build:
	dh_auto_build --buildsystem pybuild -- --after-build 'rm -rf {build_dir}/spglib/lib'

execute_after_dh_auto_test:
	LD_LIBRARY_PATH=$(CURDIR)/obj-$(DEB_HOST_GNU_TYPE) dh_auto_test --buildsystem pybuild

execute_after_dh_auto_install:
	dh_auto_install --buildsystem pybuild

execute_after_dh_makeshlibs:
	cut -d - -f 1 debian/libsymspg2/DEBIAN/symbols | sponge debian/libsymspg2/DEBIAN/symbols

override_dh_installchangelogs:
	dh_installchangelogs ChangeLog.md

execute_after_dh_auto_clean:
	dh_auto_clean --buildsystem pybuild
	rm -rf .pytest_cache/ test/functional/python/__pycache__/
