Simplify Scripts

This commit is contained in:
TheBrokenRail 2023-12-26 17:45:53 -05:00
parent 5f8c700081
commit 631cbc07d0
2 changed files with 67 additions and 80 deletions

View File

@ -2,13 +2,15 @@
set -e set -e
# Build # Variables
build() { MODE="$(echo "$1" | tr '[:upper:]' '[:lower:]')"
# Use Build Dir ARCH="$(echo "$2" | tr '[:upper:]' '[:lower:]')"
# Run CMake If Needed
if [ ! -f "build/${MODE}-${ARCH}/arm/build.ninja" ] || [ ! -f "build/${MODE}-${ARCH}/native/build.ninja" ]; then if [ ! -f "build/${MODE}-${ARCH}/arm/build.ninja" ] || [ ! -f "build/${MODE}-${ARCH}/native/build.ninja" ]; then
# Run CMake
./scripts/setup.sh "${MODE}" "${ARCH}" ./scripts/setup.sh "${MODE}" "${ARCH}"
fi fi
# Use Build Dir
cd "build/${MODE}-${ARCH}" cd "build/${MODE}-${ARCH}"
# Create Prefix # Create Prefix
@ -32,12 +34,3 @@ build() {
# Exit # Exit
cd ../../ cd ../../
}
# Variables
MODE="$(echo "$1" | tr '[:upper:]' '[:lower:]')"
ARCH="$(echo "$2" | tr '[:upper:]' '[:lower:]')"
shift 2
# Build
build "${MODE}" "${ARCH}"

View File

@ -5,8 +5,17 @@ set -e
# ARM Toolchain File # ARM Toolchain File
ARM_TOOLCHAIN_FILE="$(pwd)/cmake/toolchain/armhf-toolchain.cmake" ARM_TOOLCHAIN_FILE="$(pwd)/cmake/toolchain/armhf-toolchain.cmake"
# Setup # Variables
setup() { MODE="$(echo "$1" | tr '[:upper:]' '[:lower:]')"
ARCH="$(echo "$2" | tr '[:upper:]' '[:lower:]')"
shift 2
# Verify Mode
if [ "${MODE}" != "client" ] && [ "${MODE}" != "server" ]; then
echo "Invalid Mode: ${MODE}" > /dev/stderr
exit 1
fi
# Find Toolchain # Find Toolchain
toolchain_file="$(pwd)/cmake/toolchain/${ARCH}-toolchain.cmake" toolchain_file="$(pwd)/cmake/toolchain/${ARCH}-toolchain.cmake"
if [ ! -f "${toolchain_file}" ]; then if [ ! -f "${toolchain_file}" ]; then
@ -46,18 +55,3 @@ setup() {
# Exit # Exit
cd ../../ cd ../../
}
# Variables
MODE="$(echo "$1" | tr '[:upper:]' '[:lower:]')"
ARCH="$(echo "$2" | tr '[:upper:]' '[:lower:]')"
shift 2
# Verify Mode
if [ "${MODE}" != "client" ] && [ "${MODE}" != "server" ]; then
echo "Invalid Mode: ${MODE}" > /dev/stderr
exit 1
fi
# Setup
setup "$@"