# # ksh93.cygport # # Copyright (C) 2024 Roland Mainz # # 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.10 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.10.zip" SRC_DIR='./ksh-1.0.10/' PATCH_URI="" #PATCH_URI+=" ksh_1_0_8_libast_Cygwin_set_PATH_LEADING_SLASHES_for_UNC_paths.patch" #PATCH_URI+=" ksh_1_0_9_mamake_bootstrap.patch" 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 <"${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 if false ; then # ksh93 v1.0.8 sed -i -r 's/mkfifo.+?(-m [[:digit:]]+)/mkfifo /g' ./src/cmd/INIT/package.sh ./bin/package else # ksh93 >= v1.0.9 sed -i -r 's/mkfifo.+?(-m [[:digit:]]+)/mkfifo /g' ./bin/package fi # # 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' printf '# /etc/ksh.kshrc+~/.kshrc are sourced only for interactive shells\n' printf '#\n' printf '\n' printf 'function _ksh_kshrc_is_windows_admin_account\n' printf '{\n' printf ' #\n' printf ' # Test whether we have the Windows permissions to install DLLs\n' printf ' # and the kernel module\n' printf ' #\n' printf ' # Usually Windows Adminstrator rights are indicated by the\n' printf ' # membership in group "544(Administratoren)" (Cygwin maps\n' printf ' # "SID S-1-5-32-544" to GID 544)\n' printf ' #\n' printf ' if [[ "$(/usr/bin/id -G)" =~ (^|[[:space:]]+)544([[:space:]]+|$) ]] ; then\n' printf ' return 0\n' printf ' fi\n' printf ' return 1\n' printf '}\n' printf '\n' printf '# default prompt\n' printf 'if _ksh_kshrc_is_windows_admin_account ; then\n' printf ' PS1=$'\''\\E[1;91m$(/usr/bin/logname)@$(/usr/bin/hostname) \\E[1;33m${PWD/~(Sl-r)$HOME/"~"}\\E[0m\\n$ '\''\n' printf 'else\n' printf ' PS1=$'\''\\E[1;32m$(/usr/bin/logname)@$(/usr/bin/hostname) \\E[1;33m${PWD/~(Sl-r)$HOME/"~"}\\E[0m\\n$ '\''\n' printf 'fi\n' printf '\n' printf '# default editor mode\n' printf 'set -o gmacs\n' printf '\n' printf '# EOF.\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.