Files
lbmk/include/release.sh
Leah Rowe 8347e2c85d xbmk: cleanup of recent code refactoring
be a bit less pedantic about if else clauses. leave the
big ones still with then on separate lines, where else
is specified.

also unroll a few condensed code lines where i missed
a few.

sloccount 2303 in lbmk. that's still only slightly bigger
than libreboot 20260907 which was 2180, and still much
smaller than libreboot 20230625 which was 3322.

this is *without* the condensed codelines, so now the only
thing that's reduced is the overall amount of logic present
in the build system.

and i should clarify that lbmk is presently much more powerful
than both of those two versions (20160907/20230625).

the 2016 one is useful for comparison historically, since that
was the last major version of libreboot prior to the great
second coming of leah in 2021; and the 2023 june release was
basically the last one before the great audits of 2023 to
2025 began.

not to brag (not much anyway), but all of this means that lbmk
is an insanely efficient build system, considering all the
features it has and what it does.

i unrolled the condensed code style in lbmk, making the scripts
a lot easier to read, because i received complainst about the
condensed style previously used; nicholas chin and alper nebi
yasak both told me that it sucked, and riku viitanen had hinted
at that same fact several months prior.

so hopefully now, lbmk is a bit nicer. those and other people
often find it challenging to challenge me because for reason
they assume i'll get upset and fly off the handle, but it's the
opposite. i want constant criticism, so that i know to improve!

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-09-24 13:19:23 +01:00

119 lines
2.2 KiB
Bash

# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright (c) 2023-2025 Leah Rowe <leah@libreboot.org>
eval "`setvars "" reldir reldest vdir rsrc relmode`"
release()
{
export XBMK_RELEASE="y"
reldir="release"
while getopts m: option; do
if [ -z "$OPTARG" ]; then
err "empty argument not allowed" "release" "$@"
fi
case "$option" in
m)
relmode="$OPTARG"
;;
*)
err "invalid option '-$option'" "release" "$@"
;;
esac
done
reldest="$reldir/$version"
if [ -e "$reldest" ]; then
err "already exists: \"$reldest\"" "release" "$@"
fi
vdir="`mktemp -d || err "can't make vdir"`" || \
err "can't make tmp vdir" "release" "$@"
vdir="$vdir/$version"
rsrc="$vdir/${relname}_src"
remkdir "$vdir"
x_ git clone . "$rsrc"
update_xbmkver "$rsrc"
prep_release src
prep_release tarball
if [ "$relmode" != "src" ]; then
prep_release bin
fi
x_ rm -Rf "$rsrc"
x_ mkdir -p "$reldir"
x_ mv "$vdir" "$reldir"
x_ rm -Rf "${vdir%"/$version"}"
printf "\n\nDONE! Check release files under %s\n" "$reldest"
}
prep_release()
{
(
if [ "$1" != "tarball" ]; then
x_ cd "$rsrc"
fi
prep_release_$1
) || err "can't prep release $1" "prep_release" "$@"
}
prep_release_src()
{
x_ ./mk -f
fx_ "x_ rm -Rf" x_ find . -name ".git"
fx_ "x_ rm -Rf" x_ find . -name ".gitmodules"
( fx_ nuke x_ find config -type f -name "nuke.list" ) || \
err "can't prune project files" "prep_release_src" "$@"; :
}
nuke()
{
r="$rsrc/src/${1#config/}"
if [ -d "${r%/*}" ]; then
x_ cd "${r%/*}"
dx_ "eval [ -L \"\$fx\" ] || x_ rm -Rf" "$rsrc/$1"
fi
}
prep_release_tarball()
{
git log --graph --pretty=format:'%Cred%h%Creset %s %Creset' \
--abbrev-commit > "$rsrc/CHANGELOG" || \
err "can't create '$rsrc/CHANGELOG'" "prep_release_tarball" "$@"
x_ rm -f "$rsrc/lock"
x_ rm -Rf "$rsrc/cache" "$rsrc/xbmkwd"
(
x_ cd "${rsrc%/*}"
x_ mktarball "${rsrc##*/}" "${rsrc##*/}.tar.xz"
) || err "can't create src tarball" "prep_release_tarball" "$@"; :
}
prep_release_bin()
{
x_ ./mk -d coreboot
x_ ./mk -b coreboot
x_ ./mk -b pico-serprog
x_ ./mx -b stm32-vserprog
x_ ./mk -b pcsx-redux
fx_ mkrom_tarball x_ find bin -maxdepth 1 -type d -name "serprog_*"
x_ mv bin ../roms
}