File: rules

package info (click to toggle)
libmtp 1.1.13-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid, stretch
  • size: 3,760 kB
  • ctags: 3,940
  • sloc: ansic: 27,835; sh: 4,367; makefile: 191; python: 26; perl: 13
file content (100 lines) | stat: -rwxr-xr-x 2,915 bytes parent folder | download | duplicates (2)
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/usr/bin/make -f

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

# The default changed in libmtp 1.1.9 to /usr/lib/udev
DEB_CONFIGURE_EXTRA_FLAGS += --with-udev=/lib/udev

DB2MAN = /usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.xsl
XP = xsltproc -''-nonet
SOVERSION = 9
SUBSTFILES = debian/libmtp$(SOVERSION).docs	\
	debian/libmtp$(SOVERSION).install	\
	debian/libmtp$(SOVERSION).preinst	\
	debian/libmtp$(SOVERSION).postinst
UDEVFILES = 20-libmtp$(SOVERSION).fdi

debdir = $(CURDIR)/debian
debver = $(shell perl -ne '/([\d.-]+)/;print "$$1"; last' \
		debian/changelog)

# Replace SOVERSION string in debian/ files
libmtp$(SOVERSION).%: libmtp.%.in
	sed "s/@SOVERSION@/$(SOVERSION)/g" < $<	> $@
debian/%: debian/%.in
	sed "s/@SOVERSION@/$(SOVERSION)/g" < $<	> $@

mtp-tools.1: debian/mtp-tools.dbk
	# Build and install the man page for mtp-tools
	$(XP) $(DB2MAN) $<

%:
	dh $@ --with autoreconf

##override_dh_autoreconf:
##	cp /usr/share/gnulib/build-aux/config.rpath .
##	dh_autoreconf

##override_dh_autoreconf_clean:
##	rm -rf config.rpath
##	dh_autoreconf_clean

override_dh_auto_configure: $(SUBSTFILES) debian/control
	# 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 $(SUBSTFILES) $(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
	chmod +x debian/sanitize-manpage.pl
	( 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:
ifeq (linux,$(DEB_HOST_ARCH_OS))
	echo "udev=udev" >> debian/libmtp$(SOVERSION).substvars
endif
	# Remove rpath from the library
	chrpath --delete \
		$(debdir)/libmtp$(SOVERSION)/usr/lib/$(DEB_HOST_MULTIARCH)/libmtp.so.*.*
	# Remove rpath from programs
	chrpath --delete $(debdir)/mtp-tools/usr/bin/*
	dh_installdeb

override_dh_strip:
	dh_strip -plibmtp$(SOVERSION) --dbg-package=libmtp-dbg
	dh_strip --remaining-packages