From 7431c110feaccb04a84212a6b85d07c3a783f939 Mon Sep 17 00:00:00 2001 From: winlin Date: Mon, 24 Mar 2014 10:51:37 +0800 Subject: [PATCH] package support arm package --- trunk/auto/depends.sh | 4 ++-- trunk/scripts/package.sh | 33 ++++++++++++++++++++++++++++----- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/trunk/auto/depends.sh b/trunk/auto/depends.sh index d6d69f882..145576c97 100755 --- a/trunk/auto/depends.sh +++ b/trunk/auto/depends.sh @@ -109,7 +109,7 @@ function Ubuntu_prepare() echo "Ubuntu install tools success" return 0 } -Ubuntu_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "Ubuntu perfapre failed, ret=$ret"; exit $ret; fi +Ubuntu_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "Ubuntu prepare failed, ret=$ret"; exit $ret; fi ##################################################################################### # for Centos, auto install tools by yum ##################################################################################### @@ -193,7 +193,7 @@ function Centos_prepare() echo "Centos install tools success" return 0 } -Centos_prepare; ret=$?; if [[ 0 -ne $ret ]]; then "CentOS perfapre failed, ret=$ret"; exit $ret; fi +Centos_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "CentOS prepare failed, ret=$ret"; exit $ret; fi ##################################################################################### # st-1.9 diff --git a/trunk/scripts/package.sh b/trunk/scripts/package.sh index 9c1fd1619..ef817339c 100755 --- a/trunk/scripts/package.sh +++ b/trunk/scripts/package.sh @@ -1,11 +1,20 @@ #!/bin/bash +# Usage: +# bash package.sh [arm] +# option arm, whether build for arm, requires ubuntu12. + # user can config the following configs, then package. INSTALL=/usr/local/srs +# whether build for arm, only for ubuntu12. +ARM=NO ################################################################################## ################################################################################## ################################################################################## +# parse options. +if [[ $1 == "arm" ]]; then ARM=YES; fi + # discover the current work dir, the log and access. echo "argv[0]=$0" if [[ ! -f $0 ]]; then @@ -34,11 +43,19 @@ ok_msg "target os is ${os_name}-${os_major_version} ${os_release} ${os_machine}" # build srs # @see https://github.com/winlinvip/simple-rtmp-server/wiki/Build ok_msg "start build srs" -( - cd $work_dir && - ./configure --with-ssl --with-hls --with-nginx --with-ffmpeg --with-http-callback --prefix=$INSTALL && - make && rm -rf $package_dir && make DESTDIR=$package_dir install -) >> $log 2>&1 +if [ $ARM = YES ]; then + ( + cd $work_dir && + ./configure --with-ssl --with-arm-ubuntu12 --prefix=$INSTALL && + make && rm -rf $package_dir && make DESTDIR=$package_dir install + ) >> $log 2>&1 +else + ( + cd $work_dir && + ./configure --with-ssl --with-hls --with-nginx --with-ffmpeg --with-http-callback --prefix=$INSTALL && + make && rm -rf $package_dir && make DESTDIR=$package_dir install + ) >> $log 2>&1 +fi ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "build srs failed"; exit $ret; fi ok_msg "build srs success" @@ -54,6 +71,12 @@ ok_msg "start copy extra files to package" ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "copy extra files failed"; exit $ret; fi ok_msg "copy extra files success" +# detect for arm. +if [ $ARM = YES ]; then + arm_cpu=`arm-linux-gnueabi-readelf --arch-specific ${build_objs}/srs|grep Tag_CPU_arch:|awk '{print $2}'` + os_machine='arm${arm_cpu}cpu'; +fi + # generate zip dir and zip filename srs_version=`${build_objs}/srs -v 2>/dev/stdout 1>/dev/null` && zip_dir="SRS-${os_name}${os_major_version}-${os_machine}-${srs_version}"