diff --git a/trunk/auto/depends.sh b/trunk/auto/depends.sh index 8c33d58395..e376fb016c 100755 --- a/trunk/auto/depends.sh +++ b/trunk/auto/depends.sh @@ -189,7 +189,7 @@ fi ##################################################################################### # Use srs-cache from base image. See https://github.com/ossrs/dev-docker/blob/ubuntu20-cache/Dockerfile # Note that the cache for cygwin is not under /usr/local, but copy to objs instead. -if [[ -d /usr/local/srs-cache/srs/trunk/objs && $(pwd) != "/usr/local/srs-cache/srs/trunk" ]]; then +if [[ -d /usr/local/srs-cache/srs/trunk/objs && $(pwd) != "/usr/local/srs-cache/srs/trunk" && $SRS_BUILD_CACHE == YES ]]; then SOURCE_DIR=$(ls -d /usr/local/srs-cache/srs/trunk/objs/Platform-SRS${SRS_MAJOR}-* 2>/dev/null|head -n 1) if [[ -d $SOURCE_DIR ]]; then TARGET_DIR=${SRS_OBJS}/${SRS_PLATFORM} && diff --git a/trunk/auto/options.sh b/trunk/auto/options.sh index c90e97dce9..d3cf3c1fa9 100755 --- a/trunk/auto/options.sh +++ b/trunk/auto/options.sh @@ -108,6 +108,8 @@ SRS_CROSS_BUILD_ARCH= SRS_CROSS_BUILD_HOST= # For cross build, the cross prefix, for example(FFmpeg), --cross-prefix=aarch64-linux-gnu- SRS_CROSS_BUILD_PREFIX= +# For cache build +SRS_BUILD_CACHE=NO # ##################################################################################### # Toolchain for cross-build on Ubuntu for ARM or MIPS. @@ -448,6 +450,10 @@ function parse_user_option() { --ffmpeg) SRS_FFMPEG_TOOL=$(switch2value $value) ;; --ffmpeg-tool) SRS_FFMPEG_TOOL=$(switch2value $value) ;; + # use cache for build. + --build-cache) SRS_BUILD_CACHE=YES ;; + --without-build-cache) SRS_BUILD_CACHE=NO ;; + *) echo "$0: error: invalid option \"$option\"" exit 1