2016-03-01 23:41:00 +08:00
|
|
|
#
|
|
|
|
# Copyright (c) 2015 Wind River Systems, Inc.
|
|
|
|
#
|
2017-01-19 09:01:01 +08:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
2016-03-01 23:41:00 +08:00
|
|
|
#
|
2015-05-11 00:16:10 +08:00
|
|
|
|
2016-03-01 18:31:29 +08:00
|
|
|
# In zsh the value of $0 depends on the FUNCTION_ARGZERO option which is
|
|
|
|
# set by default. FUNCTION_ARGZERO, when it is set, sets $0 temporarily
|
|
|
|
# to the name of the function/script when executing a shell function or
|
|
|
|
# sourcing a script. POSIX_ARGZERO option, when it is set, exposes the
|
|
|
|
# original value of $0 in spite of the current FUNCTION_ARGZERO setting.
|
2016-03-18 20:50:21 +08:00
|
|
|
#
|
|
|
|
# Note: The version of zsh need to be 5.0.6 or above. Any versions below
|
2022-03-17 05:07:43 +08:00
|
|
|
# 5.0.6 maybe encounter errors when sourcing this script.
|
2019-05-17 17:24:11 +08:00
|
|
|
if [ -n "${ZSH_VERSION:-}" ]; then
|
2019-11-23 04:04:20 +08:00
|
|
|
dir="${(%):-%N}"
|
2016-03-01 18:31:29 +08:00
|
|
|
if [ $options[posixargzero] != "on" ]; then
|
|
|
|
setopt posixargzero
|
2019-11-23 04:04:20 +08:00
|
|
|
name=$(basename -- "$0")
|
2019-11-04 22:18:48 +08:00
|
|
|
unsetopt posixargzero
|
2016-03-01 18:31:29 +08:00
|
|
|
else
|
2019-11-23 04:04:20 +08:00
|
|
|
name=$(basename -- "$0")
|
2016-03-01 18:31:29 +08:00
|
|
|
fi
|
|
|
|
else
|
2019-11-23 04:04:20 +08:00
|
|
|
dir="${BASH_SOURCE[0]}"
|
|
|
|
name=$(basename -- "$0")
|
2016-03-01 18:31:29 +08:00
|
|
|
fi
|
|
|
|
|
2019-11-23 04:04:20 +08:00
|
|
|
if [ "X$name" "==" "Xzephyr-env.sh" ]; then
|
2015-06-20 09:21:48 +08:00
|
|
|
echo "Source this file (do NOT execute it!) to set the Zephyr Kernel environment."
|
2015-05-11 00:16:10 +08:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
# You can further customize your environment by creating a bash script called
|
2017-04-01 03:08:33 +08:00
|
|
|
# .zephyrrc in your home directory. It will be automatically
|
2015-05-11 00:16:10 +08:00
|
|
|
# run (if it exists) by this script.
|
|
|
|
|
2017-07-16 00:13:36 +08:00
|
|
|
if uname | grep -q "MINGW"; then
|
2017-04-01 03:26:25 +08:00
|
|
|
win_build=1
|
2019-11-23 04:04:20 +08:00
|
|
|
pwd_opt="-W"
|
2017-04-01 03:26:25 +08:00
|
|
|
else
|
|
|
|
win_build=0
|
2019-11-23 04:04:20 +08:00
|
|
|
pwd_opt=""
|
2017-04-01 03:26:25 +08:00
|
|
|
fi
|
2015-12-09 10:49:00 +08:00
|
|
|
|
2015-05-11 00:16:10 +08:00
|
|
|
# identify OS source tree root directory
|
2019-11-23 04:04:20 +08:00
|
|
|
export ZEPHYR_BASE=$( builtin cd "$( dirname "$dir" )" > /dev/null && pwd ${pwd_opt})
|
|
|
|
unset pwd_opt
|
2015-05-11 00:16:10 +08:00
|
|
|
|
2015-06-06 10:46:00 +08:00
|
|
|
scripts_path=${ZEPHYR_BASE}/scripts
|
2017-04-01 03:26:25 +08:00
|
|
|
if [ "$win_build" -eq 1 ]; then
|
|
|
|
scripts_path=$(echo "/$scripts_path" | sed 's/\\/\//g' | sed 's/://')
|
|
|
|
fi
|
|
|
|
unset win_build
|
2017-01-07 04:27:39 +08:00
|
|
|
if ! echo "${PATH}" | grep -q "${scripts_path}"; then
|
|
|
|
export PATH=${scripts_path}:${PATH}
|
|
|
|
fi
|
2015-05-11 00:16:10 +08:00
|
|
|
unset scripts_path
|
|
|
|
|
|
|
|
# enable custom environment settings
|
2015-06-06 10:42:27 +08:00
|
|
|
zephyr_answer_file=~/zephyr-env_install.bash
|
2016-02-13 11:24:47 +08:00
|
|
|
[ -f ${zephyr_answer_file} ] && {
|
2019-11-23 04:04:45 +08:00
|
|
|
echo "Warning: Please rename ~/zephyr-env_install.bash to ~/.zephyrrc"
|
|
|
|
. ${zephyr_answer_file}
|
2016-02-13 11:24:47 +08:00
|
|
|
}
|
|
|
|
unset zephyr_answer_file
|
|
|
|
zephyr_answer_file=~/.zephyrrc
|
2019-11-23 04:04:45 +08:00
|
|
|
[ -f ${zephyr_answer_file} ] && . ${zephyr_answer_file}
|
2015-06-06 10:42:27 +08:00
|
|
|
unset zephyr_answer_file
|