carla/Util/BuildTools/Environment.sh

50 lines
826 B
Bash
Raw Permalink Normal View History

2018-07-04 17:59:59 +08:00
#! /bin/bash
# Sets the environment for other shell scripts.
set -e
CURDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../.." && pwd )"
source $(dirname "$0")/Vars.mk
unset CURDIR
if [ -n "${CARLA_BUILD_NO_COLOR}" ]; then
function log {
echo "`basename "$0"`: $1"
}
function fatal_error {
echo -e >&2 "`basename "$0"`: ERROR: $1"
exit 2
}
else
function log {
2019-04-16 19:06:40 +08:00
echo -e "\033[1;35m`basename "$0"`: $1\033[0m"
2018-07-04 17:59:59 +08:00
}
function fatal_error {
echo -e >&2 "\033[0;31m`basename "$0"`: ERROR: $1\033[0m"
exit 2
}
fi
2019-03-20 05:41:42 +08:00
function get_git_repository_version {
2018-07-04 17:59:59 +08:00
git describe --tags --dirty --always
}
function copy_if_changed {
mkdir -p $(dirname $2)
2018-12-22 04:21:58 +08:00
rsync -cIr --out-format="%n" $1 $2
2018-07-04 17:59:59 +08:00
}
function move_if_changed {
copy_if_changed $1 $2
rm -f $1
}
2018-10-16 01:41:51 +08:00
CARLA_BUILD_CONCURRENCY=`nproc --all`