From 302da32fc5a27d9e939981608f4bd0d5b32e5c87 Mon Sep 17 00:00:00 2001 From: winlin Date: Thu, 2 Apr 2020 11:41:36 +0800 Subject: [PATCH] When configure, default to make clean --- trunk/auto/options.sh | 13 +++++++++++++ trunk/auto/setup_variables.sh | 9 ++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/trunk/auto/options.sh b/trunk/auto/options.sh index c0300172b..ff1a3b44d 100755 --- a/trunk/auto/options.sh +++ b/trunk/auto/options.sh @@ -113,6 +113,8 @@ SRS_TOOL_RANDLIB=randlib SRS_EXTRA_FLAGS= # Set the object files tag name. SRS_BUILD_TAG= +# Whether do "make clean" when configure. +SRS_CLEAN=YES ##################################################################################### # menu @@ -188,6 +190,8 @@ Toolchain options: @see https://github.com/ossrs/srs/issues/1547#issuec --with-nasm Build FFMPEG for RTC with nasm support. --without-nasm Build FFMPEG for RTC without nasm support, for CentOS6 nasm is too old. --build-tag= Set the build object directory suffix. + --with-clean Configure SRS and do `make clean` if possible. + --without-clean Configure SRS and never `make clean` even possible.. Conflicts: 1. --with-gmc vs --with-gmp: @@ -236,6 +240,7 @@ function parse_user_option() { --with-rtc) SRS_RTC=YES ;; --with-gb28181) SRS_GB28181=YES ;; --with-nasm) SRS_NASM=YES ;; + --with-clean) SRS_CLEAN=YES ;; --with-gperf) SRS_GPERF=YES ;; --with-gmc) SRS_GPERF_MC=YES ;; --with-gmd) SRS_GPERF_MD=YES ;; @@ -255,6 +260,7 @@ function parse_user_option() { --without-rtc) SRS_RTC=NO ;; --without-gb28181) SRS_GB28181=NO ;; --without-nasm) SRS_NASM=NO ;; + --without-clean) SRS_CLEAN=NO ;; --without-gperf) SRS_GPERF=NO ;; --without-gmc) SRS_GPERF_MC=NO ;; --without-gmd) SRS_GPERF_MD=NO ;; @@ -557,6 +563,7 @@ function regenerate_options() { if [ $SRS_RTC = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-rtc"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-rtc"; fi if [ $SRS_GB28181 = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gb28181"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gb28181"; fi if [ $SRS_NASM = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-nasm"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-nasm"; fi + if [ $SRS_CLEAN = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-clean"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-clean"; fi if [ $SRS_GPERF = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gperf"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gperf"; fi if [ $SRS_GPERF_MC = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gmc"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gmc"; fi if [ $SRS_GPERF_MD = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gmd"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gmd"; fi @@ -602,6 +609,12 @@ function check_option_conflicts() { echo "Don't support building FFMPEG, please use docker https://github.com/ossrs/srs-docker"; exit -1; fi + # For OSX, recommend to use DTrace, https://blog.csdn.net/win_lin/article/details/53503869 + if [[ $SRS_OSX == YES && $SRS_GPROF == YES ]]; then + echo "Tool gprof for OSX is unavailable, please use dtrace, read https://blog.csdn.net/win_lin/article/details/53503869" + exit -1 + fi + # TODO: FIXME: check more os. __check_ok=YES diff --git a/trunk/auto/setup_variables.sh b/trunk/auto/setup_variables.sh index 7a39fd166..7414e6d07 100755 --- a/trunk/auto/setup_variables.sh +++ b/trunk/auto/setup_variables.sh @@ -10,6 +10,11 @@ if [[ ${SRS_BUILD_TAG} != "" ]]; then fi echo "SRS_WORKDIR: ${SRS_WORKDIR}, SRS_OBJS_DIR: ${SRS_OBJS_DIR}, SRS_OBJS: ${SRS_OBJS}, SRS_PLATFORM: ${SRS_PLATFORM}" +if [[ $SRS_CLEAN == YES && -f Makefile ]]; then + echo "Do full cleanup, you can disable it by: --without-clean" + make clean +fi + # For src object files on each platform. ( mkdir -p ${SRS_OBJS_DIR} && cd ${SRS_OBJS_DIR} && @@ -20,5 +25,7 @@ echo "SRS_WORKDIR: ${SRS_WORKDIR}, SRS_OBJS_DIR: ${SRS_OBJS_DIR}, SRS_OBJS: ${SR mkdir -p ${SRS_PLATFORM}/include && ln -sf ${SRS_PLATFORM}/include && mkdir -p ${SRS_PLATFORM}/lib && ln -sf ${SRS_PLATFORM}/lib ) -echo "Fast cleanup, if need to do full cleanup, please use: make clean" +if [[ $SRS_CLEAN == NO ]]; then + echo "Fast cleanup, if need to do full cleanup, please use: make clean" +fi