Fix sourcing envsetup.sh under zsh.

r262292 moved much of the script under the android_envsetup_main
function.  Since zsh does not define BASH_SOURCE, SCRIPT_DIR ends up
being set to $0, which contains the name of the function.  As a result,
the various paths are computed incorrectly under when envsetup.sh is
sourced from zsh.
BUG=

Review URL: https://codereview.chromium.org/330513007

git-svn-id: http://src.chromium.org/svn/trunk/src/build@276931 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
rickyz@google.com 2014-06-13 05:15:48 +00:00
Родитель fd7b79628d
Коммит 96863e5f58
1 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -14,7 +14,8 @@ fi
# This only exists to set local variables. Don't call this manually.
android_envsetup_main() {
local SCRIPT_DIR="$(dirname "${BASH_SOURCE:-$0}")"
local SCRIPT_PATH="$1"
local SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"
local CURRENT_DIR="$(readlink -f "${SCRIPT_DIR}/../../")"
if [[ -z "${CHROME_SRC}" ]]; then
@ -48,7 +49,9 @@ android_envsetup_main() {
export ENVSETUP_GYP_CHROME_SRC=${CHROME_SRC} # TODO(thakis): Remove.
}
android_envsetup_main
# In zsh, $0 is the name of the file being sourced.
android_envsetup_main "${BASH_SOURCE:-$0}"
unset -f android_envsetup_main
android_gyp() {
echo "Please call build/gyp_chromium instead. android_gyp is going away."