File: rules

package info (click to toggle)
libmtp 1.1.22-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 18,404 kB
  • sloc: ansic: 32,347; sh: 292; makefile: 207; python: 26; perl: 13
file content (81 lines) | stat: -rwxr-xr-x 2,347 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/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:
	NOCONFIGURE=1 ./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/&/&amp;/' $$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