winlin

update package script

@@ -10,8 +10,9 @@ echo "通用打包脚本,--help查看参数" @@ -10,8 +10,9 @@ echo "通用打包脚本,--help查看参数"
10 INSTALL=/usr/local/srs 10 INSTALL=/usr/local/srs
11 # whether build for arm, only for ubuntu12. 11 # whether build for arm, only for ubuntu12.
12 help=NO 12 help=NO
  13 +X86_64=YES
13 ARM=NO 14 ARM=NO
14 -DO_BUILD=YES 15 +PI=NO
15 16
16 ################################################################################## 17 ##################################################################################
17 ################################################################################## 18 ##################################################################################
@@ -30,8 +31,9 @@ do @@ -30,8 +31,9 @@ do
30 case "$option" in 31 case "$option" in
31 --help) help=yes ;; 32 --help) help=yes ;;
32 33
  34 + --x86-64) X86_64=YES ;;
33 --arm) ARM=YES ;; 35 --arm) ARM=YES ;;
34 - --no-build) DO_BUILD=NO ;; 36 + --pi) PI=NO ;;
35 37
36 *) 38 *)
37 echo "$0: error: invalid option \"$option\"" 39 echo "$0: error: invalid option \"$option\""
@@ -44,8 +46,12 @@ if [ $help = yes ]; then @@ -44,8 +46,12 @@ if [ $help = yes ]; then
44 46
45 --help print this message 47 --help print this message
46 48
47 - --arm configure with arm and make srs. use arm tools to get info.  
48 - --no-build donot build srs, user has builded(./configure --pi && make). only make install. 49 + --x86-64 for x86-64 platform, configure/make/package.
  50 + --arm for arm cross-build platform, configure/make/package.
  51 + --pi for pi platform, configure/make/package.
  52 +
  53 +default:
  54 + --x86-64
49 END 55 END
50 exit 0 56 exit 0
51 fi 57 fi
@@ -84,24 +90,27 @@ if [[ "unknown" == $os_machine ]]; then os_machine=`uname -m`; fi @@ -84,24 +90,27 @@ if [[ "unknown" == $os_machine ]]; then os_machine=`uname -m`; fi
84 90
85 # build srs 91 # build srs
86 # @see https://github.com/winlinvip/simple-rtmp-server/wiki/Build 92 # @see https://github.com/winlinvip/simple-rtmp-server/wiki/Build
87 -if [ $DO_BUILD = YES ]; then  
88 - ok_msg "start build srs"  
89 - if [ $ARM = YES ]; then  
90 - (  
91 - cd $work_dir &&  
92 - ./configure --arm --prefix=$INSTALL && make  
93 - ) >> $log 2>&1  
94 - else  
95 - (  
96 - cd $work_dir &&  
97 - ./configure --x86-x64 --prefix=$INSTALL && make  
98 - ) >> $log 2>&1  
99 - fi  
100 - ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "build srs failed"; exit $ret; fi  
101 - ok_msg "build srs success" 93 +ok_msg "start build srs"
  94 +if [ $X86_64 = YES ]; then
  95 + (
  96 + cd $work_dir &&
  97 + ./configure --x86-x64 --prefix=$INSTALL && make
  98 + ) >> $log 2>&1
  99 +elif [ $ARM = YES ]; then
  100 + (
  101 + cd $work_dir &&
  102 + ./configure --arm --prefix=$INSTALL && make
  103 + ) >> $log 2>&1
  104 +elif [ $PI = YES ]; then
  105 + (
  106 + cd $work_dir &&
  107 + ./configure --pi --prefix=$INSTALL && make
  108 + ) >> $log 2>&1
102 else 109 else
103 - ok_msg "user skip build, directly install" 110 + failed_msg "invalid option, must be x86-x64/arm/pi, see --help"; exit 1;
104 fi 111 fi
  112 +ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "build srs failed"; exit $ret; fi
  113 +ok_msg "build srs success"
105 114
106 # install srs 115 # install srs
107 ok_msg "start install srs" 116 ok_msg "start install srs"