mirror of
https://github.com/ossrs/srs.git
synced 2025-02-12 19:31:53 +00:00
Fix #1547, support crossbuild for ARM/MIPS.
This commit is contained in:
parent
6af8e38017
commit
0df108740a
6 changed files with 73 additions and 30 deletions
|
@ -146,7 +146,8 @@ For previous versions, please read:
|
||||||
|
|
||||||
## V3 changes
|
## V3 changes
|
||||||
|
|
||||||
* v3.0, 2020-01-21, For [#1547][bug #1547], support setting cc/cxx/ar tools. 3.0.103
|
* v3.0, 2020-01-21, Fix [#1547][bug #1547], support crossbuild for ARM/MIPS.
|
||||||
|
* v3.0, 2020-01-21, For [#1547][bug #1547], support setting cc/cxx/ar/ld/randlib tools. 3.0.103
|
||||||
* v3.0, 2020-01-19, For [#1580][bug #1580], fix cid range problem. 3.0.102
|
* v3.0, 2020-01-19, For [#1580][bug #1580], fix cid range problem. 3.0.102
|
||||||
* v3.0, 2020-01-19, For [#1070][bug #1070], define FLV CodecID for [AV1][bug #1070] and [opus][bug #307]. 3.0.101
|
* v3.0, 2020-01-19, For [#1070][bug #1070], define FLV CodecID for [AV1][bug #1070] and [opus][bug #307]. 3.0.101
|
||||||
* v3.0, 2020-01-16, For [#1575][bug #1575], correct RTMP redirect as tcUrl, add redirect2 as RTMP URL. 3.0.100
|
* v3.0, 2020-01-16, For [#1575][bug #1575], correct RTMP redirect as tcUrl, add redirect2 as RTMP URL. 3.0.100
|
||||||
|
|
|
@ -132,6 +132,11 @@ if [ $SRS_LOG_TRACE = YES ]; then
|
||||||
else
|
else
|
||||||
srs_undefine_macro "SRS_AUTO_TRACE" $SRS_AUTO_HEADERS_H
|
srs_undefine_macro "SRS_AUTO_TRACE" $SRS_AUTO_HEADERS_H
|
||||||
fi
|
fi
|
||||||
|
if [ $SRS_CROSS_BUILD = YES ]; then
|
||||||
|
srs_define_macro "SRS_AUTO_CROSSBUILD" $SRS_AUTO_HEADERS_H
|
||||||
|
else
|
||||||
|
srs_undefine_macro "SRS_AUTO_CROSSBUILD" $SRS_AUTO_HEADERS_H
|
||||||
|
fi
|
||||||
|
|
||||||
# prefix
|
# prefix
|
||||||
echo "" >> $SRS_AUTO_HEADERS_H
|
echo "" >> $SRS_AUTO_HEADERS_H
|
||||||
|
|
|
@ -232,7 +232,8 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
|
||||||
(
|
(
|
||||||
rm -rf ${SRS_OBJS}/st-srs && cd ${SRS_OBJS} &&
|
rm -rf ${SRS_OBJS}/st-srs && cd ${SRS_OBJS} &&
|
||||||
ln -sf ../3rdparty/st-srs && cd st-srs &&
|
ln -sf ../3rdparty/st-srs && cd st-srs &&
|
||||||
make clean && make ${_ST_MAKE} EXTRA_CFLAGS="${_ST_EXTRA_CFLAGS}" &&
|
make clean && make ${_ST_MAKE} EXTRA_CFLAGS="${_ST_EXTRA_CFLAGS}" \
|
||||||
|
CC=${SRS_TOOL_CC} AR=${SRS_TOOL_AR} LD=${SRS_TOOL_LD} RANDLIB=${SRS_TOOL_RANDLIB} &&
|
||||||
cd .. && rm -f st && ln -sf st-srs/obj st
|
cd .. && rm -f st && ln -sf st-srs/obj st
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
|
@ -321,21 +322,27 @@ fi
|
||||||
#####################################################################################
|
#####################################################################################
|
||||||
# openssl, for rtmp complex handshake
|
# openssl, for rtmp complex handshake
|
||||||
#####################################################################################
|
#####################################################################################
|
||||||
# extra configure options
|
if [[ $SRS_SSL == YES && $SRS_USE_SYS_SSL == YES ]]; then
|
||||||
OPENSSL_HOTFIX="-DOPENSSL_NO_HEARTBEATS"
|
echo "Warning: Use system libssl, without compiling openssl."
|
||||||
|
fi
|
||||||
# @see http://www.openssl.org/news/secadv/20140407.txt
|
# @see http://www.openssl.org/news/secadv/20140407.txt
|
||||||
# Affected users should upgrade to OpenSSL 1.1.0e. Users unable to immediately
|
# Affected users should upgrade to OpenSSL 1.1.0e. Users unable to immediately
|
||||||
# upgrade can alternatively recompile OpenSSL with -DOPENSSL_NO_HEARTBEATS.
|
# upgrade can alternatively recompile OpenSSL with -DOPENSSL_NO_HEARTBEATS.
|
||||||
if [ $SRS_SSL = YES ]; then
|
if [[ $SRS_SSL == YES && $SRS_USE_SYS_SSL != YES ]]; then
|
||||||
|
OPENSSL_HOTFIX="-DOPENSSL_NO_HEARTBEATS"
|
||||||
|
OPENSSL_CONFIG="./config"
|
||||||
|
# https://stackoverflow.com/questions/15539062/cross-compiling-of-openssl-for-linux-arm-v5te-linux-gnueabi-toolchain
|
||||||
|
if [[ $SRS_CROSS_BUILD == YES ]]; then
|
||||||
|
OPENSSL_CONFIG="./Configure linux-armv4"
|
||||||
|
else
|
||||||
|
# If not crossbuild, try to use exists libraries.
|
||||||
if [[ -f /usr/local/lib64/libssl.a && ! -f ${SRS_OBJS}/openssl/lib/libssl.a ]]; then
|
if [[ -f /usr/local/lib64/libssl.a && ! -f ${SRS_OBJS}/openssl/lib/libssl.a ]]; then
|
||||||
(mkdir -p ${SRS_OBJS}/openssl/lib && cd ${SRS_OBJS}/openssl/lib &&
|
(mkdir -p ${SRS_OBJS}/openssl/lib && cd ${SRS_OBJS}/openssl/lib &&
|
||||||
ln -sf /usr/local/lib64/libssl.a && ln -sf /usr/local/lib64/libcrypto.a)
|
ln -sf /usr/local/lib64/libssl.a && ln -sf /usr/local/lib64/libcrypto.a)
|
||||||
(mkdir -p ${SRS_OBJS}/openssl/include && cd ${SRS_OBJS}/openssl/include &&
|
(mkdir -p ${SRS_OBJS}/openssl/include && cd ${SRS_OBJS}/openssl/include &&
|
||||||
ln -sf /usr/local/include/openssl)
|
ln -sf /usr/local/include/openssl)
|
||||||
fi
|
fi
|
||||||
if [ $SRS_USE_SYS_SSL = YES ]; then
|
fi
|
||||||
echo "Warning: Use system libssl, without compiling openssl."
|
|
||||||
else
|
|
||||||
# cross build not specified, if exists flag, need to rebuild for no-arm platform.
|
# cross build not specified, if exists flag, need to rebuild for no-arm platform.
|
||||||
if [[ -f ${SRS_OBJS}/openssl/lib/libssl.a ]]; then
|
if [[ -f ${SRS_OBJS}/openssl/lib/libssl.a ]]; then
|
||||||
echo "Openssl-1.1.0e is ok.";
|
echo "Openssl-1.1.0e is ok.";
|
||||||
|
@ -344,8 +351,8 @@ if [ $SRS_SSL = YES ]; then
|
||||||
(
|
(
|
||||||
rm -rf ${SRS_OBJS}/openssl-1.1.0e && cd ${SRS_OBJS} &&
|
rm -rf ${SRS_OBJS}/openssl-1.1.0e && cd ${SRS_OBJS} &&
|
||||||
unzip -q ../3rdparty/openssl-1.1.0e.zip && cd openssl-1.1.0e &&
|
unzip -q ../3rdparty/openssl-1.1.0e.zip && cd openssl-1.1.0e &&
|
||||||
./config --prefix=`pwd`/_release -no-shared no-threads $OPENSSL_HOTFIX &&
|
${OPENSSL_CONFIG} --prefix=`pwd`/_release -no-shared -no-threads -no-asm $OPENSSL_HOTFIX &&
|
||||||
make && make install_sw &&
|
make CC=${SRS_TOOL_CC} AR="${SRS_TOOL_AR} -rs" LD=${SRS_TOOL_LD} RANDLIB=${SRS_TOOL_RANDLIB} && make install_sw &&
|
||||||
cd .. && rm -rf openssl && ln -sf openssl-1.1.0e/_release openssl
|
cd .. && rm -rf openssl && ln -sf openssl-1.1.0e/_release openssl
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
|
@ -353,7 +360,6 @@ if [ $SRS_SSL = YES ]; then
|
||||||
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build openssl-1.1.0e failed, ret=$ret"; exit $ret; fi
|
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build openssl-1.1.0e failed, ret=$ret"; exit $ret; fi
|
||||||
if [ ! -f ${SRS_OBJS}/openssl/lib/libssl.a ]; then echo "Build openssl-1.1.0e failed."; exit -1; fi
|
if [ ! -f ${SRS_OBJS}/openssl/lib/libssl.a ]; then echo "Build openssl-1.1.0e failed."; exit -1; fi
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
#####################################################################################
|
#####################################################################################
|
||||||
# live transcoding, ffmpeg-4.1, x264-core157, lame-3.99.5, libaacplus-2.0.2.
|
# live transcoding, ffmpeg-4.1, x264-core157, lame-3.99.5, libaacplus-2.0.2.
|
||||||
|
@ -447,4 +453,3 @@ fi
|
||||||
# generated the test script
|
# generated the test script
|
||||||
#####################################################################################
|
#####################################################################################
|
||||||
rm -rf ${SRS_OBJS}/srs.test && ln -sf `pwd`/scripts/srs.test objs/srs.test
|
rm -rf ${SRS_OBJS}/srs.test && ln -sf `pwd`/scripts/srs.test objs/srs.test
|
||||||
|
|
||||||
|
|
|
@ -100,6 +100,8 @@ SRS_CROSS_BUILD=NO
|
||||||
SRS_TOOL_CC=gcc
|
SRS_TOOL_CC=gcc
|
||||||
SRS_TOOL_CXX=g++
|
SRS_TOOL_CXX=g++
|
||||||
SRS_TOOL_AR=ar
|
SRS_TOOL_AR=ar
|
||||||
|
SRS_TOOL_LD=ld
|
||||||
|
SRS_TOOL_RANDLIB=randlib
|
||||||
SRS_EXTRA_FLAGS=
|
SRS_EXTRA_FLAGS=
|
||||||
|
|
||||||
#####################################################################################
|
#####################################################################################
|
||||||
|
@ -164,6 +166,8 @@ Toolchain options: @see https://github.com/ossrs/srs/issues/1547#issuec
|
||||||
--cc=<CC> Use c compiler CC, default is gcc.
|
--cc=<CC> Use c compiler CC, default is gcc.
|
||||||
--cxx=<CXX> Use c++ compiler CXX, default is g++.
|
--cxx=<CXX> Use c++ compiler CXX, default is g++.
|
||||||
--ar=<AR> Use archive tool AR, default is ar.
|
--ar=<AR> Use archive tool AR, default is ar.
|
||||||
|
--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.
|
--extra-flags=<EFLAGS> Set EFLAGS as CFLAGS and CXXFLAGS. Also passed to ST as EXTRA_CFLAGS.
|
||||||
|
|
||||||
Conflicts:
|
Conflicts:
|
||||||
|
@ -249,6 +253,8 @@ function parse_user_option() {
|
||||||
--cc) SRS_TOOL_CC=${value} ;;
|
--cc) SRS_TOOL_CC=${value} ;;
|
||||||
--cxx) SRS_TOOL_CXX=${value} ;;
|
--cxx) SRS_TOOL_CXX=${value} ;;
|
||||||
--ar) SRS_TOOL_AR=${value} ;;
|
--ar) SRS_TOOL_AR=${value} ;;
|
||||||
|
--ld) SRS_TOOL_LD=${value} ;;
|
||||||
|
--randlib) SRS_TOOL_RANDLIB=${value} ;;
|
||||||
--extra-flags) SRS_EXTRA_FLAGS=${value} ;;
|
--extra-flags) SRS_EXTRA_FLAGS=${value} ;;
|
||||||
|
|
||||||
--x86-x64) SRS_X86_X64=YES ;;
|
--x86-x64) SRS_X86_X64=YES ;;
|
||||||
|
@ -420,6 +426,14 @@ function apply_user_presets() {
|
||||||
SRS_UTEST=NO
|
SRS_UTEST=NO
|
||||||
SRS_STATIC=NO
|
SRS_STATIC=NO
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# if crossbuild, disable research and librtmp.
|
||||||
|
if [[ $SRS_CROSS_BUILD == YES ]]; then
|
||||||
|
SRS_LIBRTMP=NO
|
||||||
|
SRS_RESEARCH=NO
|
||||||
|
SRS_UTEST=NO
|
||||||
|
SRS_STATIC=NO
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
apply_user_presets
|
apply_user_presets
|
||||||
|
|
||||||
|
@ -520,6 +534,8 @@ SRS_AUTO_CONFIGURE="--prefix=${SRS_PREFIX}"
|
||||||
if [[ $SRS_TOOL_CC != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cc=$SRS_TOOL_CC"; 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_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
|
if [[ $SRS_TOOL_AR != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --ar=$SRS_TOOL_AR"; fi
|
||||||
|
if [[ $SRS_TOOL_LD != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --ld=$SRS_TOOL_LD"; fi
|
||||||
|
if [[ $SRS_TOOL_RANDLIB != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --randlib=$SRS_TOOL_RANDLIB"; fi
|
||||||
echo "User config: $SRS_AUTO_USER_CONFIGURE"
|
echo "User config: $SRS_AUTO_USER_CONFIGURE"
|
||||||
echo "Detail config: ${SRS_AUTO_CONFIGURE}"
|
echo "Detail config: ${SRS_AUTO_CONFIGURE}"
|
||||||
}
|
}
|
||||||
|
@ -541,6 +557,14 @@ function check_option_conflicts() {
|
||||||
echo "No arhive tool"
|
echo "No arhive tool"
|
||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
||||||
|
if [[ $SRS_TOOL_LD == '' ]]; then
|
||||||
|
echo "No linker tool"
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
if [[ $SRS_TOOL_RANDLIB == '' ]]; then
|
||||||
|
echo "No randlib tool"
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $SRS_OSX = YES ]; then
|
if [ $SRS_OSX = YES ]; then
|
||||||
echo "We don't support OSX, please use docker https://github.com/ossrs/srs-docker"
|
echo "We don't support OSX, please use docker https://github.com/ossrs/srs-docker"
|
||||||
|
|
|
@ -251,6 +251,9 @@ void show_macro_features()
|
||||||
#if defined(__aarch64__)
|
#if defined(__aarch64__)
|
||||||
ss << " aarch64";
|
ss << " aarch64";
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(SRS_AUTO_CROSSBUILD)
|
||||||
|
ss << "(crossbuild)";
|
||||||
|
#endif
|
||||||
|
|
||||||
ss << ", conf:" << _srs_config->config() << ", limit:" << _srs_config->get_max_connections()
|
ss << ", conf:" << _srs_config->config() << ", limit:" << _srs_config->get_max_connections()
|
||||||
<< ", writev:" << sysconf(_SC_IOV_MAX) << ", encoding:" << (srs_is_little_endian()? "little-endian":"big-endian")
|
<< ", writev:" << sysconf(_SC_IOV_MAX) << ", encoding:" << (srs_is_little_endian()? "little-endian":"big-endian")
|
||||||
|
|
|
@ -115,7 +115,12 @@ srs_error_t srs_fd_reuseport(int fd)
|
||||||
#if defined(SO_REUSEPORT)
|
#if defined(SO_REUSEPORT)
|
||||||
int v = 1;
|
int v = 1;
|
||||||
if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &v, sizeof(int)) == -1) {
|
if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &v, sizeof(int)) == -1) {
|
||||||
|
#ifdef SRS_AUTO_CROSSBUILD
|
||||||
|
srs_warn("SO_REUSEPORT disabled for crossbuild");
|
||||||
|
return srs_success;
|
||||||
|
#else
|
||||||
return srs_error_new(ERROR_SOCKET_SETREUSEADDR, "SO_REUSEPORT fd=%v", fd);
|
return srs_error_new(ERROR_SOCKET_SETREUSEADDR, "SO_REUSEPORT fd=%v", fd);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#warning "SO_REUSEPORT is not supported by your OS"
|
#warning "SO_REUSEPORT is not supported by your OS"
|
||||||
|
|
Loading…
Reference in a new issue