#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1

SHELL := sh -e

DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export CFLAGS=-fPIE

override_dh_auto_clean:
	dh_auto_clean
	rm -rf $(CURDIR)/test/__pycache__/
	rm -rf $(CURDIR)/test/.pytest_cache/

override_dh_auto_configure:
	mkdir -p debian/tmp
	mkdir -p usr/share/man/man1
	mkdir -p usr/share/man/man8
	cd debian/tmp && meson -D utils=true -D examples=false -D default_library=both -D prefix=/usr ../..

override_dh_prep:
	# Skip prep

override_dh_auto_build:
	cd debian/tmp && ninja -v
	sed -i 's/\/local//g' debian/tmp/meson-private/fuse3.pc

override_dh_compress:
	dh_compress -Xusr/share/doc/libfuse3-dev/examples -XREADME.md

override_dh_fixperms:
	dh_fixperms

ifeq ($(DEB_BUILD_ARCH),linux)
	chmod 0755 debian/tmp/util/fusermount3
endif

override_dh_installman:
	# Skip

override_dh_auto_test:
	# Skip tests

%:
	dh ${@}