git: 6e9237ba47f0 - main - shells/ksh*: Allow the ksh ports to coexist

From: Cy Schubert <cy_at_FreeBSD.org>
Date: Sun, 28 Aug 2022 21:19:54 UTC
The branch main has been updated by cy:

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

commit 6e9237ba47f0c0df54a58ca8a1bf79b44d580208
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2022-08-28 20:12:47 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2022-08-28 21:16:45 +0000

    shells/ksh*: Allow the ksh ports to coexist
    
    Add an option to allow the ksh ports to avoid conflicting with each
    other and to coexist. This allows people who wish to punish themselves
    by tracking developent to still be able to fall back should upstream
    cause regressions.
    
    This also allows legacy ksh93 to coexist with the recently added
    ksh93/ksh, which is not entirely compatible with legacy ksh. Applications
    which require a legacy ksh compatible package should use the ksh93 port
    installed using one of its options. This allows new and old to exist on
    the same system.
---
 shells/ksh-devel/Makefile  | 21 ++++++++++++---------
 shells/ksh-devel/pkg-plist |  6 +++---
 shells/ksh/Makefile        | 18 ++++++++++--------
 shells/ksh/pkg-plist       |  6 +++---
 shells/ksh93/Makefile      | 13 +++++++++----
 shells/ksh93/pkg-plist     |  6 +++---
 6 files changed, 40 insertions(+), 30 deletions(-)

diff --git a/shells/ksh-devel/Makefile b/shells/ksh-devel/Makefile
index 8819a458368c..d9d609bb3f6d 100644
--- a/shells/ksh-devel/Makefile
+++ b/shells/ksh-devel/Makefile
@@ -36,13 +36,15 @@ GH_TAGNAME=	${HASH}
 #		$PATH.
 KSH_CONFLICTS=		pdksh
 KSH93_CONFLICTS=	ksh2020 ksh93 ast-ksh
+KSH93D_CONFLICTS=	ksh2020 ksh93 ast-ksh
 
 OPTIONS_DEFAULT=	KSH93 EXAMPLES
 OPTIONS_DEFINE=		EXAMPLES STATIC
 OPTIONS_SINGLE=		BIN_KSH
-OPTIONS_SINGLE_BIN_KSH=	KSH KSH93
+OPTIONS_SINGLE_BIN_KSH=	KSH KSH93 KSH93D
 KSH_DESC=		Install to ${PREFIX}/bin/ksh
 KSH93_DESC=		Install to ${PREFIX}/bin/ksh93
+KSH93D_DESC=		Install to ${PREFIX}/bin/ksh93d (development)
 
 CFLAGS+=	-DMAP_TYPE
 LDFLAGS+=	-lm
@@ -52,13 +54,14 @@ STATIC_MAKE_ENV=	LDFLAGS+=-static
 
 KSH_PLIST_SUB=		93=""
 KSH93_PLIST_SUB=	93="93"
+KSH93D_PLIST_SUB=	93="93d"
 
 .include <bsd.port.options.mk>
 
-.if ${PORT_OPTIONS:MKSH93}
-PNAME=		ksh93
-.else
-PNAME=		ksh
+.if ${PORT_OPTIONS:MKSH93D}
+PSUFFIX=	93d
+.elif ${PORT_OPTIONS:MKSH93}
+PSUFFIX=	93
 .endif
 
 post-patch:
@@ -68,10 +71,10 @@ do-build:
 	@cd ${WRKSRC}/ && ${SETENV} -i ${MAKE_ENV} ${SH} bin/package flat make
 
 do-install:
-	${INSTALL_PROGRAM} ${WRKSRC}/bin/ksh ${STAGEDIR}${PREFIX}/bin/${PNAME}
-	${INSTALL_MAN} ${WRKSRC}/man/man1/sh.1 ${STAGEDIR}${MAN1PREFIX}/man/man1/${PNAME}.1
-	${MKDIR} ${STAGEDIR}${EXAMPLESDIR}/
-	cd ${WRKSRC}/fun/ && ${INSTALL_SCRIPT} dirs popd pushd ${STAGEDIR}${EXAMPLESDIR}/
+	${INSTALL_PROGRAM} ${WRKSRC}/bin/ksh ${STAGEDIR}${PREFIX}/bin/ksh${PSUFFIX}
+	${INSTALL_MAN} ${WRKSRC}/man/man1/sh.1 ${STAGEDIR}${MAN1PREFIX}/man/man1/ksh${PSUFFIX}.1
+	${MKDIR} ${STAGEDIR}${EXAMPLESDIR}${PSUFFIX}/
+	cd ${WRKSRC}/fun/ && ${INSTALL_SCRIPT} dirs popd pushd ${STAGEDIR}${EXAMPLESDIR}${PSUFFIX}/
 
 do-test:
 	cd ${WRKSRC}/src/cmd/ksh93/tests/ && ${SETENV} SHELL=${WRKSRC}/bin/ksh ${WRKSRC}/bin/ksh shtests
diff --git a/shells/ksh-devel/pkg-plist b/shells/ksh-devel/pkg-plist
index 39bd9a3d8408..92209428c72c 100644
--- a/shells/ksh-devel/pkg-plist
+++ b/shells/ksh-devel/pkg-plist
@@ -1,6 +1,6 @@
 @shell bin/ksh%%93%%
 man/man1/ksh%%93%%.1.gz
-share/examples/ksh/dirs
-share/examples/ksh/popd
-share/examples/ksh/pushd
+share/examples/ksh%%93%%/dirs
+share/examples/ksh%%93%%/popd
+share/examples/ksh%%93%%/pushd
 
diff --git a/shells/ksh/Makefile b/shells/ksh/Makefile
index 1780a8047211..63c5bf1e506f 100644
--- a/shells/ksh/Makefile
+++ b/shells/ksh/Makefile
@@ -39,6 +39,7 @@ OPTIONS_SINGLE=		BIN_KSH
 OPTIONS_SINGLE_BIN_KSH=	KSH KSH93
 KSH_DESC=		Install to ${PREFIX}/bin/ksh
 KSH93_DESC=		Install to ${PREFIX}/bin/ksh93
+KSH93N_DESC=		Install to ${PREFIX}/bin/ksh93n (new)
 
 CFLAGS+=	-DMAP_TYPE
 LDFLAGS+=	-lm
@@ -48,13 +49,14 @@ STATIC_MAKE_ENV=	LDFLAGS+=-static
 
 KSH_PLIST_SUB=		93=""
 KSH93_PLIST_SUB=	93="93"
+KSH93N_PLIST_SUB=	93="93n"
 
 .include <bsd.port.options.mk>
 
-.if ${PORT_OPTIONS:MKSH93}
-PNAME=		ksh93
-.else
-PNAME=		ksh
+.if ${PORT_OPTIONS:MKSH93N}
+PSUFFIX=	93n
+.elif ${PORT_OPTIONS:MKSH93}
+PSUFFIX=	93
 .endif
 
 post-patch:
@@ -64,10 +66,10 @@ do-build:
 	@cd ${WRKSRC}/ && ${SETENV} -i ${MAKE_ENV} ${SH} bin/package flat make
 
 do-install:
-	${INSTALL_PROGRAM} ${WRKSRC}/bin/ksh ${STAGEDIR}${PREFIX}/bin/${PNAME}
-	${INSTALL_MAN} ${WRKSRC}/man/man1/sh.1 ${STAGEDIR}${MAN1PREFIX}/man/man1/${PNAME}.1
-	${MKDIR} ${STAGEDIR}${EXAMPLESDIR}/
-	cd ${WRKSRC}/fun/ && ${INSTALL_SCRIPT} dirs popd pushd ${STAGEDIR}${EXAMPLESDIR}/
+	${INSTALL_PROGRAM} ${WRKSRC}/bin/ksh ${STAGEDIR}${PREFIX}/bin/ksh${PSUFFIX}
+	${INSTALL_MAN} ${WRKSRC}/man/man1/sh.1 ${STAGEDIR}${MAN1PREFIX}/man/man1/ksh${PSUFFIX}.1
+	${MKDIR} ${STAGEDIR}${EXAMPLESDIR}${PSUFFIX}/
+	cd ${WRKSRC}/fun/ && ${INSTALL_SCRIPT} dirs popd pushd ${STAGEDIR}${EXAMPLESDIR}${PSUFFIX}/
 
 do-test:
 	cd ${WRKSRC}/src/cmd/ksh93/tests/ && ${SETENV} SHELL=${WRKSRC}/bin/ksh ${WRKSRC}/bin/ksh shtests
diff --git a/shells/ksh/pkg-plist b/shells/ksh/pkg-plist
index 39bd9a3d8408..92209428c72c 100644
--- a/shells/ksh/pkg-plist
+++ b/shells/ksh/pkg-plist
@@ -1,6 +1,6 @@
 @shell bin/ksh%%93%%
 man/man1/ksh%%93%%.1.gz
-share/examples/ksh/dirs
-share/examples/ksh/popd
-share/examples/ksh/pushd
+share/examples/ksh%%93%%/dirs
+share/examples/ksh%%93%%/popd
+share/examples/ksh%%93%%/pushd
 
diff --git a/shells/ksh93/Makefile b/shells/ksh93/Makefile
index 964940deabed..7bfbe64740b8 100644
--- a/shells/ksh93/Makefile
+++ b/shells/ksh93/Makefile
@@ -39,9 +39,10 @@ KSH93_CONFLICTS=	ksh2020 ksh93-devel ast-ksh
 OPTIONS_DEFAULT=	KSH93 EXAMPLES
 OPTIONS_DEFINE=		EXAMPLES STATIC
 OPTIONS_SINGLE=		BIN_KSH
-OPTIONS_SINGLE_BIN_KSH=	KSH KSH93
+OPTIONS_SINGLE_BIN_KSH=	KSH KSH93 KSH93L
 KSH_DESC=		Install to ${PREFIX}/bin/ksh
 KSH93_DESC=		Install to ${PREFIX}/bin/ksh93
+KSH93L_DESC=		Install to ${PREFIX}/bin/ksh93l (legacy)
 
 CFLAGS+=	-DMAP_TYPE
 LDFLAGS+=	-lm
@@ -51,6 +52,7 @@ STATIC_MAKE_ENV=	LDFLAGS+=-static
 
 KSH_PLIST_SUB=		93=""
 KSH93_PLIST_SUB=	93="93"
+KSH93L_PLIST_SUB=	93="93l"
 
 .include <bsd.port.pre.mk>
 
@@ -58,7 +60,10 @@ KSH93_PLIST_SUB=	93="93"
 BROKEN=	GCC 9.1 changes the output of `gcc -E` which breaks the conf.sh script, fixed in shells/ksh93-devel
 .endif
 
-.if ${PORT_OPTIONS:MKSH93}
+.if ${PORT_OPTIONS:MKSH93L}
+PNAME=		ksh93l
+PSUFFIX=	l
+.elif ${PORT_OPTIONS:MKSH93}
 PNAME=		ksh93
 .else
 PNAME=		ksh
@@ -73,8 +78,8 @@ do-build:
 do-install:
 	${INSTALL_PROGRAM} ${WRKSRC}/bin/ksh ${STAGEDIR}${PREFIX}/bin/${PNAME}
 	${INSTALL_MAN} ${WRKSRC}/man/man1/sh.1 ${STAGEDIR}${MAN1PREFIX}/man/man1/${PNAME}.1
-	${MKDIR} ${STAGEDIR}${EXAMPLESDIR}/
-	cd ${WRKSRC}/fun/ && ${INSTALL_SCRIPT} dirs popd pushd ${STAGEDIR}${EXAMPLESDIR}/
+	${MKDIR} ${STAGEDIR}${EXAMPLESDIR}${PSUFFIX}/
+	cd ${WRKSRC}/fun/ && ${INSTALL_SCRIPT} dirs popd pushd ${STAGEDIR}${EXAMPLESDIR}${PSUFFIX}/
 
 do-test:
 	cd ${WRKSRC}/src/cmd/ksh93/tests/ && ${SETENV} SHELL=${WRKSRC}/bin/ksh ${WRKSRC}/bin/ksh shtests
diff --git a/shells/ksh93/pkg-plist b/shells/ksh93/pkg-plist
index 86dc0057f028..92209428c72c 100644
--- a/shells/ksh93/pkg-plist
+++ b/shells/ksh93/pkg-plist
@@ -1,6 +1,6 @@
 @shell bin/ksh%%93%%
 man/man1/ksh%%93%%.1.gz
-share/examples/ksh93/dirs
-share/examples/ksh93/popd
-share/examples/ksh93/pushd
+share/examples/ksh%%93%%/dirs
+share/examples/ksh%%93%%/popd
+share/examples/ksh%%93%%/pushd