Debian Codegraph @

debian/rules

raw
1 #!/usr/bin/make -f
2 # debian/rules file - for GnuPG
3 # Copyright 1994,1995 by Ian Jackson.
4 # Copyright 1998-2003 by James Troup.
5 # Copyright 2003-2004 by Matthias Urlichs.
6 #
7 # I hereby give you perpetual unlimited permission to copy,
8 # modify and relicense this file, provided that you do not remove
9 # my name from the file itself. (I assert my moral right of
10 # paternity under the Copyright, Designs and Patents Act 1988.)
11 # This file may have to be extensively modified
12
13 include /usr/share/dpkg/architecture.mk
14
15 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
16
17 # avoid -pie for gpgv-static on kfreebsd-amd64, and x32
18 # platforms, which cannot support it by default:
19 ifeq (,$(filter $(DEB_HOST_ARCH), kfreebsd-amd64 x32))
20 GPGV_STATIC_HARDENING = "-pie"
21 else
22 GPGV_STATIC_HARDENING = ""
23 endif
24
25 # Avoid parallel tests on hppa and riscv64 architecture.
26 # Parallel tests generates high load on machine which causes timeouts and thus
27 # triggers unexpected failures.
28 ifeq (,$(filter $(DEB_HOST_ARCH), hppa riscv64))
29 # And also, avoid parallel tests due to swtpm failures (see https://dev.gnupg.org/T7494)
30 AUTOTEST_FLAGS = "--no-parallel"
31 else
32 AUTOTEST_FLAGS = "--no-parallel"
33 endif
34
35 ifneq ($(filter nodoc,$(DEB_BUILD_PROFILES)),)
36 NODOC = --disable-doc
37 endif
38
39 %:
40 dh $@ --with=autoreconf --builddirectory=build
41
42 GPGV_UNNEEDED = gpgtar gpgsm scdaemon dirmngr tofu exec ldap gnutls sqlite libdns keyboxd tpm2d npth
43 GPGV_UDEB_UNNEEDED = $(GPGV_UNNEEDED) bzip2 doc
44
45 WIN32_FLAGS=LDFLAGS="-Xlinker --no-insert-timestamp -static" CFLAGS="-g -Os" CPPFLAGS=
46
47 ifeq ($(filter pkg.gnupg2.gpgvonly,$(DEB_BUILD_PROFILES)),)
48
49 execute_after_dh_auto_configure:
50 dh_auto_configure --builddirectory=build --verbose -- \
51 --libexecdir=\$${prefix}/lib/gnupg \
52 --enable-wks-tools \
53 --enable-all-tests \
54 --with-agent-s2k-calibration=300 \
55 --enable-large-secmem \
56 --with-mailprog=/usr/sbin/sendmail \
57 --enable-maintainer-mode \
58 $(NODOC)
59 # win32 uses hand-written *FLAGS
60 # mkdefsinc is built with *_FOR_BUILD
61 # gpgscm is also not shipped
62 @echo 'blhc: ignore-line-regexp: .*i686-w64-mingw32-gcc .*'
63 @echo 'blhc: ignore-line-regexp: .*-o mkdefsinc .*'
64 @echo 'blhc: ignore-line-regexp: .*-o gpgscm .*'
65
66 override_dh_auto_configure-arch:
67 dh_auto_configure --builddirectory=build-gpgv-udeb -- \
68 $(NODOC) \
69 $(foreach x, $(GPGV_UDEB_UNNEEDED), --disable-$(x))
70
71 override_dh_auto_configure-indep:
72 # nothing to do
73
74 execute_after_dh_auto_build:
75 dh_auto_build --builddirectory=build
76
77 override_dh_auto_build-arch:
78 dh_auto_build --builddirectory=build-gpgv-udeb
79 cp -a build-gpgv-udeb build-gpgv-static
80 rm -f build-gpgv-static/g10/gpgv
81 cd build-gpgv-static/g10 && $(MAKE) LDFLAGS="$$LDFLAGS $(GPGV_STATIC_HARDENING) -static" gpgv
82 mv build-gpgv-static/g10/gpgv build-gpgv-static/g10/gpgv-static
83
84 override_dh_auto_build-indep:
85 mkdir -p build-gpgv-win32
86 cd build-gpgv-win32 && $(WIN32_FLAGS) ../configure \
87 $(foreach x, $(GPGV_UDEB_UNNEEDED), --disable-$(x)) \
88 $(foreach x, libgpg-error libgcrypt libassuan ksba, --with-$x-prefix=/usr/i686-w64-mingw32) \
89 $(NODOC) \
90 --enable-gpg2-is-gpg \
91 --with-zlib=/usr/i686-w64-mingw \
92 --prefix=/usr/i686-w64-mingw32 \
93 --host i686-w64-mingw32
94 cd build-gpgv-win32/common && $(WIN32_FLAGS) $(MAKE) status-codes.h audit-events.h
95 cd build-gpgv-win32/common && $(WIN32_FLAGS) $(MAKE) libgpgrl.a
96 cd build-gpgv-win32/common && $(WIN32_FLAGS) $(MAKE) libsimple-pwquery.a
97 cd build-gpgv-win32/common && $(WIN32_FLAGS) $(MAKE) libcommon.a
98 cd build-gpgv-win32/kbx && $(WIN32_FLAGS) $(MAKE) libkeybox.a
99 cd build-gpgv-win32/regexp && $(WIN32_FLAGS) $(MAKE) _unicode_mapping.c
100 cd build-gpgv-win32/regexp && $(WIN32_FLAGS) $(MAKE) libregexp.a
101 cd build-gpgv-win32/g10 && $(WIN32_FLAGS) $(MAKE) gpgv.exe
102 strip build-gpgv-win32/g10/gpgv.exe
103
104 execute_after_dh_installdocs:
105 # These are already shipped in the respective packages
106 rm -vf \
107 debian/gnupg/usr/share/doc/gnupg/examples/systemd-user/*.service \
108 debian/gnupg/usr/share/doc/gnupg/examples/systemd-user/*.socket
109
110 override_dh_auto_test:
111 dh_auto_test --builddirectory=build -- verbose=3 TESTFLAGS=$(AUTOTEST_FLAGS)
112
113 override_dh_shlibdeps:
114 # Make ldap a recommends rather than a hard dependency.
115 dpkg-shlibdeps -Tdebian/dirmngr.substvars -dRecommends debian/dirmngr/usr/lib/gnupg/dirmngr_ldap -dDepends debian/dirmngr/usr/bin/dirmngr*
116 dh_shlibdeps -Ndirmngr
117
118 else # ifeq ($(filter pkg.gnupg2.gpgvonly,$(DEB_BUILD_PROFILES)),)
119 override_dh_auto_configure:
120 dh_auto_configure --builddirectory=build --verbose -- \
121 --libexecdir=\$${prefix}/lib/gnupg \
122 --enable-maintainer-mode \
123 $(NODOC) \
124 $(foreach x, $(GPGV_UNNEEDED), --disable-$(x))
125
126 override_dh_auto_test:
127 # stripped down build fails on make check
128
129 endif # ifeq ($(filter pkg.gnupg2.gpgvonly,$(DEB_BUILD_PROFILES)),
130
131
132 execute_before_dh_autoreconf:
133 echo "Developer change history can be found in the source tarball. See NEWS for high-level changes." > ChangeLog
134
135 # visualizations of package dependencies:
136 debian/%.png: debian/%.dot
137 dot -T png -o $@ $<