+++ /dev/null
-#!/bin/bash
-# Copyright (C) 2021-2022 Harry Godden (hgn) - All Rights Reserved
-#
-# Build script utilities
-# Usage:
-# 1) in your build script, define the function
-#
-# vg_command(){
-#
-# }
-#
-# it should handle $1 as the switch for different commands
-# if you want to run an existing command, use run_command <x> to do it.
-#
-#
-# 2) at the end of the build script, include:
-#
-# source vg/vg_build.sh
-#
-# this runs the triggers that are passed in from the invoker
-#
-#
-# 3) targets with standard tool support should run the command:
-#
-# vg_compile_tools
-#
-# make sure _compiler _options, and _ext are setup for that target
-# these will only invoke the tooling compilers if tools is passed to the
-# build script.
-#
-# Util
-# ==============================================================================
-
-error(){
- echo -e "\033[1;31mError:\e[0m $@"
- exit 1
-}
-
-warning(){
- echo -e "\033[1;33mWarning:\e[0m $@"
-}
-
-success(){
- echo -e "\033[1;32mSuccess:\e[0m $@"
-}
-
-logit(){
- echo -e "\033[0;37m$@\e[0m"
-}
-
-titleit(){
- echo ""
- echo -e "\033[1;35m$@\e[0m"
- echo "================================================================"
- echo ""
-}
-
-titleit " vg_build.sh ver: 2.0\n"
-
-# Compile shit
-# ==============================================================================
-
-compiler_cache="ccache"
-
-# Autodetect ccache unavailible
-if ! [ -x "$( command -v $compiler_cache )" ]; then
- compiler_cache=""
-fi
-
-compile_x(){
- cmd="$compiler_cache $_compiler
- $_options
- $_warnings
- $_include
- $_library
- $_src
- -o $_folder/$_dst$_ext
- $_link
- $_epilogue"
-
- logit " $cmd\n"
- $cmd
-
- if [ $? -ne 0 ]; then
- error "compiler failed"
- fi
-
- success "Compiled item\n"
-}
-
-# Tools scripts
-# ==============================================================================
-enable_tools=false
-
-vg_compile_tools() {
- if [ $enable_tools = true ]; then source vg/src/tools.sh; fi
-}
-
-run_command(){
- case "$1" in
- tools)
- enable_tools=true
- ;;
- "")
- return
- ;;
- *)
- vg_command $1
- esac
-}
-
-run_command $1
-run_command $2
-run_command $3
-run_command $4
-run_command $5
-run_command $6
-run_command $7
-run_command $8
-run_command $9