1 | ' $Id: configure.vbs 37204 2011-05-24 16:28:51Z vboxsync $
|
---|
2 | '' @file
|
---|
3 | ' The purpose of this script is to check for all external tools, headers, and
|
---|
4 | ' libraries VBox OSE depends on.
|
---|
5 | '
|
---|
6 | ' The script generates the build configuration file 'AutoConfig.kmk' and the
|
---|
7 | ' environment setup script 'env.bat'. A log of what has been done is
|
---|
8 | ' written to 'configure.log'.
|
---|
9 | '
|
---|
10 |
|
---|
11 | '
|
---|
12 | ' Copyright (C) 2006-2011 Oracle Corporation
|
---|
13 | '
|
---|
14 | ' This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
15 | ' available from http://www.virtualbox.org. This file is free software;
|
---|
16 | ' you can redistribute it and/or modify it under the terms of the GNU
|
---|
17 | ' General Public License (GPL) as published by the Free Software
|
---|
18 | ' Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
19 | ' VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
20 | ' hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
21 | '
|
---|
22 |
|
---|
23 |
|
---|
24 | '*****************************************************************************
|
---|
25 | '* Global Variables *
|
---|
26 | '*****************************************************************************
|
---|
27 | dim g_strPath, g_strEnvFile, g_strLogFile, g_strCfgFile, g_strShellOutput
|
---|
28 | g_strPath = Left(Wscript.ScriptFullName, Len(Wscript.ScriptFullName) - Len("\configure.vbs"))
|
---|
29 | g_strEnvFile = g_strPath & "\env.bat"
|
---|
30 | g_strCfgFile = g_strPath & "\AutoConfig.kmk"
|
---|
31 | g_strLogFile = g_strPath & "\configure.log"
|
---|
32 | 'g_strTmpFile = g_strPath & "\configure.tmp"
|
---|
33 |
|
---|
34 | dim g_objShell, g_objFileSys
|
---|
35 | Set g_objShell = WScript.CreateObject("WScript.Shell")
|
---|
36 | Set g_objFileSys = WScript.CreateObject("Scripting.FileSystemObject")
|
---|
37 |
|
---|
38 | dim g_strPathkBuild, g_strPathkBuildBin, g_strPathDev, g_strPathVCC, g_strPathPSDK, g_strPathDDK, g_strSubOutput
|
---|
39 | g_strPathkBuild = ""
|
---|
40 | g_strPathDev = ""
|
---|
41 | g_strPathVCC = ""
|
---|
42 | g_strPathPSDK = ""
|
---|
43 | g_strPathDDK = ""
|
---|
44 |
|
---|
45 | dim g_blnDisableCOM, g_strDisableCOM
|
---|
46 | g_blnDisableCOM = False
|
---|
47 | g_strDisableCOM = ""
|
---|
48 |
|
---|
49 | ' The internal mode is primarily for skipping some large libraries.
|
---|
50 | dim g_blnInternalMode
|
---|
51 | g_blnInternalMode = False
|
---|
52 |
|
---|
53 | ' Whether to try the internal stuff first or last.
|
---|
54 | dim g_blnInternalFirst
|
---|
55 | g_blnInternalFirst = True
|
---|
56 |
|
---|
57 | ' Whether to try the new tools: Visual Studio 10.0, Windows 7 SDK and WDK.
|
---|
58 | dim g_blnNewTools
|
---|
59 | g_blnNewTools = False 'True
|
---|
60 |
|
---|
61 |
|
---|
62 |
|
---|
63 | ''
|
---|
64 | ' Converts to unix slashes
|
---|
65 | function UnixSlashes(str)
|
---|
66 | UnixSlashes = replace(str, "\", "/")
|
---|
67 | end function
|
---|
68 |
|
---|
69 |
|
---|
70 | ''
|
---|
71 | ' Converts to dos slashes
|
---|
72 | function DosSlashes(str)
|
---|
73 | DosSlashes = replace(str, "/", "\")
|
---|
74 | end function
|
---|
75 |
|
---|
76 |
|
---|
77 | ''
|
---|
78 | ' Read a file (typically the tmp file) into a string.
|
---|
79 | function FileToString(strFilename)
|
---|
80 | const ForReading = 1, TristateFalse = 0
|
---|
81 | dim objLogFile, str
|
---|
82 |
|
---|
83 | set objFile = g_objFileSys.OpenTextFile(DosSlashes(strFilename), ForReading, False, TristateFalse)
|
---|
84 | str = objFile.ReadAll()
|
---|
85 | objFile.Close()
|
---|
86 |
|
---|
87 | FileToString = str
|
---|
88 | end function
|
---|
89 |
|
---|
90 |
|
---|
91 | ''
|
---|
92 | ' Deletes a file
|
---|
93 | sub FileDelete(strFilename)
|
---|
94 | if g_objFileSys.FileExists(DosSlashes(strFilename)) then
|
---|
95 | g_objFileSys.DeleteFile(DosSlashes(strFilename))
|
---|
96 | end if
|
---|
97 | end sub
|
---|
98 |
|
---|
99 |
|
---|
100 | ''
|
---|
101 | ' Appends a line to an ascii file.
|
---|
102 | sub FileAppendLine(strFilename, str)
|
---|
103 | const ForAppending = 8, TristateFalse = 0
|
---|
104 | dim objFile
|
---|
105 |
|
---|
106 | set objFile = g_objFileSys.OpenTextFile(DosSlashes(strFilename), ForAppending, True, TristateFalse)
|
---|
107 | objFile.WriteLine(str)
|
---|
108 | objFile.Close()
|
---|
109 | end sub
|
---|
110 |
|
---|
111 |
|
---|
112 | ''
|
---|
113 | ' Checks if the file exists.
|
---|
114 | function FileExists(strFilename)
|
---|
115 | FileExists = g_objFileSys.FileExists(DosSlashes(strFilename))
|
---|
116 | end function
|
---|
117 |
|
---|
118 |
|
---|
119 | ''
|
---|
120 | ' Checks if the directory exists.
|
---|
121 | function DirExists(strDirectory)
|
---|
122 | DirExists = g_objFileSys.FolderExists(DosSlashes(strDirectory))
|
---|
123 | end function
|
---|
124 |
|
---|
125 |
|
---|
126 | ''
|
---|
127 | ' Checks if this is a WOW64 process.
|
---|
128 | function IsWow64()
|
---|
129 | if g_objShell.Environment("PROCESS")("PROCESSOR_ARCHITEW6432") <> "" then
|
---|
130 | IsWow64 = 1
|
---|
131 | else
|
---|
132 | IsWow64 = 0
|
---|
133 | end if
|
---|
134 | end function
|
---|
135 |
|
---|
136 |
|
---|
137 | ''
|
---|
138 | ' Returns a reverse sorted array (strings).
|
---|
139 | function ArraySortStrings(arrStrings)
|
---|
140 | for i = LBound(arrStrings) to UBound(arrStrings)
|
---|
141 | str1 = arrStrings(i)
|
---|
142 | for j = i + 1 to UBound(arrStrings)
|
---|
143 | str2 = arrStrings(j)
|
---|
144 | if StrComp(str2, str1) < 0 then
|
---|
145 | arrStrings(j) = str1
|
---|
146 | str1 = str2
|
---|
147 | end if
|
---|
148 | next
|
---|
149 | arrStrings(i) = str1
|
---|
150 | next
|
---|
151 | ArraySortStrings = arrStrings
|
---|
152 | end function
|
---|
153 |
|
---|
154 |
|
---|
155 | ''
|
---|
156 | ' Prints a string array.
|
---|
157 | sub ArrayPrintStrings(arrStrings, strPrefix)
|
---|
158 | for i = LBound(arrStrings) to UBound(arrStrings)
|
---|
159 | Print strPrefix & "arrStrings(" & i & ") = '" & arrStrings(i) & "'"
|
---|
160 | next
|
---|
161 | end sub
|
---|
162 |
|
---|
163 |
|
---|
164 | ''
|
---|
165 | ' Returns a reverse sorted array (strings).
|
---|
166 | function ArrayRSortStrings(arrStrings)
|
---|
167 | ' Sort it.
|
---|
168 | arrStrings = ArraySortStrings(arrStrings)
|
---|
169 |
|
---|
170 | ' Reverse the array.
|
---|
171 | cnt = UBound(arrStrings) - LBound(arrStrings) + 1
|
---|
172 | if cnt > 0 then
|
---|
173 | j = UBound(arrStrings)
|
---|
174 | iHalf = Fix(LBound(arrStrings) + cnt / 2)
|
---|
175 | for i = LBound(arrStrings) to iHalf - 1
|
---|
176 | strTmp = arrStrings(i)
|
---|
177 | arrStrings(i) = arrStrings(j)
|
---|
178 | arrStrings(j) = strTmp
|
---|
179 | j = j - 1
|
---|
180 | next
|
---|
181 | end if
|
---|
182 | ArrayRSortStrings = arrStrings
|
---|
183 | end function
|
---|
184 |
|
---|
185 |
|
---|
186 | ''
|
---|
187 | ' Returns the input array with the string appended.
|
---|
188 | ' Note! There must be some better way of doing this...
|
---|
189 | function ArrayAppend(arr, str)
|
---|
190 | dim i, cnt
|
---|
191 | cnt = UBound(arr) - LBound(arr) + 1
|
---|
192 | redim arrRet(cnt)
|
---|
193 | for i = LBound(arr) to UBound(arr)
|
---|
194 | arrRet(i) = arr(i)
|
---|
195 | next
|
---|
196 | arrRet(UBound(arr) + 1) = str
|
---|
197 | ArrayAppend = arrRet
|
---|
198 | end function
|
---|
199 |
|
---|
200 |
|
---|
201 |
|
---|
202 | ''
|
---|
203 | ' Translates a register root name to a value
|
---|
204 | function RegTransRoot(strRoot)
|
---|
205 | const HKEY_LOCAL_MACHINE = &H80000002
|
---|
206 | const HKEY_CURRENT_USER = &H80000001
|
---|
207 | select case strRoot
|
---|
208 | case "HKLM"
|
---|
209 | RegTransRoot = HKEY_LOCAL_MACHINE
|
---|
210 | case "HKCU"
|
---|
211 | RegTransRoot = HKEY_CURRENT_USER
|
---|
212 | case else
|
---|
213 | MsgFatal "RegTransRoot: Unknown root: '" & strRoot & "'"
|
---|
214 | RegTransRoot = 0
|
---|
215 | end select
|
---|
216 | end function
|
---|
217 |
|
---|
218 |
|
---|
219 | '' The registry globals
|
---|
220 | dim g_objReg, g_objRegCtx
|
---|
221 | dim g_blnRegistry
|
---|
222 | g_blnRegistry = false
|
---|
223 |
|
---|
224 |
|
---|
225 | ''
|
---|
226 | ' Init the register provider globals.
|
---|
227 | function RegInit()
|
---|
228 | RegInit = false
|
---|
229 | On Error Resume Next
|
---|
230 | if g_blnRegistry = false then
|
---|
231 | set g_objRegCtx = CreateObject("WbemScripting.SWbemNamedValueSet")
|
---|
232 | ' Comment out the following for lines if the cause trouble on your windows version.
|
---|
233 | if IsWow64() then
|
---|
234 | g_objRegCtx.Add "__ProviderArchitecture", 64
|
---|
235 | g_objRegCtx.Add "__RequiredArchitecture", true
|
---|
236 | end if
|
---|
237 | set objLocator = CreateObject("Wbemscripting.SWbemLocator")
|
---|
238 | set objServices = objLocator.ConnectServer("", "root\default", "", "", , , , g_objRegCtx)
|
---|
239 | set g_objReg = objServices.Get("StdRegProv")
|
---|
240 | g_blnRegistry = true
|
---|
241 | end if
|
---|
242 | RegInit = true
|
---|
243 | end function
|
---|
244 |
|
---|
245 |
|
---|
246 | ''
|
---|
247 | ' Gets a value from the registry. Returns "" if string wasn't found / valid.
|
---|
248 | function RegGetString(strName)
|
---|
249 | RegGetString = ""
|
---|
250 | if RegInit() then
|
---|
251 | dim strRoot, strKey, strValue
|
---|
252 | dim iRoot
|
---|
253 |
|
---|
254 | ' split up into root, key and value parts.
|
---|
255 | strRoot = left(strName, instr(strName, "\") - 1)
|
---|
256 | strKey = mid(strName, instr(strName, "\") + 1, instrrev(strName, "\") - instr(strName, "\"))
|
---|
257 | strValue = mid(strName, instrrev(strName, "\") + 1)
|
---|
258 |
|
---|
259 | ' Must use ExecMethod to call the GetStringValue method because of the context.
|
---|
260 | Set InParms = g_objReg.Methods_("GetStringValue").Inparameters
|
---|
261 | InParms.hDefKey = RegTransRoot(strRoot)
|
---|
262 | InParms.sSubKeyName = strKey
|
---|
263 | InParms.sValueName = strValue
|
---|
264 | On Error Resume Next
|
---|
265 | set OutParms = g_objReg.ExecMethod_("GetStringValue", InParms, , g_objRegCtx)
|
---|
266 | if OutParms.ReturnValue = 0 then
|
---|
267 | RegGetString = OutParms.sValue
|
---|
268 | end if
|
---|
269 | else
|
---|
270 | ' fallback mode
|
---|
271 | On Error Resume Next
|
---|
272 | RegGetString = g_objShell.RegRead(strName)
|
---|
273 | end if
|
---|
274 | end function
|
---|
275 |
|
---|
276 |
|
---|
277 | ''
|
---|
278 | ' Returns an array of subkey strings.
|
---|
279 | function RegEnumSubKeys(strRoot, strKeyPath)
|
---|
280 | dim iRoot
|
---|
281 | iRoot = RegTransRoot(strRoot)
|
---|
282 | RegEnumSubKeys = Array()
|
---|
283 |
|
---|
284 | if RegInit() then
|
---|
285 | ' Must use ExecMethod to call the EnumKey method because of the context.
|
---|
286 | Set InParms = g_objReg.Methods_("EnumKey").Inparameters
|
---|
287 | InParms.hDefKey = RegTransRoot(strRoot)
|
---|
288 | InParms.sSubKeyName = strKeyPath
|
---|
289 | On Error Resume Next
|
---|
290 | set OutParms = g_objReg.ExecMethod_("EnumKey", InParms, , g_objRegCtx)
|
---|
291 | if OutParms.ReturnValue = 0 then
|
---|
292 | RegEnumSubKeys = OutParms.sNames
|
---|
293 | end if
|
---|
294 | else
|
---|
295 | ' fallback mode
|
---|
296 | dim objReg, rc, arrSubKeys
|
---|
297 | set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
|
---|
298 | On Error Resume Next
|
---|
299 | rc = objReg.EnumKey(iRoot, strKeyPath, arrSubKeys)
|
---|
300 | if rc = 0 then
|
---|
301 | RegEnumSubKeys = arrSubKeys
|
---|
302 | end if
|
---|
303 | end if
|
---|
304 | end function
|
---|
305 |
|
---|
306 |
|
---|
307 | ''
|
---|
308 | ' Returns an array of full path subkey strings.
|
---|
309 | function RegEnumSubKeysFull(strRoot, strKeyPath)
|
---|
310 | dim arrTmp
|
---|
311 | arrTmp = RegEnumSubKeys(strRoot, strKeyPath)
|
---|
312 | for i = LBound(arrTmp) to UBound(arrTmp)
|
---|
313 | arrTmp(i) = strKeyPath & "\" & arrTmp(i)
|
---|
314 | next
|
---|
315 | RegEnumSubKeysFull = arrTmp
|
---|
316 | end function
|
---|
317 |
|
---|
318 |
|
---|
319 | ''
|
---|
320 | ' Returns an rsorted array of subkey strings.
|
---|
321 | function RegEnumSubKeysRSort(strRoot, strKeyPath)
|
---|
322 | RegEnumSubKeysRSort = ArrayRSortStrings(RegEnumSubKeys(strRoot, strKeyPath))
|
---|
323 | end function
|
---|
324 |
|
---|
325 |
|
---|
326 | ''
|
---|
327 | ' Returns an rsorted array of subkey strings.
|
---|
328 | function RegEnumSubKeysFullRSort(strRoot, strKeyPath)
|
---|
329 | RegEnumSubKeysFullRSort = ArrayRSortStrings(RegEnumSubKeysFull(strRoot, strKeyPath))
|
---|
330 | end function
|
---|
331 |
|
---|
332 |
|
---|
333 | ''
|
---|
334 | ' Gets the commandline used to invoke the script.
|
---|
335 | function GetCommandline()
|
---|
336 | dim str, i
|
---|
337 |
|
---|
338 | '' @todo find an api for querying it instead of reconstructing it like this...
|
---|
339 | GetCommandline = "cscript configure.vbs"
|
---|
340 | for i = 1 to WScript.Arguments.Count
|
---|
341 | str = WScript.Arguments.Item(i - 1)
|
---|
342 | if str = "" then
|
---|
343 | str = """"""
|
---|
344 | elseif (InStr(1, str, " ")) then
|
---|
345 | str = """" & str & """"
|
---|
346 | end if
|
---|
347 | GetCommandline = GetCommandline & " " & str
|
---|
348 | next
|
---|
349 | end function
|
---|
350 |
|
---|
351 |
|
---|
352 | ''
|
---|
353 | ' Gets an environment variable.
|
---|
354 | function EnvGet(strName)
|
---|
355 | EnvGet = g_objShell.Environment("PROCESS")(strName)
|
---|
356 | end function
|
---|
357 |
|
---|
358 |
|
---|
359 | ''
|
---|
360 | ' Sets an environment variable.
|
---|
361 | sub EnvSet(strName, strValue)
|
---|
362 | g_objShell.Environment("PROCESS")(strName) = strValue
|
---|
363 | LogPrint "EnvSet: " & strName & "=" & strValue
|
---|
364 | end sub
|
---|
365 |
|
---|
366 |
|
---|
367 | ''
|
---|
368 | ' Appends a string to an environment variable
|
---|
369 | sub EnvAppend(strName, strValue)
|
---|
370 | dim str
|
---|
371 | str = g_objShell.Environment("PROCESS")(strName)
|
---|
372 | g_objShell.Environment("PROCESS")(strName) = str & strValue
|
---|
373 | LogPrint "EnvAppend: " & strName & "=" & str & strValue
|
---|
374 | end sub
|
---|
375 |
|
---|
376 |
|
---|
377 | ''
|
---|
378 | ' Prepends a string to an environment variable
|
---|
379 | sub EnvPrepend(strName, strValue)
|
---|
380 | dim str
|
---|
381 | str = g_objShell.Environment("PROCESS")(strName)
|
---|
382 | g_objShell.Environment("PROCESS")(strName) = strValue & str
|
---|
383 | LogPrint "EnvPrepend: " & strName & "=" & strValue & str
|
---|
384 | end sub
|
---|
385 |
|
---|
386 |
|
---|
387 | ''
|
---|
388 | ' Get the path of the parent directory. Returns root if root was specified.
|
---|
389 | ' Expects abs path.
|
---|
390 | function PathParent(str)
|
---|
391 | PathParent = g_objFileSys.GetParentFolderName(DosSlashes(str))
|
---|
392 | end function
|
---|
393 |
|
---|
394 |
|
---|
395 | ''
|
---|
396 | ' Strips the filename from at path.
|
---|
397 | function PathStripFilename(str)
|
---|
398 | PathStripFilename = g_objFileSys.GetParentFolderName(DosSlashes(str))
|
---|
399 | end function
|
---|
400 |
|
---|
401 |
|
---|
402 | ''
|
---|
403 | ' Get the abs path, use the short version if necessary.
|
---|
404 | function PathAbs(str)
|
---|
405 | strAbs = g_objFileSys.GetAbsolutePathName(DosSlashes(str))
|
---|
406 | strParent = g_objFileSys.GetParentFolderName(strAbs)
|
---|
407 | if strParent = "" then
|
---|
408 | PathAbs = strAbs
|
---|
409 | else
|
---|
410 | strParent = PathAbs(strParent) ' Recurse to resolve parent paths.
|
---|
411 | PathAbs = g_objFileSys.BuildPath(strParent, g_objFileSys.GetFileName(strAbs))
|
---|
412 |
|
---|
413 | dim obj
|
---|
414 | set obj = Nothing
|
---|
415 | if FileExists(PathAbs) then
|
---|
416 | set obj = g_objFileSys.GetFile(PathAbs)
|
---|
417 | elseif DirExists(PathAbs) then
|
---|
418 | set obj = g_objFileSys.GetFolder(PathAbs)
|
---|
419 | end if
|
---|
420 |
|
---|
421 | if not (obj is nothing) then
|
---|
422 | for each objSub in obj.ParentFolder.SubFolders
|
---|
423 | if obj.Name = objSub.Name or obj.ShortName = objSub.ShortName then
|
---|
424 | if InStr(1, objSub.Name, " ") > 0 _
|
---|
425 | Or InStr(1, objSub.Name, "&") > 0 _
|
---|
426 | Or InStr(1, objSub.Name, "$") > 0 _
|
---|
427 | then
|
---|
428 | PathAbs = g_objFileSys.BuildPath(strParent, objSub.ShortName)
|
---|
429 | if InStr(1, PathAbs, " ") > 0 _
|
---|
430 | Or InStr(1, PathAbs, "&") > 0 _
|
---|
431 | Or InStr(1, PathAbs, "$") > 0 _
|
---|
432 | then
|
---|
433 | MsgFatal "PathAbs(" & str & ") attempted to return filename with problematic " _
|
---|
434 | & "characters in it (" & PathAbs & "). The tool/sdk referenced will probably " _
|
---|
435 | & "need to be copied or reinstalled to a location without 'spaces', '$', ';' " _
|
---|
436 | & "or '&' in the path name. (Unless it's a problem with this script of course...)"
|
---|
437 | end if
|
---|
438 | else
|
---|
439 | PathAbs = g_objFileSys.BuildPath(strParent, objSub.Name)
|
---|
440 | end if
|
---|
441 | exit for
|
---|
442 | end if
|
---|
443 | next
|
---|
444 | end if
|
---|
445 | end if
|
---|
446 | end function
|
---|
447 |
|
---|
448 |
|
---|
449 | ''
|
---|
450 | ' Get the abs path, use the long version.
|
---|
451 | function PathAbsLong(str)
|
---|
452 | strAbs = g_objFileSys.GetAbsolutePathName(DosSlashes(str))
|
---|
453 | strParent = g_objFileSys.GetParentFolderName(strAbs)
|
---|
454 | if strParent = "" then
|
---|
455 | PathAbsLong = strAbs
|
---|
456 | else
|
---|
457 | strParent = PathAbsLong(strParent) ' Recurse to resolve parent paths.
|
---|
458 | PathAbsLong = g_objFileSys.BuildPath(strParent, g_objFileSys.GetFileName(strAbs))
|
---|
459 |
|
---|
460 | dim obj
|
---|
461 | set obj = Nothing
|
---|
462 | if FileExists(PathAbsLong) then
|
---|
463 | set obj = g_objFileSys.GetFile(PathAbsLong)
|
---|
464 | elseif DirExists(PathAbsLong) then
|
---|
465 | set obj = g_objFileSys.GetFolder(PathAbsLong)
|
---|
466 | end if
|
---|
467 |
|
---|
468 | if not (obj is nothing) then
|
---|
469 | for each objSub in obj.ParentFolder.SubFolders
|
---|
470 | if obj.Name = objSub.Name or obj.ShortName = objSub.ShortName then
|
---|
471 | PathAbsLong = g_objFileSys.BuildPath(strParent, objSub.Name)
|
---|
472 | exit for
|
---|
473 | end if
|
---|
474 | next
|
---|
475 | end if
|
---|
476 | end if
|
---|
477 | end function
|
---|
478 |
|
---|
479 |
|
---|
480 | ''
|
---|
481 | ' Executes a command in the shell catching output in g_strShellOutput
|
---|
482 | function Shell(strCommand, blnBoth)
|
---|
483 | dim strShell, strCmdline, objExec, str
|
---|
484 |
|
---|
485 | strShell = g_objShell.ExpandEnvironmentStrings("%ComSpec%")
|
---|
486 | if blnBoth = true then
|
---|
487 | strCmdline = strShell & " /c " & strCommand & " 2>&1"
|
---|
488 | else
|
---|
489 | strCmdline = strShell & " /c " & strCommand & " 2>nul"
|
---|
490 | end if
|
---|
491 |
|
---|
492 | LogPrint "# Shell: " & strCmdline
|
---|
493 | Set objExec = g_objShell.Exec(strCmdLine)
|
---|
494 | g_strShellOutput = objExec.StdOut.ReadAll()
|
---|
495 | objExec.StdErr.ReadAll()
|
---|
496 | do while objExec.Status = 0
|
---|
497 | Wscript.Sleep 20
|
---|
498 | g_strShellOutput = g_strShellOutput & objExec.StdOut.ReadAll()
|
---|
499 | objExec.StdErr.ReadAll()
|
---|
500 | loop
|
---|
501 |
|
---|
502 | LogPrint "# Status: " & objExec.ExitCode
|
---|
503 | LogPrint "# Start of Output"
|
---|
504 | LogPrint g_strShellOutput
|
---|
505 | LogPrint "# End of Output"
|
---|
506 |
|
---|
507 | Shell = objExec.ExitCode
|
---|
508 | end function
|
---|
509 |
|
---|
510 |
|
---|
511 | ''
|
---|
512 | ' Try find the specified file in the path.
|
---|
513 | function Which(strFile)
|
---|
514 | dim strPath, iStart, iEnd, str
|
---|
515 |
|
---|
516 | ' the path
|
---|
517 | strPath = EnvGet("Path")
|
---|
518 | iStart = 1
|
---|
519 | do while iStart <= Len(strPath)
|
---|
520 | iEnd = InStr(iStart, strPath, ";")
|
---|
521 | if iEnd <= 0 then iEnd = Len(strPath) + 1
|
---|
522 | if iEnd > iStart then
|
---|
523 | str = Mid(strPath, iStart, iEnd - iStart) & "/" & strFile
|
---|
524 | if FileExists(str) then
|
---|
525 | Which = str
|
---|
526 | exit function
|
---|
527 | end if
|
---|
528 | end if
|
---|
529 | iStart = iEnd + 1
|
---|
530 | loop
|
---|
531 |
|
---|
532 | ' registry or somewhere?
|
---|
533 |
|
---|
534 | Which = ""
|
---|
535 | end function
|
---|
536 |
|
---|
537 |
|
---|
538 | ''
|
---|
539 | ' Append text to the log file and echo it to stdout
|
---|
540 | sub Print(str)
|
---|
541 | LogPrint str
|
---|
542 | Wscript.Echo str
|
---|
543 | end sub
|
---|
544 |
|
---|
545 |
|
---|
546 | ''
|
---|
547 | ' Prints a test header
|
---|
548 | sub PrintHdr(strTest)
|
---|
549 | LogPrint "***** Checking for " & strTest & " *****"
|
---|
550 | Wscript.Echo "Checking for " & StrTest & "..."
|
---|
551 | end sub
|
---|
552 |
|
---|
553 |
|
---|
554 | ''
|
---|
555 | ' Prints a success message
|
---|
556 | sub PrintResultMsg(strTest, strResult)
|
---|
557 | LogPrint "** " & strTest & ": " & strResult
|
---|
558 | Wscript.Echo " Found "& strTest & ": " & strResult
|
---|
559 | end sub
|
---|
560 |
|
---|
561 |
|
---|
562 | ''
|
---|
563 | ' Prints a successfully detected path
|
---|
564 | sub PrintResult(strTest, strPath)
|
---|
565 | strLongPath = PathAbsLong(strPath)
|
---|
566 | if PathAbs(strPath) <> strLongPath then
|
---|
567 | LogPrint "** " & strTest & ": " & strPath & " (" & UnixSlashes(strLongPath) & ")"
|
---|
568 | Wscript.Echo " Found " & strTest & ": " & strPath & " (" & UnixSlashes(strLongPath) & ")"
|
---|
569 | else
|
---|
570 | LogPrint "** " & strTest & ": " & strPath
|
---|
571 | Wscript.Echo " Found " & strTest & ": " & strPath
|
---|
572 | end if
|
---|
573 | end sub
|
---|
574 |
|
---|
575 |
|
---|
576 | ''
|
---|
577 | ' Warning message.
|
---|
578 | sub MsgWarning(strMsg)
|
---|
579 | Print "warning: " & strMsg
|
---|
580 | end sub
|
---|
581 |
|
---|
582 |
|
---|
583 | ''
|
---|
584 | ' Fatal error.
|
---|
585 | sub MsgFatal(strMsg)
|
---|
586 | Print "fatal error: " & strMsg
|
---|
587 | Wscript.Quit
|
---|
588 | end sub
|
---|
589 |
|
---|
590 |
|
---|
591 | ''
|
---|
592 | ' Error message, fatal unless flag to ignore errors is given.
|
---|
593 | sub MsgError(strMsg)
|
---|
594 | Print "error: " & strMsg
|
---|
595 | if g_blnInternalMode = False then
|
---|
596 | Wscript.Quit
|
---|
597 | end if
|
---|
598 | end sub
|
---|
599 |
|
---|
600 |
|
---|
601 | ''
|
---|
602 | ' Write a log header with some basic info.
|
---|
603 | sub LogInit
|
---|
604 | FileDelete g_strLogFile
|
---|
605 | LogPrint "# Log file generated by " & Wscript.ScriptFullName
|
---|
606 | for i = 1 to WScript.Arguments.Count
|
---|
607 | LogPrint "# Arg #" & i & ": " & WScript.Arguments.Item(i - 1)
|
---|
608 | next
|
---|
609 | if Wscript.Arguments.Count = 0 then
|
---|
610 | LogPrint "# No arguments given"
|
---|
611 | end if
|
---|
612 | LogPrint "# Reconstructed command line: " & GetCommandline()
|
---|
613 |
|
---|
614 | ' some Wscript stuff
|
---|
615 | LogPrint "# Wscript properties:"
|
---|
616 | LogPrint "# ScriptName: " & Wscript.ScriptName
|
---|
617 | LogPrint "# Version: " & Wscript.Version
|
---|
618 | LogPrint "# Build: " & Wscript.BuildVersion
|
---|
619 | LogPrint "# Name: " & Wscript.Name
|
---|
620 | LogPrint "# Full Name: " & Wscript.FullName
|
---|
621 | LogPrint "# Path: " & Wscript.Path
|
---|
622 | LogPrint "#"
|
---|
623 |
|
---|
624 |
|
---|
625 | ' the environment
|
---|
626 | LogPrint "# Environment:"
|
---|
627 | dim objEnv
|
---|
628 | for each strVar in g_objShell.Environment("PROCESS")
|
---|
629 | LogPrint "# " & strVar
|
---|
630 | next
|
---|
631 | LogPrint "#"
|
---|
632 | end sub
|
---|
633 |
|
---|
634 |
|
---|
635 | ''
|
---|
636 | ' Append text to the log file.
|
---|
637 | sub LogPrint(str)
|
---|
638 | FileAppendLine g_strLogFile, str
|
---|
639 | 'Wscript.Echo "dbg: " & str
|
---|
640 | end sub
|
---|
641 |
|
---|
642 |
|
---|
643 | ''
|
---|
644 | ' Checks if the file exists and logs failures.
|
---|
645 | function LogFileExists(strPath, strFilename)
|
---|
646 | LogFileExists = FileExists(strPath & "/" & strFilename)
|
---|
647 | if LogFileExists = False then
|
---|
648 | LogPrint "Testing '" & strPath & "': " & strFilename & " not found"
|
---|
649 | end if
|
---|
650 |
|
---|
651 | end function
|
---|
652 |
|
---|
653 |
|
---|
654 | ''
|
---|
655 | ' Finds the first file matching the pattern.
|
---|
656 | ' If no file is found, log the failure.
|
---|
657 | function LogFindFile(strPath, strPattern)
|
---|
658 | dim str
|
---|
659 |
|
---|
660 | '
|
---|
661 | ' Yes, there are some facy database kinda interface to the filesystem
|
---|
662 | ' however, breaking down the path and constructing a usable query is
|
---|
663 | ' too much hassle. So, we'll do it the unix way...
|
---|
664 | '
|
---|
665 | if Shell("dir /B """ & DosSlashes(strPath) & "\" & DosSlashes(strPattern) & """", True) = 0 _
|
---|
666 | And InStr(1, g_strShellOutput, Chr(13)) > 1 _
|
---|
667 | then
|
---|
668 | ' return the first word.
|
---|
669 | LogFindFile = Left(g_strShellOutput, InStr(1, g_strShellOutput, Chr(13)) - 1)
|
---|
670 | else
|
---|
671 | LogPrint "Testing '" & strPath & "': " & strPattern & " not found"
|
---|
672 | LogFindFile = ""
|
---|
673 | end if
|
---|
674 | end function
|
---|
675 |
|
---|
676 |
|
---|
677 | ''
|
---|
678 | ' Finds the first directory matching the pattern.
|
---|
679 | ' If no directory is found, log the failure,
|
---|
680 | ' else return the complete path to the found directory.
|
---|
681 | function LogFindDir(strPath, strPattern)
|
---|
682 | dim str
|
---|
683 |
|
---|
684 | '
|
---|
685 | ' Yes, there are some facy database kinda interface to the filesystem
|
---|
686 | ' however, breaking down the path and constructing a usable query is
|
---|
687 | ' too much hassle. So, we'll do it the unix way...
|
---|
688 | '
|
---|
689 |
|
---|
690 | ' List the alphabetically last names as first entries (with /O-N).
|
---|
691 | if Shell("dir /B /AD /O-N """ & DosSlashes(strPath) & "\" & DosSlashes(strPattern) & """", True) = 0 _
|
---|
692 | And InStr(1, g_strShellOutput, Chr(13)) > 1 _
|
---|
693 | then
|
---|
694 | ' return the first word.
|
---|
695 | LogFindDir = strPath & "/" & Left(g_strShellOutput, InStr(1, g_strShellOutput, Chr(13)) - 1)
|
---|
696 | else
|
---|
697 | LogPrint "Testing '" & strPath & "': " & strPattern & " not found"
|
---|
698 | LogFindDir = ""
|
---|
699 | end if
|
---|
700 | end function
|
---|
701 |
|
---|
702 |
|
---|
703 | ''
|
---|
704 | ' Initializes the config file.
|
---|
705 | sub CfgInit
|
---|
706 | FileDelete g_strCfgFile
|
---|
707 | CfgPrint "# -*- Makefile -*-"
|
---|
708 | CfgPrint "#"
|
---|
709 | CfgPrint "# Build configuration generated by " & GetCommandline()
|
---|
710 | CfgPrint "#"
|
---|
711 | if g_blnInternalMode = False then
|
---|
712 | CfgPrint "VBOX_OSE := 1"
|
---|
713 | end if
|
---|
714 | end sub
|
---|
715 |
|
---|
716 |
|
---|
717 | ''
|
---|
718 | ' Prints a string to the config file.
|
---|
719 | sub CfgPrint(str)
|
---|
720 | FileAppendLine g_strCfgFile, str
|
---|
721 | end sub
|
---|
722 |
|
---|
723 |
|
---|
724 | ''
|
---|
725 | ' Initializes the environment batch script.
|
---|
726 | sub EnvInit
|
---|
727 | FileDelete g_strEnvFile
|
---|
728 | EnvPrint "@echo off"
|
---|
729 | EnvPrint "rem"
|
---|
730 | EnvPrint "rem Environment setup script generated by " & GetCommandline()
|
---|
731 | EnvPrint "rem"
|
---|
732 | end sub
|
---|
733 |
|
---|
734 |
|
---|
735 | ''
|
---|
736 | ' Prints a string to the environment batch script.
|
---|
737 | sub EnvPrint(str)
|
---|
738 | FileAppendLine g_strEnvFile, str
|
---|
739 | end sub
|
---|
740 |
|
---|
741 |
|
---|
742 | ''
|
---|
743 | ' No COM
|
---|
744 | sub DisableCOM(strReason)
|
---|
745 | if g_blnDisableCOM = False then
|
---|
746 | LogPrint "Disabled COM components: " & strReason
|
---|
747 | g_blnDisableCOM = True
|
---|
748 | g_strDisableCOM = strReason
|
---|
749 | CfgPrint "VBOX_WITH_MAIN="
|
---|
750 | CfgPrint "VBOX_WITH_QTGUI="
|
---|
751 | CfgPrint "VBOX_WITH_VBOXSDL="
|
---|
752 | CfgPrint "VBOX_WITH_DEBUGGER_GUI="
|
---|
753 | CfgPrint "VBOX_WITHOUT_COM=1"
|
---|
754 | end if
|
---|
755 | end sub
|
---|
756 |
|
---|
757 |
|
---|
758 | ''
|
---|
759 | ' No UDPTunnel
|
---|
760 | sub DisableUDPTunnel(strReason)
|
---|
761 | if g_blnDisableUDPTunnel = False then
|
---|
762 | LogPrint "Disabled UDPTunnel network transport: " & strReason
|
---|
763 | g_blnDisableUDPTunnel = True
|
---|
764 | g_strDisableUDPTunnel = strReason
|
---|
765 | CfgPrint "VBOX_WITH_UDPTUNNEL="
|
---|
766 | end if
|
---|
767 | end sub
|
---|
768 |
|
---|
769 |
|
---|
770 | ''
|
---|
771 | ' Checks the the path doesn't contain characters the tools cannot deal with.
|
---|
772 | sub CheckSourcePath
|
---|
773 | dim sPwd
|
---|
774 |
|
---|
775 | sPwd = PathAbs(g_strPath)
|
---|
776 | if InStr(1, sPwd, " ") > 0 then
|
---|
777 | MsgError "Source path contains spaces! Please move it. (" & sPwd & ")"
|
---|
778 | end if
|
---|
779 | if InStr(1, sPwd, "$") > 0 then
|
---|
780 | MsgError "Source path contains the '$' char! Please move it. (" & sPwd & ")"
|
---|
781 | end if
|
---|
782 | if InStr(1, sPwd, "%") > 0 then
|
---|
783 | MsgError "Source path contains the '%' char! Please move it. (" & sPwd & ")"
|
---|
784 | end if
|
---|
785 | if InStr(1, sPwd, Chr(10)) > 0 _
|
---|
786 | Or InStr(1, sPwd, Chr(13)) > 0 _
|
---|
787 | Or InStr(1, sPwd, Chr(9)) > 0 _
|
---|
788 | then
|
---|
789 | MsgError "Source path contains control characters! Please move it. (" & sPwd & ")"
|
---|
790 | end if
|
---|
791 | Print "Source path: OK"
|
---|
792 | end sub
|
---|
793 |
|
---|
794 |
|
---|
795 | ''
|
---|
796 | ' Checks for kBuild - very simple :)
|
---|
797 | sub CheckForkBuild(strOptkBuild)
|
---|
798 | PrintHdr "kBuild"
|
---|
799 |
|
---|
800 | '
|
---|
801 | ' Check if there is a 'kmk' in the path somewhere without
|
---|
802 | ' any PATH_KBUILD* stuff around.
|
---|
803 | '
|
---|
804 | blnNeedEnvVars = True
|
---|
805 | g_strPathkBuild = strOptkBuild
|
---|
806 | g_strPathkBuildBin = ""
|
---|
807 | if (g_strPathkBuild = "") _
|
---|
808 | And (EnvGet("PATH_KBUILD") = "") _
|
---|
809 | And (EnvGet("PATH_KBUILD_BIN") = "") _
|
---|
810 | And (Shell("kmk.exe --version", True) = 0) _
|
---|
811 | And (InStr(1,g_strShellOutput, "kBuild Make 0.1") > 0) _
|
---|
812 | And (InStr(1,g_strShellOutput, "PATH_KBUILD") > 0) _
|
---|
813 | And (InStr(1,g_strShellOutput, "PATH_KBUILD_BIN") > 0) then
|
---|
814 | '' @todo Need to parse out the PATH_KBUILD and PATH_KBUILD_BIN values to complete the other tests.
|
---|
815 | 'blnNeedEnvVars = False
|
---|
816 | MsgWarning "You've installed kBuild it seems. configure.vbs hasn't been updated to " _
|
---|
817 | & "deal with that yet and will use the one it ships with. Sorry."
|
---|
818 | end if
|
---|
819 |
|
---|
820 | '
|
---|
821 | ' Check for the PATH_KBUILD env.var. and fall back on root/kBuild otherwise.
|
---|
822 | '
|
---|
823 | if g_strPathkBuild = "" then
|
---|
824 | g_strPathkBuild = EnvGet("PATH_KBUILD")
|
---|
825 | if (g_strPathkBuild <> "") and (FileExists(g_strPathkBuild & "/footer.kmk") = False) then
|
---|
826 | MsgWarning "Ignoring incorrect kBuild path (PATH_KBUILD=" & g_strPathkBuild & ")"
|
---|
827 | g_strPathkBuild = ""
|
---|
828 | end if
|
---|
829 |
|
---|
830 | if g_strPathkBuild = "" then
|
---|
831 | g_strPathkBuild = g_strPath & "/kBuild"
|
---|
832 | end if
|
---|
833 | end if
|
---|
834 |
|
---|
835 | g_strPathkBuild = UnixSlashes(PathAbs(g_strPathkBuild))
|
---|
836 |
|
---|
837 | '
|
---|
838 | ' Determin the location of the kBuild binaries.
|
---|
839 | '
|
---|
840 | if g_strPathkBuildBin = "" then
|
---|
841 | dim str2
|
---|
842 | if EnvGet("PROCESSOR_ARCHITECTURE") = "x86" then
|
---|
843 | g_strPathkBuildBin = g_strPathkBuild & "/bin/win.x86"
|
---|
844 | else ' boldly assumes there is only x86 and amd64.
|
---|
845 | g_strPathkBuildBin = g_strPathkBuild & "/bin/win.amd64"
|
---|
846 | if FileExists(g_strPathkBuild & "/kmk.exe") = False then
|
---|
847 | g_strPathkBuildBin = g_strPathkBuild & "/bin/win.x86"
|
---|
848 | end if
|
---|
849 | end if
|
---|
850 | if FileExists(g_strPathkBuild & "/kmk.exe") = False then
|
---|
851 | g_strPathkBuildBin = g_strPathkBuild & "/bin/win.x86"
|
---|
852 | end if
|
---|
853 | end if
|
---|
854 |
|
---|
855 | '
|
---|
856 | ' Perform basic validations of the kBuild installation.
|
---|
857 | '
|
---|
858 | if (FileExists(g_strPathkBuild & "/footer.kmk") = False) _
|
---|
859 | Or (FileExists(g_strPathkBuild & "/header.kmk") = False) _
|
---|
860 | Or (FileExists(g_strPathkBuild & "/rules.kmk") = False) then
|
---|
861 | MsgFatal "Can't find valid kBuild at '" & g_strPathkBuild & "'. Either there is an " _
|
---|
862 | & "incorrect PATH_KBUILD in the environment or the checkout didn't succeed."
|
---|
863 | exit sub
|
---|
864 | end if
|
---|
865 | if (FileExists(g_strPathkBuildBin & "/kmk.exe") = False) _
|
---|
866 | Or (FileExists(g_strPathkBuildBin & "/kmk_ash.exe") = False) then
|
---|
867 | MsgFatal "Can't find valid kBuild binaries at '" & g_strPathkBuildBin & "'. Either there is an " _
|
---|
868 | & "incorrect PATH_KBUILD in the environment or the checkout didn't succeed."
|
---|
869 | exit sub
|
---|
870 | end if
|
---|
871 |
|
---|
872 | if (Shell(DosSlashes(g_strPathkBuildBin & "/kmk.exe") & " --version", True) <> 0) Then
|
---|
873 | MsgFatal "Can't execute '" & g_strPathkBuildBin & "/kmk.exe --version'. check configure.log for the out."
|
---|
874 | exit sub
|
---|
875 | end if
|
---|
876 |
|
---|
877 | '
|
---|
878 | ' Check for env.vars that kBuild uses.
|
---|
879 | '
|
---|
880 | str = EnvGet("BUILD_TYPE")
|
---|
881 | if (str <> "") _
|
---|
882 | And (InStr(1, "|release|debug|profile|kprofile", str) <= 0) then
|
---|
883 | EnvPrint "set BUILD_TYPE=release"
|
---|
884 | EnvSet "BUILD_TYPE", "release"
|
---|
885 | MsgWarning "Found unknown BUILD_TYPE value '" & str &"' in your environment. Setting it to 'release'."
|
---|
886 | end if
|
---|
887 |
|
---|
888 | str = EnvGet("BUILD_TARGET")
|
---|
889 | if (str <> "") _
|
---|
890 | And (InStr(1, "win|win32|win64", str) <= 0) then '' @todo later only 'win' will be valid. remember to fix this check!
|
---|
891 | EnvPrint "set BUILD_TARGET=win"
|
---|
892 | EnvSet "BUILD_TARGET", "win"
|
---|
893 | MsgWarning "Found unknown BUILD_TARGET value '" & str &"' in your environment. Setting it to 'win32'."
|
---|
894 | end if
|
---|
895 |
|
---|
896 | str = EnvGet("BUILD_TARGET_ARCH")
|
---|
897 | if (str <> "") _
|
---|
898 | And (InStr(1, "x86|amd64", str) <= 0) then
|
---|
899 | EnvPrint "set BUILD_TARGET_ARCH=x86"
|
---|
900 | EnvSet "BUILD_TARGET_ARCH", "x86"
|
---|
901 | MsgWarning "Found unknown BUILD_TARGET_ARCH value '" & str &"' in your environment. Setting it to 'x86'."
|
---|
902 | end if
|
---|
903 |
|
---|
904 | str = EnvGet("BUILD_TARGET_CPU")
|
---|
905 | ' perhaps a bit pedantic this since this isn't clearly define nor used much...
|
---|
906 | if (str <> "") _
|
---|
907 | And (InStr(1, "i386|i486|i686|i786|i868|k5|k6|k7|k8", str) <= 0) then
|
---|
908 | EnvPrint "set BUILD_TARGET_CPU=i386"
|
---|
909 | EnvSet "BUILD_TARGET_CPU", "i386"
|
---|
910 | MsgWarning "Found unknown BUILD_TARGET_CPU value '" & str &"' in your environment. Setting it to 'i386'."
|
---|
911 | end if
|
---|
912 |
|
---|
913 | str = EnvGet("BUILD_PLATFORM")
|
---|
914 | if (str <> "") _
|
---|
915 | And (InStr(1, "win|win32|win64", str) <= 0) then '' @todo later only 'win' will be valid. remember to fix this check!
|
---|
916 | EnvPrint "set BUILD_PLATFORM=win"
|
---|
917 | EnvSet "BUILD_PLATFORM", "win"
|
---|
918 | MsgWarning "Found unknown BUILD_PLATFORM value '" & str &"' in your environment. Setting it to 'win32'."
|
---|
919 | end if
|
---|
920 |
|
---|
921 | str = EnvGet("BUILD_PLATFORM_ARCH")
|
---|
922 | if (str <> "") _
|
---|
923 | And (InStr(1, "x86|amd64", str) <= 0) then
|
---|
924 | EnvPrint "set BUILD_PLATFORM_ARCH=x86"
|
---|
925 | EnvSet "BUILD_PLATFORM_ARCH", "x86"
|
---|
926 | MsgWarning "Found unknown BUILD_PLATFORM_ARCH value '" & str &"' in your environment. Setting it to 'x86'."
|
---|
927 | end if
|
---|
928 |
|
---|
929 | str = EnvGet("BUILD_PLATFORM_CPU")
|
---|
930 | ' perhaps a bit pedantic this since this isn't clearly define nor used much...
|
---|
931 | if (str <> "") _
|
---|
932 | And (InStr(1, "i386|i486|i686|i786|i868|k5|k6|k7|k8", str) <= 0) then
|
---|
933 | EnvPrint "set BUILD_PLATFORM_CPU=i386"
|
---|
934 | EnvSet "BUILD_PLATFORM_CPU", "i386"
|
---|
935 | MsgWarning "Found unknown BUILD_PLATFORM_CPU value '" & str &"' in your environment. Setting it to 'i386'."
|
---|
936 | end if
|
---|
937 |
|
---|
938 | '
|
---|
939 | ' If PATH_DEV is set, check that it's pointing to something useful.
|
---|
940 | '
|
---|
941 | str = EnvGet("PATH_DEV")
|
---|
942 | g_strPathDev = str
|
---|
943 | if (str <> "") _
|
---|
944 | And False then '' @todo add some proper tests here.
|
---|
945 | strNew = UnixSlashes(g_strPath & "/tools")
|
---|
946 | EnvPrint "set PATH_DEV=" & strNew
|
---|
947 | EnvSet "PATH_DEV", strNew
|
---|
948 | MsgWarning "Found PATH_DEV='" & str &"' in your environment. Setting it to '" & strNew & "'."
|
---|
949 | g_strPathDev = strNew
|
---|
950 | end if
|
---|
951 | if g_strPathDev = "" then g_strPathDev = UnixSlashes(g_strPath & "/tools")
|
---|
952 |
|
---|
953 | '
|
---|
954 | ' Write PATH_KBUILD to the environment script if necessary.
|
---|
955 | '
|
---|
956 | if blnNeedEnvVars = True then
|
---|
957 | EnvPrint "set PATH_KBUILD=" & g_strPathkBuild
|
---|
958 | EnvSet "PATH_KBUILD", g_strPathkBuild
|
---|
959 | EnvPrint "set PATH=" & g_strPathkBuildBin & ";%PATH%"
|
---|
960 | EnvPrepend "PATH", g_strPathkBuildBin & ";"
|
---|
961 | end if
|
---|
962 |
|
---|
963 | PrintResult "kBuild", g_strPathkBuild
|
---|
964 | PrintResult "kBuild binaries", g_strPathkBuildBin
|
---|
965 | end sub
|
---|
966 |
|
---|
967 |
|
---|
968 | ''
|
---|
969 | ' Checks for Visual C++ version 7.1, 8 or 10.
|
---|
970 | sub CheckForVisualCPP(strOptVC, strOptVCCommon, blnOptVCExpressEdition)
|
---|
971 | dim strPathVC, strPathVCCommon, str, str2, blnNeedMsPDB
|
---|
972 | PrintHdr "Visual C++"
|
---|
973 |
|
---|
974 | '
|
---|
975 | ' Try find it...
|
---|
976 | '
|
---|
977 | strPathVC = ""
|
---|
978 | strPathVCCommon = ""
|
---|
979 | if (strPathVC = "") And (strOptVC <> "") then
|
---|
980 | if CheckForVisualCPPSub(strOptVC, strOptVCCommon, blnOptVCExpressEdition) then
|
---|
981 | strPathVC = strOptVC
|
---|
982 | strPathVCCommon = strOptVCCommon
|
---|
983 | end if
|
---|
984 | end if
|
---|
985 |
|
---|
986 | if (strPathVC = "") And (g_blnInternalFirst = True) Then
|
---|
987 | if g_blnNewTools Then
|
---|
988 | strPathVC = g_strPathDev & "/win.x86/vcc/v10"
|
---|
989 | if CheckForVisualCPPSub(strPathVC, "", blnOptVCExpressEdition) = False then
|
---|
990 | strPathVC = ""
|
---|
991 | end if
|
---|
992 | end if
|
---|
993 | if strPathVC = "" then
|
---|
994 | strPathVC = g_strPathDev & "/win.x86/vcc/v8"
|
---|
995 | if CheckForVisualCPPSub(strPathVC, "", blnOptVCExpressEdition) = False then
|
---|
996 | strPathVC = g_strPathDev & "/win.x86/vcc/v7"
|
---|
997 | if CheckForVisualCPPSub(strPathVC, "", blnOptVCExpressEdition) = False then
|
---|
998 | strPathVC = ""
|
---|
999 | end if
|
---|
1000 | end if
|
---|
1001 | end if
|
---|
1002 | end if
|
---|
1003 |
|
---|
1004 | if (strPathVC = "") _
|
---|
1005 | And (Shell("cl.exe", True) = 0) then
|
---|
1006 | str = Which("cl.exe")
|
---|
1007 | if FileExists(PathStripFilename(strClExe) & "/build.exe") then
|
---|
1008 | ' don't know how to deal with this cl.
|
---|
1009 | Warning "Ignoring DDK cl.exe (" & str & ")."
|
---|
1010 | else
|
---|
1011 | strPathVC = PathParent(PathStripFilename(str))
|
---|
1012 | strPathVCCommon = PathParent(strPathVC) & "/Common7"
|
---|
1013 | end if
|
---|
1014 | end if
|
---|
1015 |
|
---|
1016 | if (strPathVC = "") And g_blnNewTools then
|
---|
1017 | str = RegGetString("HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Setup\VS\ProductDir")
|
---|
1018 | if str <> "" Then
|
---|
1019 | str2 = str & "Common7"
|
---|
1020 | str = str & "VC"
|
---|
1021 | if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
|
---|
1022 | strPathVC = str
|
---|
1023 | strPathVCCommon = str2
|
---|
1024 | end if
|
---|
1025 | end if
|
---|
1026 | end if
|
---|
1027 |
|
---|
1028 | if (strPathVC = "") And g_blnNewTools then
|
---|
1029 | str = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\10.0\Setup\VS\ProductDir")
|
---|
1030 | if str <> "" Then
|
---|
1031 | str2 = str & "Common7"
|
---|
1032 | str = str & "VC"
|
---|
1033 | if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
|
---|
1034 | strPathVC = str
|
---|
1035 | strPathVCCommon = str2
|
---|
1036 | end if
|
---|
1037 | end if
|
---|
1038 | end if
|
---|
1039 |
|
---|
1040 | if strPathVC = "" then
|
---|
1041 | str = RegGetString("HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\8.0\Setup\VS\ProductDir")
|
---|
1042 | str2 = RegGetString("HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\8.0\Setup\VS\EnvironmentDirectory")
|
---|
1043 | if str <> "" And str2 <> "" Then
|
---|
1044 | str = str & "VC"
|
---|
1045 | str2 = PathParent(str2)
|
---|
1046 | if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
|
---|
1047 | strPathVC = str
|
---|
1048 | strPathVCCommon = str2
|
---|
1049 | end if
|
---|
1050 | end if
|
---|
1051 | end if
|
---|
1052 |
|
---|
1053 | if strPathVC = "" then
|
---|
1054 | str = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\8.0\Setup\VS\ProductDir")
|
---|
1055 | str2 = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\8.0\Setup\VS\EnvironmentDirectory")
|
---|
1056 | if str <> "" And str2 <> "" Then
|
---|
1057 | str = str & "VC"
|
---|
1058 | str2 = PathParent(str2)
|
---|
1059 | if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
|
---|
1060 | strPathVC = str
|
---|
1061 | strPathVCCommon = str2
|
---|
1062 | end if
|
---|
1063 | end if
|
---|
1064 | end if
|
---|
1065 |
|
---|
1066 | if strPathVC = "" then
|
---|
1067 | '' @todo check what this really looks like on 7.1
|
---|
1068 | str = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\7.1\Setup\VS\ProductDir")
|
---|
1069 | str2 = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\7.1\Setup\VS\EnvironmentDirectory")
|
---|
1070 | if str <> "" And str2 <> "" Then
|
---|
1071 | str = str & "VC7"
|
---|
1072 | str2 = PathParent(str2)
|
---|
1073 | if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
|
---|
1074 | strPathVC = str
|
---|
1075 | strPathVCCommon = str2
|
---|
1076 | end if
|
---|
1077 | end if
|
---|
1078 | end if
|
---|
1079 |
|
---|
1080 | if strPathVC = "" then
|
---|
1081 | str = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\7.0\Setup\VS\ProductDir")
|
---|
1082 | str2 = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\7.0\Setup\VS\EnvironmentDirectory")
|
---|
1083 | if str <> "" And str2 <> "" Then
|
---|
1084 | str = str & "VC7"
|
---|
1085 | str2 = PathParent(str2)
|
---|
1086 | if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
|
---|
1087 | strPathVC = str
|
---|
1088 | strPathVCCommon = str2
|
---|
1089 | end if
|
---|
1090 | end if
|
---|
1091 | end if
|
---|
1092 |
|
---|
1093 | if strPathVC = "" then
|
---|
1094 | str = RegGetString("HKLM\SOFTWARE\Microsoft\Wow6432Node\VisualStudio\SxS\VC7\8.0")
|
---|
1095 | if str <> "" then
|
---|
1096 | str2 = PathParent(str) & "/Common7"
|
---|
1097 | if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
|
---|
1098 | strPathVC = str
|
---|
1099 | strPathVCCommon = str2
|
---|
1100 | end if
|
---|
1101 | end if
|
---|
1102 | end if
|
---|
1103 |
|
---|
1104 | if strPathVC = "" then
|
---|
1105 | str = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VC7\8.0")
|
---|
1106 | if str <> "" then
|
---|
1107 | str2 = PathParent(str) & "/Common7"
|
---|
1108 | if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
|
---|
1109 | strPathVC = str
|
---|
1110 | strPathVCCommon = str2
|
---|
1111 | end if
|
---|
1112 | end if
|
---|
1113 | end if
|
---|
1114 |
|
---|
1115 | ' finally check for the express edition.
|
---|
1116 | if strPathVC = "" then
|
---|
1117 | str = RegGetString("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Visual C++ 2005 Express Edition - ENU\InstallLocation")
|
---|
1118 | if str <> "" then
|
---|
1119 | str2 = str & "Common7"
|
---|
1120 | str = str & "VC/"
|
---|
1121 | if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
|
---|
1122 | strPathVC = str
|
---|
1123 | strPathVCCommon = str2
|
---|
1124 | end if
|
---|
1125 | end if
|
---|
1126 | end if
|
---|
1127 |
|
---|
1128 | if (strPathVC = "") And (g_blnInternalFirst = False) Then
|
---|
1129 | strPathVC = g_strPathDev & "/win.x86/vcc/v8"
|
---|
1130 | if CheckForVisualCPPSub(strPathVC, "", blnOptVCExpressEdition) = False then
|
---|
1131 | strPathVC = g_strPathDev & "/win.x86/vcc/v7"
|
---|
1132 | if CheckForVisualCPPSub(strPathVC, "", blnOptVCExpressEdition) = False then
|
---|
1133 | strPathVC = ""
|
---|
1134 | end if
|
---|
1135 | end if
|
---|
1136 | end if
|
---|
1137 |
|
---|
1138 | if strPathVC = "" then
|
---|
1139 | MsgError "Cannot find cl.exe (Visual C++) anywhere on your system. Check the build requirements."
|
---|
1140 | exit sub
|
---|
1141 | end if
|
---|
1142 |
|
---|
1143 | '
|
---|
1144 | ' Clean up the path and determin the VC directory.
|
---|
1145 | '
|
---|
1146 | strPathVC = UnixSlashes(PathAbs(strPathVC))
|
---|
1147 | g_strPathVCC = strPathVC
|
---|
1148 |
|
---|
1149 | '
|
---|
1150 | ' Check the version.
|
---|
1151 | ' We'll have to make sure mspdbXX.dll is somewhere in the PATH.
|
---|
1152 | '
|
---|
1153 | if (strPathVCCommon <> "") Then
|
---|
1154 | EnvAppend "PATH", ";" & strPathVCCommon & "/IDE"
|
---|
1155 | end if
|
---|
1156 | if Shell(DosSlashes(strPathVC & "/bin/cl.exe"), True) <> 0 then
|
---|
1157 | MsgError "Executing '" & strClExe & "' (which we believe to be the Visual C++ compiler driver) failed."
|
---|
1158 | exit sub
|
---|
1159 | end if
|
---|
1160 |
|
---|
1161 | if (InStr(1, g_strShellOutput, "Version 13.10") <= 0) _
|
---|
1162 | And (InStr(1, g_strShellOutput, "Version 14.") <= 0) _
|
---|
1163 | And (InStr(1, g_strShellOutput, "Version 16.") <= 0) then
|
---|
1164 | MsgError "The Visual C++ compiler we found ('" & strPathVC & "') isn't 7.1, 8.0 or 10.0. Check the build requirements."
|
---|
1165 | exit sub
|
---|
1166 | end if
|
---|
1167 |
|
---|
1168 | '
|
---|
1169 | ' Ok, emit build config variables.
|
---|
1170 | '
|
---|
1171 | if InStr(1, g_strShellOutput, "Version 16.") > 0 then
|
---|
1172 | CfgPrint "VBOX_USE_VCC100 := 1"
|
---|
1173 | CfgPrint "PATH_TOOL_VCC100 := " & g_strPathVCC
|
---|
1174 | CfgPrint "PATH_TOOL_VCC100X86 = $(PATH_TOOL_VCC100)"
|
---|
1175 | CfgPrint "PATH_TOOL_VCC100AMD64 = $(PATH_TOOL_VCC100)"
|
---|
1176 | if LogFileExists(strPathVC, "atlmfc/include/atlbase.h") then
|
---|
1177 | PrintResult "Visual C++ v10 with ATL", g_strPathVCC
|
---|
1178 | elseif LogFileExists(g_strPathDDK, "inc/atl71/atlbase.h") _
|
---|
1179 | And LogFileExists(g_strPathDDK, "lib/ATL/i386/atls.lib") then
|
---|
1180 | CfgPrint "TOOL_VCC100X86_MT = $(PATH_SDK_WINPSDK)/Bin/mt.exe"
|
---|
1181 | CfgPrint "TOOL_VCC100AMD64_MT = $(TOOL_VCC100X86_MT)"
|
---|
1182 | CfgPrint "VBOX_WITHOUT_COMPILER_REDIST=1"
|
---|
1183 | CfgPrint "PATH_TOOL_VCC100_ATLMFC_INC = " & g_strPathDDK & "/inc/atl71"
|
---|
1184 | CfgPrint "PATH_TOOL_VCC100_ATLMFC_LIB.amd64 = " & g_strPathDDK & "/lib/ATL/amd64"
|
---|
1185 | CfgPrint "PATH_TOOL_VCC100_ATLMFC_LIB.x86 = " & g_strPathDDK & "/lib/ATL/i386"
|
---|
1186 | CfgPrint "PATH_TOOL_VCC100AMD64_ATLMFC_INC = " & g_strPathDDK & "/inc/atl71"
|
---|
1187 | CfgPrint "PATH_TOOL_VCC100AMD64_ATLMFC_LIB = " & g_strPathDDK & "/lib/ATL/amd64"
|
---|
1188 | CfgPrint "PATH_TOOL_VCC100X86_ATLMFC_INC = " & g_strPathDDK & "/inc/atl71"
|
---|
1189 | CfgPrint "PATH_TOOL_VCC100X86_ATLMFC_LIB = " & g_strPathDDK & "/lib/ATL/i386"
|
---|
1190 | PrintResult "Visual C++ v10 with DDK ATL", g_strPathVCC
|
---|
1191 | else
|
---|
1192 | CfgPrint "TOOL_VCC100X86_MT = $(PATH_SDK_WINPSDK)/Bin/mt.exe"
|
---|
1193 | CfgPrint "TOOL_VCC100AMD64_MT = $(TOOL_VCC100X86_MT)"
|
---|
1194 | CfgPrint "VBOX_WITHOUT_COMPILER_REDIST=1"
|
---|
1195 | DisableCOM "No ATL"
|
---|
1196 | PrintResult "Visual C++ v10 (or later) without ATL", g_strPathVCC
|
---|
1197 | end if
|
---|
1198 | elseif InStr(1, g_strShellOutput, "Version 14.") > 0 then
|
---|
1199 | CfgPrint "VBOX_USE_VCC80 := 1"
|
---|
1200 | CfgPrint "PATH_TOOL_VCC80 := " & g_strPathVCC
|
---|
1201 | CfgPrint "PATH_TOOL_VCC80X86 = $(PATH_TOOL_VCC80)"
|
---|
1202 | CfgPrint "PATH_TOOL_VCC80AMD64 = $(PATH_TOOL_VCC80)"
|
---|
1203 | if blnOptVCExpressEdition _
|
---|
1204 | And LogFileExists(strPathVC, "atlmfc/include/atlbase.h") = False _
|
---|
1205 | then
|
---|
1206 | CfgPrint "TOOL_VCC80X86_MT = $(PATH_SDK_WINPSDK)/Bin/mt.exe"
|
---|
1207 | CfgPrint "TOOL_VCC80AMD64_MT = $(TOOL_VCC80X86_MT)"
|
---|
1208 | CfgPrint "VBOX_WITHOUT_COMPILER_REDIST=1"
|
---|
1209 | DisableCOM "No ATL"
|
---|
1210 | PrintResult "Visual C++ v8 (or later) without ATL", g_strPathVCC
|
---|
1211 | else
|
---|
1212 | PrintResult "Visual C++ v8 (or later)", g_strPathVCC
|
---|
1213 | end if
|
---|
1214 | else
|
---|
1215 | CfgPrint "PATH_TOOL_VCC70 := " & g_strPathVCC
|
---|
1216 | if blnOptVCExpressEdition _
|
---|
1217 | And LogFileExists(strPathVC, "atlmfc/include/atlbase.h") = False _
|
---|
1218 | then
|
---|
1219 | CfgPrint "VBOX_WITHOUT_COMPILER_REDIST=1"
|
---|
1220 | DisableCOM "No ATL"
|
---|
1221 | PrintResult "Visual C++ v7.1 without ATL", g_strPathVCC
|
---|
1222 | else
|
---|
1223 | PrintResult "Visual C++ v7.1", g_strPathVCC
|
---|
1224 | end if
|
---|
1225 | end if
|
---|
1226 |
|
---|
1227 | ' and the env.bat path fix.
|
---|
1228 | if strPathVCCommon <> "" then
|
---|
1229 | EnvPrint "set PATH=%PATH%;" & strPathVCCommon & "/IDE;"
|
---|
1230 | end if
|
---|
1231 | end sub
|
---|
1232 |
|
---|
1233 | ''
|
---|
1234 | ' Checks if the specified path points to a usable PSDK.
|
---|
1235 | function CheckForVisualCPPSub(strPathVC, strPathVCCommon, blnOptVCExpressEdition)
|
---|
1236 | strPathVC = UnixSlashes(PathAbs(strPathVC))
|
---|
1237 | CheckForVisualCPPSub = False
|
---|
1238 | LogPrint "trying: strPathVC=" & strPathVC & " strPathVCCommon=" & strPathVCCommon & " blnOptVCExpressEdition=" & blnOptVCExpressEdition
|
---|
1239 | if LogFileExists(strPathVC, "bin/cl.exe") _
|
---|
1240 | And LogFileExists(strPathVC, "bin/link.exe") _
|
---|
1241 | And LogFileExists(strPathVC, "include/string.h") _
|
---|
1242 | And LogFileExists(strPathVC, "lib/libcmt.lib") _
|
---|
1243 | And LogFileExists(strPathVC, "lib/msvcrt.lib") _
|
---|
1244 | then
|
---|
1245 | if blnOptVCExpressEdition _
|
---|
1246 | Or ( LogFileExists(strPathVC, "atlmfc/include/atlbase.h") _
|
---|
1247 | And LogFileExists(strPathVC, "atlmfc/lib/atls.lib")) _
|
---|
1248 | Or ( LogFileExists(g_strPathDDK, "inc/atl71/atlbase.h") _
|
---|
1249 | And LogFileExists(g_strPathDDK, "lib/ATL/i386/atls.lib")) _
|
---|
1250 | Then
|
---|
1251 | '' @todo figure out a way we can verify the version/build!
|
---|
1252 | CheckForVisualCPPSub = True
|
---|
1253 | end if
|
---|
1254 | end if
|
---|
1255 | end function
|
---|
1256 |
|
---|
1257 |
|
---|
1258 | ''
|
---|
1259 | ' Checks for a platform SDK that works with the compiler
|
---|
1260 | sub CheckForPlatformSDK(strOptSDK)
|
---|
1261 | dim strPathPSDK, str
|
---|
1262 | PrintHdr "Windows Platform SDK (recent)"
|
---|
1263 |
|
---|
1264 | strPathPSDK = ""
|
---|
1265 |
|
---|
1266 | ' Check the supplied argument first.
|
---|
1267 | str = strOptSDK
|
---|
1268 | if str <> "" then
|
---|
1269 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1270 | end if
|
---|
1271 |
|
---|
1272 | ' The tools location (first).
|
---|
1273 | if strPathPSDK = "" And g_blnInternalFirst then
|
---|
1274 | str = g_strPathDev & "/win.x86/sdk/200604"
|
---|
1275 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1276 | end if
|
---|
1277 |
|
---|
1278 | if strPathPSDK = "" And g_blnInternalFirst then
|
---|
1279 | str = g_strPathDev & "/win.x86/sdk/200504"
|
---|
1280 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1281 | end if
|
---|
1282 |
|
---|
1283 | if strPathPSDK = "" And g_blnInternalFirst then
|
---|
1284 | str = g_strPathDev & "/win.x86/sdk/200209"
|
---|
1285 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1286 | end if
|
---|
1287 |
|
---|
1288 | ' Look for it in the environment
|
---|
1289 | str = EnvGet("MSSdk")
|
---|
1290 | if strPathPSDK = "" And str <> "" then
|
---|
1291 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1292 | end if
|
---|
1293 |
|
---|
1294 | str = EnvGet("Mstools")
|
---|
1295 | if strPathPSDK = "" And str <> "" then
|
---|
1296 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1297 | end if
|
---|
1298 |
|
---|
1299 | ' Check if there is one installed with the compiler.
|
---|
1300 | if strPathPSDK = "" And str <> "" then
|
---|
1301 | str = g_strPathVCC & "/PlatformSDK"
|
---|
1302 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1303 | end if
|
---|
1304 |
|
---|
1305 | ' Check the registry next (ASSUMES sorting). (first pair is vista, second is pre-vista)
|
---|
1306 | arrSubKeys = RegEnumSubKeysRSort("HKLM", "SOFTWARE\Microsoft\Microsoft SDKs\Windows")
|
---|
1307 | for each strSubKey in arrSubKeys
|
---|
1308 | str = RegGetString("HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\" & strSubKey & "\InstallationFolder")
|
---|
1309 | if strPathPSDK = "" And str <> "" then
|
---|
1310 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1311 | end if
|
---|
1312 | Next
|
---|
1313 | arrSubKeys = RegEnumSubKeysRSort("HKCU", "SOFTWARE\Microsoft\Microsoft SDKs\Windows")
|
---|
1314 | for each strSubKey in arrSubKeys
|
---|
1315 | str = RegGetString("HKCU\SOFTWARE\Microsoft\Microsoft SDKs\Windows\" & strSubKey & "\InstallationFolder")
|
---|
1316 | if strPathPSDK = "" And str <> "" then
|
---|
1317 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1318 | end if
|
---|
1319 | Next
|
---|
1320 |
|
---|
1321 | arrSubKeys = RegEnumSubKeysRSort("HKLM", "SOFTWARE\Microsoft\MicrosoftSDK\InstalledSDKs")
|
---|
1322 | for each strSubKey in arrSubKeys
|
---|
1323 | str = RegGetString("HKLM\SOFTWARE\Microsoft\MicrosoftSDK\InstalledSDKs\" & strSubKey & "\Install Dir")
|
---|
1324 | if strPathPSDK = "" And str <> "" then
|
---|
1325 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1326 | end if
|
---|
1327 | Next
|
---|
1328 | arrSubKeys = RegEnumSubKeysRSort("HKCU", "SOFTWARE\Microsoft\MicrosoftSDK\InstalledSDKs")
|
---|
1329 | for each strSubKey in arrSubKeys
|
---|
1330 | str = RegGetString("HKCU\SOFTWARE\Microsoft\MicrosoftSDK\InstalledSDKs\" & strSubKey & "\Install Dir")
|
---|
1331 | if strPathPSDK = "" And str <> "" then
|
---|
1332 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1333 | end if
|
---|
1334 | Next
|
---|
1335 |
|
---|
1336 | ' The tools location (post).
|
---|
1337 | if (strPathPSDK = "") And (g_blnInternalFirst = False) then
|
---|
1338 | str = g_strPathDev & "/win.x86/sdk/200604"
|
---|
1339 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1340 | end if
|
---|
1341 |
|
---|
1342 | if (strPathPSDK = "") And (g_blnInternalFirst = False) then
|
---|
1343 | str = g_strPathDev & "/win.x86/sdk/200504"
|
---|
1344 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1345 | end if
|
---|
1346 |
|
---|
1347 | if (strPathPSDK = "") And (g_blnInternalFirst = False) then
|
---|
1348 | str = g_strPathDev & "/win.x86/sdk/200209"
|
---|
1349 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1350 | end if
|
---|
1351 |
|
---|
1352 | ' Give up.
|
---|
1353 | if strPathPSDK = "" then
|
---|
1354 | MsgError "Cannot find a suitable Platform SDK. Check configure.log and the build requirements."
|
---|
1355 | exit sub
|
---|
1356 | end if
|
---|
1357 |
|
---|
1358 | '
|
---|
1359 | ' Emit the config.
|
---|
1360 | '
|
---|
1361 | strPathPSDK = UnixSlashes(PathAbs(strPathPSDK))
|
---|
1362 | CfgPrint "PATH_SDK_WINPSDK := " & strPathPSDK
|
---|
1363 | CfgPrint "PATH_SDK_WINPSDKINCS = $(PATH_SDK_WINPSDK)"
|
---|
1364 | CfgPrint "PATH_SDK_WIN32SDK = $(PATH_SDK_WINPSDK)"
|
---|
1365 | CfgPrint "PATH_SDK_WIN64SDK = $(PATH_SDK_WINPSDK)"
|
---|
1366 |
|
---|
1367 | PrintResult "Windows Platform SDK", strPathPSDK
|
---|
1368 | g_strPathPSDK = strPathPSDK
|
---|
1369 | end sub
|
---|
1370 |
|
---|
1371 | ''
|
---|
1372 | ' Checks if the specified path points to a usable PSDK.
|
---|
1373 | function CheckForPlatformSDKSub(strPathPSDK)
|
---|
1374 | CheckForPlatformSDKSub = False
|
---|
1375 | LogPrint "trying: strPathPSDK=" & strPathPSDK
|
---|
1376 | if LogFileExists(strPathPSDK, "include/Windows.h") _
|
---|
1377 | And LogFileExists(strPathPSDK, "lib/Kernel32.Lib") _
|
---|
1378 | And LogFileExists(strPathPSDK, "lib/User32.Lib") _
|
---|
1379 | then
|
---|
1380 | CheckForPlatformSDKSub = True
|
---|
1381 | end if
|
---|
1382 | end function
|
---|
1383 |
|
---|
1384 |
|
---|
1385 | ''
|
---|
1386 | ' Checks for a Windows 2003 DDK or Windows 7 Driver Kit.
|
---|
1387 | sub CheckForWin2k3DDK(strOptDDK)
|
---|
1388 | dim strPathDDK, str, strSubKeys
|
---|
1389 | PrintHdr "Windows 2003 DDK, build 3790 or later"
|
---|
1390 |
|
---|
1391 | '
|
---|
1392 | ' Find the DDK.
|
---|
1393 | '
|
---|
1394 | strPathDDK = ""
|
---|
1395 | ' The specified path.
|
---|
1396 | if strPathDDK = "" And strOptDDK <> "" then
|
---|
1397 | if CheckForWin2k3DDKSub(strOptDDK, True) then strPathDDK = strOptDDK
|
---|
1398 | end if
|
---|
1399 |
|
---|
1400 | ' The tools location (first).
|
---|
1401 | if strPathDDK = "" And g_blnInternalFirst then
|
---|
1402 | str = g_strPathDev & "/win.x86/ddkwin2k3/200503"
|
---|
1403 | if CheckForWin2k3DDKSub(str, False) then strPathDDK = str
|
---|
1404 | end if
|
---|
1405 |
|
---|
1406 | if strPathDDK = "" And g_blnInternalFirst then
|
---|
1407 | str = g_strPathDev & "/win.x86/ddkwin2k3/2004"
|
---|
1408 | if CheckForWin2k3DDKSub(str, False) then strPathDDK = str
|
---|
1409 | end if
|
---|
1410 |
|
---|
1411 | ' Check the environment
|
---|
1412 | str = EnvGet("DDK_INC_PATH")
|
---|
1413 | if strPathDDK = "" And str <> "" then
|
---|
1414 | str = PathParent(PathParent(str))
|
---|
1415 | if CheckForWin2k3DDKSub(str, True) then strPathDDK = str
|
---|
1416 | end if
|
---|
1417 |
|
---|
1418 | str = EnvGet("BASEDIR")
|
---|
1419 | if strPathDDK = "" And str <> "" then
|
---|
1420 | if CheckForWin2k3DDKSub(str, True) then strPathDDK = str
|
---|
1421 | end if
|
---|
1422 |
|
---|
1423 | ' Some array constants to ease the work.
|
---|
1424 | arrSoftwareKeys = array("SOFTWARE", "SOFTWARE\Wow6432Node")
|
---|
1425 | arrRoots = array("HKLM", "HKCU")
|
---|
1426 |
|
---|
1427 | ' Windows 7 WDK.
|
---|
1428 | arrLocations = array()
|
---|
1429 | for each strSoftwareKey in arrSoftwareKeys
|
---|
1430 | for each strSubKey in RegEnumSubKeysFull("HKLM", strSoftwareKey & "\Microsoft\KitSetup\configured-kits")
|
---|
1431 | for each strSubKey2 in RegEnumSubKeysFull("HKLM", strSubKey)
|
---|
1432 | str = RegGetString("HKLM\" & strSubKey2 & "\setup-install-location")
|
---|
1433 | if str <> "" then
|
---|
1434 | arrLocations = ArrayAppend(arrLocations, PathAbsLong(str))
|
---|
1435 | end if
|
---|
1436 | next
|
---|
1437 | next
|
---|
1438 | next
|
---|
1439 | arrLocations = ArrayRSortStrings(arrLocations)
|
---|
1440 |
|
---|
1441 | ' Vista WDK.
|
---|
1442 | for each strRoot in arrRoots
|
---|
1443 | for each strSubKey in RegEnumSubKeysFullRSort(strRoot, "SOFTWARE\Microsoft\WINDDK")
|
---|
1444 | str = RegGetString(strRoot & "\" & strSubKey & "\Setup\BUILD")
|
---|
1445 | if str <> "" then arrLocations = ArrayAppend(arrLocations, PathAbsLong(str))
|
---|
1446 | Next
|
---|
1447 | next
|
---|
1448 |
|
---|
1449 | ' Pre-Vista WDK?
|
---|
1450 | for each strRoot in arrRoots
|
---|
1451 | for each strSubKey in RegEnumSubKeysFullRSort(strRoot, "SOFTWARE\Microsoft\WINDDK")
|
---|
1452 | str = RegGetString(strRoot & "\" & strSubKey & "\SFNDirectory")
|
---|
1453 | if str <> "" then arrLocations = ArrayAppend(arrLocations, PathAbsLong(str))
|
---|
1454 | Next
|
---|
1455 | next
|
---|
1456 |
|
---|
1457 | ' Check the locations we've gathered.
|
---|
1458 | for each str in arrLocations
|
---|
1459 | if strPathDDK = "" then
|
---|
1460 | if CheckForWin2k3DDKSub(str, True) then strPathDDK = str
|
---|
1461 | end if
|
---|
1462 | next
|
---|
1463 |
|
---|
1464 | ' The tools location (post).
|
---|
1465 | if (strPathDDK = "") And (g_blnInternalFirst = False) then
|
---|
1466 | str = g_strPathDev & "/win.x86/ddkwin2k3/200503"
|
---|
1467 | if CheckForWin2k3DDKSub(str, False) then strPathDDK = str
|
---|
1468 | end if
|
---|
1469 |
|
---|
1470 | if (strPathDDK = "") And (g_blnInternalFirst = False) then
|
---|
1471 | str = g_strPathDev & "/win.x86/ddkwin2k3/2004"
|
---|
1472 | if CheckForWin2k3DDKSub(str, False) then strPathDDK = str
|
---|
1473 | end if
|
---|
1474 |
|
---|
1475 | ' Give up.
|
---|
1476 | if strPathDDK = "" then
|
---|
1477 | MsgError "Cannot find a suitable Windows 2003 DDK. Check configure.log and the build requirements."
|
---|
1478 | exit sub
|
---|
1479 | end if
|
---|
1480 |
|
---|
1481 | '
|
---|
1482 | ' Emit the config.
|
---|
1483 | '
|
---|
1484 | strPathDDK = UnixSlashes(PathAbs(strPathDDK))
|
---|
1485 | if LogFileExists(strPathDDK, "inc/api/ntdef.h") then
|
---|
1486 | CfgPrint "VBOX_USE_WINDDK := 1"
|
---|
1487 | CfgPrint "PATH_SDK_WINDDK := " & strPathDDK
|
---|
1488 | else
|
---|
1489 | CfgPrint "PATH_SDK_W2K3DDK := " & strPathDDK
|
---|
1490 | CfgPrint "PATH_SDK_W2K3DDKX86 = $(PATH_SDK_W2K3DDK)"
|
---|
1491 | CfgPrint "PATH_SDK_W2K3DDKAMD64 = $(PATH_SDK_W2K3DDK)"
|
---|
1492 | end if
|
---|
1493 |
|
---|
1494 | PrintResult "Windows 2003 DDK", strPathDDK
|
---|
1495 | g_strPathDDK = strPathDDK
|
---|
1496 | end sub
|
---|
1497 |
|
---|
1498 | '' Quick check if the DDK is in the specified directory or not.
|
---|
1499 | function CheckForWin2k3DDKSub(strPathDDK, blnCheckBuild)
|
---|
1500 | CheckForWin2k3DDKSub = False
|
---|
1501 | LogPrint "trying: strPathDDK=" & strPathDDK & " blnCheckBuild=" & blnCheckBuild
|
---|
1502 | if g_blnNewTools _
|
---|
1503 | And LogFileExists(strPathDDK, "inc/api/ntdef.h") _
|
---|
1504 | And LogFileExists(strPathDDK, "lib/wnet/i386/int64.lib") _
|
---|
1505 | then
|
---|
1506 | '' @todo figure out a way we can verify the version/build!
|
---|
1507 | CheckForWin2k3DDKSub = True
|
---|
1508 | end if
|
---|
1509 |
|
---|
1510 | if LogFileExists(strPathDDK, "inc/ddk/wnet/ntdef.h") _
|
---|
1511 | And LogFileExists(strPathDDK, "lib/wnet/i386/int64.lib") _
|
---|
1512 | then
|
---|
1513 | '' @todo figure out a way we can verify the version/build!
|
---|
1514 | CheckForWin2k3DDKSub = True
|
---|
1515 | end if
|
---|
1516 | end function
|
---|
1517 |
|
---|
1518 |
|
---|
1519 | ''
|
---|
1520 | ' Finds midl.exe
|
---|
1521 | sub CheckForMidl()
|
---|
1522 | dim strMidl
|
---|
1523 | PrintHdr "Midl.exe"
|
---|
1524 |
|
---|
1525 | ' Skip if no COM/ATL.
|
---|
1526 | if g_blnDisableCOM then
|
---|
1527 | PrintResultMsg "Midl", "Skipped (" & g_strDisableCOM & ")"
|
---|
1528 | exit sub
|
---|
1529 | end if
|
---|
1530 |
|
---|
1531 | if LogFileExists(g_strPathPSDK, "bin/Midl.exe") then
|
---|
1532 | strMidl = g_strPathPSDK & "/bin/Midl.exe"
|
---|
1533 | elseif LogFileExists(g_strPathVCC, "Common7/Tools/Bin/Midl.exe") then
|
---|
1534 | strMidl = g_strPathVCC & "/Common7/Tools/Bin/Midl.exe"
|
---|
1535 | elseif LogFileExists(g_strPathDDK, "bin/x86/Midl.exe") then
|
---|
1536 | strMidl = g_strPathDDK & "/bin/x86/Midl.exe"
|
---|
1537 | elseif LogFileExists(g_strPathDDK, "bin/Midl.exe") then
|
---|
1538 | strMidl = g_strPathDDK & "/bin/Midl.exe"
|
---|
1539 | elseif LogFileExists(g_strPathDev, "win.x86/bin/Midl.exe") then
|
---|
1540 | strMidl = g_strPathDev & "/win.x86/bin/Midl.exe"
|
---|
1541 | else
|
---|
1542 | MsgWarning "Midl.exe not found!"
|
---|
1543 | exit sub
|
---|
1544 | end if
|
---|
1545 |
|
---|
1546 | CfgPrint "VBOX_MAIN_IDL = " & strMidl
|
---|
1547 | PrintResult "Midl.exe", strMidl
|
---|
1548 | end sub
|
---|
1549 |
|
---|
1550 |
|
---|
1551 | ''
|
---|
1552 | ' Checks for a recent DirectX SDK.
|
---|
1553 | sub CheckForDirectXSDK(strOptDXSDK)
|
---|
1554 | dim strPathDXSDK, str, arrSubKeys, arrSubKeys2, strKey, strKey2
|
---|
1555 | PrintHdr "Direct X SDK"
|
---|
1556 |
|
---|
1557 | '
|
---|
1558 | ' Find the DX SDK.
|
---|
1559 | '
|
---|
1560 | strPathDXSDK = ""
|
---|
1561 | ' The specified path.
|
---|
1562 | if (strPathDXSDK = "") And (strOptDXSDK <> "") then
|
---|
1563 | if CheckForDirectXSDKSub(strOptDXSDK) then strPathDXSDK = strOptDXSDK
|
---|
1564 | end if
|
---|
1565 |
|
---|
1566 | ' The tools location (first).
|
---|
1567 | if (strPathDXSDK = "") And (g_blnInternalFirst = True) then
|
---|
1568 | str = g_strPathDev & "/win.x86/dxsdk/200610"
|
---|
1569 | if CheckForDirectXSDKSub(str) then strPathDXSDK = str
|
---|
1570 | end if
|
---|
1571 |
|
---|
1572 | ' Check the installer registry (sucks a bit).
|
---|
1573 | arrSubKeys = RegEnumSubKeys("HKLM", "SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData")
|
---|
1574 | for Each strSubKey In arrSubKeys
|
---|
1575 | strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\" & strSubKey & "\Products"
|
---|
1576 | arrSubKeys2 = RegEnumSubKeys("HKLM", strKey)
|
---|
1577 | for Each strSubKey2 In arrSubKeys2
|
---|
1578 | strKey2 = "HKLM\" & strKey & "\" & strSubKey2 & "\InstallProperties"
|
---|
1579 | str = RegGetString(strKey2 & "\DisplayName")
|
---|
1580 | if InStr(1, str, "Microsoft DirectX SDK") > 0 then
|
---|
1581 | str = RegGetString(strKey2 & "\InstallLocation")
|
---|
1582 | if (str <> "") And (strPathDXSDK = "") then
|
---|
1583 | if CheckForDirectXSDKSub(str) then
|
---|
1584 | strPathDXSDK = str
|
---|
1585 | Exit For
|
---|
1586 | end if
|
---|
1587 | end if
|
---|
1588 | end if
|
---|
1589 | Next
|
---|
1590 | Next
|
---|
1591 |
|
---|
1592 | ' The tools location (post).
|
---|
1593 | if (strPathDXSDK = "") And (g_blnInternalFirst = False) then
|
---|
1594 | str = g_strPathDev & "/win.x86/dxsdk/200610"
|
---|
1595 | if CheckForDirectXSDKSub(str) then strPathDXSDK = str
|
---|
1596 | end if
|
---|
1597 |
|
---|
1598 | ' Give up.
|
---|
1599 | if strPathDXSDK = "" then
|
---|
1600 | MsgError "Cannot find a suitable Direct X SDK. Check configure.log and the build requirements."
|
---|
1601 | exit sub
|
---|
1602 | end if
|
---|
1603 |
|
---|
1604 | '
|
---|
1605 | ' Emit the config.
|
---|
1606 | '
|
---|
1607 | strPathDXSDK = UnixSlashes(PathAbs(strPathDXSDK))
|
---|
1608 | CfgPrint "PATH_SDK_DXSDK := " & strPathDXSDK
|
---|
1609 | CfgPrint "PATH_SDK_DXSDKX86 = $(PATH_SDK_DXSDK)"
|
---|
1610 | CfgPrint "PATH_SDK_DXSDKAMD64 = $(PATH_SDK_DXSDK)"
|
---|
1611 |
|
---|
1612 | PrintResult "Direct X SDK", strPathDXSDK
|
---|
1613 | end sub
|
---|
1614 |
|
---|
1615 | '' Quick check if the DXSDK is in the specified directory or not.
|
---|
1616 | function CheckForDirectXSDKSub(strPathDXSDK)
|
---|
1617 | CheckForDirectXSDKSub = False
|
---|
1618 | LogPrint "trying: strPathDXSDK=" & strPathDXSDK
|
---|
1619 | if LogFileExists(strPathDXSDK, "Lib/x86/dxguid.lib") _
|
---|
1620 | then
|
---|
1621 | '' @todo figure out a way we can verify the version/build!
|
---|
1622 | CheckForDirectXSDKSub = True
|
---|
1623 | end if
|
---|
1624 | end function
|
---|
1625 |
|
---|
1626 |
|
---|
1627 | ''
|
---|
1628 | ' Checks for a MingW32 suitable for building the recompiler.
|
---|
1629 | '
|
---|
1630 | ' strOptW32API is currently ignored.
|
---|
1631 | '
|
---|
1632 | sub CheckForMingW(strOptMingw, strOptW32API)
|
---|
1633 | dim strPathMingW, strPathW32API, str
|
---|
1634 | PrintHdr "MinGW GCC v3.3.x + Binutils + Runtime + W32API"
|
---|
1635 |
|
---|
1636 | '
|
---|
1637 | ' Find the MinGW and W32API tools.
|
---|
1638 | '
|
---|
1639 | strPathMingW = ""
|
---|
1640 | strPathW32API = ""
|
---|
1641 |
|
---|
1642 | ' The specified path.
|
---|
1643 | if (strPathMingW = "") And (strOptMingW <> "") then
|
---|
1644 | if CheckForMingWSub(strOptMingW, strOptW32API) then
|
---|
1645 | strPathMingW = strOptMingW
|
---|
1646 | strPathW32API = strOptW32API
|
---|
1647 | end if
|
---|
1648 | end if
|
---|
1649 |
|
---|
1650 | ' The tools location (first).
|
---|
1651 | if (strPathMingW = "") And (g_blnInternalFirst = True) then
|
---|
1652 | str = g_strPathDev & "/win.x86/mingw32/v3.3.3"
|
---|
1653 | str2 = g_strPathDev & "/win.x86/w32api/v2.5"
|
---|
1654 | if CheckForMingWSub(str, str2) then
|
---|
1655 | strPathMingW = str
|
---|
1656 | strPathW32API = str2
|
---|
1657 | end if
|
---|
1658 | end if
|
---|
1659 |
|
---|
1660 | ' See if there is any gcc around.
|
---|
1661 | if strPathMingW = "" then
|
---|
1662 | str = Which("mingw32-gcc.exe")
|
---|
1663 | if (str <> "") then
|
---|
1664 | str = PathParent(PathStripFilename(str))
|
---|
1665 | if CheckForMingWSub(str, str) then strPathMingW = str
|
---|
1666 | end if
|
---|
1667 | end if
|
---|
1668 |
|
---|
1669 | if strPathMingW = "" then
|
---|
1670 | str = Which("gcc.exe")
|
---|
1671 | if (str <> "") then
|
---|
1672 | str = PathParent(PathStripFilename(str))
|
---|
1673 | if CheckForMingWSub(str, str) then strPathMingW = str
|
---|
1674 | end if
|
---|
1675 | end if
|
---|
1676 |
|
---|
1677 | ' The tools location (post).
|
---|
1678 | if (strPathMingW = "") And (g_blnInternalFirst = False) then
|
---|
1679 | str = g_strPathDev & "/win.x86/mingw32/v3.3.3"
|
---|
1680 | str2 = g_strPathDev & "/win.x86/w32api/v2.5"
|
---|
1681 | if CheckForMingWSub(str, str2) then
|
---|
1682 | strPathMingW = str
|
---|
1683 | strPathW32API = str2
|
---|
1684 | end if
|
---|
1685 | end if
|
---|
1686 |
|
---|
1687 | ' Success?
|
---|
1688 | if strPathMingW = "" then
|
---|
1689 | if strOptMingw = "" then
|
---|
1690 | MsgError "Can't locate a suitable MinGW installation. Try specify the path with " _
|
---|
1691 | & "the --with-MinGW=<path> argument. If still no luck, consult the configure.log and the build requirements."
|
---|
1692 | else
|
---|
1693 | MsgError "Can't locate a suitable MinGW installation. Please consult the configure.log and the build requirements."
|
---|
1694 | end if
|
---|
1695 | exit sub
|
---|
1696 | end if
|
---|
1697 |
|
---|
1698 | '
|
---|
1699 | ' Emit the config.
|
---|
1700 | '
|
---|
1701 | strPathMingW = UnixSlashes(PathAbs(strPathMingW))
|
---|
1702 | CfgPrint "PATH_TOOL_MINGW32 := " & strPathMingW
|
---|
1703 | PrintResult "MinGW (GCC v" & g_strSubOutput & ")", strPathMingW
|
---|
1704 | if (strPathMingW = strPathW32API) Or strPathW32API = "" then
|
---|
1705 | CfgPrint "PATH_SDK_W32API = $(PATH_TOOL_MINGW32)"
|
---|
1706 | else
|
---|
1707 | CfgPrint "PATH_SDK_W32API = " & strPathW32API
|
---|
1708 | PrintResult "W32API", strPathW32API
|
---|
1709 | end if
|
---|
1710 | end sub
|
---|
1711 |
|
---|
1712 | ''
|
---|
1713 | ' Checks if the specified path points to an usable MinGW or not.
|
---|
1714 | function CheckForMingWSub(strPathMingW, strPathW32API)
|
---|
1715 | g_strSubOutput = ""
|
---|
1716 | if strPathW32API = "" then strPathW32API = strPathMingW
|
---|
1717 | LogPrint "trying: strPathMingW=" &strPathMingW & " strPathW32API=" & strPathW32API
|
---|
1718 |
|
---|
1719 | if LogFileExists(strPathMingW, "bin/mingw32-gcc.exe") _
|
---|
1720 | And LogFileExists(strPathMingW, "bin/ld.exe") _
|
---|
1721 | And LogFileExists(strPathMingW, "bin/objdump.exe") _
|
---|
1722 | And LogFileExists(strPathMingW, "bin/dllwrap.exe") _
|
---|
1723 | And LogFileExists(strPathMingW, "bin/as.exe") _
|
---|
1724 | And LogFileExists(strPathMingW, "include/string.h") _
|
---|
1725 | And LogFileExists(strPathMingW, "include/_mingw.h") _
|
---|
1726 | And LogFileExists(strPathMingW, "lib/dllcrt1.o") _
|
---|
1727 | And LogFileExists(strPathMingW, "lib/dllcrt2.o") _
|
---|
1728 | And LogFileExists(strPathMingW, "lib/libmsvcrt.a") _
|
---|
1729 | _
|
---|
1730 | And LogFileExists(strPathW32API, "lib/libkernel32.a") _
|
---|
1731 | And LogFileExists(strPathW32API, "include/windows.h") _
|
---|
1732 | then
|
---|
1733 | if Shell(DosSlashes(strPathMingW & "/bin/gcc.exe") & " --version", True) = 0 then
|
---|
1734 | dim offVer, iMajor, iMinor, iPatch, strVer
|
---|
1735 |
|
---|
1736 | ' extract the version.
|
---|
1737 | strVer = ""
|
---|
1738 | offVer = InStr(1, g_strShellOutput, "(GCC) ")
|
---|
1739 | if offVer > 0 then
|
---|
1740 | strVer = LTrim(Mid(g_strShellOutput, offVer + Len("(GCC) ")))
|
---|
1741 | strVer = RTrim(Left(strVer, InStr(1, strVer, " ")))
|
---|
1742 | if (Mid(strVer, 2, 1) = ".") _
|
---|
1743 | And (Mid(strVer, 4, 1) = ".") then
|
---|
1744 | iMajor = Int(Left(strVer, 1)) ' Is Int() the right thing here? I want atoi()!!!
|
---|
1745 | iMinor = Int(Mid(strVer, 3, 1))
|
---|
1746 | iPatch = Int(Mid(strVer, 5))
|
---|
1747 | else
|
---|
1748 | LogPrint "Malformed version: '" & strVer & "'"
|
---|
1749 | strVer = ""
|
---|
1750 | end if
|
---|
1751 | end if
|
---|
1752 | if strVer <> "" then
|
---|
1753 | if (iMajor = 3) And (iMinor = 3) then
|
---|
1754 | CheckForMingWSub = True
|
---|
1755 | g_strSubOutput = strVer
|
---|
1756 | else
|
---|
1757 | LogPrint "MinGW version '" & iMajor & "." & iMinor & "." & iPatch & "' is not supported (or configure.vbs failed to parse it correctly)."
|
---|
1758 | end if
|
---|
1759 | else
|
---|
1760 | LogPrint "Couldn't locate the GCC version in the output!"
|
---|
1761 | end if
|
---|
1762 |
|
---|
1763 | else
|
---|
1764 | LogPrint "Failed to run gcc.exe!"
|
---|
1765 | end if
|
---|
1766 | end if
|
---|
1767 | end function
|
---|
1768 |
|
---|
1769 |
|
---|
1770 | ''
|
---|
1771 | ' Checks for any libSDL binaries.
|
---|
1772 | sub CheckForlibSDL(strOptlibSDL)
|
---|
1773 | dim strPathlibSDL, str
|
---|
1774 | PrintHdr "libSDL"
|
---|
1775 |
|
---|
1776 | '
|
---|
1777 | ' Try find some SDL library.
|
---|
1778 | '
|
---|
1779 |
|
---|
1780 | ' First, the specific location.
|
---|
1781 | strPathlibSDL = ""
|
---|
1782 | if (strPathlibSDL = "") And (strOptlibSDL <> "") then
|
---|
1783 | if CheckForlibSDLSub(strOptlibSDL) then strPathlibSDL = strOptlibSDL
|
---|
1784 | end if
|
---|
1785 |
|
---|
1786 | ' The tools location (first).
|
---|
1787 | if (strPathlibSDL = "") And (g_blnInternalFirst = True) Then
|
---|
1788 | str = g_strPathDev & "/win.x86/libsdl/v1.2.11"
|
---|
1789 | if CheckForlibSDLSub(str) then strPathlibSDL = str
|
---|
1790 | end if
|
---|
1791 |
|
---|
1792 | if (strPathlibSDL = "") And (g_blnInternalFirst = True) Then
|
---|
1793 | str = g_strPathDev & "/win.x86/libsdl/v1.2.7-InnoTek"
|
---|
1794 | if CheckForlibSDLSub(str) then strPathlibSDL = str
|
---|
1795 | end if
|
---|
1796 |
|
---|
1797 | ' Poke about in the path.
|
---|
1798 | str = Which("SDLmain.lib")
|
---|
1799 | if (strPathlibSDL = "") And (str <> "") Then
|
---|
1800 | str = PathParent(PathStripFilename(str))
|
---|
1801 | if CheckForlibSDLSub(str) then strPathlibSDL = str
|
---|
1802 | end if
|
---|
1803 |
|
---|
1804 | str = Which("SDL.dll")
|
---|
1805 | if (strPathlibSDL = "") And (str <> "") Then
|
---|
1806 | str = PathParent(PathStripFilename(str))
|
---|
1807 | if CheckForlibSDLSub(str) then strPathlibSDL = str
|
---|
1808 | end if
|
---|
1809 |
|
---|
1810 | ' The tools location (post).
|
---|
1811 | if (strPathlibSDL = "") And (g_blnInternalFirst = False) Then
|
---|
1812 | str = g_strPathDev & "/win.x86/libsdl/v1.2.11"
|
---|
1813 | if CheckForlibSDLSub(str) then strPathlibSDL = str
|
---|
1814 | end if
|
---|
1815 |
|
---|
1816 | if (strPathlibSDL = "") And (g_blnInternalFirst = False) Then
|
---|
1817 | str = g_strPathDev & "/win.x86/libsdl/v1.2.7-InnoTek"
|
---|
1818 | if CheckForlibSDLSub(str) then strPathlibSDL = str
|
---|
1819 | end if
|
---|
1820 |
|
---|
1821 | ' Success?
|
---|
1822 | if strPathlibSDL = "" then
|
---|
1823 | if strOptlibSDL = "" then
|
---|
1824 | MsgError "Can't locate libSDL. Try specify the path with the --with-libSDL=<path> argument. " _
|
---|
1825 | & "If still no luck, consult the configure.log and the build requirements."
|
---|
1826 | else
|
---|
1827 | MsgError "Can't locate libSDL. Please consult the configure.log and the build requirements."
|
---|
1828 | end if
|
---|
1829 | exit sub
|
---|
1830 | end if
|
---|
1831 |
|
---|
1832 | strPathLibSDL = UnixSlashes(PathAbs(strPathLibSDL))
|
---|
1833 | CfgPrint "PATH_SDK_LIBSDL := " & strPathlibSDL
|
---|
1834 |
|
---|
1835 | PrintResult "libSDL", strPathlibSDL
|
---|
1836 | end sub
|
---|
1837 |
|
---|
1838 | ''
|
---|
1839 | ' Checks if the specified path points to an usable libSDL or not.
|
---|
1840 | function CheckForlibSDLSub(strPathlibSDL)
|
---|
1841 | CheckForlibSDLSub = False
|
---|
1842 | LogPrint "trying: strPathlibSDL=" & strPathlibSDL
|
---|
1843 | if LogFileExists(strPathlibSDL, "lib/SDL.lib") _
|
---|
1844 | And LogFileExists(strPathlibSDL, "lib/SDLmain.lib") _
|
---|
1845 | And LogFileExists(strPathlibSDL, "lib/SDL.dll") _
|
---|
1846 | And LogFileExists(strPathlibSDL, "include/SDL.h") _
|
---|
1847 | And LogFileExists(strPathlibSDL, "include/SDL_syswm.h") _
|
---|
1848 | And LogFileExists(strPathlibSDL, "include/SDL_version.h") _
|
---|
1849 | then
|
---|
1850 | CheckForlibSDLSub = True
|
---|
1851 | end if
|
---|
1852 | end function
|
---|
1853 |
|
---|
1854 |
|
---|
1855 | ''
|
---|
1856 | ' Checks for libxml2.
|
---|
1857 | sub CheckForXml2(strOptXml2)
|
---|
1858 | dim strPathXml2, str
|
---|
1859 | PrintHdr "libxml2"
|
---|
1860 |
|
---|
1861 | ' Skip if no COM/ATL.
|
---|
1862 | if g_blnDisableCOM then
|
---|
1863 | PrintResultMsg "libxml2", "Skipped (" & g_strDisableCOM & ")"
|
---|
1864 | exit sub
|
---|
1865 | end if
|
---|
1866 |
|
---|
1867 | '
|
---|
1868 | ' Try find some xml2 dll/lib.
|
---|
1869 | '
|
---|
1870 | strPathXml2 = ""
|
---|
1871 | if (strPathXml2 = "") And (strOptXml2 <> "") then
|
---|
1872 | if CheckForXml2Sub(strOptXml2) then strPathXml2 = strOptXml2
|
---|
1873 | end if
|
---|
1874 |
|
---|
1875 | if strPathXml2 = "" Then
|
---|
1876 | str = Which("libxml2.lib")
|
---|
1877 | if str <> "" Then
|
---|
1878 | str = PathParent(PathStripFilename(str))
|
---|
1879 | if CheckForXml2Sub(str) then strPathXml2 = str
|
---|
1880 | end if
|
---|
1881 | end if
|
---|
1882 |
|
---|
1883 | ' Ignore failure if we're in 'internal' mode.
|
---|
1884 | if (strPathXml2 = "") and g_blnInternalMode then
|
---|
1885 | PrintResultMsg "libxml2", "ignored (internal mode)"
|
---|
1886 | exit sub
|
---|
1887 | end if
|
---|
1888 |
|
---|
1889 | ' Success?
|
---|
1890 | if strPathXml2 = "" then
|
---|
1891 | if strOptXml2 = "" then
|
---|
1892 | MsgError "Can't locate libxml2. Try specify the path with the --with-libxml2=<path> argument. " _
|
---|
1893 | & "If still no luck, consult the configure.log and the build requirements."
|
---|
1894 | else
|
---|
1895 | MsgError "Can't locate libxml2. Please consult the configure.log and the build requirements."
|
---|
1896 | end if
|
---|
1897 | exit sub
|
---|
1898 | end if
|
---|
1899 |
|
---|
1900 | strPathXml2 = UnixSlashes(PathAbs(strPathXml2))
|
---|
1901 | CfgPrint "SDK_VBOX_LIBXML2_INCS := " & strPathXml2 & "/include"
|
---|
1902 | CfgPrint "SDK_VBOX_LIBXML2_LIBS := " & strPathXml2 & "/lib/libxml2.lib"
|
---|
1903 |
|
---|
1904 | PrintResult "libxml2", strPathXml2
|
---|
1905 | end sub
|
---|
1906 |
|
---|
1907 | ''
|
---|
1908 | ' Checks if the specified path points to an usable libxml2 or not.
|
---|
1909 | function CheckForXml2Sub(strPathXml2)
|
---|
1910 | dim str
|
---|
1911 |
|
---|
1912 | CheckForXml2Sub = False
|
---|
1913 | LogPrint "trying: strPathXml2=" & strPathXml2
|
---|
1914 | if LogFileExists(strPathXml2, "include/libxml/xmlexports.h") _
|
---|
1915 | And LogFileExists(strPathXml2, "include/libxml/xmlreader.h") _
|
---|
1916 | then
|
---|
1917 | str = LogFindFile(strPathXml2, "bin/libxml2.dll")
|
---|
1918 | if str <> "" then
|
---|
1919 | if LogFindFile(strPathXml2, "lib/libxml2.lib") <> "" then
|
---|
1920 | CheckForXml2Sub = True
|
---|
1921 | end if
|
---|
1922 | end if
|
---|
1923 | end if
|
---|
1924 | end function
|
---|
1925 |
|
---|
1926 |
|
---|
1927 | ''
|
---|
1928 | ' Checks for libxslt.
|
---|
1929 | sub CheckForXslt(strOptXslt)
|
---|
1930 | dim strPathXslt, str
|
---|
1931 | PrintHdr "libxslt"
|
---|
1932 |
|
---|
1933 | ' Skip if no COM/ATL.
|
---|
1934 | if g_blnDisableCOM then
|
---|
1935 | PrintResultMsg "libxslt", "Skipped (" & g_strDisableCOM & ")"
|
---|
1936 | exit sub
|
---|
1937 | end if
|
---|
1938 |
|
---|
1939 | '
|
---|
1940 | ' Try find some libxslt dll/lib.
|
---|
1941 | '
|
---|
1942 | strPathXslt = ""
|
---|
1943 | if (strPathXslt = "") And (strOptXslt <> "") then
|
---|
1944 | if CheckForXsltSub(strOptXslt) then strPathXslt = strOptXslt
|
---|
1945 | end if
|
---|
1946 |
|
---|
1947 | if strPathXslt = "" Then
|
---|
1948 | str = Which("libxslt.lib")
|
---|
1949 | if str <> "" Then
|
---|
1950 | str = PathParent(PathStripFilename(str))
|
---|
1951 | if CheckForXsltSub(str) then strPathXslt = str
|
---|
1952 | end if
|
---|
1953 | end if
|
---|
1954 |
|
---|
1955 | if strPathXslt = "" Then
|
---|
1956 | str = Which("libxslt.dll")
|
---|
1957 | if str <> "" Then
|
---|
1958 | str = PathParent(PathStripFilename(str))
|
---|
1959 | if CheckForXsltSub(str) then strPathXslt = str
|
---|
1960 | end if
|
---|
1961 | end if
|
---|
1962 |
|
---|
1963 | ' Ignore failure if we're in 'internal' mode.
|
---|
1964 | if (strPathXslt = "") and g_blnInternalMode then
|
---|
1965 | PrintResultMsg "libxslt", "ignored (internal mode)"
|
---|
1966 | exit sub
|
---|
1967 | end if
|
---|
1968 |
|
---|
1969 | ' Success?
|
---|
1970 | if strPathXslt = "" then
|
---|
1971 | if strOptXslt = "" then
|
---|
1972 | MsgError "Can't locate libxslt. Try specify the path with the --with-libxslt=<path> argument. " _
|
---|
1973 | & "If still no luck, consult the configure.log and the build requirements."
|
---|
1974 | else
|
---|
1975 | MsgError "Can't locate libxslt. Please consult the configure.log and the build requirements."
|
---|
1976 | end if
|
---|
1977 | exit sub
|
---|
1978 | end if
|
---|
1979 |
|
---|
1980 | strPathXslt = UnixSlashes(PathAbs(strPathXslt))
|
---|
1981 | CfgPrint "SDK_VBOX_LIBXSLT_INCS := " & strPathXslt & "/include"
|
---|
1982 | CfgPrint "SDK_VBOX_LIBXSLT_LIBS := " & strPathXslt & "/lib/libxslt.lib"
|
---|
1983 |
|
---|
1984 | PrintResult "libxslt", strPathXslt
|
---|
1985 | end sub
|
---|
1986 |
|
---|
1987 |
|
---|
1988 | ''
|
---|
1989 | ' Checks if the specified path points to an usable libxslt or not.
|
---|
1990 | function CheckForXsltSub(strPathXslt)
|
---|
1991 | dim str
|
---|
1992 |
|
---|
1993 | CheckForXsltSub = False
|
---|
1994 | LogPrint "trying: strPathXslt=" & strPathXslt
|
---|
1995 |
|
---|
1996 | if LogFileExists(strPathXslt, "include/libxslt/namespaces.h") _
|
---|
1997 | And LogFileExists(strPathXslt, "include/libxslt/xsltutils.h") _
|
---|
1998 | then
|
---|
1999 | str = LogFindFile(strPathXslt, "lib/libxslt.dll")
|
---|
2000 | if str <> "" then
|
---|
2001 | if LogFileExists(strPathXslt, "lib/libxslt.lib") _
|
---|
2002 | then
|
---|
2003 | CheckForXsltSub = True
|
---|
2004 | end if
|
---|
2005 | end if
|
---|
2006 | end if
|
---|
2007 | end function
|
---|
2008 |
|
---|
2009 |
|
---|
2010 | ''
|
---|
2011 | ' Checks for openssl
|
---|
2012 | sub CheckForSsl(strOptSsl)
|
---|
2013 | dim strPathSsl, str
|
---|
2014 | PrintHdr "openssl"
|
---|
2015 |
|
---|
2016 | '
|
---|
2017 | ' Try find some openssl dll/lib.
|
---|
2018 | '
|
---|
2019 | strPathSsl = ""
|
---|
2020 | if (strPathSsl = "") And (strOptSsl <> "") then
|
---|
2021 | if CheckForSslSub(strOptSsl) then strPathSsl = strOptSsl
|
---|
2022 | end if
|
---|
2023 |
|
---|
2024 | if strPathSsl = "" Then
|
---|
2025 | str = Which("ssleay32.lib")
|
---|
2026 | if str <> "" Then
|
---|
2027 | str = PathParent(PathStripFilename(str))
|
---|
2028 | if CheckForSslSub(str) then strPathSsl = str
|
---|
2029 | end if
|
---|
2030 | end if
|
---|
2031 |
|
---|
2032 | ' Ignore failure if we're in 'internal' mode.
|
---|
2033 | if (strPathSsl = "") and g_blnInternalMode then
|
---|
2034 | PrintResultMsg "openssl", "ignored (internal mode)"
|
---|
2035 | exit sub
|
---|
2036 | end if
|
---|
2037 |
|
---|
2038 | ' Success?
|
---|
2039 | if strPathSsl = "" then
|
---|
2040 | if strOptSsl = "" then
|
---|
2041 | MsgError "Can't locate openssl. Try specify the path with the --with-openssl=<path> argument. " _
|
---|
2042 | & "If still no luck, consult the configure.log and the build requirements."
|
---|
2043 | else
|
---|
2044 | MsgError "Can't locate openssl. Please consult the configure.log and the build requirements."
|
---|
2045 | end if
|
---|
2046 | exit sub
|
---|
2047 | end if
|
---|
2048 |
|
---|
2049 | strPathSsl = UnixSlashes(PathAbs(strPathSsl))
|
---|
2050 | CfgPrint "SDK_VBOX_OPENSSL_INCS := " & strPathSsl & "/include"
|
---|
2051 | CfgPrint "SDK_VBOX_OPENSSL_LIBS := " & strPathSsl & "/lib/ssleay32.lib" & " " & strPathSsl & "/lib/libeay32.lib"
|
---|
2052 | CfgPrint "SDK_VBOX_BLD_OPENSSL_LIBS := " & strPathSsl & "/lib/ssleay32.lib" & " " & strPathSsl & "/lib/libeay32.lib"
|
---|
2053 |
|
---|
2054 | PrintResult "openssl", strPathSsl
|
---|
2055 | end sub
|
---|
2056 |
|
---|
2057 | ''
|
---|
2058 | ' Checks if the specified path points to an usable openssl or not.
|
---|
2059 | function CheckForSslSub(strPathSsl)
|
---|
2060 |
|
---|
2061 | CheckForSslSub = False
|
---|
2062 | LogPrint "trying: strPathSsl=" & strPathSsl
|
---|
2063 | if LogFileExists(strPathSsl, "include/openssl/md5.h") _
|
---|
2064 | And LogFindFile(strPathSsl, "bin/ssleay32.dll") <> "" _
|
---|
2065 | And LogFindFile(strPathSsl, "lib/ssleay32.lib") <> "" _
|
---|
2066 | And LogFindFile(strPathSsl, "bin/libeay32.dll") <> "" _
|
---|
2067 | And LogFindFile(strPathSsl, "lib/libeay32.lib") <> "" _
|
---|
2068 | then
|
---|
2069 | CheckForSslSub = True
|
---|
2070 | end if
|
---|
2071 | end function
|
---|
2072 |
|
---|
2073 |
|
---|
2074 | ''
|
---|
2075 | ' Checks for libcurl
|
---|
2076 | sub CheckForCurl(strOptCurl)
|
---|
2077 | dim strPathCurl, str
|
---|
2078 | PrintHdr "libcurl"
|
---|
2079 |
|
---|
2080 | '
|
---|
2081 | ' Try find some cURL dll/lib.
|
---|
2082 | '
|
---|
2083 | strPathCurl = ""
|
---|
2084 | if (strPathCurl = "") And (strOptCurl <> "") then
|
---|
2085 | if CheckForCurlSub(strOptCurl) then strPathCurl = strOptCurl
|
---|
2086 | end if
|
---|
2087 |
|
---|
2088 | if strPathCurl = "" Then
|
---|
2089 | str = Which("libcurl.lib")
|
---|
2090 | if str <> "" Then
|
---|
2091 | str = PathParent(PathStripFilename(str))
|
---|
2092 | if CheckForCurlSub(str) then strPathCurl = str
|
---|
2093 | end if
|
---|
2094 | end if
|
---|
2095 |
|
---|
2096 | ' Ignore failure if we're in 'internal' mode.
|
---|
2097 | if (strPathCurl = "") and g_blnInternalMode then
|
---|
2098 | PrintResultMsg "curl", "ignored (internal mode)"
|
---|
2099 | exit sub
|
---|
2100 | end if
|
---|
2101 |
|
---|
2102 | ' Success?
|
---|
2103 | if strPathCurl = "" then
|
---|
2104 | if strOptCurl = "" then
|
---|
2105 | MsgError "Can't locate libcurl. Try specify the path with the --with-libcurl=<path> argument. " _
|
---|
2106 | & "If still no luck, consult the configure.log and the build requirements."
|
---|
2107 | else
|
---|
2108 | MsgError "Can't locate libcurl. Please consult the configure.log and the build requirements."
|
---|
2109 | end if
|
---|
2110 | exit sub
|
---|
2111 | end if
|
---|
2112 |
|
---|
2113 | strPathCurl = UnixSlashes(PathAbs(strPathCurl))
|
---|
2114 | CfgPrint "SDK_VBOX_LIBCURL_INCS := " & strPathCurl & "/include"
|
---|
2115 | CfgPrint "SDK_VBOX_LIBCURL_LIBS := " & strPathCurl & "/libcurl.lib"
|
---|
2116 |
|
---|
2117 | PrintResult "libcurl", strPathCurl
|
---|
2118 | end sub
|
---|
2119 |
|
---|
2120 | ''
|
---|
2121 | ' Checks if the specified path points to an usable libcurl or not.
|
---|
2122 | function CheckForCurlSub(strPathCurl)
|
---|
2123 |
|
---|
2124 | CheckForCurlSub = False
|
---|
2125 | LogPrint "trying: strPathCurl=" & strPathCurl
|
---|
2126 | if LogFileExists(strPathCurl, "include/curl/curl.h") _
|
---|
2127 | And LogFindFile(strPathCurl, "libcurl.dll") <> "" _
|
---|
2128 | And LogFindFile(strPathCurl, "libcurl.lib") <> "" _
|
---|
2129 | then
|
---|
2130 | CheckForCurlSub = True
|
---|
2131 | end if
|
---|
2132 | end function
|
---|
2133 |
|
---|
2134 |
|
---|
2135 |
|
---|
2136 | ''
|
---|
2137 | ''
|
---|
2138 | ' Checks for any Qt4 binaries.
|
---|
2139 | sub CheckForQt4(strOptQt4)
|
---|
2140 | dim strPathQt4
|
---|
2141 |
|
---|
2142 | PrintHdr "Qt4"
|
---|
2143 |
|
---|
2144 | '
|
---|
2145 | ' Try to find the Qt4 installation (user specified path with --with-qt4)
|
---|
2146 | '
|
---|
2147 | strPathQt4 = ""
|
---|
2148 |
|
---|
2149 | LogPrint "Checking for user specified path of Qt4 ... "
|
---|
2150 | if (strPathQt4 = "") And (strOptQt4 <> "") then
|
---|
2151 | strOptQt4 = UnixSlashes(strOptQt4)
|
---|
2152 | if CheckForQt4Sub(strOptQt4) then strPathQt4 = strOptQt4
|
---|
2153 | end if
|
---|
2154 |
|
---|
2155 | if strPathQt4 = "" then
|
---|
2156 | CfgPrint "VBOX_WITH_QT4GUI="
|
---|
2157 | PrintResultMsg "Qt4", "not found"
|
---|
2158 | else
|
---|
2159 | CfgPrint "PATH_SDK_QT4 := " & strPathQt4
|
---|
2160 | CfgPrint "PATH_TOOL_QT4 = $(PATH_SDK_QT4)"
|
---|
2161 | CfgPrint "VBOX_PATH_QT4 = $(PATH_SDK_QT4)"
|
---|
2162 | PrintResult "Qt4 ", strPathQt4
|
---|
2163 | end if
|
---|
2164 | end sub
|
---|
2165 |
|
---|
2166 |
|
---|
2167 | '
|
---|
2168 | '
|
---|
2169 | function CheckForQt4Sub(strPathQt4)
|
---|
2170 |
|
---|
2171 | CheckForQt4Sub = False
|
---|
2172 | LogPrint "trying: strPathQt4=" & strPathQt4
|
---|
2173 |
|
---|
2174 | if LogFileExists(strPathQt4, "bin/moc.exe") _
|
---|
2175 | And LogFileExists(strPathQt4, "bin/uic.exe") _
|
---|
2176 | And LogFileExists(strPathQt4, "include/Qt/qwidget.h") _
|
---|
2177 | And LogFileExists(strPathQt4, "include/QtGui/QApplication") _
|
---|
2178 | And LogFileExists(strPathQt4, "include/QtNetwork/QHostAddress") _
|
---|
2179 | And ( LogFileExists(strPathQt4, "lib/QtCore4.lib") _
|
---|
2180 | Or LogFileExists(strPathQt4, "lib/VBoxQtCore4.lib") _
|
---|
2181 | Or LogFileExists(strPathQt4, "lib/QtCoreVBox4.lib")) _
|
---|
2182 | And ( LogFileExists(strPathQt4, "lib/QtNetwork4.lib") _
|
---|
2183 | Or LogFileExists(strPathQt4, "lib/VBoxQtNetwork4.lib") _
|
---|
2184 | Or LogFileExists(strPathQt4, "lib/QtNetworkVBox4.lib")) _
|
---|
2185 | then
|
---|
2186 | CheckForQt4Sub = True
|
---|
2187 | end if
|
---|
2188 |
|
---|
2189 | end function
|
---|
2190 |
|
---|
2191 |
|
---|
2192 | '
|
---|
2193 | '
|
---|
2194 | function CheckForPython(strPathPython)
|
---|
2195 |
|
---|
2196 | PrintHdr "Python"
|
---|
2197 |
|
---|
2198 | CheckForPython = False
|
---|
2199 | LogPrint "trying: strPathPython=" & strPathPython
|
---|
2200 |
|
---|
2201 | if LogFileExists(strPathPython, "python.exe") then
|
---|
2202 | CfgPrint "VBOX_BLD_PYTHON := " & strPathPython & "\python.exe"
|
---|
2203 | CheckForPython = True
|
---|
2204 | end if
|
---|
2205 |
|
---|
2206 | PrintResult "Python ", strPathPython
|
---|
2207 | end function
|
---|
2208 |
|
---|
2209 |
|
---|
2210 | '
|
---|
2211 | '
|
---|
2212 | function CheckForMkisofs(strFnameMkisofs)
|
---|
2213 |
|
---|
2214 | PrintHdr "mkisofs"
|
---|
2215 |
|
---|
2216 | CheckForMkisofs = False
|
---|
2217 | LogPrint "trying: strFnameMkisofs=" & strFnameMkisofs
|
---|
2218 |
|
---|
2219 | if FileExists(strFnameMkisofs) = false then
|
---|
2220 | LogPrint "Testing '" & strFnameMkisofs & " not found"
|
---|
2221 | else
|
---|
2222 | CfgPrint "VBOX_MKISOFS := " & strFnameMkisofs
|
---|
2223 | CheckForMkisofs = True
|
---|
2224 | end if
|
---|
2225 |
|
---|
2226 | PrintResult "mkisofs ", strFnameMkisofs
|
---|
2227 | end function
|
---|
2228 |
|
---|
2229 |
|
---|
2230 | ''
|
---|
2231 | ' Show usage.
|
---|
2232 | sub usage
|
---|
2233 | Print "Usage: cscript configure.vbs [options]"
|
---|
2234 | Print ""
|
---|
2235 | Print "Configuration:"
|
---|
2236 | Print " -h, --help"
|
---|
2237 | Print " --internal"
|
---|
2238 | Print " --internal-last"
|
---|
2239 | Print ""
|
---|
2240 | Print "Components:"
|
---|
2241 | Print " --disable-COM"
|
---|
2242 | Print " --disable-UDPTunnel"
|
---|
2243 | Print ""
|
---|
2244 | Print "Locations:"
|
---|
2245 | Print " --with-DDK=PATH "
|
---|
2246 | Print " --with-DXSDK=PATH "
|
---|
2247 | Print " --with-kBuild=PATH "
|
---|
2248 | Print " --with-libSDL=PATH "
|
---|
2249 | Print " --with-MinGW=PATH "
|
---|
2250 | Print " --with-Qt4=PATH "
|
---|
2251 | Print " --with-SDK=PATH "
|
---|
2252 | Print " --with-VC=PATH "
|
---|
2253 | Print " --with-VC-Common=PATH "
|
---|
2254 | Print " --with-VC-Express-Edition"
|
---|
2255 | Print " --with-W32API=PATH "
|
---|
2256 | Print " --with-libxml2=PATH "
|
---|
2257 | Print " --with-libxslt=PATH "
|
---|
2258 | Print " --with-openssl=PATH "
|
---|
2259 | Print " --with-libcurl=PATH "
|
---|
2260 | Print " --with-python=PATH "
|
---|
2261 | end sub
|
---|
2262 |
|
---|
2263 |
|
---|
2264 | ''
|
---|
2265 | ' The main() like function.
|
---|
2266 | '
|
---|
2267 | Sub Main
|
---|
2268 | '
|
---|
2269 | ' Write the log header and check that we're not using wscript.
|
---|
2270 | '
|
---|
2271 | LogInit
|
---|
2272 | If UCase(Right(Wscript.FullName, 11)) = "WSCRIPT.EXE" Then
|
---|
2273 | Wscript.Echo "This script must be run under CScript."
|
---|
2274 | Wscript.Quit(1)
|
---|
2275 | End If
|
---|
2276 |
|
---|
2277 | '
|
---|
2278 | ' Parse arguments.
|
---|
2279 | '
|
---|
2280 | strOptDDK = ""
|
---|
2281 | strOptDXDDK = ""
|
---|
2282 | strOptkBuild = ""
|
---|
2283 | strOptlibSDL = ""
|
---|
2284 | strOptMingW = ""
|
---|
2285 | strOptQt4 = ""
|
---|
2286 | strOptSDK = ""
|
---|
2287 | strOptVC = ""
|
---|
2288 | strOptVCCommon = ""
|
---|
2289 | blnOptVCExpressEdition = False
|
---|
2290 | strOptW32API = ""
|
---|
2291 | strOptXml2 = ""
|
---|
2292 | strOptXslt = ""
|
---|
2293 | strOptSsl = ""
|
---|
2294 | strOptCurl = ""
|
---|
2295 | strOptPython = ""
|
---|
2296 | strOptMkisofs = ""
|
---|
2297 | blnOptDisableCOM = False
|
---|
2298 | blnOptDisableUDPTunnel = False
|
---|
2299 | for i = 1 to Wscript.Arguments.Count
|
---|
2300 | dim str, strArg, strPath
|
---|
2301 |
|
---|
2302 | ' Separate argument and path value
|
---|
2303 | str = Wscript.Arguments.item(i - 1)
|
---|
2304 | if InStr(1, str, "=") > 0 then
|
---|
2305 | strArg = Mid(str, 1, InStr(1, str, "=") - 1)
|
---|
2306 | strPath = Mid(str, InStr(1, str, "=") + 1)
|
---|
2307 | if strPath = "" then MsgFatal "Syntax error! Argument #" & i & " is missing the path."
|
---|
2308 | else
|
---|
2309 | strArg = str
|
---|
2310 | strPath = ""
|
---|
2311 | end if
|
---|
2312 |
|
---|
2313 | ' Process the argument
|
---|
2314 | select case LCase(strArg)
|
---|
2315 | case "--with-ddk"
|
---|
2316 | strOptDDK = strPath
|
---|
2317 | case "--with-dxsdk"
|
---|
2318 | strOptDXSDK = strPath
|
---|
2319 | case "--with-kbuild"
|
---|
2320 | strOptkBuild = strPath
|
---|
2321 | case "--with-libsdl"
|
---|
2322 | strOptlibSDL = strPath
|
---|
2323 | case "--with-mingw"
|
---|
2324 | strOptMingW = strPath
|
---|
2325 | case "--with-qt4"
|
---|
2326 | strOptQt4 = strPath
|
---|
2327 | case "--with-sdk"
|
---|
2328 | strOptSDK = strPath
|
---|
2329 | case "--with-vc"
|
---|
2330 | strOptVC = strPath
|
---|
2331 | case "--with-vc-common"
|
---|
2332 | strOptVCCommon = strPath
|
---|
2333 | case "--with-vc-express-edition"
|
---|
2334 | blnOptVCExpressEdition = True
|
---|
2335 | case "--with-w32api"
|
---|
2336 | strOptW32API = strPath
|
---|
2337 | case "--with-libxml2"
|
---|
2338 | strOptXml2 = strPath
|
---|
2339 | case "--with-libxslt"
|
---|
2340 | strOptXslt = strPath
|
---|
2341 | case "--with-openssl"
|
---|
2342 | strOptSsl = strPath
|
---|
2343 | case "--with-libcurl"
|
---|
2344 | strOptCurl = strPath
|
---|
2345 | case "--with-python"
|
---|
2346 | strOptPython = strPath
|
---|
2347 | case "--with-mkisofs"
|
---|
2348 | strOptMkisofs = strPath
|
---|
2349 | case "--disable-com"
|
---|
2350 | blnOptDisableCOM = True
|
---|
2351 | case "--enable-com"
|
---|
2352 | blnOptDisableCOM = False
|
---|
2353 | case "--disable-udptunnel"
|
---|
2354 | blnOptDisableUDPTunnel = True
|
---|
2355 | case "--internal"
|
---|
2356 | g_blnInternalMode = True
|
---|
2357 | case "--internal-last"
|
---|
2358 | g_blnInternalFirst = False
|
---|
2359 | case "-h", "--help", "-?"
|
---|
2360 | usage
|
---|
2361 | Wscript.Quit(0)
|
---|
2362 | case else
|
---|
2363 | Wscript.echo "syntax error: Unknown option '" & str &"'."
|
---|
2364 | usage
|
---|
2365 | Wscript.Quit(1)
|
---|
2366 | end select
|
---|
2367 | next
|
---|
2368 |
|
---|
2369 | '
|
---|
2370 | ' Initialize output files.
|
---|
2371 | '
|
---|
2372 | CfgInit
|
---|
2373 | EnvInit
|
---|
2374 |
|
---|
2375 | '
|
---|
2376 | ' Check that the Shell function is sane.
|
---|
2377 | '
|
---|
2378 | g_objShell.Environment("PROCESS")("TESTING_ENVIRONMENT_INHERITANCE") = "This works"
|
---|
2379 | if Shell("set TESTING_ENVIRONMENT_INHERITANC", False) <> 0 then ' The 'E' is missing on purpose (4nt).
|
---|
2380 | MsgFatal "shell execution test failed!"
|
---|
2381 | end if
|
---|
2382 | if g_strShellOutput <> "TESTING_ENVIRONMENT_INHERITANCE=This works" & CHR(13) & CHR(10) then
|
---|
2383 | MsgFatal "shell inheritance or shell execution isn't working right."
|
---|
2384 | end if
|
---|
2385 | g_objShell.Environment("PROCESS")("TESTING_ENVIRONMENT_INHERITANCE") = ""
|
---|
2386 | Print "Shell inheritance test: OK"
|
---|
2387 |
|
---|
2388 | '
|
---|
2389 | ' Do the checks.
|
---|
2390 | '
|
---|
2391 | if blnOptDisableCOM = True then
|
---|
2392 | DisableCOM "--disable-com"
|
---|
2393 | end if
|
---|
2394 | if blnOptDisableUDPTunnel = True then
|
---|
2395 | DisableUDPTunnel "--disable-udptunnel"
|
---|
2396 | end if
|
---|
2397 | CheckSourcePath
|
---|
2398 | CheckForkBuild strOptkBuild
|
---|
2399 | CheckForWin2k3DDK strOptDDK
|
---|
2400 | CheckForVisualCPP strOptVC, strOptVCCommon, blnOptVCExpressEdition
|
---|
2401 | CheckForPlatformSDK strOptSDK
|
---|
2402 | CheckForMidl
|
---|
2403 | CheckForDirectXSDK strOptDXSDK
|
---|
2404 | CheckForMingW strOptMingw, strOptW32API
|
---|
2405 | CheckForlibSDL strOptlibSDL
|
---|
2406 | ' Don't check for these libraries by default as they are part of OSE
|
---|
2407 | ' Using external libs can add a dependency to iconv
|
---|
2408 | if (strOptXml2 <> "") then
|
---|
2409 | CheckForXml2 strOptXml2
|
---|
2410 | end if
|
---|
2411 | if (strOptXslt <> "") then
|
---|
2412 | CheckForXslt strOptXslt
|
---|
2413 | end if
|
---|
2414 | CheckForSsl strOptSsl
|
---|
2415 | CheckForCurl strOptCurl
|
---|
2416 | CheckForQt4 strOptQt4
|
---|
2417 | if (strOptPython <> "") then
|
---|
2418 | CheckForPython strOptPython
|
---|
2419 | end if
|
---|
2420 | if (strOptMkisofs <> "") then
|
---|
2421 | CheckForMkisofs strOptMkisofs
|
---|
2422 | end if
|
---|
2423 | if g_blnInternalMode then
|
---|
2424 | EnvPrint "call " & g_strPathDev & "/env.cmd %1 %2 %3 %4 %5 %6 %7 %8 %9"
|
---|
2425 | end if
|
---|
2426 |
|
---|
2427 | Print ""
|
---|
2428 | Print "Execute env.bat once before you start to build VBox:"
|
---|
2429 | Print ""
|
---|
2430 | Print " env.bat"
|
---|
2431 | Print " kmk"
|
---|
2432 | Print ""
|
---|
2433 |
|
---|
2434 | End Sub
|
---|
2435 |
|
---|
2436 |
|
---|
2437 | Main
|
---|
2438 |
|
---|