#!/usr/bin/make -f

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


DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

#export DEB_BUILD_MAINT_OPTIONS   := hardening=+all
export DEB_LDFLAGS_MAINT_APPEND  := -Wl,--as-needed
# CMake doesn't use CPPFLAGS, pass them to CFLAGS/CXXFLAGS instead (bug #662833)
export DEB_CFLAGS_MAINT_APPEND   := -pipe -Wall $(shell dpkg-buildflags --get CPPFLAGS)
export DEB_CXXFLAGS_MAINT_APPEND := -pipe -Wall $(shell dpkg-buildflags --get CPPFLAGS)


%:
	dh $@ --buildsystem=cmake --parallel

override_dh_auto_configure:
	dh_auto_configure -- -DLIB_SUFFIX="/$(DEB_HOST_MULTIARCH)" -DBUNDLE_XDG_UTILS=No

override_dh_shlibdeps:
        # needed because other libraries depend on
        # /usr/lib/<multiarch>/razor-desktop/libdesktop-razor.so, installed in
        # this private directory, and that it cannot be found otherwise
        #
        # dpkg-shlibdeps: warning: couldn't find library libdesktop-razor.so needed by debian/razorqt-desktop/usr/lib/x86_64-linux-gnu/razor-desktop/libiconview.so (ELF format: 'elf64-x86-64'; RPATH: '')
        # ...
	dh_shlibdeps -l"usr/lib/$(DEB_HOST_MULTIARCH)/razor-desktop/"

override_dh_install:
	dh_install --list-missing
