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