add targets to Nmakefile to fetch boot images on windows, add a wscript program to fetch files over http without depending on curl/wget

db4
Joe Groff 2010-05-24 14:19:44 -07:00
parent 60b20d590a
commit 518fa0de57
2 changed files with 40 additions and 1 deletions

View File

@ -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

View File

@ -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