#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS  = hardening=+all
export DEB_CFLAGS_MAINT_APPEND  = -fPIE
export DEB_LDFLAGS_MAINT_APPEND = -pie -fPIE

%:
	dh $@

###
### Some changes to fix magicrescue
###
override_dh_install:
# Move tools from usr/share to usr/lib because there are arch dependent files.
	dh_install
	dh_installdirs usr/lib/magicrescue
	mv debian/magicrescue/usr/share/magicrescue/tools/ \
           debian/magicrescue/usr/lib/magicrescue/
	dh_link usr/lib/magicrescue/tools usr/share/magicrescue/tools
# Remove the recipe gimp-xcf. See #567968.
	rm -f debian/magicrescue/usr/share/magicrescue/recipes/gimp-xcf
	rm -f debian/magicrescue/usr/lib/magicrescue/tools/gimp-resave.pl
# Move manpages to right place.
	mv debian/magicrescue/usr/man/ debian/magicrescue/usr/share/
# Fix a file permission.
	chmod 755 debian/magicrescue/usr/lib/magicrescue/tools/laola.pl
