#!/usr/bin/make -f export DEB_BUILD_MAINT_OPTIONS = hardening=+all LDFLAGS+=-Wl,--as-needed DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) DEB_CONFIGURE_EXTRA_FLAGS := --enable-static=no ifneq (,$(findstring libmtp-doc, $(shell dh_listpackages))) DEB_CONFIGURE_EXTRA_FLAGS += --enable-doxygen endif ifeq (,$(findstring libmtp-common, $(shell dh_listpackages))) DEB_CONFIGURE_EXTRA_FLAGS += --disable-configfiles endif export deb_udevdir = $(shell pkg-config --variable=udevdir udev | sed s,^/,,) # The default changed in libmtp 1.1.9 to /usr/lib/udev. We defer to udev.pc. DEB_CONFIGURE_EXTRA_FLAGS += --with-udev=/$(deb_udevdir) DB2MAN = /usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.xsl XP = xsltproc --nonet SOVERSION = 9 UDEVFILES = 20-libmtp$(SOVERSION).fdi debdir = $(CURDIR)/debian mtp-tools.1: debian/mtp-tools.dbk # Build and install the man page for mtp-tools $(XP) $(DB2MAN) $< %: dh $@ execute_before_dh_autoreconf: ./autogen.sh override_dh_auto_configure: # Save file modified by configure ( test -e src/gphoto2-endian.h-orig -o ! \( -e src/gphoto2-endian.h \) ) \ || cp src/gphoto2-endian.h src/gphoto2-endian.h-orig dh_auto_configure -- $(DEB_CONFIGURE_EXTRA_FLAGS) override_dh_auto_clean: rm -f mtp-tools.1 $(UDEVFILES) # Restore original file test ! -e src/gphoto2-endian.h-orig \ || mv src/gphoto2-endian.h-orig src/gphoto2-endian.h dh_auto_clean override_dh_auto_build: mtp-tools.1 dh_auto_build ifneq (,$(findstring libmtp-common, $(shell dh_listpackages))) ifeq (linux,$(DEB_HOST_ARCH_OS)) # Fix mode of udev lifting script chmod +x libmtp.sh # Rename udev files for f in $(UDEVFILES) ; do \ cp libmtp.$${f#*.} $$f ; \ sed -i 's/&/&/' $$f ; \ done endif endif override_dh_install: ifneq (,$(findstring libmtp-doc, $(shell dh_listpackages))) # Rename some man files and remove others ( cd doc/man/man3/ ; \ rm -f _* ; \ for i in $$(ls *.3 | grep -v ^mtp_) ; do \ ../../../debian/sanitize-manpage.pl < $$i > mtp_$$i ; \ done ) endif dh_install override_dh_installdeb-arch: # Remove rpath from the library chrpath --delete \ $(debdir)/libmtp$(SOVERSION)t64/usr/lib/$(DEB_HOST_MULTIARCH)/libmtp.so.*.* # Remove rpath from programs chrpath --delete $(debdir)/mtp-tools/usr/bin/* dh_installdeb