git: ea1086f14d69 - main - security/libpki: new location for sample files

From: Nuno Teixeira <eduardo_at_FreeBSD.org>
Date: Mon, 18 Jul 2022 08:22:30 UTC
The branch main has been updated by eduardo:

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

commit ea1086f14d694235d0dd6df321edc270097793a3
Author:     Bruno Damour <bruno@ruomad.net>
AuthorDate: 2022-07-18 08:18:39 +0000
Commit:     Nuno Teixeira <eduardo@FreeBSD.org>
CommitDate: 2022-07-18 08:22:14 +0000

    security/libpki: new location for sample files
    
     - not install any configuration files AT ALL
     - put all provided samples in ${PREFIX}/share/libpki/etc
     - add a message to the user to refer to these samples
     - mark the port as BROKEN on arm64 (according to pullout message received)
     - add options to allow configure to enable DNS, LDAP, MySQL and
       PostgreSQL if asked for
     - bump PORTREVISION
    
    PR:             265189
---
 security/libpki/Makefile    | 40 +++++++++++++++++++++++++++++++--------
 security/libpki/pkg-message | 17 +++++++++++++++++
 security/libpki/pkg-plist   | 46 ++++++++++++++++++++++++---------------------
 3 files changed, 74 insertions(+), 29 deletions(-)

diff --git a/security/libpki/Makefile b/security/libpki/Makefile
index 2583811f7040..17e62c596635 100644
--- a/security/libpki/Makefile
+++ b/security/libpki/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	libpki
 DISTVERSIONPREFIX=	v
 DISTVERSION=	0.9.2
+PORTREVISION=	1
 CATEGORIES=	security
 
 PATCH_SITES=	https://github.com/openca/libpki/commit/
@@ -12,6 +13,8 @@ COMMENT=	OpenCA PKI library (libpki) and tools
 LICENSE=	APACHE20
 LICENSE_FILE=	${WRKSRC}/COPYING
 
+NOT_FOR_ARCHS=	arm64
+
 USES=		autoreconf gnome libtool ssl
 USE_GITHUB=	yes
 GH_ACCOUNT=	openca
@@ -20,17 +23,38 @@ USE_LDCONFIG=	yes
 
 GNU_CONFIGURE=	yes
 CONFIGURE_ARGS=	--disable-dependency-tracking \
-		--disable-dns \
-		--disable-iphone \
-		--disable-ldap \
-		--disable-mysql \
-		--disable-pg
+		--disable-iphone
+
 INSTALL_TARGET=	install-strip
 
+OPTIONS_DEFINE=	DNS LDAP MYSQL PGSQL
+
+DNS_DESC=	"Enable DNS support"
+LDAP_DESC=	"Enable LDAP support"
+MYSQL_DESC=	"Enable MySQL support"
+PGSQL_DESC=	"Enable PostgreSQL support"
+
+DNS_CONFIGURE_ENABLE=	dns
+LDAP_LIB_DEPENDS=	liblber.so:net/openldap24-client \
+			libldap_r.so:net/openldap24-client
+LDAP_CONFIGURE_ENABLE=	ldap
+LDAP_LDFLAGS+=		-llber
+MYSQL_USES=		mysql
+MYSQL_CONFIGURE_ENABLE=	mysql
+PGSQL_USES=		pgsql
+PGSQL_CONFIGURE_ENABLE=	pg
+
 post-stage:
-	${MV} ${STAGEDIR}${PREFIX}/etc/pki.conf ${STAGEDIR}${PREFIX}/etc/pki.conf.sample; \
-	for f in $$(find ${STAGEDIR}${PREFIX}/etc/libpki -type f); do \
-		${MV} $$f $$f.sample; \
+	${MKDIR} ${STAGEDIR}${PREFIX}/share/libpki/etc; \
+	${MKDIR} ${STAGEDIR}${PREFIX}/share/libpki/etc/libpki; \
+	${MKDIR} ${STAGEDIR}${PREFIX}/share/libpki/etc/libpki/hsm.d; \
+	${MKDIR} ${STAGEDIR}${PREFIX}/share/libpki/etc/libpki/profile.d; \
+	${MKDIR} ${STAGEDIR}${PREFIX}/share/libpki/etc/libpki/store.d; \
+	${MKDIR} ${STAGEDIR}${PREFIX}/share/libpki/etc/libpki/token.d; \
+	${MV} ${STAGEDIR}${PREFIX}/etc/pki.conf ${STAGEDIR}${PREFIX}/share/libpki/etc/pki.conf.sample; \
+	cd ${STAGEDIR}${PREFIX}/etc/libpki; \
+	for f in $$(find * -type f); do \
+		${MV} ${STAGEDIR}${PREFIX}/etc/libpki/$$f ${STAGEDIR}${PREFIX}/share/libpki/etc/libpki/$$f.sample; \
 	done; \
 	${RM} -rf ${STAGEDIR}${PREFIX}/include/internal
 
diff --git a/security/libpki/pkg-message b/security/libpki/pkg-message
new file mode 100644
index 000000000000..78dcb8f577d4
--- /dev/null
+++ b/security/libpki/pkg-message
@@ -0,0 +1,17 @@
+[
+{ type: install
+  message: <<EOM
+Sample Configuration files have been installed in $PREFIX/share/libpki/etc, in a
+hierachy that mimics the one created in $PREFIX/etc.
+They may be used as templates to be copied into the corresponding subdirectory
+under $PREFIX/etc and customized according to user context.
+EOM
+}
+{
+  type: remove
+  message: <<EOM
+User-installed configuration files under $PREFIX/etc/libpki have been preserved and
+must be removed manually if needed, as well as this directory. 
+EOM
+}
+]
diff --git a/security/libpki/pkg-plist b/security/libpki/pkg-plist
index 5595d20e913c..2db500532b58 100644
--- a/security/libpki/pkg-plist
+++ b/security/libpki/pkg-plist
@@ -8,27 +8,6 @@ bin/pki-siginfo
 bin/pki-tool
 bin/pki-xpair
 bin/url-tool
-@sample %%ETCDIR%%/hsm.d/eracom-sdk.xml.sample
-@sample %%ETCDIR%%/hsm.d/etoken-engine.xml.sample
-@sample %%ETCDIR%%/hsm.d/etoken-pkcs11.xml.sample
-@sample %%ETCDIR%%/hsm.d/etoken.xml.sample
-@sample %%ETCDIR%%/hsm.d/opencryptoki.xml.sample
-@sample %%ETCDIR%%/hsm.d/tpm.xml.sample
-@sample %%ETCDIR%%/objectIdentifiers.xml.sample
-@sample %%ETCDIR%%/profile.d/crl.xml.sample
-@sample %%ETCDIR%%/profile.d/server.xml.sample
-@sample %%ETCDIR%%/profile.d/test.xml.sample
-@sample %%ETCDIR%%/profile.d/user.xml.sample
-@sample %%ETCDIR%%/store.d/empty.xml.sample
-@sample %%ETCDIR%%/token.d/default.xml.sample
-@sample %%ETCDIR%%/token.d/eracom.xml.sample
-@sample %%ETCDIR%%/token.d/etoken-engine.xml.sample
-@sample %%ETCDIR%%/token.d/etoken.xml.sample
-@sample %%ETCDIR%%/token.d/opencryptoki.xml.sample
-@sample %%ETCDIR%%/token.d/software.xml.sample
-@sample %%ETCDIR%%/token.d/test.xml.sample
-@sample %%ETCDIR%%/token.d/tpm.xml.sample
-@sample etc/pki.conf.sample
 include/libpki/banners.h
 include/libpki/cmc.h
 include/libpki/cmc/cmc_cert_req.h
@@ -176,3 +155,28 @@ lib/libpki.so.92.92.4
 %%DATADIR%%/doxygen-pdf.conf
 %%DATADIR%%/doxygen.conf
 %%DATADIR%%/pkginfo
+%%DATADIR%%/etc/pki.conf.sample
+%%DATADIR%%/etc/libpki/hsm.d/eracom-sdk.xml.sample
+%%DATADIR%%/etc/libpki/hsm.d/etoken-engine.xml.sample
+%%DATADIR%%/etc/libpki/hsm.d/etoken-pkcs11.xml.sample
+%%DATADIR%%/etc/libpki/hsm.d/etoken.xml.sample
+%%DATADIR%%/etc/libpki/hsm.d/opencryptoki.xml.sample
+%%DATADIR%%/etc/libpki/hsm.d/tpm.xml.sample
+%%DATADIR%%/etc/libpki/objectIdentifiers.xml.sample
+%%DATADIR%%/etc/libpki/profile.d/crl.xml.sample
+%%DATADIR%%/etc/libpki/profile.d/server.xml.sample
+%%DATADIR%%/etc/libpki/profile.d/test.xml.sample
+%%DATADIR%%/etc/libpki/profile.d/user.xml.sample
+%%DATADIR%%/etc/libpki/store.d/empty.xml.sample
+%%DATADIR%%/etc/libpki/token.d/default.xml.sample
+%%DATADIR%%/etc/libpki/token.d/eracom.xml.sample
+%%DATADIR%%/etc/libpki/token.d/etoken-engine.xml.sample
+%%DATADIR%%/etc/libpki/token.d/etoken.xml.sample
+%%DATADIR%%/etc/libpki/token.d/opencryptoki.xml.sample
+%%DATADIR%%/etc/libpki/token.d/software.xml.sample
+%%DATADIR%%/etc/libpki/token.d/test.xml.sample
+%%DATADIR%%/etc/libpki/token.d/tpm.xml.sample
+@dir etc/libpki/hsm.d
+@dir etc/libpki/profile.d
+@dir etc/libpki/store.d
+@dir etc/libpki/token.d