File: rules

package info (click to toggle)
tss2 1045-1.2
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 6,868 kB
  • sloc: ansic: 58,589; sh: 5,124; php: 1,247; makefile: 380; cpp: 23
file content (131 lines) | stat: -rwxr-xr-x 3,855 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/usr/bin/make -f

export DH_VERBOSE=1

package = tss2
version = 1045

# debian uses sh by default
SHELL := /bin/bash

DEBDIR = $(CURDIR)/debian

# package name should reflect soname
LIBNAME = libtss
LIBPKG = $(LIBNAME)0
DEVPKG = $(LIBNAME)-dev
LIBSYM = $(LIBNAME).so
LIBSONAME = $(LIBNAME).so.0
VERSIONED_LIB = $(LIBNAME).so.0.1

TSSDOC = ibmtss.html

# for multiple binaries
TMP = $(CURDIR)/debian/tmp
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

# mirror structure for the destination (package's build tree)
USRLIB = usr/lib/$(DEB_HOST_MULTIARCH)
USRBIN = usr/bin
USRINC = usr/include/$(DEB_HOST_MULTIARCH)/$(package)
MAN1 = usr/share/man/man1
LIC = usr/share/doc/$(package)
DOC = usr/share/doc/$(DEVPKG)

# package build directories
DESTBIN = $(CURDIR)/debian/$(package)/usr/bin
DESTLIB = $(CURDIR)/debian/$(LIBPKG)/usr/lib/$(DEB_HOST_MULTIARCH)
DESTINCDEV = $(CURDIR)/debian/$(DEVPKG)/usr/include/$(DEB_HOST_MULTIARCH)/$(package)
DESTMAN1 = $(CURDIR)/debian/$(package)/usr/share/man/man1

# tss2 package has copyright
DESTLIC = $(CURDIR)/debian/$(package)/$(LIC)

# put doc in dev package instead
DESTDOC = $(CURDIR)/debian/$(DEVPKG)/$(DOC)


%:
	dh $@


override_dh_auto_clean:
	make -C utils -f makefile.debian clean
	# clean up package build dir
	dh_clean


override_dh_auto_build:
	dh_testdir
	dh_auto_build
	# nonstandard variable names are used in place of CFLAGS and LDFLAGS
	# in addition, CPPFLAGS is added to fully support all hardened
	# build flags in the upstream buildsystem.
	CCFLAGS="$(shell dpkg-buildflags --get CFLAGS) " \
	CCFLAGS+="$(shell dpkg-buildflags --get CPPFLAGS)" \
	LNFLAGS="$(shell dpkg-buildflags --get LDFLAGS)" \
	make -C utils -f makefile.debian


override_dh_auto_install:
	mkdir -m 755 -p $(TMP)/$(USRLIB)
	mkdir -m 755 -p $(TMP)/$(USRBIN)
	mkdir -m 755 -p $(TMP)/$(USRINC)
	mkdir -m 755 -p $(TMP)/$(MAN1)
	mkdir -m 755 -p $(TMP)/$(LIC)
	mkdir -m 755 -p $(TMP)/$(DOC)
	mkdir -m 755 -p $(DESTBIN)
	mkdir -m 755 -p $(DESTLIB)
	mkdir -m 755 -p $(DESTINCDEV)
	mkdir -m 755 -p $(DESTMAN1)
	mkdir -m 755 -p $(DESTLIC)
	mkdir -m 755 -p $(DESTDOC)

	# Prefix for namespacing
	# Pick out executables and copy with namespacing
	for f in $(CURDIR)/utils/*; do \
		if [[ -x $$f && -f $$f && ! $$f =~ .*\..* ]]; then \
			cp -p $$f $(TMP)/$(USRBIN)/tss`basename $$f`; \
		fi; \
	done

	# For multiple binary packages, install under debian/tmp first
	cp -auv $(CURDIR)/utils/$(VERSIONED_LIB) $(TMP)/$(USRLIB)/$(VERSIONED_LIB)
	ln -s $(TMP)/$(USRLIB)/$(VERSIONED_LIB) $(TMP)/$(USRLIB)/$(LIBSONAME)
	ln -s $(TMP)/$(USRLIB)/$(LIBSONAME) $(TMP)/$(USRLIB)/$(LIBSYM)

	install -m 644 $(CURDIR)/utils/$(package)/*.h $(TMP)/$(USRINC)
	install -m 644 $(CURDIR)/utils/man/man1/tss*.1 $(TMP)/$(MAN1)

	install -m 644 $(CURDIR)/$(TSSDOC) $(TMP)/$(DOC)/$(TSSDOC)
	install -m 644 $(DEBDIR)/copyright $(TMP)/$(LIC)/copyright


	# dh_install them into diff. pcakges now
	# dh_install look into debian/tmp by default
	cp $(TMP)/$(USRBIN)/* $(DESTBIN)
	cp $(TMP)/$(USRINC)/* $(DESTINCDEV)
	cp -p $(TMP)/$(USRBIN)/* $(DESTBIN)


	# the commands act on the library package
	# with debian/tmp as the package build directory
	# dh_install install files into the package build dir

	dh_install -Pdebian/$(LIBPKG) -p$(LIBPKG) $(USRLIB)/$(VERSIONED_LIB) $(USRLIB)

	dh_link -Pdebian/$(LIBPKG) -p$(LIBPKG) $(USRLIB)/$(VERSIONED_LIB) $(USRLIB)/$(LIBSONAME)
	dh_link -Pdebian/$(DEVPKG) -p$(DEVPKG) $(USRLIB)/$(LIBSONAME) $(USRLIB)/$(LIBSYM)


	cp -p $(TMP)/$(MAN1)/* $(DESTMAN1)
	cp -p $(TMP)/$(LIC)/copyright $(DESTLIC)
	cp -p $(TMP)/$(DOC)/$(TSSDOC) $(DESTDOC)

	# -v option is needed to remove revision number
	dpkg-gensymbols -v$(version) -p$(LIBPKG) -Pdebian/$(LIBPKG) -Odebian/$(LIBPKG).symbols -c4


	dh_makeshlibs -m0 -V "$(LIBPKG) (>= 0.0)"
	dh_shlibdeps -L$(LIBPKG) -l debian/$(LIBPKG)/usr/lib/$(DEB_HOST_MULTIARCH)