configure 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870
  1. #!/bin/bash
  2. #####################################################################################
  3. # the main output dir, all configure and make output are in this dir.
  4. #####################################################################################
  5. # Configure SRS from other directory, for example:
  6. # env SRS_WORKDIR=~/git/srs/trunk ./configure
  7. if [[ -z $SRS_WORKDIR ]]; then SRS_WORKDIR="."; fi
  8. # Set the objs to other directory, for example:
  9. # env SRS_OUTPUT=$(pwd) ./configure
  10. if [[ -z $SRS_OUTPUT ]]; then
  11. SRS_OBJS="${SRS_WORKDIR}/objs" && SRS_MAKEFILE=${SRS_WORKDIR}/Makefile
  12. else
  13. SRS_OBJS="${SRS_OUTPUT}/objs" && SRS_MAKEFILE=${SRS_OUTPUT}/Makefile
  14. fi
  15. # linux shell color support.
  16. RED="\\033[31m"
  17. GREEN="\\033[32m"
  18. YELLOW="\\033[33m"
  19. BLACK="\\033[0m"
  20. #####################################################################################
  21. # parse user options, set the variables like:
  22. # srs features: SRS_SSL/SRS_HLS/SRS_HTTP_CALLBACK/......
  23. # build options: SRS_JOBS
  24. #####################################################################################
  25. # parse options, exit with error when parse options invalid.
  26. . $SRS_WORKDIR/auto/options.sh
  27. # setup variables when options parsed.
  28. . $SRS_WORKDIR/auto/setup_variables.sh
  29. # We don't need to cleanup the exists files.
  30. rm -f ${SRS_MAKEFILE}
  31. # Create objs and platform directories.
  32. mkdir -p ${SRS_OBJS}/${SRS_PLATFORM}
  33. # If only generate objs directory, quit without error.
  34. if [[ $SRS_GENERATE_OBJS == YES ]]; then exit 0; fi
  35. # apply user options.
  36. . $SRS_WORKDIR/auto/depends.sh
  37. # the auto generated variables.
  38. . $SRS_WORKDIR/auto/auto_headers.sh
  39. #####################################################################################
  40. # generate Makefile.
  41. #####################################################################################
  42. # ubuntu echo in Makefile cannot display color, use bash instead
  43. SRS_BUILD_SUMMARY="_srs_build_summary.sh"
  44. # utest make entry, (cd utest; make)
  45. SrsUtestMakeEntry="@echo -e \"ignore utest for it's disabled\""
  46. if [[ $SRS_UTEST == YES ]]; then SrsUtestMakeEntry="\$(MAKE)\$(JOBS) -C ${SRS_OBJS}/${SRS_PLATFORM}/utest"; fi
  47. #####################################################################################
  48. # finger out modules to install.
  49. # where srs module is a dir which contains a config file.
  50. SRS_MODULES=()
  51. __mfiles=$(find $SRS_WORKDIR/modules -name "config") && for __mfile in $__mfiles; do
  52. SRS_MODULES+=("`dirname $__mfile`")
  53. done
  54. # variables for makefile for all modules.
  55. __mphonys="" && __mdefaults="" && __mcleanups=""
  56. # add each modules for application
  57. for SRS_MODULE in ${SRS_MODULES[*]}; do
  58. echo "install module at: $SRS_MODULE"
  59. . $SRS_WORKDIR/auto/reset_module.sh && . $SRS_MODULE/config
  60. if [[ 0 -ne ${#SRS_MODULE_MAIN[@]} ]]; then
  61. __mphonys="$__mphonys $SRS_MODULE_NAME"
  62. __mdefaults="$__mdefaults $SRS_MODULE_NAME"
  63. __mcleanups="$__mcleanups $SRS_MODULE_NAME"
  64. fi
  65. done
  66. # generate extra phony for each modules.
  67. cat << END > ${SRS_OBJS}/Makefile
  68. .PHONY: $__mphonys
  69. END
  70. #####################################################################################
  71. # build tools or compiler args.
  72. # enable gdb debug
  73. GDBDebug=" -g -O0"
  74. # the warning level.
  75. WarnLevel=" -Wall"
  76. # the compile standard.
  77. CppStd="-ansi"
  78. if [[ $SRS_CXX11 == YES ]]; then
  79. CppStd="-std=c++11"
  80. if [[ $SRS_CYGWIN64 == YES ]]; then CppStd="-std=gnu++11"; fi
  81. fi
  82. if [[ $SRS_CXX14 == YES ]]; then
  83. CppStd="-std=c++14"
  84. if [[ $SRS_CYGWIN64 == YES ]]; then CppStd="-std=gnu++14"; fi
  85. fi
  86. # performance of gprof
  87. SrsGprof=""; SrsGprofLink=""; if [[ $SRS_GPROF == YES ]]; then SrsGprof=" -pg -lc_p"; SrsGprofLink=" -pg"; fi
  88. # performance of gperf
  89. SrsGperf=""; SrsGperfLink=""; if [[ $SRS_GPERF == YES ]]; then SrsGperfLink=" -lpthread"; fi
  90. # the cxx flag generated.
  91. CXXFLAGS="${CXXFLAGS} ${CppStd}${WarnLevel}${GDBDebug}${LibraryCompile}${SrsGprof}"
  92. if [[ $SRS_GPERF == YES ]]; then
  93. CXXFLAGS="${CXXFLAGS} -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free";
  94. fi
  95. # For coverage.
  96. if [[ $SRS_GCOV == YES ]]; then
  97. SrsGcov="-fprofile-arcs -ftest-coverage"
  98. fi
  99. if [[ $SRS_GCOV == YES ]]; then
  100. CXXFLAGS="${CXXFLAGS} ${SrsGcov}";
  101. fi
  102. # User configed options.
  103. if [[ $SRS_EXTRA_FLAGS != '' ]]; then
  104. CXXFLAGS="${CXXFLAGS} $SRS_EXTRA_FLAGS";
  105. fi
  106. # For Sanitizer
  107. # @doc: https://github.com/google/sanitizers/wiki/AddressSanitizer
  108. if [[ $SRS_SANITIZER == YES && $OS_IS_X86_64 == YES ]]; then
  109. CXXFLAGS="${CXXFLAGS} -fsanitize=address -fno-omit-frame-pointer";
  110. fi
  111. # Start to generate the Makefile.
  112. cat << END >> ${SRS_OBJS}/Makefile
  113. GCC = ${SRS_TOOL_CC}
  114. CXX = ${SRS_TOOL_CXX}
  115. AR = ${SRS_TOOL_AR}
  116. LINK = ${SRS_TOOL_CXX}
  117. CXXFLAGS = ${CXXFLAGS}
  118. .PHONY: default srs srs_ingest_hls
  119. default:
  120. END
  121. #####################################################################################
  122. # Libraries, external library to build in srs,
  123. # header(.h): add to ModuleLibIncs if need the specified library. for example, LibSTRoot
  124. # library(.a): add to ModuleLibFiles if binary need the specifeid library. for example, LibSTfile
  125. #
  126. # the link options, always use static link
  127. SrsLinkOptions="-ldl -lpthread";
  128. # st(state-threads) the basic network library for SRS.
  129. LibSTRoot="${SRS_OBJS}/st"; LibSTfile="${LibSTRoot}/libst.a"
  130. if [[ $SRS_SHARED_ST == YES ]]; then LibSTfile="-L${LibSTRoot} -lst"; fi
  131. # srtp
  132. if [[ $SRS_RTC == YES ]]; then
  133. LibSrtpRoot="${SRS_OBJS}/srtp2/include"; LibSrtpFile="${SRS_OBJS}/srtp2/lib/libsrtp2.a"
  134. if [[ $SRS_USE_SYS_SRTP == YES ]]; then
  135. LibSrtpRoot=""; LibSrtpFile="libsrtp2.a"
  136. if [[ $SRS_SHARED_SRTP == YES ]]; then
  137. LibSrtpFile="";
  138. SrsLinkOptions="${SrsLinkOptions} -lsrtp2";
  139. fi
  140. fi
  141. fi
  142. # FFMPEG for WebRTC transcoding, such as aac to opus.
  143. if [[ $SRS_FFMPEG_FIT == YES ]]; then
  144. LibFfmpegRoot="${SRS_OBJS}/ffmpeg/include"
  145. LibFfmpegFile="${SRS_OBJS}/ffmpeg/lib/libavcodec.a ${SRS_OBJS}/ffmpeg/lib/libswresample.a ${SRS_OBJS}/ffmpeg/lib/libavutil.a"
  146. if [[ $SRS_FFMPEG_OPUS != YES ]]; then
  147. LibFfmpegFile="${LibFfmpegFile} ${SRS_OBJS}/opus/lib/libopus.a"
  148. fi
  149. if [[ $SRS_SHARED_FFMPEG == YES ]]; then
  150. LibFfmpegFile="-L${SRS_OBJS}/ffmpeg/lib -lavcodec -lswresample -lavutil";
  151. if [[ $SRS_FFMPEG_OPUS != YES ]]; then
  152. LibFfmpegFile="$LibFfmpegFile -L${SRS_OBJS}/opus/lib -lopus"
  153. fi
  154. fi
  155. if [[ $SRS_USE_SYS_FFMPEG == YES ]]; then
  156. LibFfmpegRoot=""
  157. LibFfmpegFile="libavcodec.a libswresample.a libavutil.a libopus.a";
  158. if [[ $SRS_SHARED_FFMPEG == YES ]]; then
  159. LibFfmpegFile=""
  160. SrsLinkOptions="${SrsLinkOptions} -lavcodec -lswresample -lavutil -lopus";
  161. fi
  162. fi
  163. fi
  164. # openssl-1.1.0e, for the RTMP complex handshake.
  165. LibSSLRoot="";LibSSLfile=""
  166. if [[ $SRS_SSL == YES && $SRS_USE_SYS_SSL == NO ]]; then
  167. LibSSLRoot="${SRS_OBJS}/openssl/include"; LibSSLfile="${SRS_OBJS}/openssl/lib/libssl.a ${SRS_OBJS}/openssl/lib/libcrypto.a";
  168. fi
  169. # gperftools-2.1, for mem check and mem/cpu profile
  170. LibGperfRoot=""; LibGperfFile=""
  171. if [[ $SRS_GPERF == YES ]]; then
  172. LibGperfRoot="${SRS_OBJS}/gperf/include"; LibGperfFile="${SRS_OBJS}/gperf/lib/libtcmalloc_and_profiler.a";
  173. fi
  174. if [[ $SRS_GPERF_MD == YES ]]; then
  175. LibGperfFile="${SRS_OBJS}/gperf/lib/libtcmalloc_debug.a";
  176. fi
  177. # srt code path
  178. if [[ $SRS_SRT == YES ]]; then
  179. LibSRTRoot="${SRS_OBJS}/srt/include"; LibSRTfile="${SRS_OBJS}/srt/lib/libsrt.a"
  180. if [[ $SRS_SHARED_SRT == YES ]]; then LibSRTfile="-L${SRS_OBJS}/srt/lib -lsrt"; fi
  181. if [[ $SRS_USE_SYS_SRT == YES ]]; then
  182. LibSRTRoot=""; LibSRTfile="libsrt.a"
  183. if [[ $SRS_SHARED_SRT == YES ]]; then
  184. LibSRTfile="";
  185. SrsLinkOptions="${SrsLinkOptions} -lsrt";
  186. fi
  187. fi
  188. fi
  189. if [[ $SRS_SSL == YES && $SRS_USE_SYS_SSL == YES ]]; then
  190. SrsLinkOptions="${SrsLinkOptions} -lssl -lcrypto";
  191. fi
  192. # Static link the c++ libraries, for user who build SRS by a new version of gcc,
  193. # so we need to link the c++ libraries staticly but not all.
  194. # @see https://stackoverflow.com/a/26107550
  195. if [[ $SRS_STATIC == YES ]]; then
  196. SrsLinkOptions="${SrsLinkOptions} -static-libstdc++";
  197. fi
  198. # For coverage.
  199. if [[ $SRS_GCOV == YES ]]; then
  200. SrsLinkOptions="${SrsLinkOptions} ${SrsGcov}";
  201. fi
  202. # For FFMPEG/RTC on Linux.
  203. if [[ $SRS_OSX != YES && $SRS_CYGWIN64 != YES && $SRS_RTC == YES && $SRS_FFMPEG_FIT == YES ]]; then
  204. SrsLinkOptions="${SrsLinkOptions} -lrt";
  205. fi
  206. # The backtrace symbol option.
  207. if [[ $SRS_BACKTRACE == YES ]]; then
  208. SrsLinkOptions="${SrsLinkOptions} -rdynamic";
  209. fi
  210. # For address sanitizer
  211. # @doc: https://github.com/google/sanitizers/wiki/AddressSanitizer
  212. if [[ $SRS_SANITIZER == YES && $OS_IS_X86_64 == YES ]]; then
  213. SrsLinkOptions="${SrsLinkOptions} -fsanitize=address -fno-omit-frame-pointer";
  214. if [[ $SRS_SANITIZER_STATIC == YES ]]; then
  215. SrsLinkOptions="${SrsLinkOptions} -static-libasan";
  216. fi
  217. fi
  218. # For FFMPEG/RTC on windows.
  219. if [[ $SRS_CYGWIN64 == YES && $SRS_FFMPEG_FIT == YES ]]; then
  220. SrsLinkOptions="${SrsLinkOptions} -lbcrypt";
  221. fi
  222. # User configed options.
  223. if [[ $SRS_EXTRA_LDFLAGS != '' ]]; then
  224. SrsLinkOptions="${SrsLinkOptions} $SRS_EXTRA_LDFLAGS";
  225. fi
  226. #####################################################################################
  227. # Modules, compile each module, then link to binary
  228. #
  229. #Core, depends only on system apis.
  230. MODULE_ID="CORE"
  231. MODULE_DEPENDS=()
  232. ModuleLibIncs=(${SRS_OBJS})
  233. MODULE_FILES=("srs_core" "srs_core_version" "srs_core_version5" "srs_core_autofree" "srs_core_performance"
  234. "srs_core_time" "srs_core_platform")
  235. CORE_INCS="src/core"; MODULE_DIR=${CORE_INCS} . $SRS_WORKDIR/auto/modules.sh
  236. CORE_OBJS="${MODULE_OBJS[@]}"
  237. #
  238. #Kernel, depends on core, provides error/log/config, nothing about stream information.
  239. MODULE_ID="KERNEL"
  240. MODULE_DEPENDS=("CORE")
  241. ModuleLibIncs=(${SRS_OBJS} ${LibSSLRoot})
  242. MODULE_FILES=("srs_kernel_error" "srs_kernel_log" "srs_kernel_buffer"
  243. "srs_kernel_utility" "srs_kernel_flv" "srs_kernel_codec" "srs_kernel_io"
  244. "srs_kernel_consts" "srs_kernel_aac" "srs_kernel_mp3" "srs_kernel_ts" "srs_kernel_ps"
  245. "srs_kernel_stream" "srs_kernel_balance" "srs_kernel_mp4" "srs_kernel_file"
  246. "srs_kernel_kbps")
  247. if [[ $SRS_RTC == YES ]]; then
  248. MODULE_FILES+=("srs_kernel_rtc_rtp" "srs_kernel_rtc_rtcp")
  249. fi
  250. KERNEL_INCS="src/kernel"; MODULE_DIR=${KERNEL_INCS} . $SRS_WORKDIR/auto/modules.sh
  251. KERNEL_OBJS="${MODULE_OBJS[@]}"
  252. #
  253. #RTMP/HTTP/Raw Protocol, depends on core/kernel, provides rtmp/htttp protocol features.
  254. MODULE_ID="PROTOCOL"
  255. MODULE_DEPENDS=("CORE" "KERNEL")
  256. ModuleLibIncs=(${SRS_OBJS} ${LibSTRoot} ${LibSSLRoot})
  257. MODULE_FILES=("srs_protocol_amf0" "srs_protocol_io" "srs_protocol_conn" "srs_protocol_rtmp_handshake"
  258. "srs_protocol_rtmp_stack" "srs_protocol_utility" "srs_protocol_rtmp_msg_array" "srs_protocol_stream"
  259. "srs_protocol_raw_avc" "srs_protocol_http_stack" "srs_protocol_kbps" "srs_protocol_json"
  260. "srs_protocol_format" "srs_protocol_log" "srs_protocol_st" "srs_protocol_http_client"
  261. "srs_protocol_http_conn" "srs_protocol_rtmp_conn" "srs_protocol_protobuf")
  262. if [[ $SRS_SRT == YES ]]; then
  263. MODULE_FILES+=("srs_protocol_srt")
  264. ModuleLibIncs+=(${LibSRTRoot})
  265. fi
  266. if [[ $SRS_RTC == YES ]]; then
  267. MODULE_FILES+=("srs_protocol_rtc_stun")
  268. fi
  269. PROTOCOL_INCS="src/protocol"; MODULE_DIR=${PROTOCOL_INCS} . $SRS_WORKDIR/auto/modules.sh
  270. PROTOCOL_OBJS="${MODULE_OBJS[@]}"
  271. #
  272. #App Module, for SRS server only.
  273. MODULE_ID="APP"
  274. MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL")
  275. ModuleLibIncs=(${SRS_OBJS} ${LibSSLRoot})
  276. if [[ $SRS_GPERF == YES ]]; then
  277. ModuleLibIncs+=(${LibGperfRoot})
  278. fi
  279. if [[ $SRS_RTC == YES ]]; then
  280. ModuleLibIncs+=(${LibSrtpRoot})
  281. fi
  282. if [[ $SRS_FFMPEG_FIT == YES ]]; then
  283. ModuleLibIncs+=("${LibFfmpegRoot[*]}")
  284. fi
  285. MODULE_FILES=("srs_app_server" "srs_app_conn" "srs_app_rtmp_conn" "srs_app_source"
  286. "srs_app_refer" "srs_app_hls" "srs_app_forward" "srs_app_encoder" "srs_app_http_stream"
  287. "srs_app_st" "srs_app_log" "srs_app_config"
  288. "srs_app_pithy_print" "srs_app_reload" "srs_app_http_api" "srs_app_http_conn" "srs_app_http_hooks"
  289. "srs_app_ingest" "srs_app_ffmpeg" "srs_app_utility" "srs_app_edge"
  290. "srs_app_heartbeat" "srs_app_empty" "srs_app_http_client" "srs_app_http_static"
  291. "srs_app_recv_thread" "srs_app_security" "srs_app_statistic" "srs_app_hds"
  292. "srs_app_mpegts_udp" "srs_app_listener" "srs_app_async_call"
  293. "srs_app_caster_flv" "srs_app_latest_version" "srs_app_uuid" "srs_app_process" "srs_app_ng_exec"
  294. "srs_app_hourglass" "srs_app_dash" "srs_app_fragment" "srs_app_dvr"
  295. "srs_app_coworkers" "srs_app_hybrid" "srs_app_threads")
  296. if [[ $SRS_SRT == YES ]]; then
  297. MODULE_FILES+=("srs_app_srt_server" "srs_app_srt_listener" "srs_app_srt_conn" "srs_app_srt_utility" "srs_app_srt_source")
  298. fi
  299. if [[ $SRS_RTC == YES ]]; then
  300. MODULE_FILES+=("srs_app_rtc_conn" "srs_app_rtc_dtls" "srs_app_rtc_sdp" "srs_app_rtc_network"
  301. "srs_app_rtc_queue" "srs_app_rtc_server" "srs_app_rtc_source" "srs_app_rtc_api")
  302. fi
  303. if [[ $SRS_APM == YES ]]; then
  304. MODULE_FILES+=("srs_app_tencentcloud")
  305. fi
  306. if [[ $SRS_FFMPEG_FIT == YES ]]; then
  307. MODULE_FILES+=("srs_app_rtc_codec")
  308. fi
  309. if [[ $SRS_GB28181 == YES ]]; then
  310. MODULE_FILES+=("srs_app_gb28181")
  311. fi
  312. DEFINES=""
  313. # add each modules for app
  314. for SRS_MODULE in ${SRS_MODULES[*]}; do
  315. . $SRS_WORKDIR/auto/reset_module.sh && . $SRS_MODULE/config
  316. MODULE_FILES+=("${SRS_MODULE_APP[*]}")
  317. DEFINES="${DEFINES} ${SRS_MODULE_DEFINES}"
  318. done
  319. APP_INCS="src/app"; MODULE_DIR=${APP_INCS} . $SRS_WORKDIR/auto/modules.sh
  320. APP_OBJS="${MODULE_OBJS[@]}"
  321. #
  322. #Server Module, for SRS only.
  323. MODULE_ID="SERVER"
  324. MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "APP")
  325. ModuleLibIncs=(${SRS_OBJS} ${LibGperfRoot} ${LibSSLRoot})
  326. if [[ $SRS_RTC == YES ]]; then
  327. ModuleLibIncs+=(${LibSrtpRoot})
  328. fi
  329. if [[ $SRS_FFMPEG_FIT == YES ]]; then
  330. ModuleLibIncs+=("${LibFfmpegRoot[*]}")
  331. fi
  332. MODULE_FILES=("srs_main_server")
  333. SERVER_INCS="src/main"; MODULE_DIR=${SERVER_INCS} . $SRS_WORKDIR/auto/modules.sh
  334. SERVER_OBJS="${MODULE_OBJS[@]}"
  335. #
  336. #Main Module, for app from modules.
  337. MODULE_ID="MAIN"
  338. MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "APP")
  339. ModuleLibIncs=(${SRS_OBJS} ${LibGperfRoot} ${LibSSLRoot})
  340. if [[ $SRS_RTC == YES ]]; then
  341. ModuleLibIncs+=(${LibSrtpRoot})
  342. fi
  343. if [[ $SRS_FFMPEG_FIT == YES ]]; then
  344. ModuleLibIncs+=("${LibFfmpegRoot[*]}")
  345. fi
  346. MODULE_FILES=()
  347. DEFINES=""
  348. # add each modules for main
  349. for SRS_MODULE in ${SRS_MODULES[*]}; do
  350. . $SRS_WORKDIR/auto/reset_module.sh && . $SRS_MODULE/config
  351. MODULE_FILES+=("${SRS_MODULE_MAIN[*]}")
  352. DEFINES="${DEFINES} ${SRS_MODULE_DEFINES}"
  353. done
  354. MAIN_INCS="src/main"; MODULE_DIR=${MAIN_INCS} . $SRS_WORKDIR/auto/modules.sh
  355. MAIN_OBJS="${MODULE_OBJS[@]}"
  356. #####################################################################################
  357. # Binaries, main entrances, link the module and its depends modules,
  358. # then link to a binary, for example, objs/srs
  359. #
  360. # all main entrances
  361. MAIN_ENTRANCES=("srs_main_server")
  362. for SRS_MODULE in ${SRS_MODULES[*]}; do
  363. . $SRS_WORKDIR/auto/reset_module.sh && . $SRS_MODULE/config
  364. MAIN_ENTRANCES+=("${SRS_MODULE_MAIN[*]}")
  365. done
  366. #
  367. # all depends libraries
  368. ModuleLibFiles=(${LibSTfile} ${LibSSLfile} ${LibGperfFile})
  369. if [[ $SRS_RTC == YES ]]; then
  370. ModuleLibFiles+=(${LibSrtpFile})
  371. fi
  372. if [[ $SRS_FFMPEG_FIT == YES ]]; then
  373. ModuleLibFiles+=("${LibFfmpegFile[*]}")
  374. fi
  375. if [[ $SRS_SRT == YES ]]; then
  376. ModuleLibFiles+=("${LibSRTfile[*]}")
  377. fi
  378. # all depends objects
  379. MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${PROTOCOL_OBJS[@]} ${APP_OBJS[@]} ${SERVER_OBJS[@]}"
  380. ModuleLibIncs=(${SRS_OBJS} ${LibSTRoot} ${LibGperfRoot} ${LibSSLRoot})
  381. if [[ $SRS_RTC == YES ]]; then
  382. ModuleLibIncs+=(${LibSrtpRoot})
  383. fi
  384. if [[ $SRS_FFMPEG_FIT == YES ]]; then
  385. ModuleLibIncs+=("${LibFfmpegRoot[*]}")
  386. fi
  387. if [[ $SRS_SRT == YES ]]; then
  388. ModuleLibIncs+=(${LibSRTRoot})
  389. MODULE_OBJS="${MODULE_OBJS} ${SRT_OBJS[@]}"
  390. fi
  391. LINK_OPTIONS="${LDFLAGS} ${SrsLinkOptions}${SrsGprofLink}${SrsGperfLink}"
  392. #
  393. # srs: srs(simple rtmp server) over st(state-threads)
  394. BUILD_KEY="srs" APP_MAIN="srs_main_server" APP_NAME="srs" . $SRS_WORKDIR/auto/apps.sh
  395. #
  396. # For modules, with the app module.
  397. MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${PROTOCOL_OBJS[@]} ${APP_OBJS[@]} ${MAIN_OBJS[@]}"
  398. ModuleLibFiles=(${LibSTfile} ${LibSSLfile} ${LibGperfFile})
  399. if [[ $SRS_RTC == YES ]]; then
  400. ModuleLibFiles+=(${LibSrtpFile})
  401. fi
  402. if [[ $SRS_FFMPEG_FIT == YES ]]; then
  403. ModuleLibFiles+=("${LibFfmpegFile[*]}")
  404. fi
  405. if [[ $SRS_SRT == YES ]]; then
  406. ModuleLibFiles+=("${LibSRTfile[*]}")
  407. fi
  408. #
  409. for SRS_MODULE in ${SRS_MODULES[*]}; do
  410. . $SRS_WORKDIR/auto/reset_module.sh && . $SRS_MODULE/config
  411. # no SRS_MODULE_MAIN
  412. if [[ 0 -eq ${#SRS_MODULE_MAIN[@]} ]]; then continue; fi
  413. BUILD_KEY="$SRS_MODULE_NAME" APP_MAIN="${SRS_MODULE_MAIN[0]}" APP_NAME="$SRS_MODULE_NAME" . $SRS_WORKDIR/auto/apps.sh
  414. done
  415. # For utest on mac.
  416. # @see https://github.com/protocolbuffers/protobuf/issues/51#issuecomment-111044468
  417. if [[ $SRS_OSX == YES ]]; then
  418. UTEST_EXTRA_DEFINES="-DGTEST_USE_OWN_TR1_TUPLE=1"
  419. fi
  420. #
  421. # utest, the unit-test cases of srs, base on gtest1.6
  422. if [[ $SRS_UTEST == YES ]]; then
  423. MODULE_FILES=("srs_utest" "srs_utest_amf0" "srs_utest_kernel" "srs_utest_core"
  424. "srs_utest_config" "srs_utest_rtmp" "srs_utest_http" "srs_utest_avc" "srs_utest_reload"
  425. "srs_utest_mp4" "srs_utest_service" "srs_utest_app" "srs_utest_rtc" "srs_utest_config2"
  426. "srs_utest_protocol" "srs_utest_protocol2" "srs_utest_kernel2" "srs_utest_protocol3")
  427. if [[ $SRS_SRT == YES ]]; then
  428. MODULE_FILES+=("srs_utest_srt")
  429. fi
  430. if [[ $SRS_GB28181 == YES ]]; then
  431. MODULE_FILES+=("srs_utest_gb28181")
  432. fi
  433. ModuleLibIncs=(${SRS_OBJS} ${LibSTRoot} ${LibSSLRoot})
  434. if [[ $SRS_RTC == YES ]]; then
  435. ModuleLibIncs+=(${LibSrtpRoot})
  436. fi
  437. if [[ $SRS_FFMPEG_FIT == YES ]]; then
  438. ModuleLibIncs+=("${LibFfmpegRoot[*]}")
  439. fi
  440. if [[ $SRS_SRT == YES ]]; then
  441. ModuleLibIncs+=("${LibSRTRoot[*]}")
  442. fi
  443. ModuleLibFiles=(${LibSTfile} ${LibSSLfile})
  444. if [[ $SRS_RTC == YES ]]; then
  445. ModuleLibFiles+=(${LibSrtpFile})
  446. fi
  447. if [[ $SRS_FFMPEG_FIT == YES ]]; then
  448. ModuleLibFiles+=("${LibFfmpegFile[*]}")
  449. fi
  450. if [[ $SRS_SRT == YES ]]; then
  451. ModuleLibFiles+=("${LibSRTfile[*]}")
  452. fi
  453. MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "APP")
  454. MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${PROTOCOL_OBJS[@]} ${APP_OBJS[@]} ${SRT_OBJS[@]}"
  455. LINK_OPTIONS="${LDFLAGS} -lpthread ${SrsLinkOptions}" MODULE_DIR="src/utest" APP_NAME="srs_utest" . $SRS_WORKDIR/auto/utest.sh
  456. fi
  457. #####################################################################################
  458. # generate colorful summary script
  459. . $SRS_WORKDIR/auto/summary.sh
  460. #####################################################################################
  461. # makefile
  462. echo "Generate Makefile"
  463. # backup old makefile.
  464. rm -f ${SRS_MAKEFILE}.bk &&
  465. mv ${SRS_MAKEFILE} ${SRS_MAKEFILE}.bk
  466. # generate phony header
  467. cat << END > ${SRS_MAKEFILE}
  468. .PHONY: default all _default install help clean destroy server srs_ingest_hls utest _prepare_dir $__mphonys
  469. .PHONY: clean_srs clean_modules clean_openssl clean_srtp2 clean_opus clean_ffmpeg clean_st
  470. .PHONY: st ffmpeg
  471. GCC = ${SRS_TOOL_CC}
  472. CXX = ${SRS_TOOL_CXX}
  473. AR = ${SRS_TOOL_AR}
  474. LINK = ${SRS_TOOL_LD}
  475. RANDLIB = ${SRS_TOOL_RANDLIB}
  476. CXXFLAGS = ${CXXFLAGS}
  477. LDFLAGS = ${LDFLAGS}
  478. # install prefix.
  479. SRS_PREFIX=${SRS_PREFIX}
  480. SRS_DEFAULT_CONFIG=${SRS_DEFAULT_CONFIG}
  481. __REAL_INSTALL=\$(DESTDIR)\$(SRS_PREFIX)
  482. SRS_FORCE_MAKE_JOBS=${SRS_FORCE_MAKE_JOBS}
  483. END
  484. if [[ $SRS_FORCE_MAKE_JOBS == YES ]]; then
  485. cat << END >> ${SRS_MAKEFILE}
  486. JOBS=\$(shell echo \$(MAKEFLAGS)| grep -qE '\-j[0-9]+' || echo " ${SRS_JOBS}")
  487. END
  488. fi
  489. # the real entry for all platform:
  490. cat << END >> ${SRS_MAKEFILE}
  491. default: server
  492. all: _default
  493. _default: server srs_ingest_hls utest $__mdefaults
  494. help:
  495. @echo "Usage: make <help>|<clean>|<destroy>|<server>|<utest>|<install>|<uninstall>"
  496. @echo " help Display this help menu"
  497. @echo " clean Cleanup project and all depends"
  498. @echo " destroy Cleanup all files for this platform in ${SRS_OBJS}/${SRS_PLATFORM}"
  499. @echo " server Build the srs and other modules in main"
  500. @echo " utest Build the utest for srs"
  501. @echo " install Install srs to the prefix path"
  502. @echo " uninstall Uninstall srs from prefix path"
  503. @echo "To rebuild special module:"
  504. @echo " st Rebuild st-srs in ${SRS_OBJS}/${SRS_PLATFORM}/st-srs"
  505. @echo " ffmpeg Rebuild ffmpeg in ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg-4.2-fit"
  506. @echo "To reconfigure special depends:"
  507. @echo " clean_openssl Remove the openssl cache."
  508. @echo " clean_srtp2 Remove the libsrtp2 cache."
  509. @echo " clean_opus Remove the opus cache."
  510. @echo " clean_ffmpeg Remove the FFmpeg cache."
  511. @echo " clean_st Remove the ST cache."
  512. @echo "For example:"
  513. @echo " make"
  514. @echo " make help"
  515. doclean:
  516. (cd ${SRS_OBJS} && rm -rf srs srs_utest srs.exe srs_utest.exe $__mcleanups)
  517. (cd ${SRS_OBJS} && rm -rf src/* include lib)
  518. (mkdir -p ${SRS_OBJS}/utest && cd ${SRS_OBJS}/utest && rm -rf *.o *.a)
  519. clean: clean_srs clean_modules
  520. destroy:
  521. (cd ${SRS_OBJS} && rm -rf ${SRS_PLATFORM})
  522. clean_srs:
  523. @(cd ${SRS_OBJS} && rm -rf srs srs_utest src/* utest/*)
  524. clean_modules:
  525. @(cd ${SRS_OBJS} && rm -rf $__mdefaults)
  526. clean_openssl:
  527. @rm -rf ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/openssl
  528. @echo "Please rebuild openssl by: ./configure"
  529. clean_srtp2:
  530. @rm -rf ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/srtp2
  531. @echo "Please rebuild libsrtp2 by: ./configure"
  532. clean_opus:
  533. @rm -rf ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/opus
  534. @echo "Please rebuild opus by: ./configure"
  535. clean_ffmpeg:
  536. @rm -rf ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/ffmpeg
  537. @echo "Please rebuild FFmpeg by: ./configure"
  538. clean_st:
  539. @rm -rf ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/st
  540. @echo "Please rebuild ST by: ./configure"
  541. st:
  542. @rm -f ${SRS_OBJS}/srs srs_utest
  543. @\$(MAKE)\$(JOBS) -C ${SRS_OBJS}/${SRS_PLATFORM}/st-srs clean
  544. @env EXTRA_CFLAGS="${_ST_EXTRA_CFLAGS}" \$(MAKE)\$(JOBS) -C ${SRS_OBJS}/${SRS_PLATFORM}/st-srs ${_ST_MAKE_ARGS} CC=\$(GCC) AR=\$(AR) LD=\$(LINK) RANDLIB=\$(RANDLIB)
  545. @echo "Please rebuild srs by: make"
  546. ffmpeg:
  547. @rm -f ${SRS_OBJS}/srs srs_utest
  548. \$(MAKE)\$(JOBS) -C ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg-4.2-fit
  549. \$(MAKE)\$(JOBS) -C ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg-4.2-fit install-libs
  550. @echo "Please rebuild srs by: make"
  551. END
  552. # Generate Makefile entry for srs-server.
  553. cat << END >> ${SRS_MAKEFILE}
  554. server: _prepare_dir
  555. @echo "Build the SRS server, JOBS=\${JOBS}, FORCE_MAKE_JOBS=${SRS_FORCE_MAKE_JOBS}"
  556. \$(MAKE)\$(JOBS) -f ${SRS_OBJS}/Makefile srs
  557. @bash objs/_srs_build_summary.sh
  558. END
  559. # generate all modules entry
  560. for SRS_MODULE in ${SRS_MODULES[*]}; do
  561. . $SRS_WORKDIR/auto/reset_module.sh && . $SRS_MODULE/config
  562. cat << END >> ${SRS_MAKEFILE}
  563. $SRS_MODULE_NAME: _prepare_dir server
  564. @echo "Build the $SRS_MODULE_NAME over SRS"
  565. \$(MAKE)\$(JOBS) -f ${SRS_OBJS}/Makefile $SRS_MODULE_NAME
  566. END
  567. done
  568. # install entry
  569. cat << END >> ${SRS_MAKEFILE}
  570. uninstall:
  571. @echo "rmdir \$(SRS_PREFIX)"
  572. @rm -rf \$(SRS_PREFIX)
  573. install:
  574. @echo "Now mkdir \$(__REAL_INSTALL)"
  575. @mkdir -p \$(__REAL_INSTALL)
  576. @echo "Now make the http root dir"
  577. @mkdir -p \$(__REAL_INSTALL)/objs/nginx/html
  578. @cp -f research/api-server/static-dir/index.html \$(__REAL_INSTALL)/objs/nginx/html
  579. @cp -f research/players/crossdomain.xml \$(__REAL_INSTALL)/objs/nginx/html
  580. @cp -f research/api-server/static-dir/favicon.ico \$(__REAL_INSTALL)/objs/nginx/html
  581. @cp -Rf research/players \$(__REAL_INSTALL)/objs/nginx/html/
  582. @cp -Rf research/console \$(__REAL_INSTALL)/objs/nginx/html/
  583. @cp -Rf 3rdparty/signaling/www/demos \$(__REAL_INSTALL)/objs/nginx/html/
  584. @echo "Now copy binary files"
  585. @mkdir -p \$(__REAL_INSTALL)/objs
  586. @cp -f objs/srs \$(__REAL_INSTALL)/objs
  587. @echo "Now copy srs conf files"
  588. @mkdir -p \$(__REAL_INSTALL)/conf
  589. @cp -f conf/*.conf \$(__REAL_INSTALL)/conf
  590. @cp -f conf/server.key conf/server.crt \$(__REAL_INSTALL)/conf
  591. @echo "Now copy init.d script files"
  592. @mkdir -p \$(__REAL_INSTALL)/etc/init.d
  593. @cp -f etc/init.d/srs \$(__REAL_INSTALL)/etc/init.d
  594. @sed -i "s|^ROOT=.*|ROOT=\"\$(SRS_PREFIX)\"|g" \$(__REAL_INSTALL)/etc/init.d/srs
  595. @sed -i "s|^CONFIG=.*|CONFIG=\"\$(SRS_DEFAULT_CONFIG)\"|g" \$(__REAL_INSTALL)/etc/init.d/srs
  596. @echo "Now copy systemctl service files"
  597. @mkdir -p \$(__REAL_INSTALL)/usr/lib/systemd/system
  598. @cp -f usr/lib/systemd/system/srs.service \$(__REAL_INSTALL)/usr/lib/systemd/system/srs.service
  599. @echo ""
  600. @echo "@see: https://ossrs.net/lts/zh-cn/docs/v4/doc/service"
  601. END
  602. if [[ $SRS_UTEST == YES ]]; then
  603. cat << END >> ${SRS_MAKEFILE}
  604. utest: server
  605. @echo "Building the utest for srs"
  606. ${SrsUtestMakeEntry}
  607. @echo "The utest is built ok."
  608. END
  609. else
  610. cat << END >> ${SRS_MAKEFILE}
  611. utest: server
  612. @echo "Ignore utest for it's disabled."
  613. END
  614. fi
  615. cat << END >> ${SRS_MAKEFILE}
  616. # the ./configure will generate it.
  617. _prepare_dir:
  618. @mkdir -p ${SRS_OBJS}
  619. END
  620. # generate makefile ok, append the tails.
  621. cat ${SRS_MAKEFILE}.bk >> ${SRS_MAKEFILE} &&
  622. rm -f ${SRS_MAKEFILE}.bk
  623. echo 'Configure ok! '
  624. #####################################################################################
  625. # when configure success, prepare build
  626. #####################################################################################
  627. # create objs/logs for ffmpeg to write log.
  628. mkdir -p ${SRS_OBJS}/logs
  629. #####################################################################################
  630. # configure summary
  631. #####################################################################################
  632. # summary
  633. echo ""
  634. echo "Configure summary:"
  635. echo " ${SRS_AUTO_USER_CONFIGURE}"
  636. echo " ${SRS_AUTO_CONFIGURE}"
  637. if [[ $SRS_HLS == YES ]]; then
  638. echo -e "${GREEN}HLS is enabled.${BLACK}"
  639. else
  640. echo -e "${YELLOW}Warning: HLS is disabled.${BLACK}"
  641. fi
  642. if [[ $SRS_STREAM_CASTER == YES ]]; then
  643. echo -e "${YELLOW}Experiment: StreamConverter is enabled.${BLACK}"
  644. else
  645. echo -e "${GREEN}Note: StreamConverter is disabled.${BLACK}"
  646. fi
  647. if [[ $SRS_HDS == YES ]]; then
  648. echo -e "${YELLOW}Experiment: HDS is enabled.${BLACK}"
  649. else
  650. echo -e "${GREEN}Warning: HDS is disabled.${BLACK}"
  651. fi
  652. if [[ $SRS_GB28181 == YES ]]; then
  653. echo -e "${YELLOW}Experiment: GB28181 is enabled. https://github.com/ossrs/srs/issues/3176${BLACK}"
  654. else
  655. echo -e "${GREEN}Warning: GB28181 is disabled.${BLACK}"
  656. fi
  657. if [[ $SRS_SRT == YES ]]; then
  658. echo -e "${YELLOW}Experiment: SRT is enabled. https://github.com/ossrs/srs/issues/1147${BLACK}"
  659. else
  660. echo -e "${GREEN}Warning: SRT is disabled.${BLACK}"
  661. fi
  662. if [[ $SRS_RTC == YES ]]; then
  663. echo -e "${YELLOW}Experiment: RTC is enabled. https://github.com/ossrs/srs/issues/307${BLACK}"
  664. else
  665. echo -e "${GREEN}Warning: RTC is disabled.${BLACK}"
  666. fi
  667. if [[ $SRS_HTTPS == YES ]]; then
  668. echo -e "${YELLOW}Experiment: HTTPS is enabled. https://github.com/ossrs/srs/issues/1657${BLACK}"
  669. else
  670. echo -e "${GREEN}Warning: HTTPS is disabled.${BLACK}"
  671. fi
  672. if [[ $SRS_DVR == YES ]]; then
  673. echo -e "${GREEN}DVR is enabled.${BLACK}"
  674. else
  675. echo -e "${YELLOW}Warning: DVR is disabled.${BLACK}"
  676. fi
  677. if [[ $SRS_SSL == YES ]]; then
  678. echo -e "${GREEN}RTMP complex handshake is enabled${BLACK}"
  679. else
  680. echo -e "${YELLOW}Warning: RTMP complex handshake is disabled, flash cann't play h264/aac.${BLACK}"
  681. fi
  682. if [[ $SRS_NASM == YES ]]; then
  683. echo -e "${GREEN}NASM for HTTPS(openssl) and FFmepg is enabled${BLACK}"
  684. else
  685. echo -e "${YELLOW}Warning: NASM for HTTPS(openssl) and FFmepg is disabled${BLACK}"
  686. fi
  687. if [[ $SRS_SRTP_ASM == YES ]]; then
  688. echo -e "${GREEN}SRTP-NASM for WebRTC(openssl) is enabled${BLACK}"
  689. else
  690. echo -e "${YELLOW}Warning: SRTP-NASM for WebRTC(openssl) is disabled${BLACK}"
  691. fi
  692. if [[ $SRS_TRANSCODE == YES ]]; then
  693. echo -e "${GREEN}The transcoding is enabled${BLACK}"
  694. else
  695. echo -e "${YELLOW}Warning: The transcoding is disabled.${BLACK}"
  696. fi
  697. if [[ $SRS_INGEST == YES ]]; then
  698. echo -e "${GREEN}The ingesting is enabled.${BLACK}"
  699. else
  700. echo -e "${YELLOW}Warning: The ingesting is disabled.${BLACK}"
  701. fi
  702. if [[ $SRS_HTTP_CALLBACK == YES ]]; then
  703. echo -e "${GREEN}The http-callback is enabled${BLACK}"
  704. else
  705. echo -e "${YELLOW}Warning: The http-callback is disabled.${BLACK}"
  706. fi
  707. if [[ $SRS_HTTP_SERVER == YES ]]; then
  708. echo -e "${GREEN}Embeded HTTP server for HTTP-FLV/HLS is enabled.${BLACK}"
  709. else
  710. echo -e "${YELLOW}Warning: Embeded HTTP server is disabled, HTTP-FLV is disabled, please use nginx to delivery HLS.${BLACK}"
  711. fi
  712. if [[ $SRS_HTTP_API == YES ]]; then
  713. echo -e "${GREEN}The HTTP API is enabled${BLACK}"
  714. else
  715. echo -e "${YELLOW}Warning: The HTTP API is disabled.${BLACK}"
  716. fi
  717. if [[ $SRS_UTEST == YES ]]; then
  718. echo -e "${GREEN}The utests are enabled.${BLACK}"
  719. else
  720. echo -e "${YELLOW}Note: The utests are disabled.${BLACK}"
  721. fi
  722. if [[ $SRS_GPERF == YES ]]; then
  723. echo -e "${GREEN}The gperf(tcmalloc) is enabled.${BLACK}"
  724. else
  725. echo -e "${GREEN}Note: The gperf(tcmalloc) is disabled.${BLACK}"
  726. fi
  727. if [[ $SRS_GPERF_MC == YES ]]; then
  728. echo -e "${YELLOW}The gmc(gperf memory check) is enabled, performance may suffer.${BLACK}"
  729. else
  730. echo -e "${GREEN}Note: The gmc(gperf memory check) is disabled.${BLACK}"
  731. fi
  732. if [[ $SRS_GPERF_MD == YES ]]; then
  733. echo -e "${YELLOW}The gmd(gperf memory defense) is enabled, performance may suffer.${BLACK}"
  734. else
  735. echo -e "${GREEN}Note: The gmd(gperf memory defense) is disabled.${BLACK}"
  736. fi
  737. if [[ $SRS_GPERF_MP == YES ]]; then
  738. echo -e "${YELLOW}The gmp(gperf memory profile) is enabled, performance may suffer.${BLACK}"
  739. else
  740. echo -e "${GREEN}Note: The gmp(gperf memory profile) is disabled.${BLACK}"
  741. fi
  742. if [[ $SRS_GPERF_CP == YES ]]; then
  743. echo -e "${YELLOW}The gcp(gperf cpu profile) is enabled, performance may suffer.${BLACK}"
  744. else
  745. echo -e "${GREEN}Note: The gcp(gperf cpu profile) is disabled.${BLACK}"
  746. fi
  747. if [[ $SRS_GPROF == YES ]]; then
  748. echo -e "${YELLOW}The gprof(GNU profile tool) is enabled, performance may suffer.${BLACK}"
  749. else
  750. echo -e "${GREEN}Note: The gprof(GNU profile tool) is disabled.${BLACK}"
  751. fi
  752. if [[ $SRS_CROSS_BUILD == YES ]]; then
  753. echo -e "${YELLOW}The cross-build is enabled.${BLACK}"
  754. else
  755. echo -e "${GREEN}Note: The cross-build is disabled.${BLACK}"
  756. fi
  757. if [[ $SRS_VALGRIND == YES ]]; then
  758. echo -e "${GREEN}The valgrind is enabled.${BLACK}"
  759. else
  760. echo -e "${GREEN}Note: The valgrind is disabled.${BLACK}"
  761. fi
  762. if [[ $SRS_SANITIZER == YES ]]; then
  763. echo -e "${GREEN}The sanitizer is enabled.${BLACK}"
  764. else
  765. echo -e "${GREEN}Note: The sanitizer is disabled.${BLACK}"
  766. fi
  767. # add each modules for application
  768. for SRS_MODULE in ${SRS_MODULES[*]}; do
  769. echo -e "${GREEN}Enable module: $SRS_MODULE${BLACK}"
  770. done
  771. #####################################################################################
  772. # Do cleanup when configure done.
  773. #####################################################################################
  774. if [[ $SRS_CLEAN == YES && -f Makefile ]]; then
  775. #echo "Do full cleanup, you can disable it by: --clean=off"
  776. make clean
  777. fi
  778. #####################################################################################
  779. # next step
  780. #####################################################################################
  781. echo ""
  782. echo "You can build SRS:"
  783. echo "\" make \" to build the SRS server"
  784. echo "\" make help \" to get some help"