busybox: squashed commit of merging cm-12.1
With fixes to LOCAL_C_INCLUDES for libsepol in M and fixed
some missing includes to enable building for 64 bit devices
Conflicts:
Android.mk
android/libc/arch-x86/syscalls/swapoff.S
android/libc/arch-x86/syscalls/swapon.S
android/libc/arch-x86/syscalls/sysinfo.S
android/librpc/pmap_rmt.c
android/reboot.c
include-full/copy-current.sh
include-minimal/copy-current.sh
include/platform.h
networking/interface.c
networking/nslookup.c
Change-Id: If6092fa87f3d21190db1af4f70daa150eb462660
diff --git a/scripts/gen_build_files.sh b/scripts/gen_build_files.sh
index 0989b2f..d5f7b94 100755
--- a/scripts/gen_build_files.sh
+++ b/scripts/gen_build_files.sh
@@ -17,6 +17,22 @@
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
@@ -27,11 +43,11 @@
# rules re handling of "\n" in echo params.
printf "%s\n" "${header}"
# print everything up to INSERT line
- sed -n '/^INSERT$/ q; p' "${src}"
+ $SED_IMPL -n '/^INSERT$/ q; p' "${src}"
# copy stdin to stdout
cat
# print everything after INSERT line
- sed -n '/^INSERT$/ { :l; n; p; bl }' "${src}"
+ $SED_IMPL -n '/^INSERT$/ { :l; n; p; bl }' "${src}"
} >"${dst}.tmp"
if ! cmp -s "${dst}" "${dst}.tmp"; then
gen "${dst}"
@@ -42,7 +58,7 @@
}
# (Re)generate include/applets.h
-sed -n 's@^//applet:@@p' "$srctree"/*/*.c "$srctree"/*/*/*.c \
+$SED_IMPL -n 's@^//applet:@@p' "$srctree"/*/*.c "$srctree"/*/*/*.c \
| generate \
"$srctree/include/applets.src.h" \
"include/applets.h" \
@@ -52,7 +68,7 @@
# We add line continuation backslash after each line,
# and insert empty line before each line which doesn't start
# with space or tab
-sed -n -e 's@^//usage:\([ \t].*\)$@\1 \\@p' -e 's@^//usage:\([^ \t].*\)$@\n\1 \\@p' \
+$SED_IMPL -n -e 's@^//usage:\([ \t].*\)$@\1 \\@p' -e 's@^//usage:\([^ \t].*\)$@\n\1 \\@p' \
"$srctree"/*/*.c "$srctree"/*/*/*.c \
| generate \
"$srctree/include/usage.src.h" \
@@ -70,7 +86,7 @@
if test -f "$src"; then
mkdir -p -- "$d" 2>/dev/null
- sed -n 's@^//kbuild:@@p' "$srctree/$d"/*.c \
+ $SED_IMPL -n 's@^//kbuild:@@p' "$srctree/$d"/*.c \
| generate \
"${src}" "${dst}" \
"# DO NOT EDIT. This file is generated from Kbuild.src"
@@ -81,7 +97,7 @@
if test -f "$src"; then
mkdir -p -- "$d" 2>/dev/null
- sed -n 's@^//config:@@p' "$srctree/$d"/*.c \
+ $SED_IMPL -n 's@^//config:@@p' "$srctree/$d"/*.c \
| generate \
"${src}" "${dst}" \
"# DO NOT EDIT. This file is generated from Config.src"