diff --git a/scripts/build_sokol_library.sh b/scripts/build_sokol_library.sh index e2cec23..e4cf7d6 100644 --- a/scripts/build_sokol_library.sh +++ b/scripts/build_sokol_library.sh @@ -36,27 +36,46 @@ fi pushd "$path_sokol" -check_and_install() { - if ! dpkg -s $1 &> /dev/null; then - echo "$1 not found. Attempting to install..." - sudo apt update && sudo apt install -y $1 - if [ $? -ne 0 ]; then - echo "Failed to install $1. Please install manually and try again." - exit 1 - fi - fi -} +# Detect the operating system +OS=$(uname -s) -# Check for OpenGL and X11 development libraries -# check_and_install libgl1-mesa-dev -# check_and_install libx11-dev -# check_and_install libxcursor-dev -# check_and_install libxrandr-dev -# check_and_install libxinerama-dev -# check_and_install libxi-dev -# check_and_install libasound2-dev # ALSA development library +case "$OS" in + Linux*) + echo "Detected Linux operating system" + # Check for OpenGL and X11 development libraries + check_and_install() { + if ! dpkg -s $1 &> /dev/null; then + echo "$1 not found. Attempting to install..." + sudo apt update && sudo apt install -y $1 + if [ $? -ne 0 ]; then + echo "Failed to install $1. Please install manually and try again." + exit 1 + fi + fi + } + # Uncomment these lines if you need to install these dependencies + # check_and_install libgl1-mesa-dev + # check_and_install libx11-dev + # check_and_install libxcursor-dev + # check_and_install libxrandr-dev + # check_and_install libxinerama-dev + # check_and_install libxi-dev + # check_and_install libasound2-dev # ALSA development library -# Run the build script -./build_clibs_linux.sh + echo "Running Linux build script..." + ./build_clibs_linux.sh + ;; + Darwin*) + echo "Detected macOS operating system" + echo "Running macOS build script..." + ./build_clibs_macos.sh + ;; + *) + echo "Unsupported operating system: $OS" + exit 1 + ;; +esac popd + +echo "Build process completed."