Debian Codegraph @

debian/rules

raw symbols SCIP
1 #!/usr/bin/make -f
2
3 export DEB_CFLAGS_MAINT_APPEND := -Wall -D_GNU_SOURCE -Wno-unused-const-variable
4 export DEB_BUILD_MAINT_OPTIONS := hardening=+all future=+lfs
5
6 include /usr/share/dpkg/architecture.mk
7 include /usr/share/dpkg/pkg-info.mk
8
9 # Set this variable if you're building packages outside of Debian and don't
10 # want the checks for DFSG-freeness.
11 #DFSG_NONFREE = 1
12
13 # Expose maintainer address to build/mkversion (see debian/patches/set-maintainer-name)
14 export DEB_MAINTAINER ?= $(shell sed -ne 's/^Maintainer:\s\+//p' debian/control)
15
16 # Expose DEB_VERSION to build/version.sh (see debian/patches/debian-version)
17 export DEB_VERSION
18
19 # noslapd: empty (false) or non-empty (true)
20 noslapd := $(filter pkg.openldap.noslapd, ${DEB_BUILD_PROFILES})
21
22 # Workaround for bad glibc behavior when resolving localhost
23 export RESOLV_MULTI = off
24
25 CONFIG = $(shell grep -v "^\#" debian/configure.options)
26 ifeq ($(DEB_HOST_ARCH_OS),hurd)
27 CONFIG += --disable-mdb
28 endif
29 ifneq (${noslapd},)
30 CONFIG += --disable-slapd
31 endif
32 ifneq ($(filter cross,$(DEB_BUILD_PROFILES)),)
33 CONFIG += --with-yielding-select=yes ac_cv_func_memcmp_working=yes
34 endif
35
36 CONTRIB_MODULES = autogroup lastbind passwd passwd/pbkdf2 passwd/sha2 ppm smbk5pwd
37
38 installdir := $(CURDIR)/debian/tmp
39 builddir := $(CURDIR)/debian/build
40 slapddir := $(CURDIR)/debian/slapd/usr/sbin
41
42 # Standard variables used in contrib Makefiles.
43 # We override these in make invocations rather than patch every one.
44 CONTRIB_MAKEVARS := \
45 LDAP_BUILD='$(builddir)' \
46 OPT= \
47 prefix=/usr \
48 ldap_subdir=/ldap \
49 moduledir='$$(libdir)$$(ldap_subdir)'
50
51 DH = dh $@ --builddirectory=$(builddir)
52 .PHONY: build
53 build:
54 $(DH)
55 %:
56 $(DH)
57
58 override_dh_auto_configure:
59 # Check if we include the RFCs, Internet-Drafts, or upstream schemas
60 # with RFC text (which are non DFSG-free). You can set DFSG_NONFREE
61 # to build the packages from the unchanged upstream sources but Debian
62 # can not ship the RFCs in main so this test is here to make sure it
63 # does not get in by accident again. -- Torsten
64 if [ -z "$(DFSG_NONFREE)" ]; then \
65 if [ -e doc/drafts ] || [ -e doc/rfc ]; then exit 1; fi; \
66 if [ -e servers/slapd/schema/core.schema ] \
67 && grep -q 'RFC 4519 definition' servers/slapd/schema/core.schema; \
68 then \
69 exit 1; \
70 fi; \
71 fi
72
73 # Copy our stripped schema versions into where upstream expects them.
74 if [ -z "$(DFSG_NONFREE)" ]; then \
75 cp debian/schema/*.schema debian/schema/*.ldif \
76 servers/slapd/schema/; \
77 fi
78
79 dh_auto_configure -- $(CONFIG)
80
81 override_dh_auto_build-arch:
82 # slapdS.c is generated by libtool without using ${CPPFLAGS}
83 @echo 'blhc: ignore-line-regexp: .*"slapdS\.c".*'
84 # servers/slapd/Makefile.in uses `$(AR) ruv libbackends.a *.o' construct,
85 # and *.o sort is locale-dependent. LC_ALL=C makes the build reproducible.
86 LC_ALL=C \
87 dh_auto_build
88 ifeq (${noslapd},)
89 # passwd/sha2 needs special handling, see #1030716 and LP: #2000817
90 for mod in $(CONTRIB_MODULES); do \
91 if [ "$$mod" = "passwd/sha2" ]; then \
92 EXTRA_OPT="-fno-strict-aliasing"; \
93 else \
94 EXTRA_OPT=""; \
95 fi; \
96 dh_auto_build -Dcontrib/slapd-modules/$$mod -Bcontrib/slapd-modules/$$mod -- $(CONTRIB_MAKEVARS) OPT+=$$EXTRA_OPT || exit $$?; \
97 done
98 endif
99
100 override_dh_auto_test-arch:
101 # Disable certain timing-sensitive tests which can be flaky on buildds (#1010608)
102 rm -f tests/scripts/test063-delta-multiprovider tests/scripts/test069-delta-multiprovider-starttls
103 dh_auto_test
104
105 override_dh_auto_install-arch:
106 # systemdsystemunitdir: we ship our own systemd unit
107 dh_auto_install -- STRIP_OPTS= systemdsystemunitdir=
108 ifeq (${noslapd},)
109 for mod in $(CONTRIB_MODULES); do \
110 dh_auto_install -Dcontrib/slapd-modules/$$mod -Bcontrib/slapd-modules/$$mod -- $(CONTRIB_MAKEVARS) || exit $$?; \
111 done
112
113 # Empty the dependency_libs file in the .la files.
114 for F in $(installdir)/usr/lib/ldap/*.la; do \
115 sed -i "s/^dependency_libs=.*/dependency_libs=''/" $$F; \
116 done
117 endif
118
119 # Check all built libraries for unresolved symbols except for the
120 # libslapi library. It is a special case since the SLAPI interface
121 # depends on symbols defined in slapd itself. Those symbols will
122 # remain unresolved until the plugin is loaded into slapd.
123 for F in $(installdir)/usr/lib/$(DEB_HOST_MULTIARCH)/*.so.*.*.*; do \
124 if echo "$$F" | grep -q libslapi ; then \
125 continue; \
126 fi; \
127 if LD_LIBRARY_PATH=$(installdir)/usr/lib/$(DEB_HOST_MULTIARCH) ldd -d -r $$F 2>&1 | grep '^undefined symbol:'; then \
128 echo; \
129 echo "library $$F has undefined references. Please fix this before continuing."; \
130 exit 1; \
131 fi; \
132 done
133
134 # Upstream manpages are section 8C but installed as section 8
135 find $(installdir)/usr/share/man -name \*.8 \
136 | xargs perl -pi -e 's#(\.TH \w+ 8)C#$$1#'
137
138 # for indep, we only need the ldap.conf.5 manpage
139 override_dh_auto_build-indep:
140 $(MAKE) -C ${builddir}/doc/man/man5
141 override_dh_auto_test-indep:
142 override_dh_auto_install-indep:
143 install -Dm0644 ${builddir}/doc/man/man5/ldap.conf.5.tmp \
144 ${installdir}/usr/share/man/man5/ldap.conf.5
145
146 override_dh_installinit:
147 dh_installinit --no-restart-after-upgrade --error-handler=ignore_init_failure -- "defaults 19 80"
148
149 override_dh_strip:
150 dh_strip
151 ifeq (${noslapd},)
152 # hardlink these so not confined by apparmor; do this here and not
153 # in dh_link so that dh_strip doesn't get confused and put the wrong
154 # binary in the debug package.
155 for f in slapacl slapadd slapauth slapcat slapdn slapindex slapmodify slappasswd slapschema slaptest; do \
156 ln -f $(slapddir)/slapd $(slapddir)/$$f ; \
157 done
158 endif
159
160 override_dh_makeshlibs:
161 ifeq (${noslapd},)
162 echo "slapd:Provides=$$(objdump -p debian/slapd/usr/lib/$(DEB_HOST_MULTIARCH)/libslapi-*.so.* \
163 | sed -ne '/SONAME/ { s/[[:space:]]*SONAME[[:space:]]*//; \
164 s/\.so\./-/; p; q }' \
165 )" >> debian/slapd.substvars
166 dh_makeshlibs -pslapd -X/usr/lib/ldap/ -V "$$(sed -ne's/slapd:Provides=//p' debian/slapd.substvars)"
167 endif
168 dh_makeshlibs --remaining-packages
169
170 override_dh_installdeb:
171 dh_installdeb
172 ifeq (${noslapd},)
173 perl -w debian/dh_installscripts-common -p slapd
174 endif
175
176 override_dh_auto_clean:
177 dh_auto_clean
178 # Update translation templates for debconf
179 debconf-updatepo
180 ifeq (${noslapd},)
181 # Remove our stripped schema from the upstream source area.
182 if [ -z "$(DFSG_NONFREE)" ]; then \
183 set -e; for s in debian/schema/*.schema debian/schema/*.ldif; do \
184 rm -f servers/slapd/schema/`basename $$s`; \
185 done; \
186 fi
187
188 # Clean the contrib directory
189 for mod in $(CONTRIB_MODULES); do \
190 dh_auto_clean -Dcontrib/slapd-modules/$$mod -Bcontrib/slapd-modules/$$mod || exit $$?; \
191 done
192 endif