1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:57:45 +00:00

Ports: Prefix output with the build step and port name

We already have something similar for the toolchain builds. This makes
it easier to identify which build step is currently running.
This commit is contained in:
Gunnar Beutner 2022-10-23 15:22:42 +02:00 committed by Gunnar Beutner
parent 9cbf031b6d
commit 2968cbca11

View file

@ -10,6 +10,20 @@ unset SERENITY_STRIPPED_ENV
export MAKEJOBS="${MAKEJOBS:-$(nproc)}" export MAKEJOBS="${MAKEJOBS:-$(nproc)}"
buildstep() {
local buildstep_name=$1
shift
if [ -z "$@" ]; then
"${buildstep_name}"
else
"$@"
fi 2>&1 | sed $'s|^|\x1b[34m['"${port}/${buildstep_name}"$']\x1b[39m |'
}
buildstep_intro() {
echo -e "\x1b[1;32m=> $@\x1b[0m"
}
maybe_source() { maybe_source() {
if [ -f "$1" ]; then if [ -f "$1" ]; then
. "$1" . "$1"
@ -438,7 +452,7 @@ func_defined install || install() {
run make DESTDIR=$DESTDIR "${installopts[@]}" install run make DESTDIR=$DESTDIR "${installopts[@]}" install
} }
func_defined post_install || post_install() { func_defined post_install || post_install() {
echo :
} }
clean() { clean() {
rm -rf "${PORT_BUILD_DIR}" rm -rf "${PORT_BUILD_DIR}"
@ -457,11 +471,11 @@ clean_all() {
clean_dist clean_dist
} }
addtodb() { addtodb() {
buildstep_intro "Adding $port $version to database of installed ports..."
if [ -n "$(package_install_state $port $version)" ]; then if [ -n "$(package_install_state $port $version)" ]; then
echo "Note: $port $version already installed." echo "Note: Skipped because $port $version is already installed."
return return
fi fi
echo "Adding $port $version to database of installed ports..."
if [ "${1:-}" = "--auto" ]; then if [ "${1:-}" = "--auto" ]; then
echo "auto $port $version" >> "$packagesdb" echo "auto $port $version" >> "$packagesdb"
else else
@ -515,65 +529,65 @@ uninstall() {
mv packages.db.tmp "$packagesdb" mv packages.db.tmp "$packagesdb"
} }
do_installdepends() { do_installdepends() {
echo "Installing dependencies of $port..." buildstep_intro "Installing dependencies of $port..."
installdepends installdepends
} }
do_fetch() { do_fetch() {
echo "Fetching $port..." buildstep_intro "Fetching $port..."
fetch buildstep fetch
} }
do_patch() { do_patch() {
echo "Patching $port..." buildstep_intro "Patching $port..."
pre_patch buildstep pre_patch
patch_internal buildstep patch_internal
} }
do_configure() { do_configure() {
ensure_build ensure_build
if [ "$useconfigure" = "true" ]; then if [ "$useconfigure" = "true" ]; then
echo "Configuring $port..." buildstep_intro "Configuring $port..."
if "$use_fresh_config_sub"; then if "$use_fresh_config_sub"; then
ensure_new_config_sub buildstep ensure_new_config_sub
fi fi
if "$use_fresh_config_guess"; then if "$use_fresh_config_guess"; then
ensure_new_config_guess buildstep ensure_new_config_guess
fi fi
pre_configure buildstep pre_configure
configure buildstep configure
post_configure buildstep post_configure
else else
echo "This port does not use a configure script. Skipping configure step." buildstep configure echo "This port does not use a configure script. Skipping configure step."
fi fi
} }
do_build() { do_build() {
ensure_build ensure_build
echo "Building $port..." buildstep_intro "Building $port..."
build buildstep build
} }
do_install() { do_install() {
ensure_build ensure_build
pre_install buildstep pre_install
echo "Installing $port..." buildstep_intro "Installing $port..."
install buildstep install
install_main_launcher buildstep install_main_launcher
install_main_icon buildstep install_main_icon
post_install buildstep post_install
addtodb "${1:-}" addtodb "${1:-}"
} }
do_clean() { do_clean() {
echo "Cleaning build directory for $port..." buildstep_intro "Cleaning build directory for $port..."
clean buildstep clean
} }
do_clean_dist() { do_clean_dist() {
echo "Cleaning dist files for $port..." buildstep_intro "Cleaning dist files for $port..."
clean_dist buildstep clean_dist
} }
do_clean_all() { do_clean_all() {
echo "Cleaning all for $port..." buildstep_intro "Cleaning all for $port..."
clean_all buildstep clean_all
} }
do_uninstall() { do_uninstall() {
echo "Uninstalling $port..." buildstep_intro "Uninstalling $port..."
uninstall buildstep uninstall
} }
do_showproperty() { do_showproperty() {
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do