mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-18 19:01:47 +03:00
9bf11d9fd2
* fbt: assets builder for apps WIP * fbt: automatically building private fap assets * docs: details on how to use image assets * fbt: renamed fap_assets -> fap_icons * fbt: support for fap_extbuild field * docs: info on fap_extbuild * fbt: added --proxy-env parame ter * fbt: made firmware_cdb & updater_cdb targets always available * fbt: renamed fap_icons -> fap_icon_assets * fbt: deprecated firmware_* target names for faps; new alias is "fap_APPID" * fbt: changed intermediate file locations for external apps * fbt: support for fap_private_libs; docs: updates * restored mbedtls as global lib * scripts: lint.py: skip "lib" subfolder * fbt: Sanity checks for building advanced faps as part of fw * docs: info on fap_private_libs; fbt: optimized *.fam indexing * fbt: cleanup; samples: added sample_icons app * fbt: moved example app to applications/examples * linter fix * docs: readme fixes * added applications/examples/application.fam stub * docs: more info on private libs Co-authored-by: あく <alleteam@gmail.com>
97 lines
2.5 KiB
Plaintext
97 lines
2.5 KiB
Plaintext
import SCons
|
|
from SCons.Platform import TempFileMunge
|
|
from fbt import util
|
|
|
|
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 = [
|
|
"WORKFLOW_BRANCH_OR_TAG",
|
|
"DIST_SUFFIX",
|
|
"HOME",
|
|
"APPDATA",
|
|
"PYTHONHOME",
|
|
"PYTHONNOUSERSITE",
|
|
"TMP",
|
|
"TEMP",
|
|
]
|
|
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=[
|
|
(
|
|
"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())
|
|
# 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"] = util.tempfile_arg_esc_func
|
|
util.wrap_tempfile(coreenv, "LINKCOM")
|
|
util.wrap_tempfile(coreenv, "ARCOM")
|
|
|
|
coreenv["SINGLEQUOTEFUNC"] = util.single_quote
|
|
|
|
Return("coreenv")
|