#!/usr/bin/make -f

export DH_OPTIONS
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

INSTDIR = debian/tmp

LIB_PKG = $(shell dh_listpackages | grep libopenexr | grep -v libopenexr-d)
ABI_PKG = $(LIB_PKG)-imath$(shell pkgconf --variable=libsuffix Imath | sed 's/_/-/g')

%:
	dh $@ -Bbuild -Scmake

override_dh_makeshlibs:
	echo "libopenexr:Provides=$(ABI_PKG)" >> debian/$(LIB_PKG).substvars
	dh_makeshlibs -p$(LIB_PKG) -V "$(ABI_PKG)"
	dh_makeshlibs --remaining-packages

ifeq ($(DEB_HOST_ARCH_ENDIAN),big)
# Ignore test results
override_dh_auto_test:
	-dh_auto_test
endif

ifeq ($(DEB_HOST_ARCH_OS),hurd)
# Ignore test results
override_dh_auto_test:
	-dh_auto_test
endif
