ladybird/Ports/build_all.sh
Gunnar Beutner b3db01e20e Ports: Detect more types of errors in the AvailablePorts.md file
This adds support for detecting incorrect version numbers and links
in the ports list.

Also, unlike before it doesn't parse the package.sh script but executes
it instead which allows us to detect syntax errors.
2021-04-23 16:11:48 +02:00

85 lines
2.0 KiB
Bash
Executable File

#!/usr/bin/env bash
clean=false
verbose=false
case "$1" in
clean)
clean=true
;;
verbose)
verbose=true
;;
*)
;;
esac
case "$2" in
clean)
clean=true
;;
verbose)
verbose=true
;;
*)
;;
esac
some_failed=false
built_ports=""
for file in *; do
if [ -d $file ]; then
pushd $file > /dev/null
port=$(basename $file)
port_built=0
for built_port in $built_ports; do
if [ "$built_port" = "$port" ]; then
port_built=1
break
fi
done
if [ $port_built -eq 1 ]; then
echo "Built $port."
popd > /dev/null
continue
fi
if ! [ -f package.sh ]; then
echo "ERROR: Skipping $port because its package.sh script is missing."
popd > /dev/null
continue
fi
built_ports="$built_ports $port $(./package.sh showproperty depends) "
if [ "$clean" == true ]; then
if [ "$verbose" == true ]; then
./package.sh clean_all
else
./package.sh clean_all > /dev/null 2>&1
fi
fi
if [ "$verbose" == true ]; then
if ./package.sh; then
echo "Built ${port}."
else
echo "ERROR: Build of ${port} was not successful!"
some_failed=true
fi
else
if ./package.sh > /dev/null 2>&1; then
echo "Built ${port}."
else
echo "ERROR: Build of ${port} was not successful!"
some_failed=true
fi
fi
popd > /dev/null
fi
done
if [ "$some_failed" == false ]; then
exit 0
else
exit 1
fi