sh-elf-vhex/scripts/binutils/build.sh

76 lines
1.2 KiB
Bash
Raw Normal View History

#! /usr/bin/env bash
#---
# Help screen
#---
function help() {
cat << EOF
Script for the building step of binutils for the Vhex project.
Usage $0 [options...]
Configurations:
-h, --help Display this help
EOF
exit 0
}
#---
2021-11-16 17:43:29 +01:00
# Parse arguments
#---
for arg;
do case "$arg" in
--help | -h) help;;
*)
echo "error: unrecognized argument '$arg', giving up." >&2
exit 1
esac
done
#---
# Setup check
#---
_src=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
cd "$_src" || exit 1
source ../_utils.sh
2022-01-25 10:44:34 +01:00
# Avoid rebuilds and error
if [[ -f ../../_build/binutils/.fini ]]
then
echo "$TAG already built, skipping rebuild"
2022-01-25 10:44:34 +01:00
exit 0
fi
if [[ ! -d ../../_build/binutils/build ]]
then
2021-11-16 17:43:29 +01:00
echo "error: Are you sure to have configured binutils ? it seems that" >&2
echo " the build directory is missing..." >&2
exit 1
fi
2022-01-25 10:44:34 +01:00
cd ../../_build/binutils/build || exit 1
2021-11-15 17:04:56 +01:00
#---
2021-11-16 17:43:29 +01:00
# Build part
#---
2021-11-16 17:43:29 +01:00
echo "$TAG Compiling binutils (usually 5-10 minutes)..."
utils_makecmd
2021-11-15 17:04:56 +01:00
echo "$TAG Installing binutils to sysroot..."
2021-11-15 17:04:56 +01:00
utils_makecmd install-strip
2022-01-25 10:44:34 +01:00
# Indicate that the construction is finished
2022-01-25 10:44:34 +01:00
echo "$TAG Cleaning up..."
rm -rf ../build
rm -rf ../archive
2022-01-25 10:44:34 +01:00
touch ../.fini