2021-11-14 12:14:41 +01:00
|
|
|
#! /usr/bin/env bash
|
|
|
|
|
|
|
|
verbose=false
|
|
|
|
|
|
|
|
#
|
|
|
|
# Help screen
|
|
|
|
#
|
2021-11-16 17:43:29 +01:00
|
|
|
help() {
|
2021-11-14 12:14:41 +01:00
|
|
|
cat << OEF
|
2021-11-16 17:43:29 +01:00
|
|
|
Script for the building step of binutils for the Vhex kernel.
|
2021-11-14 12:14:41 +01:00
|
|
|
|
|
|
|
Usage $0 [options...]
|
|
|
|
|
|
|
|
Configurations:
|
|
|
|
-h, --help Display this help
|
|
|
|
--verbose Display extra information during the building step
|
|
|
|
OEF
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
2021-11-16 17:43:29 +01:00
|
|
|
# Parse arguments
|
2021-11-14 12:14:41 +01:00
|
|
|
#
|
|
|
|
|
|
|
|
for arg; do case "$arg" in
|
|
|
|
--help | -h) help;;
|
|
|
|
--verbose) verbose=true;;
|
|
|
|
*)
|
|
|
|
echo "error: unreconized argument '$arg', giving up." >&2
|
|
|
|
exit 1
|
|
|
|
esac; done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Building step
|
|
|
|
#
|
|
|
|
|
|
|
|
TAG='<sh-elf-vhex-binutils>'
|
|
|
|
|
2022-01-25 10:44:34 +01:00
|
|
|
# Avoid rebuilds and error
|
|
|
|
|
|
|
|
if [[ -f ../../build/binutils/.fini ]]; then
|
|
|
|
echo "$TAG already build, skipping rebuild"
|
|
|
|
exit 0
|
|
|
|
fi
|
2021-11-14 12:14:41 +01:00
|
|
|
|
2021-11-16 17:43:29 +01:00
|
|
|
if [[ ! -d ../../build/binutils/build ]]; then
|
|
|
|
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
|
|
|
|
2021-11-14 12:14:41 +01:00
|
|
|
cd ../../build/binutils/build
|
|
|
|
|
|
|
|
|
2021-11-16 17:43:29 +01:00
|
|
|
# Import some helpers
|
|
|
|
|
2021-11-15 17:04:56 +01:00
|
|
|
source ../../../scripts/utils.sh
|
2021-11-14 12:14:41 +01:00
|
|
|
|
2021-11-15 17:04:56 +01:00
|
|
|
|
2021-11-16 17:43:29 +01:00
|
|
|
# Build part
|
|
|
|
|
2021-11-14 12:14:41 +01:00
|
|
|
echo "$TAG Compiling binutils (usually 5-10 minutes)..."
|
|
|
|
|
2021-11-15 17:04:56 +01:00
|
|
|
$quiet $make_cmd -j"$cores"
|
|
|
|
|
|
|
|
echo "$TAG Installing to local folder..."
|
|
|
|
|
|
|
|
$quiet $make_cmd install-strip
|
2022-01-25 10:44:34 +01:00
|
|
|
|
|
|
|
# Indicate that the build is finished
|
|
|
|
|
|
|
|
touch ../.fini
|
2021-11-16 17:43:29 +01:00
|
|
|
exit 0
|