diff --git a/trunk/auto/apps.sh b/trunk/auto/apps.sh old mode 100755 new mode 100644 diff --git a/trunk/auto/build_ffmpeg.sh b/trunk/auto/build_ffmpeg.sh index 8dd566b84..551ed683d 100755 --- a/trunk/auto/build_ffmpeg.sh +++ b/trunk/auto/build_ffmpeg.sh @@ -2,6 +2,11 @@ ff_src_dir="../../3rdparty" +# the jobs to make ffmpeg +if [[ "" -eq SRS_JOBS ]]; then + export SRS_JOBS="--jobs=1" +fi + ff_current_dir=$(pwd -P) ff_build_dir="${ff_current_dir}/_build" ff_release_dir="${ff_current_dir}/_release" @@ -9,6 +14,7 @@ echo "start to build the tools for transcode system:" echo "current_dir: ${ff_current_dir}" echo "build_dir: ${ff_build_dir}" echo "release_dir: ${ff_release_dir}" +echo "SRS_JOBS: ${SRS_JOBS}" mkdir -p ${ff_build_dir} mkdir -p ${ff_release_dir} @@ -22,7 +28,7 @@ else cd $ff_current_dir && rm -rf yasm-1.2.0 && unzip -q ${ff_src_dir}/yasm-1.2.0.zip && cd yasm-1.2.0 && ./configure --prefix=${ff_release_dir} && - make && make install + make ${SRS_JOBS} && make install ret=$?; if [[ 0 -ne ${ret} ]]; then echo "build yasm-1.2.0 failed"; exit 1; fi fi # add yasm to path, for x264 to use yasm directly. @@ -37,7 +43,7 @@ else cd $ff_current_dir && rm -rf libaacplus-2.0.2 && unzip -q ${ff_src_dir}/libaacplus-2.0.2.zip && cd libaacplus-2.0.2 && cp ../${ff_src_dir}/libaacplus-patch-26410-800.zip src/26410-800.zip && - bash autogen.sh && ./configure --prefix=${ff_release_dir} --enable-static && make && make install + bash autogen.sh && ./configure --prefix=${ff_release_dir} --enable-static && make ${SRS_JOBS} && make install ret=$?; if [[ 0 -ne ${ret} ]]; then echo "build libaacplus-2.0.2 failed"; exit 1; fi fi @@ -48,7 +54,7 @@ else echo "build lame-3.99.5" cd $ff_current_dir && rm -rf lame-3.99.5 && unzip -q ${ff_src_dir}/lame-3.99.5.zip && - cd lame-3.99.5 && ./configure --prefix=${ff_release_dir} --enable-static && make && make install + cd lame-3.99.5 && ./configure --prefix=${ff_release_dir} --enable-static && make ${SRS_JOBS} && make install ret=$?; if [[ 0 -ne ${ret} ]]; then echo "build lame-3.99.5 failed"; exit 1; fi fi @@ -61,7 +67,7 @@ else rm -rf x264-snapshot-20131129-2245-stable && unzip -q ${ff_src_dir}/x264-snapshot-20131129-2245-stable.zip && cd x264-snapshot-20131129-2245-stable && ./configure --prefix=${ff_release_dir} --disable-opencl --bit-depth=8 --enable-static && - make && make install + make ${SRS_JOBS} && make install ret=$?; if [[ 0 -ne ${ret} ]]; then echo "build x264 failed"; exit 1; fi fi @@ -90,6 +96,6 @@ else --enable-libx264 --enable-libmp3lame --enable-libaacplus \ --enable-pthreads --extra-libs=-lpthread \ --enable-encoders --enable-decoders --enable-avfilter --enable-muxers --enable-demuxers && - make && make install + make ${SRS_JOBS} && make install ret=$?; if [[ 0 -ne ${ret} ]]; then echo "build ffmpeg failed"; exit 1; fi fi diff --git a/trunk/auto/depends.sh b/trunk/auto/depends.sh old mode 100755 new mode 100644 index 4ad84c5d4..784310b27 --- a/trunk/auto/depends.sh +++ b/trunk/auto/depends.sh @@ -183,7 +183,7 @@ else rm -rf ${SRS_OBJS}/st-1.9 && cd ${SRS_OBJS} && unzip -q ../3rdparty/st-1.9.zip && cd st-1.9 && patch -p1 < ../../3rdparty/1.st.arm.Makefile.patch && - make linux-debug && + make linux-debug ${SRS_JOBS}&& cd .. && rm -f st && ln -sf st-1.9/obj st ) fi @@ -205,7 +205,7 @@ if [ $SRS_HTTP = YES ]; then cd http-parser-2.1 && sed -i "s/CPPFLAGS_FAST +=.*$/CPPFLAGS_FAST = \$\(CPPFLAGS_DEBUG\)/g" Makefile && sed -i "s/CFLAGS_FAST =.*$/CFLAGS_FAST = \$\(CFLAGS_DEBUG\)/g" Makefile && - make package && + make package ${SRS_JOBS} && cd .. && rm -f hp && ln -sf http-parser-2.1 hp ) fi @@ -236,7 +236,7 @@ if [ $SRS_HLS = YES ]; then ( rm -rf ${SRS_OBJS}/nginx-1.5.7 && cd ${SRS_OBJS} && unzip -q ../3rdparty/nginx-1.5.7.zip && cd nginx-1.5.7 && - ./configure --prefix=`pwd`/_release && make && make install && + ./configure --prefix=`pwd`/_release && make ${SRS_JOBS} && make install && cd .. && ln -sf nginx-1.5.7/_release nginx ) fi @@ -352,7 +352,7 @@ if [ $SRS_SSL = YES ]; then rm -rf ${SRS_OBJS}/openssl-1.0.1f && cd ${SRS_OBJS} && unzip -q ../3rdparty/openssl-1.0.1f.zip && cd openssl-1.0.1f && ./config --prefix=`pwd`/_release -no-shared && - make && make install && + make ${SRS_JOBS} && make install && cd .. && ln -sf openssl-1.0.1f/_release openssl ) fi @@ -399,10 +399,10 @@ fi if [ $SRS_RESEARCH = YES ]; then mkdir -p ${SRS_OBJS}/research - (cd research/hls && make && mv ts_info ../../${SRS_OBJS}/research) + (cd research/hls && make ${SRS_JOBS} && mv ts_info ../../${SRS_OBJS}/research) ret=$?; if [[ $ret -ne 0 ]]; then echo "build research/hls failed, ret=$ret"; exit $ret; fi - (cd research/ffempty && make && mv ffempty ../../${SRS_OBJS}/research) + (cd research/ffempty && make ${SRS_JOBS} && mv ffempty ../../${SRS_OBJS}/research) ret=$?; if [[ $ret -ne 0 ]]; then echo "build research/ffempty failed, ret=$ret"; exit $ret; fi fi @@ -412,9 +412,9 @@ fi if [ $SRS_UTEST = YES ]; then mkdir -p ${SRS_OBJS}/utest - (cd research/hls && make && mv ts_info ../../${SRS_OBJS}/research) + (cd research/hls && make ${SRS_JOBS} && mv ts_info ../../${SRS_OBJS}/research) ret=$?; if [[ $ret -ne 0 ]]; then echo "build research/hls failed, ret=$ret"; exit $ret; fi - (cd research/ffempty && make && mv ffempty ../../${SRS_OBJS}/research) + (cd research/ffempty && make ${SRS_JOBS} && mv ffempty ../../${SRS_OBJS}/research) ret=$?; if [[ $ret -ne 0 ]]; then echo "build research/ffempty failed, ret=$ret"; exit $ret; fi fi diff --git a/trunk/auto/generate_header.sh b/trunk/auto/generate_header.sh old mode 100755 new mode 100644 diff --git a/trunk/auto/libs.sh b/trunk/auto/libs.sh old mode 100755 new mode 100644 diff --git a/trunk/auto/modules.sh b/trunk/auto/modules.sh old mode 100755 new mode 100644 diff --git a/trunk/auto/options.sh b/trunk/auto/options.sh old mode 100755 new mode 100644 index e66729742..129973eab --- a/trunk/auto/options.sh +++ b/trunk/auto/options.sh @@ -17,6 +17,8 @@ SRS_FFMPEG=RESERVED SRS_HTTP=RESERVED SRS_RESEARCH=RESERVED SRS_UTEST=RESERVED +# arguments +SRS_JOBS=1 # TODO: remove the default to yes. SRS_HLS=YES @@ -36,7 +38,10 @@ do opt="$opt `echo $option | sed -e \"s/\(--[^=]*=\)\(.* .*\)/\1'\2'/\"`" case "$option" in - -*=*) value=`echo "$option" | sed -e 's/[-_a-zA-Z0-9]*=//'` ;; + -*=*) + value=`echo "$option" | sed -e 's/[-_a-zA-Z0-9]*=//'` + option=`echo "$option" | sed -e 's/=[-_a-zA-Z0-9]*//'` + ;; *) value="" ;; esac @@ -56,6 +61,8 @@ do --without-http) SRS_HTTP=NO ;; --without-research) SRS_RESEARCH=NO ;; --without-utest) SRS_UTEST=NO ;; + + --jobs) SRS_JOBS=${value} ;; *) echo "$0: error: invalid option \"$option\"" @@ -64,6 +71,13 @@ do esac done +# parse the jobs for make +if [[ "" -eq SRS_JOBS ]]; then + export SRS_JOBS="--jobs" +else + export SRS_JOBS="--jobs=${SRS_JOBS}" +fi + # save all config options to macro to write to auto headers file SRS_CONFIGURE="$opt" @@ -90,6 +104,9 @@ if [ $help = yes ]; then --without-ffmpeg disable the ffmpeg transcoding feature. --without-research do not build the research tools. --without-utest do not build the utest for srs. + + --jobs[=N] Allow N jobs at once; infinite jobs with no arg. + used for make in the configure, for example, to make ffmpeg. END exit 0 diff --git a/trunk/configure b/trunk/configure index ac5a3deea..034de0b0b 100755 --- a/trunk/configure +++ b/trunk/configure @@ -49,7 +49,7 @@ echo "" >> $SRS_AUTO_HEADERS_H # srs-librtmp sample entry SrsLibrtmpSampleEntry="nossl"; if [ $SRS_SSL = YES ]; then SrsLibrtmpSampleEntry="ssl";fi # utest make entry, (cd utest; make) -SrsUtestMakeEntry="@echo -e \"ignore utest for it's disabled\""; if [ $SRS_UTEST = YES ]; then SrsUtestMakeEntry="(cd utest; make)"; fi +SrsUtestMakeEntry="@echo -e \"ignore utest for it's disabled\""; if [ $SRS_UTEST = YES ]; then SrsUtestMakeEntry="(cd utest; \$(MAKE))"; fi ##################################################################################### # colorful summary @@ -73,7 +73,7 @@ GREEN="\\${GREEN}" YELLOW="\\${YELLOW}" BLACK="\\${BLACK}" -default: server bandwidth librtmp librtmp-sample utest +default: bandwidth librtmp-sample utest @echo -e "\$(GREEN)build summary:\$(BLACK)" @echo -e " \$(GREEN)server: ./objs/srs, the srs server\$(BLACK)" @echo -e " ${SrsHlsSummaryColor}hls: delivery HLS stream, @see: https://github.com/winlinvip/simple-rtmp-server/wiki/DeliveryHLS\$(BLACK)" @@ -108,20 +108,20 @@ server: _prepare_dir @echo "build the srs(simple rtmp server) over st(state-threads)" \$(MAKE) -f ${SRS_OBJS}/${SRS_MAKEFILE} srs -bandwidth: _prepare_dir +bandwidth: server @echo "build the bandwidth test client tool" \$(MAKE) -f ${SRS_OBJS}/${SRS_MAKEFILE} bandwidth -librtmp: _prepare_dir +librtmp: server @echo "build the client publish/play library." \$(MAKE) -f ${SRS_OBJS}/${SRS_MAKEFILE} librtmp -librtmp-sample: +librtmp-sample: librtmp @echo "build the srs-librtmp sample" - (cd research/librtmp; make ${SrsLibrtmpSampleEntry}) + (cd research/librtmp; \$(MAKE) ${SrsLibrtmpSampleEntry}) @echo "srs-librtmp sample build success" -utest: +utest: server @echo "build the utest for srs" ${SrsUtestMakeEntry} @echo "utest for srs build success" @@ -154,7 +154,7 @@ AR ?= ar CXXFLAGS = ${CXXFLAGS} LINK = g++ -.PHONY: default srs bandwidth +.PHONY: default srs bandwidth librtmp default: