Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SRT build from source code #2357

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 64 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ jobs:
- run: |
echo "Build and run SRS with GB28181" &&
cd trunk && ./configure --gb28181=on && make
build-c7-srt:
docker:
- image: ossrs/srs:dev
steps:
- checkout
- run: |
echo "Build and run SRS with SRT" &&
cd trunk && ./configure --srt=on && make
build-c8-baseline:
docker:
- image: ossrs/srs:dev8
Expand All @@ -32,14 +40,62 @@ jobs:
- run: |
echo "Build and run SRS for CentOS8" &&
cd trunk && ./configure && make
build-u20-baseline:
build-c8-srt:
docker:
- image: ossrs/srs:dev8
steps:
- checkout
- run: |
echo "Build and run SRS with SRT for CentOS8" &&
cd trunk && ./configure --srt=on && make
build-u16-baseline:
docker:
- image: ossrs/srs:ubuntu16
steps:
- checkout
- run: |
echo "Build and run SRS for Ubuntu16" &&
cd trunk && ./configure && make
build-u16-srt:
docker:
- image: ossrs/srs:ubuntu16
steps:
- checkout
- run: |
echo "Build and run SRS with SRT for Ubuntu16" &&
cd trunk && ./configure --srt=on && make
build-u18-baseline:
docker:
- image: ossrs/srs:ubuntu18
steps:
- checkout
- run: |
echo "Build and run SRS for Ubuntu18" &&
cd trunk && ./configure && make
build-u18-srt:
docker:
- image: ossrs/srs:ubuntu18
steps:
- checkout
- run: |
echo "Build and run SRS with SRT for Ubuntu18" &&
cd trunk && ./configure --srt=on && make
build-u20-baseline:
docker:
- image: ossrs/srs:ubuntu20
steps:
- checkout
- run: |
echo "Build and run SRS for Ubuntu20" &&
cd trunk && ./configure && make
build-u20-srt:
docker:
- image: ossrs/srs:ubuntu20
steps:
- checkout
- run: |
echo "Build and run SRS with SRT for Ubuntu20" &&
cd trunk && ./configure --srt=on && make
run-utest:
docker:
- image: ossrs/srs:dev
Expand Down Expand Up @@ -76,6 +132,13 @@ workflows:
- run-regression-test
- build-c7-noasm
- build-c7-gb28181
- build-c7-srt
- build-c8-baseline
- build-c8-srt
- build-u16-baseline
- build-u16-srt
- build-u18-baseline
- build-u18-srt
- build-u20-baseline
- build-u20-srt
- build-c7-ansi-noff
Binary file added trunk/3rdparty/srt-1.4.1.zip
Binary file not shown.
78 changes: 72 additions & 6 deletions trunk/auto/depends.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,23 @@ function Ubuntu_prepare()
fi
fi

if [[ $SRS_SRT == YES ]]; then
echo "SRT enable, install depend tools"
tclsh <<< "exit" >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "Installing tcl."
require_sudoer "sudo apt-get install -y --force-yes tcl"
sudo apt-get install -y --force-yes tcl; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "The tcl is installed."
fi

cmake --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "Installing cmake."
require_sudoer "sudo apt-get install -y --force-yes cmake"
sudo apt-get install -y --force-yes cmake; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "The cmake is installed."
fi
fi

pkg-config --version >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "Installing pkg-config."
require_sudoer "sudo apt-get install -y --force-yes pkg-config"
Expand Down Expand Up @@ -181,6 +198,23 @@ function Centos_prepare()
fi
fi

if [[ $SRS_SRT == YES ]]; then
echo "SRT enable, install depend tools"
tclsh <<< "exit" >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "Installing tcl."
require_sudoer "sudo yum install -y tcl"
sudo yum install -y tcl; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "The tcl is installed."
fi

cmake --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "Installing cmake."
require_sudoer "sudo yum install -y cmake"
sudo yum install -y cmake; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "The cmake is installed."
fi
fi

pkg-config --version --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "Please install pkg-config"; exit -1;
fi
Expand Down Expand Up @@ -278,6 +312,23 @@ function OSX_prepare()
fi
fi

if [[ $SRS_SRT == YES ]]; then
echo "SRT enable, install depend tools"
tclsh <<< "exit" >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "Installing tcl."
echo "brew install tcl."
brew install tcl; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install tcl success"
fi

cmake --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "Installing cmake."
echo "brew install cmake."
brew install cmake; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install cmake success"
fi
fi

echo "OSX install tools success"
return 0
}
Expand Down Expand Up @@ -689,15 +740,30 @@ fi
# SRT module, https://github.com/ossrs/srs/issues/1147#issuecomment-577469119
#####################################################################################
if [[ $SRS_SRT == YES ]]; then
if [[ -f /usr/local/lib64/libsrt.a && ! -f ${SRS_OBJS}/srt/lib/libsrt.a ]]; then
mkdir -p ${SRS_OBJS}/srt/lib && ln -sf /usr/local/lib64/libsrt.a ${SRS_OBJS}/srt/lib/libsrt.a
mkdir -p ${SRS_OBJS}/srt/include && ln -sf /usr/local/include/srt ${SRS_OBJS}/srt/include/
fi
if [[ -f ${SRS_OBJS}/srt/lib/libsrt.a ]]; then
echo "libsrt-1.4.1 is ok.";
else
echo "no libsrt, please run in docker ossrs/srs:srt or build from source https://github.com/ossrs/srs/issues/1147#issuecomment-577469119";
exit -1;
echo "Build srt-1.4.1"
(
if [[ ! -d ${SRS_OBJS}/${SRS_PLATFORM}/openssl/lib/pkgconfig ]]; then
echo "OpenSSL pkgconfig no fond, build srt-1.4.1 failed.";
exit -1;
fi
rm -rf ${SRS_OBJS}/${SRS_PLATFORM}/srt-1.4.1 && cd ${SRS_OBJS}/${SRS_PLATFORM} &&
unzip -q ../../3rdparty/srt-1.4.1.zip && cd srt-1.4.1 &&
PKG_CONFIG_PATH=../openssl/lib/pkgconfig ./configure --prefix=`pwd`/_release --disable-c++11 --disable-app --disable-shared --enable-static &&
make ${SRS_JOBS} && make install &&
cd .. && rm -rf srt && ln -sf srt-1.4.1/_release srt
# Move to lib dir.
if [[ -f srt/lib64/libsrt.a ]]; then
mv srt/lib64 srt/lib
fi
)
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build srt-1.4.1 failed, ret=$ret"; exit $ret; fi
# Always update the links.
(cd ${SRS_OBJS}/${SRS_PLATFORM} && rm -rf srt && ln -sf srt-1.4.1/_release srt)
(cd ${SRS_OBJS} && rm -rf srt && ln -sf ${SRS_PLATFORM}/srt-1.4.1/_release srt)
if [ ! -f ${SRS_OBJS}/srt/lib/libsrt.a ]; then echo "Build srt-1.4.1 failed."; exit -1; fi
fi
fi

Expand Down
21 changes: 14 additions & 7 deletions trunk/configure
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ fi

# srt code path
if [[ $SRS_SRT == YES ]]; then
LibSRTRoot="${SRS_WORKDIR}/src/srt"; LibSRTfile="${SRS_OBJS_DIR}/srt/lib/libsrt.a"
if [[ $SRS_SHARED_SRT == YES ]]; then LibSRTfile="-lsrt"; fi
SrsSRTRoot="${SRS_WORKDIR}/src/srt"
LibSRTRoot="${SRS_OBJS_DIR}/srt/include"; LibSRTfile="${SRS_OBJS_DIR}/srt/lib/libsrt.a"
fi

# For iconv on macOS only, CentOS seems ok.
Expand Down Expand Up @@ -244,12 +244,12 @@ PROTOCOL_INCS="src/protocol"; MODULE_DIR=${PROTOCOL_INCS} . auto/modules.sh
PROTOCOL_OBJS="${MODULE_OBJS[@]}"
#
#srt protocol features.
if [ $SRS_SRT = YES ]; then
if [[ $SRS_SRT == YES ]]; then
MODULE_ID="SRT"
MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "APP")
ModuleLibIncs=(${SRS_OBJS_DIR} ${LibSSLRoot})
ModuleLibIncs=(${SRS_OBJS_DIR} ${LibSSLRoot} ${LibSRTRoot})
MODULE_FILES=("srt_server" "srt_handle" "srt_conn" "srt_to_rtmp" "ts_demux" "srt_data")
SRT_INCS=${LibSRTRoot}; MODULE_DIR=${LibSRTRoot} . auto/modules.sh
SRT_INCS=(${LibSRTRoot} ${SrsSRTRoot}); MODULE_DIR=${SrsSRTRoot} . auto/modules.sh
SRT_OBJS="${MODULE_OBJS[@]}"
fi

Expand Down Expand Up @@ -320,7 +320,8 @@ if [[ $SRS_FFMPEG_FIT == YES ]]; then
ModuleLibIncs+=("${LibFfmpegRoot[*]}")
fi
if [[ $SRS_SRT == YES ]]; then
ModuleLibIncs+=("${LibSRTRoot[*]}")
ModuleLibIncs+=(${LibSRTRoot})
ModuleLibIncs+=("${SrsSRTRoot[*]}")
fi
MODULE_FILES=("srs_main_server")
SERVER_INCS="src/main"; MODULE_DIR=${SERVER_INCS} . auto/modules.sh
Expand All @@ -336,6 +337,10 @@ fi
if [[ $SRS_FFMPEG_FIT == YES ]]; then
ModuleLibIncs+=("${LibFfmpegRoot[*]}")
fi
if [[ $SRS_SRT == YES ]]; then
ModuleLibIncs+=(${LibSRTRoot})
ModuleLibIncs+=("${SrsSRTRoot[*]}")
fi
MODULE_FILES=()
DEFINES=""
# add each modules for main
Expand Down Expand Up @@ -382,6 +387,8 @@ if [[ $SRS_FFMPEG_FIT == YES ]]; then
ModuleLibIncs+=("${LibFfmpegRoot[*]}")
fi
if [[ $SRS_SRT == YES ]]; then
ModuleLibIncs+=(${LibSRTRoot})
ModuleLibIncs+=("${SrsSRTRoot[*]}")
MODULE_OBJS="${MODULE_OBJS} ${SRT_OBJS[@]}"
fi
LINK_OPTIONS="${SrsLinkOptions}${SrsGprofLink}${SrsGperfLink}"
Expand Down Expand Up @@ -424,7 +431,7 @@ if [ $SRS_UTEST = YES ]; then
ModuleLibIncs+=("${LibFfmpegRoot[*]}")
fi
if [[ $SRS_SRT == YES ]]; then
ModuleLibIncs+=("${LibSRTRoot[*]}")
ModuleLibIncs+=("${SrsSRTRoot[*]}")
fi
ModuleLibFiles=(${LibSTfile} ${LibSSLfile})
if [[ $SRS_RTC == YES ]]; then
Expand Down