File: rules

package info (click to toggle)
cyrus-sasl2 2.1.27~101-g0780600+dfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 10,576 kB
  • sloc: ansic: 60,537; xml: 2,322; java: 1,614; sh: 1,345; makefile: 719; perl: 241; python: 223
file content (244 lines) | stat: -rwxr-xr-x 8,967 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
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
243
244
#!/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.

# Debhelper control.
export DH_ALWAYS_EXCLUDE=CVS
#export DH_VERBOSE=1 # uncomment this to turn on verbose mode

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

# see FEATURE AREAS in dpkg-buildflags(1)
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
# package maintainers to append LDFLAGS
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed -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)))
	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)))
	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)))
	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:/usr/lib/sasl2 \
	--sysconfdir=/etc \
	--with-devrandom=/dev/urandom

# Some convenience variables
export TMPBUILD_MIT := $(CURDIR)/build-mit
export TMPBUILD_HEIMDAL := $(CURDIR)/build-heimdal
export MIT_LDFLAGS := $(shell krb5-config.mit --libs gssapi | sed -e 's/ -l.*//')
export MIT_CPPFLAGS := $(shell krb5-config.mit --cflags gssapi)
export HEIMDAL_LDFLAGS := $(shell krb5-config.heimdal --libs gssapi | sed -e 's/ -l.*//')
export HEIMDAL_CPPFLAGS := $(shell krb5-config.heimdal --cflags gssapi)

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

TMPBUILD=$(CURDIR)/build

### The Makefile targets begin. ###

%:
	dh $@ --with=quilt --with=autotools_dev --with=autoreconf $(DH_PACKAGE_EXCLUDES)

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

	rm -f $(CURDIR)/sample/sample-client \
		$(CURDIR)/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 gen-auth.1

	# Remove build directories
	rm -rf $(TMPBUILD_MIT) $(TMPBUILD_HEIMDAL)

override_dh_auto_configure:
	LDFLAGS="$(LDFLAGS) $(HEIMDAL_LDFLAGS)" \
	CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS) $(HEIMDAL_CPPFLAGS)" \
	dh_auto_configure -B$(TMPBUILD_HEIMDAL) -- $(CONFIGURE_COMMON_OPTIONS) --with-gss_impl=heimdal

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

	# Record the build-time settings for later reference
	echo 'To build this package, configure was called as follows:' \
		> debian/README.configure-options

	grep with\ options $(TMPBUILD_MIT)/config.status | sed -e \
		's/^.*options \\"/configure /;s/\\"$///' \
		>> debian/README.configure-options

override_dh_auto_build:
	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

	# Build sample-{client,server}
	$(MAKE) -f $(CURDIR)/debian/sample/Makefile -C $(CURDIR)/sample 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
	# Build the gen-auth man page
	/usr/bin/pod2man --stderr debian/gen-auth/gen-auth >gen-auth.1

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

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

	# Note the version of Berkeley DB used to build this package
	mkdir -p debian/tmp/usr/lib/sasl2
	echo $(BDB_VERSION) > debian/tmp/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 debian/tmp/usr/sbin/pluginviewer debian/tmp/usr/sbin/saslpluginviewer
	mv debian/tmp/usr/share/man/man8/pluginviewer.8 \
		debian/tmp/usr/share/man/man8/saslpluginviewer.8
	install -m 644 saslauthd/saslauthd.mdoc \
		debian/tmp/usr/share/man/man8/saslauthd.8
	install -m 644 $(CURDIR)/debian/testsaslauthd.8 \
		debian/tmp/usr/share/man/man8/testsaslauthd.8
	mv debian/tmp/usr/sbin/dbconverter-2 debian/tmp/usr/sbin/sasldbconverter2

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

	# Alter the rpath of certain binaries and shared libraries.
	chrpath -d debian/tmp/usr/sbin/sasldblistusers2 \
		debian/tmp/usr/sbin/saslpasswd2
ifeq (,$(findstring no-sql,$(DEB_BUILD_OPTIONS)))
	chrpath -d debian/tmp/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

	# Install saslfinger
	install -m 644 -D $(CURDIR)/debian/saslfinger/saslfinger.1 \
		debian/tmp/usr/share/man/man1/saslfinger.1
	install -m 755 -D $(CURDIR)/debian/saslfinger/saslfinger \
		debian/tmp/usr/bin/saslfinger

	# Install gen-auth
	install -m 755 -D $(CURDIR)/debian/gen-auth/gen-auth \
		debian/tmp/usr/bin/gen-auth

	# Install logcheck snippet
	install -m 644 -D $(CURDIR)/debian/libsasl2-modules.logcheck.server \
		debian/tmp/etc/logcheck/ignore.d.server/libsasl2-modules

override_dh_install:
	dh_install --fail-missing

override_dh_installinit:
	dh_installinit $(DH_PACKAGE_EXCLUDES) --name=saslauthd start 20 2 3 4 5 . stop 20 0 1 6 .

override_dh_strip:
	dh_strip -O--dbgsym-migration='cyrus-sasl2-dbg (<< 2.1.26-72-g88d82a3+dfsg-1~), cyrus-sasl2-mit-dbg (<< 2.1.26-72-g88d82a3+dfsg-1~), cyrus-sasl2-heimdal-dbg (<< 2.1.26-72-g88d82a3+dfsg-1~)'

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

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