summaryrefslogtreecommitdiffstats
path: root/envsetup.sh
diff options
context:
space:
mode:
authorWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2016-03-18 02:25:20 +0100
committerWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2016-03-18 02:25:20 +0100
commit882914410c98e48b6de5df0721164b963b55b63e (patch)
treec17fe30cceac5b0f7b2dc39c84f4e0c1f44a5a5e /envsetup.sh
parent700d8f580e79ddc2f853cec8acc848706cbcbff5 (diff)
parent078a4dc15aa20587d95a3ca6555721d9110b288e (diff)
downloadbuild-882914410c98e48b6de5df0721164b963b55b63e.zip
build-882914410c98e48b6de5df0721164b963b55b63e.tar.gz
build-882914410c98e48b6de5df0721164b963b55b63e.tar.bz2
Merge branch 'cm-13.0' of https://github.com/CyanogenMod/android_build into replicant-6.0
Signed-off-by: Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de>
Diffstat (limited to 'envsetup.sh')
-rw-r--r--envsetup.sh52
1 files changed, 40 insertions, 12 deletions
diff --git a/envsetup.sh b/envsetup.sh
index bb46faf..91fdc6f 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -11,6 +11,7 @@ Invoke ". build/envsetup.sh" from your shell to add the following functions to y
To limit the modules being built use the syntax: mmm dir/:target1,target2.
- mma: Builds all of the modules in the current directory, and their dependencies.
- mmp: Builds all of the modules in the current directory and pushes them to the device.
+- mmap: Builds all of the modules in the current directory, and its dependencies, then pushes the package to the device.
- mmmp: Builds all of the modules in the supplied directories and pushes them to the device.
- mmma: Builds all of the modules in the supplied directories, and their dependencies.
- mms: Short circuit builder. Quickly re-build the kernel, rootfs, boot and system images
@@ -855,7 +856,6 @@ function mm()
local M=$(findmakefile)
local MODULES=
local GET_INSTALL_PATH=
- local ARGS=
# Remove the path to top as the makefilepath needs to be relative
local M=`echo $M|sed 's:'$T'/::'`
if [ ! "$T" ]; then
@@ -872,12 +872,12 @@ function mm()
done
if [ -n "$GET_INSTALL_PATH" ]; then
MODULES=
- ARGS=GET-INSTALL-PATH
+ # set all args to 'GET-INSTALL-PATH'
+ set -- GET-INSTALL-PATH
else
MODULES=all_modules
- ARGS=$@
fi
- ONE_SHOT_MAKEFILE=$M $DRV make -C $T -f build/core/main.mk $MODULES $ARGS
+ ONE_SHOT_MAKEFILE=$M $DRV make -C $T -f build/core/main.mk $MODULES "$@"
fi
fi
}
@@ -892,8 +892,15 @@ function mmm()
local ARGS=
local DIR TO_CHOP
local GET_INSTALL_PATH=
- local DASH_ARGS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^-.*$/')
- local DIRS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^[^-].*$/')
+
+ if [ "$(__detect_shell)" = "zsh" ]; then
+ set -lA DASH_ARGS $(echo "$@" | awk -v RS=" " -v ORS=" " '/^-.*$/')
+ set -lA DIRS $(echo "$@" | awk -v RS=" " -v ORS=" " '/^[^-].*$/')
+ else
+ local DASH_ARGS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^-.*$/')
+ local DIRS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^[^-].*$/')
+ fi
+
for DIR in $DIRS ; do
MODULES=`echo $DIR | sed -n -e 's/.*:\(.*$\)/\1/p' | sed 's/,/ /'`
if [ "$MODULES" = "" ]; then
@@ -956,8 +963,13 @@ function mmma()
local T=$(gettop)
local DRV=$(getdriver $T)
if [ "$T" ]; then
- local DASH_ARGS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^-.*$/')
- local DIRS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^[^-].*$/')
+ if [ "$(__detect_shell)" = "zsh" ]; then
+ set -lA DASH_ARGS $(echo "$@" | awk -v RS=" " -v ORS=" " '/^-.*$/')
+ set -lA DIRS $(echo "$@" | awk -v RS=" " -v ORS=" " '/^[^-].*$/')
+ else
+ local DASH_ARGS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^-.*$/')
+ local DIRS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^[^-].*$/')
+ fi
local MY_PWD=`PWD= /bin/pwd`
if [ "$MY_PWD" = "$T" ]; then
MY_PWD=
@@ -1811,7 +1823,7 @@ function makerecipe() {
repo forall -c '
- if [ "$REPO_REMOTE" == "github" ]
+ if [ "$REPO_REMOTE" = "github" ]
then
pwd
cmremote
@@ -1821,6 +1833,12 @@ function makerecipe() {
}
function cmgerrit() {
+
+ if [ "$(__detect_shell)" = "zsh" ]; then
+ # zsh does not define FUNCNAME, derive from funcstack
+ local FUNCNAME=$funcstack[1]
+ fi
+
if [ $# -eq 0 ]; then
$FUNCNAME help
return 1
@@ -2211,7 +2229,7 @@ function dopush()
echo "Device Found."
fi
- if (adb shell getprop ro.cm.device | grep -q "$CM_BUILD") || [ "$FORCE_PUSH" == "true" ];
+ if (adb shell getprop ro.cm.device | grep -q "$CM_BUILD") || [ "$FORCE_PUSH" = "true" ];
then
# retrieve IP and PORT info if we're using a TCP connection
TCPIPPORT=$(adb devices | egrep '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:[0-9]+[^0-9]+' \
@@ -2328,6 +2346,7 @@ EOF
alias mmp='dopush mm'
alias mmmp='dopush mmm'
+alias mmap='dopush mma'
alias mkap='dopush mka'
alias cmkap='dopush cmka'
@@ -2446,16 +2465,25 @@ function make()
mk_timer $(get_make_command) "$@"
}
-if [ "x$SHELL" != "x/bin/bash" ]; then
+function __detect_shell() {
case `ps -o command -p $$` in
*bash*)
+ echo bash
;;
*zsh*)
+ echo zsh
;;
*)
- echo "WARNING: Only bash and zsh are supported, use of other shell may lead to erroneous results"
+ echo unknown
+ return 1
;;
esac
+ return
+}
+
+
+if ! __detect_shell > /dev/null; then
+ echo "WARNING: Only bash and zsh are supported, use of other shell may lead to erroneous results"
fi
# Execute the contents of any vendorsetup.sh files we can find.