From 518fa0de57116e7b4e4f86bace2908f86ee61c87 Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Mon, 24 May 2010 14:19:44 -0700 Subject: [PATCH] add targets to Nmakefile to fetch boot images on windows, add a wscript program to fetch files over http without depending on curl/wget --- Nmakefile | 12 +++++++++++- build-support/http-get.vbs | 29 +++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 build-support/http-get.vbs diff --git a/Nmakefile b/Nmakefile index d0b543d7ab..8f60176d58 100755 --- a/Nmakefile +++ b/Nmakefile @@ -1,3 +1,7 @@ +!IF !DEFINED(BOOTIMAGE_VERSION) +BOOTIMAGE_VERSION = latest +!ENDIF + !IF DEFINED(PLATFORM) LINK_FLAGS = /nologo shell32.lib @@ -115,6 +119,12 @@ clean: del factor.dll del factor.dll.lib -.PHONY: all default x86-32 x86-64 clean +bootimage-x86-32: + cscript /nologo build-support\http-get.vbs http://factorcode.org/images/$(BOOTIMAGE_VERSION)/boot.winnt-x86.32.image boot.winnt-x86.32.image + +bootimage-x86-64: + cscript /nologo build-support\http-get.vbs http://factorcode.org/images/$(BOOTIMAGE_VERSION)/boot.winnt-x86.64.image boot.winnt.x86.64.image + +.PHONY: all bootimage-x86-32 bootimage-x86-64 default x86-32 x86-64 clean .SUFFIXES: .rs diff --git a/build-support/http-get.vbs b/build-support/http-get.vbs new file mode 100644 index 0000000000..1a279e2527 --- /dev/null +++ b/build-support/http-get.vbs @@ -0,0 +1,29 @@ +if WScript.Arguments.Count < 2 then + WScript.Echo "usage: http-get.vbs source-url dest-file" + WScript.Quit 1 +else + source_url = WScript.Arguments.Item(0) + dest_filename = WScript.Arguments.Item(1) + + dim http, source_data + set http = CreateObject("WinHttp.WinHttpRequest.5.1") + http.Open "GET", source_url, false + http.Send + + if http.Status = 200 then + dim dest_stream + set dest_stream = CreateObject("ADODB.Stream") + + dest_stream.Type = 1 ' adTypeBinary + dest_stream.Open + dest_stream.Write http.ResponseBody + dest_stream.SaveToFile dest_filename, 2 ' adSaveCreateOverWrite + + set dest_stream = nothing + else + WScript.Echo CStr(http.Status) + " " + http.StatusText + " when fetching " + source_url + WScript.Quit 1 + end if + + set http = nothing +end if -- 2.34.1