Skip to content

Commit

Permalink
Build: add build-cache option to compile.
Browse files Browse the repository at this point in the history
  • Loading branch information
chundonglinlin committed Nov 1, 2023
1 parent a914e95 commit b26aa20
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion trunk/auto/depends.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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} &&
Expand Down
6 changes: 6 additions & 0 deletions trunk/auto/options.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b26aa20

Please sign in to comment.