Add build_multiple.sh that builds multiple KDE projects

This commit is contained in:
Tracey Clark 2025-10-17 22:31:14 -05:00
commit 986b3bc1ba

67
kde_dev/build_multiple.sh Executable file
View file

@ -0,0 +1,67 @@
#!/usr/bin/env bash
# Build multiple projects based on a provided list
current_date=$(date -I)
src_dir=$HOME/kde/src
dirs=''
# Function to display script usage UPDATE
usage () {
echo "Usage: $0"
echo "./$(basename "$0") [-h] [-d]"
echo ""
echo " -h, --help Display this help message"
echo " -d The list of directories to build"
echo ""
echo "This script takes a quoted list of directories. ex:"
echo ""
echo ' build_multiple "breeze libplasma plasma-desktop"'
echo ""
echo 'In each directory, this will pull the branch and build the project'
}
# list of arguments expected in the input
optstring=":d:h"
while getopts ${optstring} option; do
case "${option}" in
d) dirs="${OPTARG}" ;;
h) usage
exit 0 ;;
*) usage
exit 1 ;;
?)
echo "Invalid option: -${OPTARG}." >&2
echo usage >&2
exit 1
;;
esac
done
update_and_build_dir () {
cd ${src_dir}
echo `pwd`
cd ${dir}
echo `pwd`
git fetch || { echo 'git fetch failed' ; exit 1; }
git pull || { echo 'git pull failed' ; exit 1; }
kde-builder $(basename "$PWD") --no-src --resume-from $(basename "$PWD") || { echo "kde-builder failed for $PWD" ; exit 1; }
}
if [[ ( $@ == "--help") || $@ == "-h" ]]; then
usage
exit 0
fi
printf "Building requested projects\n%s ${dirs}\n"
# Split the string of directories into an array
read -r -a splitArray <<<"$dirs"
for dir in "${splitArray[@]}";
do
echo "dir passing to sub is ${dir}"
update_and_build_dir "${dir}"
done
echo "Builds done"