winlin

for #155, osx(darwin) support demo with nginx and ffmpeg. 2.0.143.

@@ -566,6 +566,7 @@ Supported operating systems and hardware: @@ -566,6 +566,7 @@ Supported operating systems and hardware:
566 566
567 ### SRS 2.0 history 567 ### SRS 2.0 history
568 568
  569 +* v2.0, 2015-03-17, for [#155](https://github.com/winlinvip/simple-rtmp-server/issues/155), osx(darwin) support demo with nginx and ffmpeg. 2.0.143.
569 * v2.0, 2015-03-15, start [2.0release branch](https://github.com/winlinvip/simple-rtmp-server/tree/2.0release), 80773 lines. 570 * v2.0, 2015-03-15, start [2.0release branch](https://github.com/winlinvip/simple-rtmp-server/tree/2.0release), 80773 lines.
570 * v2.0, 2015-03-14, fix [#324](https://github.com/winlinvip/simple-rtmp-server/issues/324), support hstrs(http stream trigger rtmp source) edge mode. 2.0.140. 571 * v2.0, 2015-03-14, fix [#324](https://github.com/winlinvip/simple-rtmp-server/issues/324), support hstrs(http stream trigger rtmp source) edge mode. 2.0.140.
571 * v2.0, 2015-03-14, for [#324](https://github.com/winlinvip/simple-rtmp-server/issues/324), support hstrs(http stream trigger rtmp source) origin mode. 2.0.139. 572 * v2.0, 2015-03-14, for [#324](https://github.com/winlinvip/simple-rtmp-server/issues/324), support hstrs(http stream trigger rtmp source) origin mode. 2.0.139.
  1 +*** configure Sat Nov 30 05:45:08 2013
  2 +--- ../x264-snapshot-20131129-2245-stable-patch/configure Tue Mar 17 21:42:24 2015
  3 +***************
  4 +*** 466,472 ****
  5 + ;;
  6 + darwin*)
  7 + SYS="MACOSX"
  8 +! CFLAGS="$CFLAGS -falign-loops=16"
  9 + libm="-lm"
  10 + if [ "$pic" = "no" ]; then
  11 + cc_check "" -mdynamic-no-pic && CFLAGS="$CFLAGS -mdynamic-no-pic"
  12 +--- 466,472 ----
  13 + ;;
  14 + darwin*)
  15 + SYS="MACOSX"
  16 +! CFLAGS="$CFLAGS"
  17 + libm="-lm"
  18 + if [ "$pic" = "no" ]; then
  19 + cc_check "" -mdynamic-no-pic && CFLAGS="$CFLAGS -mdynamic-no-pic"
@@ -79,6 +79,7 @@ else @@ -79,6 +79,7 @@ else
79 cd $ff_current_dir && 79 cd $ff_current_dir &&
80 rm -rf x264-snapshot-20131129-2245-stable && unzip -q ${ff_src_dir}/x264-snapshot-20131129-2245-stable.zip && 80 rm -rf x264-snapshot-20131129-2245-stable && unzip -q ${ff_src_dir}/x264-snapshot-20131129-2245-stable.zip &&
81 cd x264-snapshot-20131129-2245-stable && 81 cd x264-snapshot-20131129-2245-stable &&
  82 + chmod +w configure && patch -p0 <../../../3rdparty/patches/5.x264.osx.gcc.patch &&
82 ./configure --prefix=${ff_release_dir} --disable-opencl --bit-depth=8 \ 83 ./configure --prefix=${ff_release_dir} --disable-opencl --bit-depth=8 \
83 --enable-static --disable-avs --disable-swscale --disable-lavf \ 84 --enable-static --disable-avs --disable-swscale --disable-lavf \
84 --disable-ffms --disable-gpac && 85 --disable-ffms --disable-gpac &&
@@ -97,6 +97,15 @@ function Ubuntu_prepare() @@ -97,6 +97,15 @@ function Ubuntu_prepare()
97 sudo apt-get install -y --force-yes unzip; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi 97 sudo apt-get install -y --force-yes unzip; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
98 echo "install unzip success" 98 echo "install unzip success"
99 fi 99 fi
  100 +
  101 + if [ $SRS_NGINX = YES ]; then
  102 + if [[ ! -f /usr/include/pcre.h ]]; then
  103 + echo "install libpcre3-dev"
  104 + require_sudoer "sudo apt-get install -y --force-yes libpcre3-dev"
  105 + sudo apt-get install -y --force-yes libpcre3-dev; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
  106 + echo "install libpcre3-dev success"
  107 + fi
  108 + fi
100 109
101 if [ $SRS_FFMPEG_TOOL = YES ]; then 110 if [ $SRS_FFMPEG_TOOL = YES ]; then
102 autoconf --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then 111 autoconf --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
@@ -113,13 +122,6 @@ function Ubuntu_prepare() @@ -113,13 +122,6 @@ function Ubuntu_prepare()
113 echo "install libtool success" 122 echo "install libtool success"
114 fi 123 fi
115 124
116 - if [[ ! -f /usr/include/pcre.h ]]; then  
117 - echo "install libpcre3-dev"  
118 - require_sudoer "sudo apt-get install -y --force-yes libpcre3-dev"  
119 - sudo apt-get install -y --force-yes libpcre3-dev; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi  
120 - echo "install libpcre3-dev success"  
121 - fi  
122 -  
123 if [[ ! -f /usr/include/zlib.h ]]; then 125 if [[ ! -f /usr/include/zlib.h ]]; then
124 echo "install zlib1g-dev" 126 echo "install zlib1g-dev"
125 require_sudoer "sudo apt-get install -y --force-yes zlib1g-dev" 127 require_sudoer "sudo apt-get install -y --force-yes zlib1g-dev"
@@ -188,6 +190,15 @@ function Centos_prepare() @@ -188,6 +190,15 @@ function Centos_prepare()
188 sudo yum install -y unzip; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi 190 sudo yum install -y unzip; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
189 echo "install unzip success" 191 echo "install unzip success"
190 fi 192 fi
  193 +
  194 + if [ $SRS_NGINX = YES ]; then
  195 + if [[ ! -f /usr/include/pcre.h ]]; then
  196 + echo "install pcre-devel"
  197 + require_sudoer "sudo yum install -y pcre-devel"
  198 + sudo yum install -y pcre-devel; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
  199 + echo "install pcre-devel success"
  200 + fi
  201 + fi
191 202
192 if [ $SRS_FFMPEG_TOOL = YES ]; then 203 if [ $SRS_FFMPEG_TOOL = YES ]; then
193 automake --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then 204 automake --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
@@ -211,13 +222,6 @@ function Centos_prepare() @@ -211,13 +222,6 @@ function Centos_prepare()
211 echo "install libtool success" 222 echo "install libtool success"
212 fi 223 fi
213 224
214 - if [[ ! -f /usr/include/pcre.h ]]; then  
215 - echo "install pcre-devel"  
216 - require_sudoer "sudo yum install -y pcre-devel"  
217 - sudo yum install -y pcre-devel; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi  
218 - echo "install pcre-devel success"  
219 - fi  
220 -  
221 if [[ ! -f /usr/include/zlib.h ]]; then 225 if [[ ! -f /usr/include/zlib.h ]]; then
222 echo "install zlib-devel" 226 echo "install zlib-devel"
223 require_sudoer "sudo yum install -y zlib-devel" 227 require_sudoer "sudo yum install -y zlib-devel"
@@ -271,14 +275,6 @@ function OSX_prepare() @@ -271,14 +275,6 @@ function OSX_prepare()
271 echo "OSX does not support stat, use --without-stat" 275 echo "OSX does not support stat, use --without-stat"
272 exit 1 276 exit 1
273 fi 277 fi
274 - if [ $SRS_FFMPEG_TOOL = YES ]; then  
275 - echo "OSX does not support ffmpeg, use --without-ffmpeg"  
276 - exit 1  
277 - fi  
278 - if [ $SRS_NGINX = YES ]; then  
279 - echo "OSX does not support nginx, use --without-nginx"  
280 - exit 1  
281 - fi  
282 fi 278 fi
283 279
284 brew --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then 280 brew --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
@@ -322,7 +318,16 @@ function OSX_prepare() @@ -322,7 +318,16 @@ function OSX_prepare()
322 brew install unzip; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi 318 brew install unzip; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
323 echo "install unzip success" 319 echo "install unzip success"
324 fi 320 fi
325 - 321 +
  322 + if [ $SRS_NGINX = YES ]; then
  323 + if [[ ! -f /usr/local/include/pcre.h ]]; then
  324 + echo "install pcre"
  325 + echo "brew install pcre"
  326 + brew install pcre; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
  327 + echo "install pcre success"
  328 + fi
  329 + fi
  330 +
326 if [ $SRS_FFMPEG_TOOL = YES ]; then 331 if [ $SRS_FFMPEG_TOOL = YES ]; then
327 automake --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then 332 automake --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
328 echo "install automake" 333 echo "install automake"
@@ -338,25 +343,18 @@ function OSX_prepare() @@ -338,25 +343,18 @@ function OSX_prepare()
338 echo "install autoconf success" 343 echo "install autoconf success"
339 fi 344 fi
340 345
341 - libtool --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then 346 + which libtool >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
342 echo "install libtool" 347 echo "install libtool"
343 echo "brew install libtool" 348 echo "brew install libtool"
344 brew install libtool; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi 349 brew install libtool; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
345 echo "install libtool success" 350 echo "install libtool success"
346 fi 351 fi
347 -  
348 - if [[ ! -f /usr/include/pcre.h ]]; then  
349 - echo "install pcre-devel"  
350 - echo "brew install pcre-devel"  
351 - brew install pcre-devel; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi  
352 - echo "install pcre-devel success"  
353 - fi  
354 -  
355 - if [[ ! -f /usr/include/zlib.h ]]; then  
356 - echo "install zlib-devel"  
357 - echo "brew install zlib-devel"  
358 - brew install zlib-devel; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi  
359 - echo "install zlib-devel success" 352 +
  353 + brew info zlib >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
  354 + echo "install zlib"
  355 + echo "brew install zlib"
  356 + brew install zlib; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
  357 + echo "install zlib success"
360 fi 358 fi
361 fi 359 fi
362 360
@@ -369,6 +367,19 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then @@ -369,6 +367,19 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
369 fi 367 fi
370 368
371 ##################################################################################### 369 #####################################################################################
  370 +# check the os.
  371 +#####################################################################################
  372 +# user must specifies something what a fuck, we suppport following os:
  373 +# centos/ubuntu/osx,
  374 +# embeded system, for example, mips or arm,
  375 +# export srs-librtmp
  376 +# others is invalid.
  377 +if [[ $OS_IS_UBUNTU = NO && $OS_IS_CENTOS = NO && $OS_IS_OSX = NO && $SRS_EMBEDED_CPU = NO && $SRS_EXPORT_LIBRTMP_PROJECT = NO ]]; then
  378 + echo "what a fuck, os not supported."
  379 + exit 1
  380 +fi
  381 +
  382 +#####################################################################################
372 # st-1.9 383 # st-1.9
373 ##################################################################################### 384 #####################################################################################
374 if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then 385 if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
@@ -435,8 +446,6 @@ if [ $SRS_HTTP_PARSER = YES ]; then @@ -435,8 +446,6 @@ if [ $SRS_HTTP_PARSER = YES ]; then
435 rm -rf ${SRS_OBJS}/http-parser-2.1 && cd ${SRS_OBJS} && unzip -q ../3rdparty/http-parser-2.1.zip && 446 rm -rf ${SRS_OBJS}/http-parser-2.1 && cd ${SRS_OBJS} && unzip -q ../3rdparty/http-parser-2.1.zip &&
436 cd http-parser-2.1 && 447 cd http-parser-2.1 &&
437 patch -p0 < ../../3rdparty/patches/2.http.parser.patch && 448 patch -p0 < ../../3rdparty/patches/2.http.parser.patch &&
438 - sed -i "s/CPPFLAGS_FAST +=.*$/CPPFLAGS_FAST = \$\(CPPFLAGS_DEBUG\)/g" Makefile &&  
439 - sed -i "s/CFLAGS_FAST =.*$/CFLAGS_FAST = \$\(CFLAGS_DEBUG\)/g" Makefile &&  
440 make CC=${SrsArmCC} AR=${SrsArmAR} package && 449 make CC=${SrsArmCC} AR=${SrsArmAR} package &&
441 cd .. && rm -rf hp && ln -sf http-parser-2.1 hp && 450 cd .. && rm -rf hp && ln -sf http-parser-2.1 hp &&
442 cd .. && touch ${SRS_OBJS}/_flag.st.hp.tmp 451 cd .. && touch ${SRS_OBJS}/_flag.st.hp.tmp
@@ -504,7 +513,11 @@ if [ $__SRS_BUILD_NGINX = YES ]; then @@ -504,7 +513,11 @@ if [ $__SRS_BUILD_NGINX = YES ]; then
504 # srs will write ts/m3u8 file use current user, 513 # srs will write ts/m3u8 file use current user,
505 # nginx default use nobody, so cannot read the ts/m3u8 created by srs. 514 # nginx default use nobody, so cannot read the ts/m3u8 created by srs.
506 cp ${SRS_OBJS}/nginx/conf/nginx.conf ${SRS_OBJS}/nginx/conf/nginx.conf.bk 515 cp ${SRS_OBJS}/nginx/conf/nginx.conf ${SRS_OBJS}/nginx/conf/nginx.conf.bk
507 - sed -i "s/^.user nobody;/user `whoami`;/g" ${SRS_OBJS}/nginx/conf/nginx.conf 516 + if [ $OS_IS_OSX = YES ]; then
  517 + sed -i '' "s/^.user nobody;/user `whoami`;/g" ${SRS_OBJS}/nginx/conf/nginx.conf
  518 + else
  519 + sed -i "s/^.user nobody;/user `whoami`;/g" ${SRS_OBJS}/nginx/conf/nginx.conf
  520 + fi
508 fi 521 fi
509 522
510 # the demo dir. 523 # the demo dir.
@@ -19,11 +19,11 @@ CONFIG="8085" @@ -19,11 +19,11 @@ CONFIG="8085"
19 ######################################################################## 19 ########################################################################
20 # utility functions 20 # utility functions
21 ######################################################################## 21 ########################################################################
22 -RED="\\e[31m"  
23 -GREEN="\\e[32m"  
24 -YELLOW="\\e[33m"  
25 -BLACK="\\e[0m"  
26 -POS="\\e[60G" 22 +RED="\\033[31m"
  23 +GREEN="\\033[32m"
  24 +YELLOW="\\033[33m"
  25 +BLACK="\\033[0m"
  26 +POS="\\033[60G"
27 27
28 ok_msg(){ 28 ok_msg(){
29 echo -e "${1}${POS}${BLACK}[${GREEN} OK ${BLACK}]" 29 echo -e "${1}${POS}${BLACK}[${GREEN} OK ${BLACK}]"
@@ -21,11 +21,11 @@ DEFAULT_LOG_FILE='./objs/srs.demo.log' @@ -21,11 +21,11 @@ DEFAULT_LOG_FILE='./objs/srs.demo.log'
21 ######################################################################## 21 ########################################################################
22 # utility functions 22 # utility functions
23 ######################################################################## 23 ########################################################################
24 -RED="\\e[31m"  
25 -GREEN="\\e[32m"  
26 -YELLOW="\\e[33m"  
27 -BLACK="\\e[0m"  
28 -POS="\\e[60G" 24 +RED="\\033[31m"
  25 +GREEN="\\033[32m"
  26 +YELLOW="\\033[33m"
  27 +BLACK="\\033[0m"
  28 +POS="\\033[60G"
29 29
30 ok_msg() { 30 ok_msg() {
31 echo -e "${1}${POS}${BLACK}[${GREEN} OK ${BLACK}]" 31 echo -e "${1}${POS}${BLACK}[${GREEN} OK ${BLACK}]"
@@ -21,11 +21,11 @@ DEFAULT_LOG_FILE='./objs/srs.demo.19350.log' @@ -21,11 +21,11 @@ DEFAULT_LOG_FILE='./objs/srs.demo.19350.log'
21 ######################################################################## 21 ########################################################################
22 # utility functions 22 # utility functions
23 ######################################################################## 23 ########################################################################
24 -RED="\\e[31m"  
25 -GREEN="\\e[32m"  
26 -YELLOW="\\e[33m"  
27 -BLACK="\\e[0m"  
28 -POS="\\e[60G" 24 +RED="\\033[31m"
  25 +GREEN="\\033[32m"
  26 +YELLOW="\\033[33m"
  27 +BLACK="\\033[0m"
  28 +POS="\\033[60G"
29 29
30 ok_msg() { 30 ok_msg() {
31 echo -e "${1}${POS}${BLACK}[${GREEN} OK ${BLACK}]" 31 echo -e "${1}${POS}${BLACK}[${GREEN} OK ${BLACK}]"
@@ -3,10 +3,10 @@ src_dir='src' @@ -3,10 +3,10 @@ src_dir='src'
3 if [[ ! -d $src_dir ]]; then echo "错误:必须在src同目录执行脚本"; exit 1; fi 3 if [[ ! -d $src_dir ]]; then echo "错误:必须在src同目录执行脚本"; exit 1; fi
4 4
5 # linux shell color support. 5 # linux shell color support.
6 -RED="\\e[31m"  
7 -GREEN="\\e[32m"  
8 -YELLOW="\\e[33m"  
9 -BLACK="\\e[0m" 6 +RED="\\033[31m"
  7 +GREEN="\\033[32m"
  8 +YELLOW="\\033[33m"
  9 +BLACK="\\033[0m"
10 10
11 ./etc/init.d/srs-demo restart; ret=$?; if [[ 0 -ne $ret ]]; then echo "错误:启动SRS失败"; exit $ret; fi 11 ./etc/init.d/srs-demo restart; ret=$?; if [[ 0 -ne $ret ]]; then echo "错误:启动SRS失败"; exit $ret; fi
12 echo "启动SRS服务器成功" 12 echo "启动SRS服务器成功"
@@ -32,7 +32,8 @@ cat<<END @@ -32,7 +32,8 @@ cat<<END
32 http://$ip:$port/players/srs_bwt.html?key=35c9b402c12a7246868752e2878f7e0e&vhost=bandcheck.srs.com 32 http://$ip:$port/players/srs_bwt.html?key=35c9b402c12a7246868752e2878f7e0e&vhost=bandcheck.srs.com
33 END 33 END
34 34
35 -if [[ `getenforce` != 'Disabled' ]]; then 35 +which getenforce >/dev/null 2>&1
  36 +if [[ 0 -eq $? && `getenforce` != 'Disabled' ]]; then
36 echo -e "${RED}请关闭selinux:${BLACK}"; 37 echo -e "${RED}请关闭selinux:${BLACK}";
37 echo -e "${RED} 打开配置文件:sudo vi /etc/sysconfig/selinux${BLACK}"; 38 echo -e "${RED} 打开配置文件:sudo vi /etc/sysconfig/selinux${BLACK}";
38 echo -e "${RED} 修改为:SELINUX=disabled${BLACK}"; 39 echo -e "${RED} 修改为:SELINUX=disabled${BLACK}";
@@ -32,6 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -32,6 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 #define VERSION_MAJOR 3 32 #define VERSION_MAJOR 3
33 #define VERSION_MINOR 0 33 #define VERSION_MINOR 0
34 #define VERSION_REVISION 0 34 #define VERSION_REVISION 0
  35 +#define VERSION_REVISION 143
35 36
36 // server info. 37 // server info.
37 #define RTMP_SIG_SRS_KEY "SRS" 38 #define RTMP_SIG_SRS_KEY "SRS"