#!/usr/bin/make -f

include /usr/share/dpkg/default.mk
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
include /usr/share/dpkg/buildflags.mk

# workaround address space limitations on some architectures
# see: https://salsa.debian.org/science-team/xraylib/-/merge_requests/2
ifneq (,$(filter $(DEB_HOST_ARCH), m68k mipsel sh4))
  export DEB_CFLAGS_MAINT_APPEND += -g1
endif

export PYBUILD_SYSTEM = meson
export PYBUILD_CONFIGURE_ARGS = \
  -Dpython-bindings=enabled \
  -Dpython-numpy-bindings=enabled \
  -Dpython=python{version}

%:
	dh $@ --without autoreconf --buildsystem pybuild

execute_after_dh_auto_install:
	find debian/tmp/ -name xraydoc.txt -delete || true
	find debian/tmp -name libxrl.la -delete || true
