2022-07-14 19:24:26 +03:00
|
|
|
#!/bin/sh
|
2022-06-26 15:00:03 +03:00
|
|
|
|
2022-07-14 19:24:26 +03:00
|
|
|
# shellcheck disable=SC2086 source=/dev/null
|
|
|
|
# unofficial strict mode
|
|
|
|
set -eu;
|
2022-06-26 15:00:03 +03:00
|
|
|
|
2022-08-02 17:05:31 +03:00
|
|
|
# private variables
|
2023-05-09 00:30:33 +03:00
|
|
|
N_GIT_THREADS="$(getconf _NPROCESSORS_ONLN)";
|
2022-07-14 19:24:26 +03:00
|
|
|
SCRIPT_PATH="$(cd "$(dirname "$0")" && pwd -P)";
|
2023-02-17 15:22:08 +03:00
|
|
|
SCONS_DEFAULT_FLAGS="--warn=target-not-built";
|
|
|
|
SCONS_EP="python3 -m SCons";
|
2022-08-02 17:05:31 +03:00
|
|
|
|
|
|
|
# public variables
|
|
|
|
FBT_NOENV="${FBT_NOENV:-""}";
|
|
|
|
FBT_NO_SYNC="${FBT_NO_SYNC:-""}";
|
|
|
|
FBT_TOOLCHAIN_PATH="${FBT_TOOLCHAIN_PATH:-$SCRIPT_PATH}";
|
2023-02-17 15:22:08 +03:00
|
|
|
FBT_VERBOSE="${FBT_VERBOSE:-""}";
|
2022-06-30 19:06:12 +03:00
|
|
|
|
2022-08-02 17:05:31 +03:00
|
|
|
if [ -z "$FBT_NOENV" ]; then
|
2023-02-17 15:22:08 +03:00
|
|
|
FBT_VERBOSE="$FBT_VERBOSE" . "$SCRIPT_PATH/scripts/toolchain/fbtenv.sh";
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$FBT_VERBOSE" ]; then
|
|
|
|
SCONS_DEFAULT_FLAGS="$SCONS_DEFAULT_FLAGS -Q";
|
2022-07-14 19:24:26 +03:00
|
|
|
fi
|
|
|
|
|
2022-08-02 17:05:31 +03:00
|
|
|
if [ -z "$FBT_NO_SYNC" ]; then
|
2022-07-14 19:24:26 +03:00
|
|
|
if [ ! -d "$SCRIPT_PATH/.git" ]; then
|
2023-03-15 18:24:56 +03:00
|
|
|
echo "\".git\" directory not found, please clone repo via \"git clone\"";
|
2022-07-14 19:24:26 +03:00
|
|
|
exit 1;
|
2022-07-04 20:38:18 +03:00
|
|
|
fi
|
2023-05-09 00:30:33 +03:00
|
|
|
git submodule update --init --depth 1 --jobs "$N_GIT_THREADS";
|
2022-06-26 15:00:03 +03:00
|
|
|
fi
|
|
|
|
|
2022-10-26 01:15:02 +03:00
|
|
|
$SCONS_EP $SCONS_DEFAULT_FLAGS "$@"
|