flipperzero-firmware/site_scons/environ.scons
hedger 0adad32418
fbt fixes pt4 (#1899)
* fbt: fixed py scripts for gdb
* fbt: removed compiled dolphin assets from tracked files; resolved cached dependency issues by globally disabling deps cache; changed dependency tracking for dolphin assets
* fbt: fix for "resources" node lookup
* toolchain: bump to v.16 with scons + x64 win binaries
* fbt: using scons from toolchain
* vscode: fixed paths for 64-bit Windows toolchain
* fbt: added colors!
* fbt: moved import validator to ansi lib coloring
* fbt: moved COMSTR vars to tools
* fbt: custom action for fap dist
* fbt: added OPENOCD_ADAPTER_SERIAL configuration var for openocd operations
* fbt: added get_stlink target
* docs: details on libs for faps
* vscode: added DAP config for using Flipper as a debugger for a 2nd Flipper
* fbt: blind deps fix for sdk_origin
* fbt: sdk: moved deployment actions to pure python
* Github: disable disableLicenseExpirationCheck option for pvs

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2022-10-26 07:15:02 +09:00

102 lines
2.7 KiB
Plaintext

from SCons.Platform import TempFileMunge
from fbt.util import tempfile_arg_esc_func, single_quote, wrap_tempfile
import os
import multiprocessing
Import("VAR_ENV")
forward_os_env = {
# Import PATH from OS env - scons doesn't do that by default
"PATH": os.environ["PATH"],
}
# Proxying CI environment to child processes & scripts
variables_to_forward = [
# CI/CD variables
"WORKFLOW_BRANCH_OR_TAG",
"DIST_SUFFIX",
# Python & other tools
"HOME",
"APPDATA",
"PYTHONHOME",
"PYTHONNOUSERSITE",
"TMP",
"TEMP",
# Colors for tools
"TERM",
]
if proxy_env := GetOption("proxy_env"):
variables_to_forward.extend(proxy_env.split(","))
for env_value_name in variables_to_forward:
if environ_value := os.environ.get(env_value_name, None):
forward_os_env[env_value_name] = environ_value
coreenv = VAR_ENV.Clone(
tools=[
"fbt_tweaks",
(
"crosscc",
{
"toolchain_prefix": "arm-none-eabi-",
"versions": VAR_ENV["FBT_TOOLCHAIN_VERSIONS"],
},
),
"python3",
"sconsmodular",
"sconsrecursiveglob",
"ccache",
],
TEMPFILE=TempFileMunge,
MAXLINELENGTH=2048,
PROGSUFFIX=".elf",
ENV=forward_os_env,
)
# If DIST_SUFFIX is set in environment, is has precedence (set by CI)
if os_suffix := os.environ.get("DIST_SUFFIX", None):
coreenv.Replace(
DIST_SUFFIX=os_suffix,
)
# print(coreenv.Dump())
if not coreenv["VERBOSE"]:
coreenv.SetDefault(
CCCOMSTR="\tCC\t${SOURCE}",
CXXCOMSTR="\tCPP\t${SOURCE}",
ASCOMSTR="\tASM\t${SOURCE}",
ARCOMSTR="\tAR\t${TARGET}",
RANLIBCOMSTR="\tRANLIB\t${TARGET}",
LINKCOMSTR="\tLINK\t${TARGET}",
INSTALLSTR="\tINSTALL\t${TARGET}",
APPSCOMSTR="\tAPPS\t${TARGET}",
VERSIONCOMSTR="\tVERSION\t${TARGET}",
STRIPCOMSTR="\tSTRIP\t${TARGET}",
OBJDUMPCOMSTR="\tOBJDUMP\t${TARGET}",
# GDBCOMSTR="\tGDB\t${SOURCE}",
# GDBPYCOMSTR="\tGDB-PY\t${SOURCE}",
)
# Default value for commandline options
SetOption("num_jobs", multiprocessing.cpu_count())
## NB - disabled both caches since they seem to do more harm then good in our case
# Avoiding re-scan of all sources on every startup
# SetOption("implicit_cache", True)
# SetOption("implicit_deps_unchanged", True)
# More aggressive caching
SetOption("max_drift", 1)
# Random task queue - to discover isses with build logic faster
# SetOption("random", 1)
# Setting up temp file parameters - to overcome command line length limits
coreenv["TEMPFILEARGESCFUNC"] = tempfile_arg_esc_func
wrap_tempfile(coreenv, "LINKCOM")
wrap_tempfile(coreenv, "ARCOM")
coreenv["SINGLEQUOTEFUNC"] = single_quote
Return("coreenv")