Changeset 56bb70d in freewrt


Ignore:
Timestamp:
Oct 15, 2007, 11:45:13 AM (18 years ago)
Author:
Thorsten Glaser <tg@…>
Branches:
freewrt_1_0, freewrt_2_0
Children:
3667e10
Parents:
1255a41
Message:

tentatively upgrade to mksh R31d

git-svn-id: svn://www.freewrt.org/branches/freewrt_1_0@3598 afb5a338-a214-0410-bd46-81f09a774fd1

Location:
package/mksh
Files:
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • package/mksh/Makefile

    r1255a41 r56bb70d  
    88
    99PKG_NAME=               mksh
    10 PKG_VERSION=            31.3
    11 PKG_RELEASE=            2
     10PKG_VERSION=            31.4
     11PKG_RELEASE=            1
    1212PKG_SOURCE=             ${PKG_NAME}-R31c.cpio.gz
    13 PKG_MD5SUM=             08b6354ad94b9c5d5bfc301e3314e412
     13PKG_MD5SUM=             a7c77428bd2b887c1583095a00c84aac
    1414
    1515PKG_SOURCE_URL=         http://www.mirbsd.org/MirOS/dist/mir/mksh/
     
    2020$(eval $(call PKG_template,MKSH,mksh,${PKG_VERSION}-${PKG_RELEASE},${ARCH}))
    2121
    22 $(WRKBUILD)/.configured:
     22${WRKBUILD}/.configured:
    2323        @touch $@
    2424
    25 CPPFLAGS_TO_PASS:=      -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include
     25CPPFLAGS_TO_PASS:=      -I${STAGING_DIR}/usr/include -I${STAGING_DIR}/include
    2626CPPFLAGS_TO_PASS+=      -DMKSH_NOPWNAM=1
    2727
     
    3030endif
    3131
    32 $(WRKBUILD)/.built:
     32${WRKBUILD}/.built:
    3333        (cd ${WRKBUILD}; \
    3434            CC='${TARGET_CC}' \
    3535            CFLAGS='${TARGET_CFLAGS}' \
    3636            CPPFLAGS='${CPPFLAGS_TO_PASS}' \
    37             LDFLAGS='-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib' \
     37            LDFLAGS='-L${STAGING_DIR}/usr/lib -L${STAGING_DIR}/lib' \
    3838            TARGET_OS=Linux \
    3939            HAVE_ARC4RANDOM=0 HAVE_MKNOD=0 HAVE_SETLOCALE_CTYPE=0 \
    4040            HAVE_PERSISTENT_HISTORY=0 \
    4141            ${BASH} Build.sh -Q -r)
    42         rm -rf $(WRKINST)
    43         mkdir -p $(WRKINST)/{bin,etc}
     42        rm -rf ${WRKINST}
     43        mkdir -p ${WRKINST}/{bin,etc}
    4444        install -c -m 755 ${WRKBUILD}/mksh ${WRKINST}/bin/mksh
    45         install -c -m 444 ${WRKSRC}/dot.mkshrc ${WRKINST}/etc/mkshrc
     45        install -c -m 644 ${WRKSRC}/dot.mkshrc ${WRKINST}/etc/mkshrc
    4646        @touch $@
    4747
    48 $(IPKG_MKSH):
    49         install -d -m 0755 $(IDIR_MKSH)/bin
    50         install -d -m 0755 $(IDIR_MKSH)/etc
    51         $(CP) $(WRKINST)/bin/mksh $(IDIR_MKSH)/bin/
    52         $(RSTRIP) $(IDIR_MKSH)
    53         $(CP) $(WRKINST)/etc/mkshrc $(IDIR_MKSH)/etc/
     48${IPKG_MKSH}:
     49        cd ${WRKINST} && pax -rw -pe bin/mksh etc/mkshrc ${IDIR_MKSH}/
     50        ${RSTRIP} ${IDIR_MKSH}
    5451ifeq (${FWRT_PACKAGE_MKSH_AS_BINSH},y)
    55         cd $(IDIR_MKSH)/bin/; ln -sf mksh sh
     52        cd ${IDIR_MKSH}/bin; ln -sf mksh sh
    5653endif
    5754ifeq (${FWRT_PACKAGE_MKSH_AS_BINASH},y)
    58         cd $(IDIR_MKSH)/bin/; ln -sf mksh ash
     55        cd ${IDIR_MKSH}/bin; ln -sf mksh ash
    5956endif
    60         $(IPKG_BUILD) $(IDIR_MKSH) $(PACKAGE_DIR)
     57        ${IPKG_BUILD} ${IDIR_MKSH} ${PACKAGE_DIR}
  • package/mksh/patches/patch-dot_mkshrc

    r1255a41 r56bb70d  
    11$FreeWRT$
    22
    3         • bring mksh to the level of 2007/09/26
    43        • FreeWRT patches:
    54          – no hostname(1)
     
    76          – yofuh doesn’t like $? in $PS1
    87
    9 --- mksh.orig/dot.mkshrc        2007-09-03 09:25:28.000000000 +0000
    10 +++ mksh/dot.mkshrc     2007-09-26 17:52:20.000000000 +0000
    11 @@ -1,8 +1,41 @@
     8--- mksh.orig/dot.mkshrc        Tue Oct  2 01:03:12 2007
     9+++ mksh/dot.mkshrc     Mon Oct 15 09:32:00 2007
     10@@ -24,13 +24,15 @@
     11 #-
     12 # sample mksh initialisation file for interactive shells
     13 
    1214-: ${EDITOR:=/bin/ed} ${TERM:=vt100} ${HOSTNAME:=$(ulimit -c 0;hostname -s 2>&-)}
    13 +# $MirOS: src/bin/mksh/dot.mkshrc,v 1.22 2007/09/25 22:36:36 tg Stab $
    14 +#-
    15 +# Copyright (c) 2007
    16 +#      Thorsten Glaser <tg@mirbsd.de>
    17 +#
    18 +# Provided that these terms and disclaimer and all copyright notices
    19 +# are retained or reproduced in an accompanying document, permission
    20 +# is granted to deal in this work without restriction, including un-
    21 +# limited rights to use, publicly perform, distribute, sell, modify,
    22 +# merge, give away, or sublicence.
    23 +#
    24 +# Advertising materials mentioning features or use of this work must
    25 +# display the following acknowledgement:
    26 +#      This product includes material provided by Thorsten Glaser.
    27 +#
    28 +# This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to
    29 +# the utmost extent permitted by applicable law, neither express nor
    30 +# implied; without malicious intent or gross negligence. In no event
    31 +# may a licensor, author or contributor be held liable for indirect,
    32 +# direct, other damage, loss, or other issues arising in any way out
    33 +# of dealing in the work, even if advised of the possibility of such
    34 +# damage or existence of a defect, except proven that it results out
    35 +# of said person's immediate fault when using the work as intended.
    36 +#-
    37 +# sample mksh initialisation file for interactive shells
    38 +
    3915+: ${EDITOR:=/bin/ed} ${TERM:=vt100} ${HOSTNAME:=$(</proc/sys/kernel/hostname)}
    4016 [[ $HOSTNAME = @(localhost|*([  ])) ]] && HOSTNAME=$(ulimit -c 0;hostname 2>&-)
    4117 : ${HOSTNAME:=nil}; PS1='#'; [[ "$(ulimit -c 0; id -u 2>&-)" -eq 0 ]] || PS1='$'
    42 -PS1='$(((e = $?)) && print $e\|)${USER:=$(ulimit -c 0; id -un 2>&- || \
    43 -    print nobody)}@${HOSTNAME%%.*}:$(typeset pfx=~ wd=${PWD:-?}
    44 +function precmd {
    45 +       typeset -i10 e=$?
    46 +
     18 function precmd {
     19        typeset -i10 e=$?
     20 
     21-       (( e )) && print -n -- "$e|"
    4722+# enable this back if you want the errorlevel in your prompt
    4823+# this is default in upstream mksh
    4924+#      (( e )) && print -n -- "$e|"
    50 +}
    51 +PS1='$(precmd)${USER:=$(ulimit -c 0;id -un 2>&- || print \?)}@${HOSTNAME%%.*}:$(
    52 +       typeset pfx=~ wd=${PWD:-?}
    53         typeset -i n=${COLUMNS:-80}/3; let n="n < 7 ? 7 : n"
    54         [[ ${wd#$pfx} = $wd || $pfx = ?(/) ]] || wd=\~${wd#$pfx}
    55         pfx=; while (( (${#pfx} + ${#wd}) > n )); do
    56 @@ -18,7 +51,7 @@ export EDITOR HOSTNAME LESSHISTFILE=- MK
     25 }
     26 PS1='$(precmd)${USER:=$(ulimit -c 0;id -un 2>&- || print \?)}@${HOSTNAME%%.*}:$(
     27        typeset pfx=~ wd=${PWD:-?}
     28@@ -50,7 +52,7 @@ export EDITOR HOSTNAME LESSHISTFILE=- MK
    5729 alias l='/bin/ls -F'
    5830 alias la='l -a'
     
    6335 whence -p rot13 >&- || alias rot13='tr [A-Za-z] [N-ZA-Mn-za-m]'
    6436 whence -p hd >&- || function hd {
    65 @@ -26,6 +59,162 @@ whence -p hd >&- || function hd {
    66             -e '"  |" "%_p"' -e '"|\n"' "$@"
    67  }
    68  
    69 +# Berkeley C shell compatible dirs, popd, and pushd functions
    70 +# Z shell compatible chpwd() hook, used to update DIRSTACK[0]
    71 +DIRSTACKBASE=$(readlink -nf ~/. 2>&- || print -nr -- "$HOME")
    72 +typeset -r DIRSTACKBASE
    73 +set -A DIRSTACK
    74 +function chpwd {
    75 +       DIRSTACK[0]=$(readlink -nf . 2>&- || print -nr -- "$PWD")
    76 +       [[ ${DIRSTACK[0]#$DIRSTACKBASE} = ${DIRSTACK[0]} ]] || \
    77 +           DIRSTACK[0]=\~${DIRSTACK[0]#$DIRSTACKBASE}
    78 +       :
    79 +}
    80 +chpwd .
    81 +function cd {
    82 +       builtin cd "$@"
    83 +       chpwd "$@"
    84 +}
    85 +function cd_csh {
    86 +       typeset d t=$1
    87 +
    88 +       [[ $t = ~* ]] && t=$DIRSTACKBASE${t#~}
    89 +       if ! d=$(builtin cd "$t" 2>&1); then
    90 +               print -u2 "${1}: ${d##*$t - }."
    91 +               return 1
    92 +       fi
    93 +       cd "$t"
    94 +}
    95 +function dirs {
    96 +       typeset d
    97 +       typeset -i isnoglob=0 fl=0 fv=0 fn=0 cpos=0
    98 +
    99 +       [[ $(set +o) == *-o\ noglob* ]] && isnoglob=1
    100 +       set -o noglob
    101 +       while getopts ":lvn" d; do
    102 +               case $d {
    103 +               (l)     fl=1 ;;
    104 +               (v)     fv=1 ;;
    105 +               (n)     fn=1 ;;
    106 +               (*)     print -u2 'Usage: dirs [-lvn].'
    107 +                       return 1 ;;
    108 +               }
    109 +       done
    110 +       shift $((OPTIND - 1))
    111 +       if (( $# > 0 )); then
    112 +               print -u2 'Usage: dirs [-lvn].'
    113 +               return 1
    114 +       fi
    115 +       if (( fv )); then
    116 +               fv=0
    117 +               while (( fv < ${#DIRSTACK[*]} )); do
    118 +                       d=${DIRSTACK[fv]}
    119 +                       [[ $fl$d = 1~* ]] && d=$DIRSTACKBASE${d#~}
    120 +                       print -r -- "$fv        $d"
    121 +                       let fv++
    122 +               done
    123 +       else
    124 +               fv=0
    125 +               while (( fv < ${#DIRSTACK[*]} )); do
    126 +                       d=${DIRSTACK[fv]}
    127 +                       [[ $fl$d = 1~* ]] && d=$DIRSTACKBASE${d#~}
    128 +                       if (( fn && (cpos+=${#d}+1) >= 79 && ${#d} < 80 )); then
    129 +                               print
    130 +                               (( cpos = ${#d} + 1 ))
    131 +                       fi
    132 +                       print -nr -- "$d "
    133 +                       let fv++
    134 +               done
    135 +               print
    136 +       fi
    137 +       (( isnoglob )) || set +o noglob
    138 +       return 0
    139 +}
    140 +function popd {
    141 +       typeset d fa
    142 +       typeset -i isnoglob=0 n=1
    143 +
    144 +       [[ $(set +o) == *-o\ noglob* ]] && isnoglob=1
    145 +       set -o noglob
    146 +       while getopts ":0123456789lvn" d; do
    147 +               case $d {
    148 +               (l|v|n) fa="$fa -$d" ;;
    149 +               (+*)    n=2
    150 +                       break ;;
    151 +               (*)     print -u2 'Usage: popd [-lvn] [+<n>].'
    152 +                       return 1 ;;
    153 +               }
    154 +       done
    155 +       shift $((OPTIND - n))
    156 +       n=0
    157 +       if (( $# > 1 )); then
    158 +               print -u2 popd: Too many arguments.
    159 +               return 1
    160 +       elif [[ $1 = ++([0-9]) && $1 != +0 ]]; then
    161 +               if (( (n = ${1#+}) >= ${#DIRSTACK[*]} )); then
    162 +                       print -u2 popd: Directory stack not that deep.
    163 +                       return 1
    164 +               fi
    165 +       elif [[ -n $1 ]]; then
    166 +               print -u2 popd: Bad directory.
    167 +               return 1
    168 +       fi
    169 +       if (( ${#DIRSTACK[*]} < 2 )); then
    170 +               print -u2 popd: Directory stack empty.
    171 +               return 1
    172 +       fi
    173 +       unset DIRSTACK[n]
    174 +       set -A DIRSTACK -- "${DIRSTACK[@]}"
    175 +       cd_csh "${DIRSTACK[0]}" || return 1
    176 +       (( isnoglob )) || set +o noglob
    177 +       dirs $fa
    178 +}
    179 +function pushd {
    180 +       typeset d fa
    181 +       typeset -i isnoglob=0 n=1
    182 +
    183 +       [[ $(set +o) == *-o\ noglob* ]] && isnoglob=1
    184 +       set -o noglob
    185 +       while getopts ":0123456789lvn" d; do
    186 +               case $d {
    187 +               (l|v|n) fa="$fa -$d" ;;
    188 +               (+*)    n=2
    189 +                       break ;;
    190 +               (*)     print -u2 'Usage: pushd [-lvn] [<dir>|+<n>].'
    191 +                       return 1 ;;
    192 +               }
    193 +       done
    194 +       shift $((OPTIND - n))
    195 +       if (( $# == 0 )); then
    196 +               if (( ${#DIRSTACK[*]} < 2 )); then
    197 +                       print -u2 pushd: No other directory.
    198 +                       return 1
    199 +               fi
    200 +               d=${DIRSTACK[1]}
    201 +               DIRSTACK[1]=${DIRSTACK[0]}
    202 +               cd_csh "$d" || return 1
    203 +       elif (( $# > 1 )); then
    204 +               print -u2 pushd: Too many arguments.
    205 +               return 1
    206 +       elif [[ $1 = ++([0-9]) && $1 != +0 ]]; then
    207 +               if (( (n = ${1#+}) >= ${#DIRSTACK[*]} )); then
    208 +                       print -u2 pushd: Directory stack not that deep.
    209 +                       return 1
    210 +               fi
    211 +               while (( n-- )); do
    212 +                       d=${DIRSTACK[0]}
    213 +                       unset DIRSTACK[0]
    214 +                       set -A DIRSTACK -- "${DIRSTACK[@]}" "$d"
    215 +               done
    216 +               cd_csh "${DIRSTACK[0]}" || return 1
    217 +       else
    218 +               set -A DIRSTACK -- placeholder "${DIRSTACK[@]}"
    219 +               cd_csh "$1" || return 1
    220 +       fi
    221 +       (( isnoglob )) || set +o noglob
    222 +       dirs $fa
    223 +}
    224 +
    225  # strip comments (and leading/trailing whitespace if IFS is set) from
    226  # any file(s) given as argument, or stdin if none, and spew to stdout
    227  function Lstripcom {
    228 @@ -35,6 +224,4 @@ function Lstripcom {
    229         done; }
    230  }
    231  
    232 -# place customisations between this line and the “: RCSID” line below
    233 -
    234 -: $MirOS: src/bin/mksh/dot.mkshrc,v 1.19 2007/09/03 09:25:05 tg Rel $
    235 +: place customsations above this line!
Note: See TracChangeset for help on using the changeset viewer.