68 lines
1.9 KiB
Bash
Executable File
68 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Dependency Check Script for GTK2 MPV Player
|
|
|
|
PRINT_OK() { echo -e "\e[32m[OK]\e[0m $1"; }
|
|
PRINT_ERROR() { echo -e "\e[31m[ERROR]\e[0m $1"; }
|
|
PRINT_WARNING() { echo -e "\e[33m[WARNING]\e[0m $1"; }
|
|
|
|
FAILED=0
|
|
|
|
echo "Checking build dependencies..."
|
|
|
|
# Check for pkg-config
|
|
if command -v pkg-config >/dev/null 2>&1; then
|
|
PRINT_OK "pkg-config found"
|
|
else
|
|
PRINT_ERROR "pkg-config not found. Please install it."
|
|
FAILED=1
|
|
fi
|
|
|
|
# Check for GTK+ 2.0
|
|
if pkg-config --exists gtk+-2.0; then
|
|
PRINT_OK "GTK+ 2.0 development files found"
|
|
else
|
|
PRINT_ERROR "GTK+ 2.0 development files not found (libgtk2.0-dev or equivalent)."
|
|
FAILED=1
|
|
fi
|
|
|
|
# Check for libmpv (runtime)
|
|
# Try to find ldconfig in common paths if not in PATH
|
|
LDCONFIG_BIN=$(command -v ldconfig || command -v /sbin/ldconfig || command -v /usr/sbin/ldconfig)
|
|
if [ -n "$LDCONFIG_BIN" ]; then
|
|
MPV_PATH=$($LDCONFIG_BIN -p | grep libmpv.so.2 | head -n 1 | awk '{print $NF}')
|
|
if [ -n "$MPV_PATH" ]; then
|
|
PRINT_OK "libmpv.so.2 found at: $MPV_PATH"
|
|
else
|
|
PRINT_WARNING "libmpv.so.2 not found in system paths. You will need to provide it in the 'lib' directory manually if bundling fails."
|
|
fi
|
|
else
|
|
PRINT_WARNING "ldconfig not found. Unable to check for libmpv.so.2 automatically."
|
|
fi
|
|
|
|
# Check for compiler
|
|
if command -v gcc >/dev/null 2>&1; then
|
|
PRINT_OK "gcc found"
|
|
else
|
|
PRINT_ERROR "gcc not found. Please install a C compiler."
|
|
FAILED=1
|
|
fi
|
|
|
|
# Check for make
|
|
if command -v make >/dev/null 2>&1; then
|
|
PRINT_OK "make found"
|
|
else
|
|
PRINT_ERROR "make not found. Please install make."
|
|
FAILED=1
|
|
fi
|
|
|
|
if [ $FAILED -eq 0 ]; then
|
|
echo "--------------------------------------"
|
|
PRINT_OK "All required build dependencies are present."
|
|
exit 0
|
|
else
|
|
echo "--------------------------------------"
|
|
PRINT_ERROR "Some dependencies are missing. Please install them and try again."
|
|
exit 1
|
|
fi
|