forked from SynthstromAudible/DelugeFirmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dbt
executable file
·48 lines (40 loc) · 1.51 KB
/
dbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env bash
# Deluge Build Tool (DBT)
#
# Build script for DelugeFirmware, blatantly borrowed from 'fbt' used by
# flipperdevices/flipperzero-firmware and licensed under GNU GPL
# shellcheck disable=SC2086 source=/dev/null
# unofficial strict mode
set -eu;
# private variables
N_GIT_THREADS="$(getconf _NPROCESSORS_ONLN)";
SCRIPT_PATH="$(cd "$(dirname "$0")" && pwd -P)";
DBT_EP="python3 dbt.py";
# public variables
DBT_NOENV="${DBT_NOENV:-""}";
DBT_NO_SYNC="${DBT_NO_SYNC:-""}";
DBT_TOOLCHAIN_PATH="${DBT_TOOLCHAIN_PATH:-$SCRIPT_PATH}";
DBT_VERBOSE="${DBT_VERBOSE:-""}";
DBT_NO_PYTHON_UPGRADE="${DBT_NO_PYTHON_UPGRADE:-""}";
if [ -z "$DBT_NOENV" ]; then
DBT_VERBOSE="$DBT_VERBOSE" . "$SCRIPT_PATH/scripts/toolchain/dbtenv.sh";
fi
if [ -z "$DBT_NO_SYNC" ]; then
if [ ! -d "$SCRIPT_PATH/.git" ]; then
echo "\".git\" directory not found, please clone repo via \"git clone\"";
exit 1;
fi
git submodule update --init --depth 1 --jobs "$N_GIT_THREADS";
fi
if [ -z "$DBT_NO_PYTHON_UPGRADE" ]; then
# Install python wheels if not already installed, upgrade pip
# afterward (needs certifi in place).
pip_cmd="python3 -m pip";
pip_requirements_path="${SCRIPT_PATH}/scripts/toolchain/requirements.txt"
pip_wheel_path="${TOOLCHAIN_ARCH_DIR}/python/wheel";
pip_certifi_wheel=$(find $pip_wheel_path/certifi*)
$pip_cmd install -q "${pip_certifi_wheel}"
$pip_cmd install -q --upgrade pip
$pip_cmd install -q -f "${pip_wheel_path}" -r "${pip_requirements_path}"
fi
$DBT_EP "$@"