Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Jan 2001 04:23:03 +0100
From:      Christian Weisgerber <naddy@mips.inka.de>
To:        freebsd-ports@freebsd.org
Subject:   First draft of ksh93 port
Message-ID:  <20010101042303.A6421@kemoauc.mips.inka.de>

next in thread | raw e-mail | index | archive | help

--7JfCtLOvnd9MIVvH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Here's a first draft of a ksh93 source port.

Unresolved issues so far:

1. License.

2. Correctness.
   I haven't run any regression tests yet, as they depend on nmake
   which requires building the whole ast-open package.

3. Completeness.
   The port only installs the shell executable itself and the man
   page.  Notable omissions: the shcomp and suid_exec programs (no
   idea what those do) and libshell (using it requires some header
   files that depend on further header files--eventually we would
   pull in all of libast, which seems excessive).

Acknowledgements:  Cyrille Lefevre, for the essential patch to
src/lib/libast/features/limits.c.

Building this port produces hundreds of compiler warnings.  Almost
all of these derive from the same few header files and are harmless.
I'm on alpha; i386 shouldn't pose any additional problems.

-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de

--7JfCtLOvnd9MIVvH
Content-Type: application/x-shar
Content-Disposition: attachment; filename="ksh93.shar"

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	ksh93
#	ksh93/Makefile
#	ksh93/pkg-comment
#	ksh93/distinfo
#	ksh93/pkg-descr
#	ksh93/pkg-plist
#	ksh93/files
#	ksh93/files/patch-src_cmd_INIT_package.sh
#	ksh93/files/patch-src_cmd_INIT_mamake.c
#	ksh93/files/patch-src_cmd_INIT_proto.c
#	ksh93/files/patch-src_cmd_ksh93_Mamefile
#	ksh93/files/patch-src_cmd_ksh93_sh.1
#	ksh93/files/patch-src_lib_libast_vmalloc_vmhdr.h
#	ksh93/files/patch-src_lib_libast_features_sfio
#	ksh93/files/patch-src_lib_libast_features_limits.c
#
echo c - ksh93
mkdir -p ksh93 > /dev/null 2>&1
echo x - ksh93/Makefile
sed 's/^X//' >ksh93/Makefile << 'END-of-ksh93/Makefile'
X# New ports collection makefile for:   ksh93
X# Date created:                2000-12-26
X# Whom:                        Christian Weisgerber <naddy@mips.inka.de>
X#
X# $FreeBSD$
X
XPORTNAME=	ksh93
XPORTVERSION= 	${DISTVERSION:S/-//g}
XCATEGORIES=	x11
XMASTER_SITES=	http://www.research.att.com/~gsf/download/tgz/
X
XMAINTAINER=	Christian Weisgerber <naddy@mips.inka.de>
X
XRESTRICTED=	unclear license
XIS_INTERACTIVE=	user must explicitly acknowledge license
X
XDISTVERSION=	2000-10-31.0000
XDISTNAME=	${PORTNAME}-${DISTVERSION}
XDISTFILES=	INIT.${DISTVERSION}.tgz ast-ksh.${DISTVERSION}.tgz
XEXTRACT_ONLY=	INIT.${DISTVERSION}.tgz
X
XNO_WRKSUBDIR=	yes
X
XMAN1=		ksh93.1
X
X.if !defined(I_AGREE)
Xpre-fetch:
X	@${ECHO_MSG}
X	@${ECHO_MSG} "Please read AT&T's Source Code License Agreement at"
X	@${ECHO_MSG} "http://www.research.att.com/sw/license/ast-open.html"
X	@${ECHO_MSG} "If you agree with AT&T's terms, restart building"
X	@${ECHO_MSG} "with \"make -DI_AGREE\"."
X	@${ECHO_MSG}
X	@exit 1
X.endif
X
Xpost-extract:
X	@${PERL} -i -pe 'undef $$_ if /^if\texecutable pax/ .. /^fi/' \
X	    ${WRKSRC}/bin/package
X	@${MKDIR} ${WRKSRC}/lib/package/tgz
X.for file in ast-ksh.${DISTVERSION}.tgz ast-ksh-locale.${DISTVERSION}.tgz
X	@${LN} -s ${DISTDIR}/${file} ${WRKSRC}/lib/package/tgz/${file}
X.endfor
X	@cd ${WRKSRC}; bin/package read >/dev/null
X
Xdo-build:
X	@cd ${WRKSRC}; bin/package make CC='${CC}' CCFLAGS='${CFLAGS}'
X
Xdo-install:
X	${INSTALL_PROGRAM} ${WRKSRC}/arch/freebsd.${ARCH}/bin/ksh \
X	    ${PREFIX}/bin/ksh93
X	${INSTALL_MAN} ${WRKSRC}/arch/freebsd.${ARCH}/man/man1/sh.1 \
X	    ${PREFIX}/man/man1/ksh93.1
X
X.include <bsd.port.mk>
END-of-ksh93/Makefile
echo x - ksh93/pkg-comment
sed 's/^X//' >ksh93/pkg-comment << 'END-of-ksh93/pkg-comment'
XThe official AT&T release of KornShell 93
END-of-ksh93/pkg-comment
echo x - ksh93/distinfo
sed 's/^X//' >ksh93/distinfo << 'END-of-ksh93/distinfo'
XMD5 (INIT.2000-10-31.0000.tgz) = 1170436abf4d9b354ad10c94a569d8ad
XMD5 (ast-ksh.2000-10-31.0000.tgz) = 77472b89f667750c455dbe8a8321364c
END-of-ksh93/distinfo
echo x - ksh93/pkg-descr
sed 's/^X//' >ksh93/pkg-descr << 'END-of-ksh93/pkg-descr'
XKSH-93 is the most recent version of the KornShell Language described
Xin "The KornShell Command and Programming Language," by Morris
XBolsky and David Korn of AT&T Bell Laboratories.  The KornShell is
Xa shell programming language, which is upward compatible with "sh"
X(the Bourne Shell), and is intended to conform to the IEEE P1003.2/ISO
X9945.2 Shell and Utilities standard.  KSH-93 provides an enhanced
Xprogramming environment in addition to the major command-entry
Xfeatures of the BSD shell "csh".  With KSH-93, medium-sized programming
Xtasks can be performed at shell-level without a significant loss
Xin performance.  In addition, "sh" scripts can be run on KSH-93
Xwithout modification.
X
XWWW: http://www.kornshell.com/
END-of-ksh93/pkg-descr
echo x - ksh93/pkg-plist
sed 's/^X//' >ksh93/pkg-plist << 'END-of-ksh93/pkg-plist'
X@comment $FreeBSD$
Xbin/ksh93
X@exec echo "updating /etc/shells"; cp /etc/shells /etc/shells.bak; (grep -v %D/%F /etc/shells.bak; echo %D/%F) >/etc/shells
X@unexec echo "updating /etc/shells"; cp /etc/shells /etc/shells.bak; (grep -v %D/%F /etc/shells.bak) >/etc/shells
END-of-ksh93/pkg-plist
echo c - ksh93/files
mkdir -p ksh93/files > /dev/null 2>&1
echo x - ksh93/files/patch-src_cmd_INIT_package.sh
sed 's/^X//' >ksh93/files/patch-src_cmd_INIT_package.sh << 'END-of-ksh93/files/patch-src_cmd_INIT_package.sh'
X--- src/cmd/INIT/package.sh.orig	Mon Nov 13 15:21:36 2000
X+++ src/cmd/INIT/package.sh	Thu Dec 28 18:26:19 2000
X@@ -1972,11 +1972,6 @@
X # $INSTALLROOT may be an obsolete shipment
X 
X PAX=
X-if	executable pax
X-then	case `pax --?meter 2>&1` in
X-	*--meter*)	PAX=pax ;;
X-	esac
X-fi
X 
X # finalize the views
X 
END-of-ksh93/files/patch-src_cmd_INIT_package.sh
echo x - ksh93/files/patch-src_cmd_INIT_mamake.c
sed 's/^X//' >ksh93/files/patch-src_cmd_INIT_mamake.c << 'END-of-ksh93/files/patch-src_cmd_INIT_mamake.c'
X--- src/cmd/INIT/mamake.c.orig	Fri Sep 22 00:38:32 2000
X+++ src/cmd/INIT/mamake.c	Thu Dec 28 18:26:19 2000
X@@ -98,6 +98,8 @@
X #endif
X 
X #include <stdio.h>
X+#include <stdlib.h>
X+#include <string.h>
X #include <unistd.h>
X #include <ctype.h>
X #include <sys/types.h>
END-of-ksh93/files/patch-src_cmd_INIT_mamake.c
echo x - ksh93/files/patch-src_cmd_INIT_proto.c
sed 's/^X//' >ksh93/files/patch-src_cmd_INIT_proto.c << 'END-of-ksh93/files/patch-src_cmd_INIT_proto.c'
X--- src/cmd/INIT/proto.c.orig	Thu Oct 26 16:00:44 2000
X+++ src/cmd/INIT/proto.c	Thu Dec 28 18:26:19 2000
X@@ -1531,6 +1531,7 @@
X 
X 
X 
X+extern __MANGLE__ __V_*		realloc __PROTO__((__V_*, int));
X extern __MANGLE__ __V_*		calloc __PROTO__((int, int));
X extern __MANGLE__ char*		ctime __PROTO__((time_t*));
X extern __MANGLE__ void		free __PROTO__((__V_*));
X@@ -3965,7 +3966,7 @@
X 	if ((n = ip - bp - 1) > 0)
X 	{
X 		ip = bp;
X-		do switch( n) { default : memcpy( op, ip, n); op += n; ip += n; break; case 7 : * op++ = * ip++; case 6 : * op++ = * ip++; case 5 : * op++ = * ip++; case 4 : * op++ = * ip++; case 3 : * op++ = * ip++; case 2 : * op++ = * ip++; case 1 : * op++ = * ip++; case 0 : break; } while (0);
X+		do switch( n) { default : memcopy( op, ip, n); op += n; ip += n; break; case 7 : * op++ = * ip++; case 6 : * op++ = * ip++; case 5 : * op++ = * ip++; case 4 : * op++ = * ip++; case 3 : * op++ = * ip++; case 2 : * op++ = * ip++; case 1 : * op++ = * ip++; case 0 : break; } while (0);
X 		ip++;
X 	}
X 	state = ~state;
X@@ -5835,11 +5836,11 @@
X 				pppclose(b);
X 				return flags | ((1<<13)<<0);
X 			}
X-			strcpy(buf, copy);
X+			strcopy(buf, copy);
X 			e = buf + n;
X 			if (*file != '/')
X 				*e++ = '/';
X-			strcpy(e, file);
X+			strcopy(e, file);
X 			if ((fd = creat(buf, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)) < 0)
X 			{
X 				for (e = buf; *e == '/'; e++);
X@@ -5882,7 +5883,7 @@
X 		if (file && (flags & ((1<<13)<<1)))
X 		{
X 			*e = '_';
X-			strcpy(b, file);
X+			strcopy(b, file);
X 			*e = x;
X 			if (replace(b, file, !(flags & (1<<0))))
X 				proto_error(b, 2, "cannot rename to", file);
X@@ -5977,7 +5978,7 @@
X 				else
X 				{
X 					*op++ = '\n';
X-					memcpy(op, b, n + 1);
X+					memcopy(op, b, n + 1);
X 					op += n;
X 				}
X 				break;
END-of-ksh93/files/patch-src_cmd_INIT_proto.c
echo x - ksh93/files/patch-src_cmd_ksh93_Mamefile
sed 's/^X//' >ksh93/files/patch-src_cmd_ksh93_Mamefile << 'END-of-ksh93/files/patch-src_cmd_ksh93_Mamefile'
X--- src/cmd/ksh93/Mamfile.orig	Mon Nov 13 16:56:53 2000
X+++ src/cmd/ksh93/Mamfile	Thu Dec 28 18:26:19 2000
X@@ -1111,12 +1111,12 @@
X done sh/shcomp.c
X prev sh/shcomp.c
X setv _BLD_shell -U_BLD_shell
X-exec - ${CC} -O  -I. -Iinclude -I${INSTALLROOT}/include/ast -DSH_DICT='(void*)e_dict' -DKSHELL -D_PACKAGE_ast -DSHOPT_SUID_EXEC -DSHOPT_VSH -DSHOPT_ESH -c sh/shcomp.c
X+exec - ${CC} ${CCFLAGS} -I. -Iinclude -I${INSTALLROOT}/include/ast -DSH_DICT='(void*)e_dict' -DKSHELL -D_PACKAGE_ast -DSHOPT_SUID_EXEC -DSHOPT_VSH -DSHOPT_ESH -c sh/shcomp.c
X done shcomp.o generated
X prev libshell.a archive
X setv mam_libshell `sed -e 's,-lshell,libshell.a,' shell.req`
X prev ${mam_libdl}
X-exec - ${CC} -O ${LDFLAGS} ${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib}  -o shcomp shcomp.o ${mam_libshell} ${mam_libm} ${mam_cc_static}  ${mam_cc_dynamic} ${mam_libast}
X+exec - ${CC} ${CCFLAGS} ${LDFLAGS} ${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib}  -o shcomp shcomp.o ${mam_libshell} ${mam_libm} ${mam_cc_static}  ${mam_cc_dynamic} ${mam_libast}
X done shcomp generated
X make sh/suid_exec.c
X prev ${INSTALLROOT}/include/ast/error.h implicit
X@@ -1133,10 +1133,10 @@
X make suid_exec.o
X prev sh/suid_exec.c
X prev sh/suid_exec.c
X-exec - ${CC} -O  -I. -I${INSTALLROOT}/include/ast -D_PACKAGE_ast -c sh/suid_exec.c
X+exec - ${CC} ${CCFLAGS} -I. -I${INSTALLROOT}/include/ast -D_PACKAGE_ast -c sh/suid_exec.c
X done suid_exec.o generated
X prev ${mam_libdl}
X-exec - ${CC} -O ${LDFLAGS} ${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib}  -o suid_exec suid_exec.o ${mam_cc_static} ${mam_libast} ${mam_cc_dynamic} ${mam_libm} ${mam_cc_static}  ${mam_cc_dynamic} ${mam_libast}
X+exec - ${CC} ${CCFLAGS} ${LDFLAGS} ${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib}  -o suid_exec suid_exec.o ${mam_cc_static} ${mam_libast} ${mam_cc_dynamic} ${mam_libm} ${mam_cc_static}  ${mam_cc_dynamic} ${mam_libast}
X done suid_exec generated
X make ${INSTALLROOT}/bin
X exec - set -
END-of-ksh93/files/patch-src_cmd_ksh93_Mamefile
echo x - ksh93/files/patch-src_cmd_ksh93_sh.1
sed 's/^X//' >ksh93/files/patch-src_cmd_ksh93_sh.1 << 'END-of-ksh93/files/patch-src_cmd_ksh93_sh.1'
X--- src/cmd/ksh93/sh.1.orig	Wed Dec 27 23:10:30 2000
X+++ src/cmd/ksh93/sh.1	Wed Dec 27 23:10:44 2000
X@@ -4,7 +4,7 @@
X .\"
X .\" @(#)sh.1 (research!dgk) 12/28/93
X .\"
X-.nr Z 0 \" set to 1 when command name is ksh rather than sh
X+.nr Z 1 \" set to 1 when command name is ksh rather than sh
X .nr Y 0 \" set to 1 for R&D UNIX
X .if \nY=1 .nr Z 1
X .ds OK [\|
END-of-ksh93/files/patch-src_cmd_ksh93_sh.1
echo x - ksh93/files/patch-src_lib_libast_vmalloc_vmhdr.h
sed 's/^X//' >ksh93/files/patch-src_lib_libast_vmalloc_vmhdr.h << 'END-of-ksh93/files/patch-src_lib_libast_vmalloc_vmhdr.h'
X--- src/lib/libast/vmalloc/vmhdr.h.orig	Thu Dec 28 00:07:39 2000
X+++ src/lib/libast/vmalloc/vmhdr.h	Thu Dec 28 00:08:18 2000
X@@ -56,12 +56,12 @@
X #include	<ast_common.h>
X #include	"FEATURE/vmalloc"
X 
X+#endif /*_PACKAGE_ast*/
X+
X #if !_UWIN
X #define _npt_getpagesize	1
X #define _npt_sbrk		1
X #endif
X-
X-#endif /*_PACKAGE_ast*/
X 
X #undef free
X #undef malloc
END-of-ksh93/files/patch-src_lib_libast_vmalloc_vmhdr.h
echo x - ksh93/files/patch-src_lib_libast_features_sfio
sed 's/^X//' >ksh93/files/patch-src_lib_libast_features_sfio << 'END-of-ksh93/files/patch-src_lib_libast_features_sfio'
X--- src/lib/libast/features/sfio.orig	Thu Dec 28 02:40:45 2000
X+++ src/lib/libast/features/sfio	Thu Dec 28 02:40:52 2000
X@@ -1,4 +1,4 @@
X-hdr	float,floatingpoint,math,values
X+hdr	float,floatingpoint,math
X sys	filio,ioctl
X lib	qfrexp,qldexp
X 
END-of-ksh93/files/patch-src_lib_libast_features_sfio
echo x - ksh93/files/patch-src_lib_libast_features_limits.c
sed 's/^X//' >ksh93/files/patch-src_lib_libast_features_limits.c << 'END-of-ksh93/files/patch-src_lib_libast_features_limits.c'
X--- src/lib/libast/features/limits.c.orig	Tue Feb  9 15:23:43 1999
X+++ src/lib/libast/features/limits.c	Thu Dec 28 19:35:20 2000
X@@ -122,6 +122,7 @@
X 	while (uc >>= 1) val++;
X #endif
X 	printf("#define CHAR_BIT	%lu\n", val);
X+#undef MB_LEN_MAX
X #ifdef MB_LEN_MAX
X 	val = MB_LEN_MAX;
X 	printf("#undef	MB_LEN_MAX\n");
X@@ -392,6 +393,9 @@
X #endif
X #ifdef	_LIMITS_H_
X 	printf("#define _LIMITS_H_\n");
X+#endif
X+#ifdef	_MACHINE_LIMITS_H
X+	printf("#define _MACHINE_LIMITS_H_");
X #endif
X #ifdef	__LIMITS_H
X 	printf("#define __LIMITS_H\n");
END-of-ksh93/files/patch-src_lib_libast_features_limits.c
exit


--7JfCtLOvnd9MIVvH--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010101042303.A6421>