#!/bin/bash

# Path: scripts/cpp.sh

set -e

BLUE='\033[1;34m'
YELLOW='\033[1;33m'
GREEN='\033[1;32m'
NC='\033[0m'

if [ -f /etc/os-release ]; then
    . /etc/os-release
    OS=$ID
fi

echo -e "${BLUE}    LOG:${YELLOW} Setting up C++ Tooling (LLVM/Clang)...${NC}"

if [ "$OS" == "arch" ] || [ "$OS" == "manjaro" ]; then
    sudo pacman -S --noconfirm --needed clang cmake ninja lldb gdb
elif [ "$OS" == "ubuntu" ] || [ "$OS" == "debian" ]; then
    sudo DEBIAN_FRONTEND=noninteractive apt-get update
    sudo DEBIAN_FRONTEND=noninteractive apt-get install -y clang cmake ninja-build lldb gdb
fi

echo -e "${GREEN}    SUCCESS:${NC} C++ Environment Ready."
echo -e "    - Compiler: $(clang --version | head -n 1)"
echo -e "    - Builder:  $(cmake --version | head -n 1)"
echo -e "    - Debugger: $(lldb --version | head -n 1)"