From 80b0222532e123225cece4dc18f6b0fca772ebaf Mon Sep 17 00:00:00 2001 From: nbd Date: Fri, 12 Jun 2009 20:24:16 +0000 Subject: [PATCH] upgrade mksh to R38c (patch from #5332) git-svn-id: svn://svn.openwrt.org/openwrt/packages@16428 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- utils/mksh/Makefile | 45 ++++++++++++++++++++----------- utils/mksh/patches/100-dot_mkshrc | 39 ++++++++++++++------------- 2 files changed, 49 insertions(+), 35 deletions(-) diff --git a/utils/mksh/Makefile b/utils/mksh/Makefile index cae6213a4..6828ab64c 100644 --- a/utils/mksh/Makefile +++ b/utils/mksh/Makefile @@ -1,5 +1,6 @@ -# +# # Copyright (C) 2007-2008 OpenWrt.org +# Copyright (c) 2009 Thorsten Glaser # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -8,43 +9,55 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mksh -PKG_VERSION:=R33d +PKG_VERSION:=38c PKG_RELEASE:=1 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).cpio.gz +PKG_SOURCE:=$(PKG_NAME)-R$(PKG_VERSION).cpio.gz PKG_SOURCE_URL:=http://www.mirbsd.org/MirOS/dist/mir/mksh -PKG_MD5SUM:=8ad2547ad55dc3a02b13554ab9b5c9c8 +PKG_MD5SUM:=692192a6468b5f5c5e559756f1851766 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) include $(INCLUDE_DIR)/package.mk -# This program seems to depend on libssp, but only for GCC 4 -GCCVER:=$(if $(DUMP),4,$(word 1,$(subst ., ,$(subst ",,$(CONFIG_GCC_VERSION))))) -#")))) -ifeq ($(GCCVER),4) - DEP:=+libssp -else - DEP:= -endif - define Package/mksh SECTION:=shells CATEGORY:=Base system - TITLE:=mksh + TITLE:=MirBSD Korn Shell DEPENDS:=$(DEP) endef define Package/mksh/description -MirBSD version of ksh +mksh is the MirBSD enhanced version of the Public Domain Korn +shell (pdksh), a Bourne-compatible shell which is largely si- +milar to the original AT&T Korn shell; mksh is the only pdksh +derivate currently being actively developed. It includes bug +fixes and feature improvements, in order to produce a modern, +robust shell good for interactive and especially script use. +mksh has UTF-8 support (e.g. in the emacs editing mode); R38c +corresponds to OpenBSD 4.5-current ksh (without GNU bash-like +$PS1 and fancy character classes). The code has throughoutly +been cleaned up and simplified, bugs fixed, standards compli- +ance added, and several enhancements (for extended compatibi- +lity to other modern shells - as well as a couple of its own) +have been placed. endef define Build/Compile + # -DMKSH_SMALL=1 ⇒ reduce functionality quite a lot + # -DMKSH_ASSUME_UTF8=0 ⇒ never automatically enable + # UTF-8 mode, neither use setlocale/nl_langinfo + # nor look at $LC_* and $LANG (not recommended) + # HAVE_CAN_FSTACKPROTECTORALL=0 ⇒ nuke libssp dependency + # HAVE_REALPATH=x ⇒ add the realpath builtin, which was + # disabled by MKSH_SMALL, back if realpath() exists cd $(PKG_BUILD_DIR); \ CC="$(TARGET_CC)" \ TARGET_OS="$(shell uname -s)" \ CFLAGS="$(TARGET_CFLAGS)" \ - CPPFLAGS="-DMKSH_SMALL=1" \ + CPPFLAGS="-DMKSH_SMALL=1 -DMKSH_ASSUME_UTF8=0" \ + HAVE_CAN_FSTACKPROTECTORALL=0 \ + HAVE_REALPATH=x \ LDFLAGS="$(TARGET_LDFLAGS)" \ $(BASH) Build.sh -Q -r endef diff --git a/utils/mksh/patches/100-dot_mkshrc b/utils/mksh/patches/100-dot_mkshrc index 60d2961ab..be0e40db8 100644 --- a/utils/mksh/patches/100-dot_mkshrc +++ b/utils/mksh/patches/100-dot_mkshrc @@ -1,31 +1,23 @@ -$FreeWRT$ +$Id$ - • FreeWRT patches: + • Part of the FreeWRT patches: – no hostname(1) – ls has no -o - – yofuh doesn’t like $? in $PS1 + • OpenWrt fix: + – since this is not ~/.mkshrc make sure subshells find it ---- a/dot.mkshrc -+++ b/dot.mkshrc -@@ -25,13 +25,15 @@ - # sample mksh initialisation file for interactive shells; install as - # /etc/skel/.mkshrc (as root, for new accounts) or copy to ~/.mkshrc +--- mksh/dot.mkshrc~ 2009-05-31 19:17:57.000000000 +0200 ++++ mksh/dot.mkshrc 2009-06-12 17:37:18.000000000 +0200 +@@ -20,7 +20,7 @@ + #- + # ~/.mkshrc: mksh initialisation file for interactive shells -: ${EDITOR:=/bin/ed} ${TERM:=vt100} ${HOSTNAME:=$(ulimit -c 0;hostname -s 2>&-)} +: ${EDITOR:=/bin/ed} ${TERM:=vt100} ${HOSTNAME:=$(&-) - : ${HOSTNAME:=nil}; PS1='#'; [[ "$(ulimit -c 0; id -u 2>&-)" -eq 0 ]] || PS1='$' + : ${HOSTNAME:=nil}; if (( USER_ID )); then PS1='$'; else PS1='#'; fi function precmd { - typeset -Ui10 e=$? - -- (( e )) && print -n "$e|" -+# enable this back if you want the errorlevel in your prompt -+# this is default in upstream mksh, disabled locally in fwrt -+# (( e )) && print -n "$e|" - } - PS1='$(precmd)${USER:=$(ulimit -c 0;id -un 2>&- || print \?)}@${HOSTNAME%%.*}:$( - typeset pfx=~ wd=${PWD:-?} -@@ -53,7 +55,7 @@ +@@ -38,7 +38,7 @@ unalias ls alias l='ls -F' alias la='l -a' alias ll='l -l' @@ -34,3 +26,12 @@ $FreeWRT$ alias which='whence -p' whence -p rot13 >&- || alias rot13='tr \ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ \ +@@ -283,4 +283,8 @@ function Lstripcom { + done; } + } + ++# we need this in OpenWrt for subshells that are not login shells ++: ${ENV=/etc/mkshrc} ++[[ -z $ENV ]] || export ENV ++ + : place customsations above this line