aboutsummaryrefslogtreecommitdiff
path: root/depends/funcs.mk
diff options
context:
space:
mode:
authorCory Fields <cory-nospam-@coryfields.com>2014-08-22 15:41:38 -0400
committerCory Fields <cory-nospam-@coryfields.com>2014-08-22 15:42:54 -0400
commitc897b1e732f524e525d1bd150326b7f0632c1b69 (patch)
tree187a1738b1f9aa506e3bdfac83ec3770b88ff322 /depends/funcs.mk
parentfac54dcb71d1779ac71d5d760cc2bd3bbdb333ca (diff)
downloadbitcoin-c897b1e732f524e525d1bd150326b7f0632c1b69.tar.xz
depends: add a fallback path in case package sources go missing
If a source url fails to download, try again at $FALLBACK_DOWNLOAD_PATH/file.name, where FALLBACK_DOWNLOAD_PATH can be overridden by the user.
Diffstat (limited to 'depends/funcs.mk')
-rw-r--r--depends/funcs.mk14
1 files changed, 8 insertions, 6 deletions
diff --git a/depends/funcs.mk b/depends/funcs.mk
index b5d8b0ee2e..280706efb3 100644
--- a/depends/funcs.mk
+++ b/depends/funcs.mk
@@ -20,11 +20,13 @@ $(sort $(foreach dep,$(2),$(2) $(call int_get_all_dependencies,$(1),$($(dep)_dep
endef
define fetch_file
-(test -f $(SOURCES_PATH)/$(3) || \
- ( mkdir -p $$($(1)_extract_dir) && $(build_DOWNLOAD) "$$($(1)_extract_dir)/$(3).temp" "$(2)" && \
- echo "$(4) $$($(1)_extract_dir)/$(3).temp" > $$($(1)_extract_dir)/.$(3).hash && \
- $(build_SHA256SUM) -c $$($(1)_extract_dir)/.$(3).hash && \
- mv $$($(1)_extract_dir)/$(3).temp $(SOURCES_PATH)/$(3) ))
+(test -f $(SOURCES_PATH)/$(4) || \
+ ( mkdir -p $$($(1)_extract_dir) && \
+ ( $(build_DOWNLOAD) "$$($(1)_extract_dir)/$(3).temp" "$(2)/$(3)" || \
+ $(build_DOWNLOAD) "$$($(1)_extract_dir)/$(3).temp" "$(FALLBACK_DOWNLOAD_PATH)/$(3)" ) && \
+ echo "$(5) $$($(1)_extract_dir)/$(4).temp" > $$($(1)_extract_dir)/.$(4).hash && \
+ $(build_SHA256SUM) -c $$($(1)_extract_dir)/.$(4).hash && \
+ mv $$($(1)_extract_dir)/$(4).temp $(SOURCES_PATH)/$(4) ))
endef
define int_get_build_recipe_hash
@@ -65,7 +67,7 @@ $(1)_download_path_fixed=$(subst :,\:,$$($(1)_download_path))
#default commands
-$(1)_fetch_cmds ?= $(call fetch_file,$(1),$(subst \:,:,$$($(1)_download_path_fixed)/$$($(1)_download_file)),$($(1)_file_name),$($(1)_sha256_hash))
+$(1)_fetch_cmds ?= $(call fetch_file,$(1),$(subst \:,:,$$($(1)_download_path_fixed)),$$($(1)_download_file),$($(1)_file_name),$($(1)_sha256_hash))
$(1)_extract_cmds ?= mkdir -p $$($(1)_extract_dir) && echo "$$($(1)_sha256_hash) $$($(1)_source)" > $$($(1)_extract_dir)/.$$($(1)_file_name).hash && $(build_SHA256SUM) -c $$($(1)_extract_dir)/.$$($(1)_file_name).hash && tar --strip-components=1 -xf $$($(1)_source)
$(1)_preprocess_cmds ?=
$(1)_build_cmds ?=