From a0c631de9fca0d980ef6ed6189dfd7e45e192d4f Mon Sep 17 00:00:00 2001 From: winlin Date: Wed, 25 Dec 2019 15:46:58 +0800 Subject: [PATCH] For #1537, #1282, support --extra-flags for unknown CPU arch. --- trunk/auto/depends.sh | 4 ++++ trunk/auto/options.sh | 10 ++++++++-- trunk/configure | 4 ++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/trunk/auto/depends.sh b/trunk/auto/depends.sh index 6a32cfe4a..6791e7ef7 100755 --- a/trunk/auto/depends.sh +++ b/trunk/auto/depends.sh @@ -424,6 +424,10 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then if [[ $SRS_VALGRIND == YES ]]; then _ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS -DMD_VALGRIND" fi + # Pass the global extra flags. + if [[ $SRS_EXTRA_CFLAGS != '' ]]; then + _ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS $SRS_EXTRA_CFLAGS" + fi # Patched ST from https://github.com/ossrs/state-threads/tree/srs if [[ -f ${SRS_OBJS}/st/libst.a ]]; then echo "The state-threads is ok."; diff --git a/trunk/auto/options.sh b/trunk/auto/options.sh index 853640016..4e74329d1 100755 --- a/trunk/auto/options.sh +++ b/trunk/auto/options.sh @@ -54,6 +54,8 @@ SRS_GCOV=NO SRS_LOG_VERBOSE=NO SRS_LOG_INFO=NO SRS_LOG_TRACE=NO +# The extra c/c++ flags to build SRS. Note that we also pass to ST as EXTRA_CFLAGS. +SRS_EXTRA_CFLAGS= # ################################################################ # experts @@ -97,7 +99,6 @@ SRS_ENABLE_ALL=NO # ##################################################################################### # We don't support crossbuild for ARM/MIPS, please directly build it on ARM/MIPS server. -# whether cross build for embed cpu, arm/mips SRS_CROSS_BUILD=NO ##################################################################################### @@ -174,7 +175,10 @@ Presets: --full enable all features, no gperf/gprof/arm. --x86-64 alias for --x86-x64. -Always Enabled: +Toolchain options: + --extra-flags= Set EFLAGS as CFLAGS and CXXFLAGS. Pass to ST as EXTRA_CFLAGS. + +Recomment to enable: --with-http-api enable HTTP API, to communicate with SRS. --with-http-callback enable HTTP hooks, build cherrypy as demo api server. --with-http-server enable HTTP server to delivery http stream. @@ -257,6 +261,7 @@ function parse_user_option() { --without-mips-ubuntu12) SRS_CROSS_BUILD=NO ;; --jobs) SRS_JOBS=${value} ;; + --extra-flags) SRS_EXTRA_CFLAGS=${value} ;; --prefix) SRS_PREFIX=${value} ;; --static) SRS_STATIC=YES ;; --log-verbose) SRS_LOG_VERBOSE=YES ;; @@ -568,6 +573,7 @@ SRS_AUTO_CONFIGURE="--prefix=${SRS_PREFIX}" if [ $SRS_LOG_INFO = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-info"; fi 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_CFLAGS != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --extra-flags=\\\"$SRS_EXTRA_CFLAGS\\\""; fi echo "User config: $SRS_AUTO_USER_CONFIGURE" echo "Detail config: ${SRS_AUTO_CONFIGURE}" } diff --git a/trunk/configure b/trunk/configure index 0a8d14f45..f60ef1ec8 100755 --- a/trunk/configure +++ b/trunk/configure @@ -118,6 +118,10 @@ fi if [[ $SRS_GCOV == YES ]]; then CXXFLAGS="${CXXFLAGS} ${SrsGcov}"; fi +# User configed options. +if [[ $SRS_EXTRA_CFLAGS != '' ]]; then + CXXFLAGS="${CXXFLAGS} $SRS_EXTRA_CFLAGS"; +fi # Start to generate the Makefile. cat << END >> ${SRS_OBJS}/${SRS_MAKEFILE} GCC = gcc