File: rules

package info (click to toggle)
nspr 2%3A4.29-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 6,868 kB
  • sloc: ansic: 111,012; sh: 3,711; cpp: 3,246; makefile: 2,782; asm: 723; perl: 405; python: 162
file content (95 lines) | stat: -rwxr-xr-x 3,301 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
#!/usr/bin/make -f

include debian/make.mk
# Use dpkg-buildflags to get hardening flags, and exclude non-hardening flags
dpkg_buildflags = $(and $(1),$(shell DEB_CFLAGS_MAINT_STRIP="$(shell DEB_BUILD_MAINT_OPTIONS=hardening=-all dpkg-buildflags --get $(1))" dpkg-buildflags --get $(1)))
$(call lazy,CFLAGS,$$(call dpkg_buildflags,CFLAGS))
$(call lazy,CPPFLAGS,$$(call dpkg_buildflags,CPPFLAGS))
$(call lazy,LDFLAGS,$$(call dpkg_buildflags,LDFLAGS))

CFLAGS += -Wall -pipe
LDFLAGS += -Wl,--as-needed

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CONFIGURE_FLAGS := --disable-optimize
else
	CONFIGURE_FLAGS := --enable-optimize
endif

ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
	CONFIGURE_FLAGS += --enable-debug
else
	CONFIGURE_FLAGS += --disable-debug --enable-debug-symbols
endif

ifeq (64,$(shell dpkg-architecture -qDEB_HOST_ARCH_BITS))
	CONFIGURE_FLAGS += --enable-64bit
endif
ifeq (x32,$(shell dpkg-architecture -qDEB_HOST_ARCH))
	CONFIGURE_FLAGS += --enable-x32
endif

$(call lazy,DEB_HOST_MULTIARCH,$$(shell dpkg-architecture -qDEB_HOST_MULTIARCH))
$(call lazy,BUILD_DATE,$$(shell dpkg-parsechangelog -S Date))

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

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

%:
	dh $@ --sourcedirectory=nspr

override_dh_auto_configure: $(PREPROCESS_FILES:.in=)
	for file in config.guess config.sub; do \
		sed -i '2!b;/^#/ i\exec "/usr/share/misc/'$$file'" "$$@"' nspr/build/autoconf/$$file; \
	done

	cd nspr && \
	CFLAGS="$(CFLAGS)" \
	CPPFLAGS="$(CPPFLAGS)" \
	LDFLAGS="$(LDFLAGS)" \
	./configure --target=$(DEB_HOST_GNU_TYPE) --host=$(DEB_BUILD_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
                    $(CONFIGURE_FLAGS) \
		    --prefix=/usr \
		    --libdir=/usr/lib/$(DEB_HOST_MULTIARCH)

override_dh_auto_build:
	$(MAKE) -C nspr \
		SH_NOW="$(shell TZ=UTC date -d "$(BUILD_DATE)" +%s)000000" \
		SH_DATE="$(shell TZ=UTC date -d "$(BUILD_DATE)" "+%Y-%m-%d %T")"

override_dh_auto_clean:
	[ ! -f nspr/pr/tests/Makefile ] || $(MAKE) -C nspr/pr/tests clean
	[ ! -f nspr/lib/tests/Makefile ] || $(MAKE) -C nspr/lib/tests clean
	dh_auto_clean

	rm -f $(PREPROCESS_FILES:.in=)
	for file in config.guess config.sub; do \
		sed -i '2!b;/^exec "/ d' nspr/build/autoconf/$$file; \
	done

override_dh_strip:
	dh_strip --dbgsym-migration='libnspr4-dbg (<< 2:4.9-2~)'

override_dh_makeshlibs:
	dh_makeshlibs -a -- -c4

override_dh_auto_test:
ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
	$(MAKE) -C nspr/pr/tests
	$(MAKE) -C nspr/lib/tests
	# Skip gethost because it needs DNS, and thus networking.
	# Skip fdcach, peek and vercheck because they fail.
	# Skip socket because it freezes.
	# Skip getproto because it fails on some buildds.
	# Skip nblayer because it freezes on armel.
	cd nspr/pr/tests && grep -v '^\(fdcach\|gethost\|getproto\|nblayer\|peek\|socket\|vercheck\)$$' ./runtests.sh | sh - $(CURDIR)/nspr/dist
	cd nspr/lib/tests && LD_LIBRARY_PATH=$(CURDIR)/nspr/dist/bin$(addprefix :,$(LD_LIBRARY_PATH)) ./base64t
	cd nspr/lib/tests && LD_LIBRARY_PATH=$(CURDIR)/nspr/dist/bin$(addprefix :,$(LD_LIBRARY_PATH)) ./string
endif

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