diff options
author | Leah Rowe <leah@libreboot.org> | 2025-08-31 21:37:30 +0100 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2025-08-31 21:37:30 +0100 |
commit | 24a8226fee0eb320c7b16da94971402b42a7ce87 (patch) | |
tree | 71306384d229ddaed867f38ad932e663fbaa9f71 /include/init.sh | |
parent | 7c04cd37b52afe971cafcb607f07428c46ea9b24 (diff) |
init.sh: tidy up xbmk_set_env
this is a general function that sets variables,
but there are many types of variables to be set.
rather than have all the logic inside this function,
handle it in subfunctions called by xbmk_set_env.
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include/init.sh')
-rw-r--r-- | include/init.sh | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/include/init.sh b/include/init.sh index d6d9a4bb..f71c486e 100644 --- a/include/init.sh +++ b/include/init.sh @@ -79,30 +79,12 @@ xbmk_set_env() # parent instance of xbmk, so continue. xbmk_parent_check_tmp - printf "%s\n" "$xbtmp" > "$xbmklock" || \ err "cannot create '$xbmklock'"; : - export XBMK_CACHE="$xbmkpwd/cache" - [ -L "$XBMK_CACHE" ] && [ "$XBMK_CACHE" = "$xbmkpwd/cache" ] && \ - err "cachedir '$xbmkpwd/cache' is a symlink" - [ ! -e "$XBMK_CACHE" ] || \ - [ -d "$XBMK_CACHE" ] || err "cachedir '$XBMK_CACHE' is a file"; : - - export PATH="$XBMK_CACHE/xbmkpath:$XBMK_CACHE/gnupath:$PATH" - xbmkpath="$PATH" - - # if "y": a coreboot target won't be built if target.cfg says release="n" - # (this is used to exclude certain build targets from releases) - [ -z "${XBMK_RELEASE+x}" ] && export XBMK_RELEASE="n" - [ "$XBMK_RELEASE" = "Y" ] && export XBMK_RELEASE="y" - [ "$XBMK_RELEASE" = "y" ] || export XBMK_RELEASE="n" - + xbmk_parent_set_export xbmk_set_version - export LOCALVERSION="-$projectname-${version%%-*}" - remkdir "$xbtmp" "$xbloc" "$XBMK_CACHE/gnupath" "$XBMK_CACHE/xbmkpath" - xbmk_set_pyver } @@ -164,6 +146,24 @@ xbmk_parent_check_tmp() x_ rm -f "$xbmklist" } +xbmk_parent_set_export() +{ + export XBMK_CACHE="$xbmkpwd/cache" + [ -L "$XBMK_CACHE" ] && [ "$XBMK_CACHE" = "$xbmkpwd/cache" ] && \ + err "cachedir '$xbmkpwd/cache' is a symlink" + [ ! -e "$XBMK_CACHE" ] || \ + [ -d "$XBMK_CACHE" ] || err "cachedir '$XBMK_CACHE' is a file"; : + + export PATH="$XBMK_CACHE/xbmkpath:$XBMK_CACHE/gnupath:$PATH" + xbmkpath="$PATH" + + # if "y": a coreboot target won't be built if target.cfg says release="n" + # (this is used to exclude certain build targets from releases) + [ -z "${XBMK_RELEASE+x}" ] && export XBMK_RELEASE="n" + [ "$XBMK_RELEASE" = "Y" ] && export XBMK_RELEASE="y" + [ "$XBMK_RELEASE" = "y" ] || export XBMK_RELEASE="n"; : +} + xbmk_set_threads() { [ -z "${XBMK_THREADS+x}" ] && export XBMK_THREADS=1 @@ -184,6 +184,7 @@ xbmk_set_version() update_xbmkver "." relname="$projectname-$version" + export LOCALVERSION="-$projectname-${version%%-*}" } xbmk_set_pyver() |