#!/usr/bin/make -f

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

export DEB_BUILD_MAINT_OPTIONS := hardening=+pie,+bindnow
export DEB_CFLAGS_MAINT_APPEND := -pipe -Wall
export DEB_CXXFLAGS_MAINT_APPEND := -pipe -Wall
export DEB_LDFLAGS_MAINT_APPEND := -Wl,-Bsymbolic -Wl,--as-needed


AQSIS_CHANGELOG = release-notes/1.6/summary-1.6.0.txt


%:
	dh $@ --buildsystem=cmake

override_dh_auto_configure:
	dh_auto_configure -- \
		-DSYSCONFDIR=/etc/aqsis \
		-DAQSIS_USE_EXTERNAL_TINYXML:BOOL=ON \
		-DAQSIS_USE_PDIFF:BOOL=OFF \
		-DAQSIS_USE_RPATH:BOOL=OFF

override_dh_auto_build:
	dh_auto_build --parallel

override_dh_auto_install:
	dh_auto_install

#	Remove houdini script, not interesting for Debian (it's intended as
#	plugin for 3rd party proprietary software, to use Aqsis as renderer),
#	and also has poor licensing terms (not well explained, not for all
#	files, etc).
	rm -fr debian/tmp/usr/share/aqsis/plugins/houdini

#	Remove empty directory (valid until/unless there are more plugins than
#	houdini), otherwise dh_install fails with --list-missing
	rmdir debian/tmp/usr/share/aqsis/plugins

#	Add exec permissions to several example scripts
	find debian/tmp/usr/ \( -name \*.sh -o -name \*.py \) -exec chmod a+x {} \;

override_dh_installchangelogs:
	dh_installchangelogs $(AQSIS_CHANGELOG)
