]> gitweb.factorcode.org Git - factor.git/commitdiff
add targets to Nmakefile to fetch boot images on windows, add a wscript program to...
authorJoe Groff <arcata@gmail.com>
Mon, 24 May 2010 21:19:44 +0000 (14:19 -0700)
committerJoe Groff <arcata@gmail.com>
Mon, 24 May 2010 21:19:44 +0000 (14:19 -0700)
Nmakefile
build-support/http-get.vbs [new file with mode: 0644]

index d0b543d7abde02fe8837031ba727191c5f1930da..8f60176d58ef69fc9e5f320a1050a709157cf738 100755 (executable)
--- 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 (file)
index 0000000..1a279e2
--- /dev/null
@@ -0,0 +1,29 @@
+if WScript.Arguments.Count < 2 then\r
+    WScript.Echo "usage: http-get.vbs source-url dest-file"\r
+    WScript.Quit 1\r
+else\r
+    source_url = WScript.Arguments.Item(0)\r
+    dest_filename = WScript.Arguments.Item(1)\r
+\r
+    dim http, source_data\r
+    set http = CreateObject("WinHttp.WinHttpRequest.5.1")\r
+    http.Open "GET", source_url, false\r
+    http.Send\r
+\r
+    if http.Status = 200 then\r
+        dim dest_stream\r
+        set dest_stream = CreateObject("ADODB.Stream")\r
+\r
+        dest_stream.Type = 1 ' adTypeBinary\r
+        dest_stream.Open\r
+        dest_stream.Write http.ResponseBody\r
+        dest_stream.SaveToFile dest_filename, 2 ' adSaveCreateOverWrite\r
+\r
+        set dest_stream = nothing\r
+    else\r
+        WScript.Echo CStr(http.Status) + " " + http.StatusText + " when fetching " + source_url\r
+        WScript.Quit 1\r
+    end if\r
+\r
+    set http = nothing\r
+end if\r