summaryrefslogtreecommitdiff
path: root/security/courier-authlib/Makefile
blob: 8e0521c31b95f52fb89c177097fe36a47e64221f (plain) (blame)
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
# New ports collection makefile for:	courier-authlib
# Date created:				19 Dec 2004
# Whom:					Oliver Lehmann
#
# $FreeBSD$
#

PORTNAME=	courier-authlib
PORTVERSION=	0.61.0
CATEGORIES?=	security mail
.if defined(PKGNAMESUFFIX)
MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR=	courier
.else
MASTER_SITES=	# empty
DISTFILES=	# empty
EXTRACT_ONLY=	# empty
.endif

MAINTAINER=	oliver@FreeBSD.org
COMMENT?=	Meta-port for the courier authentication library

CONFLICTS=	courier-0.45*

.if !defined(PKGNAMESUFFIX)
RUN_DEPENDS=	courierauthconfig:${PORTSDIR}/security/courier-authlib-base

NO_BUILD=	yes
PATCHDIR=	/dev/null

OPTIONS+=	GDBM	"Use gdbm instead of system bdb"	off

.include "${.CURDIR}/Makefile.opt"

.else	# !defined(PKGNAMESUFFIX)

USE_AUTOTOOLS=	libltdl:15
USE_BZIP2=	yes
USE_GMAKE=	yes
GNU_CONFIGURE=	yes
USE_PERL5=	yes
USE_SUBMAKE=	yes
USE_LDCONFIG=	yes
LDCONFIG_DIRS=	%%PREFIX%%/lib/${PORTNAME}

MAILOWN=	courier
MAILGRP=	courier
MAILUID=	465
MAILGID=	465
LOCALSTATEDIR=	/var
AUTHDAEMONVAR=	${LOCALSTATEDIR}/run/authdaemond

VPOPMAILDIR?=	${LOCALBASE}/vpopmail
USERDB?=	${PREFIX}/etc/userdb

CPPFLAGS+=	-I${LOCALBASE}/include
LDFLAGS+=	-L${LOCALBASE}/lib
CONFIGURE_ENV=	CPPFLAGS='${CPPFLAGS}' \
		LDFLAGS='${LDFLAGS}'
MAKE_ENV:=	${CONFIGURE_ENV}

CONFIGURE_TARGET=--build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
CONFIGURE_ARGS=	--enable-unicode \
		--enable-ltdl-install=no \
		--without-authcustom \
		--without-authshadow \
		--without-authpwd \
		--with-mailuser=${MAILOWN} \
		--with-mailgroup=${MAILGRP} \
		--localstatedir=${LOCALSTATEDIR} \
		--with-authdaemonvar=${AUTHDAEMONVAR} \
		--cache-file=${WRKDIR}/courier-authlib.cache

INSTALL_TARGET=	install-strip install-configure

DESCR=		${PKGDIR}/pkg-descr${PKGNAMESUFFIX}
PLIST=		${PKGDIR}/pkg-plist${PKGNAMESUFFIX:S/gdbm/db/}

AUTHMOD=	auth${PKGNAMESUFFIX:S/-//:S/gdbm/db/}

.if ${AUTHMOD} == authbase
RUN_DEPENDS+=	${LOCALBASE}/share/sysconftool/sysconftool:${PORTSDIR}/devel/sysconftool
CONFIGURE_ARGS+=--with-base --with-authpam

MAN1=		courierlogger.1 authtest.1

MAN3=		authlib.3 auth_generic.3 auth_login.3 auth_getuserinfo.3 \
		auth_enumerate.3 auth_passwd.3 auth_getoption.3 auth_sasl.3

DOCS=		AUTHORS COPYING ChangeLog INSTALL NEWS README \
		README.authdebug.html README_authlib.html

PLIST_SUB+=	MAILOWN=${MAILOWN} MAILGRP=${MAILGRP} \
		MAILUID=${MAILUID} MAILGID=${MAILGID} \
		AUTHDAEMONVAR=${AUTHDAEMONVAR}
SUB_LIST:=	${PLIST_SUB}
SUB_FILES+=	pkg-install pkg-deinstall

.if defined(WITH_AUTHPIPE_PROG)
CONFIGURE_ARGS+=--with-pipeprog=${WITH_AUTHPIPE_PROG}
.endif

.else
RUN_DEPENDS+=	courierauthconfig:${PORTSDIR}/security/courier-authlib-base
CONFIGURE_ARGS+=--without-base --without-authpam
REMOVE_SUBDIRS+=liblock liblog
.endif

.if ${AUTHMOD} == authuserdb
MAN8=		makeuserdb.8 userdb.8 userdbpw.8
.if ${PKGNAMESUFFIX} == -usergdbm
CONFLICTS+=	${PORTNAME}-userdb-0.*
LIB_DEPENDS+=	gdbm.3:${PORTSDIR}/databases/gdbm
CONFIGURE_ARGS+=--with-db=gdbm
.elif ${PKGNAMESUFFIX} == -userdb
CONFLICTS+=	${PORTNAME}-usergdbm-0.*
CONFIGURE_ARGS+=--with-db=db
.endif
CONFIGURE_ARGS+=--with-userdb=${USERDB}
.else
CONFIGURE_ARGS+=--with-db=db --without-authuserdb
REMOVE_SUBDIRS+=makedat userdb
.endif

.if ${AUTHMOD} == authldap
DOCS=		README.ldap
USE_OPENLDAP=	yes
CONFIGURE_ARGS+=--with-authldap
.else
CONFIGURE_ARGS+=--without-authldap
.endif

.if ${AUTHMOD} == authmysql
DOCS=		README.authmysql.html README.authmysql.myownquery
USE_MYSQL=	yes
CONFIGURE_ARGS+=--with-authmysql \
		--with-mysql-libs=${LOCALBASE}/lib/mysql \
		--with-mysql-includes=${LOCALBASE}/include/mysql
.else
CONFIGURE_ARGS+=--without-authmysql
.endif

.if ${AUTHMOD} == authpgsql
DOCS=		README.authpostgres.html
USE_PGSQL=	yes
CONFIGURE_ARGS+=--with-authpgsql
.else
CONFIGURE_ARGS+=--without-authpgsql
.endif

.if ${AUTHMOD} == authvchkpw
BUILD_DEPENDS+=	${VPOPMAILDIR}/lib/libvpopmail.a:${PORTSDIR}/mail/vpopmail
CONFIGURE_ARGS+=--with-authvchkpw
.else
CONFIGURE_ARGS+=--without-authvchkpw
.endif

.endif	# !defined(PKGNAMESUFFIX)

.include <bsd.port.pre.mk>

.if !defined(PKGNAMESUFFIX)

.include "${.CURDIR}/Makefile.dep"

do-install:	#empty
do-build:	#empty
.else	# !defined(PKGNAMESUFFIX)

.if ${AUTHMOD} == authbase
.if defined(WITH_RCORDER)
USE_RCORDER=	courier-authdaemond.sh
.else
USE_RC_SUBR=	courier-authdaemond.sh
.endif

pre-everything::
	@${ECHO_CMD}
	@${ECHO_CMD}	"	Set WITH_AUTHPIPE_PROG to a program you want to use instead of"
	@${ECHO_CMD}	"	authProg for libauthpipe"
	@${ECHO_CMD}
.endif

post-patch:
	@${REINPLACE_CMD} -e 's|$$VPOPMAILLIBS|& -lcrypt|g;  \
		s|^\(INSTALL_STRIP_PROGRAM=\).*$$|\1"$${INSTALL_PROGRAM} -s"| ; \
		s|mysql_connect|mysql_real_connect|g' \
		${WRKSRC}/*/configure \
		${WRKSRC}/configure
.for subdir in ${REMOVE_SUBDIRS}
	@${REINPLACE_CMD} -E 's,(^(ac_subdirs_all|subdirs).*)${subdir},\1,g' \
		${WRKSRC}/configure
.endfor
	@${REINPLACE_CMD} -e 's|$$(INSTALL_DATA) \(.$$$$file.\)|${INSTALL_MAN} \1|' \
		${WRKSRC}/*/Makefile.in \
		${WRKSRC}/Makefile.in
	@${REINPLACE_CMD} -e 's|^\(DEFAULTOPTIONS=\)""$$|\1"wbnodsn=1"|' \
		-e 's|@ALLMODULES@|authuserdb authvchkpw authpam authldap authmysql authpgsql|' \
		${WRKSRC}/authdaemonrc.in
	@${REINPLACE_CMD} -e 's:@EXPECT@:${SETENV} expect:' \
		${WRKSRC}/authsystem.passwd.in

pre-configure:
	@if [ -f "${WRKDIR}/courier-authlib.cache" -a -s "${WRKDIR}/courier-authlib.cache" ] ; then \
		${RM} -f "${WRKDIR}/courier-authlib.cache" ; \
	fi

.if ${PKGNAMESUFFIX} == "-base"
pre-install:
	@PKG_PREFIX="${PREFIX}" ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
.endif	# ${PKGNAMESUFFIX} == "-base"

post-install:
.if !defined(NOPORTDOCS)
	@${INSTALL} ${_SHROWNGRP} -d ${DOCSDIR}
.for f in ${DOCS}
	${INSTALL_DATA} ${WRKSRC}/${f} ${DOCSDIR}
.endfor
.endif
.endif	# !defined(PKGNAMESUFFIX)

.include <bsd.port.post.mk>