git: 743dbb8f6fce - main - security/krb5*: Allow the user to specify state directory locations

From: Cy Schubert <cy_at_FreeBSD.org>
Date: Wed, 29 Nov 2023 00:02:35 UTC
The branch main has been updated by cy:

URL: https://cgit.FreeBSD.org/ports/commit/?id=743dbb8f6fce110d31bff7ccf2652396cb53868a

commit 743dbb8f6fce110d31bff7ccf2652396cb53868a
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2023-11-28 03:58:58 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2023-11-28 23:49:24 +0000

    security/krb5*: Allow the user to specify state directory locations
    
    localstatedir and runstatedir are set to ${PREFIX}/var and
    ${PREFIX}/var/run respectively. Users who wish to put their KDC
    DB elsewhere can set the following in make.conf:
            KRB5_LOCALSTATEDIR=/va
            KRB5_RUNSTATEDIR=/var/run.
    
    Unfortunately defaulting to /var instead of the current default would
    result in MIT KDC not finding its KDC DB files. This would be disruptive
    to all MIT KDC users. But new users of MIT KRB5 KDC can set the pathname
    above as desired.
    
    PR:     267560
---
 security/krb5-119/Makefile    | 13 +++++++++++--
 security/krb5-119/pkg-plist   |  4 ++--
 security/krb5-120/Makefile    | 13 +++++++++++--
 security/krb5-120/pkg-plist   |  4 ++--
 security/krb5-121/Makefile    | 13 +++++++++++--
 security/krb5-121/pkg-plist   |  4 ++--
 security/krb5-devel/Makefile  | 13 +++++++++++--
 security/krb5-devel/pkg-plist |  4 ++--
 8 files changed, 52 insertions(+), 16 deletions(-)

diff --git a/security/krb5-119/Makefile b/security/krb5-119/Makefile
index c7b33c3304cb..d658070d68ce 100644
--- a/security/krb5-119/Makefile
+++ b/security/krb5-119/Makefile
@@ -34,8 +34,7 @@ USE_LDCONFIG=		yes
 USE_PERL5=		build
 GNU_CONFIGURE=		yes
 CONFIGURE_ARGS?=	--enable-shared --without-system-verto \
-			--disable-rpath --localstatedir="${PREFIX}/var" \
-			--runstatedir="${PREFIX}/var/run"
+			--disable-rpath
 CONFIGURE_ENV=		INSTALL="${INSTALL}" INSTALL_LIB="${INSTALL_LIB}" YACC="${YACC}"
 MAKE_ARGS=		INSTALL="${INSTALL}" INSTALL_LIB="${INSTALL_LIB}"
 
@@ -71,6 +70,16 @@ LIBEDIT_BASE_DESC=	Use libedit in FreeBSD base
 .if defined(KRB5_HOME)
 PREFIX=			${KRB5_HOME}
 .endif
+.if !defined(KRB5_LOCALSTATEDIR)
+KRB5_LOCALSTATEDIR=	"${PREFIX}/var"
+.endif
+.if !defined(KRB5_RUNSTATEDIR)
+KRB5_RUNSTATEDIR=	"${PREFIX}/var/run"
+.endif
+CONFIGURE_ARGS+=	--runstatedir="${KRB5_RUNSTATEDIR}"
+CONFIGURE_ARGS+=	--localstatedir="${KRB5_LOCALSTATEDIR}"
+PLIST_SUB+=		KRB5_LOCALSTATEDIR=${KRB5_LOCALSTATEDIR}
+PLIST_SUB+=		KRB5_RUNSTATEDIR=${KRB5_RUNSTATEDIR}
 CPPFLAGS+=		-I${OPENSSLINC}
 LDFLAGS+=		-L${OPENSSLLIB}
 
diff --git a/security/krb5-119/pkg-plist b/security/krb5-119/pkg-plist
index 550c5f235d41..82804651071e 100644
--- a/security/krb5-119/pkg-plist
+++ b/security/krb5-119/pkg-plist
@@ -174,5 +174,5 @@ share/et/et_h.awk
 %%LDAP%%%%DATADIR%%/kerberos.ldif
 @dir lib/krb5/plugins/authdata
 @dir lib/krb5/plugins/libkrb5
-@dir var/run/krb5kdc
-@dir var/krb5kdc
+@dir %%KRB5_RUNSTATEDIR%%/krb5kdc
+@dir %%KRB5_LOCALSTATEDIR%%/krb5kdc
diff --git a/security/krb5-120/Makefile b/security/krb5-120/Makefile
index dd175bf24bd6..bf69ecfb7c2e 100644
--- a/security/krb5-120/Makefile
+++ b/security/krb5-120/Makefile
@@ -27,8 +27,7 @@ USE_LDCONFIG=		yes
 USE_PERL5=		build
 GNU_CONFIGURE=		yes
 CONFIGURE_ARGS?=	--enable-shared --without-system-verto \
-			--disable-rpath --localstatedir="${PREFIX}/var" \
-			--runstatedir="${PREFIX}/var/run"
+			--disable-rpath
 CONFIGURE_ENV=		INSTALL="${INSTALL}" INSTALL_LIB="${INSTALL_LIB}" YACC="${YACC}"
 MAKE_ARGS=		INSTALL="${INSTALL}" INSTALL_LIB="${INSTALL_LIB}"
 
@@ -64,6 +63,16 @@ LIBEDIT_BASE_DESC=	Use libedit in FreeBSD base
 .if defined(KRB5_HOME)
 PREFIX=			${KRB5_HOME}
 .endif
+.if !defined(KRB5_LOCALSTATEDIR)
+KRB5_LOCALSTATEDIR=	"${PREFIX}/var"
+.endif
+.if !defined(KRB5_RUNSTATEDIR)
+KRB5_RUNSTATEDIR=	"${PREFIX}/var/run"
+.endif
+CONFIGURE_ARGS+=	--runstatedir="${KRB5_RUNSTATEDIR}"
+CONFIGURE_ARGS+=	--localstatedir="${KRB5_LOCALSTATEDIR}"
+PLIST_SUB+=		KRB5_LOCALSTATEDIR=${KRB5_LOCALSTATEDIR}
+PLIST_SUB+=		KRB5_RUNSTATEDIR=${KRB5_RUNSTATEDIR}
 CPPFLAGS+=		-I${OPENSSLINC}
 LDFLAGS+=		-L${OPENSSLLIB}
 
diff --git a/security/krb5-120/pkg-plist b/security/krb5-120/pkg-plist
index f803ffb5ff2b..3b0695580d52 100644
--- a/security/krb5-120/pkg-plist
+++ b/security/krb5-120/pkg-plist
@@ -173,5 +173,5 @@ share/et/et_h.awk
 %%LDAP%%%%DATADIR%%/kerberos.ldif
 @dir lib/krb5/plugins/authdata
 @dir lib/krb5/plugins/libkrb5
-@dir var/run/krb5kdc
-@dir var/krb5kdc
+@dir %%KRB5_RUNSTATEDIR%%/krb5kdc
+@dir %%KRB5_LOCALSTATEDIR%%/krb5kdc
diff --git a/security/krb5-121/Makefile b/security/krb5-121/Makefile
index a3b296eb8016..1d0a9a01d364 100644
--- a/security/krb5-121/Makefile
+++ b/security/krb5-121/Makefile
@@ -27,8 +27,7 @@ USE_LDCONFIG=		yes
 USE_PERL5=		build
 GNU_CONFIGURE=		yes
 CONFIGURE_ARGS?=	--enable-shared --without-system-verto \
-			--disable-rpath --localstatedir="${PREFIX}/var" \
-			--runstatedir="${PREFIX}/var/run"
+			--disable-rpath
 CONFIGURE_ENV=		INSTALL="${INSTALL}" INSTALL_LIB="${INSTALL_LIB}" YACC="${YACC}"
 MAKE_ARGS=		INSTALL="${INSTALL}" INSTALL_LIB="${INSTALL_LIB}"
 
@@ -64,6 +63,16 @@ LIBEDIT_BASE_DESC=	Use libedit in FreeBSD base
 .if defined(KRB5_HOME)
 PREFIX=			${KRB5_HOME}
 .endif
+.if !defined(KRB5_LOCALSTATEDIR)
+KRB5_LOCALSTATEDIR=	"${PREFIX}/var"
+.endif
+.if !defined(KRB5_RUNSTATEDIR)
+KRB5_RUNSTATEDIR=	"${PREFIX}/var/run"
+.endif
+CONFIGURE_ARGS+=	--runstatedir="${KRB5_RUNSTATEDIR}"
+CONFIGURE_ARGS+=	--localstatedir="${KRB5_LOCALSTATEDIR}"
+PLIST_SUB+=		KRB5_LOCALSTATEDIR=${KRB5_LOCALSTATEDIR}
+PLIST_SUB+=		KRB5_RUNSTATEDIR=${KRB5_RUNSTATEDIR}
 CPPFLAGS+=		-I${OPENSSLINC}
 LDFLAGS+=		-L${OPENSSLLIB}
 
diff --git a/security/krb5-121/pkg-plist b/security/krb5-121/pkg-plist
index 11b1e585bfa0..03e1256555cc 100644
--- a/security/krb5-121/pkg-plist
+++ b/security/krb5-121/pkg-plist
@@ -174,5 +174,5 @@ share/et/et_h.awk
 %%LDAP%%%%DATADIR%%/kerberos.ldif
 @dir lib/krb5/plugins/authdata
 @dir lib/krb5/plugins/libkrb5
-@dir var/run/krb5kdc
-@dir var/krb5kdc
+@dir %%KRB5_RUNSTATEDIR%%/krb5kdc
+@dir %%KRB5_LOCALSTATEDIR%%/krb5kdc
diff --git a/security/krb5-devel/Makefile b/security/krb5-devel/Makefile
index 4749d5892cf5..0f5584214bda 100644
--- a/security/krb5-devel/Makefile
+++ b/security/krb5-devel/Makefile
@@ -29,8 +29,7 @@ GNU_CONFIGURE=		yes
 USES=			autoreconf compiler:c11 cpe gmake localbase perl5 \
 			libtool:build gssapi:bootstrap,mit pkgconfig ssl
 CONFIGURE_ARGS?=	--enable-shared --without-system-verto \
-			--disable-rpath --localstatedir="${PREFIX}/var" \
-			--runstatedir="${PREFIX}/var/run"
+			--disable-rpath
 CONFIGURE_ENV=		INSTALL="${INSTALL}" INSTALL_LIB="${INSTALL_LIB}" YACC="${YACC}" WARN_CFLAGS=-Wno-strict-prototypes
 MAKE_ARGS=		INSTALL="${INSTALL}" INSTALL_LIB="${INSTALL_LIB}"
 
@@ -64,6 +63,16 @@ LIBEDIT_BASE_DESC=	Use libedit in FreeBSD base
 .if defined(KRB5_HOME)
 PREFIX=			${KRB5_HOME}
 .endif
+.if !defined(KRB5_LOCALSTATEDIR)
+KRB5_LOCALSTATEDIR=	"${PREFIX}/var"
+.endif
+.if !defined(KRB5_RUNSTATEDIR)
+KRB5_RUNSTATEDIR=	"${PREFIX}/var/run"
+.endif
+CONFIGURE_ARGS+=	--runstatedir="${KRB5_RUNSTATEDIR}"
+CONFIGURE_ARGS+=	--localstatedir="${KRB5_LOCALSTATEDIR}"
+PLIST_SUB+=		KRB5_LOCALSTATEDIR=${KRB5_LOCALSTATEDIR}
+PLIST_SUB+=		KRB5_RUNSTATEDIR=${KRB5_RUNSTATEDIR}
 CPPFLAGS+=		-I${OPENSSLINC}
 LDFLAGS+=		-L${OPENSSLLIB}
 
diff --git a/security/krb5-devel/pkg-plist b/security/krb5-devel/pkg-plist
index 5fb1326b4a6f..22a84701655c 100644
--- a/security/krb5-devel/pkg-plist
+++ b/security/krb5-devel/pkg-plist
@@ -174,5 +174,5 @@ share/et/et_h.awk
 %%LDAP%%%%DATADIR%%/kerberos.ldif
 @dir lib/krb5/plugins/authdata
 @dir lib/krb5/plugins/libkrb5
-@dir var/run/krb5kdc
-@dir var/krb5kdc
+@dir %%KRB5_RUNSTATEDIR%%/krb5kdc
+@dir %%KRB5_LOCALSTATEDIR%%/krb5kdc