#!/usr/bin/make -f
include /usr/share/dpkg/buildopts.mk
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export PATH := /opt/plasma-build/rust-1.88.0/bin:/opt/plasma/bin:$(PATH)
export CARGO_HOME = $(CURDIR)/debian/cargo-home
export CARGO_NET_OFFLINE = true
export RUSTC = /opt/plasma-build/rust-1.88.0/bin/rustc
export CARGO = /opt/plasma-build/rust-1.88.0/bin/cargo
export CMAKE_PREFIX_PATH = /opt/plasma
export PKG_CONFIG_PATH = /opt/plasma/lib/pkgconfig:/opt/plasma/share/pkgconfig
export XDG_DATA_DIRS = /opt/plasma/share:/usr/local/share:/usr/share

%:
	dh $@ --buildsystem=meson+ninja --builddirectory=obj-module

override_dh_auto_configure:
	meson setup obj-module --prefix=/opt/plasma --libdir=lib --buildtype=release --wrap-mode=nofallback -Ddefault_library=shared -Dc_link_args=-Wl,-rpath,/opt/plasma/lib -Dtests=disabled -Dlibei=enabled -Dlibeis=enabled -Dliboeffis=enabled -Dsd-bus-provider=libsystemd

override_dh_auto_build:
	ninja -C obj-module -j$(or $(DEB_BUILD_OPTION_PARALLEL),1)

override_dh_auto_test:
	@echo 'Upstream tests disabled as in the frozen trial; consumer checks omitted.'

override_dh_auto_install:
	DESTDIR=$(CURDIR)/debian/tmp meson install -C obj-module
	python3 debian/normalize-permissions.py
	python3 debian/split.py

override_dh_installdocs:
	dh_installdocs
	python3 debian/install-notices.py

override_dh_missing:
	dh_missing --fail-missing

override_dh_makeshlibs:
	dh_makeshlibs -V --no-scripts

override_dh_shlibdeps:
	dh_shlibdeps -l$(CURDIR)/debian/plasma-next-libei/opt/plasma/lib
