summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mk/krb5.buildlink3.mk6
-rw-r--r--security/mit-krb5/builtin.mk70
2 files changed, 75 insertions, 1 deletions
diff --git a/mk/krb5.buildlink3.mk b/mk/krb5.buildlink3.mk
index fa0c1225418..4478b652d0b 100644
--- a/mk/krb5.buildlink3.mk
+++ b/mk/krb5.buildlink3.mk
@@ -1,4 +1,4 @@
-# $NetBSD: krb5.buildlink3.mk,v 1.8 2005/01/09 23:59:26 jlam Exp $
+# $NetBSD: krb5.buildlink3.mk,v 1.9 2006/04/10 15:04:44 tron Exp $
#
# This Makefile fragment is meant to be included by packages that
# require a Kerberos 5 implementation. krb5.buildlink3.mk will:
@@ -20,7 +20,11 @@ KRB5_BUILDLINK3_MK:= ${KRB5_BUILDLINK3_MK}+
.include "../../mk/bsd.prefs.mk"
.if !empty(KRB5_BUILDLINK3_MK:M+)
+.if ${OPSYS} != Darwin
KRB5_DEFAULT?= heimdal
+.else
+KRB5_DEFAULT?= mit-krb5
+.endif
KRB5_ACCEPTED?= ${_KRB5_PKGS}
# This is an exhaustive list of all of the Kerberos 5 implementations
diff --git a/security/mit-krb5/builtin.mk b/security/mit-krb5/builtin.mk
new file mode 100644
index 00000000000..ce0d50e7ac1
--- /dev/null
+++ b/security/mit-krb5/builtin.mk
@@ -0,0 +1,70 @@
+# $NetBSD: builtin.mk,v 1.1 2006/04/10 15:04:44 tron Exp $
+
+BUILTIN_PKG:= mit-krb5
+
+BUILTIN_FIND_FILES_VAR:= KRB5_CONFIG
+BUILTIN_FIND_FILES.KRB5_CONFIG= /usr/bin/krb5-config
+
+.include "../../mk/buildlink3/bsd.builtin.mk"
+
+###
+### Figure out the version of MIT Kerberos V installed on the system.
+###
+
+.if !defined(BUILTIN_VERSION.mit-krb5) && \
+ empty(KRB5_CONFIG:M__nonexistent__) && \
+ empty(KRB5_CONFIG:M${LOCALBASE}/*)
+BUILTIN_VERSION.mit-krb5!= ${KRB5_CONFIG} --version | \
+ ${SED} -e 's/.*release //' -e 's/-.*//'
+.endif
+MAKEVARS+= BUILTIN_VERSION.mit-krb5
+
+###
+### Determine if there is a built-in implementation of the package and
+### set IS_BUILTIN.<pkg> appropriately ("yes" or "no").
+###
+.if !defined(IS_BUILTIN.mit-krb5)
+IS_BUILTIN.mit-krb5= no
+. if defined(BUILTIN_VERSION.mit-krb5)
+IS_BUILTIN.mit-krb5= yes
+. endif
+.endif
+MAKEVARS+= IS_BUILTIN.mit-krb5
+
+###
+### If there is a built-in implementation, then set BUILTIN_PKG.<pkg> to
+### a package name to represent the built-in package.
+###
+.if !defined(BUILTIN_PKG.mit-krb5) && \
+ !empty(IS_BUILTIN.mit-krb5:M[yY][eE][sS]) && \
+ defined(BUILTIN_VERSION.mit-krb5)
+BUILTIN_PKG.mit-krb5= mit-krb5-${BUILTIN_VERSION.mit-krb5}
+.endif
+MAKEVARS+= BUILTIN_PKG.mit-krb5
+
+###
+### Determine whether we should use the built-in implementation if it
+### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no").
+###
+.if !defined(USE_BUILTIN.mit-krb5)
+. if ${PREFER.mit-krb5} == "pkgsrc"
+USE_BUILTIN.mit-krb5= no
+. else
+USE_BUILTIN.mit-krb5= ${IS_BUILTIN.mit-krb5}
+. if defined(BUILTIN_PKG.mit-krb5) && \
+ !empty(IS_BUILTIN.mit-krb5:M[yY][eE][sS])
+USE_BUILTIN.mit-krb5= yes
+. for _dep_ in ${BUILDLINK_API_DEPENDS.mit-krb5}
+. if !empty(USE_BUILTIN.mit-krb5:M[yY][eE][sS])
+USE_BUILTIN.mit-krb5!= \
+ if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.mit-krb5:Q}; then \
+ ${ECHO} "yes"; \
+ else \
+ ${ECHO} "no"; \
+ fi
+. endif
+. endfor
+. endif
+. endif
+.endif
+MAKEVARS+= USE_BUILTIN.mit-krb5