winlin

support use other g++ when configure.

@@ -27,7 +27,7 @@ else @@ -27,7 +27,7 @@ else
27 fi 27 fi
28 # add yasm to path, for x264 to use yasm directly. 28 # add yasm to path, for x264 to use yasm directly.
29 # ffmpeg can specifies the yasm path when configure it. 29 # ffmpeg can specifies the yasm path when configure it.
30 -PATH=${PATH}:${ff_release_dir}/bin 30 +export PATH=${PATH}:${ff_release_dir}/bin
31 31
32 # libaacplus 32 # libaacplus
33 if [[ -f ${ff_release_dir}/lib/libaacplus.a ]]; then 33 if [[ -f ${ff_release_dir}/lib/libaacplus.a ]]; then
1 #!/bin/bash 1 #!/bin/bash
2 2
  3 +#####################################################################################
  4 +#####################################################################################
  5 +# prepare the depends tools and libraries
  6 +# DEPENDS: options.sh, only when user options parsed, the depends tools are known.
  7 +#####################################################################################
  8 +#####################################################################################
  9 +
  10 +#####################################################################################
  11 +# utilities
  12 +#####################################################################################
3 function require_sudoer() 13 function require_sudoer()
4 { 14 {
5 sudo echo "" >/dev/null 2>&1 15 sudo echo "" >/dev/null 2>&1
@@ -14,7 +24,7 @@ function require_sudoer() @@ -14,7 +24,7 @@ function require_sudoer()
14 echo "check gcc/g++/gdb/make/openssl-devel" 24 echo "check gcc/g++/gdb/make/openssl-devel"
15 echo "depends tools are ok" 25 echo "depends tools are ok"
16 ##################################################################################### 26 #####################################################################################
17 -# for Ubuntu 27 +# for Ubuntu, auto install tools by apt-get
18 ##################################################################################### 28 #####################################################################################
19 function Ubuntu_prepare() 29 function Ubuntu_prepare()
20 { 30 {
@@ -92,7 +102,7 @@ function Ubuntu_prepare() @@ -92,7 +102,7 @@ function Ubuntu_prepare()
92 } 102 }
93 Ubuntu_prepare 103 Ubuntu_prepare
94 ##################################################################################### 104 #####################################################################################
95 -# for Centos 105 +# for Centos, auto install tools by yum
96 ##################################################################################### 106 #####################################################################################
97 function Centos_prepare() 107 function Centos_prepare()
98 { 108 {
@@ -380,10 +390,12 @@ fi @@ -380,10 +390,12 @@ fi
380 ##################################################################################### 390 #####################################################################################
381 # build research code 391 # build research code
382 ##################################################################################### 392 #####################################################################################
383 -mkdir -p ${SRS_OBJS}/research 393 +if [ $SRS_RESEARCH = YES ]; then
  394 + mkdir -p ${SRS_OBJS}/research
384 395
385 -(cd research/hls && make && mv ts_info ../../${SRS_OBJS}/research)  
386 -ret=$?; if [[ $ret -ne 0 ]]; then echo "build research/hls failed, ret=$ret"; exit $ret; fi 396 + (cd research/hls && make && mv ts_info ../../${SRS_OBJS}/research)
  397 + ret=$?; if [[ $ret -ne 0 ]]; then echo "build research/hls failed, ret=$ret"; exit $ret; fi
387 398
388 -(cd research/ffempty && make && mv ffempty ../../${SRS_OBJS}/research)  
389 -ret=$?; if [[ $ret -ne 0 ]]; then echo "build research/ffempty failed, ret=$ret"; exit $ret; fi 399 + (cd research/ffempty && make && mv ffempty ../../${SRS_OBJS}/research)
  400 + ret=$?; if [[ $ret -ne 0 ]]; then echo "build research/ffempty failed, ret=$ret"; exit $ret; fi
  401 +fi
@@ -50,7 +50,7 @@ for item in ${MODULE_FILES[*]}; do @@ -50,7 +50,7 @@ for item in ${MODULE_FILES[*]}; do
50 MODULE_OBJS="${MODULE_OBJS[@]} ${CPP_FILE}" 50 MODULE_OBJS="${MODULE_OBJS[@]} ${CPP_FILE}"
51 if [ -f ${CPP_FILE} ]; then 51 if [ -f ${CPP_FILE} ]; then
52 echo "${OBJ_FILE}: \$(${DEPS_NAME}) ${CPP_FILE} " >> ${FILE} 52 echo "${OBJ_FILE}: \$(${DEPS_NAME}) ${CPP_FILE} " >> ${FILE}
53 - echo " \$(GCC) -c \$(CXXFLAGS) \$(${INCS_NAME})\\" >> ${FILE} 53 + echo " \$(CXX) -c \$(CXXFLAGS) \$(${INCS_NAME})\\" >> ${FILE}
54 echo " -o ${OBJ_FILE} ${CPP_FILE}" >> ${FILE} 54 echo " -o ${OBJ_FILE} ${CPP_FILE}" >> ${FILE}
55 fi 55 fi
56 done 56 done
1 #!/bin/bash 1 #!/bin/bash
2 2
  3 +#####################################################################################
  4 +#####################################################################################
  5 +# parse user options, do this at first
  6 +#####################################################################################
  7 +#####################################################################################
  8 +
  9 +#####################################################################################
  10 +# output variables
  11 +#####################################################################################
3 help=no 12 help=no
4 13
5 SRS_HLS=RESERVED 14 SRS_HLS=RESERVED
6 SRS_SSL=RESERVED 15 SRS_SSL=RESERVED
7 SRS_FFMPEG=RESERVED 16 SRS_FFMPEG=RESERVED
8 SRS_HTTP=RESERVED 17 SRS_HTTP=RESERVED
  18 +SRS_RESEARCH=RESERVED
9 19
10 # TODO: remove the default to yes. 20 # TODO: remove the default to yes.
11 SRS_HLS=YES 21 SRS_HLS=YES
12 SRS_SSL=YES 22 SRS_SSL=YES
13 SRS_FFMPEG=YES 23 SRS_FFMPEG=YES
14 SRS_HTTP=YES 24 SRS_HTTP=YES
  25 +SRS_RESEARCH=NO
15 26
  27 +#####################################################################################
  28 +# parse options
  29 +#####################################################################################
16 opt= 30 opt=
17 31
18 for option 32 for option
@@ -31,11 +45,13 @@ do @@ -31,11 +45,13 @@ do
31 --with-hls) SRS_HLS=YES ;; 45 --with-hls) SRS_HLS=YES ;;
32 --with-ffmpeg) SRS_FFMPEG=YES ;; 46 --with-ffmpeg) SRS_FFMPEG=YES ;;
33 --with-http) SRS_HTTP=YES ;; 47 --with-http) SRS_HTTP=YES ;;
  48 + --with-research) SRS_RESEARCH=YES ;;
34 49
35 --without-ssl) SRS_SSL=NO ;; 50 --without-ssl) SRS_SSL=NO ;;
36 --without-hls) SRS_HLS=NO ;; 51 --without-hls) SRS_HLS=NO ;;
37 --without-ffmpeg) SRS_FFMPEG=NO ;; 52 --without-ffmpeg) SRS_FFMPEG=NO ;;
38 --without-http) SRS_HTTP=NO ;; 53 --without-http) SRS_HTTP=NO ;;
  54 + --without-research) SRS_RESEARCH=NO ;;
39 55
40 *) 56 *)
41 echo "$0: error: invalid option \"$option\"" 57 echo "$0: error: invalid option \"$option\""
@@ -44,11 +60,14 @@ do @@ -44,11 +60,14 @@ do
44 esac 60 esac
45 done 61 done
46 62
47 -# save all config options to macro. 63 +# save all config options to macro to write to auto headers file
48 SRS_CONFIGURE="$opt" 64 SRS_CONFIGURE="$opt"
49 65
  66 +#####################################################################################
  67 +# show help and exit
  68 +#####################################################################################
50 if [ $help = yes ]; then 69 if [ $help = yes ]; then
51 -cat << END 70 + cat << END
52 71
53 --help print this message 72 --help print this message
54 73
@@ -58,17 +77,21 @@ cat << END @@ -58,17 +77,21 @@ cat << END
58 --with-http enable http hooks, build cherrypy as demo api server. 77 --with-http enable http hooks, build cherrypy as demo api server.
59 srs will call the http hooks, such as: on_connect. 78 srs will call the http hooks, such as: on_connect.
60 --with-ffmpeg enable transcoding with ffmpeg. 79 --with-ffmpeg enable transcoding with ffmpeg.
  80 + --with-research build the research tools.
61 81
62 --without-ssl disable rtmp complex handshake. 82 --without-ssl disable rtmp complex handshake.
63 --without-hls disable hls, rtmp streaming only. 83 --without-hls disable hls, rtmp streaming only.
64 --without-http disable http, http hooks callback. 84 --without-http disable http, http hooks callback.
65 --without-ffmpeg disable the ffmpeg transcoding feature. 85 --without-ffmpeg disable the ffmpeg transcoding feature.
  86 + --without-research do not build the research tools.
66 87
67 END 88 END
68 -  
69 - exit 1 89 + exit 0
70 fi 90 fi
71 91
  92 +#####################################################################################
  93 +# check user options
  94 +#####################################################################################
72 __check_ok=YES 95 __check_ok=YES
73 if [ $SRS_SSL = RESERVED ]; then 96 if [ $SRS_SSL = RESERVED ]; then
74 echo "you must specifies the ssl, see: ./configure --help"; 97 echo "you must specifies the ssl, see: ./configure --help";
@@ -86,6 +109,10 @@ if [ $SRS_HTTP = RESERVED ]; then @@ -86,6 +109,10 @@ if [ $SRS_HTTP = RESERVED ]; then
86 echo "you must specifies the http, see: ./configure --help"; 109 echo "you must specifies the http, see: ./configure --help";
87 __check_ok=NO 110 __check_ok=NO
88 fi 111 fi
  112 +if [ $SRS_RESEARCH = RESERVED ]; then
  113 + echo "you must specifies the research, see: ./configure --help";
  114 + __check_ok=NO
  115 +fi
89 if [ $__check_ok = NO ]; then 116 if [ $__check_ok = NO ]; then
90 exit 1; 117 exit 1;
91 -fi  
  118 +fi
@@ -52,7 +52,7 @@ help: @@ -52,7 +52,7 @@ help:
52 @echo " bandwidth build the bandwidth test client tool." 52 @echo " bandwidth build the bandwidth test client tool."
53 53
54 clean: 54 clean:
55 - (rm -f Makefile; cd ${SRS_OBJS}; rm -rf srs bandwidth Makefile *.hpp src st_*_load) 55 + (rm -f Makefile; cd ${SRS_OBJS}; rm -rf srs bandwidth Makefile *.hpp src st_*_load research)
56 56
57 server: _prepare_dir 57 server: _prepare_dir
58 @echo "build the srs(simple rtmp server) over st(state-threads)" 58 @echo "build the srs(simple rtmp server) over st(state-threads)"
@@ -81,10 +81,10 @@ CppStd="-ansi" @@ -81,10 +81,10 @@ CppStd="-ansi"
81 CXXFLAGS="${CppStd} ${WarnLevel} ${GDBDebug}" 81 CXXFLAGS="${CppStd} ${WarnLevel} ${GDBDebug}"
82 #CXXFLAGS="${CppStd} ${WarnLevel} ${GDBDebug} ${Performance}" 82 #CXXFLAGS="${CppStd} ${WarnLevel} ${GDBDebug} ${Performance}"
83 cat << END > ${SRS_OBJS}/${SRS_MAKEFILE} 83 cat << END > ${SRS_OBJS}/${SRS_MAKEFILE}
84 -CXXFLAGS = ${CXXFLAGS}  
85 -GCC = g++  
86 -LINK = \$(GCC)  
87 -AR = ar 84 +CXXFLAGS ?= ${CXXFLAGS}
  85 +CXX ?= g++
  86 +LINK ?= \$(CXX)
  87 +AR ?= ar
88 88
89 .PHONY: default srs bandwidth 89 .PHONY: default srs bandwidth
90 90
@@ -174,6 +174,11 @@ if [ $SRS_HTTP = YES ]; then @@ -174,6 +174,11 @@ if [ $SRS_HTTP = YES ]; then
174 else 174 else
175 echo -e "${YELLOW}warning: without http hooks callback over CherryPy support${BLACK}" 175 echo -e "${YELLOW}warning: without http hooks callback over CherryPy support${BLACK}"
176 fi 176 fi
  177 +if [ $SRS_RESEARCH = YES ]; then
  178 + echo -e "${GREEN}research tools are builded${BLACK}"
  179 +else
  180 + echo -e "${BLACK}note: research tools are not builded${BLACK}"
  181 +fi
177 182
178 # mkdir dirs 183 # mkdir dirs
179 mkdir -p ${SRS_OBJS}/logs 184 mkdir -p ${SRS_OBJS}/logs