#!/usr/bin/make -f
# rules file using dh for theseus
# Copyright (C) Andreas Tille <tille@debian.org>
# License: GPL

pkg=theseus

# This
#     export DEB_BUILD_MAINT_OPTIONS = hardening=+pie
# leads to
# /usr/bin/ld: theseus.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
DEB_BUILD_MAINT_OPTIONS=hardening=+all,-pie

%:
	dh $@

override_dh_auto_install-arch:
	make install INSTALLDIR=$(CURDIR)/debian/$(pkg)/usr/bin
	# Fix wrong path used in upstream script.  Fixing it here is safer than
	# changing the patch for any new upstream release
	sed -e 's?/usr/local/bin?/usr/bin?' \
	    -e 's?/usr/bin/sed?/bin/sed?'   \
	    theseus_align > debian/$(pkg)/usr/bin/theseus_align

override_dh_auto_install-indep:
	# nothing to do here

override_dh_install:
	dh_install
	# remove macos resource files
	find debian -name "._*" -delete
	find debian -name ".DS_*" -delete
