44 lines
1.4 KiB
Bash
Executable File
44 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
# Configuration
|
|
CONTAINER_NAME="noicesynth-builder"
|
|
IMAGE="archlinux:latest"
|
|
|
|
# 1. Check for Distrobox
|
|
if ! command -v distrobox &> /dev/null; then
|
|
echo "Error: distrobox is not installed on your system."
|
|
exit 1
|
|
fi
|
|
|
|
# 2. Create Container (if it doesn't exist)
|
|
# We use Arch Linux for easy access to latest toolchains and SDL2
|
|
if ! distrobox list | grep -q "$CONTAINER_NAME"; then
|
|
echo "Creating container '$CONTAINER_NAME'..."
|
|
distrobox create --image "$IMAGE" --name "$CONTAINER_NAME" --yes
|
|
fi
|
|
|
|
# 3. Execute Build Inside Container
|
|
PROJECT_DIR=$(pwd)
|
|
echo "Entering container to build..."
|
|
distrobox enter "$CONTAINER_NAME" --additional-flags "--workdir $PROJECT_DIR" -- sh -c '
|
|
set -e # Ensure script exits on error inside the container too
|
|
# A. Install Dependencies (only if missing)
|
|
# We check for sdl2-config and wget to see if dev tools are present
|
|
if ! command -v sdl2-config &> /dev/null || ! command -v wget &> /dev/null; then
|
|
echo "Installing compiler and libraries..."
|
|
sudo pacman -Syu --noconfirm base-devel sdl2 wget
|
|
fi
|
|
|
|
# B. Download miniaudio.h (if missing)
|
|
if [ ! -f miniaudio.h ]; then
|
|
echo "Downloading miniaudio.h..."
|
|
wget https://raw.githubusercontent.com/mackron/miniaudio/master/miniaudio.h
|
|
fi
|
|
|
|
# C. Compile
|
|
echo "Compiling Project..."
|
|
make
|
|
'
|
|
|
|
echo "Build Success! Run ./noicesynth_linux to start the synth." |