contrib: Ease the configuration of a custom cache directory.

It was previously possible by overriding the TARBALLS variable on each
make call, but that's inconvenient.  This changes allows specifying it
once, at bootstrap time.  If the TARBALLS environment is defined, it
is also honored (and takes precedence over the value provided at
bootstrap time).

* contrib/src/ffmpeg/rules.mak (ffmpeg): Because the $(TARBALLS)
variable is now made absolute (for clarity in the build output), do
not use a relative path.
* contrib/src/onnx/rules.mak (onnx): Likewise.
* contrib/src/vpx/rules.mak (libvpx): Likewise.
* contrib/src/x264/rules.mak: Likewise.

Change-Id: I07497b095938c7885159f44753ead2814ed2a2fe
This commit is contained in:
Maxim Cournoyer
2021-02-15 10:26:34 -05:00
committed by Adrien Béraud
parent ab6b1726eb
commit 6d3b0c0708
6 changed files with 18 additions and 7 deletions

View File

@ -26,6 +26,7 @@ usage()
echo " --prefix=PREFIX install files in PREFIX"
echo " --no-checksums don't verify checksums (allows to replace tarballs)"
echo " --disable-downloads don't download packages from the internet"
echo ' --cache-dir=DIR the directory where contrib tarballs are cached'
echo " --enable-debug build with debug symbol and extra checks (disabled by default)"
echo " --disable-FOO configure to not build package FOO"
echo " --enable-FOO configure to build package FOO"
@ -36,6 +37,7 @@ HOST=
PREFIX=
PKGS_ENABLE=
PKGS_DISABLE=
CONF_TARBALLS=
if test ! -f "../../contrib/src/main.mak"
then
@ -59,6 +61,9 @@ do
--disable-downloads)
DISABLE_CONTRIB_DOWNLOADS="TRUE"
;;
--cache-dir=*)
CONF_TARBALLS="${1#--cache-dir=}"
;;
--enable-debug)
ENABLE_DEBUG=1
;;
@ -122,6 +127,7 @@ PKGS_DISABLE := $PKGS_DISABLE
PKGS_ENABLE := $PKGS_ENABLE
DISABLE_CONTRIB_DOWNLOADS := $DISABLE_CONTRIB_DOWNLOADS
DISABLE_CONTRIB_CHECKSUMS := $DISABLE_CONTRIB_CHECKSUMS
CONF_TARBALLS := $CONF_TARBALLS
ENABLE_DEBUG := $ENABLE_DEBUG
EOF

View File

@ -342,7 +342,7 @@ $(TARBALLS)/ffmpeg-$(FFMPEG_HASH).tar.gz:
ffmpeg: ffmpeg-$(FFMPEG_HASH).tar.gz
rm -Rf $@ $@-$(FFMPEG_HASH)
mkdir -p $@-$(FFMPEG_HASH)
(cd $@-$(FFMPEG_HASH) && tar x $(if ${BATCH_MODE},,-v) --strip-components=1 -f ../$<)
(cd $@-$(FFMPEG_HASH) && tar x $(if ${BATCH_MODE},,-v) --strip-components=1 -f $<)
$(APPLY) $(SRC)/ffmpeg/remove-mjpeg-log.patch
$(APPLY) $(SRC)/ffmpeg/change-RTCP-ratio.patch
$(APPLY) $(SRC)/ffmpeg/rtp_ext_abs_send_time.patch

View File

@ -23,10 +23,15 @@ all: install
# bootstrap configuration
include config.mak
TOPSRC ?= ../../contrib
TOPDST ?= ..
TOPSRC ?= $(abspath ../../contrib)
TOPDST ?= $(abspath ..)
SRC := $(TOPSRC)/src
TARBALLS := $(TOPSRC)/tarballs
# Resolves TARBALLS using the following precedence rules:
# 1. Environment variable
# 2. Configured value at bootstrap time
# 3. Default value
TARBALLS := $(or $(TARBALLS),$(CONF_TARBALLS),$(TOPSRC)/tarballs)
PATH :=$(abspath ../../extras/tools/build/bin):$(PATH)
export PATH

View File

@ -12,7 +12,7 @@ $(TARBALLS)/onnxruntime-$(ONNX_VERSION).tar.xz:
onnx: onnxruntime-$(ONNX_VERSION).tar.xz .sum-onnx
rm -Rf $@
mkdir -p $@
(cd $@ && tar x --strip-components=1 -f ../$<)
(cd $@ && tar x --strip-components=1 -f $<)
.onnx: onnx
ifdef HAVE_ANDROID

View File

@ -11,7 +11,7 @@ $(TARBALLS)/libvpx-$(VPX_HASH).tar.gz:
libvpx: libvpx-$(VPX_HASH).tar.gz .sum-vpx
rm -Rf $@-$(VPX_HASH)
mkdir -p $@-$(VPX_HASH)
(cd $@-$(VPX_HASH) && tar x $(if ${BATCH_MODE},,-v) --strip-components=1 -f ../$<)
(cd $@-$(VPX_HASH) && tar x $(if ${BATCH_MODE},,-v) --strip-components=1 -f $<)
$(MOVE)
DEPS_vpx =

View File

@ -50,7 +50,7 @@ $(TARBALLS)/x264-$(X264_HASH).tar.xz:
x264: x264-$(X264_HASH).tar.xz .sum-x264
rm -Rf $@-$(X264_HASH)
mkdir -p $@-$(X264_HASH)
(cd $@-$(X264_HASH) && tar x $(if ${BATCH_MODE},,-v) --strip-components=1 -f ../$<)
(cd $@-$(X264_HASH) && tar x $(if ${BATCH_MODE},,-v) --strip-components=1 -f $<)
ifdef HAVE_IOS
$(APPLY) $(SRC)/x264/remove-align.patch
endif