Ignore:
Timestamp:
Jan 1, 2014, 12:47:38 AM (5 years ago)
Author:
bruno
Message:
  • Update mindi-busybox to 1.21.1
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mindi-busybox/scripts/gen_build_files.sh

    r2725 r3232  
    11#!/bin/sh
     2
     3# Note: was using sed OPTS CMD -- FILES
     4# but users complain that many sed implementations
     5# are misinterpreting --.
    26
    37test $# -ge 2 || { echo "Syntax: $0 SRCTREE OBJTREE"; exit 1; }
     
    1620generate()
    1721{
    18     local src="$1" dst="$2" header="$3" insert="$4"
     22    # NB: data to be inserted at INSERT line is coming on stdin
     23    local src="$1" dst="$2" header="$3"
    1924    #chk "${dst}"
    20     (
     25    {
     26        # Need to use printf: different shells have inconsistent
     27        # rules re handling of "\n" in echo params.
    2128        printf "%s\n" "${header}"
    22         if grep -qs '^INSERT$' "${src}"; then
    23             sed -n '1,/^INSERT$/p' "${src}"
    24             printf "%s\n" "${insert}"
    25             sed -n '/^INSERT$/,$p' "${src}"
    26         else
    27             if [ -n "${insert}" ]; then
    28                 printf "%s\n" "ERROR: INSERT line missing in: ${src}" 1>&2
    29             fi
    30             cat "${src}"
    31         fi
    32     ) | sed '/^INSERT$/d' > "${dst}.tmp"
     29        # print everything up to INSERT line
     30        sed -n '/^INSERT$/ q; p' "${src}"
     31        # copy stdin to stdout
     32        cat
     33        # print everything after INSERT line
     34        sed -n '/^INSERT$/ { :l; n; p; bl }' "${src}"
     35    } >"${dst}.tmp"
    3336    if ! cmp -s "${dst}" "${dst}.tmp"; then
    3437        gen "${dst}"
     
    4043
    4144# (Re)generate include/applets.h
    42 s=`sed -n 's@^//applet:@@p' -- "$srctree"/*/*.c "$srctree"/*/*/*.c`
    43 generate \
     45sed -n 's@^//applet:@@p' "$srctree"/*/*.c "$srctree"/*/*/*.c \
     46| generate \
    4447    "$srctree/include/applets.src.h" \
    4548    "include/applets.h" \
    46     "/* DO NOT EDIT. This file is generated from applets.src.h */" \
    47     "${s}"
     49    "/* DO NOT EDIT. This file is generated from applets.src.h */"
    4850
    4951# (Re)generate include/usage.h
     
    5153# and insert empty line before each line which doesn't start
    5254# with space or tab
    53 # (note: we need to use \\\\ because of ``)
    54 s=`sed -n -e 's@^//usage:\([ \t].*\)$@\1 \\\\@p' -e 's@^//usage:\([^ \t].*\)$@\n\1 \\\\@p' -- "$srctree"/*/*.c "$srctree"/*/*/*.c`
    55 generate \
     55sed -n -e 's@^//usage:\([ \t].*\)$@\1 \\@p' -e 's@^//usage:\([^ \t].*\)$@\n\1 \\@p' \
     56    "$srctree"/*/*.c "$srctree"/*/*/*.c \
     57| generate \
    5658    "$srctree/include/usage.src.h" \
    5759    "include/usage.h" \
    58     "/* DO NOT EDIT. This file is generated from usage.src.h */" \
    59     "${s}"
     60    "/* DO NOT EDIT. This file is generated from usage.src.h */"
    6061
    6162# (Re)generate */Kbuild and */Config.in
    62 { cd -- "$srctree" && find . -type d; } | while read -r d; do
     63# We skip .dotdirs - makes git/svn/etc users happier
     64{ cd -- "$srctree" && find . -type d -not '(' -name '.?*' -prune ')'; } \
     65| while read -r d; do
    6366    d="${d#./}"
    6467
     
    6871        mkdir -p -- "$d" 2>/dev/null
    6972
    70         s=`sed -n 's@^//kbuild:@@p' -- "$srctree/$d"/*.c`
    71         generate \
     73        sed -n 's@^//kbuild:@@p' "$srctree/$d"/*.c \
     74        | generate \
    7275            "${src}" "${dst}" \
    73             "# DO NOT EDIT. This file is generated from Kbuild.src" \
    74             "${s}"
     76            "# DO NOT EDIT. This file is generated from Kbuild.src"
    7577    fi
    7678
     
    8082        mkdir -p -- "$d" 2>/dev/null
    8183
    82         s=`sed -n 's@^//config:@@p' -- "$srctree/$d"/*.c`
    83         generate \
     84        sed -n 's@^//config:@@p' "$srctree/$d"/*.c \
     85        | generate \
    8486            "${src}" "${dst}" \
    85             "# DO NOT EDIT. This file is generated from Config.src" \
    86             "${s}"
     87            "# DO NOT EDIT. This file is generated from Config.src"
    8788    fi
    8889done
Note: See TracChangeset for help on using the changeset viewer.