1 | ' $Id: configure.vbs 85787 2020-08-16 21:14:49Z 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-2020 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 | ' kBuild stuff.
|
---|
39 | dim g_strPathkBuild, g_strPathkBuildBin, g_strPathDev
|
---|
40 | g_strPathkBuild = ""
|
---|
41 | g_strPathkBuildBin = ""
|
---|
42 | g_strPathDev = ""
|
---|
43 |
|
---|
44 | dim g_strTargetArch, g_StrTargetArchWin
|
---|
45 | g_strTargetArch = ""
|
---|
46 | g_StrTargetArchWin = ""
|
---|
47 |
|
---|
48 | dim g_strHostArch, g_strHostArchWin
|
---|
49 | g_strHostArch = ""
|
---|
50 | g_strHostArchWin = ""
|
---|
51 |
|
---|
52 | ' Visual C++ info.
|
---|
53 | dim g_strPathVCC, g_strVCCVersion
|
---|
54 | g_strPathVCC = ""
|
---|
55 | g_strVCCVersion = ""
|
---|
56 |
|
---|
57 | ' SDK and DDK.
|
---|
58 | dim g_strPathSDK10, g_strPathPSDK, g_strVerPSDK, g_strPathDDK
|
---|
59 | g_strPathSDK10 = ""
|
---|
60 | g_strPathPSDK = ""
|
---|
61 | g_strVerPSDK = ""
|
---|
62 | g_strPathDDK = ""
|
---|
63 |
|
---|
64 | ' COM disabling.
|
---|
65 | dim g_blnDisableCOM, g_strDisableCOM
|
---|
66 | g_blnDisableCOM = False
|
---|
67 | g_strDisableCOM = ""
|
---|
68 |
|
---|
69 | ' Whether to ignore (continue) on errors.
|
---|
70 | dim g_blnContinueOnError, g_rcExit
|
---|
71 | g_blnContinueOnError = False
|
---|
72 |
|
---|
73 | ' The script's exit code (for ignored errors).
|
---|
74 | dim g_rcScript
|
---|
75 | g_rcScript = 0
|
---|
76 |
|
---|
77 | ' Whether to try the internal stuff first or last.
|
---|
78 | dim g_blnInternalFirst
|
---|
79 | g_blnInternalFirst = True
|
---|
80 |
|
---|
81 | ' List of program files locations.
|
---|
82 | dim g_arrProgramFiles
|
---|
83 | if EnvGet("ProgramFiles(x86)") <> "" then
|
---|
84 | g_arrProgramFiles = Array(EnvGet("ProgramFiles"), EnvGet("ProgramFiles(x86)"))
|
---|
85 | else
|
---|
86 | g_arrProgramFiles = Array(EnvGet("ProgramFiles"))
|
---|
87 | end if
|
---|
88 |
|
---|
89 | ''
|
---|
90 | ' Converts to unix slashes
|
---|
91 | function UnixSlashes(str)
|
---|
92 | UnixSlashes = replace(str, "\", "/")
|
---|
93 | end function
|
---|
94 |
|
---|
95 |
|
---|
96 | ''
|
---|
97 | ' Converts to dos slashes
|
---|
98 | function DosSlashes(str)
|
---|
99 | DosSlashes = replace(str, "/", "\")
|
---|
100 | end function
|
---|
101 |
|
---|
102 |
|
---|
103 | ''
|
---|
104 | ' Read a file (typically the tmp file) into a string.
|
---|
105 | function FileToString(strFilename)
|
---|
106 | const ForReading = 1, TristateFalse = 0
|
---|
107 | dim objLogFile, str
|
---|
108 |
|
---|
109 | set objFile = g_objFileSys.OpenTextFile(DosSlashes(strFilename), ForReading, False, TristateFalse)
|
---|
110 | str = objFile.ReadAll()
|
---|
111 | objFile.Close()
|
---|
112 |
|
---|
113 | FileToString = str
|
---|
114 | end function
|
---|
115 |
|
---|
116 |
|
---|
117 | ''
|
---|
118 | ' Deletes a file
|
---|
119 | sub FileDelete(strFilename)
|
---|
120 | if g_objFileSys.FileExists(DosSlashes(strFilename)) then
|
---|
121 | g_objFileSys.DeleteFile(DosSlashes(strFilename))
|
---|
122 | end if
|
---|
123 | end sub
|
---|
124 |
|
---|
125 |
|
---|
126 | ''
|
---|
127 | ' Appends a line to an ascii file.
|
---|
128 | sub FileAppendLine(strFilename, str)
|
---|
129 | const ForAppending = 8, TristateFalse = 0
|
---|
130 | dim objFile
|
---|
131 |
|
---|
132 | set objFile = g_objFileSys.OpenTextFile(DosSlashes(strFilename), ForAppending, True, TristateFalse)
|
---|
133 | objFile.WriteLine(str)
|
---|
134 | objFile.Close()
|
---|
135 | end sub
|
---|
136 |
|
---|
137 |
|
---|
138 | ''
|
---|
139 | ' Checks if the file exists.
|
---|
140 | function FileExists(strFilename)
|
---|
141 | FileExists = g_objFileSys.FileExists(DosSlashes(strFilename))
|
---|
142 | end function
|
---|
143 |
|
---|
144 |
|
---|
145 | ''
|
---|
146 | ' Checks if the directory exists.
|
---|
147 | function DirExists(strDirectory)
|
---|
148 | DirExists = g_objFileSys.FolderExists(DosSlashes(strDirectory))
|
---|
149 | end function
|
---|
150 |
|
---|
151 |
|
---|
152 | ''
|
---|
153 | ' Checks if this is a WOW64 process.
|
---|
154 | function IsWow64()
|
---|
155 | if g_objShell.Environment("PROCESS")("PROCESSOR_ARCHITEW6432") <> "" then
|
---|
156 | IsWow64 = 1
|
---|
157 | else
|
---|
158 | IsWow64 = 0
|
---|
159 | end if
|
---|
160 | end function
|
---|
161 |
|
---|
162 |
|
---|
163 | ''
|
---|
164 | ' Returns a reverse sorted array (strings).
|
---|
165 | function ArraySortStrings(arrStrings)
|
---|
166 | for i = LBound(arrStrings) to UBound(arrStrings)
|
---|
167 | str1 = arrStrings(i)
|
---|
168 | for j = i + 1 to UBound(arrStrings)
|
---|
169 | str2 = arrStrings(j)
|
---|
170 | if StrComp(str2, str1) < 0 then
|
---|
171 | arrStrings(j) = str1
|
---|
172 | str1 = str2
|
---|
173 | end if
|
---|
174 | next
|
---|
175 | arrStrings(i) = str1
|
---|
176 | next
|
---|
177 | ArraySortStrings = arrStrings
|
---|
178 | end function
|
---|
179 |
|
---|
180 |
|
---|
181 | ''
|
---|
182 | ' Prints a string array.
|
---|
183 | sub ArrayPrintStrings(arrStrings, strPrefix)
|
---|
184 | for i = LBound(arrStrings) to UBound(arrStrings)
|
---|
185 | Print strPrefix & "arrStrings(" & i & ") = '" & arrStrings(i) & "'"
|
---|
186 | next
|
---|
187 | end sub
|
---|
188 |
|
---|
189 |
|
---|
190 | ''
|
---|
191 | ' Returns a reverse sorted array (strings).
|
---|
192 | function ArrayRSortStrings(arrStrings)
|
---|
193 | ' Sort it.
|
---|
194 | arrStrings = ArraySortStrings(arrStrings)
|
---|
195 |
|
---|
196 | ' Reverse the array.
|
---|
197 | cnt = UBound(arrStrings) - LBound(arrStrings) + 1
|
---|
198 | if cnt > 0 then
|
---|
199 | j = UBound(arrStrings)
|
---|
200 | iHalf = Fix(LBound(arrStrings) + cnt / 2)
|
---|
201 | for i = LBound(arrStrings) to iHalf - 1
|
---|
202 | strTmp = arrStrings(i)
|
---|
203 | arrStrings(i) = arrStrings(j)
|
---|
204 | arrStrings(j) = strTmp
|
---|
205 | j = j - 1
|
---|
206 | next
|
---|
207 | end if
|
---|
208 | ArrayRSortStrings = arrStrings
|
---|
209 | end function
|
---|
210 |
|
---|
211 |
|
---|
212 | ''
|
---|
213 | ' Returns the input array with the string appended.
|
---|
214 | ' Note! There must be some better way of doing this...
|
---|
215 | function ArrayAppend(arr, str)
|
---|
216 | dim i, cnt
|
---|
217 | cnt = UBound(arr) - LBound(arr) + 1
|
---|
218 | redim arrRet(cnt)
|
---|
219 | for i = LBound(arr) to UBound(arr)
|
---|
220 | arrRet(i) = arr(i)
|
---|
221 | next
|
---|
222 | arrRet(UBound(arr) + 1) = str
|
---|
223 | ArrayAppend = arrRet
|
---|
224 | end function
|
---|
225 |
|
---|
226 |
|
---|
227 | ''
|
---|
228 | ' Gets the SID of the current user.
|
---|
229 | function GetSid()
|
---|
230 | dim objNet, strUser, strDomain, offSlash, objWmiUser
|
---|
231 | GetSid = ""
|
---|
232 |
|
---|
233 | ' Figure the user + domain
|
---|
234 | set objNet = CreateObject("WScript.Network")
|
---|
235 | strUser = objNet.UserName
|
---|
236 | strDomain = objNet.UserDomain
|
---|
237 | offSlash = InStr(1, strUser, "\")
|
---|
238 | if offSlash > 0 then
|
---|
239 | strDomain = Left(strUser, offSlash - 1)
|
---|
240 | strUser = Right(strUser, Len(strUser) - offSlash)
|
---|
241 | end if
|
---|
242 |
|
---|
243 | ' Lookup the user.
|
---|
244 | on error resume next
|
---|
245 | set objWmiUser = GetObject("winmgmts:{impersonationlevel=impersonate}!/root/cimv2:Win32_UserAccount." _
|
---|
246 | & "Domain='" & strDomain &"',Name='" & strUser & "'")
|
---|
247 | if err.number = 0 then
|
---|
248 | GetSid = objWmiUser.SID
|
---|
249 | end if
|
---|
250 | end function
|
---|
251 |
|
---|
252 |
|
---|
253 | ''
|
---|
254 | ' Translates a register root name to a value
|
---|
255 | ' This will translate HKCU path to HKEY_USERS and fixing
|
---|
256 | function RegTransRoot(strRoot, ByRef sSubKeyName)
|
---|
257 | const HKEY_LOCAL_MACHINE = &H80000002
|
---|
258 | const HKEY_CURRENT_USER = &H80000001
|
---|
259 | const HKEY_USERS = &H80000003
|
---|
260 |
|
---|
261 | select case strRoot
|
---|
262 | case "HKLM"
|
---|
263 | RegTransRoot = HKEY_LOCAL_MACHINE
|
---|
264 | case "HKUS"
|
---|
265 | RegTransRoot = HKEY_USERS
|
---|
266 | case "HKCU"
|
---|
267 | dim strCurrentSid
|
---|
268 | strCurrentSid = GetSid()
|
---|
269 | if strCurrentSid <> "" then
|
---|
270 | sSubKeyName = strCurrentSid & "\" & sSubKeyName
|
---|
271 | RegTransRoot = HKEY_USERS
|
---|
272 | 'LogPrint "RegTransRoot: HKCU -> HKEY_USERS + " & sSubKeyName
|
---|
273 | else
|
---|
274 | RegTransRoot = HKEY_CURRENT_USER
|
---|
275 | LogPrint "RegTransRoot: Warning! HKCU -> HKEY_USERS failed!"
|
---|
276 | end if
|
---|
277 | case else
|
---|
278 | MsgFatal "RegTransRoot: Unknown root: '" & strRoot & "'"
|
---|
279 | RegTransRoot = 0
|
---|
280 | end select
|
---|
281 | end function
|
---|
282 |
|
---|
283 |
|
---|
284 | '' The registry globals
|
---|
285 | dim g_objReg, g_objRegCtx
|
---|
286 | dim g_blnRegistry
|
---|
287 | g_blnRegistry = false
|
---|
288 |
|
---|
289 |
|
---|
290 | ''
|
---|
291 | ' Init the register provider globals.
|
---|
292 | function RegInit()
|
---|
293 | RegInit = false
|
---|
294 | On Error Resume Next
|
---|
295 | if g_blnRegistry = false then
|
---|
296 | set g_objRegCtx = CreateObject("WbemScripting.SWbemNamedValueSet")
|
---|
297 | ' Comment out the following for lines if the cause trouble on your windows version.
|
---|
298 | if IsWow64() then
|
---|
299 | g_objRegCtx.Add "__ProviderArchitecture", 64
|
---|
300 | g_objRegCtx.Add "__RequiredArchitecture", true
|
---|
301 | end if
|
---|
302 | set objLocator = CreateObject("Wbemscripting.SWbemLocator")
|
---|
303 | set objServices = objLocator.ConnectServer("", "root\default", "", "", , , , g_objRegCtx)
|
---|
304 | set g_objReg = objServices.Get("StdRegProv")
|
---|
305 | g_blnRegistry = true
|
---|
306 | end if
|
---|
307 | RegInit = true
|
---|
308 | end function
|
---|
309 |
|
---|
310 |
|
---|
311 | ''
|
---|
312 | ' Gets a value from the registry. Returns "" if string wasn't found / valid.
|
---|
313 | function RegGetString(strName)
|
---|
314 | RegGetString = ""
|
---|
315 | if RegInit() then
|
---|
316 | dim strRoot, strKey, strValue
|
---|
317 | dim iRoot
|
---|
318 |
|
---|
319 | ' split up into root, key and value parts.
|
---|
320 | strRoot = left(strName, instr(strName, "\") - 1)
|
---|
321 | strKey = mid(strName, instr(strName, "\") + 1, instrrev(strName, "\") - instr(strName, "\"))
|
---|
322 | strValue = mid(strName, instrrev(strName, "\") + 1)
|
---|
323 |
|
---|
324 | ' Must use ExecMethod to call the GetStringValue method because of the context.
|
---|
325 | Set InParms = g_objReg.Methods_("GetStringValue").Inparameters
|
---|
326 | InParms.hDefKey = RegTransRoot(strRoot, strKey)
|
---|
327 | InParms.sSubKeyName = strKey
|
---|
328 | InParms.sValueName = strValue
|
---|
329 | On Error Resume Next
|
---|
330 | set OutParms = g_objReg.ExecMethod_("GetStringValue", InParms, , g_objRegCtx)
|
---|
331 | if OutParms.ReturnValue = 0 then
|
---|
332 | if OutParms.sValue <> Null then
|
---|
333 | RegGetString = OutParms.sValue
|
---|
334 | end if
|
---|
335 | end if
|
---|
336 | else
|
---|
337 | ' fallback mode
|
---|
338 | On Error Resume Next
|
---|
339 | RegGetString = g_objShell.RegRead(strName)
|
---|
340 | end if
|
---|
341 | end function
|
---|
342 |
|
---|
343 |
|
---|
344 | ''
|
---|
345 | ' Gets a multi string value from the registry. Returns array of strings if found, otherwise empty array().
|
---|
346 | function RegGetMultiString(strName)
|
---|
347 | RegGetMultiString = Array()
|
---|
348 | if RegInit() then
|
---|
349 | dim strRoot, strKey, strValue
|
---|
350 | dim iRoot
|
---|
351 |
|
---|
352 | ' split up into root, key and value parts.
|
---|
353 | strRoot = left(strName, instr(strName, "\") - 1)
|
---|
354 | strKey = mid(strName, instr(strName, "\") + 1, instrrev(strName, "\") - instr(strName, "\"))
|
---|
355 | strValue = mid(strName, instrrev(strName, "\") + 1)
|
---|
356 |
|
---|
357 | ' Must use ExecMethod to call the GetStringValue method because of the context.
|
---|
358 | Set InParms = g_objReg.Methods_("GetMultiStringValue").Inparameters
|
---|
359 | InParms.hDefKey = RegTransRoot(strRoot, strKey)
|
---|
360 | InParms.sSubKeyName = strKey
|
---|
361 | InParms.sValueName = strValue
|
---|
362 | On Error Resume Next
|
---|
363 | set OutParms = g_objReg.ExecMethod_("GetMultiStringValue", InParms, , g_objRegCtx)
|
---|
364 | if OutParms.ReturnValue = 0 then
|
---|
365 | if OutParms.sValue <> Null then
|
---|
366 | RegGetMultiString = OutParms.sValue
|
---|
367 | end if
|
---|
368 | end if
|
---|
369 | else
|
---|
370 | ' fallback mode
|
---|
371 | On Error Resume Next
|
---|
372 | RegGetMultiString = g_objShell.RegRead(strName)
|
---|
373 | end if
|
---|
374 | end function
|
---|
375 |
|
---|
376 |
|
---|
377 | ''
|
---|
378 | ' Returns an array of subkey strings.
|
---|
379 | function RegEnumSubKeys(strRoot, ByVal strKeyPath)
|
---|
380 | RegEnumSubKeys = Array()
|
---|
381 | if RegInit() then
|
---|
382 | ' Must use ExecMethod to call the EnumKey method because of the context.
|
---|
383 | Set InParms = g_objReg.Methods_("EnumKey").Inparameters
|
---|
384 | InParms.hDefKey = RegTransRoot(strRoot, strKeyPath)
|
---|
385 | InParms.sSubKeyName = strKeyPath
|
---|
386 | On Error Resume Next
|
---|
387 | set OutParms = g_objReg.ExecMethod_("EnumKey", InParms, , g_objRegCtx)
|
---|
388 | 'LogPrint "RegEnumSubKeys(" & Hex(InParms.hDefKey) & "," & InParms.sSubKeyName &") -> " & OutParms.GetText_(1)
|
---|
389 | if OutParms.ReturnValue = 0 then
|
---|
390 | if OutParms.sNames <> Null then
|
---|
391 | RegEnumSubKeys = OutParms.sNames
|
---|
392 | end if
|
---|
393 | end if
|
---|
394 | else
|
---|
395 | ' fallback mode
|
---|
396 | dim objReg, rc, arrSubKeys
|
---|
397 | set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
|
---|
398 | On Error Resume Next
|
---|
399 | rc = objReg.EnumKey(RegTransRoot(strRoot, strKeyPath), strKeyPath, arrSubKeys)
|
---|
400 | if rc = 0 then
|
---|
401 | RegEnumSubKeys = arrSubKeys
|
---|
402 | end if
|
---|
403 | end if
|
---|
404 | end function
|
---|
405 |
|
---|
406 |
|
---|
407 | ''
|
---|
408 | ' Returns an array of full path subkey strings.
|
---|
409 | function RegEnumSubKeysFull(strRoot, strKeyPath)
|
---|
410 | dim arrTmp
|
---|
411 | arrTmp = RegEnumSubKeys(strRoot, strKeyPath)
|
---|
412 | for i = LBound(arrTmp) to UBound(arrTmp)
|
---|
413 | arrTmp(i) = strKeyPath & "\" & arrTmp(i)
|
---|
414 | next
|
---|
415 | RegEnumSubKeysFull = arrTmp
|
---|
416 | end function
|
---|
417 |
|
---|
418 |
|
---|
419 | ''
|
---|
420 | ' Returns an rsorted array of subkey strings.
|
---|
421 | function RegEnumSubKeysRSort(strRoot, strKeyPath)
|
---|
422 | RegEnumSubKeysRSort = ArrayRSortStrings(RegEnumSubKeys(strRoot, strKeyPath))
|
---|
423 | end function
|
---|
424 |
|
---|
425 |
|
---|
426 | ''
|
---|
427 | ' Returns an rsorted array of subkey strings.
|
---|
428 | function RegEnumSubKeysFullRSort(strRoot, strKeyPath)
|
---|
429 | RegEnumSubKeysFullRSort = ArrayRSortStrings(RegEnumSubKeysFull(strRoot, strKeyPath))
|
---|
430 | end function
|
---|
431 |
|
---|
432 |
|
---|
433 | ''
|
---|
434 | ' Returns an array of value name strings.
|
---|
435 | function RegEnumValueNames(strRoot, ByVal strKeyPath)
|
---|
436 | RegEnumValueNames = Array()
|
---|
437 | if RegInit() then
|
---|
438 | ' Must use ExecMethod to call the EnumKey method because of the context.
|
---|
439 | Set InParms = g_objReg.Methods_("EnumValues").Inparameters
|
---|
440 | InParms.hDefKey = RegTransRoot(strRoot, strKeyPath)
|
---|
441 | InParms.sSubKeyName = strKeyPath
|
---|
442 | On Error Resume Next
|
---|
443 | set OutParms = g_objReg.ExecMethod_("EnumValues", InParms, , g_objRegCtx)
|
---|
444 | 'LogPrint "RegEnumValueNames(" & Hex(InParms.hDefKey) & "," & InParms.sSubKeyName &") -> " & OutParms.GetText_(1)
|
---|
445 | if OutParms.ReturnValue = 0 then
|
---|
446 | if OutParms.sNames <> Null then
|
---|
447 | RegEnumValueNames = OutParms.sNames
|
---|
448 | end if
|
---|
449 | end if
|
---|
450 | else
|
---|
451 | ' fallback mode
|
---|
452 | dim objReg, rc, arrSubKeys
|
---|
453 | set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
|
---|
454 | On Error Resume Next
|
---|
455 | rc = objReg.EnumValues(RegTransRoot(strRoot, strKeyPath), strKeyPath, arrSubKeys)
|
---|
456 | if rc = 0 then
|
---|
457 | RegEnumValueNames = arrSubKeys
|
---|
458 | end if
|
---|
459 | end if
|
---|
460 | end function
|
---|
461 |
|
---|
462 |
|
---|
463 | ''
|
---|
464 | ' Returns an array of full path value name strings.
|
---|
465 | function RegEnumValueNamesFull(strRoot, strKeyPath)
|
---|
466 | dim arrTmp
|
---|
467 | arrTmp = RegEnumValueNames(strRoot, strKeyPath)
|
---|
468 | for i = LBound(arrTmp) to UBound(arrTmp)
|
---|
469 | arrTmp(i) = strKeyPath & "\" & arrTmp(i)
|
---|
470 | next
|
---|
471 | RegEnumValueNamesFull = arrTmp
|
---|
472 | end function
|
---|
473 |
|
---|
474 |
|
---|
475 | ''
|
---|
476 | ' Gets the commandline used to invoke the script.
|
---|
477 | function GetCommandline()
|
---|
478 | dim str, i
|
---|
479 |
|
---|
480 | '' @todo find an api for querying it instead of reconstructing it like this...
|
---|
481 | GetCommandline = "cscript configure.vbs"
|
---|
482 | for i = 1 to WScript.Arguments.Count
|
---|
483 | str = WScript.Arguments.Item(i - 1)
|
---|
484 | if str = "" then
|
---|
485 | str = """"""
|
---|
486 | elseif (InStr(1, str, " ")) then
|
---|
487 | str = """" & str & """"
|
---|
488 | end if
|
---|
489 | GetCommandline = GetCommandline & " " & str
|
---|
490 | next
|
---|
491 | end function
|
---|
492 |
|
---|
493 |
|
---|
494 | ''
|
---|
495 | ' Gets an environment variable.
|
---|
496 | function EnvGet(strName)
|
---|
497 | EnvGet = g_objShell.Environment("PROCESS")(strName)
|
---|
498 | end function
|
---|
499 |
|
---|
500 |
|
---|
501 | ''
|
---|
502 | ' Sets an environment variable.
|
---|
503 | sub EnvSet(strName, strValue)
|
---|
504 | g_objShell.Environment("PROCESS")(strName) = strValue
|
---|
505 | LogPrint "EnvSet: " & strName & "=" & strValue
|
---|
506 | end sub
|
---|
507 |
|
---|
508 |
|
---|
509 | ''
|
---|
510 | ' Appends a string to an environment variable
|
---|
511 | sub EnvAppend(strName, strValue)
|
---|
512 | dim str
|
---|
513 | str = g_objShell.Environment("PROCESS")(strName)
|
---|
514 | g_objShell.Environment("PROCESS")(strName) = str & strValue
|
---|
515 | LogPrint "EnvAppend: " & strName & "=" & str & strValue
|
---|
516 | end sub
|
---|
517 |
|
---|
518 |
|
---|
519 | ''
|
---|
520 | ' Prepends a string to an environment variable
|
---|
521 | sub EnvPrepend(strName, strValue)
|
---|
522 | dim str
|
---|
523 | str = g_objShell.Environment("PROCESS")(strName)
|
---|
524 | g_objShell.Environment("PROCESS")(strName) = strValue & str
|
---|
525 | LogPrint "EnvPrepend: " & strName & "=" & strValue & str
|
---|
526 | end sub
|
---|
527 |
|
---|
528 | ''
|
---|
529 | ' Gets the first non-empty environment variable of the given two.
|
---|
530 | function EnvGetFirst(strName1, strName2)
|
---|
531 | EnvGetFirst = g_objShell.Environment("PROCESS")(strName1)
|
---|
532 | if EnvGetFirst = "" then
|
---|
533 | EnvGetFirst = g_objShell.Environment("PROCESS")(strName2)
|
---|
534 | end if
|
---|
535 | end function
|
---|
536 |
|
---|
537 |
|
---|
538 | ''
|
---|
539 | ' Get the path of the parent directory. Returns root if root was specified.
|
---|
540 | ' Expects abs path.
|
---|
541 | function PathParent(str)
|
---|
542 | PathParent = g_objFileSys.GetParentFolderName(DosSlashes(str))
|
---|
543 | end function
|
---|
544 |
|
---|
545 |
|
---|
546 | ''
|
---|
547 | ' Strips the filename from at path.
|
---|
548 | function PathStripFilename(str)
|
---|
549 | PathStripFilename = g_objFileSys.GetParentFolderName(DosSlashes(str))
|
---|
550 | end function
|
---|
551 |
|
---|
552 |
|
---|
553 | ''
|
---|
554 | ' Get the abs path, use the short version if necessary.
|
---|
555 | function PathAbs(str)
|
---|
556 | strAbs = g_objFileSys.GetAbsolutePathName(DosSlashes(str))
|
---|
557 | strParent = g_objFileSys.GetParentFolderName(strAbs)
|
---|
558 | if strParent = "" then
|
---|
559 | PathAbs = strAbs
|
---|
560 | else
|
---|
561 | strParent = PathAbs(strParent) ' Recurse to resolve parent paths.
|
---|
562 | PathAbs = g_objFileSys.BuildPath(strParent, g_objFileSys.GetFileName(strAbs))
|
---|
563 |
|
---|
564 | dim obj
|
---|
565 | set obj = Nothing
|
---|
566 | if FileExists(PathAbs) then
|
---|
567 | set obj = g_objFileSys.GetFile(PathAbs)
|
---|
568 | elseif DirExists(PathAbs) then
|
---|
569 | set obj = g_objFileSys.GetFolder(PathAbs)
|
---|
570 | end if
|
---|
571 |
|
---|
572 | if not (obj is nothing) then
|
---|
573 | for each objSub in obj.ParentFolder.SubFolders
|
---|
574 | if obj.Name = objSub.Name or obj.ShortName = objSub.ShortName then
|
---|
575 | if InStr(1, objSub.Name, " ") > 0 _
|
---|
576 | Or InStr(1, objSub.Name, "&") > 0 _
|
---|
577 | Or InStr(1, objSub.Name, "$") > 0 _
|
---|
578 | then
|
---|
579 | PathAbs = g_objFileSys.BuildPath(strParent, objSub.ShortName)
|
---|
580 | if InStr(1, PathAbs, " ") > 0 _
|
---|
581 | Or InStr(1, PathAbs, "&") > 0 _
|
---|
582 | Or InStr(1, PathAbs, "$") > 0 _
|
---|
583 | then
|
---|
584 | MsgFatal "PathAbs(" & str & ") attempted to return filename with problematic " _
|
---|
585 | & "characters in it (" & PathAbs & "). The tool/sdk referenced will probably " _
|
---|
586 | & "need to be copied or reinstalled to a location without 'spaces', '$', ';' " _
|
---|
587 | & "or '&' in the path name. (Unless it's a problem with this script of course...)"
|
---|
588 | end if
|
---|
589 | else
|
---|
590 | PathAbs = g_objFileSys.BuildPath(strParent, objSub.Name)
|
---|
591 | end if
|
---|
592 | exit for
|
---|
593 | end if
|
---|
594 | next
|
---|
595 | end if
|
---|
596 | end if
|
---|
597 | end function
|
---|
598 |
|
---|
599 |
|
---|
600 | ''
|
---|
601 | ' Get the abs path, use the long version.
|
---|
602 | function PathAbsLong(str)
|
---|
603 | strAbs = g_objFileSys.GetAbsolutePathName(DosSlashes(str))
|
---|
604 | strParent = g_objFileSys.GetParentFolderName(strAbs)
|
---|
605 | if strParent = "" then
|
---|
606 | PathAbsLong = strAbs
|
---|
607 | else
|
---|
608 | strParent = PathAbsLong(strParent) ' Recurse to resolve parent paths.
|
---|
609 | PathAbsLong = g_objFileSys.BuildPath(strParent, g_objFileSys.GetFileName(strAbs))
|
---|
610 |
|
---|
611 | dim obj
|
---|
612 | set obj = Nothing
|
---|
613 | if FileExists(PathAbsLong) then
|
---|
614 | set obj = g_objFileSys.GetFile(PathAbsLong)
|
---|
615 | elseif DirExists(PathAbsLong) then
|
---|
616 | set obj = g_objFileSys.GetFolder(PathAbsLong)
|
---|
617 | end if
|
---|
618 |
|
---|
619 | if not (obj is nothing) then
|
---|
620 | for each objSub in obj.ParentFolder.SubFolders
|
---|
621 | if obj.Name = objSub.Name or obj.ShortName = objSub.ShortName then
|
---|
622 | PathAbsLong = g_objFileSys.BuildPath(strParent, objSub.Name)
|
---|
623 | exit for
|
---|
624 | end if
|
---|
625 | next
|
---|
626 | end if
|
---|
627 | end if
|
---|
628 | end function
|
---|
629 |
|
---|
630 |
|
---|
631 | ''
|
---|
632 | ' Returns true if there are subfolders starting with the given string.
|
---|
633 | function HasSubdirsStartingWith(strFolder, strStartingWith)
|
---|
634 | HasSubdirsStartingWith = False
|
---|
635 | if DirExists(strFolder) then
|
---|
636 | dim obj
|
---|
637 | set obj = g_objFileSys.GetFolder(strFolder)
|
---|
638 | for each objSub in obj.SubFolders
|
---|
639 | if StrComp(Left(objSub.Name, Len(strStartingWith)), strStartingWith) = 0 then
|
---|
640 | HasSubdirsStartingWith = True
|
---|
641 | LogPrint "# HasSubdirsStartingWith(" & strFolder & "," & strStartingWith & ") found " & objSub.Name
|
---|
642 | exit for
|
---|
643 | end if
|
---|
644 | next
|
---|
645 | end if
|
---|
646 | end function
|
---|
647 |
|
---|
648 |
|
---|
649 | ''
|
---|
650 | ' Returns a sorted array of subfolder names that starts with the given string.
|
---|
651 | function GetSubdirsStartingWith(strFolder, strStartingWith)
|
---|
652 | if DirExists(strFolder) then
|
---|
653 | dim obj, i
|
---|
654 | set obj = g_objFileSys.GetFolder(strFolder)
|
---|
655 | i = 0
|
---|
656 | for each objSub in obj.SubFolders
|
---|
657 | if StrComp(Left(objSub.Name, Len(strStartingWith)), strStartingWith) = 0 then
|
---|
658 | i = i + 1
|
---|
659 | end if
|
---|
660 | next
|
---|
661 | if i > 0 then
|
---|
662 | redim arrResult(i - 1)
|
---|
663 | i = 0
|
---|
664 | for each objSub in obj.SubFolders
|
---|
665 | if StrComp(Left(objSub.Name, Len(strStartingWith)), strStartingWith) = 0 then
|
---|
666 | arrResult(i) = objSub.Name
|
---|
667 | i = i + 1
|
---|
668 | end if
|
---|
669 | next
|
---|
670 | GetSubdirsStartingWith = arrResult
|
---|
671 | else
|
---|
672 | GetSubdirsStartingWith = Array()
|
---|
673 | end if
|
---|
674 | else
|
---|
675 | GetSubdirsStartingWith = Array()
|
---|
676 | end if
|
---|
677 | end function
|
---|
678 |
|
---|
679 |
|
---|
680 | ''
|
---|
681 | ' Returns a sorted array of subfolder names that starts with the given string.
|
---|
682 | function GetSubdirsStartingWithSorted(strFolder, strStartingWith)
|
---|
683 | GetSubdirsStartingWithSorted = ArraySortStrings(GetSubdirsStartingWith(strFolder, strStartingWith))
|
---|
684 | end function
|
---|
685 |
|
---|
686 |
|
---|
687 | ''
|
---|
688 | ' Returns a reverse sorted array of subfolder names that starts with the given string.
|
---|
689 | function GetSubdirsStartingWithRSorted(strFolder, strStartingWith)
|
---|
690 | GetSubdirsStartingWithRSorted = ArrayRSortStrings(GetSubdirsStartingWith(strFolder, strStartingWith))
|
---|
691 | end function
|
---|
692 |
|
---|
693 |
|
---|
694 | ''
|
---|
695 | ' Executes a command in the shell catching output in g_strShellOutput
|
---|
696 | function Shell(strCommand, blnBoth)
|
---|
697 | dim strShell, strCmdline, objExec, str
|
---|
698 |
|
---|
699 | strShell = g_objShell.ExpandEnvironmentStrings("%ComSpec%")
|
---|
700 | if blnBoth = true then
|
---|
701 | strCmdline = strShell & " /c " & strCommand & " 2>&1"
|
---|
702 | else
|
---|
703 | strCmdline = strShell & " /c " & strCommand & " 2>nul"
|
---|
704 | end if
|
---|
705 |
|
---|
706 | LogPrint "# Shell: " & strCmdline
|
---|
707 | Set objExec = g_objShell.Exec(strCmdLine)
|
---|
708 | g_strShellOutput = objExec.StdOut.ReadAll()
|
---|
709 | objExec.StdErr.ReadAll()
|
---|
710 | do while objExec.Status = 0
|
---|
711 | Wscript.Sleep 20
|
---|
712 | g_strShellOutput = g_strShellOutput & objExec.StdOut.ReadAll()
|
---|
713 | objExec.StdErr.ReadAll()
|
---|
714 | loop
|
---|
715 |
|
---|
716 | LogPrint "# Status: " & objExec.ExitCode
|
---|
717 | LogPrint "# Start of Output"
|
---|
718 | LogPrint g_strShellOutput
|
---|
719 | LogPrint "# End of Output"
|
---|
720 |
|
---|
721 | Shell = objExec.ExitCode
|
---|
722 | end function
|
---|
723 |
|
---|
724 |
|
---|
725 | ''
|
---|
726 | ' Try find the specified file in the specified path variable.
|
---|
727 | function WhichEx(strEnvVar, strFile)
|
---|
728 | dim strPath, iStart, iEnd, str
|
---|
729 |
|
---|
730 | ' the path
|
---|
731 | strPath = EnvGet(strEnvVar)
|
---|
732 | iStart = 1
|
---|
733 | do while iStart <= Len(strPath)
|
---|
734 | iEnd = InStr(iStart, strPath, ";")
|
---|
735 | if iEnd <= 0 then iEnd = Len(strPath) + 1
|
---|
736 | if iEnd > iStart then
|
---|
737 | str = Mid(strPath, iStart, iEnd - iStart) & "/" & strFile
|
---|
738 | if FileExists(str) then
|
---|
739 | WhichEx = str
|
---|
740 | exit function
|
---|
741 | end if
|
---|
742 | end if
|
---|
743 | iStart = iEnd + 1
|
---|
744 | loop
|
---|
745 |
|
---|
746 | ' registry or somewhere?
|
---|
747 |
|
---|
748 | WhichEx = ""
|
---|
749 | end function
|
---|
750 |
|
---|
751 |
|
---|
752 | ''
|
---|
753 | ' Try find the specified file in the path.
|
---|
754 | function Which(strFile)
|
---|
755 | Which = WhichEx("Path", strFile)
|
---|
756 | end function
|
---|
757 |
|
---|
758 |
|
---|
759 | ''
|
---|
760 | ' Right pads a string with spaces to the given length
|
---|
761 | function RightPad(str, cch)
|
---|
762 | if Len(str) < cch then
|
---|
763 | RightPad = str & String(cch - Len(str), " ")
|
---|
764 | else
|
---|
765 | RightPad = str
|
---|
766 | end if
|
---|
767 | end function
|
---|
768 |
|
---|
769 | ''
|
---|
770 | ' Append text to the log file and echo it to stdout
|
---|
771 | sub Print(str)
|
---|
772 | LogPrint str
|
---|
773 | Wscript.Echo str
|
---|
774 | end sub
|
---|
775 |
|
---|
776 |
|
---|
777 | ''
|
---|
778 | ' Prints a test header
|
---|
779 | sub PrintHdr(strTest)
|
---|
780 | LogPrint "***** Checking for " & strTest & " *****"
|
---|
781 | Wscript.Echo "Checking for " & StrTest & "..."
|
---|
782 | end sub
|
---|
783 |
|
---|
784 |
|
---|
785 | ''
|
---|
786 | ' Prints a success message
|
---|
787 | sub PrintResultMsg(strTest, strResult)
|
---|
788 | dim cchPad
|
---|
789 | LogPrint "** " & strTest & ": " & strResult
|
---|
790 | Wscript.Echo " Found " & RightPad(strTest & ": ", 22) & strPad & strResult
|
---|
791 | end sub
|
---|
792 |
|
---|
793 |
|
---|
794 | ''
|
---|
795 | ' Prints a successfully detected path
|
---|
796 | sub PrintResult(strTest, strPath)
|
---|
797 | strLongPath = PathAbsLong(strPath)
|
---|
798 | if PathAbs(strPath) <> strLongPath then
|
---|
799 | LogPrint "** " & strTest & ": " & strPath & " (" & UnixSlashes(strLongPath) & ")"
|
---|
800 | Wscript.Echo " Found " & RightPad(strTest & ": ", 22) & strPath & " (" & UnixSlashes(strLongPath) & ")"
|
---|
801 | else
|
---|
802 | LogPrint "** " & strTest & ": " & strPath
|
---|
803 | Wscript.Echo " Found " & RightPad(strTest & ": ", 22) & strPath
|
---|
804 | end if
|
---|
805 | end sub
|
---|
806 |
|
---|
807 |
|
---|
808 | ''
|
---|
809 | ' Warning message.
|
---|
810 | sub MsgWarning(strMsg)
|
---|
811 | Print "warning: " & strMsg
|
---|
812 | end sub
|
---|
813 |
|
---|
814 |
|
---|
815 | ''
|
---|
816 | ' Fatal error.
|
---|
817 | sub MsgFatal(strMsg)
|
---|
818 | Print "fatal error: " & strMsg
|
---|
819 | Wscript.Quit(1)
|
---|
820 | end sub
|
---|
821 |
|
---|
822 |
|
---|
823 | ''
|
---|
824 | ' Error message, fatal unless flag to ignore errors is given.
|
---|
825 | sub MsgError(strMsg)
|
---|
826 | Print "error: " & strMsg
|
---|
827 | if g_blnContinueOnError = False then
|
---|
828 | Wscript.Quit(1)
|
---|
829 | end if
|
---|
830 | g_rcScript = 1
|
---|
831 | end sub
|
---|
832 |
|
---|
833 |
|
---|
834 | ''
|
---|
835 | ' Write a log header with some basic info.
|
---|
836 | sub LogInit
|
---|
837 | FileDelete g_strLogFile
|
---|
838 | LogPrint "# Log file generated by " & Wscript.ScriptFullName
|
---|
839 | for i = 1 to WScript.Arguments.Count
|
---|
840 | LogPrint "# Arg #" & i & ": " & WScript.Arguments.Item(i - 1)
|
---|
841 | next
|
---|
842 | if Wscript.Arguments.Count = 0 then
|
---|
843 | LogPrint "# No arguments given"
|
---|
844 | end if
|
---|
845 | LogPrint "# Reconstructed command line: " & GetCommandline()
|
---|
846 |
|
---|
847 | ' some Wscript stuff
|
---|
848 | LogPrint "# Wscript properties:"
|
---|
849 | LogPrint "# ScriptName: " & Wscript.ScriptName
|
---|
850 | LogPrint "# Version: " & Wscript.Version
|
---|
851 | LogPrint "# Build: " & Wscript.BuildVersion
|
---|
852 | LogPrint "# Name: " & Wscript.Name
|
---|
853 | LogPrint "# Full Name: " & Wscript.FullName
|
---|
854 | LogPrint "# Path: " & Wscript.Path
|
---|
855 | LogPrint "#"
|
---|
856 |
|
---|
857 |
|
---|
858 | ' the environment
|
---|
859 | LogPrint "# Environment:"
|
---|
860 | dim objEnv
|
---|
861 | for each strVar in g_objShell.Environment("PROCESS")
|
---|
862 | LogPrint "# " & strVar
|
---|
863 | next
|
---|
864 | LogPrint "#"
|
---|
865 | end sub
|
---|
866 |
|
---|
867 |
|
---|
868 | ''
|
---|
869 | ' Append text to the log file.
|
---|
870 | sub LogPrint(str)
|
---|
871 | FileAppendLine g_strLogFile, str
|
---|
872 | 'Wscript.Echo "dbg: " & str
|
---|
873 | end sub
|
---|
874 |
|
---|
875 |
|
---|
876 | ''
|
---|
877 | ' Checks if the file exists and logs failures.
|
---|
878 | function LogFileExists(strPath, strFilename)
|
---|
879 | LogFileExists = FileExists(strPath & "/" & strFilename)
|
---|
880 | if LogFileExists = False then
|
---|
881 | LogPrint "Testing '" & strPath & "': " & strFilename & " not found"
|
---|
882 | end if
|
---|
883 | end function
|
---|
884 |
|
---|
885 |
|
---|
886 | ''
|
---|
887 | ' Checks if the directory exists and logs failures.
|
---|
888 | function LogDirExists(strPath)
|
---|
889 | LogDirExists = DirExists(strPath)
|
---|
890 | if LogDirExists = False then
|
---|
891 | LogPrint "Testing '" & strPath & "': not found (or not dir)"
|
---|
892 | end if
|
---|
893 | end function
|
---|
894 |
|
---|
895 |
|
---|
896 | ''
|
---|
897 | ' Finds the first file matching the pattern.
|
---|
898 | ' If no file is found, log the failure.
|
---|
899 | function LogFindFile(strPath, strPattern)
|
---|
900 | dim str
|
---|
901 |
|
---|
902 | '
|
---|
903 | ' Yes, there are some facy database kinda interface to the filesystem
|
---|
904 | ' however, breaking down the path and constructing a usable query is
|
---|
905 | ' too much hassle. So, we'll do it the unix way...
|
---|
906 | '
|
---|
907 | if Shell("dir /B """ & DosSlashes(strPath) & "\" & DosSlashes(strPattern) & """", True) = 0 _
|
---|
908 | And InStr(1, g_strShellOutput, Chr(13)) > 1 _
|
---|
909 | then
|
---|
910 | ' return the first word.
|
---|
911 | LogFindFile = Left(g_strShellOutput, InStr(1, g_strShellOutput, Chr(13)) - 1)
|
---|
912 | else
|
---|
913 | LogPrint "Testing '" & strPath & "': " & strPattern & " not found"
|
---|
914 | LogFindFile = ""
|
---|
915 | end if
|
---|
916 | end function
|
---|
917 |
|
---|
918 |
|
---|
919 | ''
|
---|
920 | ' Finds the first directory matching the pattern.
|
---|
921 | ' If no directory is found, log the failure,
|
---|
922 | ' else return the complete path to the found directory.
|
---|
923 | function LogFindDir(strPath, strPattern)
|
---|
924 | dim str
|
---|
925 |
|
---|
926 | '
|
---|
927 | ' Yes, there are some facy database kinda interface to the filesystem
|
---|
928 | ' however, breaking down the path and constructing a usable query is
|
---|
929 | ' too much hassle. So, we'll do it the unix way...
|
---|
930 | '
|
---|
931 |
|
---|
932 | ' List the alphabetically last names as first entries (with /O-N).
|
---|
933 | if Shell("dir /B /AD /O-N """ & DosSlashes(strPath) & "\" & DosSlashes(strPattern) & """", True) = 0 _
|
---|
934 | And InStr(1, g_strShellOutput, Chr(13)) > 1 _
|
---|
935 | then
|
---|
936 | ' return the first word.
|
---|
937 | LogFindDir = strPath & "/" & Left(g_strShellOutput, InStr(1, g_strShellOutput, Chr(13)) - 1)
|
---|
938 | else
|
---|
939 | LogPrint "Testing '" & strPath & "': " & strPattern & " not found"
|
---|
940 | LogFindDir = ""
|
---|
941 | end if
|
---|
942 | end function
|
---|
943 |
|
---|
944 |
|
---|
945 | ''
|
---|
946 | ' Initializes the config file.
|
---|
947 | sub CfgInit
|
---|
948 | FileDelete g_strCfgFile
|
---|
949 | CfgPrint "# -*- Makefile -*-"
|
---|
950 | CfgPrint "#"
|
---|
951 | CfgPrint "# Build configuration generated by " & GetCommandline()
|
---|
952 | CfgPrint "#"
|
---|
953 | CfgPrint "VBOX_OSE := 1"
|
---|
954 | CfgPrint "VBOX_VCC_WERR = $(NO_SUCH_VARIABLE)"
|
---|
955 | end sub
|
---|
956 |
|
---|
957 |
|
---|
958 | ''
|
---|
959 | ' Prints a string to the config file.
|
---|
960 | sub CfgPrint(str)
|
---|
961 | FileAppendLine g_strCfgFile, str
|
---|
962 | end sub
|
---|
963 |
|
---|
964 |
|
---|
965 | ''
|
---|
966 | ' Initializes the environment batch script.
|
---|
967 | sub EnvInit
|
---|
968 | FileDelete g_strEnvFile
|
---|
969 | EnvPrint "@echo off"
|
---|
970 | EnvPrint "rem"
|
---|
971 | EnvPrint "rem Environment setup script generated by " & GetCommandline()
|
---|
972 | EnvPrint "rem"
|
---|
973 | end sub
|
---|
974 |
|
---|
975 |
|
---|
976 | ''
|
---|
977 | ' Prints a string to the environment batch script.
|
---|
978 | sub EnvPrint(str)
|
---|
979 | FileAppendLine g_strEnvFile, str
|
---|
980 | end sub
|
---|
981 |
|
---|
982 |
|
---|
983 | ''
|
---|
984 | ' Helper for EnvPrintPrepend and EnvPrintAppend.
|
---|
985 | sub EnvPrintCleanup(strEnv, strValue, strSep)
|
---|
986 | dim cchValueAndSep
|
---|
987 | FileAppendLine g_strEnvFile, "set " & strEnv & "=%" & strEnv & ":" & strSep & strValue & strSep & "=" & strSep & "%"
|
---|
988 | cchValueAndSep = Len(strValue) + Len(strSep)
|
---|
989 | FileAppendLine g_strEnvFile, "if ""%" & strEnv & "%""==""" & strValue & """ set " & strEnv & "="
|
---|
990 | FileAppendLine g_strEnvFile, "if ""%" & strEnv & ":~0," & cchValueAndSep & "%""==""" & strValue & strSep & """ set " & strEnv & "=%" & strEnv & ":~" & cchValueAndSep & "%"
|
---|
991 | FileAppendLine g_strEnvFile, "if ""%" & strEnv & ":~-" & cchValueAndSep & "%""==""" & strSep & strValue & """ set " & strEnv & "=%" & strEnv & ":~0,-" & cchValueAndSep & "%"
|
---|
992 | end sub
|
---|
993 |
|
---|
994 | '' Use by EnvPrintPrepend to skip ';' stripping.
|
---|
995 | dim g_strPrependCleanEnvVars
|
---|
996 |
|
---|
997 | ''
|
---|
998 | ' Print a statement prepending strValue to strEnv, removing duplicate values.
|
---|
999 | sub EnvPrintPrepend(strEnv, strValue, strSep)
|
---|
1000 | ' Remove old values and any leading separators.
|
---|
1001 | EnvPrintCleanup strEnv, strValue, strSep
|
---|
1002 | if InStr(1, g_strPrependCleanEnvVars, "|" & strEnv & "|") = 0 then
|
---|
1003 | FileAppendLine g_strEnvFile, "if ""%" & strEnv & ":~0,1%""==""" & strSep & """ set " & strEnv & "=%" & strEnv & ":~1%"
|
---|
1004 | FileAppendLine g_strEnvFile, "if ""%" & strEnv & ":~0,1%""==""" & strSep & """ set " & strEnv & "=%" & strEnv & ":~1%"
|
---|
1005 | g_strPrependCleanEnvVars = g_strPrependCleanEnvVars & "|" & strEnv & "|"
|
---|
1006 | end if
|
---|
1007 | ' Do the setting
|
---|
1008 | FileAppendLine g_strEnvFile, "set " & strEnv & "=" & strValue & strSep & "%" & strEnv & "%"
|
---|
1009 | end sub
|
---|
1010 |
|
---|
1011 |
|
---|
1012 | '' Use by EnvPrintPrepend to skip ';' stripping.
|
---|
1013 | dim g_strAppendCleanEnvVars
|
---|
1014 |
|
---|
1015 | ''
|
---|
1016 | ' Print a statement appending strValue to strEnv, removing duplicate values.
|
---|
1017 | sub EnvPrintAppend(strEnv, strValue, strSep)
|
---|
1018 | ' Remove old values and any trailing separators.
|
---|
1019 | EnvPrintCleanup strEnv, strValue, strSep
|
---|
1020 | if InStr(1, g_strAppendCleanEnvVars, "|" & strEnv & "|") = 0 then
|
---|
1021 | FileAppendLine g_strEnvFile, "if ""%" & strEnv & ":~-1%""==""" & strSep & """ set " & strEnv & "=%" & strEnv & ":~0,-1%"
|
---|
1022 | FileAppendLine g_strEnvFile, "if ""%" & strEnv & ":~-1%""==""" & strSep & """ set " & strEnv & "=%" & strEnv & ":~0,-1%"
|
---|
1023 | g_strAppendCleanEnvVars = g_strAppendCleanEnvVars & "|" & strEnv & "|"
|
---|
1024 | end if
|
---|
1025 | ' Do the setting.
|
---|
1026 | FileAppendLine g_strEnvFile, "set " & strEnv & "=%" & strEnv & "%" & strSep & strValue
|
---|
1027 | end sub
|
---|
1028 |
|
---|
1029 |
|
---|
1030 | ''
|
---|
1031 | ' No COM
|
---|
1032 | sub DisableCOM(strReason)
|
---|
1033 | if g_blnDisableCOM = False then
|
---|
1034 | LogPrint "Disabled COM components: " & strReason
|
---|
1035 | g_blnDisableCOM = True
|
---|
1036 | g_strDisableCOM = strReason
|
---|
1037 | CfgPrint "VBOX_WITH_MAIN="
|
---|
1038 | CfgPrint "VBOX_WITH_QTGUI="
|
---|
1039 | CfgPrint "VBOX_WITH_VBOXSDL="
|
---|
1040 | CfgPrint "VBOX_WITH_DEBUGGER_GUI="
|
---|
1041 | end if
|
---|
1042 | end sub
|
---|
1043 |
|
---|
1044 |
|
---|
1045 | ''
|
---|
1046 | ' No UDPTunnel
|
---|
1047 | sub DisableUDPTunnel(strReason)
|
---|
1048 | if g_blnDisableUDPTunnel = False then
|
---|
1049 | LogPrint "Disabled UDPTunnel network transport: " & strReason
|
---|
1050 | g_blnDisableUDPTunnel = True
|
---|
1051 | g_strDisableUDPTunnel = strReason
|
---|
1052 | CfgPrint "VBOX_WITH_UDPTUNNEL="
|
---|
1053 | end if
|
---|
1054 | end sub
|
---|
1055 |
|
---|
1056 |
|
---|
1057 | ''
|
---|
1058 | ' No SDL
|
---|
1059 | sub DisableSDL(strReason)
|
---|
1060 | if g_blnDisableSDL = False then
|
---|
1061 | LogPrint "Disabled SDL frontend: " & strReason
|
---|
1062 | g_blnDisableSDL = True
|
---|
1063 | g_strDisableSDL = strReason
|
---|
1064 | CfgPrint "VBOX_WITH_VBOXSDL="
|
---|
1065 | end if
|
---|
1066 | end sub
|
---|
1067 |
|
---|
1068 |
|
---|
1069 | ''
|
---|
1070 | ' Checks the the path doesn't contain characters the tools cannot deal with.
|
---|
1071 | sub CheckSourcePath
|
---|
1072 | dim sPwd
|
---|
1073 |
|
---|
1074 | sPwd = PathAbs(g_strPath)
|
---|
1075 | if InStr(1, sPwd, " ") > 0 then
|
---|
1076 | MsgError "Source path contains spaces! Please move it. (" & sPwd & ")"
|
---|
1077 | end if
|
---|
1078 | if InStr(1, sPwd, "$") > 0 then
|
---|
1079 | MsgError "Source path contains the '$' char! Please move it. (" & sPwd & ")"
|
---|
1080 | end if
|
---|
1081 | if InStr(1, sPwd, "%") > 0 then
|
---|
1082 | MsgError "Source path contains the '%' char! Please move it. (" & sPwd & ")"
|
---|
1083 | end if
|
---|
1084 | if InStr(1, sPwd, Chr(10)) > 0 _
|
---|
1085 | Or InStr(1, sPwd, Chr(13)) > 0 _
|
---|
1086 | Or InStr(1, sPwd, Chr(9)) > 0 _
|
---|
1087 | then
|
---|
1088 | MsgError "Source path contains control characters! Please move it. (" & sPwd & ")"
|
---|
1089 | end if
|
---|
1090 | Print "Source path: OK"
|
---|
1091 | end sub
|
---|
1092 |
|
---|
1093 |
|
---|
1094 | ''
|
---|
1095 | ' Checks for kBuild - very simple :)
|
---|
1096 | sub CheckForkBuild(strOptkBuild)
|
---|
1097 | PrintHdr "kBuild"
|
---|
1098 |
|
---|
1099 | '
|
---|
1100 | ' Check if there is a 'kmk' in the path somewhere without
|
---|
1101 | ' any KBUILD_*PATH stuff around.
|
---|
1102 | '
|
---|
1103 | blnNeedEnvVars = True
|
---|
1104 | g_strPathkBuild = strOptkBuild
|
---|
1105 | g_strPathkBuildBin = ""
|
---|
1106 | if (g_strPathkBuild = "") _
|
---|
1107 | And (EnvGetFirst("KBUILD_PATH", "PATH_KBUILD") = "") _
|
---|
1108 | And (EnvGetFirst("KBUILD_BIN_PATH", "PATH_KBUILD_BIN") = "") _
|
---|
1109 | And (Shell("kmk.exe --version", True) = 0) _
|
---|
1110 | And (InStr(1,g_strShellOutput, "kBuild Make 0.1") > 0) _
|
---|
1111 | And (InStr(1,g_strShellOutput, "KBUILD_PATH") > 0) _
|
---|
1112 | And (InStr(1,g_strShellOutput, "KBUILD_BIN_PATH") > 0) then
|
---|
1113 | '' @todo Need to parse out the KBUILD_PATH and KBUILD_BIN_PATH values to complete the other tests.
|
---|
1114 | 'blnNeedEnvVars = False
|
---|
1115 | MsgWarning "You've installed kBuild it seems. configure.vbs hasn't been updated to " _
|
---|
1116 | & "deal with that yet and will use the one it ships with. Sorry."
|
---|
1117 | end if
|
---|
1118 |
|
---|
1119 | '
|
---|
1120 | ' Check for the KBUILD_PATH env.var. and fall back on root/kBuild otherwise.
|
---|
1121 | '
|
---|
1122 | if g_strPathkBuild = "" then
|
---|
1123 | g_strPathkBuild = EnvGetFirst("KBUILD_PATH", "PATH_KBUILD")
|
---|
1124 | if (g_strPathkBuild <> "") and (FileExists(g_strPathkBuild & "/footer.kmk") = False) then
|
---|
1125 | MsgWarning "Ignoring incorrect kBuild path (KBUILD_PATH=" & g_strPathkBuild & ")"
|
---|
1126 | g_strPathkBuild = ""
|
---|
1127 | end if
|
---|
1128 |
|
---|
1129 | if g_strPathkBuild = "" then
|
---|
1130 | g_strPathkBuild = g_strPath & "/kBuild"
|
---|
1131 | end if
|
---|
1132 | end if
|
---|
1133 |
|
---|
1134 | g_strPathkBuild = UnixSlashes(PathAbs(g_strPathkBuild))
|
---|
1135 |
|
---|
1136 | '
|
---|
1137 | ' Check for env.vars that kBuild uses (do this early to set g_strTargetArch).
|
---|
1138 | '
|
---|
1139 | str = EnvGetFirst("KBUILD_TYPE", "BUILD_TYPE")
|
---|
1140 | if (str <> "") _
|
---|
1141 | And (InStr(1, "|release|debug|profile|kprofile", str) <= 0) then
|
---|
1142 | EnvPrint "set KBUILD_TYPE=release"
|
---|
1143 | EnvSet "KBUILD_TYPE", "release"
|
---|
1144 | MsgWarning "Found unknown KBUILD_TYPE value '" & str &"' in your environment. Setting it to 'release'."
|
---|
1145 | end if
|
---|
1146 |
|
---|
1147 | str = EnvGetFirst("KBUILD_TARGET", "BUILD_TARGET")
|
---|
1148 | if (str <> "") _
|
---|
1149 | And (InStr(1, "win|win32|win64", str) <= 0) then '' @todo later only 'win' will be valid. remember to fix this check!
|
---|
1150 | EnvPrint "set KBUILD_TARGET=win"
|
---|
1151 | EnvSet "KBUILD_TARGET", "win"
|
---|
1152 | MsgWarning "Found unknown KBUILD_TARGET value '" & str &"' in your environment. Setting it to 'win32'."
|
---|
1153 | end if
|
---|
1154 |
|
---|
1155 | str = EnvGetFirst("KBUILD_TARGET_ARCH", "BUILD_TARGET_ARCH")
|
---|
1156 | if (str <> "") _
|
---|
1157 | And (InStr(1, "x86|amd64", str) <= 0) then
|
---|
1158 | EnvPrint "set KBUILD_TARGET_ARCH=x86"
|
---|
1159 | EnvSet "KBUILD_TARGET_ARCH", "x86"
|
---|
1160 | MsgWarning "Found unknown KBUILD_TARGET_ARCH value '" & str &"' in your environment. Setting it to 'x86'."
|
---|
1161 | str = "x86"
|
---|
1162 | end if
|
---|
1163 | if g_strTargetArch = "" then '' command line parameter --target-arch=x86|amd64 has priority
|
---|
1164 | if str <> "" then
|
---|
1165 | g_strTargetArch = str
|
---|
1166 | elseif (EnvGet("PROCESSOR_ARCHITEW6432") = "AMD64" ) _
|
---|
1167 | Or (EnvGet("PROCESSOR_ARCHITECTURE") = "AMD64" ) then
|
---|
1168 | g_strTargetArch = "amd64"
|
---|
1169 | else
|
---|
1170 | g_strTargetArch = "x86"
|
---|
1171 | end if
|
---|
1172 | else
|
---|
1173 | if InStr(1, "x86|amd64", g_strTargetArch) <= 0 then
|
---|
1174 | EnvPrint "set KBUILD_TARGET_ARCH=x86"
|
---|
1175 | EnvSet "KBUILD_TARGET_ARCH", "x86"
|
---|
1176 | MsgWarning "Unknown --target-arch=" & str &". Setting it to 'x86'."
|
---|
1177 | end if
|
---|
1178 | end if
|
---|
1179 | LogPrint " Target architecture: " & g_strTargetArch & "."
|
---|
1180 | Wscript.Echo " Target architecture: " & g_strTargetArch & "."
|
---|
1181 | EnvPrint "set KBUILD_TARGET_ARCH=" & g_strTargetArch
|
---|
1182 |
|
---|
1183 | ' Windows variant of the arch name.
|
---|
1184 | g_strTargetArchWin = g_strTargetArch
|
---|
1185 | if g_strTargetArchWin = "amd64" then g_strTargetArchWin = "x64"
|
---|
1186 |
|
---|
1187 | str = EnvGetFirst("KBUILD_TARGET_CPU", "BUILD_TARGET_CPU")
|
---|
1188 | ' perhaps a bit pedantic this since this isn't clearly define nor used much...
|
---|
1189 | if (str <> "") _
|
---|
1190 | And (InStr(1, "i386|i486|i686|i786|i868|k5|k6|k7|k8", str) <= 0) then
|
---|
1191 | EnvPrint "set BUILD_TARGET_CPU=i386"
|
---|
1192 | EnvSet "KBUILD_TARGET_CPU", "i386"
|
---|
1193 | MsgWarning "Found unknown KBUILD_TARGET_CPU value '" & str &"' in your environment. Setting it to 'i386'."
|
---|
1194 | end if
|
---|
1195 |
|
---|
1196 | str = EnvGetFirst("KBUILD_HOST", "BUILD_PLATFORM")
|
---|
1197 | if (str <> "") _
|
---|
1198 | And (InStr(1, "win|win32|win64", str) <= 0) then '' @todo later only 'win' will be valid. remember to fix this check!
|
---|
1199 | EnvPrint "set KBUILD_HOST=win"
|
---|
1200 | EnvSet "KBUILD_HOST", "win"
|
---|
1201 | MsgWarning "Found unknown KBUILD_HOST value '" & str &"' in your environment. Setting it to 'win32'."
|
---|
1202 | end if
|
---|
1203 |
|
---|
1204 | str = EnvGetFirst("KBUILD_HOST_ARCH", "BUILD_PLATFORM_ARCH")
|
---|
1205 | if str <> "" then
|
---|
1206 | if InStr(1, "x86|amd64", str) <= 0 then
|
---|
1207 | str = "x86"
|
---|
1208 | MsgWarning "Found unknown KBUILD_HOST_ARCH value '" & str &"' in your environment. Setting it to 'x86'."
|
---|
1209 | end if
|
---|
1210 | elseif (EnvGet("PROCESSOR_ARCHITEW6432") = "AMD64" ) _
|
---|
1211 | Or (EnvGet("PROCESSOR_ARCHITECTURE") = "AMD64" ) then
|
---|
1212 | str = "amd64"
|
---|
1213 | else
|
---|
1214 | str = "x86"
|
---|
1215 | end if
|
---|
1216 | LogPrint " Host architecture: " & str & "."
|
---|
1217 | Wscript.Echo " Host architecture: " & str & "."
|
---|
1218 | EnvPrint "set KBUILD_HOST_ARCH=" & str
|
---|
1219 | g_strHostArch = str
|
---|
1220 |
|
---|
1221 | ' Windows variant of the arch name.
|
---|
1222 | g_strHostArchWin = g_strHostArch
|
---|
1223 | if g_strHostArchWin = "amd64" then g_strHostArchWin = "x64"
|
---|
1224 |
|
---|
1225 |
|
---|
1226 | str = EnvGetFirst("KBUILD_HOST_CPU", "BUILD_PLATFORM_CPU")
|
---|
1227 | ' perhaps a bit pedantic this since this isn't clearly define nor used much...
|
---|
1228 | if (str <> "") _
|
---|
1229 | And (InStr(1, "i386|i486|i686|i786|i868|k5|k6|k7|k8", str) <= 0) then
|
---|
1230 | EnvPrint "set KBUILD_HOST_CPU=i386"
|
---|
1231 | EnvSet "KBUILD_HOST_CPU", "i386"
|
---|
1232 | MsgWarning "Found unknown KBUILD_HOST_CPU value '" & str &"' in your environment. Setting it to 'i386'."
|
---|
1233 | end if
|
---|
1234 |
|
---|
1235 | '
|
---|
1236 | ' Determin the location of the kBuild binaries.
|
---|
1237 | '
|
---|
1238 | if g_strPathkBuildBin = "" then
|
---|
1239 | g_strPathkBuildBin = g_strPathkBuild & "/bin/win." & g_strHostArch
|
---|
1240 | if FileExists(g_strPathkBuildBin & "/kmk.exe") = False then
|
---|
1241 | g_strPathkBuildBin = g_strPathkBuild & "/bin/win.x86"
|
---|
1242 | end if
|
---|
1243 | end if
|
---|
1244 | g_strPathkBuildBin = UnixSlashes(PathAbs(g_strPathkBuildBin))
|
---|
1245 |
|
---|
1246 | '
|
---|
1247 | ' Perform basic validations of the kBuild installation.
|
---|
1248 | '
|
---|
1249 | if (FileExists(g_strPathkBuild & "/footer.kmk") = False) _
|
---|
1250 | Or (FileExists(g_strPathkBuild & "/header.kmk") = False) _
|
---|
1251 | Or (FileExists(g_strPathkBuild & "/rules.kmk") = False) then
|
---|
1252 | MsgFatal "Can't find valid kBuild at '" & g_strPathkBuild & "'. Either there is an " _
|
---|
1253 | & "incorrect KBUILD_PATH in the environment or the checkout didn't succeed."
|
---|
1254 | exit sub
|
---|
1255 | end if
|
---|
1256 | if (FileExists(g_strPathkBuildBin & "/kmk.exe") = False) _
|
---|
1257 | Or (FileExists(g_strPathkBuildBin & "/kmk_ash.exe") = False) then
|
---|
1258 | MsgFatal "Can't find valid kBuild binaries at '" & g_strPathkBuildBin & "'. Either there is an " _
|
---|
1259 | & "incorrect KBUILD_PATH in the environment or the checkout didn't succeed."
|
---|
1260 | exit sub
|
---|
1261 | end if
|
---|
1262 |
|
---|
1263 | if (Shell(DosSlashes(g_strPathkBuildBin & "/kmk.exe") & " --version", True) <> 0) then
|
---|
1264 | MsgFatal "Can't execute '" & g_strPathkBuildBin & "/kmk.exe --version'. check configure.log for the out."
|
---|
1265 | exit sub
|
---|
1266 | end if
|
---|
1267 |
|
---|
1268 | '
|
---|
1269 | ' If KBUILD_DEVTOOLS is set, check that it's pointing to something useful.
|
---|
1270 | '
|
---|
1271 | str = UnixSlashes(EnvGet("KBUILD_DEVTOOLS"))
|
---|
1272 | g_strPathDev = str
|
---|
1273 | if str <> "" _
|
---|
1274 | and LogDirExists(str & "/bin") _
|
---|
1275 | and LogDirExists(str & "/win.amd64/bin") _
|
---|
1276 | and LogDirExists(str & "/win.x86/bin") _
|
---|
1277 | then
|
---|
1278 | LogPrint "Found KBUILD_DEVTOOLS='" & str & "'."
|
---|
1279 | elseif str <> "" then
|
---|
1280 | MsgWarning "Ignoring bogus KBUILD_DEVTOOLS='" & str &"' in your environment!"
|
---|
1281 | g_strPathDev = strNew
|
---|
1282 | end if
|
---|
1283 | if g_strPathDev = "" then
|
---|
1284 | g_strPathDev = UnixSlashes(g_strPath & "/tools")
|
---|
1285 | LogPrint "Using KBUILD_DEVTOOLS='" & g_strPathDev & "'."
|
---|
1286 | if str <> "" then
|
---|
1287 | EnvPrint "set KBUILD_DEVTOOLS=" & g_strPathDev
|
---|
1288 | EnvSet "KBUILD_DEVTOOLS", g_strPathDev
|
---|
1289 | end if
|
---|
1290 | end if
|
---|
1291 |
|
---|
1292 | '
|
---|
1293 | ' Write KBUILD_PATH and updated PATH to the environment script if necessary.
|
---|
1294 | '
|
---|
1295 | if blnNeedEnvVars = True then
|
---|
1296 | EnvPrint "set KBUILD_PATH=" & g_strPathkBuild
|
---|
1297 | EnvSet "KBUILD_PATH", g_strPathkBuild
|
---|
1298 |
|
---|
1299 | if Right(g_strPathkBuildBin, 7) = "win.x86" then
|
---|
1300 | EnvPrintCleanup "PATH", DosSlashes(Left(g_strPathkBuildBin, Len(g_strPathkBuildBin) - 7) & "win.amd64"), ";"
|
---|
1301 | end if
|
---|
1302 | if Right(g_strPathkBuildBin, 9) = "win.amd64" then
|
---|
1303 | EnvPrintCleanup "PATH", DosSlashes(Left(g_strPathkBuildBin, Len(g_strPathkBuildBin) - 9) & "win.x86"), ";"
|
---|
1304 | end if
|
---|
1305 | EnvPrintPrepend "PATH", DosSlashes(g_strPathkBuildBin), ";"
|
---|
1306 | EnvPrepend "PATH", g_strPathkBuildBin & ";"
|
---|
1307 | end if
|
---|
1308 |
|
---|
1309 | PrintResult "kBuild", g_strPathkBuild
|
---|
1310 | PrintResult "kBuild binaries", g_strPathkBuildBin
|
---|
1311 | end sub
|
---|
1312 |
|
---|
1313 | ''
|
---|
1314 | ' Class we use for detecting VisualC++
|
---|
1315 | class VisualCPPState
|
---|
1316 | public m_blnFound
|
---|
1317 | public m_strPathVC
|
---|
1318 | public m_strPathVCCommon
|
---|
1319 | public m_strVersion
|
---|
1320 | public m_strClVersion
|
---|
1321 | public m_blnNewLayout
|
---|
1322 |
|
---|
1323 | private sub Class_Initialize
|
---|
1324 | m_blnFound = False
|
---|
1325 | m_strPathVC = ""
|
---|
1326 | m_strPathVCCommon = ""
|
---|
1327 | m_strVersion = ""
|
---|
1328 | m_strClVersion = ""
|
---|
1329 | m_blnNewLayout = false
|
---|
1330 | end sub
|
---|
1331 |
|
---|
1332 | public function checkClExe(strClExe)
|
---|
1333 | ' We'll have to make sure mspdbXX.dll is somewhere in the PATH.
|
---|
1334 | dim strSavedPath, rcExit
|
---|
1335 |
|
---|
1336 | strSavedPath = EnvGet("PATH")
|
---|
1337 | if (m_strPathVCCommon <> "") then
|
---|
1338 | EnvAppend "PATH", ";" & m_strPathVCCommon & "/IDE"
|
---|
1339 | end if
|
---|
1340 | rcExit = Shell(DosSlashes(strClExe), True)
|
---|
1341 | EnvSet "PATH", strSavedPath
|
---|
1342 |
|
---|
1343 | checkClExe = False
|
---|
1344 | if rcExit = 0 then
|
---|
1345 | ' Extract the ' Version xx.yy.build.zz for arch' bit.
|
---|
1346 | dim offVer, offEol, strVer
|
---|
1347 | strVer = ""
|
---|
1348 | offVer = InStr(1, g_strShellOutput, " Version ")
|
---|
1349 | if offVer > 0 then
|
---|
1350 | offVer = offVer + Len(" Version ")
|
---|
1351 | offEol = InStr(offVer, g_strShellOutput, Chr(13))
|
---|
1352 | if offEol > 0 then
|
---|
1353 | strVer = Trim(Mid(g_strShellOutput, offVer, offEol - offVer))
|
---|
1354 | end if
|
---|
1355 | end if
|
---|
1356 |
|
---|
1357 | ' Check that it's a supported version
|
---|
1358 | checkClExe = True
|
---|
1359 | if InStr(1, strVer, "16.") = 1 then
|
---|
1360 | m_strVersion = "VCC110"
|
---|
1361 | elseif InStr(1, strVer, "17.") = 1 then
|
---|
1362 | m_strVersion = "VCC111"
|
---|
1363 | LogPrint "The Visual C++ compiler ('" & strClExe & "') version isn't really supported, but may work: " & strVer
|
---|
1364 | elseif InStr(1, strVer, "18.") = 1 then
|
---|
1365 | m_strVersion = "VCC112"
|
---|
1366 | LogPrint "The Visual C++ compiler ('" & strClExe & "') version isn't really supported, but may work: " & strVer
|
---|
1367 | elseif InStr(1, strVer, "19.0") = 1 then
|
---|
1368 | m_strVersion = "VCC140"
|
---|
1369 | LogPrint "The Visual C++ compiler ('" & strClExe & "') version isn't really supported, but may work: " & strVer
|
---|
1370 | elseif InStr(1, strVer, "19.1") = 1 then
|
---|
1371 | m_strVersion = "VCC141"
|
---|
1372 | LogPrint "The Visual C++ compiler ('" & strClExe & "') version isn't really supported, but may work: " & strVer
|
---|
1373 | elseif InStr(1, strVer, "19.2") = 1 then
|
---|
1374 | m_strVersion = "VCC142"
|
---|
1375 | else
|
---|
1376 | LogPrint "The Visual C++ compiler we found ('" & strClExe & "') isn't in the 10.0-19.2x range (" & strVer & ")."
|
---|
1377 | LogPrint "Check the build requirements and select the appropriate compiler version."
|
---|
1378 | checkClExe = False
|
---|
1379 | exit function
|
---|
1380 | end if
|
---|
1381 | LogPrint "'" & strClExe & "' = " & m_strVersion & " (" & strVer & ")"
|
---|
1382 | else
|
---|
1383 | LogPrint "Executing '" & strClExe & "' (which we believe to be the Visual C++ compiler driver) failed (rcExit=" & rcExit & ")."
|
---|
1384 | end if
|
---|
1385 | end function
|
---|
1386 |
|
---|
1387 | public function checkInner(strPathVC) ' For the new layout only
|
---|
1388 | if m_blnFound = False then
|
---|
1389 | if LogDirExists(strPathVC & "/bin") _
|
---|
1390 | and LogDirExists(strPathVC & "/lib") _
|
---|
1391 | and LogDirExists(strPathVC & "/include") _
|
---|
1392 | and LogFileExists(strPathVC, "include/stdarg.h") _
|
---|
1393 | and LogFileExists(strPathVC, "lib/x64/libcpmt.lib") _
|
---|
1394 | and LogFileExists(strPathVC, "lib/x86/libcpmt.lib") _
|
---|
1395 | then
|
---|
1396 | LogPrint " => seems okay. new layout."
|
---|
1397 | m_blnFound = checkClExe(strPathVC & "/bin/Host" & g_strHostArchWin & "/bin/" & g_strHostArchWin & "/cl.exe")
|
---|
1398 | if m_blnFound then
|
---|
1399 | m_strPathVC = strPathVC
|
---|
1400 | end if
|
---|
1401 | end if
|
---|
1402 | end if
|
---|
1403 | checkInner = m_blnFound
|
---|
1404 | end function
|
---|
1405 |
|
---|
1406 | public function check(strPathVC, strPathVCommon)
|
---|
1407 | if (m_blnFound = False) and (strPathVC <> "") then
|
---|
1408 | m_strPathVC = UnixSlashes(PathAbs(strPathVC))
|
---|
1409 | m_strPathVCCommon = strPathVCCommon
|
---|
1410 | m_strVersion = ""
|
---|
1411 |
|
---|
1412 | LogPrint "Trying: strPathVC=" & m_strPathVC & " strPathVCCommon=" & m_strPathVCCommon
|
---|
1413 | if LogDirExists(m_strPathVC) then
|
---|
1414 | ' 15.0+ layout? This is fun because of the multiple CL versions (/tools/msvc/xx.yy.bbbbb/).
|
---|
1415 | ' OTOH, the user may have pointed us directly to one of them.
|
---|
1416 | if LogDirExists(m_strPathVC & "/Tools/MSVC") then
|
---|
1417 | m_blnNewLayout = True
|
---|
1418 | LogPrint " => seems okay. new layout."
|
---|
1419 | dim arrFolders, i
|
---|
1420 | arrFolders = GetSubdirsStartingWithSorted(m_strPathVC & "/Tools/MSVC", "14.2")
|
---|
1421 | if UBound(arrFolders) < 0 then arrFolders = GetSubdirsStartingWithSorted(m_strPathVC & "/Tools/MSVC", "14.1")
|
---|
1422 | if UBound(arrFolders) < 0 then arrFolders = GetSubdirsStartingWithSorted(m_strPathVC & "/Tools/MSVC", "1")
|
---|
1423 | for i = UBound(arrFolders) to LBound(arrFolders) step -1
|
---|
1424 | if checkInner(m_strPathVC & "/Tools/MSVC/" & arrFolders(i)) then exit for ' modifies m_strPathVC on success
|
---|
1425 | next
|
---|
1426 | elseif LogDirExists(m_strPathVC & "/bin/HostX64") _
|
---|
1427 | or LogDirExists(m_strPathVC & "/bin/HostX86") then
|
---|
1428 | checkInner(m_strPathVC)
|
---|
1429 | ' 14.0 and older layout?
|
---|
1430 | elseif LogFileExists(m_strPathVC, "/bin/cl.exe") then
|
---|
1431 | m_blnNewLayout = False
|
---|
1432 | if LogFileExists(m_strPathVC, "bin/link.exe") _
|
---|
1433 | and LogFileExists(m_strPathVC, "include/string.h") _
|
---|
1434 | and LogFileExists(m_strPathVC, "lib/libcmt.lib") _
|
---|
1435 | and LogFileExists(m_strPathVC, "lib/msvcrt.lib") _
|
---|
1436 | then
|
---|
1437 | LogPrint " => seems okay. old layout."
|
---|
1438 | m_blnFound = checkClExe(m_strPathVC & "/bin/cl.exe")
|
---|
1439 | end if
|
---|
1440 | end if
|
---|
1441 | end if
|
---|
1442 | end if
|
---|
1443 | check = m_bldFound
|
---|
1444 | end function
|
---|
1445 |
|
---|
1446 | public function checkProg(strProg)
|
---|
1447 | if m_blnFound = False then
|
---|
1448 | dim str, i, offNewLayout
|
---|
1449 | str = Which(strProg)
|
---|
1450 | if str <> "" then
|
---|
1451 | LogPrint "checkProg: '" & strProg & "' -> '" & str & "'"
|
---|
1452 | if FileExists(PathStripFilename(str) & "/build.exe") then
|
---|
1453 | Warning "Ignoring DDK cl.exe (" & str & ")." ' don't know how to deal with this cl.
|
---|
1454 | else
|
---|
1455 | ' Assume we've got cl.exe from somewhere under the 'bin' directory..
|
---|
1456 | m_strPathVC = PathParent(PathStripFilename(str))
|
---|
1457 | for i = 1 To 5
|
---|
1458 | if LogDirExists(m_strPathVC & "/include") then
|
---|
1459 | m_strPathVCCommon = PathParent(m_strPathVC) & "/Common7"
|
---|
1460 | if DirExists(m_strPathVCCommon) = False then
|
---|
1461 | m_strPathVCCommon = ""
|
---|
1462 | ' New layout?
|
---|
1463 | offNewLayout = InStr(1, LCase(DosSlashes(m_strPathVC)), "\tools\msvc\")
|
---|
1464 | if offNewLayout > 0 then m_strPathVC = Left(m_strPathVC, offNewLayout)
|
---|
1465 | end if
|
---|
1466 | check m_strPathVC, m_strPathVCCommon
|
---|
1467 | exit for
|
---|
1468 | end if
|
---|
1469 | m_strPathVC = PathParent(m_strPathVC)
|
---|
1470 | next
|
---|
1471 | end if
|
---|
1472 | end if
|
---|
1473 | end if
|
---|
1474 | checkProg = m_bldFound
|
---|
1475 | end function
|
---|
1476 |
|
---|
1477 | public function checkProgFiles(strSubdir)
|
---|
1478 | if m_blnFound = False then
|
---|
1479 | dim strProgFiles
|
---|
1480 | for each strProgFiles in g_arrProgramFiles
|
---|
1481 | check strProgFiles & "/" & strSubdir, ""
|
---|
1482 | next
|
---|
1483 | end if
|
---|
1484 | checkProgFiles = m_blnFound
|
---|
1485 | end function
|
---|
1486 |
|
---|
1487 | public function checkRegistry(strValueNm, strVCSubdir, strVCommonSubdir)
|
---|
1488 | if m_blnFound = False then
|
---|
1489 | dim str, strPrefix, arrPrefixes
|
---|
1490 | arrPrefixes = Array("HKLM\SOFTWARE\Wow6432Node\", "HKLM\SOFTWARE\", "HKCU\SOFTWARE\Wow6432Node\", "HKCU\SOFTWARE\")
|
---|
1491 | for each strPrefix in arrPrefixes
|
---|
1492 | str = RegGetString(strPrefix & strValueNm)
|
---|
1493 | if str <> "" then
|
---|
1494 | LogPrint "checkRegistry: '" & strPrefix & strValueNm & "' -> '" & str & "'"
|
---|
1495 | if check(str & strVCSubdir, str & strVCommonSubdir) = True then
|
---|
1496 | exit for
|
---|
1497 | end if
|
---|
1498 | end if
|
---|
1499 | next
|
---|
1500 | end if
|
---|
1501 | checkRegistry = m_bldFound
|
---|
1502 | end function
|
---|
1503 |
|
---|
1504 | public function checkInternal
|
---|
1505 | check g_strPathDev & "/win.amd64/vcc/v14.2", ""
|
---|
1506 | check g_strPathDev & "/win.amd64/vcc/v14.1", ""
|
---|
1507 | check g_strPathDev & "/win.amd64/vcc/v14.0", ""
|
---|
1508 | check g_strPathDev & "/win.amd64/vcc/v10sp1", ""
|
---|
1509 | check g_strPathDev & "/win.x86/vcc/v10sp1", ""
|
---|
1510 | checkInternal = m_blnFound
|
---|
1511 | end function
|
---|
1512 | end class
|
---|
1513 |
|
---|
1514 | ''
|
---|
1515 | ' Checks for Visual C++ version 10 (2010).
|
---|
1516 | sub CheckForVisualCPP(strOptVC, strOptVCCommon)
|
---|
1517 | PrintHdr "Visual C++"
|
---|
1518 |
|
---|
1519 | '
|
---|
1520 | ' Try find it...
|
---|
1521 | '
|
---|
1522 | dim objState, strProgFiles
|
---|
1523 | set objState = new VisualCPPState
|
---|
1524 | objState.check strOptVC, strOptVCCommon
|
---|
1525 | if g_blnInternalFirst = True then objState.checkInternal
|
---|
1526 | objState.checkProg "cl.exe"
|
---|
1527 | objState.checkProgFiles "Microsoft Visual Studio\2019\BuildTools\VC"
|
---|
1528 | objState.checkProgFiles "Microsoft Visual Studio\2019\Professional\VC"
|
---|
1529 | objState.checkProgFiles "Microsoft Visual Studio\2019\Community\VC"
|
---|
1530 | objState.checkRegistry "Microsoft\VisualStudio\SxS\VS7\16.0", "VC", "" ' doesn't work.
|
---|
1531 | objState.checkProgFiles "Microsoft Visual Studio\2017\BuildTools\VC"
|
---|
1532 | objState.checkProgFiles "Microsoft Visual Studio\2017\Professional\VC"
|
---|
1533 | objState.checkProgFiles "Microsoft Visual Studio\2017\Community\VC"
|
---|
1534 | objState.checkProgFiles "Microsoft Visual Studio\2017\Express\VC"
|
---|
1535 | objState.checkRegistry "Microsoft\VisualStudio\SxS\VS7\15.0", "VC", ""
|
---|
1536 | objState.checkRegistry "Microsoft\VisualStudio\SxS\VS7\14.0", "VC", "Common7"
|
---|
1537 | objState.checkRegistry "Microsoft\VisualStudio\SxS\VS7\12.0", "VC", "Common7" '?
|
---|
1538 | objState.checkRegistry "Microsoft\VisualStudio\SxS\VS7\11.0", "VC", "Common7" '?
|
---|
1539 | objState.checkRegistry "Microsoft\VisualStudio\10.0\Setup\VS\ProductDir", "VC", "Common7"
|
---|
1540 | if g_blnInternalFirst = False then objState.checkInternal
|
---|
1541 |
|
---|
1542 | if objState.m_blnFound = False then
|
---|
1543 | MsgError "Cannot find cl.exe (Visual C++) anywhere on your system. Check the build requirements."
|
---|
1544 | exit sub
|
---|
1545 | end if
|
---|
1546 | g_strPathVCC = objState.m_strPathVC
|
---|
1547 | g_strVCCVersion = objState.m_strVersion
|
---|
1548 |
|
---|
1549 | '
|
---|
1550 | ' Ok, emit build config variables.
|
---|
1551 | '
|
---|
1552 | CfgPrint "VBOX_VCC_TOOL_STEM := " & objState.m_strVersion
|
---|
1553 | CfgPrint "PATH_TOOL_" & objState.m_strVersion & " := " & g_strPathVCC
|
---|
1554 | CfgPrint "PATH_TOOL_" & objState.m_strVersion & "X86 := $(PATH_TOOL_" & objState.m_strVersion & ")"
|
---|
1555 | CfgPrint "PATH_TOOL_" & objState.m_strVersion & "AMD64 := $(PATH_TOOL_" & objState.m_strVersion & ")"
|
---|
1556 |
|
---|
1557 | if objState.m_strVersion = "VCC100" _
|
---|
1558 | or objState.m_strVersion = "VCC110" _
|
---|
1559 | or objState.m_strVersion = "VCC120" _
|
---|
1560 | or objState.m_strVersion = "VCC140" _
|
---|
1561 | then
|
---|
1562 | CfgPrint "VBOX_WITH_NEW_VCC :=" '?? for VCC110+
|
---|
1563 | else
|
---|
1564 | CfgPrint "VBOX_WITH_NEW_VCC := 1"
|
---|
1565 | end if
|
---|
1566 | PrintResult "Visual C++ " & objState.m_strVersion, g_strPathVCC
|
---|
1567 |
|
---|
1568 | ' And the env.bat path fix.
|
---|
1569 | if objState.m_strPathVCCommon <> "" then
|
---|
1570 | EnvPrintAppend "PATH", DosSlashes(objState.m_strPathVCCommon) & "\IDE", ";"
|
---|
1571 | end if
|
---|
1572 | end sub
|
---|
1573 |
|
---|
1574 | ''
|
---|
1575 | ' Checks for a platform SDK that works with the compiler
|
---|
1576 | sub CheckForPlatformSDK(strOptSDK)
|
---|
1577 | dim strPathPSDK, str
|
---|
1578 | PrintHdr "Windows Platform SDK (recent)"
|
---|
1579 |
|
---|
1580 | strPathPSDK = ""
|
---|
1581 |
|
---|
1582 | ' Check the supplied argument first.
|
---|
1583 | str = strOptSDK
|
---|
1584 | if str <> "" then
|
---|
1585 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1586 | end if
|
---|
1587 |
|
---|
1588 | ' The tools location (first).
|
---|
1589 | if strPathPSDK = "" And g_blnInternalFirst then
|
---|
1590 | str = g_strPathDev & "/win.x86/sdk/v7.1"
|
---|
1591 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1592 | end if
|
---|
1593 |
|
---|
1594 | if strPathPSDK = "" And g_blnInternalFirst then
|
---|
1595 | str = g_strPathDev & "/win.x86/sdk/v8.0"
|
---|
1596 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1597 | end if
|
---|
1598 |
|
---|
1599 | ' Look for it in the environment
|
---|
1600 | str = EnvGet("MSSdk")
|
---|
1601 | if strPathPSDK = "" And str <> "" then
|
---|
1602 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1603 | end if
|
---|
1604 |
|
---|
1605 | str = EnvGet("Mstools")
|
---|
1606 | if strPathPSDK = "" And str <> "" then
|
---|
1607 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1608 | end if
|
---|
1609 |
|
---|
1610 | ' Check if there is one installed with the compiler.
|
---|
1611 | if strPathPSDK = "" And str <> "" then
|
---|
1612 | str = g_strPathVCC & "/PlatformSDK"
|
---|
1613 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1614 | end if
|
---|
1615 |
|
---|
1616 | ' Check the registry next (ASSUMES sorting).
|
---|
1617 | arrSubKeys = RegEnumSubKeysRSort("HKLM", "SOFTWARE\Microsoft\Microsoft SDKs\Windows")
|
---|
1618 | for each strSubKey in arrSubKeys
|
---|
1619 | str = RegGetString("HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\" & strSubKey & "\InstallationFolder")
|
---|
1620 | if strPathPSDK = "" And str <> "" then
|
---|
1621 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1622 | end if
|
---|
1623 | Next
|
---|
1624 | arrSubKeys = RegEnumSubKeysRSort("HKCU", "SOFTWARE\Microsoft\Microsoft SDKs\Windows")
|
---|
1625 | for each strSubKey in arrSubKeys
|
---|
1626 | str = RegGetString("HKCU\SOFTWARE\Microsoft\Microsoft SDKs\Windows\" & strSubKey & "\InstallationFolder")
|
---|
1627 | if strPathPSDK = "" And str <> "" then
|
---|
1628 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1629 | end if
|
---|
1630 | Next
|
---|
1631 |
|
---|
1632 | ' The tools location (post).
|
---|
1633 | if (strPathPSDK = "") And (g_blnInternalFirst = False) then
|
---|
1634 | str = g_strPathDev & "/win.x86/sdk/v7.1"
|
---|
1635 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1636 | end if
|
---|
1637 |
|
---|
1638 | if (strPathPSDK = "") And (g_blnInternalFirst = False) then
|
---|
1639 | str = g_strPathDev & "/win.x86/sdk/v8.0"
|
---|
1640 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1641 | end if
|
---|
1642 |
|
---|
1643 | ' Give up.
|
---|
1644 | if strPathPSDK = "" then
|
---|
1645 | MsgError "Cannot find a suitable Platform SDK. Check configure.log and the build requirements."
|
---|
1646 | exit sub
|
---|
1647 | end if
|
---|
1648 |
|
---|
1649 | '
|
---|
1650 | ' Emit the config.
|
---|
1651 | '
|
---|
1652 | strPathPSDK = UnixSlashes(PathAbs(strPathPSDK))
|
---|
1653 | CfgPrint "PATH_SDK_WINPSDK" & g_strVerPSDK & " := " & strPathPSDK
|
---|
1654 | CfgPrint "VBOX_WINPSDK := WINPSDK" & g_strVerPSDK
|
---|
1655 |
|
---|
1656 | PrintResult "Windows Platform SDK (v" & g_strVerPSDK & ")", strPathPSDK
|
---|
1657 | g_strPathPSDK = strPathPSDK
|
---|
1658 | end sub
|
---|
1659 |
|
---|
1660 | ''
|
---|
1661 | ' Checks if the specified path points to a usable PSDK.
|
---|
1662 | function CheckForPlatformSDKSub(strPathPSDK)
|
---|
1663 | CheckForPlatformSDKSub = False
|
---|
1664 | LogPrint "trying: strPathPSDK=" & strPathPSDK
|
---|
1665 | if LogFileExists(strPathPSDK, "include/Windows.h") _
|
---|
1666 | And LogFileExists(strPathPSDK, "lib/Kernel32.Lib") _
|
---|
1667 | And LogFileExists(strPathPSDK, "lib/User32.Lib") _
|
---|
1668 | And LogFileExists(strPathPSDK, "bin/rc.exe") _
|
---|
1669 | And Shell("""" & DosSlashes(strPathPSDK & "/bin/rc.exe") & """" , True) <> 0 _
|
---|
1670 | then
|
---|
1671 | if InStr(1, g_strShellOutput, "Resource Compiler Version 6.2.") > 0 then
|
---|
1672 | g_strVerPSDK = "80"
|
---|
1673 | CheckForPlatformSDKSub = True
|
---|
1674 | elseif InStr(1, g_strShellOutput, "Resource Compiler Version 6.1.") > 0 then
|
---|
1675 | g_strVerPSDK = "71"
|
---|
1676 | CheckForPlatformSDKSub = True
|
---|
1677 | end if
|
---|
1678 | end if
|
---|
1679 | end function
|
---|
1680 |
|
---|
1681 |
|
---|
1682 | ''
|
---|
1683 | ' Checks for a platform SDK that works with the compiler
|
---|
1684 | sub CheckForSDK10(strOptSDK10, strOptSDK10Version)
|
---|
1685 | dim strPathSDK10, strSDK10Version, str
|
---|
1686 | PrintHdr "Windows 10 SDK/WDK"
|
---|
1687 | '' @todo implement strOptSDK10Version
|
---|
1688 |
|
---|
1689 | '
|
---|
1690 | ' Try find the Windows 10 kit.
|
---|
1691 | '
|
---|
1692 | strSDK10Version = ""
|
---|
1693 | strPathSDK10 = CheckForSDK10Sub(strOptSDK10, strSDK10Version)
|
---|
1694 | if strPathSDK10 = "" and g_blnInternalFirst = True then strPathSDK10 = CheckForSDK10ToolsSub(strSDK10Version)
|
---|
1695 | if strPathSDK10 = "" then
|
---|
1696 | str = RegGetString("HKLM\SOFTWARE\Microsoft\Windows Kits\Installed Roots\KitsRoot10")
|
---|
1697 | strPathSDK10 = CheckForSDK10Sub(str, strSDK10Version)
|
---|
1698 | end if
|
---|
1699 | if strPathSDK10 = "" then
|
---|
1700 | for each str in g_arrProgramFiles
|
---|
1701 | strPathSDK10 = CheckForSDK10Sub(str & "/Windows Kits/10", strSDK10Version)
|
---|
1702 | if strPathSDK10 <> "" then exit for
|
---|
1703 | next
|
---|
1704 | end if
|
---|
1705 | if strPathSDK10 = "" and g_blnInternalFirst = False then strPathSDK10 = CheckForSDK10ToolsSub()
|
---|
1706 |
|
---|
1707 | if strPathSDK10 = "" then
|
---|
1708 | MsgError "Cannot find a suitable Windows 10 SDK. Check configure.log and the build requirements."
|
---|
1709 | exit sub
|
---|
1710 | end if
|
---|
1711 |
|
---|
1712 | '
|
---|
1713 | ' Emit the config.
|
---|
1714 | '
|
---|
1715 | strPathSDK10 = UnixSlashes(PathAbs(strPathSDK10))
|
---|
1716 | CfgPrint "PATH_SDK_WINSDK10 := " & strPathSDK10
|
---|
1717 | CfgPrint "SDK_WINSDK10_VERSION := " & strSDK10Version
|
---|
1718 |
|
---|
1719 | PrintResult "Windows 10 SDK (" & strSDK10Version & ")", strPathSDK10
|
---|
1720 | g_strPathSDK10 = strPathSDK10
|
---|
1721 | end sub
|
---|
1722 |
|
---|
1723 | ''
|
---|
1724 | ' Checks the tools directory.
|
---|
1725 | function CheckForSDK10ToolsSub(ByRef strSDK10Version)
|
---|
1726 | dim arrToolsDirs, strToolsDir, arrDirs, strDir
|
---|
1727 | CheckForSDK10ToolSub = ""
|
---|
1728 | arrToolsDirs = Array(g_strPathDev & "/win." & g_strTargetArch & "/sdk", _
|
---|
1729 | g_strPathDev & "/win.x86/sdk", g_strPathDev & "/win.amd64/sdk")
|
---|
1730 | for each strToolsDir in arrToolsDirs
|
---|
1731 | arrDirs = GetSubdirsStartingWithRSorted(strToolsDir, "v10.")
|
---|
1732 | for each strDir in arrDirs
|
---|
1733 | CheckForSDK10ToolsSub = CheckForSDK10Sub(strToolsDir & "/" & strDir, strSDK10Version)
|
---|
1734 | if CheckForSDK10ToolsSub <> "" then
|
---|
1735 | exit function
|
---|
1736 | end if
|
---|
1737 | next
|
---|
1738 | next
|
---|
1739 |
|
---|
1740 | end function
|
---|
1741 |
|
---|
1742 | ''
|
---|
1743 | ' Checks if the specified path points to a usable Windows 10 SDK/WDK.
|
---|
1744 | function CheckForSDK10Sub(strPathSDK10, ByRef strSDK10Version)
|
---|
1745 | CheckForSDK10Sub = ""
|
---|
1746 | if strPathSDK10 <> "" then
|
---|
1747 | LogPrint "Trying: strPathSDK10=" & strPathSDK10
|
---|
1748 | if LogDirExists(strPathSDK10) then
|
---|
1749 | if LogDirExists(strPathSDK10 & "/Bin") _
|
---|
1750 | and LogDirExists(strPathSDK10 & "/Include") _
|
---|
1751 | and LogDirExists(strPathSDK10 & "/Lib") _
|
---|
1752 | and LogDirExists(strPathSDK10 & "/Redist") _
|
---|
1753 | then
|
---|
1754 | ' Only testing the highest one, for now. '' @todo incorporate strOptSDK10Version
|
---|
1755 | dim arrVersions
|
---|
1756 | arrVersions = GetSubdirsStartingWithSorted(strPathSDK10 & "/Include", "10.0.")
|
---|
1757 | if UBound(arrVersions) >= 0 then
|
---|
1758 | dim strVersion
|
---|
1759 | strVersion = arrVersions(UBound(arrVersions))
|
---|
1760 | LogPrint "Trying version: " & strVersion
|
---|
1761 | if LogFileExists(strPathSDK10, "include/" & strVersion & "/um/Windows.h") _
|
---|
1762 | and LogFileExists(strPathSDK10, "include/" & strVersion & "/ucrt/malloc.h") _
|
---|
1763 | and LogFileExists(strPathSDK10, "include/" & strVersion & "/ucrt/stdio.h") _
|
---|
1764 | and LogFileExists(strPathSDK10, "lib/" & strVersion & "/um/" & g_strTargetArchWin & "/kernel32.lib") _
|
---|
1765 | and LogFileExists(strPathSDK10, "lib/" & strVersion & "/um/" & g_strTargetArchWin & "/user32.lib") _
|
---|
1766 | and LogFileExists(strPathSDK10, "lib/" & strVersion & "/ucrt/" & g_strTargetArchWin & "/libucrt.lib") _
|
---|
1767 | and LogFileExists(strPathSDK10, "lib/" & strVersion & "/ucrt/" & g_strTargetArchWin & "/ucrt.lib") _
|
---|
1768 | and LogFileExists(strPathSDK10, "bin/" & strVersion & "/" & g_strHostArchWin & "/rc.exe") _
|
---|
1769 | and LogFileExists(strPathSDK10, "bin/" & strVersion & "/" & g_strHostArchWin & "/midl.exe") _
|
---|
1770 | then
|
---|
1771 | '' @todo check minimum version (for WinHv).
|
---|
1772 | strSDK10Version = strVersion
|
---|
1773 | CheckForSDK10Sub = strPathSDK10
|
---|
1774 | end if
|
---|
1775 | else
|
---|
1776 | LogPrint "Found no 10.0.* subdirectories under '" & strPathSDK10 & "/Include'!"
|
---|
1777 | end if
|
---|
1778 | end if
|
---|
1779 | end if
|
---|
1780 | end if
|
---|
1781 | end function
|
---|
1782 |
|
---|
1783 |
|
---|
1784 | ''
|
---|
1785 | ' Checks for a Windows 7 Driver Kit.
|
---|
1786 | sub CheckForWinDDK(strOptDDK)
|
---|
1787 | dim strPathDDK, str, strSubKeys
|
---|
1788 | PrintHdr "Windows DDK v7.1"
|
---|
1789 |
|
---|
1790 | '
|
---|
1791 | ' Find the DDK.
|
---|
1792 | '
|
---|
1793 | strPathDDK = ""
|
---|
1794 | ' The specified path.
|
---|
1795 | if strPathDDK = "" And strOptDDK <> "" then
|
---|
1796 | if CheckForWinDDKSub(strOptDDK, True) then strPathDDK = strOptDDK
|
---|
1797 | end if
|
---|
1798 |
|
---|
1799 | ' The tools location (first).
|
---|
1800 | if strPathDDK = "" And g_blnInternalFirst then
|
---|
1801 | str = g_strPathDev & "/win.x86/ddk/7600.16385.1"
|
---|
1802 | if CheckForWinDDKSub(str, False) then strPathDDK = str
|
---|
1803 | end if
|
---|
1804 |
|
---|
1805 | ' Check the environment
|
---|
1806 | str = EnvGet("DDK_INC_PATH")
|
---|
1807 | if strPathDDK = "" And str <> "" then
|
---|
1808 | str = PathParent(PathParent(str))
|
---|
1809 | if CheckForWinDDKSub(str, True) then strPathDDK = str
|
---|
1810 | end if
|
---|
1811 |
|
---|
1812 | str = EnvGet("BASEDIR")
|
---|
1813 | if strPathDDK = "" And str <> "" then
|
---|
1814 | if CheckForWinDDKSub(str, True) then strPathDDK = str
|
---|
1815 | end if
|
---|
1816 |
|
---|
1817 | ' Some array constants to ease the work.
|
---|
1818 | arrSoftwareKeys = array("SOFTWARE", "SOFTWARE\Wow6432Node")
|
---|
1819 | arrRoots = array("HKLM", "HKCU")
|
---|
1820 |
|
---|
1821 | ' Windows 7 WDK.
|
---|
1822 | arrLocations = array()
|
---|
1823 | for each strSoftwareKey in arrSoftwareKeys
|
---|
1824 | for each strSubKey in RegEnumSubKeysFull("HKLM", strSoftwareKey & "\Microsoft\KitSetup\configured-kits")
|
---|
1825 | for each strSubKey2 in RegEnumSubKeysFull("HKLM", strSubKey)
|
---|
1826 | str = RegGetString("HKLM\" & strSubKey2 & "\setup-install-location")
|
---|
1827 | if str <> "" then
|
---|
1828 | arrLocations = ArrayAppend(arrLocations, PathAbsLong(str))
|
---|
1829 | end if
|
---|
1830 | next
|
---|
1831 | next
|
---|
1832 | next
|
---|
1833 | arrLocations = ArrayRSortStrings(arrLocations)
|
---|
1834 |
|
---|
1835 | ' Check the locations we've gathered.
|
---|
1836 | for each str in arrLocations
|
---|
1837 | if strPathDDK = "" then
|
---|
1838 | if CheckForWinDDKSub(str, True) then strPathDDK = str
|
---|
1839 | end if
|
---|
1840 | next
|
---|
1841 |
|
---|
1842 | ' The tools location (post).
|
---|
1843 | if (strPathDDK = "") And (g_blnInternalFirst = False) then
|
---|
1844 | str = g_strPathDev & "/win.x86/ddk/7600.16385.1"
|
---|
1845 | if CheckForWinDDKSub(str, False) then strPathDDK = str
|
---|
1846 | end if
|
---|
1847 |
|
---|
1848 | ' Give up.
|
---|
1849 | if strPathDDK = "" then
|
---|
1850 | MsgError "Cannot find the Windows DDK v7.1. Check configure.log and the build requirements."
|
---|
1851 | exit sub
|
---|
1852 | end if
|
---|
1853 |
|
---|
1854 | '
|
---|
1855 | ' Emit the config.
|
---|
1856 | '
|
---|
1857 | strPathDDK = UnixSlashes(PathAbs(strPathDDK))
|
---|
1858 | CfgPrint "PATH_SDK_WINDDK71 := " & strPathDDK
|
---|
1859 |
|
---|
1860 | PrintResult "Windows DDK v7.1", strPathDDK
|
---|
1861 | g_strPathDDK = strPathDDK
|
---|
1862 | end sub
|
---|
1863 |
|
---|
1864 | '' Quick check if the DDK is in the specified directory or not.
|
---|
1865 | function CheckForWinDDKSub(strPathDDK, blnCheckBuild)
|
---|
1866 | CheckForWinDDKSub = False
|
---|
1867 | LogPrint "trying: strPathDDK=" & strPathDDK & " blnCheckBuild=" & blnCheckBuild
|
---|
1868 | if LogFileExists(strPathDDK, "inc/api/ntdef.h") _
|
---|
1869 | And LogFileExists(strPathDDK, "lib/win7/i386/int64.lib") _
|
---|
1870 | And LogFileExists(strPathDDK, "lib/wlh/i386/int64.lib") _
|
---|
1871 | And LogFileExists(strPathDDK, "lib/wnet/i386/int64.lib") _
|
---|
1872 | And LogFileExists(strPathDDK, "lib/wxp/i386/int64.lib") _
|
---|
1873 | And Not LogFileExists(strPathDDK, "lib/win8/i386/int64.lib") _
|
---|
1874 | And LogFileExists(strPathDDK, "bin/x86/rc.exe") _
|
---|
1875 | then
|
---|
1876 | if Not blnCheckBuild then
|
---|
1877 | CheckForWinDDKSub = True
|
---|
1878 | '' @todo Find better build check.
|
---|
1879 | elseif Shell("""" & DosSlashes(strPathDDK & "/bin/x86/rc.exe") & """" , True) <> 0 _
|
---|
1880 | And InStr(1, g_strShellOutput, "Resource Compiler Version 6.1.") > 0 then
|
---|
1881 | CheckForWinDDKSub = True
|
---|
1882 | end if
|
---|
1883 | end if
|
---|
1884 | end function
|
---|
1885 |
|
---|
1886 |
|
---|
1887 | ''
|
---|
1888 | ' Finds midl.exe
|
---|
1889 | sub CheckForMidl()
|
---|
1890 | dim strMidl
|
---|
1891 | PrintHdr "Midl.exe"
|
---|
1892 |
|
---|
1893 | ' Skip if no COM/ATL.
|
---|
1894 | if g_blnDisableCOM then
|
---|
1895 | PrintResultMsg "Midl", "Skipped (" & g_strDisableCOM & ")"
|
---|
1896 | exit sub
|
---|
1897 | end if
|
---|
1898 |
|
---|
1899 | if LogFileExists(g_strPathPSDK, "bin/Midl.exe") then
|
---|
1900 | strMidl = g_strPathPSDK & "/bin/Midl.exe"
|
---|
1901 | elseif LogFileExists(g_strPathVCC, "Common7/Tools/Bin/Midl.exe") then
|
---|
1902 | strMidl = g_strPathVCC & "/Common7/Tools/Bin/Midl.exe"
|
---|
1903 | elseif LogFileExists(g_strPathDDK, "bin/x86/Midl.exe") then
|
---|
1904 | strMidl = g_strPathDDK & "/bin/x86/Midl.exe"
|
---|
1905 | elseif LogFileExists(g_strPathDDK, "bin/Midl.exe") then
|
---|
1906 | strMidl = g_strPathDDK & "/bin/Midl.exe"
|
---|
1907 | elseif LogFileExists(g_strPathDev, "win.x86/bin/Midl.exe") then
|
---|
1908 | strMidl = g_strPathDev & "/win.x86/bin/Midl.exe"
|
---|
1909 | else
|
---|
1910 | MsgWarning "Midl.exe not found!"
|
---|
1911 | exit sub
|
---|
1912 | end if
|
---|
1913 |
|
---|
1914 | CfgPrint "VBOX_MAIN_IDL := " & strMidl
|
---|
1915 | PrintResult "Midl.exe", strMidl
|
---|
1916 | end sub
|
---|
1917 |
|
---|
1918 |
|
---|
1919 | ''
|
---|
1920 | ' Checks for any libSDL binaries.
|
---|
1921 | sub CheckForlibSDL(strOptlibSDL)
|
---|
1922 | dim strPathlibSDL, str
|
---|
1923 | PrintHdr "libSDL"
|
---|
1924 |
|
---|
1925 | '
|
---|
1926 | ' Try find some SDL library.
|
---|
1927 | '
|
---|
1928 |
|
---|
1929 | ' First, the specific location.
|
---|
1930 | strPathlibSDL = ""
|
---|
1931 | if (strPathlibSDL = "") And (strOptlibSDL <> "") then
|
---|
1932 | if CheckForlibSDLSub(strOptlibSDL) then strPathlibSDL = strOptlibSDL
|
---|
1933 | end if
|
---|
1934 |
|
---|
1935 | ' The tools location (first).
|
---|
1936 | if (strPathlibSDL = "") And (g_blnInternalFirst = True) then
|
---|
1937 | str = g_strPathDev & "/win." & g_strTargetArch & "/libsdl"
|
---|
1938 | if HasSubdirsStartingWith(str, "v") then
|
---|
1939 | PrintResult "libSDL", str & "/v* (auto)"
|
---|
1940 | exit sub
|
---|
1941 | end if
|
---|
1942 | end if
|
---|
1943 |
|
---|
1944 | ' Poke about in the path.
|
---|
1945 | if strPathlibSDL = "" then
|
---|
1946 | str = WhichEx("LIB", "SDLmain.lib")
|
---|
1947 | if str = "" then str = Which("..\lib\SDLmain.lib")
|
---|
1948 | if str = "" then str = Which("SDLmain.lib")
|
---|
1949 | if str <> "" then
|
---|
1950 | str = PathParent(PathStripFilename(str))
|
---|
1951 | if CheckForlibSDLSub(str) then strPathlibSDL = str
|
---|
1952 | end if
|
---|
1953 | end if
|
---|
1954 |
|
---|
1955 | if strPathlibSDL = "" then
|
---|
1956 | str = Which("SDL.dll")
|
---|
1957 | if str <> "" then
|
---|
1958 | str = PathParent(PathStripFilename(str))
|
---|
1959 | if CheckForlibSDLSub(str) then strPathlibSDL = str
|
---|
1960 | end if
|
---|
1961 | end if
|
---|
1962 |
|
---|
1963 | ' The tools location (post).
|
---|
1964 | if (strPathlibSDL = "") And (g_blnInternalFirst = False) then
|
---|
1965 | str = g_strPathDev & "/win." & g_strTargetArch & "/libsdl"
|
---|
1966 | if HasSubdirsStartingWith(str, "v") then
|
---|
1967 | PrintResult "libSDL", str & "/v* (auto)"
|
---|
1968 | exit sub
|
---|
1969 | end if
|
---|
1970 | end if
|
---|
1971 |
|
---|
1972 | ' Success?
|
---|
1973 | if strPathlibSDL = "" then
|
---|
1974 | if strOptlibSDL = "" then
|
---|
1975 | MsgError "Can't locate libSDL. Try specify the path with the --with-libSDL=<path> argument. " _
|
---|
1976 | & "If still no luck, consult the configure.log and the build requirements."
|
---|
1977 | else
|
---|
1978 | MsgError "Can't locate libSDL. Please consult the configure.log and the build requirements."
|
---|
1979 | end if
|
---|
1980 | exit sub
|
---|
1981 | end if
|
---|
1982 |
|
---|
1983 | strPathLibSDL = UnixSlashes(PathAbs(strPathLibSDL))
|
---|
1984 | CfgPrint "PATH_SDK_LIBSDL := " & strPathlibSDL
|
---|
1985 |
|
---|
1986 | PrintResult "libSDL", strPathlibSDL
|
---|
1987 | end sub
|
---|
1988 |
|
---|
1989 | ''
|
---|
1990 | ' Checks if the specified path points to an usable libSDL or not.
|
---|
1991 | function CheckForlibSDLSub(strPathlibSDL)
|
---|
1992 | CheckForlibSDLSub = False
|
---|
1993 | LogPrint "trying: strPathlibSDL=" & strPathlibSDL
|
---|
1994 | if LogFileExists(strPathlibSDL, "lib/SDL.lib") _
|
---|
1995 | And LogFileExists(strPathlibSDL, "lib/SDLmain.lib") _
|
---|
1996 | And LogFileExists(strPathlibSDL, "lib/SDL.dll") _
|
---|
1997 | And LogFileExists(strPathlibSDL, "include/SDL.h") _
|
---|
1998 | And LogFileExists(strPathlibSDL, "include/SDL_syswm.h") _
|
---|
1999 | And LogFileExists(strPathlibSDL, "include/SDL_version.h") _
|
---|
2000 | then
|
---|
2001 | CheckForlibSDLSub = True
|
---|
2002 | end if
|
---|
2003 | end function
|
---|
2004 |
|
---|
2005 |
|
---|
2006 | ''
|
---|
2007 | ' Checks for libxml2.
|
---|
2008 | sub CheckForXml2(strOptXml2)
|
---|
2009 | dim strPathXml2, str
|
---|
2010 | PrintHdr "libxml2"
|
---|
2011 |
|
---|
2012 | '
|
---|
2013 | ' Part of tarball / svn, so we can exit immediately if no path was specified.
|
---|
2014 | '
|
---|
2015 | if (strOptXml2 = "") then
|
---|
2016 | PrintResultMsg "libxml2", "src/lib/libxml2-*"
|
---|
2017 | exit sub
|
---|
2018 | end if
|
---|
2019 |
|
---|
2020 | ' Skip if no COM/ATL.
|
---|
2021 | if g_blnDisableCOM then
|
---|
2022 | PrintResultMsg "libxml2", "Skipped (" & g_strDisableCOM & ")"
|
---|
2023 | exit sub
|
---|
2024 | end if
|
---|
2025 |
|
---|
2026 | '
|
---|
2027 | ' Try find some xml2 dll/lib.
|
---|
2028 | '
|
---|
2029 | strPathXml2 = ""
|
---|
2030 | if (strPathXml2 = "") And (strOptXml2 <> "") then
|
---|
2031 | if CheckForXml2Sub(strOptXml2) then strPathXml2 = strOptXml2
|
---|
2032 | end if
|
---|
2033 |
|
---|
2034 | if strPathXml2 = "" then
|
---|
2035 | str = Which("libxml2.lib")
|
---|
2036 | if str <> "" then
|
---|
2037 | str = PathParent(PathStripFilename(str))
|
---|
2038 | if CheckForXml2Sub(str) then strPathXml2 = str
|
---|
2039 | end if
|
---|
2040 | end if
|
---|
2041 |
|
---|
2042 | ' Success?
|
---|
2043 | if strPathXml2 = "" then
|
---|
2044 | if strOptXml2 = "" then
|
---|
2045 | MsgError "Can't locate libxml2. Try specify the path with the --with-libxml2=<path> argument. " _
|
---|
2046 | & "If still no luck, consult the configure.log and the build requirements."
|
---|
2047 | else
|
---|
2048 | MsgError "Can't locate libxml2. Please consult the configure.log and the build requirements."
|
---|
2049 | end if
|
---|
2050 | exit sub
|
---|
2051 | end if
|
---|
2052 |
|
---|
2053 | strPathXml2 = UnixSlashes(PathAbs(strPathXml2))
|
---|
2054 | CfgPrint "SDK_VBOX_LIBXML2_DEFS := _REENTRANT"
|
---|
2055 | CfgPrint "SDK_VBOX_LIBXML2_INCS := " & strPathXml2 & "/include"
|
---|
2056 | CfgPrint "SDK_VBOX_LIBXML2_LIBS := " & strPathXml2 & "/lib/libxml2.lib"
|
---|
2057 |
|
---|
2058 | PrintResult "libxml2", strPathXml2
|
---|
2059 | end sub
|
---|
2060 |
|
---|
2061 | ''
|
---|
2062 | ' Checks if the specified path points to an usable libxml2 or not.
|
---|
2063 | function CheckForXml2Sub(strPathXml2)
|
---|
2064 | dim str
|
---|
2065 |
|
---|
2066 | CheckForXml2Sub = False
|
---|
2067 | LogPrint "trying: strPathXml2=" & strPathXml2
|
---|
2068 | if LogFileExists(strPathXml2, "include/libxml/xmlexports.h") _
|
---|
2069 | And LogFileExists(strPathXml2, "include/libxml/xmlreader.h") _
|
---|
2070 | then
|
---|
2071 | str = LogFindFile(strPathXml2, "bin/libxml2.dll")
|
---|
2072 | if str <> "" then
|
---|
2073 | if LogFindFile(strPathXml2, "lib/libxml2.lib") <> "" then
|
---|
2074 | CheckForXml2Sub = True
|
---|
2075 | end if
|
---|
2076 | end if
|
---|
2077 | end if
|
---|
2078 | end function
|
---|
2079 |
|
---|
2080 |
|
---|
2081 | ''
|
---|
2082 | ' Checks for openssl
|
---|
2083 | sub CheckForSsl(strOptSsl, bln32Bit)
|
---|
2084 | dim strPathSsl, str
|
---|
2085 | PrintHdr "openssl"
|
---|
2086 |
|
---|
2087 | strOpenssl = "openssl"
|
---|
2088 | if bln32Bit = True then
|
---|
2089 | strOpenssl = "openssl32"
|
---|
2090 | end if
|
---|
2091 |
|
---|
2092 | '
|
---|
2093 | ' Part of tarball / svn, so we can exit immediately if no path was specified.
|
---|
2094 | '
|
---|
2095 | if (strOptSsl = "") then
|
---|
2096 | PrintResult strOpenssl, "src/libs/openssl-*"
|
---|
2097 | exit sub
|
---|
2098 | end if
|
---|
2099 |
|
---|
2100 | '
|
---|
2101 | ' Try find some openssl dll/lib.
|
---|
2102 | '
|
---|
2103 | strPathSsl = ""
|
---|
2104 | if (strPathSsl = "") And (strOptSsl <> "") then
|
---|
2105 | if CheckForSslSub(strOptSsl) then strPathSsl = strOptSsl
|
---|
2106 | end if
|
---|
2107 |
|
---|
2108 | if strPathSsl = "" then
|
---|
2109 | str = Which("libssl.lib")
|
---|
2110 | if str <> "" then
|
---|
2111 | str = PathParent(PathStripFilename(str))
|
---|
2112 | if CheckForSslSub(str) then strPathSsl = str
|
---|
2113 | end if
|
---|
2114 | end if
|
---|
2115 |
|
---|
2116 | ' Success?
|
---|
2117 | if strPathSsl = "" then
|
---|
2118 | if strOptSsl = "" then
|
---|
2119 | MsgError "Can't locate " & strOpenssl & ". " _
|
---|
2120 | & "Try specify the path with the --with-" & strOpenssl & "=<path> argument. " _
|
---|
2121 | & "If still no luck, consult the configure.log and the build requirements."
|
---|
2122 | else
|
---|
2123 | MsgError "Can't locate " & strOpenssl & ". " _
|
---|
2124 | & "Please consult the configure.log and the build requirements."
|
---|
2125 | end if
|
---|
2126 | exit sub
|
---|
2127 | end if
|
---|
2128 |
|
---|
2129 | strPathSsl = UnixSlashes(PathAbs(strPathSsl))
|
---|
2130 | if bln32Bit = True then
|
---|
2131 | CfgPrint "SDK_VBOX_OPENSSL-x86_INCS := " & strPathSsl & "/include"
|
---|
2132 | CfgPrint "SDK_VBOX_OPENSSL-x86_LIBS := " & strPathSsl & "/lib/libcrypto.lib" & " " & strPathSsl & "/lib/libssl.lib"
|
---|
2133 | CfgPrint "SDK_VBOX_BLD_OPENSSL-x86_LIBS := " & strPathSsl & "/lib/libcrypto.lib" & " " & strPathSsl & "/lib/libssl.lib"
|
---|
2134 | else
|
---|
2135 | CfgPrint "SDK_VBOX_OPENSSL_INCS := " & strPathSsl & "/include"
|
---|
2136 | CfgPrint "SDK_VBOX_OPENSSL_LIBS := " & strPathSsl & "/lib/libcrypto.lib" & " " & strPathSsl & "/lib/libssl.lib"
|
---|
2137 | CfgPrint "SDK_VBOX_BLD_OPENSSL_LIBS := " & strPathSsl & "/lib/libcrypto.lib" & " " & strPathSsl & "/lib/libssl.lib"
|
---|
2138 | end if
|
---|
2139 |
|
---|
2140 | PrintResult strOpenssl, strPathSsl
|
---|
2141 | end sub
|
---|
2142 |
|
---|
2143 | ''
|
---|
2144 | ' Checks if the specified path points to an usable openssl or not.
|
---|
2145 | function CheckForSslSub(strPathSsl)
|
---|
2146 |
|
---|
2147 | CheckForSslSub = False
|
---|
2148 | LogPrint "trying: strPathSsl=" & strPathSsl
|
---|
2149 | if LogFileExists(strPathSsl, "include/openssl/md5.h") _
|
---|
2150 | And LogFindFile(strPathSsl, "lib/libssl.lib") <> "" _
|
---|
2151 | then
|
---|
2152 | CheckForSslSub = True
|
---|
2153 | end if
|
---|
2154 | end function
|
---|
2155 |
|
---|
2156 |
|
---|
2157 | ''
|
---|
2158 | ' Checks for libcurl
|
---|
2159 | sub CheckForCurl(strOptCurl, bln32Bit)
|
---|
2160 | dim strPathCurl, str
|
---|
2161 | PrintHdr "libcurl"
|
---|
2162 |
|
---|
2163 | strCurl = "libcurl"
|
---|
2164 | if bln32Bit = True then
|
---|
2165 | strCurl = "libcurl32"
|
---|
2166 | end if
|
---|
2167 |
|
---|
2168 | '
|
---|
2169 | ' Part of tarball / svn, so we can exit immediately if no path was specified.
|
---|
2170 | '
|
---|
2171 | if (strOptCurl = "") then
|
---|
2172 | PrintResult strCurl, "src/libs/curl-*"
|
---|
2173 | exit sub
|
---|
2174 | end if
|
---|
2175 |
|
---|
2176 | '
|
---|
2177 | ' Try find some cURL dll/lib.
|
---|
2178 | '
|
---|
2179 | strPathCurl = ""
|
---|
2180 | if (strPathCurl = "") And (strOptCurl <> "") then
|
---|
2181 | if CheckForCurlSub(strOptCurl) then strPathCurl = strOptCurl
|
---|
2182 | end if
|
---|
2183 |
|
---|
2184 | if strPathCurl = "" then
|
---|
2185 | str = Which("libcurl.lib")
|
---|
2186 | if str <> "" then
|
---|
2187 | str = PathParent(PathStripFilename(str))
|
---|
2188 | if CheckForCurlSub(str) then strPathCurl = str
|
---|
2189 | end if
|
---|
2190 | end if
|
---|
2191 |
|
---|
2192 | ' Success?
|
---|
2193 | if strPathCurl = "" then
|
---|
2194 | if strOptCurl = "" then
|
---|
2195 | MsgError "Can't locate " & strCurl & ". " _
|
---|
2196 | & "Try specify the path with the --with-" & strCurl & "=<path> argument. " _
|
---|
2197 | & "If still no luck, consult the configure.log and the build requirements."
|
---|
2198 | else
|
---|
2199 | MsgError "Can't locate " & strCurl & ". " _
|
---|
2200 | & "Please consult the configure.log and the build requirements."
|
---|
2201 | end if
|
---|
2202 | exit sub
|
---|
2203 | end if
|
---|
2204 |
|
---|
2205 | strPathCurl = UnixSlashes(PathAbs(strPathCurl))
|
---|
2206 | if bln32Bit = True then
|
---|
2207 | CfgPrint "SDK_VBOX_LIBCURL-x86_INCS := " & strPathCurl & "/include"
|
---|
2208 | CfgPrint "SDK_VBOX_LIBCURL-x86_LIBS.x86 := " & strPathCurl & "/libcurl.lib"
|
---|
2209 | else
|
---|
2210 | CfgPrint "SDK_VBOX_LIBCURL_INCS := " & strPathCurl & "/include"
|
---|
2211 | CfgPrint "SDK_VBOX_LIBCURL_LIBS := " & strPathCurl & "/libcurl.lib"
|
---|
2212 | end if
|
---|
2213 |
|
---|
2214 | PrintResult strCurl, strPathCurl
|
---|
2215 | end sub
|
---|
2216 |
|
---|
2217 | ''
|
---|
2218 | ' Checks if the specified path points to an usable libcurl or not.
|
---|
2219 | function CheckForCurlSub(strPathCurl)
|
---|
2220 |
|
---|
2221 | CheckForCurlSub = False
|
---|
2222 | LogPrint "trying: strPathCurl=" & strPathCurl
|
---|
2223 | if LogFileExists(strPathCurl, "include/curl/curl.h") _
|
---|
2224 | And LogFindFile(strPathCurl, "libcurl.dll") <> "" _
|
---|
2225 | And LogFindFile(strPathCurl, "libcurl.lib") <> "" _
|
---|
2226 | then
|
---|
2227 | CheckForCurlSub = True
|
---|
2228 | end if
|
---|
2229 | end function
|
---|
2230 |
|
---|
2231 |
|
---|
2232 | ''
|
---|
2233 | ' Checks for any Qt5 binaries.
|
---|
2234 | sub CheckForQt(strOptQt5, strOptInfix)
|
---|
2235 | dim strPathQt5, strInfixQt5, arrFolders, arrVccInfixes, strVccInfix
|
---|
2236 | PrintHdr "Qt5"
|
---|
2237 |
|
---|
2238 | '
|
---|
2239 | ' Try to find the Qt5 installation (user specified path with --with-qt5)
|
---|
2240 | '
|
---|
2241 | LogPrint "Checking for user specified path of Qt5 ... "
|
---|
2242 | strPathQt5 = ""
|
---|
2243 | if strOptQt5 <> "" then
|
---|
2244 | strPathQt5 = CheckForQt5Sub(UnixSlashes(strOptQt5), strOptInfix, strInfixQt5)
|
---|
2245 | end if
|
---|
2246 |
|
---|
2247 | if strPathQt = "" then
|
---|
2248 | '
|
---|
2249 | ' Collect links from "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\UFH\SHC"
|
---|
2250 | '
|
---|
2251 | ' Typical string list:
|
---|
2252 | ' C:\Users\someuser\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Qt\5.x.y\MSVC 20zz (64-bit)\Qt 5.x.y (MSVC 20zz 64-bit).lnk
|
---|
2253 | ' C:\Windows\System32\cmd.exe
|
---|
2254 | ' /A /Q /K E:\qt\installed\5.x.y\msvc20zz_64\bin\qtenv2.bat
|
---|
2255 | '
|
---|
2256 | dim arrValues, strValue, arrStrings, str, arrCandidates, iCandidates, strCandidate, off
|
---|
2257 | arrValues = RegEnumValueNamesFull("HKCU", "SOFTWARE\Microsoft\Windows\CurrentVersion\UFH\SHC")
|
---|
2258 | redim arrCandidates(UBound(arrValues) - LBound(arrValues) + 1)
|
---|
2259 | iCandidates = 0
|
---|
2260 | for each strValue in arrValues
|
---|
2261 | arrStrings = RegGetMultiString("HKCU\" & strValue)
|
---|
2262 | if UBound(arrStrings) >= 0 and UBound(arrStrings) - LBound(arrStrings) >= 2 then
|
---|
2263 | str = Trim(arrStrings(UBound(arrStrings)))
|
---|
2264 | if LCase(Right(str, Len("\bin\qtenv2.bat"))) = "\bin\qtenv2.bat" _
|
---|
2265 | and InStr(1, LCase(str), "\msvc20") > 0 _
|
---|
2266 | and InStr(1, str, ":") > 0 _
|
---|
2267 | then
|
---|
2268 | off = InStr(1, str, ":") - 1
|
---|
2269 | arrCandidates(iCandidates) = Mid(str, off, Len(str) - off - Len("\bin\qtenv2.bat") + 1)
|
---|
2270 | LogPrint "qt5 candidate #" & iCandidates & "=" & arrCandidates(iCandidates) & " (" & str & ")"
|
---|
2271 | iCandidates = iCandidates + 1
|
---|
2272 | end if
|
---|
2273 | end if
|
---|
2274 | next
|
---|
2275 | redim preserve arrCandidates(iCandidates)
|
---|
2276 | if iCandidates > 0 then arrCandidates = ArrayRSortStrings(arrCandidates) ' Kind of needs version sorting here...
|
---|
2277 | LogPrint "Testing qtenv2.bat links (" & iCandidates & ") ..."
|
---|
2278 |
|
---|
2279 | ' VC infixes/subdir names to consider (ASSUMES 64bit)
|
---|
2280 | if g_strVCCVersion = "VCC142" or g_strVCCVersion = "" then
|
---|
2281 | arrVccInfixes = Array("msvc2019_64", "msvc2017_64", "msvc2015_64")
|
---|
2282 | elseif g_strVCCVersion = "VCC141" then
|
---|
2283 | arrVccInfixes = Array("msvc2017_64", "msvc2015_64", "msvc2019_64")
|
---|
2284 | elseif g_strVCCVersion = "VCC140" then
|
---|
2285 | arrVccInfixes = Array("msvc2015_64", "msvc2017_64", "msvc2019_64")
|
---|
2286 | elseif g_strVCCVersion = "VCC120" then
|
---|
2287 | arrVccInfixes = Array("msvc2013_64")
|
---|
2288 | elseif g_strVCCVersion = "VCC110" then
|
---|
2289 | arrVccInfixes = Array("msvc2012_64")
|
---|
2290 | elseif g_strVCCVersion = "VCC100" then
|
---|
2291 | arrVccInfixes = Array("msvc2010_64")
|
---|
2292 | else
|
---|
2293 | MsgFatal "Unexpected VC version: " & g_strVCCVersion
|
---|
2294 | arrVccInfixes = Array()
|
---|
2295 | end if
|
---|
2296 | for each strVccInfix in arrVccInfixes
|
---|
2297 | for each strCandidate in arrCandidates
|
---|
2298 | if InStr(1, LCase(strCandidate), strVccInfix) > 0 then
|
---|
2299 | strPathQt5 = CheckForQt5Sub(strCandidate, strOptInfix, strInfixQt5)
|
---|
2300 | if strPathQt5 <> "" then exit for
|
---|
2301 | end if
|
---|
2302 | next
|
---|
2303 | if strPathQt5 <> "" then exit for
|
---|
2304 | next
|
---|
2305 | end if
|
---|
2306 |
|
---|
2307 | ' Check the dev tools - prefer ones matching the compiler.
|
---|
2308 | if strPathQt5 = "" then
|
---|
2309 | LogPrint "Testing tools dir (" & g_strPathDev & "/win." & g_strTargetArch & "/qt/v5*) ..."
|
---|
2310 | arrFolders = GetSubdirsStartingWithSorted(g_strPathDev & "/win." & g_strTargetArch & "/qt", "v5")
|
---|
2311 | arrVccInfixes = Array(LCase(g_strVCCVersion), Left(LCase(g_strVCCVersion), Len(g_strVCCVersion) - 1), "")
|
---|
2312 | for each strVccInfix in arrVccInfixes
|
---|
2313 | for i = UBound(arrFolders) to LBound(arrFolders) step -1
|
---|
2314 | if strVccInfix = "" or InStr(1, LCase(arrFolders(i)), strVccInfix) > 0 then
|
---|
2315 | strPathQt5 = CheckForQt5Sub(g_strPathDev & "/win." & g_strTargetArch & "/qt/" & arrFolders(i), strOptInfix, strInfixQt5)
|
---|
2316 | if strPathQt5 <> "" then exit for
|
---|
2317 | end if
|
---|
2318 | next
|
---|
2319 | if strPathQt5 <> "" then exit for
|
---|
2320 | next
|
---|
2321 | end if
|
---|
2322 |
|
---|
2323 | '
|
---|
2324 | ' Display the result and output the config.
|
---|
2325 | '
|
---|
2326 | if strPathQt5 <> "" then
|
---|
2327 | PrintResult "Qt5", strPathQt5
|
---|
2328 | PrintResultMsg "Qt5 infix", strInfixQt5
|
---|
2329 | CfgPrint "PATH_SDK_QT5 := " & strPathQt5
|
---|
2330 | CfgPrint "PATH_TOOL_QT5 := $(PATH_SDK_QT5)"
|
---|
2331 | CfgPrint "VBOX_PATH_QT := $(PATH_SDK_QT5)"
|
---|
2332 | CfgPrint "VBOX_QT_INFIX := " & strInfixQt5
|
---|
2333 | CfgPrint "VBOX_WITH_QT_PAYLOAD := 1"
|
---|
2334 | else
|
---|
2335 | CfgPrint "VBOX_WITH_QTGUI :="
|
---|
2336 | PrintResultMsg "Qt5", "not found"
|
---|
2337 | end if
|
---|
2338 | end sub
|
---|
2339 |
|
---|
2340 | ''
|
---|
2341 | ' Checks if the specified path points to an usable Qt5 library.
|
---|
2342 | function CheckForQt5Sub(strPathQt5, strOptInfix, ByRef strInfixQt5)
|
---|
2343 | CheckForQt5Sub = ""
|
---|
2344 | LogPrint "trying: strPathQt5=" & strPathQt5
|
---|
2345 |
|
---|
2346 | if LogFileExists(strPathQt5, "bin/moc.exe") _
|
---|
2347 | and LogFileExists(strPathQt5, "bin/uic.exe") _
|
---|
2348 | and LogFileExists(strPathQt5, "include/QtWidgets/qwidget.h") _
|
---|
2349 | and LogFileExists(strPathQt5, "include/QtWidgets/QApplication") _
|
---|
2350 | and LogFileExists(strPathQt5, "include/QtGui/QImage") _
|
---|
2351 | and LogFileExists(strPathQt5, "include/QtNetwork/QHostAddress") _
|
---|
2352 | then
|
---|
2353 | ' Infix testing.
|
---|
2354 | if LogFileExists(strPathQt5, "lib/Qt5Core.lib") _
|
---|
2355 | and LogFileExists(strPathQt5, "lib/Qt5Network.lib") then
|
---|
2356 | strInfixQt5 = ""
|
---|
2357 | CheckForQt5Sub = UnixSlashes(PathAbs(strPathQt5))
|
---|
2358 | elseif LogFileExists(strPathQt5, "lib/Qt5Core" & strOptInfix & ".lib") _
|
---|
2359 | and LogFileExists(strPathQt5, "lib/Qt5Network" & strOptInfix & ".lib") then
|
---|
2360 | strInfixQt5 = strOptInfix
|
---|
2361 | CheckForQt5Sub = UnixSlashes(PathAbs(strPathQt5))
|
---|
2362 | elseif LogFileExists(strPathQt5, "lib/Qt5CoreVBox.lib") _
|
---|
2363 | and LogFileExists(strPathQt5, "lib/Qt5NetworkVBox.lib") then
|
---|
2364 | strInfixQt5 = "VBox"
|
---|
2365 | CheckForQt5Sub = UnixSlashes(PathAbs(strPathQt5))
|
---|
2366 | end if
|
---|
2367 | end if
|
---|
2368 | end function
|
---|
2369 |
|
---|
2370 |
|
---|
2371 | ''
|
---|
2372 | ' Checks for python.
|
---|
2373 | function CheckForPython(strOptPython)
|
---|
2374 | dim strPathPython, arrVersions, strVer, str
|
---|
2375 | PrintHdr "Python"
|
---|
2376 | CheckForPython = False
|
---|
2377 |
|
---|
2378 | '
|
---|
2379 | ' Locate it.
|
---|
2380 | '
|
---|
2381 | strPathPython = CheckForPythonSub(strOptPython)
|
---|
2382 | if strPathPython = "" then
|
---|
2383 | arrVersions = Array("3.12", "3.11", "3.10", "3.9", "3.8", "3.7", "3.6", "3.5", "2.7")
|
---|
2384 | for each strVer in arrVersions
|
---|
2385 | strPathPython = CheckForPythonSub(RegGetString("HKLM\SOFTWARE\Python\PythonCore\" & strVer & "\InstallPath\"))
|
---|
2386 | if strPathPython <> "" then exit for
|
---|
2387 | next
|
---|
2388 | end if
|
---|
2389 | if strPathPython = "" then strPathPython = CheckForPythonSub(PathStripFilename(Which("python.exe")))
|
---|
2390 |
|
---|
2391 | '
|
---|
2392 | ' Output config & result.
|
---|
2393 | '
|
---|
2394 | CheckForPython = strPathPython <> ""
|
---|
2395 | if CheckForPython then
|
---|
2396 | CfgPrint "VBOX_BLD_PYTHON := " & strPathPython
|
---|
2397 | PrintResult "Python", strPathPython
|
---|
2398 | else
|
---|
2399 | PrintResultMsg "Python", "not found"
|
---|
2400 | end if
|
---|
2401 | end function
|
---|
2402 |
|
---|
2403 | '' Worker for CheckForPython.
|
---|
2404 | '
|
---|
2405 | function CheckForPythonSub(strPathPython)
|
---|
2406 | CheckForPythonSub = ""
|
---|
2407 | if strPathPython <> "" then
|
---|
2408 | if LogFileExists(strPathPython, "python.exe") _
|
---|
2409 | and LogDirExists(strPathPython & "/DLLs") _
|
---|
2410 | then
|
---|
2411 | CheckForPythonSub = UnixSlashes(PathAbs(strPathPython & "/python.exe"))
|
---|
2412 | end if
|
---|
2413 | end if
|
---|
2414 | end function
|
---|
2415 |
|
---|
2416 |
|
---|
2417 | ''
|
---|
2418 | ' Show usage.
|
---|
2419 | sub usage
|
---|
2420 | Print "Usage: cscript configure.vbs [options]"
|
---|
2421 | Print ""
|
---|
2422 | Print "Configuration:"
|
---|
2423 | Print " -h, --help Display this."
|
---|
2424 | Print " --target-arch=x86|amd64 The target architecture."
|
---|
2425 | Print " --continue-on-error Do not stop on errors."
|
---|
2426 | Print " --internal-last Check internal tools (tools/win.*) last."
|
---|
2427 | Print " --internal-first Check internal tools (tools/win.*) first (default)."
|
---|
2428 | Print ""
|
---|
2429 | Print "Components:"
|
---|
2430 | Print " --disable-COM Disables all frontends and API."
|
---|
2431 | Print " --disable-SDL Disables the SDL frontend."
|
---|
2432 | Print " --disable-UDPTunnel"
|
---|
2433 | Print ""
|
---|
2434 | Print "Locations:"
|
---|
2435 | Print " --with-kBuild=PATH Where kBuild is to be found."
|
---|
2436 | Print " --with-libSDL=PATH Where libSDL is to be found."
|
---|
2437 | Print " --with-Qt5=PATH Where Qt5 is to be found."
|
---|
2438 | Print " --with-DDK=PATH Where the WDK is to be found."
|
---|
2439 | Print " --with-SDK=PATH Where the Windows SDK is to be found."
|
---|
2440 | Print " --with-SDK10=PATH Where the Windows 10 SDK/WDK is to be found."
|
---|
2441 | Print " --with-VC=PATH Where the Visual C++ compiler is to be found."
|
---|
2442 | Print " (Expecting bin, include and lib subdirs.)"
|
---|
2443 | Print " --with-VC-Common=PATH Maybe needed for 2015 and older to"
|
---|
2444 | Print " locate the Common7 directory."
|
---|
2445 | Print " --with-python=PATH The python to use."
|
---|
2446 | Print " --with-libxml2=PATH To use a libxml2 other than the VBox one."
|
---|
2447 | Print " --with-openssl=PATH To use an openssl other than the VBox one."
|
---|
2448 | Print " --with-openssl32=PATH The 32-bit variant of openssl."
|
---|
2449 | Print " --with-libcurl=PATH To use a cURL other than the VBox one."
|
---|
2450 | Print " --with-libcurl32=PATH The 32-bit variant of cURL."
|
---|
2451 | end sub
|
---|
2452 |
|
---|
2453 |
|
---|
2454 | ''
|
---|
2455 | ' The main() like function.
|
---|
2456 | '
|
---|
2457 | function Main
|
---|
2458 | '
|
---|
2459 | ' Write the log header and check that we're not using wscript.
|
---|
2460 | '
|
---|
2461 | LogInit
|
---|
2462 | if UCase(Right(Wscript.FullName, 11)) = "WSCRIPT.EXE" then
|
---|
2463 | Wscript.Echo "This script must be run under CScript."
|
---|
2464 | Main = 1
|
---|
2465 | exit function
|
---|
2466 | end if
|
---|
2467 |
|
---|
2468 | '
|
---|
2469 | ' Parse arguments.
|
---|
2470 | '
|
---|
2471 | strOptDDK = ""
|
---|
2472 | strOptDXDDK = ""
|
---|
2473 | strOptkBuild = ""
|
---|
2474 | strOptlibSDL = ""
|
---|
2475 | strOptQt5 = ""
|
---|
2476 | strOptQt5Infix = ""
|
---|
2477 | strOptSDK = ""
|
---|
2478 | strOptSDK10 = ""
|
---|
2479 | strOptSDK10Version = ""
|
---|
2480 | strOptVC = ""
|
---|
2481 | strOptVCCommon = ""
|
---|
2482 | strOptXml2 = ""
|
---|
2483 | strOptSsl = ""
|
---|
2484 | strOptSsl32 = ""
|
---|
2485 | strOptCurl = ""
|
---|
2486 | strOptCurl32 = ""
|
---|
2487 | strOptPython = ""
|
---|
2488 | blnOptDisableCOM = False
|
---|
2489 | blnOptDisableUDPTunnel = False
|
---|
2490 | blnOptDisableSDL = False
|
---|
2491 | for i = 1 to Wscript.Arguments.Count
|
---|
2492 | dim str, strArg, strPath
|
---|
2493 |
|
---|
2494 | ' Separate argument and path value
|
---|
2495 | str = Wscript.Arguments.item(i - 1)
|
---|
2496 | if InStr(1, str, "=") > 0 then
|
---|
2497 | strArg = Mid(str, 1, InStr(1, str, "=") - 1)
|
---|
2498 | strPath = Mid(str, InStr(1, str, "=") + 1)
|
---|
2499 | if strPath = "" then MsgFatal "Syntax error! Argument #" & i & " is missing the path."
|
---|
2500 | else
|
---|
2501 | strArg = str
|
---|
2502 | strPath = ""
|
---|
2503 | end if
|
---|
2504 |
|
---|
2505 | ' Process the argument
|
---|
2506 | select case LCase(strArg)
|
---|
2507 | ' --with-something:
|
---|
2508 | case "--with-ddk"
|
---|
2509 | strOptDDK = strPath
|
---|
2510 | case "--with-dxsdk"
|
---|
2511 | MsgWarning "Ignoring --with-dxsdk (the DirectX SDK is no longer required)."
|
---|
2512 | case "--with-kbuild"
|
---|
2513 | strOptkBuild = strPath
|
---|
2514 | case "--with-libsdl"
|
---|
2515 | strOptlibSDL = strPath
|
---|
2516 | case "--with-mingw32"
|
---|
2517 | ' ignore
|
---|
2518 | case "--with-mingw-w64"
|
---|
2519 | ' ignore
|
---|
2520 | case "--with-qt5"
|
---|
2521 | strOptQt5 = strPath
|
---|
2522 | case "--with-qt5-infix"
|
---|
2523 | strOptQt5Infix = strPath
|
---|
2524 | case "--with-sdk"
|
---|
2525 | strOptSDK = strPath
|
---|
2526 | case "--with-sdk10"
|
---|
2527 | strOptSDK10 = strPath
|
---|
2528 | case "--with-sdk10-version"
|
---|
2529 | strOptSDK10Version = strPath
|
---|
2530 | case "--with-vc"
|
---|
2531 | strOptVC = strPath
|
---|
2532 | case "--with-vc-common"
|
---|
2533 | strOptVCCommon = strPath
|
---|
2534 | case "--with-vc-express-edition"
|
---|
2535 | ' ignore
|
---|
2536 | case "--with-w32api"
|
---|
2537 | ' ignore
|
---|
2538 | case "--with-libxml2"
|
---|
2539 | strOptXml2 = strPath
|
---|
2540 | case "--with-openssl"
|
---|
2541 | strOptSsl = strPath
|
---|
2542 | case "--with-openssl32"
|
---|
2543 | strOptSsl32 = strPath
|
---|
2544 | case "--with-libcurl"
|
---|
2545 | strOptCurl = strPath
|
---|
2546 | case "--with-libcurl32"
|
---|
2547 | strOptCurl32 = strPath
|
---|
2548 | case "--with-python"
|
---|
2549 | strOptPython = strPath
|
---|
2550 |
|
---|
2551 | ' --disable-something/--enable-something
|
---|
2552 | case "--disable-com"
|
---|
2553 | blnOptDisableCOM = True
|
---|
2554 | case "--enable-com"
|
---|
2555 | blnOptDisableCOM = False
|
---|
2556 | case "--disable-udptunnel"
|
---|
2557 | blnOptDisableUDPTunnel = True
|
---|
2558 | case "--enable-udptunnel"
|
---|
2559 | blnOptDisableUDPTunnel = False
|
---|
2560 | case "--disable-sdl"
|
---|
2561 | blnOptDisableSDL = True
|
---|
2562 | case "--endable-sdl"
|
---|
2563 | blnOptDisableSDL = False
|
---|
2564 |
|
---|
2565 | ' Other stuff.
|
---|
2566 | case "--continue-on-error"
|
---|
2567 | g_blnContinueOnError = True
|
---|
2568 | case "--internal-first"
|
---|
2569 | g_blnInternalFirst = True
|
---|
2570 | case "--internal-last"
|
---|
2571 | g_blnInternalFirst = False
|
---|
2572 | case "--target-arch"
|
---|
2573 | g_strTargetArch = strPath
|
---|
2574 | case "-h", "--help", "-?"
|
---|
2575 | usage
|
---|
2576 | Main = 0
|
---|
2577 | exit function
|
---|
2578 | case else
|
---|
2579 | Wscript.echo "syntax error: Unknown option '" & str &"'."
|
---|
2580 | usage
|
---|
2581 | Main = 2
|
---|
2582 | exit function
|
---|
2583 | end select
|
---|
2584 | next
|
---|
2585 |
|
---|
2586 | '
|
---|
2587 | ' Initialize output files.
|
---|
2588 | '
|
---|
2589 | CfgInit
|
---|
2590 | EnvInit
|
---|
2591 |
|
---|
2592 | '
|
---|
2593 | ' Check that the Shell function is sane.
|
---|
2594 | '
|
---|
2595 | g_objShell.Environment("PROCESS")("TESTING_ENVIRONMENT_INHERITANCE") = "This works"
|
---|
2596 | if Shell("set TESTING_ENVIRONMENT_INHERITANC", False) <> 0 then ' The 'E' is missing on purpose (4nt).
|
---|
2597 | MsgFatal "shell execution test failed!"
|
---|
2598 | end if
|
---|
2599 | if g_strShellOutput <> "TESTING_ENVIRONMENT_INHERITANCE=This works" & CHR(13) & CHR(10) then
|
---|
2600 | Print "Shell test Test -> '" & g_strShellOutput & "'"
|
---|
2601 | MsgFatal "shell inheritance or shell execution isn't working right. Make sure you use cmd.exe."
|
---|
2602 | end if
|
---|
2603 | g_objShell.Environment("PROCESS")("TESTING_ENVIRONMENT_INHERITANCE") = ""
|
---|
2604 | Print "Shell inheritance test: OK"
|
---|
2605 |
|
---|
2606 | '
|
---|
2607 | ' Do the checks.
|
---|
2608 | '
|
---|
2609 | if blnOptDisableCOM = True then
|
---|
2610 | DisableCOM "--disable-com"
|
---|
2611 | end if
|
---|
2612 | if blnOptDisableUDPTunnel = True then
|
---|
2613 | DisableUDPTunnel "--disable-udptunnel"
|
---|
2614 | end if
|
---|
2615 | CheckSourcePath
|
---|
2616 | CheckForkBuild strOptkBuild
|
---|
2617 | CheckForWinDDK strOptDDK
|
---|
2618 | CheckForVisualCPP strOptVC, strOptVCCommon
|
---|
2619 | CheckForPlatformSDK strOptSDK
|
---|
2620 | CheckForSDK10 strOptSDK10, strOptSDK10Version
|
---|
2621 | CheckForMidl
|
---|
2622 | CfgPrint "VBOX_WITH_OPEN_WATCOM := " '' @todo look for openwatcom 1.9+
|
---|
2623 | CfgPrint "VBOX_WITH_LIBVPX := " '' @todo look for libvpx 1.1.0+
|
---|
2624 | CfgPrint "VBOX_WITH_LIBOPUS := " '' @todo look for libopus 1.2.1+
|
---|
2625 |
|
---|
2626 | EnvPrintAppend "PATH", DosSlashes(g_strPath & "\tools\win." & g_strHostArch & "\bin"), ";" '' @todo look for yasm
|
---|
2627 | if g_strHostArch = "amd64" then
|
---|
2628 | EnvPrintAppend "PATH", DosSlashes(g_strPath & "\tools\win.x86\bin"), ";"
|
---|
2629 | else
|
---|
2630 | EnvPrintCleanup "PATH", DosSlashes(g_strPath & "\tools\win.amd64\bin"), ";"
|
---|
2631 | end if
|
---|
2632 | if blnOptDisableSDL = True then
|
---|
2633 | DisableSDL "--disable-sdl"
|
---|
2634 | else
|
---|
2635 | CheckForlibSDL strOptlibSDL
|
---|
2636 | end if
|
---|
2637 | CheckForXml2 strOptXml2
|
---|
2638 | CheckForSsl strOptSsl, False
|
---|
2639 | if g_strTargetArch = "amd64" then
|
---|
2640 | ' 32-bit openssl required as well
|
---|
2641 | CheckForSsl strOptSsl32, True
|
---|
2642 | end if
|
---|
2643 | CheckForCurl strOptCurl, False
|
---|
2644 | if g_strTargetArch = "amd64" then
|
---|
2645 | ' 32-bit Curl required as well
|
---|
2646 | CheckForCurl strOptCurl32, True
|
---|
2647 | end if
|
---|
2648 | CheckForQt strOptQt5, strOptQt5Infix
|
---|
2649 | CheckForPython strOptPython
|
---|
2650 |
|
---|
2651 | Print ""
|
---|
2652 | Print "Execute env.bat once before you start to build VBox:"
|
---|
2653 | Print ""
|
---|
2654 | Print " env.bat"
|
---|
2655 | Print " kmk"
|
---|
2656 | Print ""
|
---|
2657 | if g_rcScript <> 0 then
|
---|
2658 | Print "Warning: ignored errors. See above or in configure.log."
|
---|
2659 | end if
|
---|
2660 |
|
---|
2661 | Main = g_rcScript
|
---|
2662 | end function
|
---|
2663 |
|
---|
2664 | '
|
---|
2665 | ' What crt0.o typically does:
|
---|
2666 | '
|
---|
2667 | WScript.Quit(Main())
|
---|
2668 |
|
---|