winlin

refine package for raspberry.

@@ -35,6 +35,8 @@ SRS_STATIC=RESERVED @@ -35,6 +35,8 @@ SRS_STATIC=RESERVED
35 # private internal 35 # private internal
36 # dev, open all features for dev, no gperf/prof/arm. 36 # dev, open all features for dev, no gperf/prof/arm.
37 SRS_DEV=NO 37 SRS_DEV=NO
  38 +# raspberry-pi, open hls/ssl/static
  39 +SRS_PI=NO
38 40
39 ##################################################################################### 41 #####################################################################################
40 # parse options 42 # parse options
@@ -92,6 +94,7 @@ do @@ -92,6 +94,7 @@ do
92 --prefix) SRS_PREFIX=${value} ;; 94 --prefix) SRS_PREFIX=${value} ;;
93 --static) SRS_STATIC=YES ;; 95 --static) SRS_STATIC=YES ;;
94 --dev) SRS_DEV=YES ;; 96 --dev) SRS_DEV=YES ;;
  97 + --pi) SRS_PI=YES ;;
95 98
96 *) 99 *)
97 echo "$0: error: invalid option \"$option\"" 100 echo "$0: error: invalid option \"$option\""
@@ -121,6 +124,7 @@ if [ $SRS_ARM_UBUNTU12 = YES ]; then @@ -121,6 +124,7 @@ if [ $SRS_ARM_UBUNTU12 = YES ]; then
121 if [ $SRS_GPROF = RESERVED ]; then SRS_GPROF=NO; fi 124 if [ $SRS_GPROF = RESERVED ]; then SRS_GPROF=NO; fi
122 if [ $SRS_ARM_UBUNTU12 = RESERVED ]; then SRS_ARM_UBUNTU12=NO; fi 125 if [ $SRS_ARM_UBUNTU12 = RESERVED ]; then SRS_ARM_UBUNTU12=NO; fi
123 if [ $SRS_DEV = RESERVED ]; then SRS_DEV=NO; fi 126 if [ $SRS_DEV = RESERVED ]; then SRS_DEV=NO; fi
  127 + if [ $SRS_PI = RESERVED ]; then SRS_PI=NO; fi
124 # for arm, always set to static link. 128 # for arm, always set to static link.
125 SRS_STATIC=YES 129 SRS_STATIC=YES
126 else 130 else
@@ -141,6 +145,7 @@ else @@ -141,6 +145,7 @@ else
141 if [ $SRS_ARM_UBUNTU12 = RESERVED ]; then SRS_ARM_UBUNTU12=NO; fi 145 if [ $SRS_ARM_UBUNTU12 = RESERVED ]; then SRS_ARM_UBUNTU12=NO; fi
142 if [ $SRS_STATIC = RESERVED ]; then SRS_STATIC=NO; fi 146 if [ $SRS_STATIC = RESERVED ]; then SRS_STATIC=NO; fi
143 if [ $SRS_DEV = RESERVED ]; then SRS_DEV=NO; fi 147 if [ $SRS_DEV = RESERVED ]; then SRS_DEV=NO; fi
  148 + if [ $SRS_PI = RESERVED ]; then SRS_PI=NO; fi
144 fi 149 fi
145 150
146 # if dev specified, open features if possible. 151 # if dev specified, open features if possible.
@@ -164,6 +169,27 @@ if [ $SRS_DEV = YES ]; then @@ -164,6 +169,27 @@ if [ $SRS_DEV = YES ]; then
164 SRS_STATIC=NO 169 SRS_STATIC=NO
165 fi 170 fi
166 171
  172 +# if raspberry-pi specified, open ssl/hls/static features
  173 +if [ $SRS_PI = YES ]; then
  174 + SRS_HLS=YES
  175 + SRS_NGINX=NO
  176 + SRS_SSL=YES
  177 + SRS_FFMPEG=NO
  178 + SRS_HTTP_CALLBACK=NO
  179 + SRS_LIBRTMP=NO
  180 + SRS_BWTC=NO
  181 + SRS_RESEARCH=NO
  182 + SRS_UTEST=NO
  183 + SRS_GPERF=NO
  184 + SRS_GPERF_MC=NO
  185 + SRS_GPERF_MP=NO
  186 + SRS_GPERF_CP=NO
  187 + SRS_GPROF=NO
  188 + SRS_ARM_UBUNTU12=NO
  189 + # for arm, always set to static link.
  190 + SRS_STATIC=YES
  191 +fi
  192 +
167 # parse the jobs for make 193 # parse the jobs for make
168 if [[ "" -eq SRS_JOBS ]]; then 194 if [[ "" -eq SRS_JOBS ]]; then
169 export SRS_JOBS="--jobs" 195 export SRS_JOBS="--jobs"
@@ -219,6 +245,7 @@ if [ $help = yes ]; then @@ -219,6 +245,7 @@ if [ $help = yes ]; then
219 used for make in the configure, for example, to make ffmpeg. 245 used for make in the configure, for example, to make ffmpeg.
220 --prefix=<path> the absolute install path for srs. 246 --prefix=<path> the absolute install path for srs.
221 --dev for dev, open all features, no gperf/gprof/arm. 247 --dev for dev, open all features, no gperf/gprof/arm.
  248 + --pi for raspberry-pi, open features hls/ssl/static.
222 249
223 END 250 END
224 exit 0 251 exit 0
@@ -288,6 +315,8 @@ fi @@ -288,6 +315,8 @@ fi
288 315
289 # regenerate the options for default values. 316 # regenerate the options for default values.
290 SRS_CONFIGURE="" 317 SRS_CONFIGURE=""
  318 +if [ $SRS_DEV = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --dev"; fi
  319 +if [ $SRS_PI = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --pi"; fi
291 if [ $SRS_HLS = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-hls"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-hls"; fi 320 if [ $SRS_HLS = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-hls"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-hls"; fi
292 if [ $SRS_NGINX = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-nginx"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-nginx"; fi 321 if [ $SRS_NGINX = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-nginx"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-nginx"; fi
293 if [ $SRS_SSL = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-ssl"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-ssl"; fi 322 if [ $SRS_SSL = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-ssl"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-ssl"; fi
1 #!/bin/bash 1 #!/bin/bash
2 2
  3 +echo "在Ubuntu12下面交叉编译arm用的脚本"
  4 +
3 echo "argv[0]=$0" 5 echo "argv[0]=$0"
4 if [[ ! -f $0 ]]; then 6 if [[ ! -f $0 ]]; then
5 echo "directly execute the scripts on shell."; 7 echo "directly execute the scripts on shell.";
@@ -9,4 +11,4 @@ else @@ -9,4 +11,4 @@ else
9 work_dir=`dirname $0`; work_dir=`(cd ${work_dir} && pwd)` 11 work_dir=`dirname $0`; work_dir=`(cd ${work_dir} && pwd)`
10 fi 12 fi
11 13
12 -bash ${work_dir}/package.sh arm 14 +bash ${work_dir}/package.sh --arm
  1 +#!/bin/bash
  2 +
  3 +echo "在RaspberryPi下直接打包,不编译直接打包(编译慢,手工编译)"
  4 +
  5 +echo "argv[0]=$0"
  6 +if [[ ! -f $0 ]]; then
  7 + echo "directly execute the scripts on shell.";
  8 + work_dir=`pwd`
  9 +else
  10 + echo "execute scripts in file: $0";
  11 + work_dir=`dirname $0`; work_dir=`(cd ${work_dir} && pwd)`
  12 +fi
  13 +
  14 +bash ${work_dir}/package.sh --no-build
1 #!/bin/bash 1 #!/bin/bash
2 2
  3 +echo "通用打包脚本,--help查看参数"
  4 +
3 # Usage: 5 # Usage:
4 -# bash package.sh [arm] 6 +# bash package.sh [--help]
5 # option arm, whether build for arm, requires ubuntu12. 7 # option arm, whether build for arm, requires ubuntu12.
6 8
7 # user can config the following configs, then package. 9 # user can config the following configs, then package.
@@ -69,10 +71,17 @@ ret=$?; if [[ $ret -ne 0 ]]; then exit $ret; fi @@ -69,10 +71,17 @@ ret=$?; if [[ $ret -ne 0 ]]; then exit $ret; fi
69 os_name=`lsb_release --id|awk '{print $3}'` && 71 os_name=`lsb_release --id|awk '{print $3}'` &&
70 os_release=`lsb_release --release|awk '{print $2}'` && 72 os_release=`lsb_release --release|awk '{print $2}'` &&
71 os_major_version=`echo $os_release|awk -F '.' '{print $1}'` && 73 os_major_version=`echo $os_release|awk -F '.' '{print $1}'` &&
72 -os_machine=`uname -i`; if [[ "unknown" == $os_machine ]]; then os_machine=`uname -m`; fi 74 +os_machine=`uname -i`
73 ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "lsb_release get os info failed."; exit $ret; fi 75 ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "lsb_release get os info failed."; exit $ret; fi
74 ok_msg "target os is ${os_name}-${os_major_version} ${os_release} ${os_machine}" 76 ok_msg "target os is ${os_name}-${os_major_version} ${os_release} ${os_machine}"
75 77
  78 +# for raspberry-pi
  79 +# use rasberry-pi instead all release
  80 +uname -a|grep "raspberrypi"; if [[ 0 -eq $? ]]; then os_name="RaspberryPi"; fi
  81 +if [[ "Raspbian" == $os_name ]]; then os_name="RaspberryPi"; fi
  82 +# check the cpu machine
  83 +if [[ "unknown" == $os_machine ]]; then os_machine=`uname -m`; fi
  84 +
76 # build srs 85 # build srs
77 # @see https://github.com/winlinvip/simple-rtmp-server/wiki/Build 86 # @see https://github.com/winlinvip/simple-rtmp-server/wiki/Build
78 if [ $DO_BUILD = YES ]; then 87 if [ $DO_BUILD = YES ]; then