#!/usr/bin/make -f
#
# © 2009 Cyril Brulebois <kibi@debian.org>


##### INCLUDE
#

##### VARIABLES
#

DEB_BUILD_ARCH      ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
NO_MAKE_CHECK_ARCHS := arm ia64


##### OVERRIDES
#

# Need to pass an extra flag:
override_dh_auto_configure:
	dh_auto_configure -v -- --with-openexr-prefix=/usr \
		$(shell dpkg-buildflags --export=configure)

# Need to disable the test suite on some architectures:
override_dh_auto_test:
ifeq (,$(filter $(DEB_BUILD_ARCH),$(NO_MAKE_CHECK_ARCHS)))
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	dh_auto_test
endif
endif

# No need to compress .h/.cpp files:
override_dh_compress:
	dh_compress -X.h -X.cpp

# Need to remove the directories, since they're getting replaced with
# symlinks:
override_dh_link:
	rm -rf debian/libopenexr-dev/usr/share/doc/libopenexr-dev
	rm -rf debian/openexr/usr/share/doc/openexr
	dh_link

# Need to pass an extra parameter:
override_dh_makeshlibs:
	dh_makeshlibs -V

# Need to remember package versions:
override_dh_installdeb:
	dh_buildinfo -plibopenexr6
	dh_installdeb

override_dh_auto_install:
	dh_auto_install
	find debian/tmp/usr/lib -name "*.la" -exec \
		sed -i -e "s,^dependency_libs=.*,dependency_libs=''," {} +

%:
	dh $@ --with autotools_dev
