dpkg: Check for < 0 instead of == -1 for conffderef() return values
[dpkg.git] / debian / rules
blob97dbc242ca244f8d3964b511df09895d563dbbcd
1 #!/usr/bin/make -f
2 # debian/rules for the dpkg suite.
3 # Copyright © 2004 Scott James Remnant <scott@netsplit.com>
4 # Copyright © 2006-2012 Guillem Jover <guillem@debian.org>
6 WFLAGS := \
7 -Wall -Wextra \
8 -Wno-missing-field-initializers \
9 -Wno-nonnull-compare \
10 -Wno-unused-parameter \
11 # EOL
13 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
14 export DEB_CFLAGS_MAINT_APPEND = $(WFLAGS)
15 export DEB_CXXFLAGS_MAINT_APPEND = $(WFLAGS)
17 # Use the in-tree dpkg-buildflags
18 dpkg_buildflags = \
19 DEB_BUILD_MAINT_OPTIONS="$(DEB_BUILD_MAINT_OPTIONS)" \
20 DEB_CFLAGS_MAINT_APPEND="$(WFLAGS)" \
21 DEB_CXXFLAGS_MAINT_APPEND="$(WFLAGS)" \
22 $(CURDIR)/build-aux/run-script scripts/dpkg-buildflags.pl
24 # Do not enable everything on all platforms.
25 ifeq ($(DEB_HOST_ARCH_OS),linux)
26 confflags += --with-libselinux
27 endif
28 ifeq (,$(filter terse,$(DEB_BUILD_OPTIONS)))
29 testflags += TEST_VERBOSE=1
30 endif
32 # Enable parallel test suite
33 NUMJOBS = 1
34 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
35 NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
36 testflags += TEST_PARALLEL=$(NUMJOBS)
37 endif
39 dpkg_vendor = \
40 $(CURDIR)/build-aux/run-script scripts/dpkg-vendor.pl
42 DEB_VENDOR = $(shell $(call dpkg_vendor) --query Vendor)
44 D := $(CURDIR)/debian/tmp
47 dh $@ --builddirectory=build-tree
49 override_dh_auto_configure:
50 dh_auto_configure -- \
51 $(confflags) \
52 $(shell $(dpkg_buildflags) --export=configure) \
53 --libexecdir=\$${exec_prefix}/lib \
54 --with-devlibdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \
55 --with-libz \
56 --with-liblzma \
57 --with-libzstd \
58 --with-libbz2 \
59 # EOL
61 execute_after_dh_auto_install:
62 # Special-case the lintian profile, as dh cannot rename on install.
63 mkdir -p $(D)/usr/share/lintian/profiles/dpkg
64 cp debian/dpkg.lintian-profile \
65 $(D)/usr/share/lintian/profiles/dpkg/main.profile
67 override_dh_auto_test:
68 dh_auto_test -- $(testflags)
70 override_dh_installsystemd:
71 dh_installsystemd -a --name=dpkg-db-backup \
72 --no-start --no-stop-on-upgrade
74 execute_after_dh_installlogrotate:
75 dh_installlogrotate --name=alternatives
77 override_dh_installdocs:
78 dh_installdocs -Ndpkg-dev
79 dh_installdocs -pdpkg-dev --doc-main-package=dpkg
81 override_dh_installchangelogs:
82 dh_installchangelogs --no-trim
84 override_dh_bugfiles:
85 dh_bugfiles -A
87 override_dh_compress:
88 dh_compress -Xspec/
90 ifeq (,$(filter $(DEB_VENDOR),Debian Ubuntu))
91 execute_after_dh_install:
92 dh_install -pdpkg usr/sbin/dpkg-fsys-usrunmess
94 # XXX: We cannot use -X, see debhelper #756366.
95 execute_after_dh_installman:
96 dh_installman -pdpkg $(wildcard \
97 $(D)/usr/share/man/*/dpkg-fsys-usrunmess.8 \
98 $(D)/usr/share/man/*/*/dpkg-fsys-usrunmess.8 \
101 # XXX: We cannot pass pathnames to dh_installman w/o $(D), and then dh_missing
102 # complains that the pathnames do not match, so ignore them.
103 override_dh_missing:
104 dh_missing -Xdpkg-fsys-usrunmess.8
105 else
106 override_dh_missing:
107 dh_missing -Xdpkg-fsys-usrunmess
108 endif