summaryrefslogtreecommitdiff
path: root/mk/krb5.buildlink3.mk
blob: ac55596f0ad261b7ac7a6b1a00c84f76dadbc4b3 (plain)
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
# $NetBSD: krb5.buildlink3.mk,v 1.1 2004/01/10 15:29:34 jlam Exp $

KRB5_BUILDLINK3_MK:=	${KRB5_BUILDLINK3_MK}+

.include "../../mk/bsd.prefs.mk"

.if !empty(KRB5_BUILDLINK3_MK)
KRB5_DEFAULT?=	# empty
KRB5_ACCEPTED?=	${_KRB5_PKGS}

# This is an exhaustive list of all of the Kerberos 5 implementations
# that may be used with krb5.buildlink3.mk, in order of precedence.
#
_KRB5_PKGS?=	heimdal #mit-krb5

_KRB5_DEFAULT=	${KRB5_DEFAULT}
_KRB5_ACCEPTED=	${KRB5_ACCEPTED}

# Mark the acceptable Kerberos 5 packages and check which, if any, are
# already installed.
#
.  for _krb5_ in ${_KRB5_ACCEPTED}
_KRB5_OK.${_krb5_}=	yes
.    if !defined(_KRB5_INSTALLED.${_krb5_})
_KRB5_INSTALLED.${_krb5_}!=	\
	if ${PKG_INFO} -qe ${_krb5_}; then				\
		${ECHO} "yes";						\
	else								\
		${ECHO} "no";						\
	fi
MAKEFLAGS+=	_KRB5_INSTALLED.${_krb5_}="${_KRB5_INSTALLED.${_krb5_}}"
.    endif
.  endfor

.  if !defined(_KRB5)
#
# Prefer the default one if it's accepted,...
#
.    if !empty(_KRB5_DEFAULT) && \
	defined(_KRB5_OK.${_KRB5_DEFAULT}) && \
	!empty(_KRB5_OK.${_KRB5_DEFAULT}:M[yY][eE][sS])
_KRB5=		${_KRB5_DEFAULT}
.    endif
#
# ...otherwise, use one of the installed Kerberos 5 packages,...
#
.    for _krb5_ in ${_KRB5_ACCEPTED}
.      if !empty(_KRB5_INSTALLED.${_krb5_}:M[yY][eE][sS])
_KRB5?=		${_krb5_}
.      else
_KRB5_FIRSTACCEPTED?=	${_krb5_}
.      endif
.    endfor
#
# ...otherwise, just use the first accepted Kerberos 5 package.
#
.    if defined(_KRB5_FIRSTACCEPTED)
_KRB5?=		${_KRB5_FIRSTACCEPTED}
.    endif
_KRB5?=		none
MAKEFLAGS+=	_KRB5="${_KRB5}"
.  endif

KRB5_TYPE=	${_KRB5}
BUILD_DEFS+=	KRB5_TYPE

.  if ${KRB5_TYPE} == "none"
PKG_FAIL_REASON=	"No acceptable Kerberos 5 implementation found."
.  elif ${KRB5_TYPE} == "heimdal"
KRB5BASE=	${BUILDLINK_PREFIX.heimdal}
.    include "../../security/heimdal/buildlink3.mk"
.  elif ${KRB5_TYPE} == "mit-krb5"
KRB5BASE=	${BUILDLINK_PREFIX.mit-krb5}
.    include "../../security/mit-krb5/buildlink3.mk"
.  endif
BUILD_DEFS+=	KRB5BASE

.endif	# KRB5_BUILDLINK3_MK