avr-libc-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-commit] [2352] De-POSIXify the shell usage in gen-avr-lib-tree


From: Joerg Wunsch
Subject: [avr-libc-commit] [2352] De-POSIXify the shell usage in gen-avr-lib-tree.sh, since
Date: Fri, 19 Apr 2013 20:12:51 +0000

Revision: 2352
          http://svn.sv.gnu.org/viewvc/?view=rev&root=avr-libc&revision=2352
Author:   joerg_wunsch
Date:     2013-04-19 20:12:51 +0000 (Fri, 19 Apr 2013)
Log Message:
-----------
De-POSIXify the shell usage in gen-avr-lib-tree.sh, since
Solaris' /bin/sh is not POSIX-aware.  For the remaining tools,
their POSIXish variants can be chosen by prepending the PATH with
/usr/xpg4/bin (doesn't harm for non-Solaris systems), but as for
the shell this script is running under, the only other option
were to let autoconf detect it, which is a bit of overkill.

Modified Paths:
--------------
    trunk/avr-libc/ChangeLog
    trunk/avr-libc/devtools/gen-avr-lib-tree.sh

Modified: trunk/avr-libc/ChangeLog
===================================================================
--- trunk/avr-libc/ChangeLog    2013-04-18 20:53:36 UTC (rev 2351)
+++ trunk/avr-libc/ChangeLog    2013-04-19 20:12:51 UTC (rev 2352)
@@ -1,3 +1,12 @@
+2013-04-19 Joerg Wunsch <address@hidden>
+
+       * devtools/gen-avr-lib-tree.sh: De-POSIXify the shell usage, since
+       Solaris' /bin/sh is not POSIX-aware.  For the remaining tools,
+       their POSIXish variants can be chosen by prepending the PATH with
+       /usr/xpg4/bin (doesn't harm for non-Solaris systems), but as for
+       the shell this script is running under, the only other option
+       were to let autoconf detect it, which is a bit of overkill.
+
 2013-03-29 Mike Rice <address@hidden>
 
        * libc/time: (New directory.)
@@ -4,7 +13,7 @@
        * include/time.h: (New file.)
        * include/util/eu_dst.h: (New file.)
        * include/util/usa_dst.h: (New file.)
-               
+
 2013-03-19 Joerg Wunsch <address@hidden>
 
        * devtools/gen-avr-lib-tree.sh: Add ATmega64RFR2, ATmega644RFR2,

Modified: trunk/avr-libc/devtools/gen-avr-lib-tree.sh
===================================================================
--- trunk/avr-libc/devtools/gen-avr-lib-tree.sh 2013-04-18 20:53:36 UTC (rev 
2351)
+++ trunk/avr-libc/devtools/gen-avr-lib-tree.sh 2013-04-19 20:12:51 UTC (rev 
2352)
@@ -43,6 +43,8 @@
 
 # Define the special flags for special sub-targets.
 
+PATH=/usr/xpg4/bin:$PATH
+
 CFLAGS_SPACE="-mcall-prologues -Os"
 CFLAGS_TINY_STACK="-mtiny-stack -mcall-prologues -Os"
 CFLAGS_BIG_MEMORY='-Os $(FNO_JUMP_TABLES)'
@@ -357,12 +359,12 @@
 
 top_dir="UNKNOWN"
 
-if test -e AUTHORS
+if test -f AUTHORS
 then
        top_dir="$PWD"
 else
        cd ..
-       if test -e AUTHORS
+       if test -f AUTHORS
        then
                top_dir="$PWD"
        fi
@@ -384,12 +386,12 @@
 
 for ath_lib in $AVR_ARH_INFO
 do
-       arh=$(echo $ath_lib | cut -d ':' -f 1)
-       sublib=$(echo $ath_lib | cut -d ':' -f 2)
-       dev_info=$(echo $ath_lib | cut -d ':' -f 3)
-       lib_defs=$(echo $ath_lib | cut -d ':' -f 4)
-       lib_cflags=$(echo $ath_lib | cut -d ':' -f 5)
-       lib_asflags=$(echo $ath_lib | cut -d ':' -f 6)
+       arh=`echo $ath_lib | cut -d ':' -f 1`
+       sublib=`echo $ath_lib | cut -d ':' -f 2`
+       dev_info=`echo $ath_lib | cut -d ':' -f 3`
+       lib_defs=`echo $ath_lib | cut -d ':' -f 4`
+       lib_cflags=`echo $ath_lib | cut -d ':' -f 5`
+       lib_asflags=`echo $ath_lib | cut -d ':' -f 6`
 
        install_dir=$arh
        if [ $arh = avr2 ]
@@ -424,11 +426,11 @@
 
        for dev_crt in $DEV_INFO
        do
-               dev=$(echo $dev_crt | cut -d ':' -f 1)
-               crt=$(echo $dev_crt | cut -d ':' -f 2)
-               crt_defs=$(echo $dev_crt | cut -d ':' -f 3)
-               crt_cflags=$(echo $dev_crt | cut -d ':' -f 4)
-               crt_asflags=$(echo $dev_crt | cut -d ':' -f 5)
+               dev=`echo $dev_crt | cut -d ':' -f 1`
+               crt=`echo $dev_crt | cut -d ':' -f 2`
+               crt_defs=`echo $dev_crt | cut -d ':' -f 3`
+               crt_cflags=`echo $dev_crt | cut -d ':' -f 4`
+               crt_asflags=`echo $dev_crt | cut -d ':' -f 5`
 
                echo "  avr/lib/$subdir/$dev"
 
@@ -458,24 +460,24 @@
            > tempfile && mv -f tempfile Makefile.am
 
        # Find the first and the last lines of <<dev>> block.
-       n1=`grep '^if[[:blank:]]+HAS_<<dev>>' -En Makefile.am   \
+       n1=`grep -En '^if[[:blank:]]+HAS_<<dev>>' Makefile.am   \
            | cut -d ':' -f 1`
-       n2=`grep '^endif[[:blank:]]+#[[:blank:]]*<<dev>>' -En Makefile.am \
+       n2=`grep -En '^endif[[:blank:]]+#[[:blank:]]*<<dev>>' Makefile.am \
            | cut -d ':' -f 1`
 
        # Before the <<dev>> block.
-       head -n $(($n1 - 1)) Makefile.am > tempfile
+       head -n `expr $n1 - 1` Makefile.am > tempfile
 
        # Duplicate the <<dev>> block and substitute.
        for dev_crt in $DEV_INFO ; do
                dev=`echo $dev_crt | cut -d ':' -f 1`
                tail -n +$n1 Makefile.am        \
-                   | head -n $(($n2 - $n1 + 1))        \
+                   | head -n `expr $n2 - $n1 + 1`      \
                    | sed -e "s/<<dev>>/$dev/g" >> tempfile
        done
 
        # After the <<dev>> block.
-       tail -n +$(($n2 + 1)) Makefile.am >> tempfile
+       tail -n +`expr $n2 + 1` Makefile.am >> tempfile
 
        # Result.
        mv -f tempfile Makefile.am




reply via email to

[Prev in Thread] Current Thread [Next in Thread]