From be8aa92ab0fb6e29fa0ef0d2618d2c79a6e7deab Mon Sep 17 00:00:00 2001 From: winlin Date: Sun, 30 Mar 2014 12:31:50 +0800 Subject: [PATCH] refine package for raspberry. --- trunk/auto/options.sh | 29 ++++++++++++++++++++++++++++ trunk/scripts/package-arm.sh | 4 +++- trunk/scripts/package-raspberrypi.sh | 14 ++++++++++++++ trunk/scripts/package.sh | 13 +++++++++++-- 4 files changed, 57 insertions(+), 3 deletions(-) create mode 100755 trunk/scripts/package-raspberrypi.sh diff --git a/trunk/auto/options.sh b/trunk/auto/options.sh index 638a0755e..d0d404a33 100755 --- a/trunk/auto/options.sh +++ b/trunk/auto/options.sh @@ -35,6 +35,8 @@ SRS_STATIC=RESERVED # private internal # dev, open all features for dev, no gperf/prof/arm. SRS_DEV=NO +# raspberry-pi, open hls/ssl/static +SRS_PI=NO ##################################################################################### # parse options @@ -92,6 +94,7 @@ do --prefix) SRS_PREFIX=${value} ;; --static) SRS_STATIC=YES ;; --dev) SRS_DEV=YES ;; + --pi) SRS_PI=YES ;; *) echo "$0: error: invalid option \"$option\"" @@ -121,6 +124,7 @@ if [ $SRS_ARM_UBUNTU12 = YES ]; then if [ $SRS_GPROF = RESERVED ]; then SRS_GPROF=NO; fi if [ $SRS_ARM_UBUNTU12 = RESERVED ]; then SRS_ARM_UBUNTU12=NO; fi if [ $SRS_DEV = RESERVED ]; then SRS_DEV=NO; fi + if [ $SRS_PI = RESERVED ]; then SRS_PI=NO; fi # for arm, always set to static link. SRS_STATIC=YES else @@ -141,6 +145,7 @@ else if [ $SRS_ARM_UBUNTU12 = RESERVED ]; then SRS_ARM_UBUNTU12=NO; fi if [ $SRS_STATIC = RESERVED ]; then SRS_STATIC=NO; fi if [ $SRS_DEV = RESERVED ]; then SRS_DEV=NO; fi + if [ $SRS_PI = RESERVED ]; then SRS_PI=NO; fi fi # if dev specified, open features if possible. @@ -164,6 +169,27 @@ if [ $SRS_DEV = YES ]; then SRS_STATIC=NO fi +# if raspberry-pi specified, open ssl/hls/static features +if [ $SRS_PI = YES ]; then + SRS_HLS=YES + SRS_NGINX=NO + SRS_SSL=YES + SRS_FFMPEG=NO + SRS_HTTP_CALLBACK=NO + SRS_LIBRTMP=NO + SRS_BWTC=NO + SRS_RESEARCH=NO + SRS_UTEST=NO + SRS_GPERF=NO + SRS_GPERF_MC=NO + SRS_GPERF_MP=NO + SRS_GPERF_CP=NO + SRS_GPROF=NO + SRS_ARM_UBUNTU12=NO + # for arm, always set to static link. + SRS_STATIC=YES +fi + # parse the jobs for make if [[ "" -eq SRS_JOBS ]]; then export SRS_JOBS="--jobs" @@ -219,6 +245,7 @@ if [ $help = yes ]; then used for make in the configure, for example, to make ffmpeg. --prefix= the absolute install path for srs. --dev for dev, open all features, no gperf/gprof/arm. + --pi for raspberry-pi, open features hls/ssl/static. END exit 0 @@ -288,6 +315,8 @@ fi # regenerate the options for default values. SRS_CONFIGURE="" +if [ $SRS_DEV = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --dev"; fi +if [ $SRS_PI = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --pi"; fi if [ $SRS_HLS = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-hls"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-hls"; fi if [ $SRS_NGINX = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-nginx"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-nginx"; fi if [ $SRS_SSL = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-ssl"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-ssl"; fi diff --git a/trunk/scripts/package-arm.sh b/trunk/scripts/package-arm.sh index 5eaa5a394..17d7d01d4 100755 --- a/trunk/scripts/package-arm.sh +++ b/trunk/scripts/package-arm.sh @@ -1,5 +1,7 @@ #!/bin/bash +echo "在Ubuntu12下面交叉编译arm用的脚本" + echo "argv[0]=$0" if [[ ! -f $0 ]]; then echo "directly execute the scripts on shell."; @@ -9,4 +11,4 @@ else work_dir=`dirname $0`; work_dir=`(cd ${work_dir} && pwd)` fi -bash ${work_dir}/package.sh arm +bash ${work_dir}/package.sh --arm diff --git a/trunk/scripts/package-raspberrypi.sh b/trunk/scripts/package-raspberrypi.sh new file mode 100755 index 000000000..d1c163beb --- /dev/null +++ b/trunk/scripts/package-raspberrypi.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +echo "在RaspberryPi下直接打包,不编译直接打包(编译慢,手工编译)" + +echo "argv[0]=$0" +if [[ ! -f $0 ]]; then + echo "directly execute the scripts on shell."; + work_dir=`pwd` +else + echo "execute scripts in file: $0"; + work_dir=`dirname $0`; work_dir=`(cd ${work_dir} && pwd)` +fi + +bash ${work_dir}/package.sh --no-build diff --git a/trunk/scripts/package.sh b/trunk/scripts/package.sh index 0cb8ee512..722cc7418 100755 --- a/trunk/scripts/package.sh +++ b/trunk/scripts/package.sh @@ -1,7 +1,9 @@ #!/bin/bash +echo "通用打包脚本,--help查看参数" + # Usage: -# bash package.sh [arm] +# bash package.sh [--help] # option arm, whether build for arm, requires ubuntu12. # user can config the following configs, then package. @@ -69,10 +71,17 @@ ret=$?; if [[ $ret -ne 0 ]]; then exit $ret; fi os_name=`lsb_release --id|awk '{print $3}'` && os_release=`lsb_release --release|awk '{print $2}'` && os_major_version=`echo $os_release|awk -F '.' '{print $1}'` && -os_machine=`uname -i`; if [[ "unknown" == $os_machine ]]; then os_machine=`uname -m`; fi +os_machine=`uname -i` ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "lsb_release get os info failed."; exit $ret; fi ok_msg "target os is ${os_name}-${os_major_version} ${os_release} ${os_machine}" +# for raspberry-pi +# use rasberry-pi instead all release +uname -a|grep "raspberrypi"; if [[ 0 -eq $? ]]; then os_name="RaspberryPi"; fi +if [[ "Raspbian" == $os_name ]]; then os_name="RaspberryPi"; fi +# check the cpu machine +if [[ "unknown" == $os_machine ]]; then os_machine=`uname -m`; fi + # build srs # @see https://github.com/winlinvip/simple-rtmp-server/wiki/Build if [ $DO_BUILD = YES ]; then