#!/usr/bin/make -f

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

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

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

%:
	dh $@ --buildsystem=autoconf

override_dh_auto_clean:
	-dh_auto_clean

override_dh_clean:
	dh_clean
	$(RM) -r libocispec/image-spec libocispec/runtime-spec libocispec/src/__pycache__

override_dh_auto_configure:
	dh_auto_configure
	mkdir -v libocispec/image-spec
	cp -rv /usr/share/gocode/src/github.com/opencontainers/image-spec/* libocispec/image-spec/
	mkdir -v libocispec/runtime-spec
	cp -rv /usr/share/gocode/src/github.com/opencontainers/runtime-spec/* libocispec/runtime-spec/
#	FIXME: https://github.com/containers/crun/issues/240
#	$(MAKE) -C libocispec generate

override_dh_auto_test:
	-dh_auto_test

override_dh_auto_install:
	dh_auto_install --destdir=debian/tmp

override_dh_gencontrol:
	dh_gencontrol -- -Vmy:Built-Using="$(shell dpkg-query --show -f '$${source:Package} (=$${source:Version}),' golang-github-opencontainers-image-spec-dev golang-github-opencontainers-specs-dev)"
