File: rules

package info (click to toggle)
nss 2:3.45-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 168,000 kB
  • sloc: ansic: 538,157; cpp: 70,615; asm: 48,901; sh: 19,384; python: 5,774; xml: 4,801; makefile: 2,276; perl: 1,856; lex: 306; yacc: 79; sed: 15; csh: 10
file content (195 lines) | stat: -rwxr-xr-x 6,305 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
#!/usr/bin/make -f
include debian/make.mk

$(call lazy,DEB_BUILD_ARCH,$$(shell dpkg-architecture -qDEB_BUILD_ARCH))
$(call lazy,DEB_BUILD_GNU_TYPE,$$(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE))
$(call lazy,DEB_HOST_ARCH,$$(shell dpkg-architecture -qDEB_HOST_ARCH))
$(call lazy,DEB_HOST_ARCH_OS,$$(shell dpkg-architecture -qDEB_HOST_ARCH_OS))
$(call lazy,DEB_HOST_GNU_TYPE,$$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE))
$(call lazy,DEB_HOST_GNU_CPU,$$(shell dpkg-architecture -qDEB_HOST_GNU_CPU))
$(call lazy,DEB_HOST_MULTIARCH,$$(shell dpkg-architecture -qDEB_HOST_MULTIARCH))
$(call lazy,CFLAGS,$$(shell dpkg-buildflags --get CFLAGS))
$(call lazy,CPPFLAGS,$$(shell dpkg-buildflags --get CPPFLAGS))
$(call lazy,LDFLAGS,$$(shell dpkg-buildflags --get LDFLAGS))

PREPROCESS_FILES := $(wildcard debian/*.in)

$(PREPROCESS_FILES:.in=): %: %.in
	sed 's,/@DEB_HOST_MULTIARCH@,$(DEB_HOST_MULTIARCH:%=/%),g;$(EXTRA_REPLACES)' $< > $@

UPSTREAM_VERSION := $(shell dpkg-parsechangelog | sed -n 's/^Version: *\([0-9]*:\)\?\([0-9.]*+really\)\?\([^~]*\)\(~.*\)\?-.*$$/\3/ p')
MOD_MAJOR_VERSION := $(word 1, $(subst ., ,$(UPSTREAM_VERSION)))
MOD_MINOR_VERSION := $(word 2, $(subst ., ,$(UPSTREAM_VERSION)))
MOD_PATCH_VERSION := $(or $(word 3, $(subst ., ,$(UPSTREAM_VERSION))),0)

debian/nss.pc: EXTRA_REPLACES := s/@VERSION@/$(UPSTREAM_VERSION)/
debian/nss-config: EXTRA_REPLACES := s/@MOD_MAJOR_VERSION@/$(MOD_MAJOR_VERSION)/;s/@MOD_MINOR_VERSION@/$(MOD_MINOR_VERSION)/;s/@MOD_PATCH_VERSION@/$(MOD_PATCH_VERSION)/
debian/libnss3.lintian-overrides: EXTRA_REPLACES := s,/@DEB_HOST_MULTIARCH_WC@,$(DEB_HOST_MULTIARCH:%=/*),g

TOOLCHAIN :=

ifneq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH))
ifeq ($(origin CC),default)
TOOLCHAIN += CC=$(DEB_HOST_GNU_TYPE)-gcc
endif
ifeq ($(origin CXX),default)
CXX := $(DEB_HOST_GNU_TYPE)-g++
TOOLCHAIN += CXX=$(CXX)
endif
TOOLCHAIN += CCC=$(CXX)
ifeq ($(origin RANLIB),default)
TOOLCHAIN += RANLIB=$(DEB_HOST_GNU_TYPE)-ranlib
endif
TOOLCHAIN += OS_TEST=$(DEB_HOST_GNU_CPU)
TOOLCHAIN += KERNEL=$(DEB_HOST_ARCH_OS)
endif

# $(foreach foo,$(list),$(call cmd,some command $(foo))) expands to
#    some command first-elem
#    some command second-elem
#    etc.
# This avoid using a long one liner with semi colons.
define cmd
$(1)

endef

CFLAGS += -Wall -pipe

DISTDIR := $(CURDIR)/dist

COMMON_MAKE_FLAGS := \
	SOURCE_PREFIX=$(DISTDIR) \
	SOURCE_MD_DIR=$(DISTDIR) \
	DIST=$(DISTDIR) \
	OBJDIR_NAME=OBJS \
	$(and $(filter 64,$(shell dpkg-architecture -qDEB_HOST_ARCH_BITS)),USE_64=1) \
	$(and $(filter x32,$(shell dpkg-architecture -qDEB_HOST_ARCH)),USE_X32=1) \
	$(NULL)

NSS_TOOLS := \
	certutil \
	chktest \
	cmsutil \
	crlutil \
	derdump \
	httpserv \
	modutil \
	ocspclnt \
	p7content \
	p7env \
	p7sign \
	p7verify \
	pk12util \
	pk1sign \
	pwdecrypt \
	rsaperf \
	selfserv \
	shlibsign \
	signtool \
	signver \
	ssltap \
	strsclnt \
	symkeyutil \
	tstclnt \
	vfychain \
	vfyserv \
	$(NULL)

override_dh_auto_build:
	$(MAKE) -C nss/coreconf/nsinstall \
		$(COMMON_MAKE_FLAGS) \
		CC=$(DEB_BUILD_GNU_TYPE)-gcc \
		ARCHFLAG=

	$(MAKE) -C nss \
		all \
		$(COMMON_MAKE_FLAGS) \
		MOZILLA_CLIENT=1 \
		NSPR_INCLUDE_DIR=/usr/include/nspr \
		NSPR_LIB_DIR=/usr/lib/$(DEB_HOST_MULTIARCH) \
		BUILD_OPT=1 \
		NS_USE_GCC=1 \
		OPTIMIZER="$(CFLAGS) $(CPPFLAGS)" \
		LDFLAGS='$(LDFLAGS) $$(ARCHFLAG) $$(ZDEFS_FLAG)' \
		DSO_LDOPTS='-shared $$(LDFLAGS)' \
		NSS_USE_SYSTEM_SQLITE=1 \
		NSS_ENABLE_ECC=1 \
		CHECKLOC= \
		$(TOOLCHAIN)

override_dh_auto_clean:
	-$(MAKE) -C nss \
		clobber \
		$(COMMON_MAKE_FLAGS) \
		BUILD_OPT=1

	rm -rf $(DISTDIR) $(PREPROCESS_FILES:.in=)

manpage = $(addsuffix .1,$(addprefix nss/doc/nroff/,$(1)))

override_dh_auto_install: $(PREPROCESS_FILES:.in=)
	install -m 755 -d debian/libnss3/usr/lib/$(DEB_HOST_MULTIARCH)/nss debian/libnss3-dev/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig
	install -m 644 -t debian/libnss3/usr/lib/$(DEB_HOST_MULTIARCH) \
		$(DISTDIR)/lib/libnss3.so \
		$(DISTDIR)/lib/libnssutil3.so \
		$(DISTDIR)/lib/libsmime3.so \
		$(DISTDIR)/lib/libssl3.so
	install -m 644 -t debian/libnss3/usr/lib/$(DEB_HOST_MULTIARCH)/nss \
		$(DISTDIR)/lib/libfreebl3.so \
		$(DISTDIR)/lib/libfreeblpriv3.so \
		$(DISTDIR)/lib/libsoftokn3.so \
		$(DISTDIR)/lib/libnssdbm3.so \
		$(DISTDIR)/lib/libnssckbi.so

	install -m 644 -t debian/libnss3-dev/usr/include/nss \
		$(DISTDIR)/public/nss/*
	install -m 644 -t debian/libnss3-dev/usr/lib/$(DEB_HOST_MULTIARCH) \
		$(DISTDIR)/lib/libcrmf.a
	install -m 644 -t debian/libnss3-dev/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig debian/nss.pc
	install -m 755 -t debian/libnss3-dev/usr/bin debian/nss-config

	install -m 755 -t debian/libnss3-tools/usr/bin $(addprefix $(DISTDIR)/bin/,$(NSS_TOOLS))
	install -m 755 -d $(DISTDIR)/man
	install -m 644 -t $(DISTDIR)/man $(wildcard $(call manpage,$(NSS_TOOLS)))

	# these utilities are too generically-named, so we prefix them with nss- (see http://bugs.debian.org/701141)
	$(foreach bin, \
		addbuiltin \
		dbtest \
		pp \
		, \
		$(call cmd,install -m 755 -T $(DISTDIR)/bin/$(bin) debian/libnss3-tools/usr/bin/nss-$(bin)) \
		$(if $(wildcard $(call manpage,$(bin))),$(call cmd,install -m 644 -T $(call manpage,$(bin)) $(DISTDIR)/man/nss-$(bin).1)))

ifeq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH))
SHLIBSIGN = LD_LIBRARY_PATH=debian/libnss3/usr/lib/$(DEB_HOST_MULTIARCH) debian/libnss3-tools/usr/bin/shlibsign
else
SHLIBSIGN = shlibsign
endif

override_dh_strip:
	dh_strip --dbgsym-migration='libnss3-dbg (<< 2:3.37-1~)'
	$(foreach lib,libsoftokn3.so libfreebl3.so libfreeblpriv3.so libnssdbm3.so, \
		$(call cmd,umask 022; $(SHLIBSIGN) -v -i debian/libnss3/usr/lib/$(DEB_HOST_MULTIARCH)/nss/$(lib)))

ifeq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH))
	# Check FIPS mode correctly works
	mkdir debian/tmp
	LD_LIBRARY_PATH=debian/libnss3/usr/lib/$(DEB_HOST_MULTIARCH):debian/libnss3/usr/lib/$(DEB_HOST_MULTIARCH)/nss debian/libnss3-tools/usr/bin/modutil -create -dbdir debian/tmp < /dev/null
	LD_LIBRARY_PATH=debian/libnss3/usr/lib/$(DEB_HOST_MULTIARCH):debian/libnss3/usr/lib/$(DEB_HOST_MULTIARCH)/nss debian/libnss3-tools/usr/bin/modutil -fips true -dbdir debian/tmp < /dev/null
endif

override_dh_makeshlibs:
	dh_makeshlibs -a -- -c4

ifneq (,$(DEB_HOST_MULTIARCH))
override_dh_gencontrol:
	dh_gencontrol -- -Vmisc:Multi-Arch=same
endif

override_dh_builddeb:
	dh_builddeb -- -Zxz

%:
	dh $@