正在显示
5 个修改的文件
包含
148 行增加
和
40 行删除
| @@ -107,7 +107,7 @@ function Ubuntu_prepare() | @@ -107,7 +107,7 @@ function Ubuntu_prepare() | ||
| 107 | 107 | ||
| 108 | # for arm, install the cross build tool chain. | 108 | # for arm, install the cross build tool chain. |
| 109 | if [ $SRS_ARM_UBUNTU12 = YES ]; then | 109 | if [ $SRS_ARM_UBUNTU12 = YES ]; then |
| 110 | - arm-linux-gnueabi-gcc --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then | 110 | + `$SrsArmCC` --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then |
| 111 | echo "install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi" | 111 | echo "install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi" |
| 112 | require_sudoer "sudo apt-get install -y --force-yes gcc-arm-linux-gnueabi g++-arm-linux-gnueabi" | 112 | require_sudoer "sudo apt-get install -y --force-yes gcc-arm-linux-gnueabi g++-arm-linux-gnueabi" |
| 113 | sudo apt-get install -y --force-yes gcc-arm-linux-gnueabi g++-arm-linux-gnueabi; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi | 113 | 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() | @@ -115,6 +115,14 @@ function Ubuntu_prepare() | ||
| 115 | fi | 115 | fi |
| 116 | fi | 116 | fi |
| 117 | 117 | ||
| 118 | + # for mips, user must installed the tool chain. | ||
| 119 | + if [ $SRS_MIPS_UBUNTU12 = YES ]; then | ||
| 120 | + `$SrsArmCC` --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then | ||
| 121 | + echo "user must install the tool chain: $SrsArmCC" | ||
| 122 | + return 2 | ||
| 123 | + fi | ||
| 124 | + fi | ||
| 125 | + | ||
| 118 | echo "Ubuntu install tools success" | 126 | echo "Ubuntu install tools success" |
| 119 | return 0 | 127 | return 0 |
| 120 | } | 128 | } |
| @@ -203,8 +211,8 @@ function Centos_prepare() | @@ -203,8 +211,8 @@ function Centos_prepare() | ||
| 203 | fi | 211 | fi |
| 204 | 212 | ||
| 205 | # for arm, install the cross build tool chain. | 213 | # for arm, install the cross build tool chain. |
| 206 | - if [ $SRS_ARM_UBUNTU12 = YES ]; then | ||
| 207 | - echo "arm-ubuntu12 is invalid for CentOS" | 214 | + if [ $SRS_EMBEDED_CPU = YES ]; then |
| 215 | + echo "embeded(arm/mips) is invalid for CentOS" | ||
| 208 | return 1 | 216 | return 1 |
| 209 | fi | 217 | fi |
| 210 | 218 | ||
| @@ -217,7 +225,7 @@ Centos_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "CentOS prepare failed, r | @@ -217,7 +225,7 @@ Centos_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "CentOS prepare failed, r | ||
| 217 | # st-1.9 | 225 | # st-1.9 |
| 218 | ##################################################################################### | 226 | ##################################################################################### |
| 219 | # check the arm flag file, if flag changed, need to rebuild the st. | 227 | # check the arm flag file, if flag changed, need to rebuild the st. |
| 220 | -if [ $SRS_ARM_UBUNTU12 = YES ]; then | 228 | +if [ $SRS_EMBEDED_CPU = YES ]; then |
| 221 | # ok, arm specified, if the flag filed does not exists, need to rebuild. | 229 | # ok, arm specified, if the flag filed does not exists, need to rebuild. |
| 222 | if [[ -f ${SRS_OBJS}/_flag.st.arm.tmp && -f ${SRS_OBJS}/st/libst.a && -f ${SRS_OBJS}/st/libst.so ]]; then | 230 | if [[ -f ${SRS_OBJS}/_flag.st.arm.tmp && -f ${SRS_OBJS}/st/libst.a && -f ${SRS_OBJS}/st/libst.so ]]; then |
| 223 | echo "st-1.9t for arm is ok."; | 231 | 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; | @@ -263,7 +271,7 @@ if [ ! -f ${SRS_OBJS}/st/libst.so ]; then echo "build st-1.9 failed."; exit -1; | ||
| 263 | # check the arm flag file, if flag changed, need to rebuild the st. | 271 | # check the arm flag file, if flag changed, need to rebuild the st. |
| 264 | if [ $SRS_HTTP_PARSER = YES ]; then | 272 | if [ $SRS_HTTP_PARSER = YES ]; then |
| 265 | # ok, arm specified, if the flag filed does not exists, need to rebuild. | 273 | # ok, arm specified, if the flag filed does not exists, need to rebuild. |
| 266 | - if [ $SRS_ARM_UBUNTU12 = YES ]; then | 274 | + if [ $SRS_EMBEDED_CPU = YES ]; then |
| 267 | if [[ -f ${SRS_OBJS}/_flag.st.hp.tmp && -f ${SRS_OBJS}/hp/http_parser.h && -f ${SRS_OBJS}/hp/libhttp_parser.a ]]; then | 275 | if [[ -f ${SRS_OBJS}/_flag.st.hp.tmp && -f ${SRS_OBJS}/hp/http_parser.h && -f ${SRS_OBJS}/hp/libhttp_parser.a ]]; then |
| 268 | echo "http-parser-2.1 for arm is ok."; | 276 | echo "http-parser-2.1 for arm is ok."; |
| 269 | else | 277 | else |
| @@ -336,7 +344,7 @@ END | @@ -336,7 +344,7 @@ END | ||
| 336 | # create the nginx dir, for http-server if not build nginx | 344 | # create the nginx dir, for http-server if not build nginx |
| 337 | rm -rf ${SRS_OBJS}/nginx && mkdir -p ${SRS_OBJS}/nginx | 345 | rm -rf ${SRS_OBJS}/nginx && mkdir -p ${SRS_OBJS}/nginx |
| 338 | # make nginx | 346 | # make nginx |
| 339 | -__SRS_BUILD_NGINX=NO; if [ $SRS_ARM_UBUNTU12 = NO ]; then if [ $SRS_NGINX = YES ]; then __SRS_BUILD_NGINX=YES; fi fi | 347 | +__SRS_BUILD_NGINX=NO; if [ $SRS_EMBEDED_CPU = NO ]; then if [ $SRS_NGINX = YES ]; then __SRS_BUILD_NGINX=YES; fi fi |
| 340 | if [ $__SRS_BUILD_NGINX = YES ]; then | 348 | if [ $__SRS_BUILD_NGINX = YES ]; then |
| 341 | if [[ -f ${SRS_OBJS}/nginx/sbin/nginx ]]; then | 349 | if [[ -f ${SRS_OBJS}/nginx/sbin/nginx ]]; then |
| 342 | echo "nginx-1.5.7 is ok."; | 350 | echo "nginx-1.5.7 is ok."; |
| @@ -473,7 +481,7 @@ if [ $SRS_SSL = YES ]; then | @@ -473,7 +481,7 @@ if [ $SRS_SSL = YES ]; then | ||
| 473 | echo "warning: donot compile ssl, use system ssl" | 481 | echo "warning: donot compile ssl, use system ssl" |
| 474 | else | 482 | else |
| 475 | # check the arm flag file, if flag changed, need to rebuild the st. | 483 | # check the arm flag file, if flag changed, need to rebuild the st. |
| 476 | - if [ $SRS_ARM_UBUNTU12 = YES ]; then | 484 | + if [ $SRS_EMBEDED_CPU = YES ]; then |
| 477 | # ok, arm specified, if the flag filed does not exists, need to rebuild. | 485 | # ok, arm specified, if the flag filed does not exists, need to rebuild. |
| 478 | if [[ -f ${SRS_OBJS}/_flag.ssl.arm.tmp && -f ${SRS_OBJS}/openssl/lib/libssl.a ]]; then | 486 | if [[ -f ${SRS_OBJS}/_flag.ssl.arm.tmp && -f ${SRS_OBJS}/openssl/lib/libssl.a ]]; then |
| 479 | echo "openssl-1.0.1f for arm is ok."; | 487 | echo "openssl-1.0.1f for arm is ok."; |
| @@ -633,15 +641,30 @@ else | @@ -633,15 +641,30 @@ else | ||
| 633 | fi | 641 | fi |
| 634 | 642 | ||
| 635 | ##################################################################################### | 643 | ##################################################################################### |
| 636 | -# for arm. | 644 | +# for embeded. |
| 637 | ##################################################################################### | 645 | ##################################################################################### |
| 646 | +if [ $SRS_EMBEDED_CPU = YES ]; then | ||
| 647 | + echo "#define SRS_AUTO_EMBEDED_CPU" >> $SRS_AUTO_HEADERS_H | ||
| 648 | +else | ||
| 649 | + echo "#undef SRS_AUTO_EMBEDED_CPU" >> $SRS_AUTO_HEADERS_H | ||
| 650 | +fi | ||
| 651 | + | ||
| 652 | +# arm | ||
| 638 | if [ $SRS_ARM_UBUNTU12 = YES ]; then | 653 | if [ $SRS_ARM_UBUNTU12 = YES ]; then |
| 639 | echo "#define SRS_AUTO_ARM_UBUNTU12" >> $SRS_AUTO_HEADERS_H | 654 | echo "#define SRS_AUTO_ARM_UBUNTU12" >> $SRS_AUTO_HEADERS_H |
| 640 | else | 655 | else |
| 641 | echo "#undef SRS_AUTO_ARM_UBUNTU12" >> $SRS_AUTO_HEADERS_H | 656 | echo "#undef SRS_AUTO_ARM_UBUNTU12" >> $SRS_AUTO_HEADERS_H |
| 642 | fi | 657 | fi |
| 643 | 658 | ||
| 659 | +# mips | ||
| 660 | +if [ $SRS_MIPS_UBUNTU12 = YES ]; then | ||
| 661 | + echo "#define SRS_AUTO_MIPS_UBUNTU12" >> $SRS_AUTO_HEADERS_H | ||
| 662 | +else | ||
| 663 | + echo "#undef SRS_AUTO_MIPS_UBUNTU12" >> $SRS_AUTO_HEADERS_H | ||
| 664 | +fi | ||
| 665 | + | ||
| 644 | echo "" >> $SRS_AUTO_HEADERS_H | 666 | echo "" >> $SRS_AUTO_HEADERS_H |
| 667 | + | ||
| 645 | # prefix | 668 | # prefix |
| 646 | echo "#define SRS_AUTO_PREFIX \"${SRS_PREFIX}\"" >> $SRS_AUTO_HEADERS_H | 669 | echo "#define SRS_AUTO_PREFIX \"${SRS_PREFIX}\"" >> $SRS_AUTO_HEADERS_H |
| 647 | 670 |
| @@ -56,6 +56,8 @@ SRS_USE_SYS_SSL=NO | @@ -56,6 +56,8 @@ SRS_USE_SYS_SSL=NO | ||
| 56 | SRS_X86_X64=NO | 56 | SRS_X86_X64=NO |
| 57 | # armhf(v7cpu) built on ubuntu12 | 57 | # armhf(v7cpu) built on ubuntu12 |
| 58 | SRS_ARM_UBUNTU12=NO | 58 | SRS_ARM_UBUNTU12=NO |
| 59 | +# mips built on ubuntu12 | ||
| 60 | +SRS_MIPS_UBUNTU12=NO | ||
| 59 | # dev, open all features for dev, no gperf/prof/arm. | 61 | # dev, open all features for dev, no gperf/prof/arm. |
| 60 | SRS_DEV=NO | 62 | SRS_DEV=NO |
| 61 | # raspberry-pi, open hls/ssl/static | 63 | # raspberry-pi, open hls/ssl/static |
| @@ -68,6 +70,10 @@ SRS_PURE_RTMP=NO | @@ -68,6 +70,10 @@ SRS_PURE_RTMP=NO | ||
| 68 | SRS_RTMP_HLS=NO | 70 | SRS_RTMP_HLS=NO |
| 69 | # the most fast compile, nothing, only support vp6 RTMP. | 71 | # the most fast compile, nothing, only support vp6 RTMP. |
| 70 | SRS_DISABLE_ALL=NO | 72 | SRS_DISABLE_ALL=NO |
| 73 | +# | ||
| 74 | +# calc | ||
| 75 | +# whether embed cpu, arm/mips | ||
| 76 | +SRS_EMBEDED_CPU=NO | ||
| 71 | 77 | ||
| 72 | ##################################################################################### | 78 | ##################################################################################### |
| 73 | # menu | 79 | # menu |
| @@ -187,6 +193,7 @@ function parse_user_option() { | @@ -187,6 +193,7 @@ function parse_user_option() { | ||
| 187 | --with-gcp) SRS_GPERF_CP=YES ;; | 193 | --with-gcp) SRS_GPERF_CP=YES ;; |
| 188 | --with-gprof) SRS_GPROF=YES ;; | 194 | --with-gprof) SRS_GPROF=YES ;; |
| 189 | --with-arm-ubuntu12) SRS_ARM_UBUNTU12=YES ;; | 195 | --with-arm-ubuntu12) SRS_ARM_UBUNTU12=YES ;; |
| 196 | + --with-mips-ubuntu12) SRS_MIPS_UBUNTU12=YES ;; | ||
| 190 | 197 | ||
| 191 | --without-ssl) SRS_SSL=NO ;; | 198 | --without-ssl) SRS_SSL=NO ;; |
| 192 | --without-hls) SRS_HLS=NO ;; | 199 | --without-hls) SRS_HLS=NO ;; |
| @@ -208,6 +215,7 @@ function parse_user_option() { | @@ -208,6 +215,7 @@ function parse_user_option() { | ||
| 208 | --without-gcp) SRS_GPERF_CP=NO ;; | 215 | --without-gcp) SRS_GPERF_CP=NO ;; |
| 209 | --without-gprof) SRS_GPROF=NO ;; | 216 | --without-gprof) SRS_GPROF=NO ;; |
| 210 | --without-arm-ubuntu12) SRS_ARM_UBUNTU12=NO ;; | 217 | --without-arm-ubuntu12) SRS_ARM_UBUNTU12=NO ;; |
| 218 | + --without-mips-ubuntu12) SRS_MIPS_UBUNTU12=NO ;; | ||
| 211 | 219 | ||
| 212 | --jobs) SRS_JOBS=${value} ;; | 220 | --jobs) SRS_JOBS=${value} ;; |
| 213 | --prefix) SRS_PREFIX=${value} ;; | 221 | --prefix) SRS_PREFIX=${value} ;; |
| @@ -215,6 +223,7 @@ function parse_user_option() { | @@ -215,6 +223,7 @@ function parse_user_option() { | ||
| 215 | 223 | ||
| 216 | --x86-x64) SRS_X86_X64=YES ;; | 224 | --x86-x64) SRS_X86_X64=YES ;; |
| 217 | --arm) SRS_ARM_UBUNTU12=YES ;; | 225 | --arm) SRS_ARM_UBUNTU12=YES ;; |
| 226 | + --mips) SRS_MIPS_UBUNTU12=YES ;; | ||
| 218 | --pi) SRS_PI=YES ;; | 227 | --pi) SRS_PI=YES ;; |
| 219 | --dev) SRS_DEV=YES ;; | 228 | --dev) SRS_DEV=YES ;; |
| 220 | --fast) SRS_FAST=YES ;; | 229 | --fast) SRS_FAST=YES ;; |
| @@ -266,9 +275,11 @@ function apply_user_presets() { | @@ -266,9 +275,11 @@ function apply_user_presets() { | ||
| 266 | if [ $SRS_DISABLE_ALL = NO ]; then | 275 | if [ $SRS_DISABLE_ALL = NO ]; then |
| 267 | if [ $SRS_DEV = NO ]; then | 276 | if [ $SRS_DEV = NO ]; then |
| 268 | if [ $SRS_ARM_UBUNTU12 = NO ]; then | 277 | if [ $SRS_ARM_UBUNTU12 = NO ]; then |
| 269 | - if [ $SRS_PI = NO ]; then | ||
| 270 | - if [ $SRS_X86_X64 = NO ]; then | ||
| 271 | - SRS_X86_X64=YES; opt="--x86-x64 $opt"; | 278 | + if [ $SRS_MIPS_UBUNTU12 = NO ]; then |
| 279 | + if [ $SRS_PI = NO ]; then | ||
| 280 | + if [ $SRS_X86_X64 = NO ]; then | ||
| 281 | + SRS_X86_X64=YES; opt="--x86-x64 $opt"; | ||
| 282 | + fi | ||
| 272 | fi | 283 | fi |
| 273 | fi | 284 | fi |
| 274 | fi | 285 | fi |
| @@ -277,6 +288,14 @@ function apply_user_presets() { | @@ -277,6 +288,14 @@ function apply_user_presets() { | ||
| 277 | fi | 288 | fi |
| 278 | fi | 289 | fi |
| 279 | fi | 290 | fi |
| 291 | + | ||
| 292 | + # whether embeded cpu. | ||
| 293 | + if [ $SRS_ARM_UBUNTU12 = YES ]; then | ||
| 294 | + SRS_EMBEDED_CPU=YES | ||
| 295 | + fi | ||
| 296 | + if [ $SRS_MIPS_UBUNTU12 = YES ]; then | ||
| 297 | + SRS_EMBEDED_CPU=YES | ||
| 298 | + fi | ||
| 280 | 299 | ||
| 281 | # all disabled. | 300 | # all disabled. |
| 282 | if [ $SRS_DISABLE_ALL = YES ]; then | 301 | if [ $SRS_DISABLE_ALL = YES ]; then |
| @@ -400,9 +419,35 @@ function apply_user_presets() { | @@ -400,9 +419,35 @@ function apply_user_presets() { | ||
| 400 | SRS_GPERF_MP=NO | 419 | SRS_GPERF_MP=NO |
| 401 | SRS_GPERF_CP=NO | 420 | SRS_GPERF_CP=NO |
| 402 | SRS_GPROF=NO | 421 | SRS_GPROF=NO |
| 422 | + # TODO: FIXME: need static? maybe donot. | ||
| 403 | SRS_STATIC=YES | 423 | SRS_STATIC=YES |
| 404 | fi | 424 | fi |
| 405 | 425 | ||
| 426 | + # if mips specified, set some default to disabled. | ||
| 427 | + if [ $SRS_MIPS_UBUNTU12 = YES ]; then | ||
| 428 | + SRS_HLS=YES | ||
| 429 | + SRS_DVR=YES | ||
| 430 | + SRS_NGINX=NO | ||
| 431 | + SRS_SSL=YES | ||
| 432 | + SRS_FFMPEG_TOOL=NO | ||
| 433 | + SRS_TRANSCODE=YES | ||
| 434 | + SRS_INGEST=YES | ||
| 435 | + SRS_HTTP_PARSER=YES | ||
| 436 | + SRS_HTTP_CALLBACK=YES | ||
| 437 | + SRS_HTTP_SERVER=YES | ||
| 438 | + SRS_HTTP_API=YES | ||
| 439 | + SRS_LIBRTMP=YES | ||
| 440 | + SRS_BWTC=NO | ||
| 441 | + SRS_RESEARCH=NO | ||
| 442 | + SRS_UTEST=NO | ||
| 443 | + SRS_GPERF=NO | ||
| 444 | + SRS_GPERF_MC=NO | ||
| 445 | + SRS_GPERF_MP=NO | ||
| 446 | + SRS_GPERF_CP=NO | ||
| 447 | + SRS_GPROF=NO | ||
| 448 | + SRS_STATIC=NO | ||
| 449 | + fi | ||
| 450 | + | ||
| 406 | # defaults for x86/x64 | 451 | # defaults for x86/x64 |
| 407 | if [ $SRS_X86_X64 = YES ]; then | 452 | if [ $SRS_X86_X64 = YES ]; then |
| 408 | SRS_HLS=YES | 453 | SRS_HLS=YES |
| @@ -535,6 +580,7 @@ function regenerate_options() { | @@ -535,6 +580,7 @@ function regenerate_options() { | ||
| 535 | if [ $SRS_GPERF_CP = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gcp"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gcp"; fi | 580 | if [ $SRS_GPERF_CP = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gcp"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gcp"; fi |
| 536 | if [ $SRS_GPROF = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gprof"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gprof"; fi | 581 | if [ $SRS_GPROF = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gprof"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gprof"; fi |
| 537 | 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 | 582 | 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 |
| 583 | + 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 | ||
| 538 | if [ $SRS_STATIC = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --static"; fi | 584 | if [ $SRS_STATIC = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --static"; fi |
| 539 | echo "regenerate config: ${SRS_AUTO_CONFIGURE}" | 585 | echo "regenerate config: ${SRS_AUTO_CONFIGURE}" |
| 540 | } | 586 | } |
| @@ -568,9 +614,9 @@ function check_option_conflicts() { | @@ -568,9 +614,9 @@ function check_option_conflicts() { | ||
| 568 | echo "gmc/gmp/gcp not compatible with gprof, see: ./configure --help"; __check_ok=NO; | 614 | echo "gmc/gmp/gcp not compatible with gprof, see: ./configure --help"; __check_ok=NO; |
| 569 | fi fi | 615 | fi fi |
| 570 | 616 | ||
| 571 | - # check arm, if arm enabled, only allow st/ssl/librtmp, | 617 | + # check embeded(arm/mips), if embeded enabled, only allow st/ssl/librtmp, |
| 572 | # user should disable all other features | 618 | # user should disable all other features |
| 573 | - if [ $SRS_ARM_UBUNTU12 = YES ]; then | 619 | + if [ $SRS_EMBEDED_CPU = YES ]; then |
| 574 | if [ $SRS_FFMPEG_TOOL = YES ]; then echo "ffmpeg for arm is not available, see: ./configure --help"; __check_ok=NO; fi | 620 | if [ $SRS_FFMPEG_TOOL = YES ]; then echo "ffmpeg for arm is not available, see: ./configure --help"; __check_ok=NO; fi |
| 575 | if [ $SRS_BWTC = YES ]; then echo "bwtc for arm is not available, see: ./configure --help"; __check_ok=NO; fi | 621 | if [ $SRS_BWTC = YES ]; then echo "bwtc for arm is not available, see: ./configure --help"; __check_ok=NO; fi |
| 576 | if [ $SRS_RESEARCH = YES ]; then echo "research for arm is not available, see: ./configure --help"; __check_ok=NO; fi | 622 | 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() { | @@ -582,11 +628,9 @@ function check_option_conflicts() { | ||
| 582 | fi | 628 | fi |
| 583 | 629 | ||
| 584 | # if x86/x64 or directly build, never use static | 630 | # if x86/x64 or directly build, never use static |
| 585 | - if [ $SRS_ARM_UBUNTU12 = NO ]; then | ||
| 586 | - if [ $SRS_PI = NO ]; then | ||
| 587 | - if [ $SRS_STATIC = YES ]; then | ||
| 588 | - echo "x86/x64 should never use static, see: ./configure --help"; __check_ok=NO; | ||
| 589 | - fi | 631 | + if [ $SRS_X86_X64 = YES ]; then |
| 632 | + if [ $SRS_STATIC = YES ]; then | ||
| 633 | + echo "x86/x64 should never use static, see: ./configure --help"; __check_ok=NO; | ||
| 590 | fi | 634 | fi |
| 591 | fi | 635 | fi |
| 592 | 636 | ||
| @@ -609,6 +653,7 @@ function check_option_conflicts() { | @@ -609,6 +653,7 @@ function check_option_conflicts() { | ||
| 609 | if [ $SRS_GPERF_CP = RESERVED ]; then echo "you must specifies the gperf-cp, see: ./configure --help"; __check_ok=NO; fi | 653 | if [ $SRS_GPERF_CP = RESERVED ]; then echo "you must specifies the gperf-cp, see: ./configure --help"; __check_ok=NO; fi |
| 610 | if [ $SRS_GPROF = RESERVED ]; then echo "you must specifies the gprof, see: ./configure --help"; __check_ok=NO; fi | 654 | if [ $SRS_GPROF = RESERVED ]; then echo "you must specifies the gprof, see: ./configure --help"; __check_ok=NO; fi |
| 611 | if [ $SRS_ARM_UBUNTU12 = RESERVED ]; then echo "you must specifies the arm-ubuntu12, see: ./configure --help"; __check_ok=NO; fi | 655 | if [ $SRS_ARM_UBUNTU12 = RESERVED ]; then echo "you must specifies the arm-ubuntu12, see: ./configure --help"; __check_ok=NO; fi |
| 656 | + if [ $SRS_MIPS_UBUNTU12 = RESERVED ]; then echo "you must specifies the mips-ubuntu12, see: ./configure --help"; __check_ok=NO; fi | ||
| 612 | if [[ -z $SRS_PREFIX ]]; then echo "you must specifies the prefix, see: ./configure --prefix"; __check_ok=NO; fi | 657 | if [[ -z $SRS_PREFIX ]]; then echo "you must specifies the prefix, see: ./configure --prefix"; __check_ok=NO; fi |
| 613 | if [ $__check_ok = NO ]; then | 658 | if [ $__check_ok = NO ]; then |
| 614 | exit 1; | 659 | exit 1; |
| @@ -47,15 +47,35 @@ echo "" >> $SRS_AUTO_HEADERS_H | @@ -47,15 +47,35 @@ echo "" >> $SRS_AUTO_HEADERS_H | ||
| 47 | ##################################################################################### | 47 | ##################################################################################### |
| 48 | # generate auto headers file, depends on the finished of options.sh | 48 | # generate auto headers file, depends on the finished of options.sh |
| 49 | ##################################################################################### | 49 | ##################################################################################### |
| 50 | +if [ $SRS_ARM_UBUNTU12 = YES ]; then | ||
| 51 | + __SrsArmCC="arm-linux-gnueabi-gcc"; | ||
| 52 | + __SrsArmGCC="arm-linux-gnueabi-gcc"; | ||
| 53 | + __SrsArmCXX="arm-linux-gnueabi-g++"; | ||
| 54 | + __SrsArmAR="arm-linux-gnueabi-ar"; | ||
| 55 | + __SrsArmLD="arm-linux-gnueabi-ld"; | ||
| 56 | + __SrsArmRANDLIB="arm-linux-gnueabi-ranlib"; | ||
| 57 | +fi | ||
| 58 | + __SrsArmCC="mipsel-openwrt-linux-gcc"; | ||
| 59 | + __SrsArmGCC="mipsel-openwrt-linux-gcc"; | ||
| 60 | + __SrsArmCXX="mipsel-openwrt-linux-g++"; | ||
| 61 | + __SrsArmAR="mipsel-openwrt-linux-ar"; | ||
| 62 | + __SrsArmLD="mipsel-openwrt-linux-ld"; | ||
| 63 | + __SrsArmRANDLIB="mipsel-openwrt-linux-ranlib"; | ||
| 64 | +fi | ||
| 50 | # the arm-ubuntu12 options for make for depends | 65 | # the arm-ubuntu12 options for make for depends |
| 51 | -if [[ -z $SrsArmCC ]]; then SrsArmCC="arm-linux-gnueabi-gcc"; fi | ||
| 52 | -if [[ -z $SrsArmGCC ]]; then SrsArmGCC="arm-linux-gnueabi-gcc"; fi | ||
| 53 | -if [[ -z $SrsArmCXX ]]; then SrsArmCXX="arm-linux-gnueabi-g++"; fi | ||
| 54 | -if [[ -z $SrsArmAR ]]; then SrsArmAR="arm-linux-gnueabi-ar"; fi | ||
| 55 | -if [[ -z $SrsArmLD ]]; then SrsArmLD="arm-linux-gnueabi-ld"; fi | ||
| 56 | -if [[ -z $SrsArmRANDLIB ]]; then SrsArmRANDLIB="arm-linux-gnueabi-ranlib"; fi | ||
| 57 | -echo "cc=$SrsArmCC gcc=$SrsArmGCC g++=$SrsArmCXX ar=$SrsArmAR ld=$SrsArmLD randlib=$SrsArmRANDLIB" | ||
| 58 | -echo "#define SRS_AUTO_ARM_TOOL_CHAIN \"cc=$SrsArmCC gcc=$SrsArmGCC g++=$SrsArmCXX ar=$SrsArmAR ld=$SrsArmLD randlib=$SrsArmRANDLIB\"" >> $SRS_AUTO_HEADERS_H | 66 | +if [[ -z $SrsArmCC ]]; then SrsArmCC=__SrsArmCC; fi |
| 67 | +if [[ -z $SrsArmGCC ]]; then SrsArmGCC=__SrsArmGCC; fi | ||
| 68 | +if [[ -z $SrsArmCXX ]]; then SrsArmCXX=__SrsArmCXX; fi | ||
| 69 | +if [[ -z $SrsArmAR ]]; then SrsArmAR=__SrsArmAR; fi | ||
| 70 | +if [[ -z $SrsArmLD ]]; then SrsArmLD=__SrsArmLD; fi | ||
| 71 | +if [[ -z $SrsArmRANDLIB ]]; then SrsArmRANDLIB=__SrsArmRANDLIB; fi | ||
| 72 | +# write to source file | ||
| 73 | +if [ $SRS_EMBEDED_CPU = YES ]; then | ||
| 74 | + echo "cc=$SrsArmCC gcc=$SrsArmGCC g++=$SrsArmCXX ar=$SrsArmAR ld=$SrsArmLD randlib=$SrsArmRANDLIB" | ||
| 75 | + echo "#define SRS_AUTO_EMBEDED_TOOL_CHAIN \"cc=$SrsArmCC gcc=$SrsArmGCC g++=$SrsArmCXX ar=$SrsArmAR ld=$SrsArmLD randlib=$SrsArmRANDLIB\"" >> $SRS_AUTO_HEADERS_H | ||
| 76 | +else | ||
| 77 | + echo "#define SRS_AUTO_EMBEDED_TOOL_CHAIN \"normal x86/x64 gcc\"" >> $SRS_AUTO_HEADERS_H | ||
| 78 | +fi | ||
| 59 | echo "" >> $SRS_AUTO_HEADERS_H | 79 | echo "" >> $SRS_AUTO_HEADERS_H |
| 60 | 80 | ||
| 61 | # apply user options. | 81 | # apply user options. |
| @@ -185,8 +205,8 @@ DESTDIR=\$(SRS_PREFIX) | @@ -185,8 +205,8 @@ DESTDIR=\$(SRS_PREFIX) | ||
| 185 | 205 | ||
| 186 | END | 206 | END |
| 187 | 207 | ||
| 188 | -# arm, ubuntu12, use arm tool chain. | ||
| 189 | -if [ $SRS_ARM_UBUNTU12 = YES ]; then | 208 | +# embeded, ubuntu12, use embeded tool chain. |
| 209 | +if [ $SRS_EMBEDED_CPU = YES ]; then | ||
| 190 | cat << END >> ${SRS_MAKEFILE} | 210 | cat << END >> ${SRS_MAKEFILE} |
| 191 | default: | 211 | default: |
| 192 | \$(MAKE) GCC=${SrsArmGCC} CXX=${SrsArmCXX} AR=${SrsArmAR} LINK=${SrsArmCXX} _default | 212 | \$(MAKE) GCC=${SrsArmGCC} CXX=${SrsArmCXX} AR=${SrsArmAR} LINK=${SrsArmCXX} _default |
| @@ -401,15 +421,13 @@ if [ $SRS_SSL = YES ]; then if [ $SRS_USE_SYS_SSL = NO ]; then LibSSLRoot="${SRS | @@ -401,15 +421,13 @@ if [ $SRS_SSL = YES ]; then if [ $SRS_USE_SYS_SSL = NO ]; then LibSSLRoot="${SRS | ||
| 401 | LibGperfRoot=""; LibGperfFile="" | 421 | LibGperfRoot=""; LibGperfFile="" |
| 402 | if [ $SRS_GPERF = YES ]; then LibGperfRoot="${SRS_OBJS}/gperf/include"; LibGperfFile="${SRS_OBJS}/gperf/lib/libtcmalloc_and_profiler.a"; fi | 422 | if [ $SRS_GPERF = YES ]; then LibGperfRoot="${SRS_OBJS}/gperf/include"; LibGperfFile="${SRS_OBJS}/gperf/lib/libtcmalloc_and_profiler.a"; fi |
| 403 | # the link options, always use static link | 423 | # the link options, always use static link |
| 404 | -SrsLinkOptions=""; | ||
| 405 | -if [ $SRS_SSL = YES ]; then if [ $SRS_USE_SYS_SSL = YES ]; then SrsLinkOptions="-lssl"; fi fi | ||
| 406 | -if [ $SRS_ARM_UBUNTU12 = YES ]; then | ||
| 407 | - # for arm cross build tool chain, always use static and ldl. | ||
| 408 | - SrsLinkOptions="${SrsLinkOptions} -static -ldl"; | ||
| 409 | -else | ||
| 410 | - # for x86/64/arm directly build, use static or ldl. | ||
| 411 | - if [ $SRS_STATIC = YES ]; then SrsLinkOptions="${SrsLinkOptions} -static"; else SrsLinkOptions="${SrsLinkOptions} -ldl"; fi | ||
| 412 | -fi | 424 | +SrsLinkOptions="-ldl"; |
| 425 | +if [ $SRS_SSL = YES ]; then if [ $SRS_USE_SYS_SSL = YES ]; then SrsLinkOptions="${SrsLinkOptions} -lssl"; fi fi | ||
| 426 | +# if static specified, add static | ||
| 427 | +# TODO: FIXME: remove static. | ||
| 428 | +if [ $SRS_STATIC = YES ]; then SrsLinkOptions="${SrsLinkOptions} -static"; fi | ||
| 429 | +# if mips, add -lgcc_eh, or stl compile failed. | ||
| 430 | +if [ $SRS_MIPS_UBUNTU12 = NO ]; then SrsLinkOptions="${SrsLinkOptions} -lgcc_eh"; fi | ||
| 413 | 431 | ||
| 414 | ##################################################################################### | 432 | ##################################################################################### |
| 415 | # Modules, compile each module, then link to binary | 433 | # Modules, compile each module, then link to binary |
| @@ -618,6 +636,11 @@ if [ $SRS_ARM_UBUNTU12 = YES ]; then | @@ -618,6 +636,11 @@ if [ $SRS_ARM_UBUNTU12 = YES ]; then | ||
| 618 | else | 636 | else |
| 619 | echo -e "${GREEN}note: arm-ubuntu12(armhf, v7cpu) for srs are not builded${BLACK}" | 637 | echo -e "${GREEN}note: arm-ubuntu12(armhf, v7cpu) for srs are not builded${BLACK}" |
| 620 | fi | 638 | fi |
| 639 | +if [ $SRS_MIPS_UBUNTU12 = YES ]; then | ||
| 640 | + echo -e "${GREEN}mips-ubuntu12 for srs are builded${BLACK}" | ||
| 641 | +else | ||
| 642 | + echo -e "${GREEN}note: mips-ubuntu12 for srs are not builded${BLACK}" | ||
| 643 | +fi | ||
| 621 | 644 | ||
| 622 | ##################################################################################### | 645 | ##################################################################################### |
| 623 | # next step | 646 | # next step |
| @@ -13,6 +13,9 @@ help=NO | @@ -13,6 +13,9 @@ help=NO | ||
| 13 | X86_X64=NO | 13 | X86_X64=NO |
| 14 | ARM=NO | 14 | ARM=NO |
| 15 | PI=NO | 15 | PI=NO |
| 16 | +MIPS=NO | ||
| 17 | +# | ||
| 18 | +EMBEDED=NO | ||
| 16 | 19 | ||
| 17 | ################################################################################## | 20 | ################################################################################## |
| 18 | ################################################################################## | 21 | ################################################################################## |
| @@ -32,6 +35,7 @@ do | @@ -32,6 +35,7 @@ do | ||
| 32 | --help) help=yes ;; | 35 | --help) help=yes ;; |
| 33 | 36 | ||
| 34 | --x86-x64) X86_X64=YES ;; | 37 | --x86-x64) X86_X64=YES ;; |
| 38 | + --mips) MIPS=YES ;; | ||
| 35 | --arm) ARM=YES ;; | 39 | --arm) ARM=YES ;; |
| 36 | --pi) PI=YES ;; | 40 | --pi) PI=YES ;; |
| 37 | 41 | ||
| @@ -48,11 +52,16 @@ if [ $help = yes ]; then | @@ -48,11 +52,16 @@ if [ $help = yes ]; then | ||
| 48 | 52 | ||
| 49 | --x86-x64 for x86-x64 platform, configure/make/package. | 53 | --x86-x64 for x86-x64 platform, configure/make/package. |
| 50 | --arm for arm cross-build platform, configure/make/package. | 54 | --arm for arm cross-build platform, configure/make/package. |
| 55 | + --mips for mips cross-build platform, configure/make/package. | ||
| 51 | --pi for pi platform, configure/make/package. | 56 | --pi for pi platform, configure/make/package. |
| 52 | END | 57 | END |
| 53 | exit 0 | 58 | exit 0 |
| 54 | fi | 59 | fi |
| 55 | 60 | ||
| 61 | +# embeded(arm/mips) | ||
| 62 | +if [ $ARM = YES ]; then EMBEDED=YES; fi | ||
| 63 | +if [ $MIPS = YES ]; then EMBEDED=YES; fi | ||
| 64 | + | ||
| 56 | # discover the current work dir, the log and access. | 65 | # discover the current work dir, the log and access. |
| 57 | echo "argv[0]=$0" | 66 | echo "argv[0]=$0" |
| 58 | if [[ ! -f $0 ]]; then | 67 | if [[ ! -f $0 ]]; then |
| @@ -93,6 +102,11 @@ if [ $ARM = YES ]; then | @@ -93,6 +102,11 @@ if [ $ARM = YES ]; then | ||
| 93 | cd $work_dir && | 102 | cd $work_dir && |
| 94 | ./configure --arm --prefix=$INSTALL && make | 103 | ./configure --arm --prefix=$INSTALL && make |
| 95 | ) >> $log 2>&1 | 104 | ) >> $log 2>&1 |
| 105 | +elif [ $MIPS = YES ]; then | ||
| 106 | + ( | ||
| 107 | + cd $work_dir && | ||
| 108 | + ./configure --mips --prefix=$INSTALL && make | ||
| 109 | + ) >> $log 2>&1 | ||
| 96 | elif [ $PI = YES ]; then | 110 | elif [ $PI = YES ]; then |
| 97 | ( | 111 | ( |
| 98 | cd $work_dir && | 112 | cd $work_dir && |
| @@ -104,7 +118,7 @@ elif [ $X86_X64 = YES ]; then | @@ -104,7 +118,7 @@ elif [ $X86_X64 = YES ]; then | ||
| 104 | ./configure --x86-x64 --prefix=$INSTALL && make | 118 | ./configure --x86-x64 --prefix=$INSTALL && make |
| 105 | ) >> $log 2>&1 | 119 | ) >> $log 2>&1 |
| 106 | else | 120 | else |
| 107 | - failed_msg "invalid option, must be --x86-x64/--arm/--pi, see --help"; exit 1; | 121 | + failed_msg "invalid option, must be --x86-x64/--arm/--mips/--pi, see --help"; exit 1; |
| 108 | fi | 122 | fi |
| 109 | ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "build srs failed"; exit $ret; fi | 123 | ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "build srs failed"; exit $ret; fi |
| 110 | ok_msg "build srs success" | 124 | ok_msg "build srs success" |
| @@ -134,10 +148,13 @@ if [ $ARM = YES ]; then | @@ -134,10 +148,13 @@ if [ $ARM = YES ]; then | ||
| 134 | arm_cpu=`arm-linux-gnueabi-readelf --arch-specific ${build_objs}/srs|grep Tag_CPU_arch:|awk '{print $2}'` | 148 | arm_cpu=`arm-linux-gnueabi-readelf --arch-specific ${build_objs}/srs|grep Tag_CPU_arch:|awk '{print $2}'` |
| 135 | os_machine=arm${arm_cpu}cpu | 149 | os_machine=arm${arm_cpu}cpu |
| 136 | fi | 150 | fi |
| 151 | +if [ $MIPS = YES ]; then | ||
| 152 | + os_machine=mips | ||
| 153 | +fi | ||
| 137 | ok_msg "machine: $os_machine" | 154 | ok_msg "machine: $os_machine" |
| 138 | 155 | ||
| 139 | # generate zip dir and zip filename | 156 | # generate zip dir and zip filename |
| 140 | -if [ $ARM = YES ]; then | 157 | +if [ $EMBEDED = YES ]; then |
| 141 | srs_version_major=`cat $work_dir/src/core/srs_core.hpp| grep '#define VERSION_MAJOR'| awk '{print $3}'|xargs echo` && | 158 | srs_version_major=`cat $work_dir/src/core/srs_core.hpp| grep '#define VERSION_MAJOR'| awk '{print $3}'|xargs echo` && |
| 142 | srs_version_minor=`cat $work_dir/src/core/srs_core.hpp| grep '#define VERSION_MINOR'| awk '{print $3}'|xargs echo` && | 159 | srs_version_minor=`cat $work_dir/src/core/srs_core.hpp| grep '#define VERSION_MINOR'| awk '{print $3}'|xargs echo` && |
| 143 | srs_version_revision=`cat $work_dir/src/core/srs_core.hpp| grep '#define VERSION_REVISION'| awk '{print $3}'|xargs echo` && | 160 | srs_version_revision=`cat $work_dir/src/core/srs_core.hpp| grep '#define VERSION_REVISION'| awk '{print $3}'|xargs echo` && |
| @@ -96,7 +96,7 @@ int main(int argc, char** argv) | @@ -96,7 +96,7 @@ int main(int argc, char** argv) | ||
| 96 | srs_trace("configure: "SRS_AUTO_USER_CONFIGURE); | 96 | srs_trace("configure: "SRS_AUTO_USER_CONFIGURE); |
| 97 | srs_trace("features: "SRS_AUTO_CONFIGURE); | 97 | srs_trace("features: "SRS_AUTO_CONFIGURE); |
| 98 | #ifdef SRS_AUTO_ARM_UBUNTU12 | 98 | #ifdef SRS_AUTO_ARM_UBUNTU12 |
| 99 | - srs_trace("arm tool chain: "SRS_AUTO_ARM_TOOL_CHAIN); | 99 | + srs_trace("arm tool chain: "SRS_AUTO_EMBEDED_TOOL_CHAIN); |
| 100 | #endif | 100 | #endif |
| 101 | 101 | ||
| 102 | if ((ret = _srs_server->initialize()) != ERROR_SUCCESS) { | 102 | if ((ret = _srs_server->initialize()) != ERROR_SUCCESS) { |
-
请 注册 或 登录 后发表评论