1303 files changed, 32187 insertions, 57138 deletions
diff --git a/scripts/gen_build_files.sh b/scripts/gen_build_files.sh index d5f7b94..ebee17c 100755 --- a/scripts/gen_build_files.sh +++ b/scripts/gen_build_files.sh @@ -17,22 +17,6 @@ status() { printf ' %-8s%s\n' "$1" "$2"; } gen() { status "GEN" "$@"; } chk() { status "CHK" "$@"; } -# On OSX the sed implementation is not compatible with some of the -# features in this script, so this uses gsed and warns the user if -# it does not exist. -UNAME=$(uname -sm) -case "$UNAME" in -*Darwin*|*Macintosh*) - SED_IMPL=$(which gsed) - if [ $? != 0 ]; then - echo "GNU sed is required for Darwin builds, please install and add 'gsed' to the path" - exit 1; - fi - ;; -*) - SED_IMPL=sed -esac - generate() { # NB: data to be inserted at INSERT line is coming on stdin @@ -43,11 +27,16 @@ generate() # rules re handling of "\n" in echo params. printf "%s\n" "${header}" # print everything up to INSERT line - $SED_IMPL -n '/^INSERT$/ q; p' "${src}" + sed -n '/^INSERT$/ q; p' "${src}" # copy stdin to stdout cat # print everything after INSERT line - $SED_IMPL -n '/^INSERT$/ { :l; n; p; bl }' "${src}" + sed -n '/^INSERT$/ { + :l + n + p + bl + }' "${src}" } >"${dst}.tmp" if ! cmp -s "${dst}" "${dst}.tmp"; then gen "${dst}" @@ -58,7 +47,7 @@ generate() } # (Re)generate include/applets.h -$SED_IMPL -n 's@^//applet:@@p' "$srctree"/*/*.c "$srctree"/*/*/*.c \ +sed -n 's@^//applet:@@p' "$srctree"/*/*.c "$srctree"/*/*/*.c \ | generate \ "$srctree/include/applets.src.h" \ "include/applets.h" \ @@ -68,7 +57,12 @@ $SED_IMPL -n 's@^//applet:@@p' "$srctree"/*/*.c "$srctree"/*/*/*.c \ # We add line continuation backslash after each line, # and insert empty line before each line which doesn't start # with space or tab -$SED_IMPL -n -e 's@^//usage:\([ \t].*\)$@\1 \\@p' -e 's@^//usage:\([^ \t].*\)$@\n\1 \\@p' \ +TAB="$(printf '\tX')" +TAB="${TAB%X}" +LF="$(printf '\nX')" +LF="${LF%X}" +sed -n -e 's@^//usage:\([ '"$TAB"'].*\)$@\1 \\@p' \ + -e 's@^//usage:\([^ '"$TAB"'].*\)$@\'"$LF"'\1 \\@p' \ "$srctree"/*/*.c "$srctree"/*/*/*.c \ | generate \ "$srctree/include/usage.src.h" \ @@ -77,7 +71,7 @@ $SED_IMPL -n -e 's@^//usage:\([ \t].*\)$@\1 \\@p' -e 's@^//usage:\([^ \t].*\)$@\ # (Re)generate */Kbuild and */Config.in # We skip .dotdirs - makes git/svn/etc users happier -{ cd -- "$srctree" && find . -type d -not '(' -name '.?*' -prune ')'; } \ +{ cd -- "$srctree" && find . -type d ! '(' -name '.?*' -prune ')'; } \ | while read -r d; do d="${d#./}" @@ -86,7 +80,7 @@ $SED_IMPL -n -e 's@^//usage:\([ \t].*\)$@\1 \\@p' -e 's@^//usage:\([^ \t].*\)$@\ if test -f "$src"; then mkdir -p -- "$d" 2>/dev/null - $SED_IMPL -n 's@^//kbuild:@@p' "$srctree/$d"/*.c \ + sed -n 's@^//kbuild:@@p' "$srctree/$d"/*.c \ | generate \ "${src}" "${dst}" \ "# DO NOT EDIT. This file is generated from Kbuild.src" @@ -97,7 +91,7 @@ $SED_IMPL -n -e 's@^//usage:\([ \t].*\)$@\1 \\@p' -e 's@^//usage:\([^ \t].*\)$@\ if test -f "$src"; then mkdir -p -- "$d" 2>/dev/null - $SED_IMPL -n 's@^//config:@@p' "$srctree/$d"/*.c \ + sed -n 's@^//config:@@p' "$srctree/$d"/*.c \ | generate \ "${src}" "${dst}" \ "# DO NOT EDIT. This file is generated from Config.src" |