#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81358
ifneq (,$(filter $(DEB_HOST_ARCH), armel))
export DEB_LDFLAGS_MAINT_APPEND += -Wl,--no-as-needed -latomic -Wl,--as-needed
endif

%:
	dh $@ --buildsystem=cmake

override_dh_auto_configure:
	dh_auto_configure --                                        \
		-DLLVM_CONFIG_EXECUTABLE=/usr/bin/llvm-config-14    \
		-DINSTALL_PYTHON_VIRTUALENV=OFF                     \
		-DPYTHON_VENV_EXECUTABLE=/usr/bin/python3           \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo

# Skip tests for now
override_dh_auto_test:

override_dh_auto_install:
	dh_auto_install
	cd obj-$(DEB_HOST_GNU_TYPE)/analyzer/python && python3 setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb
