mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-09-19 21:20:31 +02:00
xbmk: general code cleanup
make the code much easier to read i also cleaned up the recent git identity check Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
+190
-33
@@ -57,9 +57,10 @@ trees()
|
||||
{
|
||||
flags="f:F:b:m:u:c:x:s:l:n:d:"
|
||||
|
||||
while getopts $flags option
|
||||
do
|
||||
while getopts $flags option; do
|
||||
|
||||
if [ -n "$flag" ]; then
|
||||
|
||||
err "only one flag is permitted" "trees" "$@"
|
||||
fi
|
||||
|
||||
@@ -69,6 +70,7 @@ trees()
|
||||
# ./mk -m coreboot does: make menuconfig -C src/coreboot/tree
|
||||
|
||||
case "$flag" in
|
||||
|
||||
-d)
|
||||
# -d is similar to -b, except that
|
||||
# a large number of operations will be
|
||||
@@ -79,13 +81,20 @@ trees()
|
||||
if_dry_build=""
|
||||
if_not_dry_build=":"
|
||||
;;
|
||||
|
||||
-b) : ;;
|
||||
|
||||
-u) mode="oldconfig" ;;
|
||||
|
||||
-m) mode="menuconfig" ;;
|
||||
|
||||
-c) mode="distclean" ;;
|
||||
|
||||
-x) mode="crossgcc-clean" ;;
|
||||
|
||||
-f|-F) # download source code for a project
|
||||
# macros. colon means false.
|
||||
|
||||
if_do_make=":"
|
||||
if_dry_build=""
|
||||
if_not_do_make=""
|
||||
@@ -96,13 +105,19 @@ trees()
|
||||
forcepull="y"
|
||||
fi
|
||||
;;
|
||||
|
||||
-s) mode="savedefconfig" ;;
|
||||
|
||||
-l) mode="olddefconfig" ;;
|
||||
|
||||
-n) mode="nconfig" ;;
|
||||
|
||||
*) err "invalid option '-$option'" "trees" "$@" ;;
|
||||
|
||||
esac
|
||||
|
||||
if [ -z "${OPTARG+x}" ]; then
|
||||
|
||||
shift 1
|
||||
|
||||
break
|
||||
@@ -115,13 +130,17 @@ trees()
|
||||
done
|
||||
|
||||
if [ -z "$flag" ]; then
|
||||
|
||||
err "missing flag ($flags)" "trees" "$@"
|
||||
|
||||
elif [ -z "$project" ]; then
|
||||
|
||||
fx_ "x_ ./mk $flag" x_ ls -1 config/git
|
||||
|
||||
return 1
|
||||
|
||||
elif [ ! -f "config/git/$project/pkg.cfg" ]; then
|
||||
|
||||
err "config/git/$project/pkg.cfg missing" "trees" "$@"
|
||||
fi
|
||||
|
||||
@@ -132,19 +151,26 @@ trees()
|
||||
dest_dir="$elfdir"
|
||||
|
||||
listfile="$datadir/build.list"
|
||||
|
||||
if [ ! -f "$listfile" ]; then
|
||||
|
||||
listfile="" # build.list is optional on all projects
|
||||
fi
|
||||
|
||||
mkhelpercfg="$datadir/mkhelper.cfg"
|
||||
|
||||
if e "$mkhelpercfg" f missing; then
|
||||
|
||||
mkhelpercfg="$xbtmp/mkhelper.cfg"
|
||||
|
||||
x_ touch "$mkhelpercfg"
|
||||
fi
|
||||
|
||||
targets="$*"
|
||||
cmd="build_targets $targets"
|
||||
|
||||
if singletree "$project"; then
|
||||
|
||||
cmd="build_project"
|
||||
fi
|
||||
|
||||
@@ -154,22 +180,29 @@ trees()
|
||||
build_project()
|
||||
{
|
||||
if ! configure_project "$configdir"; then
|
||||
|
||||
return 0
|
||||
|
||||
elif [ -f "$listfile" ]; then
|
||||
|
||||
if ! $if_not_dry_build elfcheck; then
|
||||
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$mode" = "distclean" ]; then
|
||||
|
||||
mode="clean"
|
||||
fi
|
||||
|
||||
if ! run_make_command; then
|
||||
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -z "$mode" ]; then
|
||||
|
||||
$if_not_dry_build \
|
||||
copy_elf; :
|
||||
fi
|
||||
@@ -178,18 +211,22 @@ build_project()
|
||||
build_targets()
|
||||
{
|
||||
if [ ! -d "$configdir" ]; then
|
||||
|
||||
err "directory '$configdir' doesn't exist" "build_targets" "$@"
|
||||
|
||||
elif [ $# -lt 1 ]; then
|
||||
|
||||
targets="$(ls -1 "$configdir")" || \
|
||||
err "'$configdir': can't list targets" "build_targets" "$@"
|
||||
fi
|
||||
|
||||
for x in $targets
|
||||
do
|
||||
for x in $targets; do
|
||||
|
||||
unset CROSS_COMPILE
|
||||
export PATH="$xbmkpath"
|
||||
|
||||
if [ "$x" = "list" ]; then
|
||||
|
||||
x_ ls -1 "config/$project"
|
||||
|
||||
listfile=""
|
||||
@@ -204,6 +241,7 @@ build_targets()
|
||||
x_ handle_defconfig
|
||||
|
||||
if [ -z "$mode" ]; then
|
||||
|
||||
x_ $postmake
|
||||
fi
|
||||
done; :
|
||||
@@ -214,39 +252,54 @@ handle_defconfig()
|
||||
target_dir="$configdir/$target"
|
||||
|
||||
if [ ! -f "CHANGELOG" ]; then
|
||||
|
||||
fetch_project "$project"
|
||||
fi
|
||||
|
||||
if ! configure_project "$target_dir"; then
|
||||
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -z "$tree" ]; then
|
||||
|
||||
err "$configdir: 'tree' not set" "handle_defconfig" "$@"
|
||||
fi
|
||||
|
||||
srcdir="src/$project/$tree"
|
||||
|
||||
if [ "$mode" = "${mode%clean}" ] && [ ! -d "$srcdir" ]; then
|
||||
if [ "$mode" = "${mode%clean}" ] && \
|
||||
[ ! -d "$srcdir" ]; then
|
||||
|
||||
return 0
|
||||
fi
|
||||
|
||||
for y in "$target_dir/config"/*
|
||||
do
|
||||
if [ "$flag" != "-d" ] && [ ! -f "$y" ]; then
|
||||
for y in "$target_dir/config"/*; do
|
||||
|
||||
if [ "$flag" != "-d" ] && \
|
||||
[ ! -f "$y" ]; then
|
||||
|
||||
continue
|
||||
|
||||
elif [ "$flag" != "-d" ]; then
|
||||
|
||||
defconfig="$y"
|
||||
fi
|
||||
|
||||
if [ -z "$mode" ]; then
|
||||
|
||||
check_defconfig || continue; :
|
||||
fi
|
||||
|
||||
if [ -z "$mode" ]; then
|
||||
|
||||
for _xarch in $xarch; do
|
||||
|
||||
$if_dry_build \
|
||||
break
|
||||
|
||||
if [ -n "$_xarch" ]; then
|
||||
|
||||
check_cross_compiler "$_xarch"
|
||||
fi
|
||||
done; :
|
||||
@@ -255,6 +308,7 @@ handle_defconfig()
|
||||
handle_makefile
|
||||
|
||||
if [ -z "$mode" ]; then
|
||||
|
||||
$if_not_dry_build \
|
||||
copy_elf
|
||||
fi
|
||||
@@ -263,7 +317,7 @@ handle_defconfig()
|
||||
|
||||
configure_project()
|
||||
{
|
||||
_tcfg="$1/target.cfg"
|
||||
tcfg="$1/target.cfg"
|
||||
|
||||
autoconfargs=""
|
||||
badhash=""
|
||||
@@ -281,13 +335,15 @@ configure_project()
|
||||
xgcctree=""
|
||||
xlang=""
|
||||
|
||||
if [ ! -f "$_tcfg" ]; then
|
||||
if [ ! -f "$tcfg" ]; then
|
||||
|
||||
buildtype="auto"
|
||||
fi
|
||||
|
||||
# globally initialise all variables for a source tree / target:
|
||||
|
||||
if e "$datadir/mkhelper.cfg" f; then
|
||||
|
||||
. "$datadir/mkhelper.cfg" || \
|
||||
err "Can't read '$datadir/mkhelper.cfg'" \
|
||||
"configure_project" "$@"
|
||||
@@ -295,8 +351,9 @@ configure_project()
|
||||
|
||||
# override target/tree specific variables from per-target config:
|
||||
|
||||
while e "$_tcfg" f || [ "$cmd" != "build_project" ]
|
||||
do
|
||||
while e "$tcfg" f || \
|
||||
[ "$cmd" != "build_project" ]; do
|
||||
|
||||
# TODO: implement infinite loop detection here, caused
|
||||
# by project targets pointing to other targets/trees
|
||||
# when then ultimate point back repeatedly; this is
|
||||
@@ -304,59 +361,78 @@ configure_project()
|
||||
# temporary files per tree/target name could be created
|
||||
# per iteration, and then checked the next time
|
||||
|
||||
printf "Loading %s config: %s\n" "$project" "$_tcfg"
|
||||
printf "Loading %s config: %s\n" "$project" "$tcfg"
|
||||
|
||||
rev=""
|
||||
tree=""
|
||||
|
||||
. "$_tcfg" || \
|
||||
err "Can't read '$_tcfg'" "configure_project" "$@"
|
||||
. "$tcfg" || \
|
||||
err "Can't read '$tcfg'" "configure_project" "$@"
|
||||
|
||||
if [ "$flag" = "-d" ]; then
|
||||
|
||||
build_depend="" # dry run
|
||||
fi
|
||||
|
||||
if [ "$cmd" = "build_project" ]; then
|
||||
|
||||
# single-tree, so it can't be a target pointing
|
||||
# to a main source tree
|
||||
|
||||
break
|
||||
fi
|
||||
|
||||
$if_do_make \
|
||||
break
|
||||
if [ "${_tcfg%/*/target.cfg}" = "${_tcfg%"/$tree/target.cfg"}" ]
|
||||
|
||||
if [ "${tcfg%/*/target.cfg}" = "${tcfg%"/$tree/target.cfg"}" ]
|
||||
then
|
||||
|
||||
# we have found the main source tree that
|
||||
# a given target uses; no need to continue
|
||||
|
||||
break
|
||||
|
||||
else
|
||||
_tcfg="${_tcfg%/*/target.cfg}/$tree/target.cfg"
|
||||
|
||||
tcfg="${tcfg%/*/target.cfg}/$tree/target.cfg"
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
if [ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ]; then
|
||||
if [ "$XBMK_RELEASE" = "y" ] && \
|
||||
[ "$release" = "n" ]; then
|
||||
|
||||
return 1
|
||||
fi
|
||||
if [ -n "$buildtype" ] && [ "${mode%config}" != "$mode" ]; then
|
||||
|
||||
if [ -n "$buildtype" ] && \
|
||||
[ "${mode%config}" != "$mode" ]; then
|
||||
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -z "$mode" ]; then
|
||||
|
||||
$if_not_dry_build \
|
||||
build_dependencies
|
||||
fi
|
||||
|
||||
mdir="$xbmkpwd/config/submodule/$project"
|
||||
|
||||
if [ -n "$tree" ]; then
|
||||
|
||||
mdir="$mdir/$tree"
|
||||
fi
|
||||
|
||||
if [ ! -f "CHANGELOG" ]; then
|
||||
|
||||
delete_old_project_files
|
||||
|
||||
$if_not_do_make \
|
||||
fetch_${cmd#build_}
|
||||
fi
|
||||
|
||||
$if_not_do_make \
|
||||
return 1
|
||||
|
||||
@@ -368,20 +444,25 @@ configure_project()
|
||||
|
||||
build_dependencies()
|
||||
{
|
||||
for bd in $build_depend
|
||||
do
|
||||
for bd in $build_depend; do
|
||||
|
||||
bd_project="${bd%%/*}"
|
||||
bd_tree="${bd##*/}"
|
||||
|
||||
if [ -z "$bd_project" ]; then
|
||||
|
||||
$if_not_dry_build \
|
||||
err "$project/$tree: !bd '$bd'" \
|
||||
"build_dependencies" "$@"
|
||||
fi
|
||||
|
||||
if [ "${bd##*/}" = "$bd" ]; then
|
||||
|
||||
bd_tree=""
|
||||
fi
|
||||
|
||||
if [ -n "$bd_project" ]; then
|
||||
|
||||
$if_not_dry_build \
|
||||
x_ ./mk -b $bd_project $bd_tree; :
|
||||
fi
|
||||
@@ -401,13 +482,16 @@ delete_old_project_files()
|
||||
# delete an entire source tree along with its builds:
|
||||
if ! project_up_to_date hash "$tree" badhash "$datadir" \
|
||||
"$configdir/$tree" "$mdir"; then
|
||||
|
||||
x_ rm -Rf "src/$project/$tree" "elf/$project/$tree"
|
||||
fi
|
||||
|
||||
x_ cp "$xbtmp/new.hash" "$XBMK_CACHE/hash/$project$tree"
|
||||
|
||||
if singletree "$project" || [ -z "$target" ] || [ "$target" = "$tree" ]
|
||||
then
|
||||
if singletree "$project" || \
|
||||
[ -z "$target" ] || \
|
||||
[ "$target" = "$tree" ]; then
|
||||
|
||||
return 0
|
||||
fi
|
||||
|
||||
@@ -417,6 +501,7 @@ delete_old_project_files()
|
||||
|
||||
if ! project_up_to_date tghash "$target" badtghash "$configdir/$target"
|
||||
then
|
||||
|
||||
x_ rm -Rf "elf/$project/$tree/$target"
|
||||
fi
|
||||
|
||||
@@ -437,6 +522,7 @@ project_up_to_date()
|
||||
x_ xbmkdir "$XBMK_CACHE/$hashdir"
|
||||
|
||||
if [ -f "$XBMK_CACHE/$hashdir/$project$hashname" ]; then
|
||||
|
||||
read -r old_hash < "$XBMK_CACHE/$hashdir/$project$hashname" \
|
||||
|| err \
|
||||
"$hashdir: err '$XBMK_CACHE/$hashdir/$project$hashname'" \
|
||||
@@ -445,6 +531,7 @@ project_up_to_date()
|
||||
fi
|
||||
|
||||
build_sbase
|
||||
|
||||
fx_ "x_ util/sbase/sha512sum" find "$@" -type f -not -path \
|
||||
"*/.git*/*" | awk '{print $1}' > "$xbtmp/tmp.hash" || \
|
||||
err "!h $project $hashdir" \
|
||||
@@ -456,6 +543,7 @@ project_up_to_date()
|
||||
|
||||
if [ "$hash" != "$old_hash" ] || \
|
||||
[ ! -f "$XBMK_CACHE/$hashdir/$project$hashname" ]; then
|
||||
|
||||
eval "$badhashvar=\"y\""
|
||||
fi
|
||||
|
||||
@@ -471,15 +559,19 @@ check_cross_compiler()
|
||||
cbdir="src/coreboot/$tree"
|
||||
|
||||
if [ "$project" != "coreboot" ]; then
|
||||
|
||||
cbdir="src/coreboot/default"
|
||||
fi
|
||||
|
||||
if [ -n "$xgcctree" ]; then
|
||||
|
||||
cbdir="src/coreboot/$xgcctree"
|
||||
fi
|
||||
|
||||
xfix="${1%-*}"
|
||||
|
||||
if [ "$xfix" = "x86_64" ]; then
|
||||
|
||||
xfix="x64"
|
||||
fi
|
||||
|
||||
@@ -487,39 +579,55 @@ check_cross_compiler()
|
||||
xgccargs="crossgcc-$xfix UPDATED_SUBMODULES=1 CPUS=$XBMK_THREADS"
|
||||
|
||||
x_ ./mk -f coreboot "${cbdir#src/coreboot/}"
|
||||
|
||||
x_ xbmkdir "elf/coreboot/$tree" # TODO: is this needed?
|
||||
|
||||
export PATH="$xbmkpwd/$cbdir/util/crossgcc/xgcc/bin:$PATH"
|
||||
|
||||
export CROSS_COMPILE="${xarch% *}-"
|
||||
|
||||
if [ -n "$xlang" ]; then
|
||||
|
||||
export BUILD_LANGUAGES="$xlang"
|
||||
fi
|
||||
|
||||
if [ -f "$xgccfile" ]; then
|
||||
|
||||
# skip the build, because a build already exists:
|
||||
|
||||
return 0
|
||||
fi
|
||||
|
||||
check_gnu_path gcc gnat || x_ check_gnu_path gnat gcc
|
||||
|
||||
# try twice because xgcc sometimes fails for, like, no reason
|
||||
#
|
||||
make -C "$cbdir" $xgccargs || x_ make -C "$cbdir" $xgccargs
|
||||
|
||||
# this tells subsequent runs that the build was already done:
|
||||
#
|
||||
x_ touch "$xgccfile"
|
||||
|
||||
# reset hostcc in PATH:
|
||||
#
|
||||
remkdir "$xbtmp/gnupath"
|
||||
}
|
||||
|
||||
# host toolchain version correction:
|
||||
|
||||
# fix mismatching gcc/gnat versions on debian trixie/sid. as of december 2024,
|
||||
# trixie/sid had gnat-13 as gnat and gcc-14 as gcc, but has gnat-14 in apt. in
|
||||
# some cases, gcc 13+14 and gnat-13 are present; or gnat-14 and gcc-14, but
|
||||
# gnat in PATH never resolves to gnat-14, because gnat-14 was "experimental"
|
||||
|
||||
# note that this was implemented for debian trixie-testing, but this same
|
||||
# issue will likely occur in future distros, including newer debian testing
|
||||
# releases. this just matches up the versions of each toolchain component.
|
||||
|
||||
check_gnu_path()
|
||||
{
|
||||
if ! command -v "$1" 1>/dev/null; then
|
||||
|
||||
err "Host '$1' unavailable" "check_gnu_path" "$@"
|
||||
fi
|
||||
|
||||
@@ -531,8 +639,11 @@ check_gnu_path()
|
||||
gnatver=""
|
||||
|
||||
if host_gcc_gnat_match "$@"; then
|
||||
|
||||
return 0
|
||||
|
||||
elif ! match_gcc_gnat_versions "$@"; then
|
||||
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
@@ -542,39 +653,47 @@ check_gnu_path()
|
||||
host_gcc_gnat_match()
|
||||
{
|
||||
if ! gnu_setver "$1" "$1"; then
|
||||
|
||||
err "Command '$1' unavailable." "check_gnu_path" "$@"
|
||||
fi
|
||||
|
||||
gnu_setver "$2" "$2" || :
|
||||
|
||||
eval "[ -z \"\$$1ver\" ] && err \"Cannot detect host '$1' version\""
|
||||
|
||||
if [ "$gnatfull" != "$gccfull" ]; then
|
||||
# non-matching gcc/gnat versions
|
||||
|
||||
# non-matching host gcc/gnat versions
|
||||
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# find all gcc/gnat versions, matching them up in PATH:
|
||||
# find all host gcc/gnat versions, matching them up in PATH:
|
||||
|
||||
match_gcc_gnat_versions()
|
||||
{
|
||||
eval "$1dir=\"$(dirname "$(command -v "$1")")\""
|
||||
|
||||
eval "_gnudir=\"\$$1dir\""
|
||||
eval "_gnuver=\"\$$1ver\""
|
||||
|
||||
for _bin in "$_gnudir/$2-"*
|
||||
do
|
||||
for _bin in "$_gnudir/$2-"*; do
|
||||
|
||||
if [ "${_bin#"$_gnudir/$2-"}" = "$_gnuver" ] && [ -x "$_bin" ]
|
||||
then
|
||||
|
||||
_gnuver="${_bin#"$_gnudir/$2-"}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if ! gnu_setver "$2" "$_gnudir/$2-$_gnuver"; then
|
||||
|
||||
return 1
|
||||
|
||||
elif [ "$gnatfull" != "$gccfull" ]; then
|
||||
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -593,10 +712,12 @@ link_gcc_gnat_versions()
|
||||
|
||||
x_ cd "$xbtmp/gnupath"
|
||||
|
||||
for _gnubin in "$_gnudir/$2"*"-$_gnuver"
|
||||
do
|
||||
for _gnubin in "$_gnudir/$2"*"-$_gnuver"; do
|
||||
|
||||
_gnuutil="${_gnubin##*/}"
|
||||
|
||||
if [ -e "$_gnubin" ]; then
|
||||
|
||||
x_ ln -s "$_gnubin" "${_gnuutil%"-$_gnuver"}"
|
||||
fi
|
||||
done
|
||||
@@ -617,6 +738,7 @@ gnu_setver()
|
||||
check_defconfig()
|
||||
{
|
||||
if [ ! -f "$defconfig" ]; then
|
||||
|
||||
$if_not_dry_build \
|
||||
err "$project/$target: no config" "check_defconfig" "$@"
|
||||
fi
|
||||
@@ -627,7 +749,9 @@ check_defconfig()
|
||||
|
||||
$if_dry_build \
|
||||
return 0
|
||||
|
||||
if ! elfcheck; then
|
||||
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
@@ -636,17 +760,23 @@ elfcheck()
|
||||
{
|
||||
# TODO: *STILL* very hacky check. do it properly (based on build.list)
|
||||
|
||||
# extremely hacky check that glues the entire universe together
|
||||
|
||||
# beware demons
|
||||
|
||||
( fx_ "eval exit 1 && err" find "$dest_dir" -type f ) || return 1; :
|
||||
}
|
||||
|
||||
handle_makefile()
|
||||
{
|
||||
if $if_not_dry_build check_makefile "$srcdir"; then
|
||||
|
||||
$if_not_dry_build \
|
||||
x_ make -C "$srcdir" $cleanargs clean
|
||||
fi
|
||||
|
||||
if [ -f "$defconfig" ]; then
|
||||
|
||||
x_ cp "$defconfig" "$srcdir/.config"
|
||||
fi
|
||||
|
||||
@@ -656,16 +786,20 @@ handle_makefile()
|
||||
_copy=".config"
|
||||
|
||||
if [ "$mode" = "savedefconfig" ]; then
|
||||
|
||||
_copy="defconfig"
|
||||
fi
|
||||
|
||||
if [ "${mode%config}" != "$mode" ]; then
|
||||
|
||||
$if_not_dry_build \
|
||||
x_ cp "$srcdir/$_copy" "$defconfig"; :
|
||||
fi
|
||||
|
||||
if [ -e "$srcdir/.git" ] && [ "$project" = "u-boot" ] && \
|
||||
if [ -e "$srcdir/.git" ] && \
|
||||
[ "$project" = "u-boot" ] && \
|
||||
[ "$mode" = "distclean" ]; then
|
||||
|
||||
$if_not_dry_build \
|
||||
x_ git -C "$srcdir" $cleanargs clean -fdx; :
|
||||
fi
|
||||
@@ -678,12 +812,16 @@ run_make_command()
|
||||
fi
|
||||
|
||||
if $if_not_dry_build check_cmake "$srcdir"; then
|
||||
|
||||
if [ -z "$mode" ]; then
|
||||
|
||||
$if_not_dry_build \
|
||||
check_autoconf "$srcdir"
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! $if_not_dry_build check_makefile "$srcdir"; then
|
||||
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -691,17 +829,22 @@ run_make_command()
|
||||
x_ make -C "$srcdir" $mode -j$XBMK_THREADS $makeargs
|
||||
|
||||
if [ -z "$mode" ]; then
|
||||
|
||||
x_ $mkhelper
|
||||
fi
|
||||
|
||||
if ! check_makefile "$srcdir"; then
|
||||
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "$mode" = "clean" ]; then
|
||||
|
||||
$if_dry_build \
|
||||
return 0
|
||||
|
||||
if ! make -C "$srcdir" $cleanargs distclean; then
|
||||
|
||||
x_ make -C "$srcdir" $cleanargs clean
|
||||
fi
|
||||
fi
|
||||
@@ -711,13 +854,18 @@ check_cmake()
|
||||
{
|
||||
$if_dry_build \
|
||||
return 0
|
||||
|
||||
if [ ! -n "$cmakedir" ]; then
|
||||
return 0
|
||||
|
||||
elif ! check_makefile "$1"; then
|
||||
|
||||
if ! cmake -B "$1" "$1/$cmakedir"; then
|
||||
|
||||
x_ check_makefile "$1"
|
||||
fi
|
||||
fi
|
||||
|
||||
x_ check_makefile "$1"; :
|
||||
}
|
||||
|
||||
@@ -727,12 +875,17 @@ check_autoconf()
|
||||
x_ cd "$1"
|
||||
|
||||
if [ -f "bootstrap" ]; then
|
||||
|
||||
x_ ./bootstrap $bootstrapargs
|
||||
fi
|
||||
|
||||
if [ -f "autogen.sh" ]; then
|
||||
|
||||
x_ ./autogen.sh $autogenargs
|
||||
fi
|
||||
|
||||
if [ -f "configure" ]; then
|
||||
|
||||
x_ ./configure $autoconfargs; :
|
||||
fi
|
||||
|
||||
@@ -741,7 +894,8 @@ check_autoconf()
|
||||
|
||||
check_makefile()
|
||||
{
|
||||
if [ ! -f "$1/Makefile" ] && [ ! -f "$1/makefile" ] && \
|
||||
if [ ! -f "$1/Makefile" ] && \
|
||||
[ ! -f "$1/makefile" ] && \
|
||||
[ ! -f "$1/GNUmakefile" ]; then
|
||||
|
||||
return 1
|
||||
@@ -751,13 +905,16 @@ check_makefile()
|
||||
copy_elf()
|
||||
{
|
||||
if [ -f "$listfile" ]; then
|
||||
|
||||
x_ xbmkdir "$dest_dir"
|
||||
fi
|
||||
|
||||
if [ -f "$listfile" ]; then
|
||||
while read -r f
|
||||
do
|
||||
|
||||
while read -r f; do
|
||||
|
||||
if [ -f "$srcdir/$f" ]; then
|
||||
|
||||
x_ cp "$srcdir/$f" "$dest_dir"
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user