unleashed-firmware/fbt
hedger 35c903494c
[FL-3627, FL-3628, FL-3631] fbt: glob & git improvements (#3151)
* fbt: optional shallow submodule checkout
* fbt: more git threads by default
* fbt: git condition fix
* fbt: renamed FBT_SHALLOW to FBT_GIT_SUBMODULE_SHALLOW
* github: enabled   FBT_GIT_SUBMODULE_SHALLOW in flows
* fbt: always compile icons' .c, even if user does not specify a proper source glob; changed glob to require files at user-specified paths to exist
* fbt: fail build for missing imports in .faps
* fbt: moved STRICT_FAP_IMPORT_CHECK to commandline options; enabled by default
* ufbt: enabled STRICT_FAP_IMPORT_CHECK

Co-authored-by: あく <alleteam@gmail.com>
2023-10-23 18:55:36 +09:00

42 lines
1.2 KiB
Bash
Executable file

#!/bin/sh
# shellcheck disable=SC2086 source=/dev/null
# unofficial strict mode
set -eu;
# private variables
N_CORES="$(getconf _NPROCESSORS_ONLN)";
N_GIT_THREADS="$(($N_CORES * 2))";
SCRIPT_PATH="$(cd "$(dirname "$0")" && pwd -P)";
SCONS_DEFAULT_FLAGS="--warn=target-not-built";
SCONS_EP="python3 -m SCons";
# public variables
FBT_NOENV="${FBT_NOENV:-""}";
FBT_NO_SYNC="${FBT_NO_SYNC:-""}";
FBT_TOOLCHAIN_PATH="${FBT_TOOLCHAIN_PATH:-$SCRIPT_PATH}";
FBT_VERBOSE="${FBT_VERBOSE:-""}";
FBT_GIT_SUBMODULE_SHALLOW="${FBT_GIT_SUBMODULE_SHALLOW:-""}";
if [ -z "$FBT_NOENV" ]; then
FBT_VERBOSE="$FBT_VERBOSE" . "$SCRIPT_PATH/scripts/toolchain/fbtenv.sh";
fi
if [ -z "$FBT_VERBOSE" ]; then
SCONS_DEFAULT_FLAGS="$SCONS_DEFAULT_FLAGS -Q";
fi
if [ -z "$FBT_NO_SYNC" ]; then
if [ ! -e "$SCRIPT_PATH/.git" ]; then
echo "\".git\" directory not found, please clone repo via \"git clone\"";
exit 1;
fi
_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;
fi
$SCONS_EP $SCONS_DEFAULT_FLAGS "$@"