#!/usr/bin/make -f
# Copyright (c) 2014 Intel Corporation

DEB_DESTDIR := $(CURDIR)/debian/piglit

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@ --buildsystem cmake+ninja --with python3

override_dh_auto_configure:
	dh_auto_configure -- \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=/usr/lib/$(DEB_HOST_MULTIARCH) \
		-DCMAKE_BUILD_TYPE=Release \
		-DPIGLIT_BUILD_GLES1_TESTS=1 \
		-DPIGLIT_BUILD_GLES2_TESTS=1 \
		-DPIGLIT_BUILD_GLES3_TESTS=1 \
		-DPIGLIT_BUILD_CL_TESTS=1 \
		-DPIGLIT_USE_WAFFLE=1

override_dh_auto_install:
	dh_auto_install
	find $(DEB_DESTDIR) -type d -name __pycache__ -exec rm -r {} +
	find $(DEB_DESTDIR) -type d -empty -delete
	python3 $(CURDIR)/debian/update-piglit-script.py $(DEB_DESTDIR)/usr/bin/piglit

override_dh_makeshlibs:
#       Fix lintian extra-license-file
	rm $(DEB_DESTDIR)/usr/share/doc/piglit/COPYING.gz

override_dh_auto_test:
	# renderdoc doesn't appear to have tests, and the ninja
	# generator of cmake fails when 'ninja test' is run.
