cbmk: allow easier sync with lbmk

an equivalent change has been made in lbmk.

certain cbmk-specific variable names have been made
generic, with certain functions and other variables
moved around.

i maintain sync between libreboot and canoeboot, where
both projects can have the same behaviours, and most of
the merge conflicts have to do with variable names
containing "LBMK", "lbmk", "cbmk" or "CBMK", or
indeed "canoeboot" and "libreboot"

LBMK/lbmk/CBMK/cbmk variables between canoeboot and
libreboot now contain the string XBMK/xbmk

it should now be *much* easier to merge build system
changes between lbmk and cbmk.

Signed-off-by: Leah Rowe <info@minifree.org>
audit2-merge1
Leah Rowe 2024-05-16 03:59:23 +01:00
parent e71189420f
commit 3e5db248dd
3 changed files with 25 additions and 25 deletions

18
build
View File

@ -8,7 +8,7 @@
set -u -e
if [ "./${0##*/}" != "${0}" ] || [ ! -f "build" ] || [ -L "build" ]; then
printf "You must run this in the cbmk work directory.\n" 1>&2
printf "You must run this in the proper work directory.\n" 1>&2
exit 1
fi
@ -25,7 +25,7 @@ main()
x_ id -u 1>/dev/null 2>/dev/null
[ $# -lt 1 ] && $err "Check $projectname documentation for help."
[ "$1" = "dependencies" ] && x_ install_packages $@ && cbmk_exit 0
[ "$1" = "dependencies" ] && x_ install_packages $@ && xbmk_exit 0
which git 1>/dev/null 2>/dev/null || \
git_err "git not installed. please install git-scm."
@ -37,7 +37,7 @@ main()
for cmd in initcmd git_init excmd; do
eval "${cmd} \$@"
done
cbmk_exit 0
xbmk_exit 0
}
initcmd()
@ -51,7 +51,7 @@ initcmd()
script_path="script/${1}"
return 0 ;;
esac
cbmk_exit 0
xbmk_exit 0
}
install_packages()
@ -73,7 +73,7 @@ install_packages()
}
# release archives contain .gitignore, but not .git.
# cbmk can be run from cbmk.git, or an archive.
# xbmk can be run from xbmk.git, or an archive.
git_init()
{
[ -L ".git" ] && $err "Reference .git is a symlink"
@ -83,7 +83,7 @@ git_init()
git init || $err "${PWD}: cannot initialise Git repository"
git add -A . || $err "${PWD}: cannot add files to Git repository"
git commit -m "${projectname} ${version}" --date "${cdate}" \
--author="cbmk <cbmk@canoeboot.org>" || \
--author="xbmk <xbmk@example.com>" || \
$err "$PWD: can't commit ${projectname}/${version}, date $cdate"
git tag -a "${version}" -m "${projectname} ${version}" || \
$err "${PWD}: cannot git-tag ${projectname}/${version}"
@ -97,7 +97,7 @@ excmd()
mkrelease()
{
export CBMK_RELEASE="y"
export XBMK_RELEASE="y"
vdir="release"
while getopts d:m: option; do
@ -169,9 +169,9 @@ fetch_trees()
rm -Rf tmp .git src/u-boot/*/test/lib/strlcat.c || $err "$_xm !rm"
}
cbmk_exit()
xbmk_exit()
{
tmp_cleanup || err_ "cbmk_exit: can't rm tmpdir upon exit $1: $tmpdir"
tmp_cleanup || err_ "xbmk_exit: can't rm tmpdir upon exit $1: $tmpdir"
exit $1
}

View File

@ -33,34 +33,34 @@ setvars()
done
printf "%s\n" "${_setvars% }"
}
eval "$(setvars "" versiondate tmpdir _nogit version _dest board boarddir \
cbmk_release threads projectname relname)"
eval "$(setvars "" versiondate tmpdir _nogit version board boarddir \
xbmk_release threads projectname relname)"
# 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)
set | grep CBMK_RELEASE 1>/dev/null 2>/dev/null || cbmk_release="n" || :
[ -z "$cbmk_release" ] && cbmk_release="$CBMK_RELEASE"
[ "$cbmk_release" = "n" ] || [ "$cbmk_release" = "y" ] || cbmk_release="n"
export CBMK_RELEASE="$cbmk_release"
set | grep XBMK_RELEASE 1>/dev/null 2>/dev/null || xbmk_release="n" || :
[ -z "$xbmk_release" ] && xbmk_release="$XBMK_RELEASE"
[ "$xbmk_release" = "n" ] || [ "$xbmk_release" = "y" ] || xbmk_release="n"
export XBMK_RELEASE="$xbmk_release"
set | grep TMPDIR 1>/dev/null 2>/dev/null || tmpdir_was_set="n"
if [ "${tmpdir_was_set}" = "y" ]; then
[ "${TMPDIR%_*}" = "/tmp/cbmk" ] || tmpdir_was_set="n"
[ "${TMPDIR%_*}" = "/tmp/xbmk" ] || tmpdir_was_set="n"
fi
if [ "${tmpdir_was_set}" = "n" ]; then
export TMPDIR="/tmp"
tmpdir="$(mktemp -d -t cbmk_XXXXXXXX)"
tmpdir="$(mktemp -d -t xbmk_XXXXXXXX)"
export TMPDIR="${tmpdir}"
else
export TMPDIR="${TMPDIR}"
tmpdir="${TMPDIR}"
fi
set | grep CBMK_THREADS 1>/dev/null 2>/dev/null && threads="$CBMK_THREADS"
set | grep XBMK_THREADS 1>/dev/null 2>/dev/null && threads="$XBMK_THREADS"
[ -z "$threads" ] && threads=1
expr "X$threads" : "X-\{0,1\}[0123456789][0123456789]*$" \
1>/dev/null 2>/dev/null || threads=1 # user specified a non-integer
export CBMK_THREADS="$threads"
export XBMK_THREADS="$threads"
x_() {
[ $# -lt 1 ] || ${@} || $err "Unhandled non-zero exit: $@"; return 0

View File

@ -61,14 +61,14 @@ main()
fi
bstr="directories"
[ "$cbmk_release" = "y" ] && bstr="tarballs"
[ "$xbmk_release" = "y" ] && bstr="tarballs"
[ -z "${targets}" ] && $err "No ROM images were compiled"
printf "\nROM images available in these %s:\n" "$bstr"
eval "printf \"${targets}\""
printf "^^ ROM images available in these %s.\n\n" "$bstr"
[ "$cbmk_release" = "y" ] && \
[ "$xbmk_release" = "y" ] && \
printf "Always run the inject command on release images!\n"
printf "DO NOT flash images from elf/ - please use bin/ instead.\n"
}
@ -99,7 +99,7 @@ handle_serprog()
done
fi
[ "$cbmk_release" = "y" ] && mktar_release "bin/serprog_$1"; return 0
[ "$xbmk_release" = "y" ] && mktar_release "bin/serprog_$1"; return 0
}
build_rp2040_rom()
@ -144,7 +144,7 @@ handle_coreboot_target()
configure_target
[ "$board" = "$tree" ] && return 0
if [ "$cbmk_release" = "y" ] && [ "$release" = "n" ]; then
if [ "$xbmk_release" = "y" ] && [ "$release" = "n" ]; then
printf "Target '%s' disabled for release.\n" "$board"
return 0
fi
@ -153,8 +153,8 @@ handle_coreboot_target()
build_target_mainboard
[ -d "bin/${board}" ] || return 0
[ "$cbmk_release" = "y" ] || targets="* bin/${board}\n${targets}"
[ "$cbmk_release" = "y" ] || return 0
[ "$xbmk_release" = "y" ] || targets="* bin/${board}\n${targets}"
[ "$xbmk_release" = "y" ] || return 0
targets="* bin/${relname}_$board.tar.xz\n$targets"
mktar_release "bin/$board"