VirtualBox

source: vbox/trunk/configure.vbs@ 104735

Last change on this file since 104735 was 101256, checked in by vboxsync, 14 months ago

configure.vbs: bugref:10450: Tweaking Qt6 support for configure script for Windows.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Id
File size: 85.1 KB
Line 
1' $Id: configure.vbs 101256 2023-09-25 16:45:59Z 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-2023 Oracle and/or its affiliates.
13'
14' This file is part of VirtualBox base platform packages, as
15' available from https://www.virtualbox.org.
16'
17' This program is free software; you can redistribute it and/or
18' modify it under the terms of the GNU General Public License
19' as published by the Free Software Foundation, in version 3 of the
20' License.
21'
22' This program is distributed in the hope that it will be useful, but
23' WITHOUT ANY WARRANTY; without even the implied warranty of
24' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25' General Public License for more details.
26'
27' You should have received a copy of the GNU General Public License
28' along with this program; if not, see <https://www.gnu.org/licenses>.
29'
30' SPDX-License-Identifier: GPL-3.0-only
31'
32
33
34''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
35' Header Files
36''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
37
38''
39' Includes a vbscript file relative to the script.
40sub IncludeFile(strFilename)
41 dim objFile, objFileSys
42 set objFileSys = WScript.CreateObject("Scripting.FileSystemObject")
43 dim strPath : strPath = objFileSys.BuildPath(objFileSys.GetParentFolderName(Wscript.ScriptFullName), strFilename)
44 set objFile = objFileSys.openTextFile(strPath)
45 executeglobal objFile.readAll()
46 objFile.close
47 set objFileSys = nothing
48end sub
49
50IncludeFile "tools\win\vbscript\helpers.vbs"
51
52
53''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
54' Global Variables '
55''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
56dim g_strPath, g_strEnvFile, g_strLogFile, g_strCfgFile
57g_strPath = Left(Wscript.ScriptFullName, Len(Wscript.ScriptFullName) - Len("\configure.vbs"))
58g_strEnvFile = g_strPath & "\env.bat"
59g_strCfgFile = g_strPath & "\AutoConfig.kmk"
60g_strLogFile = g_strPath & "\configure.log"
61'g_strTmpFile = g_strPath & "\configure.tmp"
62
63
64' kBuild stuff.
65dim g_strPathkBuild, g_strPathkBuildBin, g_strPathDev, g_arrPathDev
66g_strPathkBuild = ""
67g_strPathkBuildBin = ""
68g_strPathDev = ""
69g_arrPathDev = Array(":placeholder:")
70
71dim g_strTargetArch, g_StrTargetArchWin
72g_strTargetArch = ""
73g_StrTargetArchWin = ""
74
75dim g_strHostArch, g_strHostArchWin
76g_strHostArch = ""
77g_strHostArchWin = ""
78
79' Visual C++ info.
80dim g_strPathVCC, g_strVCCVersion
81g_strPathVCC = ""
82g_strVCCVersion = ""
83
84' SDK and DDK.
85dim g_strPathSDK10, g_strPathPSDK, g_strVerPSDK, g_strPathDDK
86g_strPathSDK10 = ""
87g_strPathPSDK = ""
88g_strVerPSDK = ""
89g_strPathDDK = ""
90
91' COM disabling.
92dim g_blnDisableCOM, g_strDisableCOM
93g_blnDisableCOM = False
94g_strDisableCOM = ""
95
96' Whether to try the internal stuff first or last.
97dim g_blnInternalFirst
98g_blnInternalFirst = True
99
100' List of program files locations.
101dim g_arrProgramFiles
102if EnvGet("ProgramFiles(x86)") <> "" then
103 g_arrProgramFiles = Array(EnvGet("ProgramFiles"), EnvGet("ProgramFiles(x86)"))
104else
105 g_arrProgramFiles = Array(EnvGet("ProgramFiles"))
106end if
107
108
109
110''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
111' Helpers: Logging and Logged operations '
112''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
113
114''
115' Write a log header with some basic info.
116sub LogInit
117 FileDelete g_strLogFile
118 LogPrint "# Log file generated by " & Wscript.ScriptFullName
119 for i = 1 to WScript.Arguments.Count
120 LogPrint "# Arg #" & i & ": " & WScript.Arguments.Item(i - 1)
121 next
122 if Wscript.Arguments.Count = 0 then
123 LogPrint "# No arguments given"
124 end if
125 LogPrint "# Reconstructed command line: " & GetCommandline()
126
127 ' some Wscript stuff
128 LogPrint "# Wscript properties:"
129 LogPrint "# ScriptName: " & Wscript.ScriptName
130 LogPrint "# Version: " & Wscript.Version
131 LogPrint "# Build: " & Wscript.BuildVersion
132 LogPrint "# Name: " & Wscript.Name
133 LogPrint "# Full Name: " & Wscript.FullName
134 LogPrint "# Path: " & Wscript.Path
135 LogPrint "#"
136
137
138 ' the environment
139 LogPrint "# Environment:"
140 dim objEnv
141 for each strVar in g_objShell.Environment("PROCESS")
142 LogPrint "# " & strVar
143 next
144 LogPrint "#"
145end sub
146
147
148''
149' Append text to the log file.
150sub LogPrint(str)
151 FileAppendLine g_strLogFile, str
152 'Wscript.Echo "dbg: " & str
153end sub
154
155''
156' Debug output.
157sub DbgPrint(str)
158 'FileAppendLine g_strLogFile, str
159 'Wscript.Echo "dbg: " & str
160end sub
161
162
163''
164' Checks if the file exists and logs failures.
165function LogFileExists(strPath, strFilename)
166 LogFileExists = FileExists(strPath & "/" & strFilename)
167 if LogFileExists = False then
168 LogPrint "Testing '" & strPath & "': " & strFilename & " not found"
169 end if
170end function
171
172
173''
174' Checks if the file exists and logs failures.
175function LogFileExists1(strPath)
176 LogFileExists1 = FileExists(strPath)
177 if LogFileExists1 = False then
178 LogPrint "Testing '" & strPath & "': file not found"
179 end if
180end function
181
182
183''
184' Checks if the directory exists and logs failures.
185function LogDirExists(strPath)
186 LogDirExists = DirExists(strPath)
187 if LogDirExists = False then
188 LogPrint "Testing '" & strPath & "': not found (or not dir)"
189 end if
190end function
191
192
193''
194' Finds the first file matching the pattern.
195' If no file is found, log the failure.
196function LogFindFile(strPath, strPattern)
197 dim str, strOutput
198
199 '
200 ' Yes, there are some facy database kinda interface to the filesystem
201 ' however, breaking down the path and constructing a usable query is
202 ' too much hassle. So, we'll do it the unix way...
203 '
204 if Shell("dir /B """ & DosSlashes(strPath) & "\" & DosSlashes(strPattern) & """", True, strOutput) = 0 _
205 And InStr(1, strOutput, Chr(13)) > 1 _
206 then
207 ' return the first word.
208 LogFindFile = Left(strOutput, InStr(1, strOutput, Chr(13)) - 1)
209 else
210 LogPrint "Testing '" & strPath & "': " & strPattern & " not found"
211 LogFindFile = ""
212 end if
213end function
214
215
216''
217' Finds the first directory matching the pattern.
218' If no directory is found, log the failure,
219' else return the complete path to the found directory.
220function LogFindDir(strPath, strPattern)
221 dim str, strOutput
222
223 '
224 ' Yes, there are some facy database kinda interface to the filesystem
225 ' however, breaking down the path and constructing a usable query is
226 ' too much hassle. So, we'll do it the unix way...
227 '
228
229 ' List the alphabetically last names as first entries (with /O-N).
230 if Shell("dir /B /AD /O-N """ & DosSlashes(strPath) & "\" & DosSlashes(strPattern) & """", True, strOutput) = 0 _
231 And InStr(1, strOutput, Chr(13)) > 1 _
232 then
233 ' return the first word.
234 LogFindDir = strPath & "/" & Left(strOutput, InStr(1, strOutput, Chr(13)) - 1)
235 else
236 LogPrint "Testing '" & strPath & "': " & strPattern & " not found"
237 LogFindDir = ""
238 end if
239end function
240
241
242''
243' Wrapper around RegGetString that logs successes.
244function LogRegGetString(strName)
245 LogRegGetString = RegGetString(strName)
246 if LogRegGetString <> "" then LogPrint "RegGetString(" & strName & ") -> " & LogRegGetString
247end function
248
249
250''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
251' Helpers: Configuration and Batch Script Writers '
252''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
253
254''
255' Initializes the config file.
256sub CfgInit
257 FileDelete g_strCfgFile
258 CfgPrint "# -*- Makefile -*-"
259 CfgPrint "#"
260 CfgPrint "# Build configuration generated by " & GetCommandline()
261 CfgPrint "#"
262 CfgPrintAssign "VBOX_OSE", "1"
263 CfgPrintAssignRecursive "VBOX_VCC_WERR", "$(NO_SUCH_VARIABLE)"
264end sub
265
266
267''
268' Prints a string to the config file.
269sub CfgPrint(str)
270 FileAppendLine g_strCfgFile, str
271end sub
272
273''
274' Prints a simple assignment to the config file.
275sub CfgPrintAssign(strVar, strValue)
276 if strValue = "" then
277 FileAppendLine g_strCfgFile, RightPad(strVar, 23) & " :="
278 else
279 FileAppendLine g_strCfgFile, RightPad(strVar, 23) & " := " & strValue
280 end if
281end sub
282
283''
284' Prints a recursive assignment to the config file.
285sub CfgPrintAssignRecursive(strVar, strValue)
286 FileAppendLine g_strCfgFile, RightPad(strVar, 23) & " = " & strValue
287end sub
288
289
290''
291' Initializes the environment batch script.
292sub EnvInit
293 FileDelete g_strEnvFile
294 EnvPrint "@echo off"
295 EnvPrint "rem"
296 EnvPrint "rem Environment setup script generated by " & GetCommandline()
297 EnvPrint "rem"
298end sub
299
300
301''
302' Prints a string to the environment batch script.
303sub EnvPrint(str)
304 FileAppendLine g_strEnvFile, str
305end sub
306
307
308''
309' Helper for EnvPrintPrepend and EnvPrintAppend.
310sub EnvPrintCleanup(strEnv, strValue, strSep)
311 dim cchValueAndSep
312 FileAppendLine g_strEnvFile, "set " & strEnv & "=%" & strEnv & ":" & strSep & strValue & strSep & "=" & strSep & "%"
313 cchValueAndSep = Len(strValue) + Len(strSep)
314 FileAppendLine g_strEnvFile, "if ""%" & strEnv & "%""==""" & strValue & """ set " & strEnv & "="
315 FileAppendLine g_strEnvFile, "if ""%" & strEnv & ":~0," & cchValueAndSep & "%""==""" & strValue & strSep & """ set " & strEnv & "=%" & strEnv & ":~" & cchValueAndSep & "%"
316 FileAppendLine g_strEnvFile, "if ""%" & strEnv & ":~-" & cchValueAndSep & "%""==""" & strSep & strValue & """ set " & strEnv & "=%" & strEnv & ":~0,-" & cchValueAndSep & "%"
317end sub
318
319
320'' Use by EnvPrintPrepend to skip ';' stripping.
321dim g_strPrependCleanEnvVars
322
323''
324' Print a statement prepending strValue to strEnv, removing duplicate values.
325sub EnvPrintPrepend(strEnv, strValue, strSep)
326 ' Remove old values and any leading separators.
327 EnvPrintCleanup strEnv, strValue, strSep
328 if InStr(1, g_strPrependCleanEnvVars, "|" & strEnv & "|") = 0 then
329 FileAppendLine g_strEnvFile, "if ""%" & strEnv & ":~0,1%""==""" & strSep & """ set " & strEnv & "=%" & strEnv & ":~1%"
330 FileAppendLine g_strEnvFile, "if ""%" & strEnv & ":~0,1%""==""" & strSep & """ set " & strEnv & "=%" & strEnv & ":~1%"
331 g_strPrependCleanEnvVars = g_strPrependCleanEnvVars & "|" & strEnv & "|"
332 end if
333 ' Do the setting
334 FileAppendLine g_strEnvFile, "set " & strEnv & "=" & strValue & strSep & "%" & strEnv & "%"
335end sub
336
337
338'' Use by EnvPrintPrepend to skip ';' stripping.
339dim g_strAppendCleanEnvVars
340
341''
342' Print a statement appending strValue to strEnv, removing duplicate values.
343sub EnvPrintAppend(strEnv, strValue, strSep)
344 ' Remove old values and any trailing separators.
345 EnvPrintCleanup strEnv, strValue, strSep
346 if InStr(1, g_strAppendCleanEnvVars, "|" & strEnv & "|") = 0 then
347 FileAppendLine g_strEnvFile, "if ""%" & strEnv & ":~-1%""==""" & strSep & """ set " & strEnv & "=%" & strEnv & ":~0,-1%"
348 FileAppendLine g_strEnvFile, "if ""%" & strEnv & ":~-1%""==""" & strSep & """ set " & strEnv & "=%" & strEnv & ":~0,-1%"
349 g_strAppendCleanEnvVars = g_strAppendCleanEnvVars & "|" & strEnv & "|"
350 end if
351 ' Do the setting.
352 FileAppendLine g_strEnvFile, "set " & strEnv & "=%" & strEnv & "%" & strSep & strValue
353end sub
354
355
356''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
357' Feature disabling '
358''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
359
360''
361' No COM
362sub DisableCOM(strReason)
363 if g_blnDisableCOM = False then
364 LogPrint "Disabled COM components: " & strReason
365 g_blnDisableCOM = True
366 g_strDisableCOM = strReason
367 CfgPrintAssign "VBOX_WITH_MAIN", ""
368 CfgPrintAssign "VBOX_WITH_QTGUI", ""
369 CfgPrintAssign "VBOX_WITH_VBOXSDL", ""
370 CfgPrintAssign "VBOX_WITH_DEBUGGER_GUI", ""
371 end if
372end sub
373
374
375''
376' No UDPTunnel
377sub DisableUDPTunnel(strReason)
378 if g_blnDisableUDPTunnel = False then
379 LogPrint "Disabled UDPTunnel network transport: " & strReason
380 g_blnDisableUDPTunnel = True
381 g_strDisableUDPTunnel = strReason
382 CfgPrintAssign "VBOX_WITH_UDPTUNNEL", ""
383 end if
384end sub
385
386
387''
388' No SDL
389sub DisableSDL(strReason)
390 if g_blnDisableSDL = False then
391 LogPrint "Disabled SDL frontend: " & strReason
392 g_blnDisableSDL = True
393 g_strDisableSDL = strReason
394 CfgPrintAssign "VBOX_WITH_VBOXSDL", ""
395 end if
396end sub
397
398
399''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
400' Tool/Library Locating and Checking '
401''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
402
403''
404' Generic helper for looking for a tools under g_strPathDev.
405'
406' The callback function takes the '.../tools/win.arch/tool/version' dir and
407' varUser as arguments, returning an non-empty string if it was found suitable.
408'
409function SearchToolsEx(strTool, strVerPrefix, ByRef fnCallback, ByRef varUser, ByRef arrToolsDirs)
410 dim strToolsDir, arrDirs, strDir
411 SearchToolsEx = ""
412 for each strToolsDir in arrToolsDirs
413 arrDirs = GetSubdirsStartingWithRVerSorted(strToolsDir, strVerPrefix)
414 for each strDir in arrDirs
415 SearchToolsEx = fnCallback(strToolsDir & "/" & strDir, varUser)
416 if SearchToolsEx <> "" then
417 exit function
418 end if
419 next
420 next
421end function
422
423'' Search under g_strPathDev for a tool, target arch only.
424function SearchTargetTools(strTool, strVerPrefix, ByRef fnCallback, ByRef varUser)
425 dim i
426 redim arrToolsDirs(ArraySize(g_arrPathDev) - 1)
427 for i = 0 to UBound(g_arrPathDev)
428 arrToolsDirs(i) = g_arrPathDev(i) & "/win." & g_strTargetArch & "/" & strTool
429 next
430 SearchTargetTools = SearchToolsEx(strTool, strVerPrefix, fnCallback, varUser, arrToolsDirs)
431end function
432
433'' Search under g_strPathDev for a tool, target arch and alternative arches.
434function SearchTargetPlusTools(strTool, strVerPrefix, ByRef fnCallback, ByRef varUser)
435 dim i
436 redim arrToolsDirs(ArraySize(g_arrPathDev)*3 - 1)
437 for i = 0 to UBound(g_arrPathDev)
438 arrToolsDirs(i*3 + 0) = g_arrPathDev(i) & "/win." & g_strTargetArch & "/" & strTool
439 arrToolsDirs(i*3 + 1) = g_arrPathDev(i) & "/win.x86/" & strTool
440 arrToolsDirs(i*3 + 2) = g_arrPathDev(i) & "/win.amd64/" & strTool
441 next
442 SearchTargetPlusTools = SearchToolsEx(strTool, strVerPrefix, fnCallback, varUser, arrToolsDirs)
443end function
444
445'' Search under g_strPathDev for a tool, host arch first.
446function SearchHostTools(strTool, strVerPrefix, ByRef fnCallback, ByRef varUser)
447 dim i
448 redim arrToolsDirs(ArraySize(g_arrPathDev) * 3 - 1)
449 for i = 0 to UBound(g_arrPathDev)
450 arrToolsDirs(i*3 + 0) = g_arrPathDev(i) & "/win." & g_strHostArch & "/" & strTool
451 arrToolsDirs(i*3 + 1) = g_arrPathDev(i) & "/win.x86/" & strTool
452 arrToolsDirs(i*3 + 2) = g_arrPathDev(i) & "/win.amd64/" & strTool
453 next
454 SearchHostTools = SearchToolsEx(strTool, strVerPrefix, fnCallback, varUser, arrToolsDirs)
455end function
456
457'' Search under g_strPathDev for a tool, common dir first.
458function SearchCommonTools(strTool, strVerPrefix, ByRef fnCallback, ByRef varUser)
459 dim i
460 redim arrToolsDirs(ArraySize(g_arrPathDev) * 4 - 1)
461 for i = 0 to UBound(g_arrPathDev)
462 arrToolsDirs(i*4 + 0) = g_arrPathDev(i) & "/win.common/" & strTool
463 arrToolsDirs(i*4 + 1) = g_arrPathDev(i) & "/win." & g_strTargetArch & "/" & strTool
464 arrToolsDirs(i*4 + 2) = g_arrPathDev(i) & "/win.x86/" & strTool
465 arrToolsDirs(i*4 + 3) = g_arrPathDev(i) & "/win.amd64/" & strTool
466 next
467 SearchCommonTools = SearchToolsEx(strTool, strVerPrefix, fnCallback, varUser, arrToolsDirs)
468end function
469
470''
471' Checks the the path doesn't contain characters the tools cannot deal with.
472'
473sub CheckSourcePath
474 dim sPwd
475
476 sPwd = PathAbsLong(g_strPath) ' Must check the long version.
477 if InStr(1, sPwd, " ") > 0 then
478 MsgError "Source path contains spaces! Please move it. (" & sPwd & ")"
479 end if
480 if InStr(1, sPwd, "$") > 0 then
481 MsgError "Source path contains the '$' char! Please move it. (" & sPwd & ")"
482 end if
483 if InStr(1, sPwd, "%") > 0 then
484 MsgError "Source path contains the '%' char! Please move it. (" & sPwd & ")"
485 end if
486 if InStr(1, sPwd, Chr(10)) > 0 _
487 or InStr(1, sPwd, Chr(13)) > 0 _
488 or InStr(1, sPwd, Chr(9)) > 0 _
489 then
490 MsgError "Source path contains control characters! Please move it. (" & sPwd & ")"
491 end if
492 Print "Source path: OK"
493end sub
494
495
496''
497' Checks for kBuild - very simple :)
498'
499sub CheckForkBuild(strOptkBuild)
500 dim blnNeedEnvVars, strOutput
501 PrintHdr "kBuild"
502
503 '
504 ' Check if there is a 'kmk' in the path somewhere without
505 ' any KBUILD_*PATH stuff around.
506 '
507 blnNeedEnvVars = True
508 g_strPathkBuild = strOptkBuild
509 g_strPathkBuildBin = ""
510 if (g_strPathkBuild = "") _
511 And (EnvGetFirst("KBUILD_PATH", "PATH_KBUILD") = "") _
512 And (EnvGetFirst("KBUILD_BIN_PATH", "PATH_KBUILD_BIN") = "") _
513 And (Shell("kmk.exe --version", True, strOutput) = 0) _
514 And (InStr(1,strOutput, "kBuild Make 0.1") > 0) _
515 And (InStr(1,strOutput, "KBUILD_PATH") > 0) _
516 And (InStr(1,strOutput, "KBUILD_BIN_PATH") > 0) then
517 '' @todo Need to parse out the KBUILD_PATH and KBUILD_BIN_PATH values to complete the other tests.
518 'blnNeedEnvVars = False
519 MsgWarning "You've installed kBuild it seems. configure.vbs hasn't been updated to " _
520 & "deal with that yet and will use the one it ships with. Sorry."
521 end if
522
523 '
524 ' Check for the KBUILD_PATH env.var. and fall back on root/kBuild otherwise.
525 '
526 if g_strPathkBuild = "" then
527 g_strPathkBuild = EnvGetFirst("KBUILD_PATH", "PATH_KBUILD")
528 if (g_strPathkBuild <> "") and (FileExists(g_strPathkBuild & "/footer.kmk") = False) then
529 MsgWarning "Ignoring incorrect kBuild path (KBUILD_PATH=" & g_strPathkBuild & ")"
530 g_strPathkBuild = ""
531 end if
532
533 if g_strPathkBuild = "" then
534 g_strPathkBuild = g_strPath & "/kBuild"
535 end if
536 end if
537
538 g_strPathkBuild = UnixSlashes(PathAbs(g_strPathkBuild))
539
540 '
541 ' Check for env.vars that kBuild uses (do this early to set g_strTargetArch).
542 '
543 str = EnvGetFirst("KBUILD_TYPE", "BUILD_TYPE")
544 if (str <> "") _
545 And (InStr(1, "|release|debug|profile|kprofile", str) <= 0) then
546 EnvPrint "set KBUILD_TYPE=release"
547 EnvSet "KBUILD_TYPE", "release"
548 MsgWarning "Found unknown KBUILD_TYPE value '" & str &"' in your environment. Setting it to 'release'."
549 end if
550
551 str = EnvGetFirst("KBUILD_TARGET", "BUILD_TARGET")
552 if (str <> "") _
553 And (InStr(1, "win|win32|win64", str) <= 0) then '' @todo later only 'win' will be valid. remember to fix this check!
554 EnvPrint "set KBUILD_TARGET=win"
555 EnvSet "KBUILD_TARGET", "win"
556 MsgWarning "Found unknown KBUILD_TARGET value '" & str &"' in your environment. Setting it to 'win32'."
557 end if
558
559 str = EnvGetFirst("KBUILD_TARGET_ARCH", "BUILD_TARGET_ARCH")
560 if (str <> "") _
561 And (InStr(1, "x86|amd64", str) <= 0) then
562 EnvPrint "set KBUILD_TARGET_ARCH=x86"
563 EnvSet "KBUILD_TARGET_ARCH", "x86"
564 MsgWarning "Found unknown KBUILD_TARGET_ARCH value '" & str &"' in your environment. Setting it to 'x86'."
565 str = "x86"
566 end if
567 if g_strTargetArch = "" then '' command line parameter --target-arch=x86|amd64 has priority
568 if str <> "" then
569 g_strTargetArch = str
570 elseif (EnvGet("PROCESSOR_ARCHITEW6432") = "AMD64" ) _
571 Or (EnvGet("PROCESSOR_ARCHITECTURE") = "AMD64" ) then
572 g_strTargetArch = "amd64"
573 else
574 g_strTargetArch = "x86"
575 end if
576 else
577 if InStr(1, "x86|amd64", g_strTargetArch) <= 0 then
578 EnvPrint "set KBUILD_TARGET_ARCH=x86"
579 EnvSet "KBUILD_TARGET_ARCH", "x86"
580 MsgWarning "Unknown --target-arch=" & str &". Setting it to 'x86'."
581 end if
582 end if
583 LogPrint " Target architecture: " & g_strTargetArch & "."
584 Wscript.Echo " Target architecture: " & g_strTargetArch & "."
585 EnvPrint "set KBUILD_TARGET_ARCH=" & g_strTargetArch
586
587 ' Windows variant of the arch name.
588 g_strTargetArchWin = g_strTargetArch
589 if g_strTargetArchWin = "amd64" then g_strTargetArchWin = "x64"
590
591 str = EnvGetFirst("KBUILD_TARGET_CPU", "BUILD_TARGET_CPU")
592 ' perhaps a bit pedantic this since this isn't clearly define nor used much...
593 if (str <> "") _
594 And (InStr(1, "i386|i486|i686|i786|i868|k5|k6|k7|k8", str) <= 0) then
595 EnvPrint "set BUILD_TARGET_CPU=i386"
596 EnvSet "KBUILD_TARGET_CPU", "i386"
597 MsgWarning "Found unknown KBUILD_TARGET_CPU value '" & str &"' in your environment. Setting it to 'i386'."
598 end if
599
600 str = EnvGetFirst("KBUILD_HOST", "BUILD_PLATFORM")
601 if (str <> "") _
602 And (InStr(1, "win|win32|win64", str) <= 0) then '' @todo later only 'win' will be valid. remember to fix this check!
603 EnvPrint "set KBUILD_HOST=win"
604 EnvSet "KBUILD_HOST", "win"
605 MsgWarning "Found unknown KBUILD_HOST value '" & str &"' in your environment. Setting it to 'win32'."
606 end if
607
608 str = EnvGetFirst("KBUILD_HOST_ARCH", "BUILD_PLATFORM_ARCH")
609 if str <> "" then
610 if InStr(1, "x86|amd64", str) <= 0 then
611 str = "x86"
612 MsgWarning "Found unknown KBUILD_HOST_ARCH value '" & str &"' in your environment. Setting it to 'x86'."
613 end if
614 elseif (EnvGet("PROCESSOR_ARCHITEW6432") = "AMD64" ) _
615 Or (EnvGet("PROCESSOR_ARCHITECTURE") = "AMD64" ) then
616 str = "amd64"
617 else
618 str = "x86"
619 end if
620 LogPrint " Host architecture: " & str & "."
621 Wscript.Echo " Host architecture: " & str & "."
622 EnvPrint "set KBUILD_HOST_ARCH=" & str
623 g_strHostArch = str
624
625 ' Windows variant of the arch name.
626 g_strHostArchWin = g_strHostArch
627 if g_strHostArchWin = "amd64" then g_strHostArchWin = "x64"
628
629
630 str = EnvGetFirst("KBUILD_HOST_CPU", "BUILD_PLATFORM_CPU")
631 ' perhaps a bit pedantic this since this isn't clearly define nor used much...
632 if (str <> "") _
633 And (InStr(1, "i386|i486|i686|i786|i868|k5|k6|k7|k8", str) <= 0) then
634 EnvPrint "set KBUILD_HOST_CPU=i386"
635 EnvSet "KBUILD_HOST_CPU", "i386"
636 MsgWarning "Found unknown KBUILD_HOST_CPU value '" & str &"' in your environment. Setting it to 'i386'."
637 end if
638
639 '
640 ' Determin the location of the kBuild binaries.
641 '
642 if g_strPathkBuildBin = "" then
643 g_strPathkBuildBin = g_strPathkBuild & "/bin/win." & g_strHostArch
644 if FileExists(g_strPathkBuildBin & "/kmk.exe") = False then
645 g_strPathkBuildBin = g_strPathkBuild & "/bin/win.x86"
646 end if
647 end if
648 g_strPathkBuildBin = UnixSlashes(PathAbs(g_strPathkBuildBin))
649
650 '
651 ' Perform basic validations of the kBuild installation.
652 '
653 if (FileExists(g_strPathkBuild & "/footer.kmk") = False) _
654 Or (FileExists(g_strPathkBuild & "/header.kmk") = False) _
655 Or (FileExists(g_strPathkBuild & "/rules.kmk") = False) then
656 MsgFatal "Can't find valid kBuild at '" & g_strPathkBuild & "'. Either there is an " _
657 & "incorrect KBUILD_PATH in the environment or the checkout didn't succeed."
658 exit sub
659 end if
660 if (FileExists(g_strPathkBuildBin & "/kmk.exe") = False) _
661 Or (FileExists(g_strPathkBuildBin & "/kmk_ash.exe") = False) then
662 MsgFatal "Can't find valid kBuild binaries at '" & g_strPathkBuildBin & "'. Either there is an " _
663 & "incorrect KBUILD_PATH in the environment or the checkout didn't succeed."
664 exit sub
665 end if
666
667 if (Shell(DosSlashes(g_strPathkBuildBin & "/kmk.exe") & " --version", True, strOutput) <> 0) then
668 MsgFatal "Can't execute '" & g_strPathkBuildBin & "/kmk.exe --version'. check configure.log for the out."
669 exit sub
670 end if
671
672 '
673 ' If KBUILD_DEVTOOLS is set, check that it's pointing to something useful.
674 '
675 str = UnixSlashes(EnvGet("KBUILD_DEVTOOLS"))
676 g_strPathDev = str
677 if str <> "" _
678 and LogDirExists(str & "/bin") _
679 and LogDirExists(str & "/win.amd64/bin") _
680 and LogDirExists(str & "/win.x86/bin") _
681 then
682 LogPrint "Found KBUILD_DEVTOOLS='" & str & "'."
683 elseif str <> "" then
684 MsgWarning "Ignoring bogus KBUILD_DEVTOOLS='" & str &"' in your environment!"
685 g_strPathDev = strNew
686 end if
687 if g_strPathDev = "" then
688 g_strPathDev = UnixSlashes(g_strPath & "/tools")
689 LogPrint "Using KBUILD_DEVTOOLS='" & g_strPathDev & "'."
690 if str <> "" then
691 EnvPrint "set KBUILD_DEVTOOLS=" & g_strPathDev
692 EnvSet "KBUILD_DEVTOOLS", g_strPathDev
693 end if
694 end if
695 g_arrPathDev(ArrayFindString(g_arrPathDev, ":placeholder:")) = g_strPathDev
696
697 '
698 ' Write KBUILD_PATH and updated PATH to the environment script if necessary.
699 '
700 if blnNeedEnvVars = True then
701 EnvPrint "set KBUILD_PATH=" & g_strPathkBuild
702 EnvSet "KBUILD_PATH", g_strPathkBuild
703
704 if Right(g_strPathkBuildBin, 7) = "win.x86" then
705 EnvPrintCleanup "PATH", DosSlashes(Left(g_strPathkBuildBin, Len(g_strPathkBuildBin) - 7) & "win.amd64"), ";"
706 end if
707 if Right(g_strPathkBuildBin, 9) = "win.amd64" then
708 EnvPrintCleanup "PATH", DosSlashes(Left(g_strPathkBuildBin, Len(g_strPathkBuildBin) - 9) & "win.x86"), ";"
709 end if
710 EnvPrintPrepend "PATH", DosSlashes(g_strPathkBuildBin), ";"
711 EnvPrependPathItem "PATH", g_strPathkBuildBin, ";"
712 end if
713
714 PrintResult "kBuild", g_strPathkBuild
715 PrintResult "kBuild binaries", g_strPathkBuildBin
716end sub
717
718
719''
720' Checks for Visual C++ version 16 (2019), 15 (2017), 14 (2015), 12 (2013), 11 (2012) or 10 (2010).
721'
722sub CheckForVisualCPP(strOptVC, strOptVCCommon)
723 PrintHdr "Visual C++"
724
725 '
726 ' Try find it...
727 '
728 dim objState, strProgFiles
729 set objState = new VisualCPPState
730 objState.check strOptVC, strOptVCCommon
731 if g_blnInternalFirst = True then objState.checkInternal
732 objState.checkProgItems "2019"
733 objState.checkProgFiles "Microsoft Visual Studio\2019\BuildTools\VC"
734 objState.checkProgFiles "Microsoft Visual Studio\2019\Professional\VC"
735 objState.checkProgFiles "Microsoft Visual Studio\2019\Community\VC"
736 objState.checkRegistry "Microsoft\VisualStudio\SxS\VS7\16.0", "VC", "" ' doesn't work.
737 objState.checkProgItems "2017"
738 objState.checkProgFiles "Microsoft Visual Studio\2017\BuildTools\VC"
739 objState.checkProgFiles "Microsoft Visual Studio\2017\Professional\VC"
740 objState.checkProgFiles "Microsoft Visual Studio\2017\Community\VC"
741 objState.checkProgFiles "Microsoft Visual Studio\2017\Express\VC"
742 objState.checkRegistry "Microsoft\VisualStudio\SxS\VS7\15.0", "VC", ""
743 objState.checkRegistry "Microsoft\VisualStudio\SxS\VS7\14.0", "VC", "Common7"
744 objState.checkRegistry "Microsoft\VisualStudio\SxS\VS7\12.0", "VC", "Common7" '?
745 objState.checkRegistry "Microsoft\VisualStudio\SxS\VS7\11.0", "VC", "Common7" '?
746 objState.checkProg "cl.exe"
747 objState.checkRegistry "Microsoft\VisualStudio\10.0\Setup\VS\ProductDir", "VC", "Common7"
748 if g_blnInternalFirst = False then objState.checkInternal
749
750 if objState.m_blnFound = False then
751 MsgError "Cannot find cl.exe (Visual C++) anywhere on your system. Check the build requirements."
752 exit sub
753 end if
754 g_strPathVCC = objState.m_strPathVC
755 g_strVCCVersion = objState.m_strVersion
756
757 '
758 ' Ok, emit build config variables.
759 '
760 CfgPrintAssign "VBOX_VCC_TOOL_STEM", objState.m_strVersion
761 CfgPrintAssign "PATH_TOOL_" & objState.m_strVersion, g_strPathVCC
762 CfgPrintAssign "PATH_TOOL_" & objState.m_strVersion & "X86", "$(PATH_TOOL_" & objState.m_strVersion & ")"
763 CfgPrintAssign "PATH_TOOL_" & objState.m_strVersion & "AMD64", "$(PATH_TOOL_" & objState.m_strVersion & ")"
764
765 if objState.m_strVersion = "VCC100" _
766 or objState.m_strVersion = "VCC110" _
767 or objState.m_strVersion = "VCC120" _
768 or objState.m_strVersion = "VCC140" _
769 then
770 CfgPrintAssign "VBOX_WITH_NEW_VCC", "" '?? for VCC110+
771 else
772 CfgPrintAssign "VBOX_WITH_NEW_VCC", "1"
773 end if
774 PrintResult "Visual C++ " & objState.m_strVersion, g_strPathVCC
775
776 ' And the env.bat path fix.
777 if objState.m_strPathVCCommon <> "" then
778 EnvPrintAppend "PATH", DosSlashes(objState.m_strPathVCCommon) & "\IDE", ";"
779 end if
780end sub
781
782'' Class we use for detecting Visual C++
783class VisualCPPState
784 public m_blnFound
785 public m_strPathVC
786 public m_strPathVCCommon
787 public m_strVersion
788 public m_strClVersion
789 public m_blnNewLayout
790
791 private sub Class_Initialize
792 m_blnFound = False
793 m_strPathVC = ""
794 m_strPathVCCommon = ""
795 m_strVersion = ""
796 m_strClVersion = ""
797 m_blnNewLayout = false
798 end sub
799
800 public function checkClExe(strClExe)
801 ' We'll have to make sure mspdbXX.dll is somewhere in the PATH.
802 dim strSavedPath, rcExit, strOutput
803
804 strSavedPath = EnvGet("PATH")
805 if (m_strPathVCCommon <> "") then
806 EnvAppendPathItem "PATH", m_strPathVCCommon & "/IDE", ";"
807 end if
808 rcExit = Shell(DosSlashes(strClExe), True, strOutput)
809 EnvSet "PATH", strSavedPath
810
811 checkClExe = False
812 if rcExit = 0 then
813 ' Extract the ' Version xx.yy.build.zz for arch' bit.
814 dim offVer, offEol, strVer
815 strVer = ""
816 offVer = InStr(1, strOutput, " Version ")
817 if offVer > 0 then
818 offVer = offVer + Len(" Version ")
819 offEol = InStr(offVer, strOutput, Chr(13))
820 if offEol > 0 then
821 strVer = Trim(Mid(strOutput, offVer, offEol - offVer))
822 end if
823 end if
824
825 ' Check that it's a supported version
826 checkClExe = True
827 if InStr(1, strVer, "16.") = 1 then
828 m_strVersion = "VCC100"
829 elseif InStr(1, strVer, "17.") = 1 then
830 m_strVersion = "VCC110"
831 LogPrint "The Visual C++ compiler ('" & strClExe & "') version isn't really supported, but may work: " & strVer
832 elseif InStr(1, strVer, "18.") = 1 then
833 m_strVersion = "VCC120"
834 LogPrint "The Visual C++ compiler ('" & strClExe & "') version isn't really supported, but may work: " & strVer
835 elseif InStr(1, strVer, "19.0") = 1 then
836 m_strVersion = "VCC140"
837 LogPrint "The Visual C++ compiler ('" & strClExe & "') version isn't really supported, but may work: " & strVer
838 elseif InStr(1, strVer, "19.1") = 1 then
839 m_strVersion = "VCC141"
840 LogPrint "The Visual C++ compiler ('" & strClExe & "') version isn't really supported, but may work: " & strVer
841 elseif InStr(1, strVer, "19.2") = 1 then
842 m_strVersion = "VCC142"
843 else
844 LogPrint "The Visual C++ compiler we found ('" & strClExe & "') isn't in the 10.0-19.2x range (" & strVer & ")."
845 LogPrint "Check the build requirements and select the appropriate compiler version."
846 checkClExe = False
847 exit function
848 end if
849 LogPrint "'" & strClExe & "' = " & m_strVersion & " (" & strVer & ")"
850 else
851 LogPrint "Executing '" & strClExe & "' (which we believe to be the Visual C++ compiler driver) failed (rcExit=" & rcExit & ")."
852 end if
853 end function
854
855 public function checkInner(strPathVC) ' For the new layout only
856 if m_blnFound = False then
857 if LogDirExists(strPathVC & "/bin") _
858 and LogDirExists(strPathVC & "/lib") _
859 and LogDirExists(strPathVC & "/include") _
860 and LogFileExists(strPathVC, "include/stdarg.h") _
861 and LogFileExists(strPathVC, "lib/x64/libcpmt.lib") _
862 and LogFileExists(strPathVC, "lib/x86/libcpmt.lib") _
863 and LogFileExists(strPathVC, "bin/Host" & g_strHostArchWin & "/" & g_strTargetArchWin & "/cl.exe") _
864 and LogFileExists(strPathVC, "bin/Host" & g_strHostArchWin & "/" & g_strHostArchWin & "/cl.exe") _
865 then
866 LogPrint " => seems okay. new layout."
867 m_blnFound = checkClExe(strPathVC & "/bin/Host" & g_strHostArchWin & "/" & g_strTargetArchWin & "/cl.exe")
868 if m_blnFound then
869 m_strPathVC = strPathVC
870 end if
871 end if
872 end if
873 checkInner = m_blnFound
874 end function
875
876 public function check(strPathVC, strPathVCommon)
877 if (m_blnFound = False) and (strPathVC <> "") then
878 m_strPathVC = UnixSlashes(PathAbs(strPathVC))
879 m_strPathVCCommon = strPathVCCommon
880 m_strVersion = ""
881
882 LogPrint "Trying: strPathVC=" & m_strPathVC & " strPathVCCommon=" & m_strPathVCCommon
883 if LogDirExists(m_strPathVC) then
884 ' 15.0+ layout? This is fun because of the multiple CL versions (/tools/msvc/xx.yy.bbbbb/).
885 ' OTOH, the user may have pointed us directly to one of them.
886 if LogDirExists(m_strPathVC & "/Tools/MSVC") then
887 m_blnNewLayout = True
888 LogPrint " => seems okay. new layout."
889 dim arrFolders, i
890 arrFolders = GetSubdirsStartingWithVerSorted(m_strPathVC & "/Tools/MSVC", "14.2")
891 if UBound(arrFolders) < 0 then arrFolders = GetSubdirsStartingWithVerSorted(m_strPathVC & "/Tools/MSVC", "14.1")
892 if UBound(arrFolders) < 0 then arrFolders = GetSubdirsStartingWithVerSorted(m_strPathVC & "/Tools/MSVC", "1")
893 for i = UBound(arrFolders) to LBound(arrFolders) step -1
894 if checkInner(m_strPathVC & "/Tools/MSVC/" & arrFolders(i)) then exit for ' modifies m_strPathVC on success
895 next
896 elseif LogDirExists(m_strPathVC & "/bin/HostX64") _
897 or LogDirExists(m_strPathVC & "/bin/HostX86") then
898 checkInner(m_strPathVC)
899 ' 14.0 and older layout?
900 elseif LogFileExists(m_strPathVC, "/bin/cl.exe") then
901 m_blnNewLayout = False
902 if LogFileExists(m_strPathVC, "bin/link.exe") _
903 and LogFileExists(m_strPathVC, "include/string.h") _
904 and LogFileExists(m_strPathVC, "lib/libcmt.lib") _
905 and LogFileExists(m_strPathVC, "lib/msvcrt.lib") _
906 then
907 LogPrint " => seems okay. old layout."
908 m_blnFound = checkClExe(m_strPathVC & "/bin/cl.exe")
909 end if
910 end if
911 end if
912 end if
913 check = m_bldFound
914 end function
915
916 public function checkProg(strProg)
917 if m_blnFound = False then
918 dim str, i, offNewLayout
919 str = Which(strProg)
920 if str <> "" then
921 LogPrint "checkProg: '" & strProg & "' -> '" & str & "'"
922 if FileExists(PathStripFilename(str) & "/build.exe") then
923 Warning "Ignoring DDK cl.exe (" & str & ")." ' don't know how to deal with this cl.
924 else
925 ' Assume we've got cl.exe from somewhere under the 'bin' directory..
926 m_strPathVC = PathParent(PathStripFilename(str))
927 for i = 1 To 5
928 if LogDirExists(m_strPathVC & "/include") then
929 m_strPathVCCommon = PathParent(m_strPathVC) & "/Common7"
930 if DirExists(m_strPathVCCommon) = False then
931 m_strPathVCCommon = ""
932 ' New layout?
933 offNewLayout = InStr(1, LCase(DosSlashes(m_strPathVC)), "\tools\msvc\")
934 if offNewLayout > 0 then m_strPathVC = Left(m_strPathVC, offNewLayout)
935 end if
936 check m_strPathVC, m_strPathVCCommon
937 exit for
938 end if
939 m_strPathVC = PathParent(m_strPathVC)
940 next
941 end if
942 end if
943 end if
944 checkProg = m_bldFound
945 end function
946
947 public function checkProgFiles(strSubdir)
948 if m_blnFound = False then
949 dim strProgFiles
950 for each strProgFiles in g_arrProgramFiles
951 check strProgFiles & "/" & strSubdir, ""
952 next
953 end if
954 checkProgFiles = m_blnFound
955 end function
956
957 public function checkRegistry(strValueNm, strVCSubdir, strVCommonSubdir)
958 if m_blnFound = False then
959 dim str, strPrefix, arrPrefixes
960 arrPrefixes = Array("HKLM\SOFTWARE\Wow6432Node\", "HKLM\SOFTWARE\", "HKCU\SOFTWARE\Wow6432Node\", "HKCU\SOFTWARE\")
961 for each strPrefix in arrPrefixes
962 str = LogRegGetString(strPrefix & strValueNm)
963 if str <> "" then
964 LogPrint "checkRegistry: '" & strPrefix & strValueNm & "' -> '" & str & "'"
965 if check(str & strVCSubdir, str & strVCommonSubdir) = True then
966 exit for
967 end if
968 end if
969 next
970 end if
971 checkRegistry = m_bldFound
972 end function
973
974 public function checkProgItems(strVersionYear)
975 if m_blnFound = False then
976 dim strCandidate
977 for each strCandidate in CollectFromProgramItemLinks(GetRef("VisualCPPCallback"), strVersionYear)
978 check strCandidate, ""
979 next
980 end if
981 checkProgItems = m_blnFound
982 end function
983
984 public function checkInternal
985 dim strPathDev
986 for each strPathDev in g_arrPathDev : check strPathDev & "/win.amd64/vcc/v14.2", "" : next
987 for each strPathDev in g_arrPathDev : check strPathDev & "/win.amd64/vcc/v14.2", "" : next
988 for each strPathDev in g_arrPathDev : check strPathDev & "/win.amd64/vcc/v14.1", "" : next
989 for each strPathDev in g_arrPathDev : check strPathDev & "/win.amd64/vcc/v14.0", "" : next
990 for each strPathDev in g_arrPathDev : check strPathDev & "/win.amd64/vcc/v10sp1", "" : next
991 for each strPathDev in g_arrPathDev : check strPathDev & "/win.x86/vcc/v10sp1", "" : next
992 checkInternal = m_blnFound
993 end function
994end class
995
996' See checkProgItems()
997function VisualCPPCallback(ByRef arrStrings, cStrings, ByRef strVersionYear)
998 VisualCPPCallback = ""
999 ' We're looking for items with three strings like this:
1000 ' C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2019\Visual Studio Tools\VC\x64 Native Tools Command Prompt for VS 2019.lnk
1001 ' C:\Windows\system32\cmd.exe
1002 ' /k "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat"
1003 if cStrings >= 3 then
1004 if InStr(1, arrStrings(0), strVersionYear) > 0 then
1005 dim strTail : strTail = "\Auxiliary\Build\vcvars64.bat"""
1006 dim str : str = arrStrings(UBound(arrStrings))
1007 if StrComp(Right(str, Len(strTail)), strTail, vbTextCompare) = 0 then
1008 dim offColon : offColon = InStr(1, str, ":")
1009 if offColon > 1 then
1010 VisualCPPCallback = Mid(str, offColon - 1, Len(str) - (offColon - 2) - Len(strTail))
1011 end if
1012 end if
1013 end if
1014 end if
1015end function
1016
1017
1018''
1019' Checks for a windows 10 SDK (later also WDK).
1020'
1021sub CheckForSDK10(strOptSDK10, strOptSDK10Version)
1022 dim strPathSDK10, strSDK10Version, str
1023 PrintHdr "Windows 10 SDK/WDK"
1024 '' @todo implement strOptSDK10Version
1025
1026 '
1027 ' Try find the Windows 10 kit.
1028 '
1029 strSDK10Version = ""
1030 strPathSDK10 = CheckForSDK10Sub(strOptSDK10, strSDK10Version)
1031 if strPathSDK10 = "" and g_blnInternalFirst = true then
1032 strPathSDK10 = SearchTargetPlusTools("sdk", "v10.", GetRef("CheckForSDK10Sub"), strSDK10Version)
1033 end if
1034
1035 if strPathSDK10 = "" then
1036 str = LogRegGetString("HKLM\SOFTWARE\Microsoft\Windows Kits\Installed Roots\KitsRoot10")
1037 strPathSDK10 = CheckForSDK10Sub(str, strSDK10Version)
1038 end if
1039 if strPathSDK10 = "" then
1040 for each str in g_arrProgramFiles
1041 strPathSDK10 = CheckForSDK10Sub(str & "/Windows Kits/10", strSDK10Version)
1042 if strPathSDK10 <> "" then exit for
1043 next
1044 end if
1045 if strPathSDK10 = "" and g_blnInternalFirst = true then
1046 strPathSDK10 = SearchTargetPlusTools("sdk", "v10.", GetRef("CheckForSDK10Sub"), strSDK10Version)
1047 end if
1048
1049 if strPathSDK10 = "" then
1050 MsgError "Cannot find a suitable Windows 10 SDK. Check configure.log and the build requirements."
1051 exit sub
1052 end if
1053
1054 '
1055 ' Emit the config.
1056 '
1057 strPathSDK10 = UnixSlashes(PathAbs(strPathSDK10))
1058 CfgPrintAssign "PATH_SDK_WINSDK10", strPathSDK10
1059 CfgPrintAssign "SDK_WINSDK10_VERSION", strSDK10Version
1060
1061 PrintResult "Windows 10 SDK", strPathSDK10
1062 PrintResultMsg "Windows 10 SDK version", strSDK10Version
1063 g_strPathSDK10 = strPathSDK10
1064end sub
1065
1066'' Checks if the specified path points to a usable Windows 10 SDK/WDK.
1067function CheckForSDK10Sub(strPathSDK10, ByRef strSDK10Version)
1068 CheckForSDK10Sub = ""
1069 if strPathSDK10 <> "" then
1070 LogPrint "Trying: strPathSDK10=" & strPathSDK10
1071 if LogDirExists(strPathSDK10) then
1072 if LogDirExists(strPathSDK10 & "/Bin") _
1073 and LogDirExists(strPathSDK10 & "/Include") _
1074 and LogDirExists(strPathSDK10 & "/Lib") _
1075 and LogDirExists(strPathSDK10 & "/Redist") _
1076 then
1077 ' Only testing the highest one, for now. '' @todo incorporate strOptSDK10Version
1078 dim arrVersions
1079 arrVersions = GetSubdirsStartingWithVerSorted(strPathSDK10 & "/Include", "10.0.")
1080 if UBound(arrVersions) >= 0 then
1081 dim strVersion
1082 strVersion = arrVersions(UBound(arrVersions))
1083 LogPrint "Trying version: " & strVersion
1084 if LogFileExists(strPathSDK10, "include/" & strVersion & "/um/Windows.h") _
1085 and LogFileExists(strPathSDK10, "include/" & strVersion & "/ucrt/malloc.h") _
1086 and LogFileExists(strPathSDK10, "include/" & strVersion & "/ucrt/stdio.h") _
1087 and LogFileExists(strPathSDK10, "lib/" & strVersion & "/um/" & g_strTargetArchWin & "/kernel32.lib") _
1088 and LogFileExists(strPathSDK10, "lib/" & strVersion & "/um/" & g_strTargetArchWin & "/user32.lib") _
1089 and LogFileExists(strPathSDK10, "lib/" & strVersion & "/ucrt/" & g_strTargetArchWin & "/libucrt.lib") _
1090 and LogFileExists(strPathSDK10, "lib/" & strVersion & "/ucrt/" & g_strTargetArchWin & "/ucrt.lib") _
1091 and LogFileExists(strPathSDK10, "bin/" & strVersion & "/" & g_strHostArchWin & "/rc.exe") _
1092 and LogFileExists(strPathSDK10, "bin/" & strVersion & "/" & g_strHostArchWin & "/midl.exe") _
1093 then
1094 if StrComp(strVersion, "10.0.17134.0") >= 0 then
1095 strSDK10Version = strVersion
1096 CheckForSDK10Sub = strPathSDK10
1097 else
1098 LogPrint "Version " & strVersion & " is too low, minimum: 10.0.17134.0"
1099 end if
1100 end if
1101 else
1102 LogPrint "Found no 10.0.* subdirectories under '" & strPathSDK10 & "/Include'!"
1103 end if
1104 end if
1105 end if
1106 end if
1107end function
1108
1109
1110''
1111' Locating a Windows 7 Driver Kit.
1112'
1113sub CheckForWinDDK(strOptDDK)
1114 dim strPathDDK, str, strSubKeys
1115 PrintHdr "Windows DDK v7.1"
1116
1117 '
1118 ' Find the DDK.
1119 '
1120 strPathDDK = CheckForWinDDKSub(strOptDDK, True)
1121
1122 ' The tools location (first).
1123 if strPathDDK = "" and g_blnInternalFirst = true then
1124 for each str in g_arrPathDev
1125 strPathDDK = CheckForWinDDKSub(str & "/win.x86/ddk/7600.16385.1", False)
1126 if strPathDDK <> "" then exit for
1127 next
1128 end if
1129
1130 ' Check the environment
1131 if strPathDDK = "" then strPathDDK = CheckForWinDDKSub(PathParent(PathParent(EnvGet("DDK_INC_PATH"))), True)
1132 if strPathDDK = "" then strPathDDK = CheckForWinDDKSub(EnvGet("BASEDIR"), True)
1133
1134 ' Some array constants to ease the work.
1135 arrSoftwareKeys = array("SOFTWARE", "SOFTWARE\Wow6432Node")
1136 arrRoots = array("HKLM", "HKCU")
1137
1138 ' Windows 7 WDK.
1139 if strPathDDK = "" then
1140 arrLocations = array()
1141 for each strSoftwareKey in arrSoftwareKeys
1142 for each strSubKey in RegEnumSubKeysFull("HKLM", strSoftwareKey & "\Microsoft\KitSetup\configured-kits")
1143 for each strSubKey2 in RegEnumSubKeysFull("HKLM", strSubKey)
1144 str = LogRegGetString("HKLM\" & strSubKey2 & "\setup-install-location")
1145 if str <> "" then
1146 arrLocations = ArrayAppend(arrLocations, PathAbsLong(str))
1147 end if
1148 next
1149 next
1150 next
1151 arrLocations = ArrayRVerSortStrings(arrLocations)
1152
1153 ' Check the locations we've gathered.
1154 for each str in arrLocations
1155 strPathDDK = CheckForWinDDKSub(str, True)
1156 if strPathDDK <> "" then exit for
1157 next
1158 end if
1159
1160 ' The tools location (post).
1161 if strPathDDK = "" and g_blnInternalFirst = false then
1162 for each str in g_arrPathDev
1163 strPathDDK = CheckForWinDDKSub(str & "/win.x86/ddk/7600.16385.1", False)
1164 if strPathDDK <> "" then exit for
1165 next
1166 end if
1167
1168 ' Give up.
1169 if strPathDDK = "" then
1170 MsgError "Cannot find the Windows DDK v7.1. Check configure.log and the build requirements."
1171 exit sub
1172 end if
1173
1174 '
1175 ' Emit the config.
1176 '
1177 strPathDDK = UnixSlashes(PathAbs(strPathDDK))
1178 CfgPrintAssign "PATH_SDK_WINDDK71", strPathDDK
1179
1180 PrintResult "Windows DDK v7.1", strPathDDK
1181 g_strPathDDK = strPathDDK
1182end sub
1183
1184'' Quick check if the DDK is in the specified directory or not.
1185function CheckForWinDDKSub(strPathDDK, blnCheckBuild)
1186 CheckForWinDDKSub = ""
1187 if strPathDDK <> "" then
1188 dim strOutput
1189 LogPrint "Trying: strPathDDK=" & strPathDDK & " blnCheckBuild=" & blnCheckBuild
1190 if LogFileExists(strPathDDK, "inc/api/ntdef.h") _
1191 And LogFileExists(strPathDDK, "lib/win7/i386/int64.lib") _
1192 And LogFileExists(strPathDDK, "lib/wlh/i386/int64.lib") _
1193 And LogFileExists(strPathDDK, "lib/wnet/i386/int64.lib") _
1194 And LogFileExists(strPathDDK, "lib/wxp/i386/int64.lib") _
1195 And Not LogFileExists(strPathDDK, "lib/win8/i386/int64.lib") _
1196 And LogFileExists(strPathDDK, "bin/x86/rc.exe") _
1197 then
1198 if Not blnCheckBuild then
1199 CheckForWinDDKSub = strPathDDK
1200 '' @todo Find better build check.
1201 elseif Shell("""" & DosSlashes(strPathDDK & "/bin/x86/rc.exe") & """" , True, strOutput) <> 0 _
1202 and InStr(1, strOutput, "Resource Compiler Version 6.1.") > 0 _
1203 then
1204 CheckForWinDDKSub = strPathDDK
1205 end if
1206 end if
1207 end if
1208end function
1209
1210
1211''
1212' Locating midl.exe
1213'
1214sub CheckForMidl(strOptMidl)
1215 dim strMidl, str
1216 PrintHdr "Midl.exe"
1217
1218 ' Skip if no COM/ATL.
1219 if g_blnDisableCOM then
1220 PrintResultMsg "Midl.exe", "Skipped (" & g_strDisableCOM & ")"
1221 exit sub
1222 end if
1223
1224 strMidl = CheckForMidlSub(strOptMidl)
1225 if strMidl = "" then strMidl = CheckForMidlSub(g_strPathSDK10 & "/bin/" & g_strHostArchWin & "/Midl.exe")
1226 if strMidl = "" then strMidl = CheckForMidlSub(g_strPathSDK10 & "/bin/x86/Midl.exe")
1227 if strMidl = "" then strMidl = CheckForMidlSub(g_strPathPSDK & "/bin/Midl.exe")
1228 if strMidl = "" then strMidl = CheckForMidlSub(g_strPathVCC & "/Common7/Tools/Bin/Midl.exe")
1229 if strMidl = "" then strMidl = CheckForMidlSub(g_strPathDDK & "/bin/" & g_strHostArchWin & "/Midl.exe")
1230 if strMidl = "" then strMidl = CheckForMidlSub(g_strPathDDK & "/bin/x86/Midl.exe")
1231 if strMidl = "" then strMidl = CheckForMidlSub(g_strPathDDK & "/bin/Midl.exe")
1232 if strMidl = "" then
1233 for each str in g_arrPathDev
1234 strMidl = CheckForMidlSub(str & "/win." & g_strHostArchWin & "/bin/Midl.exe")
1235 if strMidl <> "" then exit for
1236 strMidl = CheckForMidlSub(str & "/win.x86/bin/Midl.exe")
1237 if strMidl <> "" then exit for
1238 next
1239 end if
1240
1241 if strMidl = "" then
1242 PrintResultMsg "Midl.exe", "not found"
1243 else
1244 CfgPrintAssign "VBOX_MAIN_IDL", strMidl
1245 PrintResult "Midl.exe", strMidl
1246 end if
1247end sub
1248
1249function CheckForMidlSub(strMidl)
1250 CheckForMidlSub = ""
1251 if strMidl <> "" then
1252 if LogFileExists1(strMidl) then
1253 CheckForMidlSub = UnixSlashes(PathAbs(strMidl))
1254 end if
1255 end if
1256end function
1257
1258
1259''
1260' Locating yasm.exe
1261'
1262sub CheckForYasm(strOptYasm)
1263 dim strPathYasm, strVersion
1264 PrintHdr "yasm"
1265
1266 strVersion = ""
1267 strPathYasm = CheckForYasmSub(strOptYasm, strVersion)
1268 if strPathYasm = "" then strPathYasm = CheckForYasmSub(PathStripFilename(strOptYasm), strVersion)
1269 if strPathYasm = "" and g_blnInternalFirst = true then
1270 strPathYasm = SearchHostTools("yasm", "v", GetRef("CheckForYasmSub"), strVersion)
1271 end if
1272 if strPathYasm = "" then strPathYasm = CheckForYasmSub(PathStripFilename(Which("yasm.exe")), strVersion)
1273 if strPathYasm = "" and g_blnInternalFirst = false then
1274 strPathYasm = SearchHostTools("yasm", "v", GetRef("CheckForYasmSub"), strVersion)
1275 end if
1276
1277 if strPathYasm = "" then
1278 PrintResultMsg "yasm", "not found"
1279 MsgError "Unable to locate yasm!"
1280 else
1281 CfgPrintAssign "PATH_TOOL_YASM", strPathYasm
1282 PrintResult "yasm v" & strVersion, strPathYasm
1283 end if
1284end sub
1285
1286function CheckForYasmSub(strPathYasm, ByRef strVersion)
1287 CheckForYasmSub = ""
1288 if strPathYasm <> "" then
1289 if LogFileExists(strPathYasm, "yasm.exe") then
1290 dim strOutput
1291 if Shell("""" & DosSlashes(strPathYasm & "\yasm.exe") & """ --version", True, strOutput) = 0 then
1292 dim strPreamble : strPreamble = "yasm"
1293 dim strVer : strVer = Trim(StrGetFirstLine(strOutput))
1294 if StrComp(Left(strVer, Len(strPreamble)), strPreamble, vbTextCompare) = 0 then
1295 strVersion = StrGetFirstWord(Trim(Mid(strVer, Len(strPreamble) + 1)))
1296 if StrVersionCompare(strVersion, "1.3.0") >= 0 and strVersion <> "" then
1297 LogPrint "Found yasm version: " & strVer
1298 CheckForYasmSub = UnixSlashes(PathAbs(strPathYasm))
1299 else
1300 LogPrint "yasm version is older than 1.3.0: " & strVersion
1301 end if
1302 else
1303 LogPrint "Not yasm: " & strVer
1304 end if
1305 end if
1306 end if
1307 end if
1308end function
1309
1310
1311''
1312' Locating nasm.exe
1313'
1314sub CheckForNasm(strOptNasm)
1315 dim strPathNasm, strVersion
1316 PrintHdr "nasm"
1317
1318 strPathNasm = CheckForNasmSub(strOptNasm, strVersion)
1319 if strPathNasm = "" then strPathNasm = CheckForNasmSub(PathStripFilename(strOptNasm), strVersion)
1320 if strPathNasm = "" and g_blnInternalFirst = true then
1321 strPathNasm = SearchHostTools("nasm", "v", GetRef("CheckForNasmSub"), strVersion)
1322 end if
1323 if strPathNasm = "" then strPathNasm = CheckForNasmSub(LogRegGetString("HKLM\SOFTWARE\nasm\"), strVersion)
1324 if strPathNasm = "" then strPathNasm = CheckForNasmSub(LogRegGetString("HKCU\SOFTWARE\nasm\"), strVersion)
1325 if strPathNasm = "" then
1326 for each strCandidate in CollectFromProgramItemLinks(GetRef("NasmProgramItemCallback"), strPathNasm)
1327 strPathNasm = CheckForNasmSub(strCandidate, strVersion)
1328 next
1329 end if
1330 if strPathNasm = "" then strPathNasm = CheckForNasmSub(PathStripFilename(Which("nasm.exe")), strVersion)
1331 if strPathNasm = "" and g_blnInternalFirst = false then
1332 strPathNasm = SearchHostTools("nasm", "v", GetRef("CheckForNasmSub"), strVersion)
1333 end if
1334
1335 if strPathNasm = "" then
1336 PrintResultMsg "nasm", "not found"
1337 else
1338 CfgPrintAssign "PATH_TOOL_NASM", strPathNasm
1339 PrintResult "nasm v" & strVersion, strPathNasm
1340 end if
1341end sub
1342
1343function NasmProgramItemCallback(ByRef arrStrings, cStrings, ByRef strUnused)
1344 dim str, off
1345 NasmProgramItemCallback = ""
1346 if cStrings > 1 then
1347 str = arrStrings(1)
1348 off = InStr(1, str, "\nasm.exe", vbTextCompare)
1349 if off > 0 then
1350 NasmProgramItemCallback = Left(str, off - 1)
1351 end if
1352 end if
1353end function
1354
1355function CheckForNasmSub(strPathNasm, ByRef strVersion)
1356 CheckForNasmSub = ""
1357 if strPathNasm <> "" then
1358 if LogFileExists(strPathNasm, "nasm.exe") then
1359 dim strOutput
1360 if Shell("""" & DosSlashes(strPathNasm & "\nasm.exe") & """ -version", True, strOutput) = 0 then
1361 dim strPreamble : strPreamble = "NASM version"
1362 dim strVer : strVer = Trim(StrGetFirstLine(strOutput))
1363 if StrComp(Left(strVer, Len(strPreamble)), strPreamble, vbTextCompare) = 0 then
1364 strVersion = StrGetFirstWord(Trim(Mid(strVer, Len(strPreamble) + 1)))
1365 if StrVersionCompare(strVersion, "2.12.0") >= 0 and strVersion <> "" then
1366 LogPrint "Found nasm version: " & strVersion
1367 CheckForNasmSub = UnixSlashes(PathAbs(strPathNasm))
1368 else
1369 LogPrint "nasm version is older than 2.12.0: " & strVersion
1370 end if
1371 else
1372 LogPrint "Not nasm: " & strVer
1373 end if
1374 end if
1375 end if
1376 end if
1377end function
1378
1379
1380''
1381' Locating OpenWatcom 1.9
1382'
1383sub CheckForOpenWatcom(strOptOpenWatcom)
1384 dim strPathOW, strCandidate, strVersion
1385 PrintHdr "OpenWatcom"
1386
1387 strPathOW = CheckForOpenWatcomSub(strOptOpenWatcom, strVersion)
1388 if strPathOW = "" and g_blnInternalFirst = true then
1389 strPathOW = SearchCommonTools("openwatcom", "v", GetRef("CheckForOpenWatcomSub"), strVersion)
1390 end if
1391 if strPathOW = "" then
1392 for each strCandidate in CollectFromProgramItemLinks(GetRef("OpenWatcomProgramItemCallback"), strPathOW)
1393 if strPathOW = "" then strPathOW = CheckForOpenWatcomSub(strCandidate, strVersion)
1394 next
1395 end if
1396 if strPathOW = "" then strPathOW = CheckForOpenWatcomSub(EnvGet("WATCOM"), strVersion)
1397 if strPathOW = "" then strPathOW = CheckForOpenWatcomSub(PathParent(PathStripFilename(Which("wcc386.exe"))), strVersion)
1398 if strPathOW = "" and g_blnInternalFirst = false then
1399 strPathOW = SearchCommonTools("openwatcom", "v", GetRef("CheckForOpenWatcomSub"), strVersion)
1400 end if
1401
1402 if strPathOW = "" then
1403 PrintResultMsg "OpenWatcom", "not found"
1404 CfgPrintAssign "VBOX_WITH_OPEN_WATCOM", ""
1405 exit sub
1406 end if
1407
1408 CfgPrintAssign "VBOX_WITH_OPEN_WATCOM", "1"
1409 CfgPrintAssign "PATH_TOOL_OPENWATCOM", strPathOW
1410 PrintResult "OpenWatcom v" & strVersion, strPathOW
1411 if StrVersionCompare(strVersion, "2.0") >= 0 then
1412 MsgWarning "We only test building with OpenWatcom 1.9."
1413 end if
1414end sub
1415
1416function OpenWatcomProgramItemCallback(ByRef arrStrings, cStrings, ByRef strUnused)
1417 dim str, off
1418 OpenWatcomProgramItemCallback = ""
1419 if cStrings > 1 then
1420 str = arrStrings(1)
1421 off = InStr(1, str, "\binnt\", vbTextCompare)
1422 if off > 0 then
1423 OpenWatcomProgramItemCallback = Left(str, off - 1)
1424 end if
1425 end if
1426end function
1427
1428function CheckForOpenWatcomSub(strPathOW, ByRef strVersion)
1429 CheckForOpenWatcomSub = ""
1430 if strPathOW <> "" then
1431 LogPrint "Trying: " & strPathOW
1432 if LogDirExists(strPathOW) then
1433 if LogDirExists(strPathOW & "/binnt") _
1434 and LogDirExists(strPathOW & "/h") _
1435 and LogDirExists(strPathOW & "/eddat") _
1436 and LogFileExists(strPathOW, "binnt/wcc386.exe") _
1437 and LogFileExists(strPathOW, "binnt/wcc.exe") _
1438 and LogFileExists(strPathOW, "binnt/wlink.exe") _
1439 and LogFileExists(strPathOW, "binnt/wcl386.exe") _
1440 and LogFileExists(strPathOW, "binnt/wcl.exe") _
1441 and LogFileExists(strPathOW, "binnt/wlib.exe") _
1442 and LogFileExists(strPathOW, "binnt/wasm.exe") _
1443 and LogFileExists(strPathOW, "h/stdarg.h") _
1444 then
1445 ' Some wcl/wcl386 option parsing quirk allows us to specify /whatever
1446 ' and just get the logo text and exit code 0. We use /y as it's a valid option.
1447 dim strOutput
1448 if Shell("""" & DosSlashes(strPathOW & "\binnt\wcl.exe") & """ /y", True, strOutput) = 0 then
1449 dim strPreamble : strPreamble = "Open Watcom C/C++16 Compile and Link Utility Version"
1450 strOutput = StrGetFirstLine(strOutput)
1451 if StrStartsWithI(strOutput, strPreamble) then
1452 strVersion = StrGetFirstWord(Trim(Mid(strOutput, Len(strPreamble) + 1)))
1453 if StrVersionCompare(strVersion, "1.9") >= 0 then
1454 CheckForOpenWatcomSub = UnixSlashes(PathAbs(strPathOW))
1455 else
1456 LogPrint "OpenWatcom version id older than 1.9: " & strVersion
1457 end if
1458 else
1459 LogPrint "Not OpenWatcom: " & strOutput
1460 end if
1461 end if
1462 end if
1463 end if
1464 end if
1465end function
1466
1467
1468''
1469' Checks for any libSDL binaries.
1470'
1471sub CheckForlibSDL(strOptlibSDL)
1472 dim strPathLibSDL, strVersion
1473 PrintHdr "libSDL"
1474
1475 '
1476 ' Try find some SDL library.
1477 '
1478 strPathLibSDL = CheckForLibSDLSub(strOptlibSDL, strVersion)
1479 if strPathlibSDL = "" and g_blnInternalFirst = true then
1480 strPathLibSDL = SearchTargetTools("libsdl", "v", GetRef("CheckForLibSDLSub"), strVersion)
1481 end if
1482
1483 ' Poke about in the LIB and PATH env.vars.
1484 if strPathlibSDL = "" then strPathLibSDL = CheckForlibSDLSub(PathParent(PathStripFilename(WhichEx("LIB", "SDLmain.lib"))), strVersion)
1485 if strPathlibSDL = "" then strPathLibSDL = CheckForlibSDLSub(PathParent(PathStripFilename(Which("..\lib\SDLmain.lib"))), strVersion)
1486 if strPathlibSDL = "" then strPathLibSDL = CheckForlibSDLSub(PathParent(PathStripFilename(Which("SDLmain.lib"))), strVersion)
1487 if strPathlibSDL = "" then strPathLibSDL = CheckForlibSDLSub(PathParent(PathStripFilename(Which("SDL.dll"))), strVersion)
1488
1489 ' The tools again.
1490 if strPathlibSDL = "" and g_blnInternalFirst = false then
1491 strPathLibSDL = SearchTargetTools("libsdl", "v", GetRef("CheckForLibSDLSub"), strVersion)
1492 end if
1493
1494 ' Success?
1495 if strPathlibSDL = "" then
1496 if strOptlibSDL = "" then
1497 MsgError "Can't locate libSDL. Try specify the path with the --with-libSDL=<path> argument. " _
1498 & "If still no luck, consult the configure.log and the build requirements."
1499 else
1500 MsgError "Can't locate libSDL. Please consult the configure.log and the build requirements."
1501 end if
1502 exit sub
1503 end if
1504
1505 strPathLibSDL = UnixSlashes(PathAbs(strPathLibSDL))
1506 CfgPrintAssign "PATH_SDK_LIBSDL", strPathlibSDL
1507
1508 PrintResult "libSDL", strPathlibSDL
1509end sub
1510
1511'' Checks if the specified path points to an usable libSDL or not.
1512function CheckForLibSDLSub(strPathlibSDL, strVersion)
1513 CheckForlibSDLSub = ""
1514 if strPathLibSDL <> "" then
1515 LogPrint "Trying: strPathLibSDL=" & strPathLibSDL
1516 if LogFileExists(strPathLibSDL, "lib/SDL.lib") _
1517 and LogFileExists(strPathLibSDL, "lib/SDLmain.lib") _
1518 and LogFileExists(strPathLibSDL, "lib/SDL.dll") _
1519 then
1520 dim strIncSub : strIncSub = "include"
1521 if DirExists(strPathlibSDL & "/include/SDL") then strIncSub = "include/SDL"
1522 if LogFileExists(strPathLibSDL, strIncSub & "/SDL.h") _
1523 and LogFileExists(strPathLibSDL, strIncSub & "/SDL_syswm.h") _
1524 and LogFileExists(strPathLibSDL, strIncSub & "/SDL_version.h") _
1525 then
1526 strVersion = ""
1527 CheckForLibSDLSub = strPathLibSDL
1528 end if
1529 end if
1530 end if
1531end function
1532
1533
1534''
1535' Checks for libxml2.
1536'
1537sub CheckForXml2(strOptXml2)
1538 dim strPathXml2, str
1539 PrintHdr "libxml2"
1540
1541 '
1542 ' Part of tarball / svn, so we can exit immediately if no path was specified.
1543 '
1544 if (strOptXml2 = "") then
1545 PrintResultMsg "libxml2", "src/lib/libxml2-*"
1546 exit sub
1547 end if
1548
1549 ' Skip if no COM/ATL.
1550 if g_blnDisableCOM then
1551 PrintResultMsg "libxml2", "Skipped (" & g_strDisableCOM & ")"
1552 exit sub
1553 end if
1554
1555 '
1556 ' Try find some xml2 dll/lib.
1557 '
1558 strPathXml2 = ""
1559 if (strPathXml2 = "") And (strOptXml2 <> "") then
1560 if CheckForXml2Sub(strOptXml2) then strPathXml2 = strOptXml2
1561 end if
1562
1563 if strPathXml2 = "" then
1564 str = Which("libxml2.lib")
1565 if str <> "" then
1566 str = PathParent(PathStripFilename(str))
1567 if CheckForXml2Sub(str) then strPathXml2 = str
1568 end if
1569 end if
1570
1571 ' Success?
1572 if strPathXml2 = "" then
1573 if strOptXml2 = "" then
1574 MsgError "Can't locate libxml2. Try specify the path with the --with-libxml2=<path> argument. " _
1575 & "If still no luck, consult the configure.log and the build requirements."
1576 else
1577 MsgError "Can't locate libxml2. Please consult the configure.log and the build requirements."
1578 end if
1579 exit sub
1580 end if
1581
1582 strPathXml2 = UnixSlashes(PathAbs(strPathXml2))
1583 CfgPrintAssign "SDK_VBoxLibXml2_DEFS", "_REENTRANT"
1584 CfgPrintAssign "SDK_VBoxLibXml2_INCS", strPathXml2 & "/include"
1585 CfgPrintAssign "SDK_VBoxLibXml2_LIBS", strPathXml2 & "/lib/libxml2.lib"
1586
1587 PrintResult "libxml2", strPathXml2
1588end sub
1589
1590'' Checks if the specified path points to an usable libxml2 or not.
1591function CheckForXml2Sub(strPathXml2)
1592 dim str
1593
1594 CheckForXml2Sub = False
1595 LogPrint "trying: strPathXml2=" & strPathXml2
1596 if LogFileExists(strPathXml2, "include/libxml/xmlexports.h") _
1597 And LogFileExists(strPathXml2, "include/libxml/xmlreader.h") _
1598 then
1599 str = LogFindFile(strPathXml2, "bin/libxml2.dll")
1600 if str <> "" then
1601 if LogFindFile(strPathXml2, "lib/libxml2.lib") <> "" then
1602 CheckForXml2Sub = True
1603 end if
1604 end if
1605 end if
1606end function
1607
1608
1609'' Checks for openssl
1610sub CheckForSsl(strOptSsl, bln32Bit)
1611 dim strPathSsl, str
1612 PrintHdr "openssl"
1613
1614 strOpenssl = "openssl"
1615 if bln32Bit = True then
1616 strOpenssl = "openssl32"
1617 end if
1618
1619 '
1620 ' Part of tarball / svn, so we can exit immediately if no path was specified.
1621 '
1622 if (strOptSsl = "") then
1623 PrintResult strOpenssl, "src/libs/openssl-*"
1624 exit sub
1625 end if
1626
1627 '
1628 ' Try find some openssl dll/lib.
1629 '
1630 strPathSsl = ""
1631 if (strPathSsl = "") And (strOptSsl <> "") then
1632 if CheckForSslSub(strOptSsl) then strPathSsl = strOptSsl
1633 end if
1634
1635 if strPathSsl = "" then
1636 str = Which("libssl.lib")
1637 if str <> "" then
1638 str = PathParent(PathStripFilename(str))
1639 if CheckForSslSub(str) then strPathSsl = str
1640 end if
1641 end if
1642
1643 ' Success?
1644 if strPathSsl = "" then
1645 if strOptSsl = "" then
1646 MsgError "Can't locate " & strOpenssl & ". " _
1647 & "Try specify the path with the --with-" & strOpenssl & "=<path> argument. " _
1648 & "If still no luck, consult the configure.log and the build requirements."
1649 else
1650 MsgError "Can't locate " & strOpenssl & ". " _
1651 & "Please consult the configure.log and the build requirements."
1652 end if
1653 exit sub
1654 end if
1655
1656 strPathSsl = UnixSlashes(PathAbs(strPathSsl))
1657 if bln32Bit = True then
1658 CfgPrintAssign "SDK_VBoxOpenSslStatic-x86_INCS", strPathSsl & "/include"
1659 CfgPrintAssign "SDK_VBoxOpenSslStatic-x86_LIBS", strPathSsl & "/lib/libcrypto.lib" & " " & strPathSsl & "/lib/libssl.lib"
1660 CfgPrintAssign "SDK_VBoxOpenSslBldProg-x86_LIBS", strPathSsl & "/lib/libcrypto.lib" & " " & strPathSsl & "/lib/libssl.lib"
1661 else
1662 CfgPrintAssign "SDK_VBoxOpenSslStatic_INCS", strPathSsl & "/include"
1663 CfgPrintAssign "SDK_VBoxOpenSslStatic_LIBS", strPathSsl & "/lib/libcrypto.lib" & " " & strPathSsl & "/lib/libssl.lib"
1664 CfgPrintAssign "SDK_VBoxOpenSslBldProg_LIBS", strPathSsl & "/lib/libcrypto.lib" & " " & strPathSsl & "/lib/libssl.lib"
1665 end if
1666
1667 PrintResult strOpenssl, strPathSsl
1668end sub
1669
1670'' Checks if the specified path points to an usable openssl or not.
1671function CheckForSslSub(strPathSsl)
1672
1673 CheckForSslSub = False
1674 LogPrint "trying: strPathSsl=" & strPathSsl
1675 if LogFileExists(strPathSsl, "include/openssl/md5.h") _
1676 And LogFindFile(strPathSsl, "lib/libssl.lib") <> "" _
1677 then
1678 CheckForSslSub = True
1679 end if
1680end function
1681
1682
1683''
1684' Checks for libcurl
1685'
1686sub CheckForCurl(strOptCurl, bln32Bit)
1687 dim strPathCurl, str
1688 PrintHdr "libcurl"
1689
1690 strCurl = "libcurl"
1691 if bln32Bit = True then
1692 strCurl = "libcurl32"
1693 end if
1694
1695 '
1696 ' Part of tarball / svn, so we can exit immediately if no path was specified.
1697 '
1698 if (strOptCurl = "") then
1699 PrintResult strCurl, "src/libs/curl-*"
1700 exit sub
1701 end if
1702
1703 '
1704 ' Try find some cURL dll/lib.
1705 '
1706 strPathCurl = ""
1707 if (strPathCurl = "") And (strOptCurl <> "") then
1708 if CheckForCurlSub(strOptCurl) then strPathCurl = strOptCurl
1709 end if
1710
1711 if strPathCurl = "" then
1712 str = Which("libcurl.lib")
1713 if str <> "" then
1714 str = PathParent(PathStripFilename(str))
1715 if CheckForCurlSub(str) then strPathCurl = str
1716 end if
1717 end if
1718
1719 ' Success?
1720 if strPathCurl = "" then
1721 if strOptCurl = "" then
1722 MsgError "Can't locate " & strCurl & ". " _
1723 & "Try specify the path with the --with-" & strCurl & "=<path> argument. " _
1724 & "If still no luck, consult the configure.log and the build requirements."
1725 else
1726 MsgError "Can't locate " & strCurl & ". " _
1727 & "Please consult the configure.log and the build requirements."
1728 end if
1729 exit sub
1730 end if
1731
1732 strPathCurl = UnixSlashes(PathAbs(strPathCurl))
1733 if bln32Bit = True then
1734 CfgPrintAssign "SDK_VBoxLibCurl-x86_INCS", strPathCurl & "/include"
1735 CfgPrintAssign "SDK_VBoxLibCurl-x86_LIBS.x86", strPathCurl & "/libcurl.lib"
1736 else
1737 CfgPrintAssign "SDK_VBoxLibCurl_INCS", strPathCurl & "/include"
1738 CfgPrintAssign "SDK_VBoxLibCurl_LIBS", strPathCurl & "/libcurl.lib"
1739 end if
1740
1741 PrintResult strCurl, strPathCurl
1742end sub
1743
1744'' Checks if the specified path points to an usable libcurl or not.
1745function CheckForCurlSub(strPathCurl)
1746
1747 CheckForCurlSub = False
1748 LogPrint "trying: strPathCurl=" & strPathCurl
1749 if LogFileExists(strPathCurl, "include/curl/curl.h") _
1750 And LogFindFile(strPathCurl, "libcurl.dll") <> "" _
1751 And LogFindFile(strPathCurl, "libcurl.lib") <> "" _
1752 then
1753 CheckForCurlSub = True
1754 end if
1755end function
1756
1757
1758''
1759' Checks for any Qt binaries.
1760'
1761sub CheckForQt(strOptQt, strOptInfix)
1762 dim strPathQt, strInfixQt, arrFolders, arrVccInfixes, strVccInfix, strPathDev
1763 PrintHdr "Qt"
1764
1765 '
1766 ' Try to find the Qt installation (user specified path with --with-qt)
1767 '
1768 LogPrint "Checking for user specified path of Qt ... "
1769 strPathQt = CheckForQtSub(UnixSlashes(strOptQt), strOptInfix, strInfixQt)
1770 if strPathQt = "" and g_blnInternalFirst = true then strPathQt = CheckForQtInternal(strOptInfix, strInfixQt)
1771 if strPathQt = "" then
1772 '
1773 ' Collect links from "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\UFH\SHC"
1774 '
1775 ' Typical string list:
1776 ' C:\Users\someuser\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Qt\6.x.y\MSVC 20zz (64-bit)\Qt 6.x.y (MSVC 20zz 64-bit).lnk
1777 ' C:\Windows\System32\cmd.exe
1778 ' /A /Q /K E:\qt\installed\6.x.y\msvc20zz_64\bin\qtenv2.bat
1779 '
1780 dim arrCandidates, strCandidate
1781 arrCandidates = CollectFromProgramItemLinks(GetRef("QtProgramItemCallback"), strPathQt)
1782 LogPrint "Testing qtenv2.bat links (" & ArraySize(arrCandidates) & ") ..."
1783
1784 ' VC infixes/subdir names to consider (ASSUMES 64bit)
1785 if g_strVCCVersion = "VCC142" or g_strVCCVersion = "" then
1786 arrVccInfixes = Array("msvc2019_64", "msvc2017_64", "msvc2015_64")
1787 else
1788 MsgFatal "Unexpected VC version: " & g_strVCCVersion
1789 arrVccInfixes = Array()
1790 end if
1791 for each strVccInfix in arrVccInfixes
1792 for each strCandidate in arrCandidates
1793 if InStr(1, LCase(strCandidate), strVccInfix) > 0 then
1794 strPathQt = CheckForQtSub(strCandidate, strOptInfix, strInfixQt)
1795 if strPathQt <> "" then exit for
1796 end if
1797 next
1798 if strPathQt <> "" then exit for
1799 next
1800 end if
1801
1802 ' Check the dev tools - prefer ones matching the compiler.
1803 if strPathQt = "" and g_blnInternalFirst = false then strPathQt = CheckForQtInternal(strOptInfix, strInfixQt)
1804
1805 '
1806 ' Display the result and output the config.
1807 '
1808 if strPathQt <> "" then
1809 PrintResult "Qt", strPathQt
1810 PrintResultMsg "Qt infix", strInfixQt
1811 CfgPrintAssign "PATH_SDK_QT6", strPathQt
1812 CfgPrintAssign "PATH_TOOL_QT6", "$(PATH_SDK_QT6)"
1813 CfgPrintAssign "VBOX_PATH_QT", "$(PATH_SDK_QT6)"
1814 CfgPrintAssign "VBOX_QT_INFIX", strInfixQt
1815 CfgPrintAssign "VBOX_WITH_QT_PAYLOAD", "1"
1816 else
1817 PrintResultMsg "Qt", "not found"
1818 CfgPrintAssign "VBOX_WITH_QTGUI", ""
1819 end if
1820end sub
1821
1822function CheckForQtInternal(strOptInfix, ByRef strInfixQt)
1823 dim strPathDev, arrFolders, arrVccInfixes, strVccInfix, i
1824 CheckForQtInternal = ""
1825 for each strPathDev in g_arrPathDev
1826 LogPrint "Testing tools dir (" & strPathDev & "/win." & g_strTargetArch & "/qt/v6*) ..."
1827 arrFolders = GetSubdirsStartingWithVerSorted(strPathDev & "/win." & g_strTargetArch & "/qt", "v6")
1828 arrVccInfixes = Array(LCase(g_strVCCVersion), Left(LCase(g_strVCCVersion), Len(g_strVCCVersion) - 1), "")
1829 for each strVccInfix in arrVccInfixes
1830 for i = UBound(arrFolders) to LBound(arrFolders) step -1
1831 if strVccInfix = "" or InStr(1, LCase(arrFolders(i)), strVccInfix) > 0 then
1832LogPrint "i="&i&" strVccInfix="&strVccInfix
1833 strPathQt = CheckForQtSub(strPathDev & "/win." & g_strTargetArch & "/qt/" & arrFolders(i), strOptInfix, strInfixQt)
1834 if strPathQt <> "" then
1835 CheckForQtInternal = strPathQt
1836 exit function
1837 end if
1838 end if
1839 next
1840 next
1841 next
1842end function
1843
1844function QtProgramItemCallback(ByRef arrStrings, cStrings, ByRef strUnused)
1845 dim str, off
1846 QtProgramItemCallback = ""
1847 if cStrings >= 3 then
1848 str = Trim(arrStrings(UBound(arrStrings)))
1849 if LCase(Right(str, Len("\bin\qtenv2.bat"))) = "\bin\qtenv2.bat" _
1850 and InStr(1, LCase(str), "\msvc20") > 0 _
1851 and InStr(1, str, ":") > 0 _
1852 then
1853 off = InStr(1, str, ":") - 1
1854 QtProgramItemCallback = Mid(str, off, Len(str) - off - Len("\bin\qtenv2.bat") + 1)
1855 end if
1856 end if
1857end function
1858
1859function CheckForQtSub(strPathQt, strOptInfix, ByRef strInfixQt)
1860 CheckForQtSub = ""
1861 if strPathQt <> "" then
1862 LogPrint "Trying: strPathQt=" & strPathQt
1863
1864 if LogFileExists(strPathQt, "bin/moc.exe") _
1865 and LogFileExists(strPathQt, "bin/uic.exe") _
1866 and LogFileExists(strPathQt, "include/QtWidgets/qwidget.h") _
1867 and LogFileExists(strPathQt, "include/QtWidgets/QApplication") _
1868 and LogFileExists(strPathQt, "include/QtGui/QImage") _
1869 and LogFileExists(strPathQt, "include/QtNetwork/QHostAddress") _
1870 then
1871 ' Infix testing.
1872 if LogFileExists(strPathQt, "lib/Qt6Core.lib") _
1873 and LogFileExists(strPathQt, "lib/Qt6Network.lib") then
1874 LogPrint "found it w/o infix"
1875 strInfixQt = ""
1876 CheckForQtSub = UnixSlashes(PathAbs(strPathQt))
1877 elseif LogFileExists(strPathQt, "lib/Qt6Core" & strOptInfix & ".lib") _
1878 and LogFileExists(strPathQt, "lib/Qt6Network" & strOptInfix & ".lib") then
1879 LogPrint "found it w/ infix: " & strOptInfix & " (option)"
1880 strInfixQt = strOptInfix
1881 CheckForQtSub = UnixSlashes(PathAbs(strPathQt))
1882 elseif LogFileExists(strPathQt, "lib/Qt6CoreVBox.lib") _
1883 and LogFileExists(strPathQt, "lib/Qt6NetworkVBox.lib") then
1884 LogPrint "found it w/ infix: VBox"
1885 strInfixQt = "VBox"
1886 CheckForQtSub = UnixSlashes(PathAbs(strPathQt))
1887 end if
1888 end if
1889 end if
1890end function
1891
1892
1893''
1894' Checks for python.
1895'
1896function CheckForPython(strOptPython)
1897 dim strPathPython, arrVersions, strVer, str
1898 PrintHdr "Python"
1899 CheckForPython = False
1900
1901 '
1902 ' Locate it.
1903 '
1904 strPathPython = CheckForPythonSub(strOptPython)
1905 if strPathPython = "" then
1906 arrVersions = Array("3.12", "3.11", "3.10", "3.9", "3.8", "3.7", "3.6", "3.5", "2.7")
1907 for each strVer in arrVersions
1908 strPathPython = CheckForPythonSub(LogRegGetString("HKLM\SOFTWARE\Python\PythonCore\" & strVer & "\InstallPath\"))
1909 if strPathPython <> "" then exit for
1910 next
1911 end if
1912 if strPathPython = "" then strPathPython = CheckForPythonSub(PathStripFilename(Which("python.exe")))
1913
1914 '
1915 ' Output config & result.
1916 '
1917 CheckForPython = strPathPython <> ""
1918 if CheckForPython then
1919 CfgPrintAssign "VBOX_BLD_PYTHON", strPathPython
1920 PrintResult "Python", strPathPython
1921 else
1922 PrintResultMsg "Python", "not found"
1923 end if
1924end function
1925
1926function CheckForPythonSub(strPathPython)
1927 CheckForPythonSub = ""
1928 if strPathPython <> "" then
1929 if LogFileExists(strPathPython, "python.exe") _
1930 then
1931 CheckForPythonSub = UnixSlashes(PathAbs(strPathPython & "/python.exe"))
1932 end if
1933 end if
1934end function
1935
1936
1937''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
1938' Main function and usage '
1939''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
1940
1941''
1942' Show usage.
1943'
1944sub usage
1945 Print "Usage: cscript configure.vbs [options]"
1946 Print ""
1947 Print "Configuration:"
1948 Print " -h, --help Display this."
1949 Print " --target-arch=x86|amd64 The target architecture."
1950 Print " --continue-on-error Do not stop on errors."
1951 Print " --internal-last Check internal tools (tools/win.*) last."
1952 Print " --internal-first Check internal tools (tools/win.*) first (default)."
1953 Print ""
1954 Print "Components:"
1955 Print " --disable-COM Disables all frontends and API."
1956 Print " --disable-SDL Disables the SDL frontend."
1957 Print " --disable-UDPTunnel"
1958 Print " --disable-pylint Disable use of pylint."
1959 Print ""
1960 Print "Locations:"
1961 Print " --with-kBuild=PATH Where kBuild is to be found."
1962 Print " --with-libSDL=PATH Where libSDL is to be found."
1963 Print " --with-Qt=PATH Where Qt is to be found (optional)."
1964 Print " --with-DDK=PATH Where the WDK is to be found."
1965 Print " --with-SDK=PATH Where the Windows SDK is to be found."
1966 Print " --with-SDK10=PATH Where the Windows 10 SDK/WDK is to be found."
1967 Print " --with-VC=PATH Where the Visual C++ compiler is to be found."
1968 Print " (Expecting bin, include and lib subdirs.)"
1969 Print " --with-VC-Common=PATH Maybe needed for 2015 and older to"
1970 Print " locate the Common7 directory."
1971 Print " --with-python=PATH The python to use."
1972 Print " --with-midl=PATH Where midl.exe is to be found."
1973 Print " --with-yasm=PATH Where YASM is to be found."
1974 Print " --with-nasm=PATH Where NASM is to be found (optional)"
1975 Print " --with-openwatcom=PATH Where OpenWatcom 1.9 is to be found (optional)."
1976 Print " --with-libxml2=PATH To use a libxml2 other than the VBox one (opt)."
1977 Print " --with-openssl=PATH To use an openssl other than the VBox one (opt)."
1978 Print " --with-openssl32=PATH The 32-bit variant of openssl (optional)."
1979 Print " --with-libcurl=PATH To use a cURL other than the VBox one (optional)."
1980 Print " --with-libcurl32=PATH The 32-bit variant of cURL (optional)."
1981 Print ""
1982 Print " --append-tools-dir=PATH, --prepend-tools-dir=PATH"
1983 Print " Adds an alternative tools directory to search."
1984 Print " --append-tools-dir=PATH, --prepend-prog-files=PATH"
1985 Print " Adds an alternative Program Files dir to search."
1986 Print " --append-ewdk-drive=DRIVE, --prepend-ewdk-drive=DRIVE"
1987 Print " Adds an EWDK drive the search list."
1988end sub
1989
1990
1991''
1992' The main() like function.
1993'
1994function Main
1995 dim strOutput
1996
1997 '
1998 ' Write the log header and check that we're not using wscript.
1999 '
2000 LogInit
2001 if UCase(Right(Wscript.FullName, 11)) = "WSCRIPT.EXE" then
2002 Wscript.Echo "This script must be run under CScript."
2003 Main = 1
2004 exit function
2005 end if
2006 SelfTest
2007
2008 '
2009 ' Parse arguments.
2010 '
2011 strOptDDK = ""
2012 strOptkBuild = ""
2013 strOptlibSDL = ""
2014 strOptQt = ""
2015 strOptQtInfix = ""
2016 strOptSDK10 = ""
2017 strOptSDK10Version = ""
2018 strOptVC = ""
2019 strOptVCCommon = ""
2020 strOptMidl = ""
2021 strOptYasm = ""
2022 strOptNasm = ""
2023 strOptOpenWatcom = ""
2024 strOptXml2 = ""
2025 strOptSsl = ""
2026 strOptSsl32 = ""
2027 strOptCurl = ""
2028 strOptCurl32 = ""
2029 strOptPython = ""
2030 blnOptDisableCOM = False
2031 blnOptDisableUDPTunnel = False
2032 blnOptDisableSDL = False
2033 for i = 1 to Wscript.Arguments.Count
2034 dim str, strArg, strPath
2035
2036 ' Separate argument and path value
2037 str = Wscript.Arguments.item(i - 1)
2038 if InStr(1, str, "=") > 0 then
2039 strArg = Mid(str, 1, InStr(1, str, "=") - 1)
2040 strPath = Mid(str, InStr(1, str, "=") + 1)
2041 if strPath = "" then MsgFatal "Syntax error! Argument #" & i & " is missing the path."
2042 else
2043 strArg = str
2044 strPath = ""
2045 end if
2046
2047 ' Process the argument
2048 select case LCase(strArg)
2049 ' --with-something:
2050 case "--with-ddk"
2051 strOptDDK = strPath
2052 case "--with-dxsdk"
2053 MsgWarning "Ignoring --with-dxsdk (the DirectX SDK is no longer required)."
2054 case "--with-kbuild"
2055 strOptkBuild = strPath
2056 case "--with-libsdl"
2057 strOptlibSDL = strPath
2058 case "--with-mingw32"
2059 ' ignore
2060 case "--with-mingw-w64"
2061 ' ignore
2062 case "--with-qt"
2063 strOptQt = strPath
2064 case "--with-qt-infix"
2065 strOptQtInfix = strPath
2066 case "--with-sdk"
2067 MsgWarning "Ignoring --with-sdk (the legacy Platform SDK is no longer required)."
2068 case "--with-sdk10"
2069 strOptSDK10 = strPath
2070 case "--with-sdk10-version"
2071 strOptSDK10Version = strPath
2072 case "--with-vc"
2073 strOptVC = strPath
2074 case "--with-vc-common"
2075 strOptVCCommon = strPath
2076 case "--with-vc-express-edition"
2077 ' ignore
2078 case "--with-w32api"
2079 ' ignore
2080 case "--with-midl"
2081 strOptMidl = strPath
2082 case "--with-yasm"
2083 strOptYasm = strPath
2084 case "--with-nasm"
2085 strOptNasm = strPath
2086 case "--with-openwatcom"
2087 strOptOpenWatcom = strPath
2088 case "--with-libxml2"
2089 strOptXml2 = strPath
2090 case "--with-openssl"
2091 strOptSsl = strPath
2092 case "--with-openssl32"
2093 strOptSsl32 = strPath
2094 case "--with-libcurl"
2095 strOptCurl = strPath
2096 case "--with-libcurl32"
2097 strOptCurl32 = strPath
2098 case "--with-python"
2099 strOptPython = strPath
2100
2101 ' Search lists.
2102 case "--append-tools-dir"
2103 g_arrToolsDirs = ArrayAppend(g_arrPathDev, strPath)
2104 case "--prepend-tools-dir"
2105 g_arrToolsDirs = ArrayPrepend(g_arrPathDev, strPath)
2106 case "--append-prog-files"
2107 g_arrProgramFiles = ArrayAppend(g_arrProgramFiles, strPath)
2108 case "--prepend-prog-files"
2109 g_arrProgramFiles = ArrayPrepend(g_arrProgramFiles, strPath)
2110 case "--append-ewdk-drive"
2111 g_arrProgramFiles = ArrayAppend(g_arrProgramFiles, strPath & "\Program Files")
2112 case "--prepend-ewdk-drive"
2113 g_arrProgramFiles = ArrayPrepend(g_arrProgramFiles, strPath & "\Program Files")
2114
2115 ' --disable-something/--enable-something
2116 case "--disable-com"
2117 blnOptDisableCOM = True
2118 case "--enable-com"
2119 blnOptDisableCOM = False
2120 case "--disable-udptunnel"
2121 blnOptDisableUDPTunnel = True
2122 case "--enable-udptunnel"
2123 blnOptDisableUDPTunnel = False
2124 case "--disable-sdl"
2125 blnOptDisableSDL = True
2126 case "--endable-sdl"
2127 blnOptDisableSDL = False
2128 case "--disable-pylint"
2129 blnOptDisablePylint = True
2130 case "--enable-pylint"
2131 blnOptDisablePylint = False
2132
2133 ' Other stuff.
2134 case "--continue-on-error"
2135 g_blnContinueOnError = True
2136 case "--internal-first"
2137 g_blnInternalFirst = True
2138 case "--internal-last"
2139 g_blnInternalFirst = False
2140 case "--target-arch"
2141 g_strTargetArch = strPath
2142 case "-h", "--help", "-?"
2143 usage
2144 Main = 0
2145 exit function
2146 case else
2147 Wscript.echo "syntax error: Unknown option '" & str &"'."
2148 usage
2149 Main = 2
2150 exit function
2151 end select
2152 next
2153
2154 '
2155 ' Initialize output files.
2156 '
2157 CfgInit
2158 EnvInit
2159
2160 '
2161 ' Check that the Shell function is sane.
2162 '
2163 g_objShell.Environment("PROCESS")("TESTING_ENVIRONMENT_INHERITANCE") = "This works"
2164 if Shell("set TESTING_ENVIRONMENT_INHERITANC", False, strOutput) <> 0 then ' The 'E' is missing on purpose (4nt).
2165 MsgFatal "shell execution test failed!"
2166 end if
2167 if strOutput <> "TESTING_ENVIRONMENT_INHERITANCE=This works" & CHR(13) & CHR(10) then
2168 Print "Shell test Test -> '" & strOutput & "'"
2169 MsgFatal "shell inheritance or shell execution isn't working right. Make sure you use cmd.exe."
2170 end if
2171 g_objShell.Environment("PROCESS")("TESTING_ENVIRONMENT_INHERITANCE") = ""
2172 Print "Shell inheritance test: OK"
2173
2174 '
2175 ' Do the checks.
2176 '
2177 if blnOptDisableCOM = True then
2178 DisableCOM "--disable-com"
2179 end if
2180 if blnOptDisableUDPTunnel = True then
2181 DisableUDPTunnel "--disable-udptunnel"
2182 end if
2183 if blnOptDisablePylint = True then
2184 CfgPrintAssign "override VBOX_WITH_PYLINT", ""
2185 end if
2186 CheckSourcePath
2187 CheckForkBuild strOptkBuild
2188 CheckForWinDDK strOptDDK
2189 CheckForVisualCPP strOptVC, strOptVCCommon
2190 CheckForSDK10 strOptSDK10, strOptSDK10Version
2191 CheckForMidl strOptMidl
2192 CheckForYasm strOptYasm
2193 CheckForNasm strOptNasm
2194 CheckForOpenWatcom strOptOpenWatcom
2195 if blnOptDisableSDL = True then
2196 DisableSDL "--disable-sdl"
2197 else
2198 CheckForlibSDL strOptlibSDL
2199 end if
2200 CheckForXml2 strOptXml2
2201 CheckForSsl strOptSsl, False
2202 if g_strTargetArch = "amd64" then
2203 ' 32-bit openssl required as well
2204 CheckForSsl strOptSsl32, True
2205 end if
2206 CheckForCurl strOptCurl, False
2207 if g_strTargetArch = "amd64" then
2208 ' 32-bit Curl required as well
2209 CheckForCurl strOptCurl32, True
2210 end if
2211 CheckForQt strOptQt, strOptQtInfix
2212 CheckForPython strOptPython
2213 CfgPrintAssign "VBOX_WITH_LIBVPX", "" '' @todo look for libvpx 1.1.0+
2214 CfgPrintAssign "VBOX_WITH_LIBOGG", "" '' @todo look for libogg 1.3.5+
2215 CfgPrintAssign "VBOX_WITH_LIBVORBIS", "" '' @todo look for libvorbis 1.3.7+
2216
2217 EnvPrintAppend "PATH", DosSlashes(g_strPath & "\tools\win." & g_strHostArch & "\bin"), ";"
2218 if g_strHostArch = "amd64" then
2219 EnvPrintAppend "PATH", DosSlashes(g_strPath & "\tools\win.x86\bin"), ";"
2220 else
2221 EnvPrintCleanup "PATH", DosSlashes(g_strPath & "\tools\win.amd64\bin"), ";"
2222 end if
2223
2224 Print ""
2225 Print "Execute env.bat once before you start to build VBox:"
2226 Print ""
2227 Print " env.bat"
2228 Print " kmk"
2229 Print ""
2230 if g_rcScript <> 0 then
2231 Print "Warning: ignored errors. See above or in configure.log."
2232 end if
2233
2234 Main = g_rcScript
2235end function
2236
2237'
2238' What crt0.o typically does:
2239'
2240WScript.Quit(Main())
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette