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

Support configure with --extra-ldflags. v5.0.199 (#3879)

1. add --extra-ldflags
2. support  commas in configure file
3. support link system library for utest

```
./configure --extra-ldflags=-Wl,-z,now
```
This commit is contained in:
Haibo Chen 2023-11-15 17:43:29 +08:00 committed by winlin
parent 316f4641ac
commit 4e4cce867b
4 changed files with 29 additions and 9 deletions

View file

@ -118,6 +118,7 @@ SRS_TOOL_AR=ar
SRS_TOOL_LD=ld
SRS_TOOL_RANDLIB=randlib
SRS_EXTRA_FLAGS=
SRS_EXTRA_LDFLAGS=
#
#####################################################################################
# Performance optimize.
@ -207,6 +208,7 @@ Toolchain options:
--ld=<LD> Toolchain: Use linker tool LD. Default: $SRS_TOOL_CXX
--randlib=<RANDLIB> Toolchain: Use randlib tool RANDLIB. Default: $SRS_TOOL_CXX
--extra-flags=<EFLAGS> Set EFLAGS as CFLAGS and CXXFLAGS. Also passed to ST as EXTRA_CFLAGS.
--extra-ldflags=<ELDFLAGS> Set ELDFLAGS as LDFLAGS.
Cross Build options: @see https://ossrs.net/lts/zh-cn/docs/v4/doc/arm#ubuntu-cross-build-srs
--cross=on|off Enable cross-build, please set bellow Toolchain also. Default: $(value2switch $SRS_CROSS_BUILD)
@ -311,6 +313,7 @@ function parse_user_option() {
--ld) SRS_TOOL_LD=${value} ;;
--randlib) SRS_TOOL_RANDLIB=${value} ;;
--extra-flags) SRS_EXTRA_FLAGS=${value} ;;
--extra-ldflags) SRS_EXTRA_LDFLAGS=${value} ;;
--build-tag) SRS_BUILD_TAG=${value} ;;
--srtp-nasm) SRS_SRTP_ASM=$(switch2value $value) ;;
@ -439,7 +442,7 @@ function parse_user_option_to_value_and_option() {
case "$option" in
-*=*)
value=`echo "$option" | sed -e 's|[-_a-zA-Z0-9/]*=||'`
option=`echo "$option" | sed -e 's|=[-_a-zA-Z0-9/. +]*||'`
option=`echo "$option" | sed -e 's|=[,-_a-zA-Z0-9/. +]*||'`
;;
*) value="" ;;
esac
@ -680,6 +683,7 @@ function regenerate_options() {
if [[ $SRS_CROSS_BUILD_HOST != "" ]]; then SRS_AUTO_CONFIGURE="$SRS_AUTO_CONFIGURE --host=$SRS_CROSS_BUILD_HOST"; fi
if [[ $SRS_CROSS_BUILD_PREFIX != "" ]]; then SRS_AUTO_CONFIGURE="$SRS_AUTO_CONFIGURE --cross-prefix=$SRS_CROSS_BUILD_PREFIX"; fi
if [[ $SRS_EXTRA_FLAGS != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --extra-flags=\\\"$SRS_EXTRA_FLAGS\\\""; fi
if [[ $SRS_EXTRA_LDFLAGS != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --extra-ldflags=\\\"$SRS_EXTRA_LDFLAGS\\\""; 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