#!/usr/bin/make -f
#export DH_VERBOSE = 1

include /usr/share/GNUstep/debian/config.mk
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_LDFLAGS_MAINT_APPEND = -Wl,-rpath,/usr/lib/gnustep-xcode

res := $(GNUSTEP_SYSTEM_FRAMEWORKS)/XCode.framework/Versions/0/Resources

%:
	dh $@

override_dh_auto_build:
	dh_auto_build -- $(optim) $(verbose) \
	  $(shell dpkg-buildflags --export=cmdline)

override_dh_auto_install:
# Install the library as private; there are no rdeps.
	dh_auto_install -- GNUSTEP_SYSTEM_LIBRARIES=/usr/lib/gnustep-xcode

execute_before_dh_fixperms:
# Building a framework fails because this script is not executable and
# has CLRF line terminators.  Furthermore, there are two legitimate
# lintian issues (E: shell-script-fails-syntax-check and W:
# script-not-executable).
	dos2unix debian/xcode-tools$(res)/create-dummy-class.sh
	chmod +x debian/xcode-tools$(res)/create-dummy-class.sh

execute_before_dh_link:
	gsdh_gnustep
# Delete headers and broken symlinks.
	$(RM) -r debian/xcode-tools/usr/include
	find debian/xcode-tools -type l -name Headers -delete

override_dh_makeshlibs:
# Avoid lintian complaints for the private library.
	dh_makeshlibs --no-scripts
