#!/usr/bin/make -f

export CC=gcc-15
export CXX=g++-15

%:
	dh $@ --parallel

override_dh_auto_configure:
	dh_auto_configure \
	  --buildsystem=cmake+ninja -- \
	  -DCMAKE_CXX_STANDARD=23 \
	  -DMAYAFLUX_BUILD_TESTS=OFF

override_dh_auto_build-arch:
	dh_auto_build

override_dh_auto_build-indep:
	doxygen doxyconf

override_dh_auto_test:
	:

override_dh_shlibdeps:
	dh_shlibdeps -l$(CURDIR)/debian/mayaflux/usr/lib -- -xmayaflux

override_dh_auto_install:
	dh_auto_install
	install -d debian/mayaflux/etc/profile.d
	printf '#!/bin/sh\nexport MAYAFLUX_ROOT="/usr"\nexport CMAKE_PREFIX_PATH="/usr:$${CMAKE_PREFIX_PATH}"\nexport PATH="/usr/lib/llvm-21/bin:$${PATH}"\n' > debian/mayaflux/etc/profile.d/mayaflux.sh
	chmod 755 debian/mayaflux/etc/profile.d/mayaflux.sh

	install -d debian/mayaflux-doc/usr/share/doc/mayaflux/html
	if [ -d docs/html ]; then \
	  cp -r docs/html/* debian/mayaflux-doc/usr/share/doc/mayaflux/html/; \
	fi

override_dh_auto_clean:
	dh_auto_clean
	rm -rf docs/html
