trees: unified handling of source downloads

run it from load_project_config()

Signed-off-by: Leah Rowe <leah@libreboot.org>
audit6
Leah Rowe 2024-06-29 22:02:26 +01:00
parent 7bf2835207
commit cfc9f62ffe
1 changed files with 8 additions and 13 deletions

View File

@ -12,7 +12,7 @@ set -u -e
cbmakeargs="UPDATED_SUBMODULES=1 CPUS=$XBMK_THREADS"
eval `setvars "" xarch cdir config cmakedir xlang mode makeargs elfdir xtree \
project target target_dir targets tree _f target1 bootstrapargs mkhelper \
autoconfargs config_name listfile autogenargs btype`
autoconfargs config_name listfile autogenargs btype _cmd`
main()
{
@ -57,11 +57,6 @@ main()
build_project()
{
if [ "$mode" = "fetch" ]; then
[ -f "CHANGELOG" ] && return 0
fetch_project; return 0
fi
load_project_config "$cfgsdir" 0 || return 0
[ -f "$listfile" ] || listfile="" # optional on single-tree
@ -125,10 +120,6 @@ handle_defconfig()
handle_src_tree()
{
target_dir="$cfgsdir/$target"
if [ "$mode" = "fetch" ]; then
[ -f "CHANGELOG" ] && return 1
fetch_targets; return 1
fi
load_project_config "$target_dir" || return 1
x_ mkdir -p "$elfdir/$target"
@ -158,10 +149,14 @@ load_project_config()
# target.cfg optional on single-tree so return if missing.
# target.cfg mandatory on multi-tree so err if missing.
_setcfgarg="" && [ $# -gt 1 ] && _setcfgarg="$2"
eval `setcfg "$1/target.cfg" $_setcfgarg`
if [ -f "$1/target.cfg" ] || [ -z "$_setcfgarg" ]; then
eval `setcfg "$1/target.cfg" $_setcfgarg`
fi
[ -z "$btype" ] || [ "${mode%config}" = "$mode" ] || \
return 1; return 0
[ -z "$btype" ] || [ "${mode%config}" = "$mode" ] || return 1
[ "$mode" = "fetch" ] || return 0
[ -f "CHANGELOG" ] && return 1; fetch_${_cmd#build_}; return 1
}
check_cross_compiler()