60 lines
1.9 KiB
Bash
Executable File
60 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# setup.sh — bootstrap the Mestre development environment.
|
|
#
|
|
# Idempotent. Safe to run multiple times.
|
|
#
|
|
# Performs:
|
|
# 1. Initializes the Buildroot submodule.
|
|
# 2. Checks that the host has the tools Buildroot needs.
|
|
#
|
|
# On success, you can build with:
|
|
# ./scripts/build.sh
|
|
|
|
set -euo pipefail
|
|
|
|
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
cd "$REPO_ROOT"
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# 1. Buildroot submodule
|
|
# ---------------------------------------------------------------------------
|
|
if [ ! -f "$REPO_ROOT/buildroot/Makefile" ]; then
|
|
echo ">>> Initializing Buildroot submodule (this may take a minute)..."
|
|
git submodule update --init buildroot
|
|
else
|
|
echo ">>> Buildroot submodule already initialized."
|
|
fi
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# 2. Host prerequisites
|
|
# ---------------------------------------------------------------------------
|
|
# Buildroot's full list lives at:
|
|
# https://buildroot.org/downloads/manual/manual.html#requirement
|
|
# We check the most commonly missing ones; Buildroot itself will surface
|
|
# anything else we've forgotten.
|
|
echo ">>> Checking host prerequisites..."
|
|
missing=()
|
|
for tool in make gcc g++ patch perl python3 cpio rsync bc unzip wget file which sed; do
|
|
if ! command -v "$tool" >/dev/null 2>&1; then
|
|
missing+=("$tool")
|
|
fi
|
|
done
|
|
|
|
if [ ${#missing[@]} -gt 0 ]; then
|
|
echo
|
|
echo "!!! Missing host tools: ${missing[*]}"
|
|
echo
|
|
echo "On Debian/Ubuntu, install with:"
|
|
echo " sudo apt-get install build-essential patch perl python3 \\"
|
|
echo " cpio rsync bc unzip wget file"
|
|
echo
|
|
echo "See https://buildroot.org/downloads/manual/manual.html#requirement"
|
|
echo "for the complete list."
|
|
exit 1
|
|
fi
|
|
|
|
echo ">>> All required host tools present."
|
|
echo
|
|
echo "Setup complete. Next:"
|
|
echo " ./scripts/build.sh"
|