1PORTNAME=	heimdal
2PORTVERSION=	7.8.0
3PORTREVISION=	1
4CATEGORIES=	security
5MASTER_SITES=	https://github.com/heimdal/heimdal/releases/download/${DISTNAME}/
6
7MAINTAINER=	ports@MidnightBSD.org
8COMMENT=	Popular BSD-licensed implementation of Kerberos 5
9WWW=		https://www.h5l.org/
10
11LICENSE=	bsd3
12LICENSE_FILE=	${WRKSRC}/LICENSE
13
14CONFLICTS=	krb5 krb5-*
15
16USES=		cpe gettext-runtime gssapi:bootstrap,heimdal libtool pathfix \
17		pkgconfig readline makeinfo ssl
18CPE_VENDOR=	${PORTNAME}_project
19USE_LDCONFIG=	${GSSAPILIBDIR}
20
21GNU_CONFIGURE=	yes
22CONFIGURE_ENV=	ac_cv_header_fnmatch_h=yes \
23		ac_cv_header_db_h=no \
24		ac_cv_header_db3_db_h=no \
25		ac_cv_header_db4_db_h=no \
26		ac_cv_header_db5_db_h=no \
27		ac_cv_header_db6_db_h=no \
28		ac_cv_prog_COMPILE_ET=${WRKSRC}/lib/com_err/compile_et \
29		PYTHON="${TRUE}"
30CONFIGURE_ARGS=	--with-berkeley-db \
31		--with-libintl \
32		--with-libintl-include="${LOCALBASE}/include" \
33		--with-libintl-lib="${LOCALBASE}/lib" \
34		--libdir="${GSSAPILIBDIR}" \
35		--includedir="${GSSAPIINCDIR}" \
36		--with-kcm \
37		--with-openssl \
38		--with-openssl-include="${OPENSSLINC}" \
39		--with-openssl-lib="${OPENSSLLIB}" \
40		--enable-otp \
41		--enable-pthread-support \
42		--with-readline="${LOCALBASE}" \
43		--with-hdbdir="/var/${PORTNAME}" \
44		--sysconfdir="${PREFIX}/etc"
45# XXX --with-readline picks up libreadline even if found in /usr/lib.
46MAKE_ENV=	INSTALL_CATPAGES=no
47CFLAGS+=	-Wno-implicit-function-declaration
48LDFLAGS+=	-Wl,--undefined-version
49INSTALL_TARGET=	install-strip
50.if !exists(/etc/rc.d/ipropd_master)
51USE_RC_SUBR=	ipropd_master ipropd_slave
52.endif
53INFO=		heimdal hx509
54
55MAKE_JOBS_UNSAFE=	yes
56
57OPTIONS_DEFINE=	IPV6 BDB LMDB SQLITE LDAP PKINIT DIGEST KX509 CRACKLIB
58OPTIONS_DEFAULT=IPV6 BDB                  PKINIT DIGEST KX509
59OPTIONS_SUB=	yes
60
61IPV6_CONFIGURE_WITH=	ipv6
62
63BDB_DESC=		Enable BerkeleyDB KDC backend support
64BDB_USES=		bdb:5 localbase
65BDB_CONFIGURE_ENV=	ac_cv_header_db${BDB_VER}_db_h=yes \
66			ac_cv_func_db_create=yes \
67			ac_cv_funclib_db_create="-l${BDB_LIB_NAME}"
68BDB_CONFIGURE_ON=	--disable-ndbm-db
69BDB_CONFIGURE_ENV_OFF=	ac_cv_header_db_h=yes \
70			ac_cv_func_db_create=no \
71			ac_cv_funclib_db_create=no
72BDB_CONFIGURE_OFF=	--enable-ndbm-db
73
74LMDB_DESC=		Enable LMDB KDC backend support
75LMDB_CONFIGURE_ENABLE=	mdb_db
76LMDB_LIB_DEPENDS=	liblmdb.so:databases/lmdb
77
78SQLITE_DESC=		Enable SQLite KDC backend support
79SQLITE_USES=		sqlite
80SQLITE_CONFIGURE_ON=	--with-sqlite3-include="${LOCALBASE}/include" \
81			--with-sqlite3-lib="${LOCALBASE}/lib"
82SQLITE_CONFIGURE_WITH=	sqlite3
83
84LDAP_DESC=		Enable OpenLDAP KDC backend support
85LDAP_USE=		OPENLDAP=yes
86LDAP_CONFIGURE_ON=	--with-openldap-include="${LOCALBASE}/include" \
87			--with-openldap-lib="${LOCALBASE}/lib"
88LDAP_CONFIGURE_WITH=	openldap
89
90PKINIT_DESC=		Enable PK-INIT support
91PKINIT_CONFIGURE_ENABLE=pk-init
92
93DIGEST_DESC=		Enable DIGEST support
94DIGEST_CONFIGURE_ENABLE=digest
95
96KX509_DESC=		Enable kx509 support
97KX509_CONFIGURE_ENABLE=	kx509
98
99CRACKLIB_DESC=		Use CrackLib for password quality checking
100CRACKLIB_LIB_DEPENDS=	libcrack.so:security/cracklib
101
102.include <bsd.mport.options.mk>
103
104post-extract:
105	@${MKDIR} ${WRKSRC}/kpasswdd-cracklib
106	${INSTALL_DATA} ${FILESDIR}/kpasswdd-cracklib.c \
107	    ${WRKSRC}/kpasswdd-cracklib
108	${INSTALL_DATA} ${FILESDIR}/kpasswdd-Makefile \
109	    ${WRKSRC}/kpasswdd-cracklib/Makefile
110
111post-build-CRACKLIB-on:
112	cd ${WRKSRC}/kpasswdd-cracklib && \
113	    ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_ARGS} ${FAKE_MAKEARGS} ${BUILD_TARGET}
114
115post-install-CRACKLIB-on:
116	cd ${WRKSRC}/kpasswdd-cracklib && \
117	    ${SETENV} ${MAKE_ENV} ${FAKE_MAKEENV} ${MAKE} ${MAKE_ARGS} ${FAKE_MAKEARGS} ${INSTALL_TARGET}
118
119.include <bsd.port.mk>
120