1 | ' $Id: configure.vbs 85715 2020-08-12 13:54:57Z 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 | ' Right pads a string with spaces to the given length
|
---|
551 | function RightPad(str, cch)
|
---|
552 | if Len(str) < cch then
|
---|
553 | RightPad = str & String(cch - Len(str), " ")
|
---|
554 | else
|
---|
555 | RightPad = str
|
---|
556 | end if
|
---|
557 | end function
|
---|
558 |
|
---|
559 | ''
|
---|
560 | ' Append text to the log file and echo it to stdout
|
---|
561 | sub Print(str)
|
---|
562 | LogPrint str
|
---|
563 | Wscript.Echo str
|
---|
564 | end sub
|
---|
565 |
|
---|
566 |
|
---|
567 | ''
|
---|
568 | ' Prints a test header
|
---|
569 | sub PrintHdr(strTest)
|
---|
570 | LogPrint "***** Checking for " & strTest & " *****"
|
---|
571 | Wscript.Echo "Checking for " & StrTest & "..."
|
---|
572 | end sub
|
---|
573 |
|
---|
574 |
|
---|
575 | ''
|
---|
576 | ' Prints a success message
|
---|
577 | sub PrintResultMsg(strTest, strResult)
|
---|
578 | dim cchPad
|
---|
579 | LogPrint "** " & strTest & ": " & strResult
|
---|
580 | Wscript.Echo " Found " & RightPad(strTest & ": ", 18) & strPad & strResult
|
---|
581 | end sub
|
---|
582 |
|
---|
583 |
|
---|
584 | ''
|
---|
585 | ' Prints a successfully detected path
|
---|
586 | sub PrintResult(strTest, strPath)
|
---|
587 | strLongPath = PathAbsLong(strPath)
|
---|
588 | if PathAbs(strPath) <> strLongPath then
|
---|
589 | LogPrint "** " & strTest & ": " & strPath & " (" & UnixSlashes(strLongPath) & ")"
|
---|
590 | Wscript.Echo " Found " & RightPad(strTest & ": ", 18) & strPath & " (" & UnixSlashes(strLongPath) & ")"
|
---|
591 | else
|
---|
592 | LogPrint "** " & strTest & ": " & strPath
|
---|
593 | Wscript.Echo " Found " & RightPad(strTest & ": ", 18) & strPath
|
---|
594 | end if
|
---|
595 | end sub
|
---|
596 |
|
---|
597 |
|
---|
598 | ''
|
---|
599 | ' Warning message.
|
---|
600 | sub MsgWarning(strMsg)
|
---|
601 | Print "warning: " & strMsg
|
---|
602 | end sub
|
---|
603 |
|
---|
604 |
|
---|
605 | ''
|
---|
606 | ' Fatal error.
|
---|
607 | sub MsgFatal(strMsg)
|
---|
608 | Print "fatal error: " & strMsg
|
---|
609 | Wscript.Quit
|
---|
610 | end sub
|
---|
611 |
|
---|
612 |
|
---|
613 | ''
|
---|
614 | ' Error message, fatal unless flag to ignore errors is given.
|
---|
615 | sub MsgError(strMsg)
|
---|
616 | Print "error: " & strMsg
|
---|
617 | if g_blnInternalMode = False then
|
---|
618 | Wscript.Quit
|
---|
619 | end if
|
---|
620 | end sub
|
---|
621 |
|
---|
622 |
|
---|
623 | ''
|
---|
624 | ' Write a log header with some basic info.
|
---|
625 | sub LogInit
|
---|
626 | FileDelete g_strLogFile
|
---|
627 | LogPrint "# Log file generated by " & Wscript.ScriptFullName
|
---|
628 | for i = 1 to WScript.Arguments.Count
|
---|
629 | LogPrint "# Arg #" & i & ": " & WScript.Arguments.Item(i - 1)
|
---|
630 | next
|
---|
631 | if Wscript.Arguments.Count = 0 then
|
---|
632 | LogPrint "# No arguments given"
|
---|
633 | end if
|
---|
634 | LogPrint "# Reconstructed command line: " & GetCommandline()
|
---|
635 |
|
---|
636 | ' some Wscript stuff
|
---|
637 | LogPrint "# Wscript properties:"
|
---|
638 | LogPrint "# ScriptName: " & Wscript.ScriptName
|
---|
639 | LogPrint "# Version: " & Wscript.Version
|
---|
640 | LogPrint "# Build: " & Wscript.BuildVersion
|
---|
641 | LogPrint "# Name: " & Wscript.Name
|
---|
642 | LogPrint "# Full Name: " & Wscript.FullName
|
---|
643 | LogPrint "# Path: " & Wscript.Path
|
---|
644 | LogPrint "#"
|
---|
645 |
|
---|
646 |
|
---|
647 | ' the environment
|
---|
648 | LogPrint "# Environment:"
|
---|
649 | dim objEnv
|
---|
650 | for each strVar in g_objShell.Environment("PROCESS")
|
---|
651 | LogPrint "# " & strVar
|
---|
652 | next
|
---|
653 | LogPrint "#"
|
---|
654 | end sub
|
---|
655 |
|
---|
656 |
|
---|
657 | ''
|
---|
658 | ' Append text to the log file.
|
---|
659 | sub LogPrint(str)
|
---|
660 | FileAppendLine g_strLogFile, str
|
---|
661 | 'Wscript.Echo "dbg: " & str
|
---|
662 | end sub
|
---|
663 |
|
---|
664 |
|
---|
665 | ''
|
---|
666 | ' Checks if the file exists and logs failures.
|
---|
667 | function LogFileExists(strPath, strFilename)
|
---|
668 | LogFileExists = FileExists(strPath & "/" & strFilename)
|
---|
669 | if LogFileExists = False then
|
---|
670 | LogPrint "Testing '" & strPath & "': " & strFilename & " not found"
|
---|
671 | end if
|
---|
672 |
|
---|
673 | end function
|
---|
674 |
|
---|
675 |
|
---|
676 | ''
|
---|
677 | ' Finds the first file matching the pattern.
|
---|
678 | ' If no file is found, log the failure.
|
---|
679 | function LogFindFile(strPath, strPattern)
|
---|
680 | dim str
|
---|
681 |
|
---|
682 | '
|
---|
683 | ' Yes, there are some facy database kinda interface to the filesystem
|
---|
684 | ' however, breaking down the path and constructing a usable query is
|
---|
685 | ' too much hassle. So, we'll do it the unix way...
|
---|
686 | '
|
---|
687 | if Shell("dir /B """ & DosSlashes(strPath) & "\" & DosSlashes(strPattern) & """", True) = 0 _
|
---|
688 | And InStr(1, g_strShellOutput, Chr(13)) > 1 _
|
---|
689 | then
|
---|
690 | ' return the first word.
|
---|
691 | LogFindFile = Left(g_strShellOutput, InStr(1, g_strShellOutput, Chr(13)) - 1)
|
---|
692 | else
|
---|
693 | LogPrint "Testing '" & strPath & "': " & strPattern & " not found"
|
---|
694 | LogFindFile = ""
|
---|
695 | end if
|
---|
696 | end function
|
---|
697 |
|
---|
698 |
|
---|
699 | ''
|
---|
700 | ' Finds the first directory matching the pattern.
|
---|
701 | ' If no directory is found, log the failure,
|
---|
702 | ' else return the complete path to the found directory.
|
---|
703 | function LogFindDir(strPath, strPattern)
|
---|
704 | dim str
|
---|
705 |
|
---|
706 | '
|
---|
707 | ' Yes, there are some facy database kinda interface to the filesystem
|
---|
708 | ' however, breaking down the path and constructing a usable query is
|
---|
709 | ' too much hassle. So, we'll do it the unix way...
|
---|
710 | '
|
---|
711 |
|
---|
712 | ' List the alphabetically last names as first entries (with /O-N).
|
---|
713 | if Shell("dir /B /AD /O-N """ & DosSlashes(strPath) & "\" & DosSlashes(strPattern) & """", True) = 0 _
|
---|
714 | And InStr(1, g_strShellOutput, Chr(13)) > 1 _
|
---|
715 | then
|
---|
716 | ' return the first word.
|
---|
717 | LogFindDir = strPath & "/" & Left(g_strShellOutput, InStr(1, g_strShellOutput, Chr(13)) - 1)
|
---|
718 | else
|
---|
719 | LogPrint "Testing '" & strPath & "': " & strPattern & " not found"
|
---|
720 | LogFindDir = ""
|
---|
721 | end if
|
---|
722 | end function
|
---|
723 |
|
---|
724 |
|
---|
725 | ''
|
---|
726 | ' Initializes the config file.
|
---|
727 | sub CfgInit
|
---|
728 | FileDelete g_strCfgFile
|
---|
729 | CfgPrint "# -*- Makefile -*-"
|
---|
730 | CfgPrint "#"
|
---|
731 | CfgPrint "# Build configuration generated by " & GetCommandline()
|
---|
732 | CfgPrint "#"
|
---|
733 | if g_blnInternalMode = False then
|
---|
734 | CfgPrint "VBOX_OSE := 1"
|
---|
735 | CfgPrint "VBOX_VCC_WERR = $(NO_SUCH_VARIABLE)"
|
---|
736 | end if
|
---|
737 | end sub
|
---|
738 |
|
---|
739 |
|
---|
740 | ''
|
---|
741 | ' Prints a string to the config file.
|
---|
742 | sub CfgPrint(str)
|
---|
743 | FileAppendLine g_strCfgFile, str
|
---|
744 | end sub
|
---|
745 |
|
---|
746 |
|
---|
747 | ''
|
---|
748 | ' Initializes the environment batch script.
|
---|
749 | sub EnvInit
|
---|
750 | FileDelete g_strEnvFile
|
---|
751 | EnvPrint "@echo off"
|
---|
752 | EnvPrint "rem"
|
---|
753 | EnvPrint "rem Environment setup script generated by " & GetCommandline()
|
---|
754 | EnvPrint "rem"
|
---|
755 | end sub
|
---|
756 |
|
---|
757 |
|
---|
758 | ''
|
---|
759 | ' Prints a string to the environment batch script.
|
---|
760 | sub EnvPrint(str)
|
---|
761 | FileAppendLine g_strEnvFile, str
|
---|
762 | end sub
|
---|
763 |
|
---|
764 |
|
---|
765 | ''
|
---|
766 | ' Helper for EnvPrintPrepend and EnvPrintAppend.
|
---|
767 | sub EnvPrintCleanup(strEnv, strValue, strSep)
|
---|
768 | dim cchValueAndSep
|
---|
769 | FileAppendLine g_strEnvFile, "set " & strEnv & "=%" & strEnv & ":" & strSep & strValue & strSep & "=" & strSep & "%"
|
---|
770 | cchValueAndSep = Len(strValue) + Len(strSep)
|
---|
771 | FileAppendLine g_strEnvFile, "if ""%" & strEnv & "%""==""" & strValue & """ set " & strEnv & "="
|
---|
772 | FileAppendLine g_strEnvFile, "if ""%" & strEnv & ":~0," & cchValueAndSep & "%""==""" & strValue & strSep & """ set " & strEnv & "=%" & strEnv & ":~" & cchValueAndSep & "%"
|
---|
773 | FileAppendLine g_strEnvFile, "if ""%" & strEnv & ":~-" & cchValueAndSep & "%""==""" & strSep & strValue & """ set " & strEnv & "=%" & strEnv & ":~0,-" & cchValueAndSep & "%"
|
---|
774 | end sub
|
---|
775 |
|
---|
776 | '' Use by EnvPrintPrepend to skip ';' stripping.
|
---|
777 | dim g_strPrependCleanEnvVars
|
---|
778 |
|
---|
779 | ''
|
---|
780 | ' Print a statement prepending strValue to strEnv, removing duplicate values.
|
---|
781 | sub EnvPrintPrepend(strEnv, strValue, strSep)
|
---|
782 | ' Remove old values and any leading separators.
|
---|
783 | EnvPrintCleanup strEnv, strValue, strSep
|
---|
784 | if InStr(1, g_strPrependCleanEnvVars, "|" & strEnv & "|") = 0 then
|
---|
785 | FileAppendLine g_strEnvFile, "if ""%" & strEnv & ":~0,1%""==""" & strSep & """ set " & strEnv & "=%" & strEnv & ":~1%"
|
---|
786 | FileAppendLine g_strEnvFile, "if ""%" & strEnv & ":~0,1%""==""" & strSep & """ set " & strEnv & "=%" & strEnv & ":~1%"
|
---|
787 | g_strPrependCleanEnvVars = g_strPrependCleanEnvVars & "|" & strEnv & "|"
|
---|
788 | end if
|
---|
789 | ' Do the setting
|
---|
790 | FileAppendLine g_strEnvFile, "set " & strEnv & "=" & strValue & strSep & "%" & strEnv & "%"
|
---|
791 | end sub
|
---|
792 |
|
---|
793 |
|
---|
794 | '' Use by EnvPrintPrepend to skip ';' stripping.
|
---|
795 | dim g_strAppendCleanEnvVars
|
---|
796 |
|
---|
797 | ''
|
---|
798 | ' Print a statement appending strValue to strEnv, removing duplicate values.
|
---|
799 | sub EnvPrintAppend(strEnv, strValue, strSep)
|
---|
800 | ' Remove old values and any trailing separators.
|
---|
801 | EnvPrintCleanup strEnv, strValue, strSep
|
---|
802 | if InStr(1, g_strAppendCleanEnvVars, "|" & strEnv & "|") = 0 then
|
---|
803 | FileAppendLine g_strEnvFile, "if ""%" & strEnv & ":~-1%""==""" & strSep & """ set " & strEnv & "=%" & strEnv & ":~0,-1%"
|
---|
804 | FileAppendLine g_strEnvFile, "if ""%" & strEnv & ":~-1%""==""" & strSep & """ set " & strEnv & "=%" & strEnv & ":~0,-1%"
|
---|
805 | g_strAppendCleanEnvVars = g_strAppendCleanEnvVars & "|" & strEnv & "|"
|
---|
806 | end if
|
---|
807 | ' Do the setting.
|
---|
808 | FileAppendLine g_strEnvFile, "set " & strEnv & "=%" & strEnv & "%" & strSep & strValue
|
---|
809 | end sub
|
---|
810 |
|
---|
811 |
|
---|
812 | ''
|
---|
813 | ' No COM
|
---|
814 | sub DisableCOM(strReason)
|
---|
815 | if g_blnDisableCOM = False then
|
---|
816 | LogPrint "Disabled COM components: " & strReason
|
---|
817 | g_blnDisableCOM = True
|
---|
818 | g_strDisableCOM = strReason
|
---|
819 | CfgPrint "VBOX_WITH_MAIN="
|
---|
820 | CfgPrint "VBOX_WITH_QTGUI="
|
---|
821 | CfgPrint "VBOX_WITH_VBOXSDL="
|
---|
822 | CfgPrint "VBOX_WITH_DEBUGGER_GUI="
|
---|
823 | end if
|
---|
824 | end sub
|
---|
825 |
|
---|
826 |
|
---|
827 | ''
|
---|
828 | ' No UDPTunnel
|
---|
829 | sub DisableUDPTunnel(strReason)
|
---|
830 | if g_blnDisableUDPTunnel = False then
|
---|
831 | LogPrint "Disabled UDPTunnel network transport: " & strReason
|
---|
832 | g_blnDisableUDPTunnel = True
|
---|
833 | g_strDisableUDPTunnel = strReason
|
---|
834 | CfgPrint "VBOX_WITH_UDPTUNNEL="
|
---|
835 | end if
|
---|
836 | end sub
|
---|
837 |
|
---|
838 |
|
---|
839 | ''
|
---|
840 | ' No SDL
|
---|
841 | sub DisableSDL(strReason)
|
---|
842 | if g_blnDisableSDL = False then
|
---|
843 | LogPrint "Disabled SDL frontend: " & strReason
|
---|
844 | g_blnDisableSDL = True
|
---|
845 | g_strDisableSDL = strReason
|
---|
846 | CfgPrint "VBOX_WITH_VBOXSDL="
|
---|
847 | end if
|
---|
848 | end sub
|
---|
849 |
|
---|
850 |
|
---|
851 | ''
|
---|
852 | ' Checks the the path doesn't contain characters the tools cannot deal with.
|
---|
853 | sub CheckSourcePath
|
---|
854 | dim sPwd
|
---|
855 |
|
---|
856 | sPwd = PathAbs(g_strPath)
|
---|
857 | if InStr(1, sPwd, " ") > 0 then
|
---|
858 | MsgError "Source path contains spaces! Please move it. (" & sPwd & ")"
|
---|
859 | end if
|
---|
860 | if InStr(1, sPwd, "$") > 0 then
|
---|
861 | MsgError "Source path contains the '$' char! Please move it. (" & sPwd & ")"
|
---|
862 | end if
|
---|
863 | if InStr(1, sPwd, "%") > 0 then
|
---|
864 | MsgError "Source path contains the '%' char! Please move it. (" & sPwd & ")"
|
---|
865 | end if
|
---|
866 | if InStr(1, sPwd, Chr(10)) > 0 _
|
---|
867 | Or InStr(1, sPwd, Chr(13)) > 0 _
|
---|
868 | Or InStr(1, sPwd, Chr(9)) > 0 _
|
---|
869 | then
|
---|
870 | MsgError "Source path contains control characters! Please move it. (" & sPwd & ")"
|
---|
871 | end if
|
---|
872 | Print "Source path: OK"
|
---|
873 | end sub
|
---|
874 |
|
---|
875 |
|
---|
876 | ''
|
---|
877 | ' Checks for kBuild - very simple :)
|
---|
878 | sub CheckForkBuild(strOptkBuild)
|
---|
879 | PrintHdr "kBuild"
|
---|
880 |
|
---|
881 | '
|
---|
882 | ' Check if there is a 'kmk' in the path somewhere without
|
---|
883 | ' any KBUILD_*PATH stuff around.
|
---|
884 | '
|
---|
885 | blnNeedEnvVars = True
|
---|
886 | g_strPathkBuild = strOptkBuild
|
---|
887 | g_strPathkBuildBin = ""
|
---|
888 | if (g_strPathkBuild = "") _
|
---|
889 | And (EnvGetFirst("KBUILD_PATH", "PATH_KBUILD") = "") _
|
---|
890 | And (EnvGetFirst("KBUILD_BIN_PATH", "PATH_KBUILD_BIN") = "") _
|
---|
891 | And (Shell("kmk.exe --version", True) = 0) _
|
---|
892 | And (InStr(1,g_strShellOutput, "kBuild Make 0.1") > 0) _
|
---|
893 | And (InStr(1,g_strShellOutput, "KBUILD_PATH") > 0) _
|
---|
894 | And (InStr(1,g_strShellOutput, "KBUILD_BIN_PATH") > 0) then
|
---|
895 | '' @todo Need to parse out the KBUILD_PATH and KBUILD_BIN_PATH values to complete the other tests.
|
---|
896 | 'blnNeedEnvVars = False
|
---|
897 | MsgWarning "You've installed kBuild it seems. configure.vbs hasn't been updated to " _
|
---|
898 | & "deal with that yet and will use the one it ships with. Sorry."
|
---|
899 | end if
|
---|
900 |
|
---|
901 | '
|
---|
902 | ' Check for the KBUILD_PATH env.var. and fall back on root/kBuild otherwise.
|
---|
903 | '
|
---|
904 | if g_strPathkBuild = "" then
|
---|
905 | g_strPathkBuild = EnvGetFirst("KBUILD_PATH", "PATH_KBUILD")
|
---|
906 | if (g_strPathkBuild <> "") and (FileExists(g_strPathkBuild & "/footer.kmk") = False) then
|
---|
907 | MsgWarning "Ignoring incorrect kBuild path (KBUILD_PATH=" & g_strPathkBuild & ")"
|
---|
908 | g_strPathkBuild = ""
|
---|
909 | end if
|
---|
910 |
|
---|
911 | if g_strPathkBuild = "" then
|
---|
912 | g_strPathkBuild = g_strPath & "/kBuild"
|
---|
913 | end if
|
---|
914 | end if
|
---|
915 |
|
---|
916 | g_strPathkBuild = UnixSlashes(PathAbs(g_strPathkBuild))
|
---|
917 |
|
---|
918 | '
|
---|
919 | ' Check for env.vars that kBuild uses (do this early to set g_strTargetArch).
|
---|
920 | '
|
---|
921 | str = EnvGetFirst("KBUILD_TYPE", "BUILD_TYPE")
|
---|
922 | if (str <> "") _
|
---|
923 | And (InStr(1, "|release|debug|profile|kprofile", str) <= 0) then
|
---|
924 | EnvPrint "set KBUILD_TYPE=release"
|
---|
925 | EnvSet "KBUILD_TYPE", "release"
|
---|
926 | MsgWarning "Found unknown KBUILD_TYPE value '" & str &"' in your environment. Setting it to 'release'."
|
---|
927 | end if
|
---|
928 |
|
---|
929 | str = EnvGetFirst("KBUILD_TARGET", "BUILD_TARGET")
|
---|
930 | if (str <> "") _
|
---|
931 | And (InStr(1, "win|win32|win64", str) <= 0) then '' @todo later only 'win' will be valid. remember to fix this check!
|
---|
932 | EnvPrint "set KBUILD_TARGET=win"
|
---|
933 | EnvSet "KBUILD_TARGET", "win"
|
---|
934 | MsgWarning "Found unknown KBUILD_TARGET value '" & str &"' in your environment. Setting it to 'win32'."
|
---|
935 | end if
|
---|
936 |
|
---|
937 | str = EnvGetFirst("KBUILD_TARGET_ARCH", "BUILD_TARGET_ARCH")
|
---|
938 | if (str <> "") _
|
---|
939 | And (InStr(1, "x86|amd64", str) <= 0) then
|
---|
940 | EnvPrint "set KBUILD_TARGET_ARCH=x86"
|
---|
941 | EnvSet "KBUILD_TARGET_ARCH", "x86"
|
---|
942 | MsgWarning "Found unknown KBUILD_TARGET_ARCH value '" & str &"' in your environment. Setting it to 'x86'."
|
---|
943 | str = "x86"
|
---|
944 | end if
|
---|
945 | if g_strTargetArch = "" then '' command line parameter --target-arch=x86|amd64 has priority
|
---|
946 | if str <> "" then
|
---|
947 | g_strTargetArch = str
|
---|
948 | elseif (EnvGet("PROCESSOR_ARCHITEW6432") = "AMD64" ) _
|
---|
949 | Or (EnvGet("PROCESSOR_ARCHITECTURE") = "AMD64" ) then
|
---|
950 | g_strTargetArch = "amd64"
|
---|
951 | else
|
---|
952 | g_strTargetArch = "x86"
|
---|
953 | end if
|
---|
954 | else
|
---|
955 | if InStr(1, "x86|amd64", g_strTargetArch) <= 0 then
|
---|
956 | EnvPrint "set KBUILD_TARGET_ARCH=x86"
|
---|
957 | EnvSet "KBUILD_TARGET_ARCH", "x86"
|
---|
958 | MsgWarning "Unknown --target-arch=" & str &". Setting it to 'x86'."
|
---|
959 | end if
|
---|
960 | end if
|
---|
961 | LogPrint " Target architecture: " & g_strTargetArch & "."
|
---|
962 | Wscript.Echo " Target architecture: " & g_strTargetArch & "."
|
---|
963 | EnvPrint "set KBUILD_TARGET_ARCH=" & g_strTargetArch
|
---|
964 |
|
---|
965 | str = EnvGetFirst("KBUILD_TARGET_CPU", "BUILD_TARGET_CPU")
|
---|
966 | ' perhaps a bit pedantic this since this isn't clearly define nor used much...
|
---|
967 | if (str <> "") _
|
---|
968 | And (InStr(1, "i386|i486|i686|i786|i868|k5|k6|k7|k8", str) <= 0) then
|
---|
969 | EnvPrint "set BUILD_TARGET_CPU=i386"
|
---|
970 | EnvSet "KBUILD_TARGET_CPU", "i386"
|
---|
971 | MsgWarning "Found unknown KBUILD_TARGET_CPU value '" & str &"' in your environment. Setting it to 'i386'."
|
---|
972 | end if
|
---|
973 |
|
---|
974 | str = EnvGetFirst("KBUILD_HOST", "BUILD_PLATFORM")
|
---|
975 | if (str <> "") _
|
---|
976 | And (InStr(1, "win|win32|win64", str) <= 0) then '' @todo later only 'win' will be valid. remember to fix this check!
|
---|
977 | EnvPrint "set KBUILD_HOST=win"
|
---|
978 | EnvSet "KBUILD_HOST", "win"
|
---|
979 | MsgWarning "Found unknown KBUILD_HOST value '" & str &"' in your environment. Setting it to 'win32'."
|
---|
980 | end if
|
---|
981 |
|
---|
982 | str = EnvGetFirst("KBUILD_HOST_ARCH", "BUILD_PLATFORM_ARCH")
|
---|
983 | if str <> "" then
|
---|
984 | if InStr(1, "x86|amd64", str) <= 0 then
|
---|
985 | str = "x86"
|
---|
986 | MsgWarning "Found unknown KBUILD_HOST_ARCH value '" & str &"' in your environment. Setting it to 'x86'."
|
---|
987 | end if
|
---|
988 | elseif (EnvGet("PROCESSOR_ARCHITEW6432") = "AMD64" ) _
|
---|
989 | Or (EnvGet("PROCESSOR_ARCHITECTURE") = "AMD64" ) then
|
---|
990 | str = "amd64"
|
---|
991 | else
|
---|
992 | str = "x86"
|
---|
993 | end if
|
---|
994 | LogPrint " Host architecture: " & str & "."
|
---|
995 | Wscript.Echo " Host architecture: " & str & "."
|
---|
996 | EnvPrint "set KBUILD_HOST_ARCH=" & str
|
---|
997 | g_strHostArch = str
|
---|
998 |
|
---|
999 | str = EnvGetFirst("KBUILD_HOST_CPU", "BUILD_PLATFORM_CPU")
|
---|
1000 | ' perhaps a bit pedantic this since this isn't clearly define nor used much...
|
---|
1001 | if (str <> "") _
|
---|
1002 | And (InStr(1, "i386|i486|i686|i786|i868|k5|k6|k7|k8", str) <= 0) then
|
---|
1003 | EnvPrint "set KBUILD_HOST_CPU=i386"
|
---|
1004 | EnvSet "KBUILD_HOST_CPU", "i386"
|
---|
1005 | MsgWarning "Found unknown KBUILD_HOST_CPU value '" & str &"' in your environment. Setting it to 'i386'."
|
---|
1006 | end if
|
---|
1007 |
|
---|
1008 | '
|
---|
1009 | ' Determin the location of the kBuild binaries.
|
---|
1010 | '
|
---|
1011 | if g_strPathkBuildBin = "" then
|
---|
1012 | g_strPathkBuildBin = g_strPathkBuild & "/bin/win." & g_strHostArch
|
---|
1013 | if FileExists(g_strPathkBuildBin & "/kmk.exe") = False then
|
---|
1014 | g_strPathkBuildBin = g_strPathkBuild & "/bin/win.x86"
|
---|
1015 | end if
|
---|
1016 | end if
|
---|
1017 | g_strPathkBuildBin = UnixSlashes(PathAbs(g_strPathkBuildBin))
|
---|
1018 |
|
---|
1019 | '
|
---|
1020 | ' Perform basic validations of the kBuild installation.
|
---|
1021 | '
|
---|
1022 | if (FileExists(g_strPathkBuild & "/footer.kmk") = False) _
|
---|
1023 | Or (FileExists(g_strPathkBuild & "/header.kmk") = False) _
|
---|
1024 | Or (FileExists(g_strPathkBuild & "/rules.kmk") = False) then
|
---|
1025 | MsgFatal "Can't find valid kBuild at '" & g_strPathkBuild & "'. Either there is an " _
|
---|
1026 | & "incorrect KBUILD_PATH in the environment or the checkout didn't succeed."
|
---|
1027 | exit sub
|
---|
1028 | end if
|
---|
1029 | if (FileExists(g_strPathkBuildBin & "/kmk.exe") = False) _
|
---|
1030 | Or (FileExists(g_strPathkBuildBin & "/kmk_ash.exe") = False) then
|
---|
1031 | MsgFatal "Can't find valid kBuild binaries at '" & g_strPathkBuildBin & "'. Either there is an " _
|
---|
1032 | & "incorrect KBUILD_PATH in the environment or the checkout didn't succeed."
|
---|
1033 | exit sub
|
---|
1034 | end if
|
---|
1035 |
|
---|
1036 | if (Shell(DosSlashes(g_strPathkBuildBin & "/kmk.exe") & " --version", True) <> 0) Then
|
---|
1037 | MsgFatal "Can't execute '" & g_strPathkBuildBin & "/kmk.exe --version'. check configure.log for the out."
|
---|
1038 | exit sub
|
---|
1039 | end if
|
---|
1040 |
|
---|
1041 | '
|
---|
1042 | ' If PATH_DEV is set, check that it's pointing to something useful.
|
---|
1043 | '
|
---|
1044 | ''' @todo wtf is this supposed to be again? Nobody uses it afaikt.
|
---|
1045 | str = EnvGet("PATH_DEV")
|
---|
1046 | g_strPathDev = str
|
---|
1047 | if (str <> "") _
|
---|
1048 | And False then '' @todo add some proper tests here.
|
---|
1049 | strNew = UnixSlashes(g_strPath & "/tools")
|
---|
1050 | EnvPrint "set PATH_DEV=" & strNew
|
---|
1051 | EnvSet "PATH_DEV", strNew
|
---|
1052 | MsgWarning "Found PATH_DEV='" & str &"' in your environment. Setting it to '" & strNew & "'."
|
---|
1053 | g_strPathDev = strNew
|
---|
1054 | end if
|
---|
1055 | if g_strPathDev = "" then g_strPathDev = UnixSlashes(g_strPath & "/tools")
|
---|
1056 |
|
---|
1057 | '
|
---|
1058 | ' Write KBUILD_PATH and updated PATH to the environment script if necessary.
|
---|
1059 | '
|
---|
1060 | if blnNeedEnvVars = True then
|
---|
1061 | EnvPrint "set KBUILD_PATH=" & g_strPathkBuild
|
---|
1062 | EnvSet "KBUILD_PATH", g_strPathkBuild
|
---|
1063 |
|
---|
1064 | if Right(g_strPathkBuildBin, 7) = "win.x86" then
|
---|
1065 | EnvPrintCleanup "PATH", DosSlashes(Left(g_strPathkBuildBin, Len(g_strPathkBuildBin) - 7) & "win.amd64"), ";"
|
---|
1066 | end if
|
---|
1067 | if Right(g_strPathkBuildBin, 9) = "win.amd64" then
|
---|
1068 | EnvPrintCleanup "PATH", DosSlashes(Left(g_strPathkBuildBin, Len(g_strPathkBuildBin) - 9) & "win.x86"), ";"
|
---|
1069 | end if
|
---|
1070 | EnvPrintPrepend "PATH", DosSlashes(g_strPathkBuildBin), ";"
|
---|
1071 | EnvPrepend "PATH", g_strPathkBuildBin & ";"
|
---|
1072 | end if
|
---|
1073 |
|
---|
1074 | PrintResult "kBuild", g_strPathkBuild
|
---|
1075 | PrintResult "kBuild binaries", g_strPathkBuildBin
|
---|
1076 | end sub
|
---|
1077 |
|
---|
1078 |
|
---|
1079 | ''
|
---|
1080 | ' Checks for Visual C++ version 10 (2010).
|
---|
1081 | sub CheckForVisualCPP(strOptVC, strOptVCCommon, blnOptVCExpressEdition)
|
---|
1082 | dim strPathVC, strPathVCCommon, str, str2, blnNeedMsPDB
|
---|
1083 | PrintHdr "Visual C++"
|
---|
1084 |
|
---|
1085 | '
|
---|
1086 | ' Try find it...
|
---|
1087 | '
|
---|
1088 | strPathVC = ""
|
---|
1089 | strPathVCCommon = ""
|
---|
1090 | if (strPathVC = "") And (strOptVC <> "") then
|
---|
1091 | if CheckForVisualCPPSub(strOptVC, strOptVCCommon, blnOptVCExpressEdition) then
|
---|
1092 | strPathVC = strOptVC
|
---|
1093 | strPathVCCommon = strOptVCCommon
|
---|
1094 | end if
|
---|
1095 | end if
|
---|
1096 |
|
---|
1097 | if (strPathVC = "") And (g_blnInternalFirst = True) Then
|
---|
1098 | strPathVC = g_strPathDev & "/win.x86/vcc/v10sp1"
|
---|
1099 | if CheckForVisualCPPSub(strPathVC, "", blnOptVCExpressEdition) = False then
|
---|
1100 | strPathVC = ""
|
---|
1101 | end if
|
---|
1102 | end if
|
---|
1103 |
|
---|
1104 | if (strPathVC = "") _
|
---|
1105 | And (Shell("cl.exe", True) = 0) then
|
---|
1106 | str = Which("cl.exe")
|
---|
1107 | if FileExists(PathStripFilename(strClExe) & "/build.exe") then
|
---|
1108 | ' don't know how to deal with this cl.
|
---|
1109 | Warning "Ignoring DDK cl.exe (" & str & ")."
|
---|
1110 | else
|
---|
1111 | strPathVC = PathParent(PathStripFilename(str))
|
---|
1112 | strPathVCCommon = PathParent(strPathVC) & "/Common7"
|
---|
1113 | end if
|
---|
1114 | end if
|
---|
1115 |
|
---|
1116 | if (strPathVC = "") then
|
---|
1117 | str = RegGetString("HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Setup\VS\ProductDir")
|
---|
1118 | if str <> "" Then
|
---|
1119 | str2 = str & "Common7"
|
---|
1120 | str = str & "VC"
|
---|
1121 | if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
|
---|
1122 | strPathVC = str
|
---|
1123 | strPathVCCommon = str2
|
---|
1124 | end if
|
---|
1125 | end if
|
---|
1126 | end if
|
---|
1127 |
|
---|
1128 | if (strPathVC = "") then
|
---|
1129 | str = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\10.0\Setup\VS\ProductDir")
|
---|
1130 | if str <> "" Then
|
---|
1131 | str2 = str & "Common7"
|
---|
1132 | str = str & "VC"
|
---|
1133 | if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
|
---|
1134 | strPathVC = str
|
---|
1135 | strPathVCCommon = str2
|
---|
1136 | end if
|
---|
1137 | end if
|
---|
1138 | end if
|
---|
1139 |
|
---|
1140 | if (strPathVC = "") And (g_blnInternalFirst = False) Then
|
---|
1141 | strPathVC = g_strPathDev & "/win.x86/vcc/v10sp1"
|
---|
1142 | if CheckForVisualCPPSub(strPathVC, "", blnOptVCExpressEdition) = False then
|
---|
1143 | strPathVC = ""
|
---|
1144 | end if
|
---|
1145 | end if
|
---|
1146 |
|
---|
1147 | if strPathVC = "" then
|
---|
1148 | MsgError "Cannot find cl.exe (Visual C++) anywhere on your system. Check the build requirements."
|
---|
1149 | exit sub
|
---|
1150 | end if
|
---|
1151 |
|
---|
1152 | '
|
---|
1153 | ' Clean up the path and determin the VC directory.
|
---|
1154 | '
|
---|
1155 | strPathVC = UnixSlashes(PathAbs(strPathVC))
|
---|
1156 | g_strPathVCC = strPathVC
|
---|
1157 |
|
---|
1158 | '
|
---|
1159 | ' Check the version.
|
---|
1160 | ' We'll have to make sure mspdbXX.dll is somewhere in the PATH.
|
---|
1161 | '
|
---|
1162 | if (strPathVCCommon <> "") Then
|
---|
1163 | EnvAppend "PATH", ";" & strPathVCCommon & "/IDE"
|
---|
1164 | end if
|
---|
1165 | if Shell(DosSlashes(strPathVC & "/bin/cl.exe"), True) <> 0 then
|
---|
1166 | MsgError "Executing '" & strClExe & "' (which we believe to be the Visual C++ compiler driver) failed."
|
---|
1167 | exit sub
|
---|
1168 | end if
|
---|
1169 |
|
---|
1170 | if (InStr(1, g_strShellOutput, "Version 16.") <= 0) _
|
---|
1171 | And (InStr(1, g_strShellOutput, "Version 17.") <= 0) then
|
---|
1172 | MsgError "The Visual C++ compiler we found ('" & strPathVC & "') isn't 10.0 or 11.0. Check the build requirements."
|
---|
1173 | exit sub
|
---|
1174 | end if
|
---|
1175 |
|
---|
1176 | '
|
---|
1177 | ' Ok, emit build config variables.
|
---|
1178 | '
|
---|
1179 | if InStr(1, g_strShellOutput, "Version 16.") > 0 then
|
---|
1180 | CfgPrint "PATH_TOOL_VCC100 := " & g_strPathVCC
|
---|
1181 | CfgPrint "PATH_TOOL_VCC100X86 := $(PATH_TOOL_VCC100)"
|
---|
1182 | CfgPrint "PATH_TOOL_VCC100AMD64 := $(PATH_TOOL_VCC100)"
|
---|
1183 | CfgPrint "VBOX_WITH_NEW_VCC :="
|
---|
1184 | if LogFileExists(strPathVC, "atlmfc/include/atlbase.h") then
|
---|
1185 | PrintResult "Visual C++ v10 with ATL", g_strPathVCC
|
---|
1186 | elseif LogFileExists(g_strPathDDK, "inc/atl71/atlbase.h") _
|
---|
1187 | And LogFileExists(g_strPathDDK, "lib/ATL/i386/atls.lib") then
|
---|
1188 | CfgPrint "VBOX_WITHOUT_COMPILER_REDIST=1"
|
---|
1189 | CfgPrint "PATH_TOOL_VCC100_ATLMFC_INC = " & g_strPathDDK & "/inc/atl71"
|
---|
1190 | CfgPrint "PATH_TOOL_VCC100_ATLMFC_LIB.amd64 = " & g_strPathDDK & "/lib/ATL/amd64"
|
---|
1191 | CfgPrint "PATH_TOOL_VCC100_ATLMFC_LIB.x86 = " & g_strPathDDK & "/lib/ATL/i386"
|
---|
1192 | CfgPrint "PATH_TOOL_VCC100AMD64_ATLMFC_INC = " & g_strPathDDK & "/inc/atl71"
|
---|
1193 | CfgPrint "PATH_TOOL_VCC100AMD64_ATLMFC_LIB = " & g_strPathDDK & "/lib/ATL/amd64"
|
---|
1194 | CfgPrint "PATH_TOOL_VCC100X86_ATLMFC_INC = " & g_strPathDDK & "/inc/atl71"
|
---|
1195 | CfgPrint "PATH_TOOL_VCC100X86_ATLMFC_LIB = " & g_strPathDDK & "/lib/ATL/i386"
|
---|
1196 | PrintResult "Visual C++ v10 with DDK ATL", g_strPathVCC
|
---|
1197 | else
|
---|
1198 | CfgPrint "VBOX_WITHOUT_COMPILER_REDIST=1"
|
---|
1199 | DisableCOM "No ATL"
|
---|
1200 | PrintResult "Visual C++ v10 (or later) without ATL", g_strPathVCC
|
---|
1201 | end if
|
---|
1202 |
|
---|
1203 | elseif InStr(1, g_strShellOutput, "Version 17.") > 0 then
|
---|
1204 | CfgPrint "PATH_TOOL_VCC110 := " & g_strPathVCC
|
---|
1205 | CfgPrint "PATH_TOOL_VCC110X86 := $(PATH_TOOL_VCC110)"
|
---|
1206 | CfgPrint "PATH_TOOL_VCC110AMD64 := $(PATH_TOOL_VCC110)"
|
---|
1207 | PrintResult "Visual C++ v11", g_strPathVCC
|
---|
1208 | MsgWarning "The support for Visual C++ v11 (aka 2012) is experimental"
|
---|
1209 |
|
---|
1210 | else
|
---|
1211 | MsgError "The Visual C++ compiler we found ('" & strPathVC & "') isn't 10.0 or 11.0. Check the build requirements."
|
---|
1212 | exit sub
|
---|
1213 | end if
|
---|
1214 |
|
---|
1215 | ' and the env.bat path fix.
|
---|
1216 | if strPathVCCommon <> "" then
|
---|
1217 | EnvPrintAppend "PATH", DosSlashes(strPathVCCommon) & "\IDE", ";"
|
---|
1218 | end if
|
---|
1219 | end sub
|
---|
1220 |
|
---|
1221 | ''
|
---|
1222 | ' Checks if the specified path points to a usable PSDK.
|
---|
1223 | function CheckForVisualCPPSub(strPathVC, strPathVCCommon, blnOptVCExpressEdition)
|
---|
1224 | strPathVC = UnixSlashes(PathAbs(strPathVC))
|
---|
1225 | CheckForVisualCPPSub = False
|
---|
1226 | LogPrint "trying: strPathVC=" & strPathVC & " strPathVCCommon=" & strPathVCCommon & " blnOptVCExpressEdition=" & blnOptVCExpressEdition
|
---|
1227 | if LogFileExists(strPathVC, "bin/cl.exe") _
|
---|
1228 | And LogFileExists(strPathVC, "bin/link.exe") _
|
---|
1229 | And LogFileExists(strPathVC, "include/string.h") _
|
---|
1230 | And LogFileExists(strPathVC, "lib/libcmt.lib") _
|
---|
1231 | And LogFileExists(strPathVC, "lib/msvcrt.lib") _
|
---|
1232 | then
|
---|
1233 | if blnOptVCExpressEdition _
|
---|
1234 | Or ( LogFileExists(strPathVC, "atlmfc/include/atlbase.h") _
|
---|
1235 | And LogFileExists(strPathVC, "atlmfc/lib/atls.lib")) _
|
---|
1236 | Or ( LogFileExists(g_strPathDDK, "inc/atl71/atlbase.h") _
|
---|
1237 | And LogFileExists(g_strPathDDK, "lib/ATL/i386/atls.lib")) _
|
---|
1238 | Then
|
---|
1239 | '' @todo figure out a way we can verify the version/build!
|
---|
1240 | CheckForVisualCPPSub = True
|
---|
1241 | end if
|
---|
1242 | end if
|
---|
1243 | end function
|
---|
1244 |
|
---|
1245 |
|
---|
1246 | ''
|
---|
1247 | ' Checks for a platform SDK that works with the compiler
|
---|
1248 | sub CheckForPlatformSDK(strOptSDK)
|
---|
1249 | dim strPathPSDK, str
|
---|
1250 | PrintHdr "Windows Platform SDK (recent)"
|
---|
1251 |
|
---|
1252 | strPathPSDK = ""
|
---|
1253 |
|
---|
1254 | ' Check the supplied argument first.
|
---|
1255 | str = strOptSDK
|
---|
1256 | if str <> "" then
|
---|
1257 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1258 | end if
|
---|
1259 |
|
---|
1260 | ' The tools location (first).
|
---|
1261 | if strPathPSDK = "" And g_blnInternalFirst then
|
---|
1262 | str = g_strPathDev & "/win.x86/sdk/v7.1"
|
---|
1263 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1264 | end if
|
---|
1265 |
|
---|
1266 | if strPathPSDK = "" And g_blnInternalFirst then
|
---|
1267 | str = g_strPathDev & "/win.x86/sdk/v8.0"
|
---|
1268 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1269 | end if
|
---|
1270 |
|
---|
1271 | ' Look for it in the environment
|
---|
1272 | str = EnvGet("MSSdk")
|
---|
1273 | if strPathPSDK = "" And str <> "" then
|
---|
1274 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1275 | end if
|
---|
1276 |
|
---|
1277 | str = EnvGet("Mstools")
|
---|
1278 | if strPathPSDK = "" And str <> "" then
|
---|
1279 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1280 | end if
|
---|
1281 |
|
---|
1282 | ' Check if there is one installed with the compiler.
|
---|
1283 | if strPathPSDK = "" And str <> "" then
|
---|
1284 | str = g_strPathVCC & "/PlatformSDK"
|
---|
1285 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1286 | end if
|
---|
1287 |
|
---|
1288 | ' Check the registry next (ASSUMES sorting).
|
---|
1289 | arrSubKeys = RegEnumSubKeysRSort("HKLM", "SOFTWARE\Microsoft\Microsoft SDKs\Windows")
|
---|
1290 | for each strSubKey in arrSubKeys
|
---|
1291 | str = RegGetString("HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\" & strSubKey & "\InstallationFolder")
|
---|
1292 | if strPathPSDK = "" And str <> "" then
|
---|
1293 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1294 | end if
|
---|
1295 | Next
|
---|
1296 | arrSubKeys = RegEnumSubKeysRSort("HKCU", "SOFTWARE\Microsoft\Microsoft SDKs\Windows")
|
---|
1297 | for each strSubKey in arrSubKeys
|
---|
1298 | str = RegGetString("HKCU\SOFTWARE\Microsoft\Microsoft SDKs\Windows\" & strSubKey & "\InstallationFolder")
|
---|
1299 | if strPathPSDK = "" And str <> "" then
|
---|
1300 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1301 | end if
|
---|
1302 | Next
|
---|
1303 |
|
---|
1304 | ' The tools location (post).
|
---|
1305 | if (strPathPSDK = "") And (g_blnInternalFirst = False) then
|
---|
1306 | str = g_strPathDev & "/win.x86/sdk/v7.1"
|
---|
1307 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1308 | end if
|
---|
1309 |
|
---|
1310 | if (strPathPSDK = "") And (g_blnInternalFirst = False) then
|
---|
1311 | str = g_strPathDev & "/win.x86/sdk/v8.0"
|
---|
1312 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
1313 | end if
|
---|
1314 |
|
---|
1315 | ' Give up.
|
---|
1316 | if strPathPSDK = "" then
|
---|
1317 | MsgError "Cannot find a suitable Platform SDK. Check configure.log and the build requirements."
|
---|
1318 | exit sub
|
---|
1319 | end if
|
---|
1320 |
|
---|
1321 | '
|
---|
1322 | ' Emit the config.
|
---|
1323 | '
|
---|
1324 | strPathPSDK = UnixSlashes(PathAbs(strPathPSDK))
|
---|
1325 | CfgPrint "PATH_SDK_WINPSDK" & g_strVerPSDK & " := " & strPathPSDK
|
---|
1326 | CfgPrint "VBOX_WINPSDK := WINPSDK" & g_strVerPSDK
|
---|
1327 |
|
---|
1328 | PrintResult "Windows Platform SDK (v" & g_strVerPSDK & ")", strPathPSDK
|
---|
1329 | g_strPathPSDK = strPathPSDK
|
---|
1330 | end sub
|
---|
1331 |
|
---|
1332 | ''
|
---|
1333 | ' Checks if the specified path points to a usable PSDK.
|
---|
1334 | function CheckForPlatformSDKSub(strPathPSDK)
|
---|
1335 | CheckForPlatformSDKSub = False
|
---|
1336 | LogPrint "trying: strPathPSDK=" & strPathPSDK
|
---|
1337 | if LogFileExists(strPathPSDK, "include/Windows.h") _
|
---|
1338 | And LogFileExists(strPathPSDK, "lib/Kernel32.Lib") _
|
---|
1339 | And LogFileExists(strPathPSDK, "lib/User32.Lib") _
|
---|
1340 | And LogFileExists(strPathPSDK, "bin/rc.exe") _
|
---|
1341 | And Shell("""" & DosSlashes(strPathPSDK & "/bin/rc.exe") & """" , True) <> 0 _
|
---|
1342 | then
|
---|
1343 | if InStr(1, g_strShellOutput, "Resource Compiler Version 6.2.") > 0 then
|
---|
1344 | g_strVerPSDK = "80"
|
---|
1345 | CheckForPlatformSDKSub = True
|
---|
1346 | elseif InStr(1, g_strShellOutput, "Resource Compiler Version 6.1.") > 0 then
|
---|
1347 | g_strVerPSDK = "71"
|
---|
1348 | CheckForPlatformSDKSub = True
|
---|
1349 | end if
|
---|
1350 | end if
|
---|
1351 | end function
|
---|
1352 |
|
---|
1353 |
|
---|
1354 | ''
|
---|
1355 | ' Checks for a Windows 7 Driver Kit.
|
---|
1356 | sub CheckForWinDDK(strOptDDK)
|
---|
1357 | dim strPathDDK, str, strSubKeys
|
---|
1358 | PrintHdr "Windows DDK v7.1"
|
---|
1359 |
|
---|
1360 | '
|
---|
1361 | ' Find the DDK.
|
---|
1362 | '
|
---|
1363 | strPathDDK = ""
|
---|
1364 | ' The specified path.
|
---|
1365 | if strPathDDK = "" And strOptDDK <> "" then
|
---|
1366 | if CheckForWinDDKSub(strOptDDK, True) then strPathDDK = strOptDDK
|
---|
1367 | end if
|
---|
1368 |
|
---|
1369 | ' The tools location (first).
|
---|
1370 | if strPathDDK = "" And g_blnInternalFirst then
|
---|
1371 | str = g_strPathDev & "/win.x86/ddk/7600.16385.1"
|
---|
1372 | if CheckForWinDDKSub(str, False) then strPathDDK = str
|
---|
1373 | end if
|
---|
1374 |
|
---|
1375 | ' Check the environment
|
---|
1376 | str = EnvGet("DDK_INC_PATH")
|
---|
1377 | if strPathDDK = "" And str <> "" then
|
---|
1378 | str = PathParent(PathParent(str))
|
---|
1379 | if CheckForWinDDKSub(str, True) then strPathDDK = str
|
---|
1380 | end if
|
---|
1381 |
|
---|
1382 | str = EnvGet("BASEDIR")
|
---|
1383 | if strPathDDK = "" And str <> "" then
|
---|
1384 | if CheckForWinDDKSub(str, True) then strPathDDK = str
|
---|
1385 | end if
|
---|
1386 |
|
---|
1387 | ' Some array constants to ease the work.
|
---|
1388 | arrSoftwareKeys = array("SOFTWARE", "SOFTWARE\Wow6432Node")
|
---|
1389 | arrRoots = array("HKLM", "HKCU")
|
---|
1390 |
|
---|
1391 | ' Windows 7 WDK.
|
---|
1392 | arrLocations = array()
|
---|
1393 | for each strSoftwareKey in arrSoftwareKeys
|
---|
1394 | for each strSubKey in RegEnumSubKeysFull("HKLM", strSoftwareKey & "\Microsoft\KitSetup\configured-kits")
|
---|
1395 | for each strSubKey2 in RegEnumSubKeysFull("HKLM", strSubKey)
|
---|
1396 | str = RegGetString("HKLM\" & strSubKey2 & "\setup-install-location")
|
---|
1397 | if str <> "" then
|
---|
1398 | arrLocations = ArrayAppend(arrLocations, PathAbsLong(str))
|
---|
1399 | end if
|
---|
1400 | next
|
---|
1401 | next
|
---|
1402 | next
|
---|
1403 | arrLocations = ArrayRSortStrings(arrLocations)
|
---|
1404 |
|
---|
1405 | ' Check the locations we've gathered.
|
---|
1406 | for each str in arrLocations
|
---|
1407 | if strPathDDK = "" then
|
---|
1408 | if CheckForWinDDKSub(str, True) then strPathDDK = str
|
---|
1409 | end if
|
---|
1410 | next
|
---|
1411 |
|
---|
1412 | ' The tools location (post).
|
---|
1413 | if (strPathDDK = "") And (g_blnInternalFirst = False) then
|
---|
1414 | str = g_strPathDev & "/win.x86/ddk/7600.16385.1"
|
---|
1415 | if CheckForWinDDKSub(str, False) then strPathDDK = str
|
---|
1416 | end if
|
---|
1417 |
|
---|
1418 | ' Give up.
|
---|
1419 | if strPathDDK = "" then
|
---|
1420 | MsgError "Cannot find the Windows DDK v7.1. Check configure.log and the build requirements."
|
---|
1421 | exit sub
|
---|
1422 | end if
|
---|
1423 |
|
---|
1424 | '
|
---|
1425 | ' Emit the config.
|
---|
1426 | '
|
---|
1427 | strPathDDK = UnixSlashes(PathAbs(strPathDDK))
|
---|
1428 | CfgPrint "PATH_SDK_WINDDK71 := " & strPathDDK
|
---|
1429 |
|
---|
1430 | PrintResult "Windows DDK v7.1", strPathDDK
|
---|
1431 | g_strPathDDK = strPathDDK
|
---|
1432 | end sub
|
---|
1433 |
|
---|
1434 | '' Quick check if the DDK is in the specified directory or not.
|
---|
1435 | function CheckForWinDDKSub(strPathDDK, blnCheckBuild)
|
---|
1436 | CheckForWinDDKSub = False
|
---|
1437 | LogPrint "trying: strPathDDK=" & strPathDDK & " blnCheckBuild=" & blnCheckBuild
|
---|
1438 | if LogFileExists(strPathDDK, "inc/api/ntdef.h") _
|
---|
1439 | And LogFileExists(strPathDDK, "lib/win7/i386/int64.lib") _
|
---|
1440 | And LogFileExists(strPathDDK, "lib/wlh/i386/int64.lib") _
|
---|
1441 | And LogFileExists(strPathDDK, "lib/wnet/i386/int64.lib") _
|
---|
1442 | And LogFileExists(strPathDDK, "lib/wxp/i386/int64.lib") _
|
---|
1443 | And Not LogFileExists(strPathDDK, "lib/win8/i386/int64.lib") _
|
---|
1444 | And LogFileExists(strPathDDK, "bin/x86/rc.exe") _
|
---|
1445 | then
|
---|
1446 | if Not blnCheckBuild then
|
---|
1447 | CheckForWinDDKSub = True
|
---|
1448 | '' @todo Find better build check.
|
---|
1449 | elseif Shell("""" & DosSlashes(strPathDDK & "/bin/x86/rc.exe") & """" , True) <> 0 _
|
---|
1450 | And InStr(1, g_strShellOutput, "Resource Compiler Version 6.1.") > 0 then
|
---|
1451 | CheckForWinDDKSub = True
|
---|
1452 | end if
|
---|
1453 | end if
|
---|
1454 | end function
|
---|
1455 |
|
---|
1456 |
|
---|
1457 | ''
|
---|
1458 | ' Finds midl.exe
|
---|
1459 | sub CheckForMidl()
|
---|
1460 | dim strMidl
|
---|
1461 | PrintHdr "Midl.exe"
|
---|
1462 |
|
---|
1463 | ' Skip if no COM/ATL.
|
---|
1464 | if g_blnDisableCOM then
|
---|
1465 | PrintResultMsg "Midl", "Skipped (" & g_strDisableCOM & ")"
|
---|
1466 | exit sub
|
---|
1467 | end if
|
---|
1468 |
|
---|
1469 | if LogFileExists(g_strPathPSDK, "bin/Midl.exe") then
|
---|
1470 | strMidl = g_strPathPSDK & "/bin/Midl.exe"
|
---|
1471 | elseif LogFileExists(g_strPathVCC, "Common7/Tools/Bin/Midl.exe") then
|
---|
1472 | strMidl = g_strPathVCC & "/Common7/Tools/Bin/Midl.exe"
|
---|
1473 | elseif LogFileExists(g_strPathDDK, "bin/x86/Midl.exe") then
|
---|
1474 | strMidl = g_strPathDDK & "/bin/x86/Midl.exe"
|
---|
1475 | elseif LogFileExists(g_strPathDDK, "bin/Midl.exe") then
|
---|
1476 | strMidl = g_strPathDDK & "/bin/Midl.exe"
|
---|
1477 | elseif LogFileExists(g_strPathDev, "win.x86/bin/Midl.exe") then
|
---|
1478 | strMidl = g_strPathDev & "/win.x86/bin/Midl.exe"
|
---|
1479 | else
|
---|
1480 | MsgWarning "Midl.exe not found!"
|
---|
1481 | exit sub
|
---|
1482 | end if
|
---|
1483 |
|
---|
1484 | CfgPrint "VBOX_MAIN_IDL := " & strMidl
|
---|
1485 | PrintResult "Midl.exe", strMidl
|
---|
1486 | end sub
|
---|
1487 |
|
---|
1488 |
|
---|
1489 | ''
|
---|
1490 | ' Checks for any libSDL binaries.
|
---|
1491 | sub CheckForlibSDL(strOptlibSDL)
|
---|
1492 | dim strPathlibSDL, str
|
---|
1493 | PrintHdr "libSDL"
|
---|
1494 |
|
---|
1495 | '
|
---|
1496 | ' Try find some SDL library.
|
---|
1497 | '
|
---|
1498 |
|
---|
1499 | ' First, the specific location.
|
---|
1500 | strPathlibSDL = ""
|
---|
1501 | if (strPathlibSDL = "") And (strOptlibSDL <> "") then
|
---|
1502 | if CheckForlibSDLSub(strOptlibSDL) then strPathlibSDL = strOptlibSDL
|
---|
1503 | end if
|
---|
1504 |
|
---|
1505 | ' The tools location (first).
|
---|
1506 | if (strPathlibSDL = "") And (g_blnInternalFirst = True) Then
|
---|
1507 | str = g_strPathDev & "/win.x86/libsdl/v1.2.11"
|
---|
1508 | if CheckForlibSDLSub(str) then strPathlibSDL = str
|
---|
1509 | end if
|
---|
1510 |
|
---|
1511 | if (strPathlibSDL = "") And (g_blnInternalFirst = True) Then
|
---|
1512 | str = g_strPathDev & "/win.x86/libsdl/v1.2.7-InnoTek"
|
---|
1513 | if CheckForlibSDLSub(str) then strPathlibSDL = str
|
---|
1514 | end if
|
---|
1515 |
|
---|
1516 | ' Poke about in the path.
|
---|
1517 | str = Which("SDLmain.lib")
|
---|
1518 | if (strPathlibSDL = "") And (str <> "") Then
|
---|
1519 | str = PathParent(PathStripFilename(str))
|
---|
1520 | if CheckForlibSDLSub(str) then strPathlibSDL = str
|
---|
1521 | end if
|
---|
1522 |
|
---|
1523 | str = Which("SDL.dll")
|
---|
1524 | if (strPathlibSDL = "") And (str <> "") Then
|
---|
1525 | str = PathParent(PathStripFilename(str))
|
---|
1526 | if CheckForlibSDLSub(str) then strPathlibSDL = str
|
---|
1527 | end if
|
---|
1528 |
|
---|
1529 | ' The tools location (post).
|
---|
1530 | if (strPathlibSDL = "") And (g_blnInternalFirst = False) Then
|
---|
1531 | str = g_strPathDev & "/win.x86/libsdl/v1.2.11"
|
---|
1532 | if CheckForlibSDLSub(str) then strPathlibSDL = str
|
---|
1533 | end if
|
---|
1534 |
|
---|
1535 | if (strPathlibSDL = "") And (g_blnInternalFirst = False) Then
|
---|
1536 | str = g_strPathDev & "/win.x86/libsdl/v1.2.7-InnoTek"
|
---|
1537 | if CheckForlibSDLSub(str) then strPathlibSDL = str
|
---|
1538 | end if
|
---|
1539 |
|
---|
1540 | ' Success?
|
---|
1541 | if strPathlibSDL = "" then
|
---|
1542 | if strOptlibSDL = "" then
|
---|
1543 | MsgError "Can't locate libSDL. Try specify the path with the --with-libSDL=<path> argument. " _
|
---|
1544 | & "If still no luck, consult the configure.log and the build requirements."
|
---|
1545 | else
|
---|
1546 | MsgError "Can't locate libSDL. Please consult the configure.log and the build requirements."
|
---|
1547 | end if
|
---|
1548 | exit sub
|
---|
1549 | end if
|
---|
1550 |
|
---|
1551 | strPathLibSDL = UnixSlashes(PathAbs(strPathLibSDL))
|
---|
1552 | CfgPrint "PATH_SDK_LIBSDL := " & strPathlibSDL
|
---|
1553 |
|
---|
1554 | PrintResult "libSDL", strPathlibSDL
|
---|
1555 | end sub
|
---|
1556 |
|
---|
1557 | ''
|
---|
1558 | ' Checks if the specified path points to an usable libSDL or not.
|
---|
1559 | function CheckForlibSDLSub(strPathlibSDL)
|
---|
1560 | CheckForlibSDLSub = False
|
---|
1561 | LogPrint "trying: strPathlibSDL=" & strPathlibSDL
|
---|
1562 | if LogFileExists(strPathlibSDL, "lib/SDL.lib") _
|
---|
1563 | And LogFileExists(strPathlibSDL, "lib/SDLmain.lib") _
|
---|
1564 | And LogFileExists(strPathlibSDL, "lib/SDL.dll") _
|
---|
1565 | And LogFileExists(strPathlibSDL, "include/SDL.h") _
|
---|
1566 | And LogFileExists(strPathlibSDL, "include/SDL_syswm.h") _
|
---|
1567 | And LogFileExists(strPathlibSDL, "include/SDL_version.h") _
|
---|
1568 | then
|
---|
1569 | CheckForlibSDLSub = True
|
---|
1570 | end if
|
---|
1571 | end function
|
---|
1572 |
|
---|
1573 |
|
---|
1574 | ''
|
---|
1575 | ' Checks for libxml2.
|
---|
1576 | sub CheckForXml2(strOptXml2)
|
---|
1577 | dim strPathXml2, str
|
---|
1578 | PrintHdr "libxml2"
|
---|
1579 |
|
---|
1580 | '
|
---|
1581 | ' Part of tarball / svn, so we can exit immediately if no path was specified.
|
---|
1582 | '
|
---|
1583 | if (strOptXml2 = "") then
|
---|
1584 | PrintResultMsg "libxml2", "src/lib/libxml2-*"
|
---|
1585 | exit sub
|
---|
1586 | end if
|
---|
1587 |
|
---|
1588 | ' Skip if no COM/ATL.
|
---|
1589 | if g_blnDisableCOM then
|
---|
1590 | PrintResultMsg "libxml2", "Skipped (" & g_strDisableCOM & ")"
|
---|
1591 | exit sub
|
---|
1592 | end if
|
---|
1593 |
|
---|
1594 | '
|
---|
1595 | ' Try find some xml2 dll/lib.
|
---|
1596 | '
|
---|
1597 | strPathXml2 = ""
|
---|
1598 | if (strPathXml2 = "") And (strOptXml2 <> "") then
|
---|
1599 | if CheckForXml2Sub(strOptXml2) then strPathXml2 = strOptXml2
|
---|
1600 | end if
|
---|
1601 |
|
---|
1602 | if strPathXml2 = "" Then
|
---|
1603 | str = Which("libxml2.lib")
|
---|
1604 | if str <> "" Then
|
---|
1605 | str = PathParent(PathStripFilename(str))
|
---|
1606 | if CheckForXml2Sub(str) then strPathXml2 = str
|
---|
1607 | end if
|
---|
1608 | end if
|
---|
1609 |
|
---|
1610 | ' Ignore failure if we're in 'internal' mode.
|
---|
1611 | if (strPathXml2 = "") and g_blnInternalMode then
|
---|
1612 | PrintResultMsg "libxml2", "ignored (internal mode)"
|
---|
1613 | exit sub
|
---|
1614 | end if
|
---|
1615 |
|
---|
1616 | ' Success?
|
---|
1617 | if strPathXml2 = "" then
|
---|
1618 | if strOptXml2 = "" then
|
---|
1619 | MsgError "Can't locate libxml2. Try specify the path with the --with-libxml2=<path> argument. " _
|
---|
1620 | & "If still no luck, consult the configure.log and the build requirements."
|
---|
1621 | else
|
---|
1622 | MsgError "Can't locate libxml2. Please consult the configure.log and the build requirements."
|
---|
1623 | end if
|
---|
1624 | exit sub
|
---|
1625 | end if
|
---|
1626 |
|
---|
1627 | strPathXml2 = UnixSlashes(PathAbs(strPathXml2))
|
---|
1628 | CfgPrint "SDK_VBOX_LIBXML2_DEFS := _REENTRANT"
|
---|
1629 | CfgPrint "SDK_VBOX_LIBXML2_INCS := " & strPathXml2 & "/include"
|
---|
1630 | CfgPrint "SDK_VBOX_LIBXML2_LIBS := " & strPathXml2 & "/lib/libxml2.lib"
|
---|
1631 |
|
---|
1632 | PrintResult "libxml2", strPathXml2
|
---|
1633 | end sub
|
---|
1634 |
|
---|
1635 | ''
|
---|
1636 | ' Checks if the specified path points to an usable libxml2 or not.
|
---|
1637 | function CheckForXml2Sub(strPathXml2)
|
---|
1638 | dim str
|
---|
1639 |
|
---|
1640 | CheckForXml2Sub = False
|
---|
1641 | LogPrint "trying: strPathXml2=" & strPathXml2
|
---|
1642 | if LogFileExists(strPathXml2, "include/libxml/xmlexports.h") _
|
---|
1643 | And LogFileExists(strPathXml2, "include/libxml/xmlreader.h") _
|
---|
1644 | then
|
---|
1645 | str = LogFindFile(strPathXml2, "bin/libxml2.dll")
|
---|
1646 | if str <> "" then
|
---|
1647 | if LogFindFile(strPathXml2, "lib/libxml2.lib") <> "" then
|
---|
1648 | CheckForXml2Sub = True
|
---|
1649 | end if
|
---|
1650 | end if
|
---|
1651 | end if
|
---|
1652 | end function
|
---|
1653 |
|
---|
1654 |
|
---|
1655 | ''
|
---|
1656 | ' Checks for openssl
|
---|
1657 | sub CheckForSsl(strOptSsl, bln32Bit)
|
---|
1658 | dim strPathSsl, str
|
---|
1659 | PrintHdr "openssl"
|
---|
1660 |
|
---|
1661 | strOpenssl = "openssl"
|
---|
1662 | if bln32Bit = True then
|
---|
1663 | strOpenssl = "openssl32"
|
---|
1664 | end if
|
---|
1665 |
|
---|
1666 | '
|
---|
1667 | ' Part of tarball / svn, so we can exit immediately if no path was specified.
|
---|
1668 | '
|
---|
1669 | if (strOptSsl = "") then
|
---|
1670 | PrintResult strOpenssl, "src/libs/openssl-*"
|
---|
1671 | exit sub
|
---|
1672 | end if
|
---|
1673 |
|
---|
1674 | '
|
---|
1675 | ' Try find some openssl dll/lib.
|
---|
1676 | '
|
---|
1677 | strPathSsl = ""
|
---|
1678 | if (strPathSsl = "") And (strOptSsl <> "") then
|
---|
1679 | if CheckForSslSub(strOptSsl) then strPathSsl = strOptSsl
|
---|
1680 | end if
|
---|
1681 |
|
---|
1682 | if strPathSsl = "" Then
|
---|
1683 | str = Which("libssl.lib")
|
---|
1684 | if str <> "" Then
|
---|
1685 | str = PathParent(PathStripFilename(str))
|
---|
1686 | if CheckForSslSub(str) then strPathSsl = str
|
---|
1687 | end if
|
---|
1688 | end if
|
---|
1689 |
|
---|
1690 | ' Ignore failure if we're in 'internal' mode.
|
---|
1691 | if (strPathSsl = "") and g_blnInternalMode then
|
---|
1692 | PrintResultMsg strOpenssl, "ignored (internal mode)"
|
---|
1693 | exit sub
|
---|
1694 | end if
|
---|
1695 |
|
---|
1696 | ' Success?
|
---|
1697 | if strPathSsl = "" then
|
---|
1698 | if strOptSsl = "" then
|
---|
1699 | MsgError "Can't locate " & strOpenssl & ". " _
|
---|
1700 | & "Try specify the path with the --with-" & strOpenssl & "=<path> argument. " _
|
---|
1701 | & "If still no luck, consult the configure.log and the build requirements."
|
---|
1702 | else
|
---|
1703 | MsgError "Can't locate " & strOpenssl & ". " _
|
---|
1704 | & "Please consult the configure.log and the build requirements."
|
---|
1705 | end if
|
---|
1706 | exit sub
|
---|
1707 | end if
|
---|
1708 |
|
---|
1709 | strPathSsl = UnixSlashes(PathAbs(strPathSsl))
|
---|
1710 | if bln32Bit = True then
|
---|
1711 | CfgPrint "SDK_VBOX_OPENSSL-x86_INCS := " & strPathSsl & "/include"
|
---|
1712 | CfgPrint "SDK_VBOX_OPENSSL-x86_LIBS := " & strPathSsl & "/lib/libcrypto.lib" & " " & strPathSsl & "/lib/libssl.lib"
|
---|
1713 | CfgPrint "SDK_VBOX_BLD_OPENSSL-x86_LIBS := " & strPathSsl & "/lib/libcrypto.lib" & " " & strPathSsl & "/lib/libssl.lib"
|
---|
1714 | else
|
---|
1715 | CfgPrint "SDK_VBOX_OPENSSL_INCS := " & strPathSsl & "/include"
|
---|
1716 | CfgPrint "SDK_VBOX_OPENSSL_LIBS := " & strPathSsl & "/lib/libcrypto.lib" & " " & strPathSsl & "/lib/libssl.lib"
|
---|
1717 | CfgPrint "SDK_VBOX_BLD_OPENSSL_LIBS := " & strPathSsl & "/lib/libcrypto.lib" & " " & strPathSsl & "/lib/libssl.lib"
|
---|
1718 | end if
|
---|
1719 |
|
---|
1720 | PrintResult strOpenssl, strPathSsl
|
---|
1721 | end sub
|
---|
1722 |
|
---|
1723 | ''
|
---|
1724 | ' Checks if the specified path points to an usable openssl or not.
|
---|
1725 | function CheckForSslSub(strPathSsl)
|
---|
1726 |
|
---|
1727 | CheckForSslSub = False
|
---|
1728 | LogPrint "trying: strPathSsl=" & strPathSsl
|
---|
1729 | if LogFileExists(strPathSsl, "include/openssl/md5.h") _
|
---|
1730 | And LogFindFile(strPathSsl, "lib/libssl.lib") <> "" _
|
---|
1731 | then
|
---|
1732 | CheckForSslSub = True
|
---|
1733 | end if
|
---|
1734 | end function
|
---|
1735 |
|
---|
1736 |
|
---|
1737 | ''
|
---|
1738 | ' Checks for libcurl
|
---|
1739 | sub CheckForCurl(strOptCurl, bln32Bit)
|
---|
1740 | dim strPathCurl, str
|
---|
1741 | PrintHdr "libcurl"
|
---|
1742 |
|
---|
1743 | strCurl = "libcurl"
|
---|
1744 | if bln32Bit = True then
|
---|
1745 | strCurl = "libcurl32"
|
---|
1746 | end if
|
---|
1747 |
|
---|
1748 | '
|
---|
1749 | ' Part of tarball / svn, so we can exit immediately if no path was specified.
|
---|
1750 | '
|
---|
1751 | if (strOptCurl = "") then
|
---|
1752 | PrintResult strCurl, "src/libs/curl-*"
|
---|
1753 | exit sub
|
---|
1754 | end if
|
---|
1755 |
|
---|
1756 | '
|
---|
1757 | ' Try find some cURL dll/lib.
|
---|
1758 | '
|
---|
1759 | strPathCurl = ""
|
---|
1760 | if (strPathCurl = "") And (strOptCurl <> "") then
|
---|
1761 | if CheckForCurlSub(strOptCurl) then strPathCurl = strOptCurl
|
---|
1762 | end if
|
---|
1763 |
|
---|
1764 | if strPathCurl = "" Then
|
---|
1765 | str = Which("libcurl.lib")
|
---|
1766 | if str <> "" Then
|
---|
1767 | str = PathParent(PathStripFilename(str))
|
---|
1768 | if CheckForCurlSub(str) then strPathCurl = str
|
---|
1769 | end if
|
---|
1770 | end if
|
---|
1771 |
|
---|
1772 | ' Ignore failure if we're in 'internal' mode.
|
---|
1773 | if (strPathCurl = "") and g_blnInternalMode then
|
---|
1774 | PrintResultMsg strCurl, "ignored (internal mode)"
|
---|
1775 | exit sub
|
---|
1776 | end if
|
---|
1777 |
|
---|
1778 | ' Success?
|
---|
1779 | if strPathCurl = "" then
|
---|
1780 | if strOptCurl = "" then
|
---|
1781 | MsgError "Can't locate " & strCurl & ". " _
|
---|
1782 | & "Try specify the path with the --with-" & strCurl & "=<path> argument. " _
|
---|
1783 | & "If still no luck, consult the configure.log and the build requirements."
|
---|
1784 | else
|
---|
1785 | MsgError "Can't locate " & strCurl & ". " _
|
---|
1786 | & "Please consult the configure.log and the build requirements."
|
---|
1787 | end if
|
---|
1788 | exit sub
|
---|
1789 | end if
|
---|
1790 |
|
---|
1791 | strPathCurl = UnixSlashes(PathAbs(strPathCurl))
|
---|
1792 | if bln32Bit = True then
|
---|
1793 | CfgPrint "SDK_VBOX_LIBCURL-x86_INCS := " & strPathCurl & "/include"
|
---|
1794 | CfgPrint "SDK_VBOX_LIBCURL-x86_LIBS.x86 := " & strPathCurl & "/libcurl.lib"
|
---|
1795 | else
|
---|
1796 | CfgPrint "SDK_VBOX_LIBCURL_INCS := " & strPathCurl & "/include"
|
---|
1797 | CfgPrint "SDK_VBOX_LIBCURL_LIBS := " & strPathCurl & "/libcurl.lib"
|
---|
1798 | end if
|
---|
1799 |
|
---|
1800 | PrintResult strCurl, strPathCurl
|
---|
1801 | end sub
|
---|
1802 |
|
---|
1803 | ''
|
---|
1804 | ' Checks if the specified path points to an usable libcurl or not.
|
---|
1805 | function CheckForCurlSub(strPathCurl)
|
---|
1806 |
|
---|
1807 | CheckForCurlSub = False
|
---|
1808 | LogPrint "trying: strPathCurl=" & strPathCurl
|
---|
1809 | if LogFileExists(strPathCurl, "include/curl/curl.h") _
|
---|
1810 | And LogFindFile(strPathCurl, "libcurl.dll") <> "" _
|
---|
1811 | And LogFindFile(strPathCurl, "libcurl.lib") <> "" _
|
---|
1812 | then
|
---|
1813 | CheckForCurlSub = True
|
---|
1814 | end if
|
---|
1815 | end function
|
---|
1816 |
|
---|
1817 |
|
---|
1818 |
|
---|
1819 | ''
|
---|
1820 | ' Checks for any Qt5 binaries.
|
---|
1821 | sub CheckForQt(strOptQt5)
|
---|
1822 | PrintHdr "Qt5"
|
---|
1823 |
|
---|
1824 | '
|
---|
1825 | ' Try to find the Qt5 installation (user specified path with --with-qt5)
|
---|
1826 | '
|
---|
1827 | strPathQt5 = ""
|
---|
1828 |
|
---|
1829 | LogPrint "Checking for user specified path of Qt5 ... "
|
---|
1830 | if (strPathQt5 = "") And (strOptQt5 <> "") then
|
---|
1831 | strOptQt5 = UnixSlashes(strOptQt5)
|
---|
1832 | if CheckForQt5Sub(strOptQt5) then strPathQt5 = strOptQt5
|
---|
1833 | end if
|
---|
1834 |
|
---|
1835 | ' Check the dev tools
|
---|
1836 | if (strPathQt5 = "") Then
|
---|
1837 | strPathQt5 = g_strPathDev & "/win." & g_strTargetArch & "/qt/v5.5.1-r138"
|
---|
1838 | if CheckForQt5Sub(strPathQt5) = False then strPathQt5 = ""
|
---|
1839 | end if
|
---|
1840 |
|
---|
1841 | ' Display the result.
|
---|
1842 | if strPathQt5 = "" then
|
---|
1843 | PrintResultMsg "Qt5", "not found"
|
---|
1844 | else
|
---|
1845 | PrintResult "Qt5", strPathQt5
|
---|
1846 | end if
|
---|
1847 |
|
---|
1848 | if strPathQt5 <> "" then
|
---|
1849 | CfgPrint "PATH_SDK_QT5 := " & strPathQt5
|
---|
1850 | CfgPrint "PATH_TOOL_QT5 := $(PATH_SDK_QT5)"
|
---|
1851 | CfgPrint "VBOX_PATH_QT := $(PATH_SDK_QT5)"
|
---|
1852 | end if
|
---|
1853 | if strPathQt5 = "" then
|
---|
1854 | CfgPrint "VBOX_WITH_QTGUI :="
|
---|
1855 | end if
|
---|
1856 | end sub
|
---|
1857 |
|
---|
1858 |
|
---|
1859 | ''
|
---|
1860 | ' Checks if the specified path points to an usable Qt5 library.
|
---|
1861 | function CheckForQt5Sub(strPathQt5)
|
---|
1862 |
|
---|
1863 | CheckForQt5Sub = False
|
---|
1864 | LogPrint "trying: strPathQt5=" & strPathQt5
|
---|
1865 |
|
---|
1866 | if LogFileExists(strPathQt5, "bin/moc.exe") _
|
---|
1867 | And LogFileExists(strPathQt5, "bin/uic.exe") _
|
---|
1868 | And LogFileExists(strPathQt5, "include/QtWidgets/qwidget.h") _
|
---|
1869 | And LogFileExists(strPathQt5, "include/QtWidgets/QApplication") _
|
---|
1870 | And LogFileExists(strPathQt5, "include/QtGui/QImage") _
|
---|
1871 | And LogFileExists(strPathQt5, "include/QtNetwork/QHostAddress") _
|
---|
1872 | And ( LogFileExists(strPathQt5, "lib/Qt5Core.lib") _
|
---|
1873 | Or LogFileExists(strPathQt5, "lib/Qt5CoreVBox.lib")) _
|
---|
1874 | And ( LogFileExists(strPathQt5, "lib/Qt5Network.lib") _
|
---|
1875 | Or LogFileExists(strPathQt5, "lib/Qt5NetworkVBox.lib")) _
|
---|
1876 | then
|
---|
1877 | CheckForQt5Sub = True
|
---|
1878 | end if
|
---|
1879 |
|
---|
1880 | end function
|
---|
1881 |
|
---|
1882 |
|
---|
1883 | '
|
---|
1884 | '
|
---|
1885 | function CheckForPython(strPathPython)
|
---|
1886 |
|
---|
1887 | PrintHdr "Python"
|
---|
1888 |
|
---|
1889 | CheckForPython = False
|
---|
1890 | LogPrint "trying: strPathPython=" & strPathPython
|
---|
1891 |
|
---|
1892 | if LogFileExists(strPathPython, "python.exe") then
|
---|
1893 | CfgPrint "VBOX_BLD_PYTHON := " & strPathPython & "\python.exe"
|
---|
1894 | CheckForPython = True
|
---|
1895 | end if
|
---|
1896 |
|
---|
1897 | PrintResult "Python ", strPathPython
|
---|
1898 | end function
|
---|
1899 |
|
---|
1900 |
|
---|
1901 | ''
|
---|
1902 | ' Show usage.
|
---|
1903 | sub usage
|
---|
1904 | Print "Usage: cscript configure.vbs [options]"
|
---|
1905 | Print ""
|
---|
1906 | Print "Configuration:"
|
---|
1907 | Print " -h, --help"
|
---|
1908 | Print " --internal"
|
---|
1909 | Print " --internal-last"
|
---|
1910 | Print " --target-arch=x86|amd64"
|
---|
1911 | Print ""
|
---|
1912 | Print "Components:"
|
---|
1913 | Print " --disable-COM"
|
---|
1914 | Print " --disable-UDPTunnel"
|
---|
1915 | Print " --disable-SDL"
|
---|
1916 | Print ""
|
---|
1917 | Print "Locations:"
|
---|
1918 | Print " --with-kBuild=PATH "
|
---|
1919 | Print " --with-libSDL=PATH "
|
---|
1920 | Print " --with-Qt5=PATH "
|
---|
1921 | Print " --with-DDK=PATH "
|
---|
1922 | Print " --with-SDK=PATH "
|
---|
1923 | Print " --with-VC=PATH "
|
---|
1924 | Print " --with-VC-Common=PATH "
|
---|
1925 | Print " --with-VC-Express-Edition"
|
---|
1926 | Print " --with-W32API=PATH "
|
---|
1927 | Print " --with-libxml2=PATH "
|
---|
1928 | Print " --with-openssl=PATH "
|
---|
1929 | Print " --with-openssl32=PATH (only for 64-bit targets)"
|
---|
1930 | Print " --with-libcurl=PATH "
|
---|
1931 | Print " --with-libcurl32=PATH (only for 64-bit targets)"
|
---|
1932 | Print " --with-python=PATH "
|
---|
1933 | end sub
|
---|
1934 |
|
---|
1935 |
|
---|
1936 | ''
|
---|
1937 | ' The main() like function.
|
---|
1938 | '
|
---|
1939 | Sub Main
|
---|
1940 | '
|
---|
1941 | ' Write the log header and check that we're not using wscript.
|
---|
1942 | '
|
---|
1943 | LogInit
|
---|
1944 | If UCase(Right(Wscript.FullName, 11)) = "WSCRIPT.EXE" Then
|
---|
1945 | Wscript.Echo "This script must be run under CScript."
|
---|
1946 | Wscript.Quit(1)
|
---|
1947 | End If
|
---|
1948 |
|
---|
1949 | '
|
---|
1950 | ' Parse arguments.
|
---|
1951 | '
|
---|
1952 | strOptDDK = ""
|
---|
1953 | strOptDXDDK = ""
|
---|
1954 | strOptkBuild = ""
|
---|
1955 | strOptlibSDL = ""
|
---|
1956 | strOptQt5 = ""
|
---|
1957 | strOptSDK = ""
|
---|
1958 | strOptVC = ""
|
---|
1959 | strOptVCCommon = ""
|
---|
1960 | blnOptVCExpressEdition = False
|
---|
1961 | strOptW32API = ""
|
---|
1962 | strOptXml2 = ""
|
---|
1963 | strOptSsl = ""
|
---|
1964 | strOptSsl32 = ""
|
---|
1965 | strOptCurl = ""
|
---|
1966 | strOptCurl32 = ""
|
---|
1967 | strOptPython = ""
|
---|
1968 | blnOptDisableCOM = False
|
---|
1969 | blnOptDisableUDPTunnel = False
|
---|
1970 | blnOptDisableSDL = False
|
---|
1971 | for i = 1 to Wscript.Arguments.Count
|
---|
1972 | dim str, strArg, strPath
|
---|
1973 |
|
---|
1974 | ' Separate argument and path value
|
---|
1975 | str = Wscript.Arguments.item(i - 1)
|
---|
1976 | if InStr(1, str, "=") > 0 then
|
---|
1977 | strArg = Mid(str, 1, InStr(1, str, "=") - 1)
|
---|
1978 | strPath = Mid(str, InStr(1, str, "=") + 1)
|
---|
1979 | if strPath = "" then MsgFatal "Syntax error! Argument #" & i & " is missing the path."
|
---|
1980 | else
|
---|
1981 | strArg = str
|
---|
1982 | strPath = ""
|
---|
1983 | end if
|
---|
1984 |
|
---|
1985 | ' Process the argument
|
---|
1986 | select case LCase(strArg)
|
---|
1987 | case "--with-ddk"
|
---|
1988 | strOptDDK = strPath
|
---|
1989 | case "--with-dxsdk"
|
---|
1990 | MsgWarning "Ignoring --with-dxsdk (the DirectX SDK is no longer required)."
|
---|
1991 | case "--with-kbuild"
|
---|
1992 | strOptkBuild = strPath
|
---|
1993 | case "--with-libsdl"
|
---|
1994 | strOptlibSDL = strPath
|
---|
1995 | case "--with-mingw32"
|
---|
1996 | ' ignore
|
---|
1997 | case "--with-mingw-w64"
|
---|
1998 | ' ignore
|
---|
1999 | case "--with-qt5"
|
---|
2000 | strOptQt5 = strPath
|
---|
2001 | case "--with-sdk"
|
---|
2002 | strOptSDK = strPath
|
---|
2003 | case "--with-vc"
|
---|
2004 | strOptVC = strPath
|
---|
2005 | case "--with-vc-common"
|
---|
2006 | strOptVCCommon = strPath
|
---|
2007 | case "--with-vc-express-edition"
|
---|
2008 | blnOptVCExpressEdition = True
|
---|
2009 | case "--with-w32api"
|
---|
2010 | strOptW32API = strPath
|
---|
2011 | case "--with-libxml2"
|
---|
2012 | strOptXml2 = strPath
|
---|
2013 | case "--with-openssl"
|
---|
2014 | strOptSsl = strPath
|
---|
2015 | case "--with-openssl32"
|
---|
2016 | strOptSsl32 = strPath
|
---|
2017 | case "--with-libcurl"
|
---|
2018 | strOptCurl = strPath
|
---|
2019 | case "--with-libcurl32"
|
---|
2020 | strOptCurl32 = strPath
|
---|
2021 | case "--with-python"
|
---|
2022 | strOptPython = strPath
|
---|
2023 | case "--disable-com"
|
---|
2024 | blnOptDisableCOM = True
|
---|
2025 | case "--enable-com"
|
---|
2026 | blnOptDisableCOM = False
|
---|
2027 | case "--disable-udptunnel"
|
---|
2028 | blnOptDisableUDPTunnel = True
|
---|
2029 | case "--disable-sdl"
|
---|
2030 | blnOptDisableSDL = True
|
---|
2031 | case "--internal"
|
---|
2032 | g_blnInternalMode = True
|
---|
2033 | case "--internal-last"
|
---|
2034 | g_blnInternalFirst = False
|
---|
2035 | case "--target-arch"
|
---|
2036 | g_strTargetArch = strPath
|
---|
2037 | case "-h", "--help", "-?"
|
---|
2038 | usage
|
---|
2039 | Wscript.Quit(0)
|
---|
2040 | case else
|
---|
2041 | Wscript.echo "syntax error: Unknown option '" & str &"'."
|
---|
2042 | usage
|
---|
2043 | Wscript.Quit(1)
|
---|
2044 | end select
|
---|
2045 | next
|
---|
2046 |
|
---|
2047 | '
|
---|
2048 | ' Initialize output files.
|
---|
2049 | '
|
---|
2050 | CfgInit
|
---|
2051 | EnvInit
|
---|
2052 |
|
---|
2053 | '
|
---|
2054 | ' Check that the Shell function is sane.
|
---|
2055 | '
|
---|
2056 | g_objShell.Environment("PROCESS")("TESTING_ENVIRONMENT_INHERITANCE") = "This works"
|
---|
2057 | if Shell("set TESTING_ENVIRONMENT_INHERITANC", False) <> 0 then ' The 'E' is missing on purpose (4nt).
|
---|
2058 | MsgFatal "shell execution test failed!"
|
---|
2059 | end if
|
---|
2060 | if g_strShellOutput <> "TESTING_ENVIRONMENT_INHERITANCE=This works" & CHR(13) & CHR(10) then
|
---|
2061 | Print "Shell test Test -> '" & g_strShellOutput & "'"
|
---|
2062 | MsgFatal "shell inheritance or shell execution isn't working right. Make sure you use cmd.exe."
|
---|
2063 | end if
|
---|
2064 | g_objShell.Environment("PROCESS")("TESTING_ENVIRONMENT_INHERITANCE") = ""
|
---|
2065 | Print "Shell inheritance test: OK"
|
---|
2066 |
|
---|
2067 | '
|
---|
2068 | ' Do the checks.
|
---|
2069 | '
|
---|
2070 | if blnOptDisableCOM = True then
|
---|
2071 | DisableCOM "--disable-com"
|
---|
2072 | end if
|
---|
2073 | if blnOptDisableUDPTunnel = True then
|
---|
2074 | DisableUDPTunnel "--disable-udptunnel"
|
---|
2075 | end if
|
---|
2076 | CheckSourcePath
|
---|
2077 | CheckForkBuild strOptkBuild
|
---|
2078 | CheckForWinDDK strOptDDK
|
---|
2079 | CheckForVisualCPP strOptVC, strOptVCCommon, blnOptVCExpressEdition
|
---|
2080 | CheckForPlatformSDK strOptSDK
|
---|
2081 | CheckForMidl
|
---|
2082 | CfgPrint "VBOX_WITH_OPEN_WATCOM := " '' @todo look for openwatcom 1.9+
|
---|
2083 | CfgPrint "VBOX_WITH_LIBVPX := " '' @todo look for libvpx 1.1.0+
|
---|
2084 | CfgPrint "VBOX_WITH_LIBOPUS := " '' @todo look for libopus 1.2.1+
|
---|
2085 |
|
---|
2086 | EnvPrintAppend "PATH", DosSlashes(g_strPath & "\tools\win." & g_strHostArch & "\bin"), ";" '' @todo look for yasm
|
---|
2087 | if g_strHostArch = "amd64" then
|
---|
2088 | EnvPrintAppend "PATH", DosSlashes(g_strPath & "\tools\win.x86\bin"), ";"
|
---|
2089 | else
|
---|
2090 | EnvPrintCleanup "PATH", DosSlashes(g_strPath & "\tools\win.amd64\bin"), ";"
|
---|
2091 | end if
|
---|
2092 | if blnOptDisableSDL = True then
|
---|
2093 | DisableSDL "--disable-sdl"
|
---|
2094 | else
|
---|
2095 | CheckForlibSDL strOptlibSDL
|
---|
2096 | end if
|
---|
2097 | CheckForXml2 strOptXml2
|
---|
2098 | CheckForSsl strOptSsl, False
|
---|
2099 | if g_strTargetArch = "amd64" then
|
---|
2100 | ' 32-bit openssl required as well
|
---|
2101 | CheckForSsl strOptSsl32, True
|
---|
2102 | end if
|
---|
2103 | CheckForCurl strOptCurl, False
|
---|
2104 | if g_strTargetArch = "amd64" then
|
---|
2105 | ' 32-bit Curl required as well
|
---|
2106 | CheckForCurl strOptCurl32, True
|
---|
2107 | end if
|
---|
2108 | CheckForQt strOptQt5
|
---|
2109 | if (strOptPython <> "") then
|
---|
2110 | CheckForPython strOptPython
|
---|
2111 | end if
|
---|
2112 | if g_blnInternalMode then
|
---|
2113 | EnvPrint "call " & g_strPathDev & "/env.cmd %1 %2 %3 %4 %5 %6 %7 %8 %9"
|
---|
2114 | end if
|
---|
2115 |
|
---|
2116 | Print ""
|
---|
2117 | Print "Execute env.bat once before you start to build VBox:"
|
---|
2118 | Print ""
|
---|
2119 | Print " env.bat"
|
---|
2120 | Print " kmk"
|
---|
2121 | Print ""
|
---|
2122 |
|
---|
2123 | End Sub
|
---|
2124 |
|
---|
2125 |
|
---|
2126 | Main
|
---|
2127 |
|
---|