From 46686fe6c025b159796d9bdf2c1956173777b704 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sat, 6 Jul 2013 02:19:38 +0200 Subject: [PATCH] Download*File rules: add optional source target If specified the path to the source target can be used in the URL via "$source". --- build/jam/FileRules | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/build/jam/FileRules b/build/jam/FileRules index f6d9225886..a63c1a038a 100644 --- a/build/jam/FileRules +++ b/build/jam/FileRules @@ -393,20 +393,35 @@ actions DataFileToSourceFile1 $(2[1]) $(DATA_VARIABLE) $(SIZE_VARIABLE) $(2[2]) $(1) } -rule DownloadLocatedFile target : url +rule DownloadLocatedFile target : url : source { + # DownloadLocatedFile : [ : ] ; + # + # is an optional target that will be made dependent on. + # Its resolved path can be used in via '$source'. + URL on $(target) = $(url) ; - DownloadLocatedFile1 $(target) ; + if $(source) { + Depends $(target) : $(source) ; + } + + DownloadLocatedFile1 $(target) : $(source) ; } actions DownloadLocatedFile1 { - wget -O "$(1)" $(URL) + source="$(2)" + wget --no-use-server-timestamps -O "$(1)" $(URL) } -rule DownloadFile file : url +rule DownloadFile file : url : source { + # DownloadFile : [ : ] ; + # + # is an optional target that the target will be made dependent on. + # Its resolved path can be used in via '$source'. + file = $(file:G=download) ; # Request the download only once. @@ -417,7 +432,7 @@ rule DownloadFile file : url HAIKU_FILE_DOWNLOAD on $(file) = 1 ; MakeLocate $(file) : $(HAIKU_DOWNLOAD_DIR) ; - DownloadLocatedFile $(file) : $(url) ; + DownloadLocatedFile $(file) : $(url) : $(source) ; return $(file) ; }