Files
fwbuild/makefw
Michał Kopeć 0bb2d7adad makefw: check for FWBUILD existence
Signed-off-by: Michał Kopeć <michal.kopec@3mdeb.com>
2024-12-06 17:13:30 +01:00

47 lines
876 B
Bash
Executable File

#!/bin/bash
if [ ! -f FWBUILD ]; then
echo "Error: No FWBUILD file found. Exiting."
exit 1
fi
source FWBUILD
missing_dependency=0
if [ -n "$depends" ]; then
for dep in "${depends[@]}"; do
if [ ! -f $dep ]; then
echo "Missing dependency: $dep"
missing_dependency=1
fi
done
fi
if [ $missing_dependency = 1 ]; then
echo "Exiting due to missing dependencies!"
exit 2
fi
mkdir -p src
cd src
if [ -d $srcname ]; then
echo "Source already present, skipping"
else
git clone $source
fi
cd $srcname
# Prepare sources: checkout, apply any patches
prepare
# Build: Execute the build() function of the FWBUILD inside the docker container
declare -f build > .fwbuild
docker_pwd=${docker_pwd:=$PWD}
docker run --rm -it -v $PWD:$docker_pwd -w $docker_pwd $container bash -c "source .fwbuild && build"
# Package: Any post-build packaging, checksumming etc
package