1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00
This commit is contained in:
winlin 2014-05-04 18:38:08 +08:00
parent f8e8c81e50
commit 1e9561150a
5 changed files with 148 additions and 40 deletions

View file

@ -107,7 +107,7 @@ function Ubuntu_prepare()
# for arm, install the cross build tool chain.
if [ $SRS_ARM_UBUNTU12 = YES ]; then
arm-linux-gnueabi-gcc --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
`$SrsArmCC` --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi"
require_sudoer "sudo apt-get install -y --force-yes gcc-arm-linux-gnueabi g++-arm-linux-gnueabi"
sudo apt-get install -y --force-yes gcc-arm-linux-gnueabi g++-arm-linux-gnueabi; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
@ -115,6 +115,14 @@ function Ubuntu_prepare()
fi
fi
# for mips, user must installed the tool chain.
if [ $SRS_MIPS_UBUNTU12 = YES ]; then
`$SrsArmCC` --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "user must install the tool chain: $SrsArmCC"
return 2
fi
fi
echo "Ubuntu install tools success"
return 0
}
@ -203,8 +211,8 @@ function Centos_prepare()
fi
# for arm, install the cross build tool chain.
if [ $SRS_ARM_UBUNTU12 = YES ]; then
echo "arm-ubuntu12 is invalid for CentOS"
if [ $SRS_EMBEDED_CPU = YES ]; then
echo "embeded(arm/mips) is invalid for CentOS"
return 1
fi
@ -217,7 +225,7 @@ Centos_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "CentOS prepare failed, r
# st-1.9
#####################################################################################
# check the arm flag file, if flag changed, need to rebuild the st.
if [ $SRS_ARM_UBUNTU12 = YES ]; then
if [ $SRS_EMBEDED_CPU = YES ]; then
# ok, arm specified, if the flag filed does not exists, need to rebuild.
if [[ -f ${SRS_OBJS}/_flag.st.arm.tmp && -f ${SRS_OBJS}/st/libst.a && -f ${SRS_OBJS}/st/libst.so ]]; then
echo "st-1.9t for arm is ok.";
@ -263,7 +271,7 @@ if [ ! -f ${SRS_OBJS}/st/libst.so ]; then echo "build st-1.9 failed."; exit -1;
# check the arm flag file, if flag changed, need to rebuild the st.
if [ $SRS_HTTP_PARSER = YES ]; then
# ok, arm specified, if the flag filed does not exists, need to rebuild.
if [ $SRS_ARM_UBUNTU12 = YES ]; then
if [ $SRS_EMBEDED_CPU = YES ]; then
if [[ -f ${SRS_OBJS}/_flag.st.hp.tmp && -f ${SRS_OBJS}/hp/http_parser.h && -f ${SRS_OBJS}/hp/libhttp_parser.a ]]; then
echo "http-parser-2.1 for arm is ok.";
else
@ -336,7 +344,7 @@ END
# create the nginx dir, for http-server if not build nginx
rm -rf ${SRS_OBJS}/nginx && mkdir -p ${SRS_OBJS}/nginx
# make nginx
__SRS_BUILD_NGINX=NO; if [ $SRS_ARM_UBUNTU12 = NO ]; then if [ $SRS_NGINX = YES ]; then __SRS_BUILD_NGINX=YES; fi fi
__SRS_BUILD_NGINX=NO; if [ $SRS_EMBEDED_CPU = NO ]; then if [ $SRS_NGINX = YES ]; then __SRS_BUILD_NGINX=YES; fi fi
if [ $__SRS_BUILD_NGINX = YES ]; then
if [[ -f ${SRS_OBJS}/nginx/sbin/nginx ]]; then
echo "nginx-1.5.7 is ok.";
@ -473,7 +481,7 @@ if [ $SRS_SSL = YES ]; then
echo "warning: donot compile ssl, use system ssl"
else
# check the arm flag file, if flag changed, need to rebuild the st.
if [ $SRS_ARM_UBUNTU12 = YES ]; then
if [ $SRS_EMBEDED_CPU = YES ]; then
# ok, arm specified, if the flag filed does not exists, need to rebuild.
if [[ -f ${SRS_OBJS}/_flag.ssl.arm.tmp && -f ${SRS_OBJS}/openssl/lib/libssl.a ]]; then
echo "openssl-1.0.1f for arm is ok.";
@ -633,15 +641,30 @@ else
fi
#####################################################################################
# for arm.
# for embeded.
#####################################################################################
if [ $SRS_EMBEDED_CPU = YES ]; then
echo "#define SRS_AUTO_EMBEDED_CPU" >> $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_EMBEDED_CPU" >> $SRS_AUTO_HEADERS_H
fi
# arm
if [ $SRS_ARM_UBUNTU12 = YES ]; then
echo "#define SRS_AUTO_ARM_UBUNTU12" >> $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_ARM_UBUNTU12" >> $SRS_AUTO_HEADERS_H
fi
# mips
if [ $SRS_MIPS_UBUNTU12 = YES ]; then
echo "#define SRS_AUTO_MIPS_UBUNTU12" >> $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_MIPS_UBUNTU12" >> $SRS_AUTO_HEADERS_H
fi
echo "" >> $SRS_AUTO_HEADERS_H
# prefix
echo "#define SRS_AUTO_PREFIX \"${SRS_PREFIX}\"" >> $SRS_AUTO_HEADERS_H

View file

@ -56,6 +56,8 @@ SRS_USE_SYS_SSL=NO
SRS_X86_X64=NO
# armhf(v7cpu) built on ubuntu12
SRS_ARM_UBUNTU12=NO
# mips built on ubuntu12
SRS_MIPS_UBUNTU12=NO
# dev, open all features for dev, no gperf/prof/arm.
SRS_DEV=NO
# raspberry-pi, open hls/ssl/static
@ -68,6 +70,10 @@ SRS_PURE_RTMP=NO
SRS_RTMP_HLS=NO
# the most fast compile, nothing, only support vp6 RTMP.
SRS_DISABLE_ALL=NO
#
# calc
# whether embed cpu, arm/mips
SRS_EMBEDED_CPU=NO
#####################################################################################
# menu
@ -187,6 +193,7 @@ function parse_user_option() {
--with-gcp) SRS_GPERF_CP=YES ;;
--with-gprof) SRS_GPROF=YES ;;
--with-arm-ubuntu12) SRS_ARM_UBUNTU12=YES ;;
--with-mips-ubuntu12) SRS_MIPS_UBUNTU12=YES ;;
--without-ssl) SRS_SSL=NO ;;
--without-hls) SRS_HLS=NO ;;
@ -208,6 +215,7 @@ function parse_user_option() {
--without-gcp) SRS_GPERF_CP=NO ;;
--without-gprof) SRS_GPROF=NO ;;
--without-arm-ubuntu12) SRS_ARM_UBUNTU12=NO ;;
--without-mips-ubuntu12) SRS_MIPS_UBUNTU12=NO ;;
--jobs) SRS_JOBS=${value} ;;
--prefix) SRS_PREFIX=${value} ;;
@ -215,6 +223,7 @@ function parse_user_option() {
--x86-x64) SRS_X86_X64=YES ;;
--arm) SRS_ARM_UBUNTU12=YES ;;
--mips) SRS_MIPS_UBUNTU12=YES ;;
--pi) SRS_PI=YES ;;
--dev) SRS_DEV=YES ;;
--fast) SRS_FAST=YES ;;
@ -266,9 +275,11 @@ function apply_user_presets() {
if [ $SRS_DISABLE_ALL = NO ]; then
if [ $SRS_DEV = NO ]; then
if [ $SRS_ARM_UBUNTU12 = NO ]; then
if [ $SRS_PI = NO ]; then
if [ $SRS_X86_X64 = NO ]; then
SRS_X86_X64=YES; opt="--x86-x64 $opt";
if [ $SRS_MIPS_UBUNTU12 = NO ]; then
if [ $SRS_PI = NO ]; then
if [ $SRS_X86_X64 = NO ]; then
SRS_X86_X64=YES; opt="--x86-x64 $opt";
fi
fi
fi
fi
@ -277,6 +288,14 @@ function apply_user_presets() {
fi
fi
fi
# whether embeded cpu.
if [ $SRS_ARM_UBUNTU12 = YES ]; then
SRS_EMBEDED_CPU=YES
fi
if [ $SRS_MIPS_UBUNTU12 = YES ]; then
SRS_EMBEDED_CPU=YES
fi
# all disabled.
if [ $SRS_DISABLE_ALL = YES ]; then
@ -400,9 +419,35 @@ function apply_user_presets() {
SRS_GPERF_MP=NO
SRS_GPERF_CP=NO
SRS_GPROF=NO
# TODO: FIXME: need static? maybe donot.
SRS_STATIC=YES
fi
# if mips specified, set some default to disabled.
if [ $SRS_MIPS_UBUNTU12 = YES ]; then
SRS_HLS=YES
SRS_DVR=YES
SRS_NGINX=NO
SRS_SSL=YES
SRS_FFMPEG_TOOL=NO
SRS_TRANSCODE=YES
SRS_INGEST=YES
SRS_HTTP_PARSER=YES
SRS_HTTP_CALLBACK=YES
SRS_HTTP_SERVER=YES
SRS_HTTP_API=YES
SRS_LIBRTMP=YES
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_STATIC=NO
fi
# defaults for x86/x64
if [ $SRS_X86_X64 = YES ]; then
SRS_HLS=YES
@ -535,6 +580,7 @@ function regenerate_options() {
if [ $SRS_GPERF_CP = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gcp"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gcp"; fi
if [ $SRS_GPROF = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gprof"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gprof"; fi
if [ $SRS_ARM_UBUNTU12 = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-arm-ubuntu12"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-arm-ubuntu12"; fi
if [ $SRS_MIPS_UBUNTU12 = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-mips-ubuntu12"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-mips-ubuntu12"; fi
if [ $SRS_STATIC = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --static"; fi
echo "regenerate config: ${SRS_AUTO_CONFIGURE}"
}
@ -568,9 +614,9 @@ function check_option_conflicts() {
echo "gmc/gmp/gcp not compatible with gprof, see: ./configure --help"; __check_ok=NO;
fi fi
# check arm, if arm enabled, only allow st/ssl/librtmp,
# check embeded(arm/mips), if embeded enabled, only allow st/ssl/librtmp,
# user should disable all other features
if [ $SRS_ARM_UBUNTU12 = YES ]; then
if [ $SRS_EMBEDED_CPU = YES ]; then
if [ $SRS_FFMPEG_TOOL = YES ]; then echo "ffmpeg for arm is not available, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_BWTC = YES ]; then echo "bwtc for arm is not available, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_RESEARCH = YES ]; then echo "research for arm is not available, see: ./configure --help"; __check_ok=NO; fi
@ -582,11 +628,9 @@ function check_option_conflicts() {
fi
# if x86/x64 or directly build, never use static
if [ $SRS_ARM_UBUNTU12 = NO ]; then
if [ $SRS_PI = NO ]; then
if [ $SRS_STATIC = YES ]; then
echo "x86/x64 should never use static, see: ./configure --help"; __check_ok=NO;
fi
if [ $SRS_X86_X64 = YES ]; then
if [ $SRS_STATIC = YES ]; then
echo "x86/x64 should never use static, see: ./configure --help"; __check_ok=NO;
fi
fi
@ -609,6 +653,7 @@ function check_option_conflicts() {
if [ $SRS_GPERF_CP = RESERVED ]; then echo "you must specifies the gperf-cp, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_GPROF = RESERVED ]; then echo "you must specifies the gprof, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_ARM_UBUNTU12 = RESERVED ]; then echo "you must specifies the arm-ubuntu12, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_MIPS_UBUNTU12 = RESERVED ]; then echo "you must specifies the mips-ubuntu12, see: ./configure --help"; __check_ok=NO; fi
if [[ -z $SRS_PREFIX ]]; then echo "you must specifies the prefix, see: ./configure --prefix"; __check_ok=NO; fi
if [ $__check_ok = NO ]; then
exit 1;