- #
- # ksh93.cygport
- #
- # Copyright (C) 2024 Roland Mainz <roland.mainz@nrubsig.org>
- #
- # This file is free software; I give unlimited permission to copy and/or
- # distribute it, with or without modifications, as long as this notice is
- # preserved.
- #
- NAME=astksh
- LICENSE="Eclipse Public License - v 2.0"
- HOMEPAGE="https://github.com/ksh93/ksh"
- VERSION=1.0.8
- RELEASE=0
- PKG_NAMES="astksh astksh_devel"
- astksh_SUMMARY="The AT&T Korn Shell"
- astksh_DESCRIPTION="Original version of the AT&T AST Korn Shell 93."
- astksh_CATEGORY="Base Shells"
- astksh_CONTENTS=" \
- bin/ksh.exe \
- bin/ksh93.exe \
- bin/rksh.exe \
- bin/rksh93.exe \
- etc/ksh.kshrc \
- usr/share/doc/astksh \
- usr/share/man/man1 \
- "
- astksh_devel_SUMMARY="Development files for AT&T ksh"
- astksh_devel_DESCRIPTION="This package contains development tools and scripts for AT&T ksh"
- astksh_devel_CATEGORY="Devel"
- astksh_devel_CONTENTS="usr/share/ksh \
- bin/shcomp.exe \
- "
- SRC_URI="https://github.com/ksh93/ksh/archive/refs/tags/v1.0.8.zip"
- SRC_DIR='./ksh-1.0.8/'
- PATCH_URI_BASE=""
- BUILD_REQUIRES=" \
- bash \
- coreutils \
- bison \
- gcc-g++ \
- libiconv-devel \
- libintl-devel \
- libncurses-devel \
- make \
- sed \
- texinfo \
- "
- CPPFLAGS=
- CYGCONF_ARGS=
- DIFF_EXCLUDES=
- DOCS=
- function print_gnulinux_builtin_header
- {
- # Make sure to use \\ instead of \ for continuations
- cat <<ENDOFTEXT
- #ifndef _GNULINUX_KSH_CMDLIST_H
- #define _GNULINUX_KSH_CMDLIST_H
- #ifdef __cplusplus
- extern "C" {
- #endif
- /*
- * List builtins for Linux.
- * The list here is partially autogenerated and partially hand-picked
- * based on compatibility with the native GNU coreutils versions of
- * these tools
- */
- /* GNU coreutils compatible commands.
- * Be careful, some are in /bin while others are in /usr/bin
- */
- #define ASTCMDLIST(f) \
- { "/usr/ast/bin/" #f, NV_BLTIN|NV_BLTINOPT|NV_NOFREE, bltin(f) },
- #define BINCMDLIST(f) \
- { "/bin/" #f, NV_BLTIN|NV_BLTINOPT|NV_NOFREE, bltin(f) }, \
- { "/usr/bin/" #f, NV_BLTIN|NV_BLTINOPT|NV_NOFREE, bltin(f) },
- /* undo ast_map.h #defines to avoid collision */
- #undef basename
- #undef chmod
- #undef chown
- #undef dirname
- #undef mkdir
- #undef mkfifo
- #undef mktemp
- #undef readlink
- #undef realpath
- #undef rmdir
- /* Generated data, do not edit. */
- BINCMDLIST(basename)
- BINCMDLIST(cksum)
- BINCMDLIST(comm)
- BINCMDLIST(cut)
- BINCMDLIST(dirname)
- BINCMDLIST(expr)
- BINCMDLIST(fold)
- BINCMDLIST(join)
- BINCMDLIST(logname)
- BINCMDLIST(mkdir)
- BINCMDLIST(mkfifo)
- BINCMDLIST(mktemp)
- BINCMDLIST(paste)
- BINCMDLIST(pathchk)
- BINCMDLIST(rev)
- BINCMDLIST(rmdir)
- BINCMDLIST(sleep)
- BINCMDLIST(sync)
- BINCMDLIST(tee)
- BINCMDLIST(tty)
- BINCMDLIST(uniq)
- BINCMDLIST(wc)
- /* Mandatory for ksh93 test suite and AST scripts */
- BINCMDLIST(getconf)
- ASTCMDLIST(basename)
- ASTCMDLIST(cat)
- ASTCMDLIST(chgrp)
- ASTCMDLIST(chmod)
- ASTCMDLIST(chown)
- ASTCMDLIST(cksum)
- ASTCMDLIST(cmp)
- ASTCMDLIST(comm)
- ASTCMDLIST(cp)
- ASTCMDLIST(cut)
- ASTCMDLIST(date)
- ASTCMDLIST(dirname)
- //BINCMDLIST(egrep)
- //ASTCMDLIST(egrep)
- ASTCMDLIST(expr)
- ASTCMDLIST(fds)
- //BINCMDLIST(fgrep)
- //ASTCMDLIST(fgrep)
- ASTCMDLIST(fmt)
- ASTCMDLIST(fold)
- //BINCMDLIST(grep)
- //ASTCMDLIST(grep)
- ASTCMDLIST(head)
- ASTCMDLIST(id)
- //BINCMDLIST(iconv)
- //ASTCMDLIST(iconv)
- ASTCMDLIST(join)
- ASTCMDLIST(ln)
- ASTCMDLIST(logname)
- //ASTCMDLIST(ls)
- ASTCMDLIST(md5sum)
- BINCMDLIST(md5sum)
- ASTCMDLIST(mkdir)
- ASTCMDLIST(mkfifo)
- ASTCMDLIST(mktemp)
- ASTCMDLIST(mv)
- ASTCMDLIST(paste)
- ASTCMDLIST(pathchk)
- ASTCMDLIST(pids)
- //BINCMDLIST(od)
- //ASTCMDLIST(od)
- //BINCMDLIST(readlink)
- //ASTCMDLIST(readlink)
- //BINCMDLIST(realpath)
- //ASTCMDLIST(realpath)
- ASTCMDLIST(rev)
- ASTCMDLIST(rm)
- ASTCMDLIST(rmdir)
- ASTCMDLIST(stty)
- //ASTCMDLIST(sha1sum)
- //BINCMDLIST(sha1sum)
- //ASTCMDLIST(sha256sum)
- //BINCMDLIST(sha256sum)
- //ASTCMDLIST(sha384sum)
- //BINCMDLIST(sha384sum)
- //ASTCMDLIST(sha512sum)
- //BINCMDLIST(sha512sum)
- ASTCMDLIST(sum)
- ASTCMDLIST(sync)
- ASTCMDLIST(tail)
- ASTCMDLIST(tee)
- //BINCMDLIST(tr)
- //ASTCMDLIST(tr)
- ASTCMDLIST(tty)
- ASTCMDLIST(uname)
- ASTCMDLIST(uniq)
- //ASTCMDLIST(vmstate)
- ASTCMDLIST(wc)
- // ASTCMDLIST(xgrep)
- //BINCMDLIST(xargs)
- //ASTCMDLIST(xargs)
- #ifdef __cplusplus
- }
- #endif
- #endif /* !_GNULINUX_KSH_CMDLIST_H */
- ENDOFTEXT
- return 0
- }
- src_compile()
- {
- cd ${S}
- #
- # prepare build
- #
- # translate cygport ARCH to AST hosttype
- if [[ "$ARCH" == 'i686' ]] ; then
- ast_hosttype='cygwin.i386'
- elif [[ "$ARCH" == 'x86_64' ]] ; then
- ast_hosttype='cygwin.i386-64'
- else
- false
- fi
- gnulinux_builtin_header="${PWD}/tmp_gnulinux_builtin_header.h"
- print_gnulinux_builtin_header >"${gnulinux_builtin_header}"
- # ksh93+AST config flags
- bast_flags="-DSHOPT_CMDLIB_BLTIN=0 -DSH_CMDLIB_DIR=\\\"/usr/ast/bin\\\" -DSHOPT_CMDLIB_HDR=\\\"${gnulinux_builtin_header}\\\" -DSHOPT_SYSRC"
- # build debug
- #export IFFEFLAGS=-d1
- # fix build issues with mkfifo
- sed -i -r 's/mkfifo.+?(-m [[:digit:]]+)/mkfifo /g' ./src/cmd/INIT/package.sh ./bin/package
- #
- # build AT&T AST ksh
- #
- if [[ "$ARCH" == 'i686' ]] ; then
- export SHELL=/bin/bash HOSTTYPE="${ast_hosttype}"; \
- /bin/bash ./bin/package make \
- CC="/usr/bin/gcc -m32 -std=gnu17" CCFLAGS="-Os -g ${bast_flags}" SHELL="$SHELL" HOSTTYPE="$HOSTTYPE"
- elif [[ "$ARCH" == 'x86_64' ]] ; then
- export SHELL=/bin/bash HOSTTYPE="${ast_hosttype}"; \
- /bin/bash ./bin/package make \
- CC="/usr/bin/gcc -m64 -std=gnu17" CCFLAGS="-Os -g ${bast_flags}" SHELL="$SHELL" HOSTTYPE="$HOSTTYPE"
- else
- # unsupported arch!
- false
- fi
- #
- # create ksh.kshrc
- #
- {
- printf '#\n# /etc/ksh.kshrc+~/.kshrc are sourced only for interactive shells\n#\n\n'
- printf '# default prompt\n'
- printf 'PS1=%q\n' $'\E[32m$(/usr/bin/logname)@$(/usr/bin/hostname) \E[33m${PWD/~(Sl-r)$HOME/"~"}\E[0m\n$ '
- printf '# default editor mode\n'
- printf 'set -o gmacs\n'
- } >${S}/etc_ksh_kshrc
- }
- #
- # install ksh, rksh, shcomp
- #
- src_install()
- {
- if [[ "$ARCH" == 'i686' ]] ; then
- ast_hosttype='cygwin.i386'
- elif [[ "$ARCH" == 'x86_64' ]] ; then
- ast_hosttype='cygwin.i386-64'
- else
- false
- fi
- /usr/bin/install -D -m0755 ${S}/arch/${ast_hosttype}/bin/ksh.exe ${D}/bin/ksh.exe
- ln ${D}/bin/ksh.exe ${D}/bin/rksh.exe
- ln ${D}/bin/ksh.exe ${D}/bin/ksh93.exe
- ln ${D}/bin/ksh.exe ${D}/bin/rksh93.exe
- /usr/bin/install -D -m0755 ${S}/arch/${ast_hosttype}/bin/ksh.exe ${D}/bin/shcomp.exe
- /usr/bin/install -D -m0644 ${S}/arch/${ast_hosttype}/man/man1/sh.1 ${D}/usr/share/man/man1/ksh.1
- /usr/bin/install -D -m0644 ${S}/etc_ksh_kshrc ${D}/etc/ksh.kshrc
- for i in ${S}/src/cmd/ksh93/tests/* ; do
- /usr/bin/install -D -m0644 $i ${D}/usr/share/ksh/tests/$(basename "$i")
- done
- }
- CYGWIN_MAINTAINER=Roland%20Mainz
- CYGWIN_MAINTAINER_EMAIL=roland.mainz@nrubsig.org
- CYGWIN_CO_MAINTAINER=Cedric%20Blancher
- CYGWIN_CO_MAINTAINER_EMAIL=cedric.blancher@gmail.com
- # EOF.
ksh93.cygport prototype
Posted by Anonymous on Mon 5th Feb 2024 14:32
raw | new post
modification of post by Anonymous (view diff)
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.