AI: Build: Improve dependency checking to report all missing dependencies at once. v7.0.105 (#4293)

This commit is contained in:
OSSRS-AI 2025-10-25 22:21:08 -04:00 committed by winlin
parent 6590871ca8
commit 9eae868e91
3 changed files with 78 additions and 125 deletions

View File

@ -48,140 +48,92 @@ if [[ $SRS_OSX == YES ]]; then
echo "Please install brew at https://brew.sh/"; exit $ret; echo "Please install brew at https://brew.sh/"; exit $ret;
fi fi
fi fi
# Check perl, which is depended by automake for building libopus etc.
perl --version >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then # Arrays to track missing dependencies
if [[ $OS_IS_CENTOS == YES ]]; then MISSING_DEPS=()
echo "Please install perl by:" MISSING_DEPS_UBUNTU=()
echo " yum install -y perl" MISSING_DEPS_CENTOS=()
elif [[ $OS_IS_UBUNTU == YES ]]; then MISSING_DEPS_OSX=()
echo "Please install perl by:"
echo " apt install -y perl" # Helper function to check if a command exists
else check_command() {
echo "Please install perl" local cmd=$1
local cmd_name=$2
local ubuntu_pkg=$3
local centos_pkg=$4
local osx_pkg=$5
$cmd >/dev/null 2>/dev/null
if [[ $? -ne 0 ]]; then
MISSING_DEPS+=("$cmd_name")
if [[ ! -z "$ubuntu_pkg" ]]; then
MISSING_DEPS_UBUNTU+=("$ubuntu_pkg")
fi
if [[ ! -z "$centos_pkg" ]]; then
MISSING_DEPS_CENTOS+=("$centos_pkg")
fi
if [[ ! -z "$osx_pkg" ]]; then
MISSING_DEPS_OSX+=("$osx_pkg")
fi
return 1
fi fi
exit $ret; return 0
fi }
gcc --version >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then
if [[ $OS_IS_CENTOS == YES ]]; then # Check required tools
echo "Please install gcc by:" echo "Checking required tools: perl gcc g++ make patch unzip automake pkg-config which"
echo " yum install -y gcc" check_command "perl --version" "perl" "perl" "perl" "perl"
elif [[ $OS_IS_UBUNTU == YES ]]; then check_command "gcc --version" "gcc" "gcc" "gcc" "gcc"
echo "Please install gcc by:" check_command "g++ --version" "g++" "g++" "gcc-c++" "gcc"
echo " apt install -y gcc" check_command "make --version" "make" "make" "make" "make"
else check_command "patch --version" "patch" "patch" "patch" "gpatch"
echo "Please install gcc" check_command "unzip -v" "unzip" "unzip" "unzip" "unzip"
fi check_command "automake --version" "automake" "automake" "automake" "automake"
exit $ret; check_command "pkg-config --version" "pkg-config" "pkg-config" "pkgconfig" "pkg-config"
fi check_command "which ls" "which" "which" "which" "which"
g++ --version >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then
if [[ $OS_IS_CENTOS == YES ]]; then # Check optional tools for valgrind
echo "Please install g++ by:"
echo " yum install -y gcc-c++"
elif [[ $OS_IS_UBUNTU == YES ]]; then
echo "Please install g++ by:"
echo " apt install -y g++"
else
echo "Please install gcc-c++"
fi
exit $ret;
fi
make --version >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then
if [[ $OS_IS_CENTOS == YES ]]; then
echo "Please install make by:"
echo " yum install -y make"
elif [[ $OS_IS_UBUNTU == YES ]]; then
echo "Please install make by:"
echo " apt install -y make"
else
echo "Please install make"
fi
exit $ret;
fi
patch --version >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then
if [[ $OS_IS_CENTOS == YES ]]; then
echo "Please install patch by:"
echo " yum install -y patch"
elif [[ $OS_IS_UBUNTU == YES ]]; then
echo "Please install patch by:"
echo " apt install -y patch"
else
echo "Please install patch"
fi
exit $ret;
fi
unzip -v >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then
if [[ $OS_IS_CENTOS == YES ]]; then
echo "Please install unzip by:"
echo " yum install -y unzip"
elif [[ $OS_IS_UBUNTU == YES ]]; then
echo "Please install unzip by:"
echo " apt install -y unzip"
else
echo "Please install unzip"
fi
exit $ret;
fi
automake --version >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then
if [[ $OS_IS_CENTOS == YES ]]; then
echo "Please install automake by:"
echo " yum install -y automake"
elif [[ $OS_IS_UBUNTU == YES ]]; then
echo "Please install automake by:"
echo " apt install -y automake"
else
echo "Please install automake"
fi
exit $ret;
fi
if [[ $SRS_VALGRIND == YES ]]; then if [[ $SRS_VALGRIND == YES ]]; then
valgrind --version >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then check_command "valgrind --version" "valgrind" "valgrind" "valgrind" "valgrind"
echo "Please install valgrind"; exit $ret;
fi
if [[ ! -f /usr/include/valgrind/valgrind.h ]]; then if [[ ! -f /usr/include/valgrind/valgrind.h ]]; then
echo "Please install valgrind-dev"; exit $ret; MISSING_DEPS+=("valgrind-dev")
MISSING_DEPS_UBUNTU+=("valgrind")
MISSING_DEPS_CENTOS+=("valgrind-devel")
MISSING_DEPS_OSX+=("valgrind")
fi fi
fi fi
# Check tclsh, which is depended by SRT.
# Check optional tools for SRT
if [[ $SRS_SRT == YES ]]; then if [[ $SRS_SRT == YES ]]; then
tclsh <<< "exit" >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then echo "Checking optional tools for SRT: tclsh cmake"
if [[ $OS_IS_CENTOS == YES ]]; then # Special check for tclsh
echo "Please install tclsh by:" tclsh <<< "exit" >/dev/null 2>&1
echo " yum install -y tcl" if [[ $? -ne 0 ]]; then
elif [[ $OS_IS_UBUNTU == YES ]]; then MISSING_DEPS+=("tclsh")
echo "Please install tclsh by:" MISSING_DEPS_UBUNTU+=("tclsh")
echo " apt install -y tclsh" MISSING_DEPS_CENTOS+=("tcl")
else MISSING_DEPS_OSX+=("tcl-tk")
echo "Please install tclsh"
fi
exit $ret;
fi
cmake --version >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then
if [[ $OS_IS_CENTOS == YES ]]; then
echo "Please install cmake by:"
echo " yum install -y cmake"
elif [[ $OS_IS_UBUNTU == YES ]]; then
echo "Please install cmake by:"
echo " apt install -y cmake"
else
echo "Please install cmake"
fi
exit $ret;
fi fi
check_command "cmake --version" "cmake" "cmake" "cmake" "cmake"
fi fi
pkg-config --version >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then
echo "Please install pkg-config"; exit $ret; # Report all missing dependencies at once
fi if [[ ${#MISSING_DEPS[@]} -gt 0 ]]; then
which ls >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then echo ""
if [[ $OS_IS_CENTOS == YES ]]; then echo -e "Missing dependencies (${#MISSING_DEPS[@]}): ${RED}${MISSING_DEPS[@]}${BLACK}"
echo "Please install which by:"
echo " yum install -y which" if [[ $OS_IS_UBUNTU == YES && ${#MISSING_DEPS_UBUNTU[@]} -gt 0 ]]; then
elif [[ $OS_IS_UBUNTU == YES ]]; then echo -e "Please install missing dependencies by: ${GREEN}sudo apt install -y ${MISSING_DEPS_UBUNTU[@]}${BLACK}"
echo "Please install which by:" elif [[ $OS_IS_CENTOS == YES && ${#MISSING_DEPS_CENTOS[@]} -gt 0 ]]; then
echo " apt install -y which" echo -e "Please install missing dependencies by: ${GREEN}sudo yum install -y ${MISSING_DEPS_CENTOS[@]}${BLACK}"
elif [[ $SRS_OSX == YES && ${#MISSING_DEPS_OSX[@]} -gt 0 ]]; then
echo -e "Please install missing dependencies by: ${GREEN}brew install ${MISSING_DEPS_OSX[@]}${BLACK}"
else else
echo "Please install which" echo "Please install the missing dependencies above."
fi fi
exit $ret;
echo "Please install the missing dependencies above and rerun configure."
exit 1
fi fi
##################################################################################### #####################################################################################

View File

@ -7,6 +7,7 @@ The changelog for SRS.
<a name="v7-changes"></a> <a name="v7-changes"></a>
## SRS 7.0 Changelog ## SRS 7.0 Changelog
* v7.0, 2025-10-26, Build: Improve dependency checking to report all missing dependencies at once. v7.0.105 (#4293)
* v7.0, 2025-10-26, HLS: Support hls_master_m3u8_path_relative for reverse proxy compatibility. v7.0.104 (#4338) * v7.0, 2025-10-26, HLS: Support hls_master_m3u8_path_relative for reverse proxy compatibility. v7.0.104 (#4338)
* v7.0, 2025-10-25, API: Remove minimum limit of 10 for count parameter in /api/v1/streams and /api/v1/clients. v7.0.103 (#4358) * v7.0, 2025-10-25, API: Remove minimum limit of 10 for count parameter in /api/v1/streams and /api/v1/clients. v7.0.103 (#4358)
* v7.0, 2025-10-22, AI: Only support AAC/MP3/Opus audio codec. v7.0.102 (#4516) * v7.0, 2025-10-22, AI: Only support AAC/MP3/Opus audio codec. v7.0.102 (#4516)

View File

@ -9,6 +9,6 @@
#define VERSION_MAJOR 7 #define VERSION_MAJOR 7
#define VERSION_MINOR 0 #define VERSION_MINOR 0
#define VERSION_REVISION 104 #define VERSION_REVISION 105
#endif #endif