winlin

package support arm package

@@ -109,7 +109,7 @@ function Ubuntu_prepare() @@ -109,7 +109,7 @@ function Ubuntu_prepare()
109 echo "Ubuntu install tools success" 109 echo "Ubuntu install tools success"
110 return 0 110 return 0
111 } 111 }
112 -Ubuntu_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "Ubuntu perfapre failed, ret=$ret"; exit $ret; fi 112 +Ubuntu_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "Ubuntu prepare failed, ret=$ret"; exit $ret; fi
113 ##################################################################################### 113 #####################################################################################
114 # for Centos, auto install tools by yum 114 # for Centos, auto install tools by yum
115 ##################################################################################### 115 #####################################################################################
@@ -193,7 +193,7 @@ function Centos_prepare() @@ -193,7 +193,7 @@ function Centos_prepare()
193 echo "Centos install tools success" 193 echo "Centos install tools success"
194 return 0 194 return 0
195 } 195 }
196 -Centos_prepare; ret=$?; if [[ 0 -ne $ret ]]; then "CentOS perfapre failed, ret=$ret"; exit $ret; fi 196 +Centos_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "CentOS prepare failed, ret=$ret"; exit $ret; fi
197 197
198 ##################################################################################### 198 #####################################################################################
199 # st-1.9 199 # st-1.9
1 #!/bin/bash 1 #!/bin/bash
2 2
  3 +# Usage:
  4 +# bash package.sh [arm]
  5 +# option arm, whether build for arm, requires ubuntu12.
  6 +
3 # user can config the following configs, then package. 7 # user can config the following configs, then package.
4 INSTALL=/usr/local/srs 8 INSTALL=/usr/local/srs
  9 +# whether build for arm, only for ubuntu12.
  10 +ARM=NO
5 11
6 ################################################################################## 12 ##################################################################################
7 ################################################################################## 13 ##################################################################################
8 ################################################################################## 14 ##################################################################################
  15 +# parse options.
  16 +if [[ $1 == "arm" ]]; then ARM=YES; fi
  17 +
9 # discover the current work dir, the log and access. 18 # discover the current work dir, the log and access.
10 echo "argv[0]=$0" 19 echo "argv[0]=$0"
11 if [[ ! -f $0 ]]; then 20 if [[ ! -f $0 ]]; then
@@ -34,11 +43,19 @@ ok_msg "target os is ${os_name}-${os_major_version} ${os_release} ${os_machine}" @@ -34,11 +43,19 @@ ok_msg "target os is ${os_name}-${os_major_version} ${os_release} ${os_machine}"
34 # build srs 43 # build srs
35 # @see https://github.com/winlinvip/simple-rtmp-server/wiki/Build 44 # @see https://github.com/winlinvip/simple-rtmp-server/wiki/Build
36 ok_msg "start build srs" 45 ok_msg "start build srs"
37 -( 46 +if [ $ARM = YES ]; then
  47 + (
  48 + cd $work_dir &&
  49 + ./configure --with-ssl --with-arm-ubuntu12 --prefix=$INSTALL &&
  50 + make && rm -rf $package_dir && make DESTDIR=$package_dir install
  51 + ) >> $log 2>&1
  52 +else
  53 + (
38 cd $work_dir && 54 cd $work_dir &&
39 ./configure --with-ssl --with-hls --with-nginx --with-ffmpeg --with-http-callback --prefix=$INSTALL && 55 ./configure --with-ssl --with-hls --with-nginx --with-ffmpeg --with-http-callback --prefix=$INSTALL &&
40 make && rm -rf $package_dir && make DESTDIR=$package_dir install 56 make && rm -rf $package_dir && make DESTDIR=$package_dir install
41 -) >> $log 2>&1 57 + ) >> $log 2>&1
  58 +fi
42 ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "build srs failed"; exit $ret; fi 59 ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "build srs failed"; exit $ret; fi
43 ok_msg "build srs success" 60 ok_msg "build srs success"
44 61
@@ -54,6 +71,12 @@ ok_msg "start copy extra files to package" @@ -54,6 +71,12 @@ ok_msg "start copy extra files to package"
54 ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "copy extra files failed"; exit $ret; fi 71 ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "copy extra files failed"; exit $ret; fi
55 ok_msg "copy extra files success" 72 ok_msg "copy extra files success"
56 73
  74 +# detect for arm.
  75 +if [ $ARM = YES ]; then
  76 + arm_cpu=`arm-linux-gnueabi-readelf --arch-specific ${build_objs}/srs|grep Tag_CPU_arch:|awk '{print $2}'`
  77 + os_machine='arm${arm_cpu}cpu';
  78 +fi
  79 +
57 # generate zip dir and zip filename 80 # generate zip dir and zip filename
58 srs_version=`${build_objs}/srs -v 2>/dev/stdout 1>/dev/null` && 81 srs_version=`${build_objs}/srs -v 2>/dev/stdout 1>/dev/null` &&
59 zip_dir="SRS-${os_name}${os_major_version}-${os_machine}-${srs_version}" 82 zip_dir="SRS-${os_name}${os_major_version}-${os_machine}-${srs_version}"