File: rules

package info (click to toggle)
cyrus-sasl2 2.1.28%2Bdfsg1-9
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 8,536 kB
  • sloc: ansic: 47,404; sh: 4,949; xml: 1,423; makefile: 735; python: 332
file content (242 lines) | stat: -rwxr-xr-x 8,737 bytes parent folder | download | duplicates (2)
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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
#!/usr/bin/make -f
# -*- makefile -*-
#
# debian/rules for CMU Cyrus SASL version 2.1
#
# Copyright (c) 2011 by Ondřej Surý - migrated to dh7
# Based on previous work (c) 2006 by Fabian Fagerholm.
# Based on previous work by Dima Barsky.
# Based on cyrus-imapd-2.2 packages by Henrique de Moraes Holshuch.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Note that Cyrus SASL itself is published under a different license.

# Enable package hardening through dpkg-buildflags
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk
-include /usr/share/dpkg/buildtools.mk
export CC

ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
# Debian's GSSAPI is known to support SPNEGO.
export ac_cv_gssapi_supports_spnego=yes
endif

# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append LDFLAGS
export DEB_LDFLAGS_MAINT_APPEND = -Wl,-z,defs

# Save Berkeley DB used for building the package
BDB_VERSION ?= $(shell LC_ALL=C dpkg-query -l 'libdb[45].[0-9]-dev' | grep ^ii | sed -e 's|.*\s\libdb\([45]\.[0-9]\)-dev\s.*|\1|')

# SQL support may be turned off during the build, but is on by default.
ifeq (,$(findstring no-sql,$(DEB_BUILD_OPTIONS))$(findstring pkg.cyrus-sasl2.nosql,$(DEB_BUILD_PROFILES)))
	CONFIGURE_SQL=--enable-sql
else
	CONFIGURE_SQL=--disable-sql
	DH_PACKAGE_EXCLUDES += -Nlibsasl2-modules-sql
endif

# LDAP support may be turned off during the build, but is on by default.
ifeq (,$(findstring no-ldap,$(DEB_BUILD_OPTIONS))$(findstring pkg.cyrus-sasl2.noldap,$(DEB_BUILD_PROFILES)))
	CONFIGURE_LDAP=--with-ldap
	CONFIGURE_LDAPDB=--enable-ldapdb
else
	CONFIGURE_LDAP=--without-ldap
	CONFIGURE_LDAPDB=--disable-ldapdb
	DH_PACKAGE_EXCLUDES += -Nlibsasl2-modules-ldap
endif

# GSSAPI support may be turned off during the build, but is on by default
ifeq (,$(findstring no-gssapi,$(DEB_BUILD_OPTIONS))$(findstring pkg.cyrus-sasl2.nogssapi,$(DEB_BUILD_PROFILES)))
	CONFIGURE_GSSAPI=--enable-gssapi
else
	CONFIGURE_GSSAPI=--disable-gssapi
	DH_PACKAGE_EXCLUDES += -Nlibsasl2-modules-gssapi-mit \
		-Nlibsasl2-modules-gssapi-heimdal
endif

CONFIGURE_COMMON_OPTIONS= \
	--build=$(DEB_BUILD_GNU_TYPE) \
	--prefix=/usr \
	--mandir=\$${prefix}/share/man \
	--infodir=\$${prefix}/share/info \
	--enable-static \
	--enable-shared \
	--enable-alwaystrue \
	--enable-checkapop \
	--enable-cram \
	--enable-digest \
	--enable-otp \
	--disable-srp \
	--disable-srp-setpass \
	--disable-krb4 \
	$(CONFIGURE_GSSAPI) \
	--enable-gss_mutexes \
	--enable-auth-sasldb \
	--enable-plain \
	--enable-anon \
	--enable-login \
	--enable-ntlm \
	--disable-passdss \
	$(CONFIGURE_SQL) \
	--with-sqlite3=/usr \
	--with-mysql=/usr \
	--with-pgsql=/usr \
	$(CONFIGURE_LDAPDB) \
	--disable-macos-framework \
	--with-pam=/usr \
	--with-saslauthd=/var/run/saslauthd \
	$(CONFIGURE_LDAP) \
	--with-configdir=/etc/sasl2:/etc/sasl:/usr/lib/$(DEB_HOST_MULTIARCH)/sasl2:/usr/lib/sasl2 \
	--with-plugindir=/usr/lib/$(DEB_HOST_MULTIARCH)/sasl2 \
	--sysconfdir=/etc \
	--with-devrandom=/dev/urandom

# Some convenience variables
export TMPBUILD_MIT := build-mit
export TMPBUILD_HEIMDAL := build-heimdal
export TMP_MIT := debian/tmp
export TMP_HEIMDAL := debian/tmp-heimdal
export MIT_LDFLAGS := $(shell krb5-config.mit --libs gssapi | sed -e 's/ -l.*//')
export MIT_CFLAGS := $(shell krb5-config.mit --cflags gssapi)
export HEIMDAL_LDFLAGS := $(shell krb5-config.heimdal --libs gssapi | sed -e 's/ -l.*//')
export HEIMDAL_CFLAGS := $(shell krb5-config.heimdal --cflags gssapi)

AUTOFILES=acinclude.m4 aclocal.m4 config/config.sub config/config.guess \
		  config/ltmain.sh config/libtool.m4

### The Makefile targets begin. ###

%:
	dh $@ $(DH_PACKAGE_EXCLUDES)

override_dh_auto_clean:
	dh_auto_clean -B$(TMPBUILD_MIT)
	dh_auto_clean -B$(TMPBUILD_HEIMDAL)

	rm -f sample/sample-client \
		sample/sample-server
	[ ! -f Makefile ] || $(MAKE) distclean
	-rm -f config.h config.log autom4ate.cache

	# Remove symlinks that the CMU build sets up but never removes.
	# They can be found by running find . -lname '*' -print in the
	# source tree before and after a build and comparing the differences.
	rm -f lib/sasldb.c lib/db_berkeley.c lib/allockey.c lib/cram.c \
			lib/digestmd5.c lib/otp.c lib/gssapi.c lib/plain.c \
			lib/anonymous.c lib/login.c lib/ntlm.c lib/sql.c lib/ldapdb.c

	# Remove generated man pages
	-rm -f sasl-sample-client.8 sasl-sample-server.8

	# Remove build directories
	rm -rf $(TMP_MIT) $(TMP_HEIMDAL)

override_dh_auto_configure-indep:
	dh_auto_configure -- --with-sphinx-build

override_dh_auto_configure-arch:
	$(file > common/crypto-compat.c,)
	$(file > common/crypto-compat.h,)
	LDFLAGS="$(LDFLAGS) $(HEIMDAL_LDFLAGS)" \
	CFLAGS="$(CFLAGS) $(HEIMDAL_CFLAGS)" \
	dh_auto_configure -B$(TMPBUILD_HEIMDAL) -- $(CONFIGURE_COMMON_OPTIONS) --with-gss_impl=heimdal

	LDFLAGS="$(LDFLAGS) $(MIT_LDFLAGS)" \
	CFLAGS="$(CFLAGS) $(MIT_CFLAGS)" \
	dh_auto_configure -B$(TMPBUILD_MIT) -- $(CONFIGURE_COMMON_OPTIONS) --with-gss_impl=mit

override_dh_auto_build-indep:
	-mkdir docsrc/exts/themes
	-ln -s /usr/share/sphinx_rtd_theme docsrc/exts/themes/cyrus
	dh_auto_build -- doc-html

override_dh_auto_build-arch:
	-mkdir docsrc/exts/themes
	dh_auto_build -B$(TMPBUILD_HEIMDAL) -- sasldir=/usr/lib/$(DEB_HOST_MULTIARCH)/sasl2
	dh_auto_build -B$(TMPBUILD_MIT) -- sasldir=/usr/lib/$(DEB_HOST_MULTIARCH)/sasl2 all

	# Build sample-{client,server}
	$(MAKE) -f debian/sample/Makefile T=$(TMPBUILD_MIT)

	# Build the sasl-sample-client and sasl-sample-server man pages.
	/usr/bin/docbook-to-man debian/sasl-sample-client.sgml \
		> sasl-sample-client.8
	/usr/bin/docbook-to-man debian/sasl-sample-server.sgml \
		> sasl-sample-server.8

override_dh_auto_install-indep:

override_dh_auto_install-arch:
	dh_auto_install -B$(TMPBUILD_HEIMDAL) --destdir=$(TMP_HEIMDAL) -- sasldir=/usr/lib/$(DEB_HOST_MULTIARCH)/sasl2
	dh_auto_install -B$(TMPBUILD_MIT) --destdir=$(TMP_MIT) -- sasldir=/usr/lib/$(DEB_HOST_MULTIARCH)/sasl2

	# Remove static plugins - they are useless
	rm $(TMP_MIT)/usr/lib/$(DEB_HOST_MULTIARCH)/sasl2/*.a
	# Remove libtool la files, they are eeevil
	rm $(TMP_MIT)/usr/lib/$(DEB_HOST_MULTIARCH)/*.la \
	   $(TMP_MIT)/usr/lib/$(DEB_HOST_MULTIARCH)/sasl2/*.la

	# Note the version of Berkeley DB used to build this package
	mkdir -p $(TMP_MIT)/usr/lib/sasl2
	echo $(BDB_VERSION) > $(TMP_MIT)/usr/lib/sasl2/berkeley_db.txt

	# Alter the default location and names of files to fit Debian
	# policy and better integrate with the Debian system.
	mv $(TMP_MIT)/usr/sbin/pluginviewer $(TMP_MIT)/usr/sbin/saslpluginviewer
	mv $(TMP_MIT)/usr/share/man/man8/pluginviewer.8 \
		$(TMP_MIT)/usr/share/man/man8/saslpluginviewer.8
	install -m 644 saslauthd/saslauthd.mdoc \
		$(TMP_MIT)/usr/share/man/man8/saslauthd.8
	mv $(TMP_MIT)/usr/sbin/dbconverter-2 $(TMP_MIT)/usr/sbin/sasldbconverter2

	# Install sample-{client,server} with Debianized names
	install -m 755 -D sample/sample-client \
		$(TMP_MIT)/usr/bin/sasl-sample-client
	install -m 755 -D sample/sample-server \
		$(TMP_MIT)/usr/sbin/sasl-sample-server

	# Alter the rpath of certain binaries and shared libraries.
	chrpath -d $(TMP_MIT)/usr/sbin/sasldblistusers2 \
		$(TMP_MIT)/usr/sbin/saslpasswd2
ifeq (,$(findstring no-gssapi,$(DEB_BUILD_OPTIONS))$(findstring pkg.cyrus-sasl2.nogssapi,$(DEB_BUILD_PROFILES)))
	chrpath -d $(TMP_HEIMDAL)/usr/lib/$(DEB_HOST_MULTIARCH)/sasl2/libgs2.so.*.*.*
	chrpath -d $(TMP_HEIMDAL)/usr/lib/$(DEB_HOST_MULTIARCH)/sasl2/libgssapiv2.so.*.*.*
endif
ifeq (,$(findstring no-sql,$(DEB_BUILD_OPTIONS))$(findstring pkg.cyrus-sasl2.nosql,$(DEB_BUILD_PROFILES)))
	chrpath -d $(TMP_MIT)/usr/lib/$(DEB_HOST_MULTIARCH)/sasl2/libsql.so.*.*.*
endif

	# Install the sasl-sample-client and -server man pages.
	dh_installman -psasl2-bin sasl-sample-client.8 sasl-sample-server.8

override_dh_install:
	dh_install -Nlibsasl2-modules-gssapi-heimdal --sourcedir=$(TMP_MIT)
	dh_install -plibsasl2-modules-gssapi-heimdal --sourcedir=$(TMP_HEIMDAL)

override_dh_missing:
	dh_missing --fail-missing

override_dh_installinit:
	dh_installinit --no-enable $(DH_PACKAGE_EXCLUDES) --name=saslauthd

execute_after_dh_installsystemd:
	dh_installsystemd --no-enable $(DH_PACKAGE_EXCLUDES) --name=saslauthd

override_dh_installchangelogs:
	dh_installchangelogs -XChangeLog

override_dh_makeshlibs:
	dh_makeshlibs -X/usr/lib/$(DEB_HOST_MULTIARCH)/sasl2 $(DH_PACKAGE_EXCLUDES)

override_dh_auto_test-indep:

override_dh_auto_test-arch:
	cd $(TMPBUILD_MIT)/saslauthd && $(MAKE) testsaslauthd
	cd $(TMPBUILD_MIT)/utils && $(MAKE) testsuite