#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk

export PYBUILD_NAME=spice-crypt

# Disable the Rust extension as we're not able to build it in Debian yet.
export DISABLE_RUST=1

PY3VER := $(shell py3versions -d | sed 's/^python//')
PYBUILD_DIR := .pybuild/cpython3_$(PY3VER)_spice-crypt
BUILT_SPICE_CRYPT := $(PYBUILD_DIR)/scripts/spice-crypt
BUILT_PYTHONPATH := $(PYBUILD_DIR)/build

%:
	dh $@ --buildsystem=pybuild

override_dh_auto_build:
	dh_auto_build
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	PYTHONPATH="$(BUILT_PYTHONPATH)" \
	help2man --no-info \
		--name='Tool to decrypt encrypted SPICE model files' \
		--version-string='$(DEB_VERSION_UPSTREAM)' \
		$(BUILT_SPICE_CRYPT) \
		> spice-crypt.1
endif
