mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-09-19 21:20:31 +02:00
more cleanup
this will be the last time, i promise Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
+4
-7
@@ -140,11 +140,10 @@ try_fetch_git()
|
|||||||
|
|
||||||
x_ xbmkdir "${5%/*}" "${cached%/*}"
|
x_ xbmkdir "${5%/*}" "${cached%/*}"
|
||||||
|
|
||||||
if ! try_$2 "$cached" "$@"; then
|
try_$2 "$cached" "$@" || \
|
||||||
return 1
|
return 1
|
||||||
elif [ ! -d "$cached" ]; then
|
[ ! -d "$cached" ] && \
|
||||||
return 1
|
return 1
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d "$5" ]; then
|
if [ ! -d "$5" ]; then
|
||||||
tmpclone "$cached" "$5" "$6" "$7" || \
|
tmpclone "$cached" "$5" "$6" "$7" || \
|
||||||
@@ -166,10 +165,9 @@ try_fetch_curl()
|
|||||||
x_ rm -f "$cached"
|
x_ rm -f "$cached"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ ! -f "$cached" ] && \
|
[ -f "$cached" ] || \
|
||||||
if ! try_$2 "$cached" "$@"; then
|
try_$2 "$cached" "$@" || \
|
||||||
return 1
|
return 1
|
||||||
fi
|
|
||||||
|
|
||||||
[ -f "$5" ] && \
|
[ -f "$5" ] && \
|
||||||
if bad_checksum "$6" "$5" 2>/dev/null; then
|
if bad_checksum "$6" "$5" 2>/dev/null; then
|
||||||
@@ -180,7 +178,6 @@ try_fetch_curl()
|
|||||||
return 1
|
return 1
|
||||||
elif bad_checksum "$6" "$cached"; then
|
elif bad_checksum "$6" "$cached"; then
|
||||||
x_ rm -f "$cached"
|
x_ rm -f "$cached"
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
+16
-29
@@ -39,9 +39,8 @@ xbmk_init()
|
|||||||
x_ xbmkdir "cache"
|
x_ xbmkdir "cache"
|
||||||
|
|
||||||
for init_cmd in get_version set_env set_threads git_init child_exec; do
|
for init_cmd in get_version set_env set_threads git_init child_exec; do
|
||||||
if ! xbmk_$init_cmd "$@"; then
|
xbmk_$init_cmd "$@" || \
|
||||||
break
|
break; :
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,9 +146,7 @@ xbmk_child_set_env()
|
|||||||
|
|
||||||
xbmk_child_set_tmp()
|
xbmk_child_set_tmp()
|
||||||
{
|
{
|
||||||
badtmp=""
|
eval "`newvar badtmp locktmp xbtmpchk`"
|
||||||
locktmp=""
|
|
||||||
xbtmpchk=""
|
|
||||||
|
|
||||||
xbtmpchk="`findpath "$TMPDIR" || err "!findpath $TMPDIR"`" || \
|
xbtmpchk="`findpath "$TMPDIR" || err "!findpath $TMPDIR"`" || \
|
||||||
err "!findpath '$TMPDIR'" "xbmk_child_set_tmp" "$@"
|
err "!findpath '$TMPDIR'" "xbmk_child_set_tmp" "$@"
|
||||||
@@ -281,14 +278,13 @@ xbmk_set_pyver()
|
|||||||
pyver="2"
|
pyver="2"
|
||||||
pyv="import sys; print(sys.version_info[:])"
|
pyv="import sys; print(sys.version_info[:])"
|
||||||
|
|
||||||
if ! pybin python3 1>/dev/null; then
|
pybin python3 1>/dev/null || \
|
||||||
python="python"
|
python="python"
|
||||||
fi
|
|
||||||
[ "$python" = "python3" ] && \
|
[ "$python" = "python3" ] && \
|
||||||
pyver="3"
|
pyver="3"
|
||||||
if ! pybin "$python" 1>/dev/null; then
|
pybin "$python" 1>/dev/null || \
|
||||||
pyver=""
|
pyver=""
|
||||||
fi
|
|
||||||
[ -z "$pyver" ] || \
|
[ -z "$pyver" ] || \
|
||||||
"`x_ pybin "$python"`" -c "$pyv" 1>/dev/null \
|
"`x_ pybin "$python"`" -c "$pyv" 1>/dev/null \
|
||||||
2>/dev/null || \
|
2>/dev/null || \
|
||||||
@@ -321,44 +317,37 @@ pybin()
|
|||||||
py="import sys; quit(1) if sys.prefix == sys.base_prefix else quit(0)"
|
py="import sys; quit(1) if sys.prefix == sys.base_prefix else quit(0)"
|
||||||
|
|
||||||
venv=1
|
venv=1
|
||||||
if ! command -v "$1" 1>/dev/null 2>/dev/null; then
|
command -v "$1" 1>/dev/null 2>/dev/null || \
|
||||||
venv=0
|
venv=0
|
||||||
fi
|
|
||||||
[ $venv -gt 0 ] && \
|
[ $venv -lt 1 ] || \
|
||||||
if ! "$1" -c "$py" 1>/dev/null 2>/dev/null; then
|
"$1" -c "$py" 1>/dev/null 2>/dev/null || \
|
||||||
venv=0
|
venv=0
|
||||||
fi
|
|
||||||
|
|
||||||
# ideally, don't rely on PATH or hardcoded paths if python venv.
|
|
||||||
# use the *real*, direct executable linked to by the venv symlink:
|
|
||||||
|
|
||||||
|
# try the direct path from PATH first. the binary specified by venv
|
||||||
|
# can be called directly, which then removes use of the venv
|
||||||
if [ $venv -gt 0 ] && [ -L "`command -v "$1" 2>/dev/null`" ]; then
|
if [ $venv -gt 0 ] && [ -L "`command -v "$1" 2>/dev/null`" ]; then
|
||||||
pypath="$(findpath \
|
pypath="$(findpath \
|
||||||
"$(command -v "$1" 2>/dev/null)" 2>/dev/null || :)"
|
"$(command -v "$1" 2>/dev/null)" 2>/dev/null || :)"
|
||||||
|
|
||||||
if [ -e "$pypath" ] && [ ! -d "$pypath" ] && \
|
if [ -e "$pypath" ] && [ ! -d "$pypath" ] && \
|
||||||
[ -x "$pypath" ]; then
|
[ -x "$pypath" ]; then
|
||||||
|
|
||||||
printf "%s\n" "$pypath"
|
printf "%s\n" "$pypath"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if python venv: fall back to common PATH directories for checking:
|
# if python venv: fall back to common PATH directories for checking:
|
||||||
|
|
||||||
[ $venv -gt 0 ] && for pypath in "/usr/local/bin" "/usr/bin"; do
|
[ $venv -gt 0 ] && for pypath in "/usr/local/bin" "/usr/bin"; do
|
||||||
if [ -e "$pypath/$1" ] && [ ! -d "$pypath/$1" ] && \
|
if [ -e "$pypath/$1" ] && [ ! -d "$pypath/$1" ] && \
|
||||||
[ -x "$pypath/$1" ]; then
|
[ -x "$pypath/$1" ]; then
|
||||||
|
|
||||||
printf "%s/%s\n" "$pypath" "$1"
|
printf "%s/%s\n" "$pypath" "$1"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
done && return 1
|
done && return 1
|
||||||
|
|
||||||
# Defer to normal command -v if not a venv
|
# Defer to normal command -v if not a venv
|
||||||
if ! command -v "$1" 2>/dev/null; then
|
command -v "$1" 2>/dev/null || \
|
||||||
return 1
|
return 1; :
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
xbmk_set_mirror()
|
xbmk_set_mirror()
|
||||||
@@ -382,11 +371,9 @@ xbmk_git_init()
|
|||||||
# the git identity check is only needed for: ./mk -b coreboot [args]
|
# the git identity check is only needed for: ./mk -b coreboot [args]
|
||||||
[ "${2-}" = "-b" ] && [ "${3-}" = "coreboot" ] && \
|
[ "${2-}" = "-b" ] && [ "${3-}" = "coreboot" ] && \
|
||||||
for gitarg in "user.name" "user.email"; do
|
for gitarg in "user.name" "user.email"; do
|
||||||
gitcmd="git config --includes $gitarg"
|
git config --includes $gitarg 1>/dev/null 2>/dev/null || \
|
||||||
if ! $gitcmd 1>/dev/null 2>/dev/null; then
|
|
||||||
err "Run this first: $gitcmd \"your ${gitcmd##*.}\"" \
|
err "Run this first: $gitcmd \"your ${gitcmd##*.}\"" \
|
||||||
"xbmk_git_init" "$@"
|
"xbmk_git_init" "$@"; :
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
[ -L ".git" ] && \
|
[ -L ".git" ] && \
|
||||||
|
|||||||
+11
-14
@@ -48,9 +48,8 @@ inject()
|
|||||||
|
|
||||||
check_release
|
check_release
|
||||||
if check_target; then
|
if check_target; then
|
||||||
if ! patch_release; then
|
patch_release || \
|
||||||
return 0
|
return 0; :
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
[ "$xchanged" = "y" ] && \
|
[ "$xchanged" = "y" ] && \
|
||||||
remktar
|
remktar
|
||||||
@@ -135,17 +134,16 @@ patch_release()
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if ! readkconfig; then
|
readkconfig || \
|
||||||
return 1
|
return 1
|
||||||
elif [ -n "$new_mac" ] && [ -n "$CONFIG_GBE_BIN_PATH" ]; then
|
|
||||||
modify_mac
|
[ -n "$new_mac" ] && [ -n "$CONFIG_GBE_BIN_PATH" ] && \
|
||||||
fi
|
modify_mac; :
|
||||||
}
|
}
|
||||||
|
|
||||||
readkconfig()
|
readkconfig()
|
||||||
{
|
{
|
||||||
x_ rm -f "$xbtmp/cbcfg"
|
x_ rm -f "$xbtmp/cbcfg"
|
||||||
|
|
||||||
fx_ scankconfig x_ find "$boarddir/config" -type f
|
fx_ scankconfig x_ find "$boarddir/config" -type f
|
||||||
|
|
||||||
if e "$xbtmp/cbcfg" f missing; then
|
if e "$xbtmp/cbcfg" f missing; then
|
||||||
@@ -155,9 +153,8 @@ readkconfig()
|
|||||||
. "$xbtmp/cbcfg" || \
|
. "$xbtmp/cbcfg" || \
|
||||||
err "Can't read '$xbtmp/cbcfg'" "readkconfig" "$@"
|
err "Can't read '$xbtmp/cbcfg'" "readkconfig" "$@"
|
||||||
|
|
||||||
if ! setvfile "$@"; then
|
setvfile "$@" || \
|
||||||
return 1
|
return 1; :
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
scankconfig()
|
scankconfig()
|
||||||
@@ -195,10 +192,10 @@ newmac()
|
|||||||
remktar()
|
remktar()
|
||||||
{
|
{
|
||||||
(
|
(
|
||||||
x_ cd "${tmpromdir%"/bin/$board"}"
|
x_ cd "${tmpromdir%"/bin/$board"}"
|
||||||
|
|
||||||
printf "Re-building tar archive (please wait)\n"
|
printf "Re-building tar archive (please wait)\n"
|
||||||
mkrom_tarball "bin/$board" 1>/dev/null
|
mkrom_tarball "bin/$board" 1>/dev/null
|
||||||
|
|
||||||
) || err "Cannot re-generate '$archive'" "remktar" "$@"
|
) || err "Cannot re-generate '$archive'" "remktar" "$@"
|
||||||
|
|
||||||
|
|||||||
+31
-41
@@ -111,20 +111,18 @@ trees()
|
|||||||
|
|
||||||
build_project()
|
build_project()
|
||||||
{
|
{
|
||||||
if ! configure_project "$configdir"; then
|
configure_project "$configdir" || \
|
||||||
return 0
|
return 0
|
||||||
elif [ -f "$listfile" ]; then
|
|
||||||
if ! $if_not_dry_build elfcheck; then
|
[ ! -f "$listfile" ] || \
|
||||||
|
$if_not_dry_build elfcheck || \
|
||||||
return 0
|
return 0
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ "$mode" = "distclean" ] && \
|
[ "$mode" = "distclean" ] && \
|
||||||
mode="clean"
|
mode="clean"
|
||||||
|
|
||||||
if ! run_make_command; then
|
run_make_command || \
|
||||||
return 0
|
return 0
|
||||||
fi
|
|
||||||
|
|
||||||
[ -z "$mode" ] && \
|
[ -z "$mode" ] && \
|
||||||
$if_not_dry_build \
|
$if_not_dry_build \
|
||||||
@@ -168,9 +166,9 @@ handle_defconfig()
|
|||||||
|
|
||||||
[ ! -f "CHANGELOG" ] && \
|
[ ! -f "CHANGELOG" ] && \
|
||||||
fetch_project "$project"
|
fetch_project "$project"
|
||||||
if ! configure_project "$target_dir"; then
|
|
||||||
|
configure_project "$target_dir" || \
|
||||||
return 0
|
return 0
|
||||||
fi
|
|
||||||
|
|
||||||
[ -z "$tree" ] && \
|
[ -z "$tree" ] && \
|
||||||
err "$configdir: 'tree' not set" "handle_defconfig" "$@"
|
err "$configdir: 'tree' not set" "handle_defconfig" "$@"
|
||||||
@@ -304,10 +302,9 @@ build_dependencies()
|
|||||||
delete_old_project_files()
|
delete_old_project_files()
|
||||||
{
|
{
|
||||||
# delete an entire source tree along with its builds:
|
# delete an entire source tree along with its builds:
|
||||||
if ! project_up_to_date hash "$tree" badhash "$datadir" \
|
project_up_to_date hash "$tree" badhash "$datadir" \
|
||||||
"$configdir/$tree" "$mdir"; then
|
"$configdir/$tree" "$mdir" || \
|
||||||
x_ rm -Rf "src/$project/$tree" "elf/$project/$tree"
|
x_ rm -Rf "src/$project/$tree" "elf/$project/$tree"
|
||||||
fi
|
|
||||||
|
|
||||||
x_ cp "$xbtmp/new.hash" "$XBMK_CACHE/hash/$project$tree"
|
x_ cp "$xbtmp/new.hash" "$XBMK_CACHE/hash/$project$tree"
|
||||||
|
|
||||||
@@ -320,10 +317,8 @@ delete_old_project_files()
|
|||||||
# this is useful when only the target config changes, for
|
# this is useful when only the target config changes, for
|
||||||
# example x200_8mb coreboot configs change, but not coreboot:
|
# example x200_8mb coreboot configs change, but not coreboot:
|
||||||
|
|
||||||
if ! project_up_to_date tghash "$target" badtghash "$configdir/$target"
|
project_up_to_date tghash "$target" badtghash "$configdir/$target" || \
|
||||||
then
|
|
||||||
x_ rm -Rf "elf/$project/$tree/$target"
|
x_ rm -Rf "elf/$project/$tree/$target"
|
||||||
fi
|
|
||||||
|
|
||||||
x_ cp "$xbtmp/new.hash" "$XBMK_CACHE/tghash/$project$target"
|
x_ cp "$xbtmp/new.hash" "$XBMK_CACHE/tghash/$project$target"
|
||||||
}
|
}
|
||||||
@@ -414,9 +409,8 @@ check_cross_compiler()
|
|||||||
|
|
||||||
check_gnu_path()
|
check_gnu_path()
|
||||||
{
|
{
|
||||||
if ! command -v "$1" 1>/dev/null; then
|
command -v "$1" 1>/dev/null || \
|
||||||
err "Host '$1' unavailable" "check_gnu_path" "$@"
|
err "Host '$1' unavailable" "check_gnu_path" "$@"
|
||||||
fi
|
|
||||||
|
|
||||||
eval "`newvar gccdir gccfull gccver gnatdir gnatfull gnatver`"
|
eval "`newvar gccdir gccfull gccver gnatdir gnatfull gnatver`"
|
||||||
|
|
||||||
@@ -431,9 +425,8 @@ check_gnu_path()
|
|||||||
|
|
||||||
host_gcc_gnat_match()
|
host_gcc_gnat_match()
|
||||||
{
|
{
|
||||||
if ! gnu_setver "$1" "$1"; then
|
gnu_setver "$1" "$1" || \
|
||||||
err "Command '$1' unavailable." "check_gnu_path" "$@"
|
err "Command '$1' unavailable." "check_gnu_path" "$@"
|
||||||
fi
|
|
||||||
gnu_setver "$2" "$2" || :
|
gnu_setver "$2" "$2" || :
|
||||||
|
|
||||||
eval "[ -z \"\$$1ver\" ] && err \"Cannot detect host '$1' version\""
|
eval "[ -z \"\$$1ver\" ] && err \"Cannot detect host '$1' version\""
|
||||||
@@ -458,11 +451,10 @@ match_gcc_gnat_versions()
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if ! gnu_setver "$2" "$_gnudir/$2-$_gnuver"; then
|
gnu_setver "$2" "$_gnudir/$2-$_gnuver" || \
|
||||||
return 1
|
return 1
|
||||||
elif [ "$gnatfull" != "$gccfull" ]; then
|
[ "$gnatfull" != "$gccfull" ] && \
|
||||||
return 1
|
return 1
|
||||||
fi
|
|
||||||
|
|
||||||
( link_gcc_gnat_versions "$@" "$_gnudir" "$_gnuver" ) || \
|
( link_gcc_gnat_versions "$@" "$_gnudir" "$_gnuver" ) || \
|
||||||
err "Can't link '$2-$_gnuver' '$_gnudir'" "check_gnu_path" "$@"; :
|
err "Can't link '$2-$_gnuver' '$_gnudir'" "check_gnu_path" "$@"; :
|
||||||
@@ -555,14 +547,13 @@ run_make_command()
|
|||||||
[ -z "$mode" ] && \
|
[ -z "$mode" ] && \
|
||||||
x_ $premake
|
x_ $premake
|
||||||
|
|
||||||
if $if_not_dry_build check_cmake "$srcdir"; then
|
$if_not_dry_build check_cmake "$srcdir" && \
|
||||||
[ -z "$mode" ] && \
|
[ -z "$mode" ] && \
|
||||||
$if_not_dry_build \
|
$if_not_dry_build \
|
||||||
check_autoconf "$srcdir"; :
|
check_autoconf "$srcdir"
|
||||||
fi
|
|
||||||
if ! $if_not_dry_build check_makefile "$srcdir"; then
|
$if_not_dry_build check_makefile "$srcdir" || \
|
||||||
return 1
|
return 1
|
||||||
fi
|
|
||||||
|
|
||||||
$if_not_dry_build \
|
$if_not_dry_build \
|
||||||
x_ make -C "$srcdir" $mode -j$XBMK_THREADS $makeargs
|
x_ make -C "$srcdir" $mode -j$XBMK_THREADS $makeargs
|
||||||
@@ -570,30 +561,29 @@ run_make_command()
|
|||||||
[ -z "$mode" ] && \
|
[ -z "$mode" ] && \
|
||||||
x_ $mkhelper
|
x_ $mkhelper
|
||||||
|
|
||||||
if ! check_makefile "$srcdir"; then
|
check_makefile "$srcdir" || \
|
||||||
return 0
|
return 0
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$mode" = "clean" ]; then
|
[ "$mode" = "clean" ] || \
|
||||||
$if_dry_build \
|
return 0
|
||||||
return 0
|
$if_dry_build \
|
||||||
if ! make -C "$srcdir" $cleanargs distclean; then
|
return 0
|
||||||
x_ make -C "$srcdir" $cleanargs clean
|
|
||||||
fi
|
make -C "$srcdir" $cleanargs distclean || \
|
||||||
fi
|
x_ make -C "$srcdir" $cleanargs clean; :
|
||||||
}
|
}
|
||||||
|
|
||||||
check_cmake()
|
check_cmake()
|
||||||
{
|
{
|
||||||
$if_dry_build \
|
$if_dry_build \
|
||||||
return 0
|
return 0
|
||||||
if [ ! -n "$cmakedir" ]; then
|
[ ! -n "$cmakedir" ] && \
|
||||||
return 0
|
return 0
|
||||||
elif ! check_makefile "$1"; then
|
|
||||||
if ! cmake -B "$1" "$1/$cmakedir"; then
|
check_makefile "$1" || \
|
||||||
|
cmake -B "$1" "$1/$cmakedir" || \
|
||||||
x_ check_makefile "$1"
|
x_ check_makefile "$1"
|
||||||
fi
|
|
||||||
fi
|
|
||||||
x_ check_makefile "$1"; :
|
x_ check_makefile "$1"; :
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-10
@@ -168,10 +168,9 @@ fetch()
|
|||||||
# the given hashsum. So, search for a matching file via bruteforce:
|
# the given hashsum. So, search for a matching file via bruteforce:
|
||||||
( fx_ "mkdst $binsum" x_ find "${_pre_dest%/*}" -type f ) || :
|
( fx_ "mkdst $binsum" x_ find "${_pre_dest%/*}" -type f ) || :
|
||||||
|
|
||||||
if ! bad_checksum "$binsum" "$_dest"; then
|
bad_checksum "$binsum" "$_dest" || \
|
||||||
[ -f "$_dest" ] && \
|
[ ! -f "$_dest" ] || \
|
||||||
return 0; :
|
return 0; :
|
||||||
fi
|
|
||||||
|
|
||||||
[ -z "$binsum" ] && \
|
[ -z "$binsum" ] && \
|
||||||
printf "'%s': checksum undefined\n" "$_dest" 1>&2
|
printf "'%s': checksum undefined\n" "$_dest" 1>&2
|
||||||
@@ -266,11 +265,6 @@ find_me()
|
|||||||
mfs="" # no MFS whitelist needed, due to -r:
|
mfs="" # no MFS whitelist needed, due to -r:
|
||||||
fi
|
fi
|
||||||
if [ "$MEclean" = "n" ] || [ "$MEshrink" != "y" ]; then
|
if [ "$MEclean" = "n" ] || [ "$MEshrink" != "y" ]; then
|
||||||
# MEclean can still be y, this just means don't shrink,
|
|
||||||
# so deleted modules would become padded space. this
|
|
||||||
# could also be used alongside --whitelist, if
|
|
||||||
# MEclean is otherwise enabled.
|
|
||||||
|
|
||||||
_r="" # don't re-locate ME modules
|
_r="" # don't re-locate ME modules
|
||||||
_trunc="" # don't shrink the me.bin file size
|
_trunc="" # don't shrink the me.bin file size
|
||||||
fi
|
fi
|
||||||
@@ -523,9 +517,8 @@ prep()
|
|||||||
( mksha512 "$_xrom" "vendorhashes" ) || err; :
|
( mksha512 "$_xrom" "vendorhashes" ) || err; :
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! add_vfiles "$_xrom"; then
|
add_vfiles "$_xrom" || \
|
||||||
return 1 # no need to insert files
|
return 1 # no need to insert files
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$nuke" = "nuke" ]; then
|
if [ "$nuke" = "nuke" ]; then
|
||||||
pad_one_byte "$_xrom"
|
pad_one_byte "$_xrom"
|
||||||
|
|||||||
Reference in New Issue
Block a user