1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Update build script

This commit is contained in:
winlin 2020-03-29 15:23:40 +08:00
parent d5339acc57
commit c0a8193537
6 changed files with 78 additions and 37 deletions

View file

@ -338,7 +338,7 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build state-threads failed, ret=$ret"; exit $ret; fi
# Always update the links.
(cd ${SRS_OBJS} && rm -f st && ln -sf ${SRS_PLATFORM}/st-srs/${_ST_OBJ} st)
(cd ${SRS_OBJS} && rm -rf st && ln -sf ${SRS_PLATFORM}/st-srs/${_ST_OBJ} st)
if [ ! -f ${SRS_OBJS}/st/libst.a ]; then echo "Build state-threads static lib failed."; exit -1; fi
fi
@ -464,7 +464,7 @@ if [[ $SRS_SSL == YES && $SRS_USE_SYS_SSL != YES ]]; then
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build openssl-1.1.0e failed, ret=$ret"; exit $ret; fi
# Always update the links.
(cd ${SRS_OBJS} && rm -f openssl && ln -sf ${SRS_PLATFORM}/${OPENSSL_LIB} openssl)
(cd ${SRS_OBJS} && rm -rf openssl && ln -sf ${SRS_PLATFORM}/${OPENSSL_LIB} openssl)
if [ ! -f ${SRS_OBJS}/openssl/lib/libssl.a ]; then echo "Build openssl-1.1.0e failed."; exit -1; fi
fi
@ -472,24 +472,19 @@ fi
# live transcoding, ffmpeg-4.1, x264-core157, lame-3.99.5, libaacplus-2.0.2.
#####################################################################################
# Always link the ffmpeg tools if exists.
if [[ -f /usr/local/bin/ffmpeg && ! -f ${SRS_OBJS}/ffmpeg/bin/ffmpeg ]]; then
mkdir -p ${SRS_OBJS}/ffmpeg/bin && ln -sf /usr/local/bin/ffmpeg ${SRS_OBJS}/ffmpeg/bin/ffmpeg
if [[ -f /usr/local/bin/ffmpeg && ! -f ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg/bin/ffmpeg ]]; then
mkdir -p ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg/bin &&
ln -sf /usr/local/bin/ffmpeg ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg/bin/ffmpeg
fi
if [ $SRS_FFMPEG_TOOL = YES ]; then
if [[ -f ${SRS_OBJS}/ffmpeg/bin/ffmpeg ]]; then
if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg/bin/ffmpeg ]]; then
echo "ffmpeg-4.1 is ok.";
else
echo "build ffmpeg-4.1";
(
cd ${SRS_OBJS} && pwd_dir=`pwd` &&
rm -rf ffmepg.src && mkdir -p ffmpeg.src && cd ffmpeg.src &&
rm -f build_ffmpeg.sh && ln -sf ../../auto/build_ffmpeg.sh && . build_ffmpeg.sh &&
cd ${pwd_dir} && rm -rf ffmpeg && ln -sf ffmpeg.src/_release ffmpeg
)
echo "no ffmpeg found, please use srs-docker or --without-ffmpeg";
exit -1;
fi
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "build ffmpeg-4.1 failed, ret=$ret"; exit $ret; fi
if [ ! -f ${SRS_OBJS}/ffmpeg/bin/ffmpeg ]; then echo "build ffmpeg-4.1 failed."; exit -1; fi
# Always update the links.
(cd ${SRS_OBJS} && rm -rf ffmpeg && ln -sf ${SRS_PLATFORM}/ffmpeg)
fi
#####################################################################################
@ -534,7 +529,7 @@ if [ $SRS_UTEST = YES ]; then
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build gtest-1.6.0 failed, ret=$ret"; exit $ret; fi
# Always update the links.
(cd ${SRS_OBJS} && rm -f gtest && ln -sf ${SRS_PLATFORM}/gtest-1.6.0 gtest)
(cd ${SRS_OBJS} && rm -rf gtest && ln -sf ${SRS_PLATFORM}/gtest-1.6.0 gtest)
if [ ! -f ${SRS_OBJS}/gtest/include/gtest/gtest.h ]; then echo "Build gtest-1.6.0 failed."; exit -1; fi
fi
@ -557,6 +552,6 @@ if [ $SRS_GPERF = YES ]; then
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build gperftools-2.1 failed, ret=$ret"; exit $ret; fi
# Always update the links.
(cd ${SRS_OBJS} && rm -f pprof && ln -sf ${SRS_PLATFORM}/gperf/bin/pprof pprof)
(cd ${SRS_OBJS} && rm -rf pprof && ln -sf ${SRS_PLATFORM}/gperf/bin/pprof pprof)
if [ ! -f ${SRS_OBJS}/gperf/bin/pprof ]; then echo "Build gperftools-2.1 failed."; exit -1; fi
fi

View file

@ -105,6 +105,8 @@ SRS_TOOL_AR=ar
SRS_TOOL_LD=ld
SRS_TOOL_RANDLIB=randlib
SRS_EXTRA_FLAGS=
# Set the object files tag name.
SRS_BUILD_TAG=
#####################################################################################
# menu
@ -171,6 +173,7 @@ Toolchain options: @see https://github.com/ossrs/srs/issues/1547#issuec
--ld=<LD> Use linker tool LD, default is ld.
--randlib=<RANDLIB> Use randlib tool RANDLIB, default is randlib.
--extra-flags=<EFLAGS> Set EFLAGS as CFLAGS and CXXFLAGS. Also passed to ST as EXTRA_CFLAGS.
--build-tag=<TAG> Set the build object directory suffix.
Conflicts:
1. --with-gmc vs --with-gmp:
@ -254,6 +257,7 @@ function parse_user_option() {
--ld) SRS_TOOL_LD=${value} ;;
--randlib) SRS_TOOL_RANDLIB=${value} ;;
--extra-flags) SRS_EXTRA_FLAGS=${value} ;;
--build-tag) SRS_BUILD_TAG=${value} ;;
--x86-x64) SRS_X86_X64=YES ;;
--x86-64) SRS_X86_X64=YES ;;
@ -538,6 +542,7 @@ SRS_AUTO_CONFIGURE="--prefix=${SRS_PREFIX}"
if [ $SRS_LOG_TRACE = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-trace"; fi
if [ $SRS_GCOV = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --gcov"; fi
if [[ $SRS_EXTRA_FLAGS != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --extra-flags=\\\"$SRS_EXTRA_FLAGS\\\""; fi
if [[ $SRS_BUILD_TAG != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --build-tag=\\\"$SRS_BUILD_TAG\\\""; fi
if [[ $SRS_TOOL_CC != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cc=$SRS_TOOL_CC"; fi
if [[ $SRS_TOOL_CXX != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cxx=$SRS_TOOL_CXX"; fi
if [[ $SRS_TOOL_AR != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --ar=$SRS_TOOL_AR"; fi

View file

@ -1,3 +1,24 @@
#!/bin/bash
# when options parsed, setup some variables, then build the depends.
OS_KERNEL_NAME=$(uname -s)
OS_KERNRL_RELEASE=$(uname -r|awk -F '-' '{print $1}')
OS_PREFIX="Platform"
SRS_PLATFORM="${OS_PREFIX}-${OS_KERNEL_NAME}-${OS_KERNRL_RELEASE}"
if [[ ${SRS_BUILD_TAG} != "" ]]; then
SRS_PLATFORM="${SRS_PLATFORM}-${SRS_BUILD_TAG}"
fi
echo "SRS_WORKDIR: ${SRS_WORKDIR}, SRS_OBJS_DIR: ${SRS_OBJS_DIR}, SRS_OBJS: ${SRS_OBJS}, SRS_PLATFORM: ${SRS_PLATFORM}"
# For src object files on each platform.
(
cd ${SRS_OBJS_DIR} &&
rm -rf src utest srs research include lib srs_hls_ingester srs_mp4_parser &&
mkdir -p ${SRS_PLATFORM}/src && ln -sf ${SRS_PLATFORM}/src &&
mkdir -p ${SRS_PLATFORM}/utest && ln -sf ${SRS_PLATFORM}/utest &&
mkdir -p ${SRS_PLATFORM}/research && ln -sf ${SRS_PLATFORM}/research &&
mkdir -p ${SRS_PLATFORM}/include && ln -sf ${SRS_PLATFORM}/include &&
mkdir -p ${SRS_PLATFORM}/lib && ln -sf ${SRS_PLATFORM}/lib
)
echo "Fast cleanup, if need to do full cleanup, please use: make clean"

View file

@ -16,7 +16,7 @@ mkdir -p ${SRS_OBJS}/utest
# the prefix to generate the objs/utest/Makefile
# dirs relative to current dir(objs/utest), it's trunk/objs/utest
# trunk of srs, which contains the src dir, relative to objs/utest, it's trunk
SRS_TRUNK_PREFIX=../..
SRS_TRUNK_PREFIX=../../..
# gest dir, relative to objs/utest, it's trunk/objs/gtest
GTEST_DIR=${SRS_TRUNK_PREFIX}/${SRS_OBJS_DIR}/gtest