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