Commit 451d6973 authored by aviau's avatar aviau Committed by Guillaume Roguez

Allow for disabling contrib downloads

This adds the support for the DISABLE_CONTRIB_DOWNLOADS environment
variable. It if it set to TRUE, the contrib system will not download
tarballs from the internet.

It can be set from the bootstrap script with the --disable-downloads
option.

This is useful for distro packaging because distribution developpers
have to make sure they have full control of what is included in the
package. In Debian, some tarballs are included such as pjsip but the
rest should not be downloaded. A small mistake such as a missging build
dependency could cause a tarball download. This new options will help
pervent such issues.

Tuleap: #847
Change-Id: I5f579774c53def751111f9366750670fcd75d893
parent b469ecdd
......@@ -21,11 +21,12 @@
usage()
{
echo "Usage: $0 [--build=BUILD] [--host=HOST] [--prefix=PREFIX]"
echo " --build=BUILD configure for building on BUILD"
echo " --host=HOST cross-compile to build to run on HOST"
echo " --prefix=PREFIX install files in PREFIX"
echo " --disable-FOO configure to not build package FOO"
echo " --enable-FOO configure to build package FOO"
echo " --build=BUILD configure for building on BUILD"
echo " --host=HOST cross-compile to build to run on HOST"
echo " --prefix=PREFIX install files in PREFIX"
echo " --disable-downloads don't download packages from the internet"
echo " --disable-FOO configure to not build package FOO"
echo " --enable-FOO configure to build package FOO"
}
BUILD=
......@@ -50,6 +51,9 @@ do
usage
exit 0
;;
--disable-downloads)
DISABLE_CONTRIB_DOWNLOADS="TRUE"
;;
--host=*)
HOST="${1#--host=}"
;;
......@@ -108,6 +112,7 @@ HOST := $HOST
CROSS_COMPILE ?= $HOST-
PKGS_DISABLE := $PKGS_DISABLE
PKGS_ENABLE := $PKGS_ENABLE
DISABLE_CONTRIB_DOWNLOADS := $DISABLE_CONTRIB_DOWNLOADS
EOF
add_make()
......
......@@ -232,7 +232,9 @@ endif
endif
SVN ?= $(error subversion client (svn) not found!)
ifeq ($(shell curl --version >/dev/null 2>&1 || echo FAIL),)
ifeq ($(DISABLE_CONTRIB_DOWNLOADS),TRUE)
download = $(error Trying to download $(1) but DISABLE_CONTRIB_DOWNLOADS is TRUE, aborting.)
else ifeq ($(shell curl --version >/dev/null 2>&1 || echo FAIL),)
download = curl -f -L --retry-delay 10 --retry 2 -- "$(1)" > "$@"
else ifeq ($(shell wget --version >/dev/null 2>&1 || echo FAIL),)
download = rm -f $@.tmp && \
......@@ -316,6 +318,9 @@ HOSTVARS := $(HOSTTOOLS) \
CXXFLAGS="$(CXXFLAGS) $(PIC)" \
LDFLAGS="$(LDFLAGS)"
ifeq ($(DISABLE_CONTRIB_DOWNLOADS),TRUE)
download_git = $(error Trying to clone $(1) but DISABLE_CONTRIB_DOWNLOADS is TRUE, aborting.)
else
download_git = \
rm -Rf $(@:.tar.xz=) && \
$(GIT) clone $(2:%=--branch %) $(1) $(@:.tar.xz=) && \
......@@ -324,6 +329,8 @@ download_git = \
(cd $(dir $@) && \
tar cvJ $(notdir $(@:.tar.xz=))) > $@ && \
rm -Rf $(@:.tar.xz=)
endif
checksum = \
$(foreach f,$(filter $(TARBALLS)/%,$^), \
grep -- " $(f:$(TARBALLS)/%=%)$$" \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment