修复项目内SRS构建脚本

This commit is contained in:
cxh 2026-05-09 11:12:24 +08:00
parent 4f10813fa9
commit 929728f032
3 changed files with 14 additions and 4 deletions

View File

@ -19,6 +19,12 @@ If you need to rebuild SRS from the bundled source:
./scripts/build_srs.sh
```
SRS is built out-of-tree into:
```text
build/srs/objs/srs
```
## Package
```bash

View File

@ -3,18 +3,21 @@ set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
SRS_SOURCE_DIR="${SRS_SOURCE_DIR:-${1:-$ROOT_DIR/external/srs-server-5.0-r3/trunk}}"
SRS_BUILD_DIR="${SRS_BUILD_DIR:-$ROOT_DIR/build/srs}"
if [[ ! -x "$SRS_SOURCE_DIR/configure" ]]; then
echo "SRS source not found: $SRS_SOURCE_DIR" >&2
exit 1
fi
mkdir -p "$SRS_BUILD_DIR"
SRS_OUTPUT_DIR="$(realpath --relative-to="$SRS_SOURCE_DIR" "$SRS_BUILD_DIR")"
cd "$SRS_SOURCE_DIR"
if [[ ! -f objs/Makefile ]]; then
./configure --prefix=/opt/vehicle-video-service/srs
if [[ ! -f "$SRS_BUILD_DIR/Makefile" ]]; then
SRS_OUTPUT="$SRS_OUTPUT_DIR" ./configure --prefix=/opt/vehicle-video-service/srs
fi
make -j"$(nproc 2>/dev/null || echo 4)" srs
make -f "$SRS_OUTPUT_DIR/Makefile" -j"$(nproc 2>/dev/null || echo 4)"
echo "Built $SRS_SOURCE_DIR/objs/srs"
echo "Built $SRS_BUILD_DIR/objs/srs"

View File

@ -14,6 +14,7 @@ fi
find_srs_bin() {
local candidates=(
"${SRS_BIN:-}"
"$ROOT_DIR/build/srs/objs/srs"
"$ROOT_DIR/external/srs-server-5.0-r3/trunk/objs/srs"
"/home/aiec/srs-server-5.0-r3/trunk/objs/srs"
"/home/aiec/srs/bin/srs"