VirtualBox

source: vbox/trunk/configure.vbs@ 85672

Last change on this file since 85672 was 85653, checked in by vboxsync, 4 years ago

configure.vbs: OpenSSL is now part of the tarball, just like libxml2 is.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Id
File size: 64.4 KB
Line 
1' $Id: configure.vbs 85653 2020-08-09 12:22:43Z 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'*****************************************************************************
27dim g_strPath, g_strEnvFile, g_strLogFile, g_strCfgFile, g_strShellOutput
28g_strPath = Left(Wscript.ScriptFullName, Len(Wscript.ScriptFullName) - Len("\configure.vbs"))
29g_strEnvFile = g_strPath & "\env.bat"
30g_strCfgFile = g_strPath & "\AutoConfig.kmk"
31g_strLogFile = g_strPath & "\configure.log"
32'g_strTmpFile = g_strPath & "\configure.tmp"
33
34dim g_objShell, g_objFileSys
35Set g_objShell = WScript.CreateObject("WScript.Shell")
36Set g_objFileSys = WScript.CreateObject("Scripting.FileSystemObject")
37
38dim g_strPathkBuild, g_strPathkBuildBin, g_strPathDev, g_strPathVCC, g_strPathPSDK, g_strVerPSDK, g_strPathDDK, g_strSubOutput
39g_strPathkBuild = ""
40g_strPathDev = ""
41g_strPathVCC = ""
42g_strPathPSDK = ""
43g_strPathDDK = ""
44
45dim g_strTargetArch
46g_strTargetArch = ""
47
48dim g_strHostArch
49g_strHostArch = ""
50
51dim g_blnDisableCOM, g_strDisableCOM
52g_blnDisableCOM = False
53g_strDisableCOM = ""
54
55' The internal mode is primarily for skipping some large libraries.
56dim g_blnInternalMode
57g_blnInternalMode = False
58
59' Whether to try the internal stuff first or last.
60dim g_blnInternalFirst
61g_blnInternalFirst = True
62
63
64
65''
66' Converts to unix slashes
67function UnixSlashes(str)
68 UnixSlashes = replace(str, "\", "/")
69end function
70
71
72''
73' Converts to dos slashes
74function DosSlashes(str)
75 DosSlashes = replace(str, "/", "\")
76end function
77
78
79''
80' Read a file (typically the tmp file) into a string.
81function 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
90end function
91
92
93''
94' Deletes a file
95sub FileDelete(strFilename)
96 if g_objFileSys.FileExists(DosSlashes(strFilename)) then
97 g_objFileSys.DeleteFile(DosSlashes(strFilename))
98 end if
99end sub
100
101
102''
103' Appends a line to an ascii file.
104sub 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()
111end sub
112
113
114''
115' Checks if the file exists.
116function FileExists(strFilename)
117 FileExists = g_objFileSys.FileExists(DosSlashes(strFilename))
118end function
119
120
121''
122' Checks if the directory exists.
123function DirExists(strDirectory)
124 DirExists = g_objFileSys.FolderExists(DosSlashes(strDirectory))
125end function
126
127
128''
129' Checks if this is a WOW64 process.
130function IsWow64()
131 if g_objShell.Environment("PROCESS")("PROCESSOR_ARCHITEW6432") <> "" then
132 IsWow64 = 1
133 else
134 IsWow64 = 0
135 end if
136end function
137
138
139''
140' Returns a reverse sorted array (strings).
141function 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
154end function
155
156
157''
158' Prints a string array.
159sub ArrayPrintStrings(arrStrings, strPrefix)
160 for i = LBound(arrStrings) to UBound(arrStrings)
161 Print strPrefix & "arrStrings(" & i & ") = '" & arrStrings(i) & "'"
162 next
163end sub
164
165
166''
167' Returns a reverse sorted array (strings).
168function 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
185end function
186
187
188''
189' Returns the input array with the string appended.
190' Note! There must be some better way of doing this...
191function 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
200end function
201
202
203
204''
205' Translates a register root name to a value
206function 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
218end function
219
220
221'' The registry globals
222dim g_objReg, g_objRegCtx
223dim g_blnRegistry
224g_blnRegistry = false
225
226
227''
228' Init the register provider globals.
229function 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
245end function
246
247
248''
249' Gets a value from the registry. Returns "" if string wasn't found / valid.
250function 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
276end function
277
278
279''
280' Returns an array of subkey strings.
281function 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
306end function
307
308
309''
310' Returns an array of full path subkey strings.
311function 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
318end function
319
320
321''
322' Returns an rsorted array of subkey strings.
323function RegEnumSubKeysRSort(strRoot, strKeyPath)
324 RegEnumSubKeysRSort = ArrayRSortStrings(RegEnumSubKeys(strRoot, strKeyPath))
325end function
326
327
328''
329' Returns an rsorted array of subkey strings.
330function RegEnumSubKeysFullRSort(strRoot, strKeyPath)
331 RegEnumSubKeysFullRSort = ArrayRSortStrings(RegEnumSubKeysFull(strRoot, strKeyPath))
332end function
333
334
335''
336' Gets the commandline used to invoke the script.
337function 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
351end function
352
353
354''
355' Gets an environment variable.
356function EnvGet(strName)
357 EnvGet = g_objShell.Environment("PROCESS")(strName)
358end function
359
360
361''
362' Sets an environment variable.
363sub EnvSet(strName, strValue)
364 g_objShell.Environment("PROCESS")(strName) = strValue
365 LogPrint "EnvSet: " & strName & "=" & strValue
366end sub
367
368
369''
370' Appends a string to an environment variable
371sub 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
376end sub
377
378
379''
380' Prepends a string to an environment variable
381sub 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
386end sub
387
388''
389' Gets the first non-empty environment variable of the given two.
390function EnvGetFirst(strName1, strName2)
391 EnvGetFirst = g_objShell.Environment("PROCESS")(strName1)
392 if EnvGetFirst = "" then
393 EnvGetFirst = g_objShell.Environment("PROCESS")(strName2)
394 end if
395end function
396
397
398''
399' Get the path of the parent directory. Returns root if root was specified.
400' Expects abs path.
401function PathParent(str)
402 PathParent = g_objFileSys.GetParentFolderName(DosSlashes(str))
403end function
404
405
406''
407' Strips the filename from at path.
408function PathStripFilename(str)
409 PathStripFilename = g_objFileSys.GetParentFolderName(DosSlashes(str))
410end function
411
412
413''
414' Get the abs path, use the short version if necessary.
415function 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
457end function
458
459
460''
461' Get the abs path, use the long version.
462function 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
488end function
489
490
491''
492' Executes a command in the shell catching output in g_strShellOutput
493function 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
519end function
520
521
522''
523' Try find the specified file in the path.
524function 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 = ""
546end function
547
548
549''
550' Right pads a string with spaces to the given length
551function RightPad(str, cch)
552 if Len(str) < cch then
553 RightPad = str & String(cch - Len(str), " ")
554 else
555 RightPad = str
556 end if
557end function
558
559''
560' Append text to the log file and echo it to stdout
561sub Print(str)
562 LogPrint str
563 Wscript.Echo str
564end sub
565
566
567''
568' Prints a test header
569sub PrintHdr(strTest)
570 LogPrint "***** Checking for " & strTest & " *****"
571 Wscript.Echo "Checking for " & StrTest & "..."
572end sub
573
574
575''
576' Prints a success message
577sub PrintResultMsg(strTest, strResult)
578 dim cchPad
579 LogPrint "** " & strTest & ": " & strResult
580 Wscript.Echo " Found " & RightPad(strTest & ": ", 18) & strPad & strResult
581end sub
582
583
584''
585' Prints a successfully detected path
586sub 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
595end sub
596
597
598''
599' Warning message.
600sub MsgWarning(strMsg)
601 Print "warning: " & strMsg
602end sub
603
604
605''
606' Fatal error.
607sub MsgFatal(strMsg)
608 Print "fatal error: " & strMsg
609 Wscript.Quit
610end sub
611
612
613''
614' Error message, fatal unless flag to ignore errors is given.
615sub MsgError(strMsg)
616 Print "error: " & strMsg
617 if g_blnInternalMode = False then
618 Wscript.Quit
619 end if
620end sub
621
622
623''
624' Write a log header with some basic info.
625sub 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 "#"
654end sub
655
656
657''
658' Append text to the log file.
659sub LogPrint(str)
660 FileAppendLine g_strLogFile, str
661 'Wscript.Echo "dbg: " & str
662end sub
663
664
665''
666' Checks if the file exists and logs failures.
667function LogFileExists(strPath, strFilename)
668 LogFileExists = FileExists(strPath & "/" & strFilename)
669 if LogFileExists = False then
670 LogPrint "Testing '" & strPath & "': " & strFilename & " not found"
671 end if
672
673end function
674
675
676''
677' Finds the first file matching the pattern.
678' If no file is found, log the failure.
679function 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
696end 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.
703function 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
722end function
723
724
725''
726' Initializes the config file.
727sub 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
737end sub
738
739
740''
741' Prints a string to the config file.
742sub CfgPrint(str)
743 FileAppendLine g_strCfgFile, str
744end sub
745
746
747''
748' Initializes the environment batch script.
749sub EnvInit
750 FileDelete g_strEnvFile
751 EnvPrint "@echo off"
752 EnvPrint "rem"
753 EnvPrint "rem Environment setup script generated by " & GetCommandline()
754 EnvPrint "rem"
755end sub
756
757
758''
759' Prints a string to the environment batch script.
760sub EnvPrint(str)
761 FileAppendLine g_strEnvFile, str
762end sub
763
764
765''
766' No COM
767sub DisableCOM(strReason)
768 if g_blnDisableCOM = False then
769 LogPrint "Disabled COM components: " & strReason
770 g_blnDisableCOM = True
771 g_strDisableCOM = strReason
772 CfgPrint "VBOX_WITH_MAIN="
773 CfgPrint "VBOX_WITH_QTGUI="
774 CfgPrint "VBOX_WITH_VBOXSDL="
775 CfgPrint "VBOX_WITH_DEBUGGER_GUI="
776 end if
777end sub
778
779
780''
781' No UDPTunnel
782sub DisableUDPTunnel(strReason)
783 if g_blnDisableUDPTunnel = False then
784 LogPrint "Disabled UDPTunnel network transport: " & strReason
785 g_blnDisableUDPTunnel = True
786 g_strDisableUDPTunnel = strReason
787 CfgPrint "VBOX_WITH_UDPTUNNEL="
788 end if
789end sub
790
791
792''
793' No SDL
794sub DisableSDL(strReason)
795 if g_blnDisableSDL = False then
796 LogPrint "Disabled SDL frontend: " & strReason
797 g_blnDisableSDL = True
798 g_strDisableSDL = strReason
799 CfgPrint "VBOX_WITH_VBOXSDL="
800 end if
801end sub
802
803
804''
805' Checks the the path doesn't contain characters the tools cannot deal with.
806sub CheckSourcePath
807 dim sPwd
808
809 sPwd = PathAbs(g_strPath)
810 if InStr(1, sPwd, " ") > 0 then
811 MsgError "Source path contains spaces! Please move it. (" & sPwd & ")"
812 end if
813 if InStr(1, sPwd, "$") > 0 then
814 MsgError "Source path contains the '$' char! Please move it. (" & sPwd & ")"
815 end if
816 if InStr(1, sPwd, "%") > 0 then
817 MsgError "Source path contains the '%' char! Please move it. (" & sPwd & ")"
818 end if
819 if InStr(1, sPwd, Chr(10)) > 0 _
820 Or InStr(1, sPwd, Chr(13)) > 0 _
821 Or InStr(1, sPwd, Chr(9)) > 0 _
822 then
823 MsgError "Source path contains control characters! Please move it. (" & sPwd & ")"
824 end if
825 Print "Source path: OK"
826end sub
827
828
829''
830' Checks for kBuild - very simple :)
831sub CheckForkBuild(strOptkBuild)
832 PrintHdr "kBuild"
833
834 '
835 ' Check if there is a 'kmk' in the path somewhere without
836 ' any KBUILD_*PATH stuff around.
837 '
838 blnNeedEnvVars = True
839 g_strPathkBuild = strOptkBuild
840 g_strPathkBuildBin = ""
841 if (g_strPathkBuild = "") _
842 And (EnvGetFirst("KBUILD_PATH", "PATH_KBUILD") = "") _
843 And (EnvGetFirst("KBUILD_BIN_PATH", "PATH_KBUILD_BIN") = "") _
844 And (Shell("kmk.exe --version", True) = 0) _
845 And (InStr(1,g_strShellOutput, "kBuild Make 0.1") > 0) _
846 And (InStr(1,g_strShellOutput, "KBUILD_PATH") > 0) _
847 And (InStr(1,g_strShellOutput, "KBUILD_BIN_PATH") > 0) then
848 '' @todo Need to parse out the KBUILD_PATH and KBUILD_BIN_PATH values to complete the other tests.
849 'blnNeedEnvVars = False
850 MsgWarning "You've installed kBuild it seems. configure.vbs hasn't been updated to " _
851 & "deal with that yet and will use the one it ships with. Sorry."
852 end if
853
854 '
855 ' Check for the KBUILD_PATH env.var. and fall back on root/kBuild otherwise.
856 '
857 if g_strPathkBuild = "" then
858 g_strPathkBuild = EnvGetFirst("KBUILD_PATH", "PATH_KBUILD")
859 if (g_strPathkBuild <> "") and (FileExists(g_strPathkBuild & "/footer.kmk") = False) then
860 MsgWarning "Ignoring incorrect kBuild path (KBUILD_PATH=" & g_strPathkBuild & ")"
861 g_strPathkBuild = ""
862 end if
863
864 if g_strPathkBuild = "" then
865 g_strPathkBuild = g_strPath & "/kBuild"
866 end if
867 end if
868
869 g_strPathkBuild = UnixSlashes(PathAbs(g_strPathkBuild))
870
871 '
872 ' Check for env.vars that kBuild uses (do this early to set g_strTargetArch).
873 '
874 str = EnvGetFirst("KBUILD_TYPE", "BUILD_TYPE")
875 if (str <> "") _
876 And (InStr(1, "|release|debug|profile|kprofile", str) <= 0) then
877 EnvPrint "set KBUILD_TYPE=release"
878 EnvSet "KBUILD_TYPE", "release"
879 MsgWarning "Found unknown KBUILD_TYPE value '" & str &"' in your environment. Setting it to 'release'."
880 end if
881
882 str = EnvGetFirst("KBUILD_TARGET", "BUILD_TARGET")
883 if (str <> "") _
884 And (InStr(1, "win|win32|win64", str) <= 0) then '' @todo later only 'win' will be valid. remember to fix this check!
885 EnvPrint "set KBUILD_TARGET=win"
886 EnvSet "KBUILD_TARGET", "win"
887 MsgWarning "Found unknown KBUILD_TARGET value '" & str &"' in your environment. Setting it to 'win32'."
888 end if
889
890 str = EnvGetFirst("KBUILD_TARGET_ARCH", "BUILD_TARGET_ARCH")
891 if (str <> "") _
892 And (InStr(1, "x86|amd64", str) <= 0) then
893 EnvPrint "set KBUILD_TARGET_ARCH=x86"
894 EnvSet "KBUILD_TARGET_ARCH", "x86"
895 MsgWarning "Found unknown KBUILD_TARGET_ARCH value '" & str &"' in your environment. Setting it to 'x86'."
896 str = "x86"
897 end if
898 if g_strTargetArch = "" then '' command line parameter --target-arch=x86|amd64 has priority
899 if str <> "" then
900 g_strTargetArch = str
901 elseif (EnvGet("PROCESSOR_ARCHITEW6432") = "AMD64" ) _
902 Or (EnvGet("PROCESSOR_ARCHITECTURE") = "AMD64" ) then
903 g_strTargetArch = "amd64"
904 else
905 g_strTargetArch = "x86"
906 end if
907 else
908 if InStr(1, "x86|amd64", g_strTargetArch) <= 0 then
909 EnvPrint "set KBUILD_TARGET_ARCH=x86"
910 EnvSet "KBUILD_TARGET_ARCH", "x86"
911 MsgWarning "Unknown --target-arch=" & str &". Setting it to 'x86'."
912 end if
913 end if
914 LogPrint " Target architecture: " & g_strTargetArch & "."
915 Wscript.Echo " Target architecture: " & g_strTargetArch & "."
916 EnvPrint "set KBUILD_TARGET_ARCH=" & g_strTargetArch
917
918 str = EnvGetFirst("KBUILD_TARGET_CPU", "BUILD_TARGET_CPU")
919 ' perhaps a bit pedantic this since this isn't clearly define nor used much...
920 if (str <> "") _
921 And (InStr(1, "i386|i486|i686|i786|i868|k5|k6|k7|k8", str) <= 0) then
922 EnvPrint "set BUILD_TARGET_CPU=i386"
923 EnvSet "KBUILD_TARGET_CPU", "i386"
924 MsgWarning "Found unknown KBUILD_TARGET_CPU value '" & str &"' in your environment. Setting it to 'i386'."
925 end if
926
927 str = EnvGetFirst("KBUILD_HOST", "BUILD_PLATFORM")
928 if (str <> "") _
929 And (InStr(1, "win|win32|win64", str) <= 0) then '' @todo later only 'win' will be valid. remember to fix this check!
930 EnvPrint "set KBUILD_HOST=win"
931 EnvSet "KBUILD_HOST", "win"
932 MsgWarning "Found unknown KBUILD_HOST value '" & str &"' in your environment. Setting it to 'win32'."
933 end if
934
935 str = EnvGetFirst("KBUILD_HOST_ARCH", "BUILD_PLATFORM_ARCH")
936 if str <> "" then
937 if InStr(1, "x86|amd64", str) <= 0 then
938 str = "x86"
939 MsgWarning "Found unknown KBUILD_HOST_ARCH value '" & str &"' in your environment. Setting it to 'x86'."
940 end if
941 elseif (EnvGet("PROCESSOR_ARCHITEW6432") = "AMD64" ) _
942 Or (EnvGet("PROCESSOR_ARCHITECTURE") = "AMD64" ) then
943 str = "amd64"
944 else
945 str = "x86"
946 end if
947 LogPrint " Host architecture: " & str & "."
948 Wscript.Echo " Host architecture: " & str & "."
949 EnvPrint "set KBUILD_HOST_ARCH=" & str
950 g_strHostArch = str
951
952 str = EnvGetFirst("KBUILD_HOST_CPU", "BUILD_PLATFORM_CPU")
953 ' perhaps a bit pedantic this since this isn't clearly define nor used much...
954 if (str <> "") _
955 And (InStr(1, "i386|i486|i686|i786|i868|k5|k6|k7|k8", str) <= 0) then
956 EnvPrint "set KBUILD_HOST_CPU=i386"
957 EnvSet "KBUILD_HOST_CPU", "i386"
958 MsgWarning "Found unknown KBUILD_HOST_CPU value '" & str &"' in your environment. Setting it to 'i386'."
959 end if
960
961 '
962 ' Determin the location of the kBuild binaries.
963 '
964 if g_strPathkBuildBin = "" then
965 g_strPathkBuildBin = g_strPathkBuild & "/bin/win." & g_strHostArch
966 if FileExists(g_strPathkBuildBin & "/kmk.exe") = False then
967 g_strPathkBuildBin = g_strPathkBuild & "/bin/win.x86"
968 end if
969 end if
970
971 '
972 ' Perform basic validations of the kBuild installation.
973 '
974 if (FileExists(g_strPathkBuild & "/footer.kmk") = False) _
975 Or (FileExists(g_strPathkBuild & "/header.kmk") = False) _
976 Or (FileExists(g_strPathkBuild & "/rules.kmk") = False) then
977 MsgFatal "Can't find valid kBuild at '" & g_strPathkBuild & "'. Either there is an " _
978 & "incorrect KBUILD_PATH in the environment or the checkout didn't succeed."
979 exit sub
980 end if
981 if (FileExists(g_strPathkBuildBin & "/kmk.exe") = False) _
982 Or (FileExists(g_strPathkBuildBin & "/kmk_ash.exe") = False) then
983 MsgFatal "Can't find valid kBuild binaries at '" & g_strPathkBuildBin & "'. Either there is an " _
984 & "incorrect KBUILD_PATH in the environment or the checkout didn't succeed."
985 exit sub
986 end if
987
988 if (Shell(DosSlashes(g_strPathkBuildBin & "/kmk.exe") & " --version", True) <> 0) Then
989 MsgFatal "Can't execute '" & g_strPathkBuildBin & "/kmk.exe --version'. check configure.log for the out."
990 exit sub
991 end if
992
993 '
994 ' If PATH_DEV is set, check that it's pointing to something useful.
995 '
996 str = EnvGet("PATH_DEV")
997 g_strPathDev = str
998 if (str <> "") _
999 And False then '' @todo add some proper tests here.
1000 strNew = UnixSlashes(g_strPath & "/tools")
1001 EnvPrint "set PATH_DEV=" & strNew
1002 EnvSet "PATH_DEV", strNew
1003 MsgWarning "Found PATH_DEV='" & str &"' in your environment. Setting it to '" & strNew & "'."
1004 g_strPathDev = strNew
1005 end if
1006 if g_strPathDev = "" then g_strPathDev = UnixSlashes(g_strPath & "/tools")
1007
1008 '
1009 ' Write KBUILD_PATH to the environment script if necessary.
1010 '
1011 if blnNeedEnvVars = True then
1012 EnvPrint "set KBUILD_PATH=" & g_strPathkBuild
1013 EnvSet "KBUILD_PATH", g_strPathkBuild
1014 EnvPrint "set PATH=" & g_strPathkBuildBin & ";%PATH%"
1015 EnvPrepend "PATH", g_strPathkBuildBin & ";"
1016 end if
1017
1018 PrintResult "kBuild", g_strPathkBuild
1019 PrintResult "kBuild binaries", g_strPathkBuildBin
1020end sub
1021
1022
1023''
1024' Checks for Visual C++ version 10 (2010).
1025sub CheckForVisualCPP(strOptVC, strOptVCCommon, blnOptVCExpressEdition)
1026 dim strPathVC, strPathVCCommon, str, str2, blnNeedMsPDB
1027 PrintHdr "Visual C++"
1028
1029 '
1030 ' Try find it...
1031 '
1032 strPathVC = ""
1033 strPathVCCommon = ""
1034 if (strPathVC = "") And (strOptVC <> "") then
1035 if CheckForVisualCPPSub(strOptVC, strOptVCCommon, blnOptVCExpressEdition) then
1036 strPathVC = strOptVC
1037 strPathVCCommon = strOptVCCommon
1038 end if
1039 end if
1040
1041 if (strPathVC = "") And (g_blnInternalFirst = True) Then
1042 strPathVC = g_strPathDev & "/win.x86/vcc/v10sp1"
1043 if CheckForVisualCPPSub(strPathVC, "", blnOptVCExpressEdition) = False then
1044 strPathVC = ""
1045 end if
1046 end if
1047
1048 if (strPathVC = "") _
1049 And (Shell("cl.exe", True) = 0) then
1050 str = Which("cl.exe")
1051 if FileExists(PathStripFilename(strClExe) & "/build.exe") then
1052 ' don't know how to deal with this cl.
1053 Warning "Ignoring DDK cl.exe (" & str & ")."
1054 else
1055 strPathVC = PathParent(PathStripFilename(str))
1056 strPathVCCommon = PathParent(strPathVC) & "/Common7"
1057 end if
1058 end if
1059
1060 if (strPathVC = "") then
1061 str = RegGetString("HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Setup\VS\ProductDir")
1062 if str <> "" Then
1063 str2 = str & "Common7"
1064 str = str & "VC"
1065 if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
1066 strPathVC = str
1067 strPathVCCommon = str2
1068 end if
1069 end if
1070 end if
1071
1072 if (strPathVC = "") then
1073 str = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\10.0\Setup\VS\ProductDir")
1074 if str <> "" Then
1075 str2 = str & "Common7"
1076 str = str & "VC"
1077 if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
1078 strPathVC = str
1079 strPathVCCommon = str2
1080 end if
1081 end if
1082 end if
1083
1084 if (strPathVC = "") And (g_blnInternalFirst = False) Then
1085 strPathVC = g_strPathDev & "/win.x86/vcc/v10sp1"
1086 if CheckForVisualCPPSub(strPathVC, "", blnOptVCExpressEdition) = False then
1087 strPathVC = ""
1088 end if
1089 end if
1090
1091 if strPathVC = "" then
1092 MsgError "Cannot find cl.exe (Visual C++) anywhere on your system. Check the build requirements."
1093 exit sub
1094 end if
1095
1096 '
1097 ' Clean up the path and determin the VC directory.
1098 '
1099 strPathVC = UnixSlashes(PathAbs(strPathVC))
1100 g_strPathVCC = strPathVC
1101
1102 '
1103 ' Check the version.
1104 ' We'll have to make sure mspdbXX.dll is somewhere in the PATH.
1105 '
1106 if (strPathVCCommon <> "") Then
1107 EnvAppend "PATH", ";" & strPathVCCommon & "/IDE"
1108 end if
1109 if Shell(DosSlashes(strPathVC & "/bin/cl.exe"), True) <> 0 then
1110 MsgError "Executing '" & strClExe & "' (which we believe to be the Visual C++ compiler driver) failed."
1111 exit sub
1112 end if
1113
1114 if (InStr(1, g_strShellOutput, "Version 16.") <= 0) _
1115 And (InStr(1, g_strShellOutput, "Version 17.") <= 0) then
1116 MsgError "The Visual C++ compiler we found ('" & strPathVC & "') isn't 10.0 or 11.0. Check the build requirements."
1117 exit sub
1118 end if
1119
1120 '
1121 ' Ok, emit build config variables.
1122 '
1123 if InStr(1, g_strShellOutput, "Version 16.") > 0 then
1124 CfgPrint "PATH_TOOL_VCC100 := " & g_strPathVCC
1125 CfgPrint "PATH_TOOL_VCC100X86 := $(PATH_TOOL_VCC100)"
1126 CfgPrint "PATH_TOOL_VCC100AMD64 := $(PATH_TOOL_VCC100)"
1127 CfgPrint "VBOX_WITH_NEW_VCC :="
1128 if LogFileExists(strPathVC, "atlmfc/include/atlbase.h") then
1129 PrintResult "Visual C++ v10 with ATL", g_strPathVCC
1130 elseif LogFileExists(g_strPathDDK, "inc/atl71/atlbase.h") _
1131 And LogFileExists(g_strPathDDK, "lib/ATL/i386/atls.lib") then
1132 CfgPrint "VBOX_WITHOUT_COMPILER_REDIST=1"
1133 CfgPrint "PATH_TOOL_VCC100_ATLMFC_INC = " & g_strPathDDK & "/inc/atl71"
1134 CfgPrint "PATH_TOOL_VCC100_ATLMFC_LIB.amd64 = " & g_strPathDDK & "/lib/ATL/amd64"
1135 CfgPrint "PATH_TOOL_VCC100_ATLMFC_LIB.x86 = " & g_strPathDDK & "/lib/ATL/i386"
1136 CfgPrint "PATH_TOOL_VCC100AMD64_ATLMFC_INC = " & g_strPathDDK & "/inc/atl71"
1137 CfgPrint "PATH_TOOL_VCC100AMD64_ATLMFC_LIB = " & g_strPathDDK & "/lib/ATL/amd64"
1138 CfgPrint "PATH_TOOL_VCC100X86_ATLMFC_INC = " & g_strPathDDK & "/inc/atl71"
1139 CfgPrint "PATH_TOOL_VCC100X86_ATLMFC_LIB = " & g_strPathDDK & "/lib/ATL/i386"
1140 PrintResult "Visual C++ v10 with DDK ATL", g_strPathVCC
1141 else
1142 CfgPrint "VBOX_WITHOUT_COMPILER_REDIST=1"
1143 DisableCOM "No ATL"
1144 PrintResult "Visual C++ v10 (or later) without ATL", g_strPathVCC
1145 end if
1146
1147 elseif InStr(1, g_strShellOutput, "Version 17.") > 0 then
1148 CfgPrint "PATH_TOOL_VCC110 := " & g_strPathVCC
1149 CfgPrint "PATH_TOOL_VCC110X86 := $(PATH_TOOL_VCC110)"
1150 CfgPrint "PATH_TOOL_VCC110AMD64 := $(PATH_TOOL_VCC110)"
1151 PrintResult "Visual C++ v11", g_strPathVCC
1152 MsgWarning "The support for Visual C++ v11 (aka 2012) is experimental"
1153
1154 else
1155 MsgError "The Visual C++ compiler we found ('" & strPathVC & "') isn't 10.0 or 11.0. Check the build requirements."
1156 exit sub
1157 end if
1158
1159 ' and the env.bat path fix.
1160 if strPathVCCommon <> "" then
1161 EnvPrint "set PATH=%PATH%;" & strPathVCCommon & "/IDE;"
1162 end if
1163end sub
1164
1165''
1166' Checks if the specified path points to a usable PSDK.
1167function CheckForVisualCPPSub(strPathVC, strPathVCCommon, blnOptVCExpressEdition)
1168 strPathVC = UnixSlashes(PathAbs(strPathVC))
1169 CheckForVisualCPPSub = False
1170 LogPrint "trying: strPathVC=" & strPathVC & " strPathVCCommon=" & strPathVCCommon & " blnOptVCExpressEdition=" & blnOptVCExpressEdition
1171 if LogFileExists(strPathVC, "bin/cl.exe") _
1172 And LogFileExists(strPathVC, "bin/link.exe") _
1173 And LogFileExists(strPathVC, "include/string.h") _
1174 And LogFileExists(strPathVC, "lib/libcmt.lib") _
1175 And LogFileExists(strPathVC, "lib/msvcrt.lib") _
1176 then
1177 if blnOptVCExpressEdition _
1178 Or ( LogFileExists(strPathVC, "atlmfc/include/atlbase.h") _
1179 And LogFileExists(strPathVC, "atlmfc/lib/atls.lib")) _
1180 Or ( LogFileExists(g_strPathDDK, "inc/atl71/atlbase.h") _
1181 And LogFileExists(g_strPathDDK, "lib/ATL/i386/atls.lib")) _
1182 Then
1183 '' @todo figure out a way we can verify the version/build!
1184 CheckForVisualCPPSub = True
1185 end if
1186 end if
1187end function
1188
1189
1190''
1191' Checks for a platform SDK that works with the compiler
1192sub CheckForPlatformSDK(strOptSDK)
1193 dim strPathPSDK, str
1194 PrintHdr "Windows Platform SDK (recent)"
1195
1196 strPathPSDK = ""
1197
1198 ' Check the supplied argument first.
1199 str = strOptSDK
1200 if str <> "" then
1201 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1202 end if
1203
1204 ' The tools location (first).
1205 if strPathPSDK = "" And g_blnInternalFirst then
1206 str = g_strPathDev & "/win.x86/sdk/v7.1"
1207 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1208 end if
1209
1210 if strPathPSDK = "" And g_blnInternalFirst then
1211 str = g_strPathDev & "/win.x86/sdk/v8.0"
1212 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1213 end if
1214
1215 ' Look for it in the environment
1216 str = EnvGet("MSSdk")
1217 if strPathPSDK = "" And str <> "" then
1218 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1219 end if
1220
1221 str = EnvGet("Mstools")
1222 if strPathPSDK = "" And str <> "" then
1223 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1224 end if
1225
1226 ' Check if there is one installed with the compiler.
1227 if strPathPSDK = "" And str <> "" then
1228 str = g_strPathVCC & "/PlatformSDK"
1229 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1230 end if
1231
1232 ' Check the registry next (ASSUMES sorting).
1233 arrSubKeys = RegEnumSubKeysRSort("HKLM", "SOFTWARE\Microsoft\Microsoft SDKs\Windows")
1234 for each strSubKey in arrSubKeys
1235 str = RegGetString("HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\" & strSubKey & "\InstallationFolder")
1236 if strPathPSDK = "" And str <> "" then
1237 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1238 end if
1239 Next
1240 arrSubKeys = RegEnumSubKeysRSort("HKCU", "SOFTWARE\Microsoft\Microsoft SDKs\Windows")
1241 for each strSubKey in arrSubKeys
1242 str = RegGetString("HKCU\SOFTWARE\Microsoft\Microsoft SDKs\Windows\" & strSubKey & "\InstallationFolder")
1243 if strPathPSDK = "" And str <> "" then
1244 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1245 end if
1246 Next
1247
1248 ' The tools location (post).
1249 if (strPathPSDK = "") And (g_blnInternalFirst = False) then
1250 str = g_strPathDev & "/win.x86/sdk/v7.1"
1251 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1252 end if
1253
1254 if (strPathPSDK = "") And (g_blnInternalFirst = False) then
1255 str = g_strPathDev & "/win.x86/sdk/v8.0"
1256 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1257 end if
1258
1259 ' Give up.
1260 if strPathPSDK = "" then
1261 MsgError "Cannot find a suitable Platform SDK. Check configure.log and the build requirements."
1262 exit sub
1263 end if
1264
1265 '
1266 ' Emit the config.
1267 '
1268 strPathPSDK = UnixSlashes(PathAbs(strPathPSDK))
1269 CfgPrint "PATH_SDK_WINPSDK" & g_strVerPSDK & " := " & strPathPSDK
1270 CfgPrint "VBOX_WINPSDK := WINPSDK" & g_strVerPSDK
1271
1272 PrintResult "Windows Platform SDK (v" & g_strVerPSDK & ")", strPathPSDK
1273 g_strPathPSDK = strPathPSDK
1274end sub
1275
1276''
1277' Checks if the specified path points to a usable PSDK.
1278function CheckForPlatformSDKSub(strPathPSDK)
1279 CheckForPlatformSDKSub = False
1280 LogPrint "trying: strPathPSDK=" & strPathPSDK
1281 if LogFileExists(strPathPSDK, "include/Windows.h") _
1282 And LogFileExists(strPathPSDK, "lib/Kernel32.Lib") _
1283 And LogFileExists(strPathPSDK, "lib/User32.Lib") _
1284 And LogFileExists(strPathPSDK, "bin/rc.exe") _
1285 And Shell("""" & DosSlashes(strPathPSDK & "/bin/rc.exe") & """" , True) <> 0 _
1286 then
1287 if InStr(1, g_strShellOutput, "Resource Compiler Version 6.2.") > 0 then
1288 g_strVerPSDK = "80"
1289 CheckForPlatformSDKSub = True
1290 elseif InStr(1, g_strShellOutput, "Resource Compiler Version 6.1.") > 0 then
1291 g_strVerPSDK = "71"
1292 CheckForPlatformSDKSub = True
1293 end if
1294 end if
1295end function
1296
1297
1298''
1299' Checks for a Windows 7 Driver Kit.
1300sub CheckForWinDDK(strOptDDK)
1301 dim strPathDDK, str, strSubKeys
1302 PrintHdr "Windows DDK v7.1"
1303
1304 '
1305 ' Find the DDK.
1306 '
1307 strPathDDK = ""
1308 ' The specified path.
1309 if strPathDDK = "" And strOptDDK <> "" then
1310 if CheckForWinDDKSub(strOptDDK, True) then strPathDDK = strOptDDK
1311 end if
1312
1313 ' The tools location (first).
1314 if strPathDDK = "" And g_blnInternalFirst then
1315 str = g_strPathDev & "/win.x86/ddk/7600.16385.1"
1316 if CheckForWinDDKSub(str, False) then strPathDDK = str
1317 end if
1318
1319 ' Check the environment
1320 str = EnvGet("DDK_INC_PATH")
1321 if strPathDDK = "" And str <> "" then
1322 str = PathParent(PathParent(str))
1323 if CheckForWinDDKSub(str, True) then strPathDDK = str
1324 end if
1325
1326 str = EnvGet("BASEDIR")
1327 if strPathDDK = "" And str <> "" then
1328 if CheckForWinDDKSub(str, True) then strPathDDK = str
1329 end if
1330
1331 ' Some array constants to ease the work.
1332 arrSoftwareKeys = array("SOFTWARE", "SOFTWARE\Wow6432Node")
1333 arrRoots = array("HKLM", "HKCU")
1334
1335 ' Windows 7 WDK.
1336 arrLocations = array()
1337 for each strSoftwareKey in arrSoftwareKeys
1338 for each strSubKey in RegEnumSubKeysFull("HKLM", strSoftwareKey & "\Microsoft\KitSetup\configured-kits")
1339 for each strSubKey2 in RegEnumSubKeysFull("HKLM", strSubKey)
1340 str = RegGetString("HKLM\" & strSubKey2 & "\setup-install-location")
1341 if str <> "" then
1342 arrLocations = ArrayAppend(arrLocations, PathAbsLong(str))
1343 end if
1344 next
1345 next
1346 next
1347 arrLocations = ArrayRSortStrings(arrLocations)
1348
1349 ' Check the locations we've gathered.
1350 for each str in arrLocations
1351 if strPathDDK = "" then
1352 if CheckForWinDDKSub(str, True) then strPathDDK = str
1353 end if
1354 next
1355
1356 ' The tools location (post).
1357 if (strPathDDK = "") And (g_blnInternalFirst = False) then
1358 str = g_strPathDev & "/win.x86/ddk/7600.16385.1"
1359 if CheckForWinDDKSub(str, False) then strPathDDK = str
1360 end if
1361
1362 ' Give up.
1363 if strPathDDK = "" then
1364 MsgError "Cannot find the Windows DDK v7.1. Check configure.log and the build requirements."
1365 exit sub
1366 end if
1367
1368 '
1369 ' Emit the config.
1370 '
1371 strPathDDK = UnixSlashes(PathAbs(strPathDDK))
1372 CfgPrint "PATH_SDK_WINDDK71 := " & strPathDDK
1373
1374 PrintResult "Windows DDK v7.1", strPathDDK
1375 g_strPathDDK = strPathDDK
1376end sub
1377
1378'' Quick check if the DDK is in the specified directory or not.
1379function CheckForWinDDKSub(strPathDDK, blnCheckBuild)
1380 CheckForWinDDKSub = False
1381 LogPrint "trying: strPathDDK=" & strPathDDK & " blnCheckBuild=" & blnCheckBuild
1382 if LogFileExists(strPathDDK, "inc/api/ntdef.h") _
1383 And LogFileExists(strPathDDK, "lib/win7/i386/int64.lib") _
1384 And LogFileExists(strPathDDK, "lib/wlh/i386/int64.lib") _
1385 And LogFileExists(strPathDDK, "lib/wnet/i386/int64.lib") _
1386 And LogFileExists(strPathDDK, "lib/wxp/i386/int64.lib") _
1387 And Not LogFileExists(strPathDDK, "lib/win8/i386/int64.lib") _
1388 And LogFileExists(strPathDDK, "bin/x86/rc.exe") _
1389 then
1390 if Not blnCheckBuild then
1391 CheckForWinDDKSub = True
1392 '' @todo Find better build check.
1393 elseif Shell("""" & DosSlashes(strPathDDK & "/bin/x86/rc.exe") & """" , True) <> 0 _
1394 And InStr(1, g_strShellOutput, "Resource Compiler Version 6.1.") > 0 then
1395 CheckForWinDDKSub = True
1396 end if
1397 end if
1398end function
1399
1400
1401''
1402' Finds midl.exe
1403sub CheckForMidl()
1404 dim strMidl
1405 PrintHdr "Midl.exe"
1406
1407 ' Skip if no COM/ATL.
1408 if g_blnDisableCOM then
1409 PrintResultMsg "Midl", "Skipped (" & g_strDisableCOM & ")"
1410 exit sub
1411 end if
1412
1413 if LogFileExists(g_strPathPSDK, "bin/Midl.exe") then
1414 strMidl = g_strPathPSDK & "/bin/Midl.exe"
1415 elseif LogFileExists(g_strPathVCC, "Common7/Tools/Bin/Midl.exe") then
1416 strMidl = g_strPathVCC & "/Common7/Tools/Bin/Midl.exe"
1417 elseif LogFileExists(g_strPathDDK, "bin/x86/Midl.exe") then
1418 strMidl = g_strPathDDK & "/bin/x86/Midl.exe"
1419 elseif LogFileExists(g_strPathDDK, "bin/Midl.exe") then
1420 strMidl = g_strPathDDK & "/bin/Midl.exe"
1421 elseif LogFileExists(g_strPathDev, "win.x86/bin/Midl.exe") then
1422 strMidl = g_strPathDev & "/win.x86/bin/Midl.exe"
1423 else
1424 MsgWarning "Midl.exe not found!"
1425 exit sub
1426 end if
1427
1428 CfgPrint "VBOX_MAIN_IDL := " & strMidl
1429 PrintResult "Midl.exe", strMidl
1430end sub
1431
1432
1433''
1434' Checks for any libSDL binaries.
1435sub CheckForlibSDL(strOptlibSDL)
1436 dim strPathlibSDL, str
1437 PrintHdr "libSDL"
1438
1439 '
1440 ' Try find some SDL library.
1441 '
1442
1443 ' First, the specific location.
1444 strPathlibSDL = ""
1445 if (strPathlibSDL = "") And (strOptlibSDL <> "") then
1446 if CheckForlibSDLSub(strOptlibSDL) then strPathlibSDL = strOptlibSDL
1447 end if
1448
1449 ' The tools location (first).
1450 if (strPathlibSDL = "") And (g_blnInternalFirst = True) Then
1451 str = g_strPathDev & "/win.x86/libsdl/v1.2.11"
1452 if CheckForlibSDLSub(str) then strPathlibSDL = str
1453 end if
1454
1455 if (strPathlibSDL = "") And (g_blnInternalFirst = True) Then
1456 str = g_strPathDev & "/win.x86/libsdl/v1.2.7-InnoTek"
1457 if CheckForlibSDLSub(str) then strPathlibSDL = str
1458 end if
1459
1460 ' Poke about in the path.
1461 str = Which("SDLmain.lib")
1462 if (strPathlibSDL = "") And (str <> "") Then
1463 str = PathParent(PathStripFilename(str))
1464 if CheckForlibSDLSub(str) then strPathlibSDL = str
1465 end if
1466
1467 str = Which("SDL.dll")
1468 if (strPathlibSDL = "") And (str <> "") Then
1469 str = PathParent(PathStripFilename(str))
1470 if CheckForlibSDLSub(str) then strPathlibSDL = str
1471 end if
1472
1473 ' The tools location (post).
1474 if (strPathlibSDL = "") And (g_blnInternalFirst = False) Then
1475 str = g_strPathDev & "/win.x86/libsdl/v1.2.11"
1476 if CheckForlibSDLSub(str) then strPathlibSDL = str
1477 end if
1478
1479 if (strPathlibSDL = "") And (g_blnInternalFirst = False) Then
1480 str = g_strPathDev & "/win.x86/libsdl/v1.2.7-InnoTek"
1481 if CheckForlibSDLSub(str) then strPathlibSDL = str
1482 end if
1483
1484 ' Success?
1485 if strPathlibSDL = "" then
1486 if strOptlibSDL = "" then
1487 MsgError "Can't locate libSDL. Try specify the path with the --with-libSDL=<path> argument. " _
1488 & "If still no luck, consult the configure.log and the build requirements."
1489 else
1490 MsgError "Can't locate libSDL. Please consult the configure.log and the build requirements."
1491 end if
1492 exit sub
1493 end if
1494
1495 strPathLibSDL = UnixSlashes(PathAbs(strPathLibSDL))
1496 CfgPrint "PATH_SDK_LIBSDL := " & strPathlibSDL
1497
1498 PrintResult "libSDL", strPathlibSDL
1499end sub
1500
1501''
1502' Checks if the specified path points to an usable libSDL or not.
1503function CheckForlibSDLSub(strPathlibSDL)
1504 CheckForlibSDLSub = False
1505 LogPrint "trying: strPathlibSDL=" & strPathlibSDL
1506 if LogFileExists(strPathlibSDL, "lib/SDL.lib") _
1507 And LogFileExists(strPathlibSDL, "lib/SDLmain.lib") _
1508 And LogFileExists(strPathlibSDL, "lib/SDL.dll") _
1509 And LogFileExists(strPathlibSDL, "include/SDL.h") _
1510 And LogFileExists(strPathlibSDL, "include/SDL_syswm.h") _
1511 And LogFileExists(strPathlibSDL, "include/SDL_version.h") _
1512 then
1513 CheckForlibSDLSub = True
1514 end if
1515end function
1516
1517
1518''
1519' Checks for libxml2.
1520sub CheckForXml2(strOptXml2)
1521 dim strPathXml2, str
1522 PrintHdr "libxml2"
1523
1524 '
1525 ' Part of tarball / svn, so we can exit immediately if no path was specified.
1526 '
1527 if (strOptXml2 = "") then
1528 PrintResultMsg "libxml2", "src/lib/libxml2-*"
1529 exit sub
1530 end if
1531
1532 ' Skip if no COM/ATL.
1533 if g_blnDisableCOM then
1534 PrintResultMsg "libxml2", "Skipped (" & g_strDisableCOM & ")"
1535 exit sub
1536 end if
1537
1538 '
1539 ' Try find some xml2 dll/lib.
1540 '
1541 strPathXml2 = ""
1542 if (strPathXml2 = "") And (strOptXml2 <> "") then
1543 if CheckForXml2Sub(strOptXml2) then strPathXml2 = strOptXml2
1544 end if
1545
1546 if strPathXml2 = "" Then
1547 str = Which("libxml2.lib")
1548 if str <> "" Then
1549 str = PathParent(PathStripFilename(str))
1550 if CheckForXml2Sub(str) then strPathXml2 = str
1551 end if
1552 end if
1553
1554 ' Ignore failure if we're in 'internal' mode.
1555 if (strPathXml2 = "") and g_blnInternalMode then
1556 PrintResultMsg "libxml2", "ignored (internal mode)"
1557 exit sub
1558 end if
1559
1560 ' Success?
1561 if strPathXml2 = "" then
1562 if strOptXml2 = "" then
1563 MsgError "Can't locate libxml2. Try specify the path with the --with-libxml2=<path> argument. " _
1564 & "If still no luck, consult the configure.log and the build requirements."
1565 else
1566 MsgError "Can't locate libxml2. Please consult the configure.log and the build requirements."
1567 end if
1568 exit sub
1569 end if
1570
1571 strPathXml2 = UnixSlashes(PathAbs(strPathXml2))
1572 CfgPrint "SDK_VBOX_LIBXML2_DEFS := _REENTRANT"
1573 CfgPrint "SDK_VBOX_LIBXML2_INCS := " & strPathXml2 & "/include"
1574 CfgPrint "SDK_VBOX_LIBXML2_LIBS := " & strPathXml2 & "/lib/libxml2.lib"
1575
1576 PrintResult "libxml2", strPathXml2
1577end sub
1578
1579''
1580' Checks if the specified path points to an usable libxml2 or not.
1581function CheckForXml2Sub(strPathXml2)
1582 dim str
1583
1584 CheckForXml2Sub = False
1585 LogPrint "trying: strPathXml2=" & strPathXml2
1586 if LogFileExists(strPathXml2, "include/libxml/xmlexports.h") _
1587 And LogFileExists(strPathXml2, "include/libxml/xmlreader.h") _
1588 then
1589 str = LogFindFile(strPathXml2, "bin/libxml2.dll")
1590 if str <> "" then
1591 if LogFindFile(strPathXml2, "lib/libxml2.lib") <> "" then
1592 CheckForXml2Sub = True
1593 end if
1594 end if
1595 end if
1596end function
1597
1598
1599''
1600' Checks for openssl
1601sub CheckForSsl(strOptSsl, bln32Bit)
1602 dim strPathSsl, str
1603 PrintHdr "openssl"
1604
1605 strOpenssl = "openssl"
1606 if bln32Bit = True then
1607 strOpenssl = "openssl32"
1608 end if
1609
1610 '
1611 ' Part of tarball / svn, so we can exit immediately if no path was specified.
1612 '
1613 if (strOptSsl = "") then
1614 PrintResult strOpenssl, "src/libs/openssl-*"
1615 exit sub
1616 end if
1617
1618 '
1619 ' Try find some openssl dll/lib.
1620 '
1621 strPathSsl = ""
1622 if (strPathSsl = "") And (strOptSsl <> "") then
1623 if CheckForSslSub(strOptSsl) then strPathSsl = strOptSsl
1624 end if
1625
1626 if strPathSsl = "" Then
1627 str = Which("libssl.lib")
1628 if str <> "" Then
1629 str = PathParent(PathStripFilename(str))
1630 if CheckForSslSub(str) then strPathSsl = str
1631 end if
1632 end if
1633
1634 ' Ignore failure if we're in 'internal' mode.
1635 if (strPathSsl = "") and g_blnInternalMode then
1636 PrintResultMsg strOpenssl, "ignored (internal mode)"
1637 exit sub
1638 end if
1639
1640 ' Success?
1641 if strPathSsl = "" then
1642 if strOptSsl = "" then
1643 MsgError "Can't locate " & strOpenssl & ". " _
1644 & "Try specify the path with the --with-" & strOpenssl & "=<path> argument. " _
1645 & "If still no luck, consult the configure.log and the build requirements."
1646 else
1647 MsgError "Can't locate " & strOpenssl & ". " _
1648 & "Please consult the configure.log and the build requirements."
1649 end if
1650 exit sub
1651 end if
1652
1653 strPathSsl = UnixSlashes(PathAbs(strPathSsl))
1654 if bln32Bit = True then
1655 CfgPrint "SDK_VBOX_OPENSSL-x86_INCS := " & strPathSsl & "/include"
1656 CfgPrint "SDK_VBOX_OPENSSL-x86_LIBS := " & strPathSsl & "/lib/libcrypto.lib" & " " & strPathSsl & "/lib/libssl.lib"
1657 CfgPrint "SDK_VBOX_BLD_OPENSSL-x86_LIBS := " & strPathSsl & "/lib/libcrypto.lib" & " " & strPathSsl & "/lib/libssl.lib"
1658 else
1659 CfgPrint "SDK_VBOX_OPENSSL_INCS := " & strPathSsl & "/include"
1660 CfgPrint "SDK_VBOX_OPENSSL_LIBS := " & strPathSsl & "/lib/libcrypto.lib" & " " & strPathSsl & "/lib/libssl.lib"
1661 CfgPrint "SDK_VBOX_BLD_OPENSSL_LIBS := " & strPathSsl & "/lib/libcrypto.lib" & " " & strPathSsl & "/lib/libssl.lib"
1662 end if
1663
1664 PrintResult strOpenssl, strPathSsl
1665end sub
1666
1667''
1668' Checks if the specified path points to an usable openssl or not.
1669function CheckForSslSub(strPathSsl)
1670
1671 CheckForSslSub = False
1672 LogPrint "trying: strPathSsl=" & strPathSsl
1673 if LogFileExists(strPathSsl, "include/openssl/md5.h") _
1674 And LogFindFile(strPathSsl, "lib/libssl.lib") <> "" _
1675 then
1676 CheckForSslSub = True
1677 end if
1678end function
1679
1680
1681''
1682' Checks for libcurl
1683sub CheckForCurl(strOptCurl, bln32Bit)
1684 dim strPathCurl, str
1685 PrintHdr "libcurl"
1686
1687 strCurl = "libcurl"
1688 if bln32Bit = True then
1689 strCurl = "libcurl32"
1690 end if
1691
1692 '
1693 ' Try find some cURL dll/lib.
1694 '
1695 strPathCurl = ""
1696 if (strPathCurl = "") And (strOptCurl <> "") then
1697 if CheckForCurlSub(strOptCurl) then strPathCurl = strOptCurl
1698 end if
1699
1700 if strPathCurl = "" Then
1701 str = Which("libcurl.lib")
1702 if str <> "" Then
1703 str = PathParent(PathStripFilename(str))
1704 if CheckForCurlSub(str) then strPathCurl = str
1705 end if
1706 end if
1707
1708 ' Ignore failure if we're in 'internal' mode.
1709 if (strPathCurl = "") and g_blnInternalMode then
1710 PrintResultMsg strCurl, "ignored (internal mode)"
1711 exit sub
1712 end if
1713
1714 ' Success?
1715 if strPathCurl = "" then
1716 if strOptCurl = "" then
1717 MsgError "Can't locate " & strCurl & ". " _
1718 & "Try specify the path with the --with-" & strCurl & "=<path> argument. " _
1719 & "If still no luck, consult the configure.log and the build requirements."
1720 else
1721 MsgError "Can't locate " & strCurl & ". " _
1722 & "Please consult the configure.log and the build requirements."
1723 end if
1724 exit sub
1725 end if
1726
1727 strPathCurl = UnixSlashes(PathAbs(strPathCurl))
1728 if bln32Bit = True then
1729 CfgPrint "SDK_VBOX_LIBCURL-x86_INCS := " & strPathCurl & "/include"
1730 CfgPrint "SDK_VBOX_LIBCURL-x86_LIBS.x86 := " & strPathCurl & "/libcurl.lib"
1731 else
1732 CfgPrint "SDK_VBOX_LIBCURL_INCS := " & strPathCurl & "/include"
1733 CfgPrint "SDK_VBOX_LIBCURL_LIBS := " & strPathCurl & "/libcurl.lib"
1734 end if
1735
1736 PrintResult strCurl, strPathCurl
1737end sub
1738
1739''
1740' Checks if the specified path points to an usable libcurl or not.
1741function CheckForCurlSub(strPathCurl)
1742
1743 CheckForCurlSub = False
1744 LogPrint "trying: strPathCurl=" & strPathCurl
1745 if LogFileExists(strPathCurl, "include/curl/curl.h") _
1746 And LogFindFile(strPathCurl, "libcurl.dll") <> "" _
1747 And LogFindFile(strPathCurl, "libcurl.lib") <> "" _
1748 then
1749 CheckForCurlSub = True
1750 end if
1751end function
1752
1753
1754
1755''
1756' Checks for any Qt5 binaries.
1757sub CheckForQt(strOptQt5)
1758 PrintHdr "Qt5"
1759
1760 '
1761 ' Try to find the Qt5 installation (user specified path with --with-qt5)
1762 '
1763 strPathQt5 = ""
1764
1765 LogPrint "Checking for user specified path of Qt5 ... "
1766 if (strPathQt5 = "") And (strOptQt5 <> "") then
1767 strOptQt5 = UnixSlashes(strOptQt5)
1768 if CheckForQt5Sub(strOptQt5) then strPathQt5 = strOptQt5
1769 end if
1770
1771 ' Check the dev tools
1772 if (strPathQt5 = "") Then
1773 strPathQt5 = g_strPathDev & "/win." & g_strTargetArch & "/qt/v5.5.1-r138"
1774 if CheckForQt5Sub(strPathQt5) = False then strPathQt5 = ""
1775 end if
1776
1777 ' Display the result.
1778 if strPathQt5 = "" then
1779 PrintResultMsg "Qt5", "not found"
1780 else
1781 PrintResult "Qt5", strPathQt5
1782 end if
1783
1784 if strPathQt5 <> "" then
1785 CfgPrint "PATH_SDK_QT5 := " & strPathQt5
1786 CfgPrint "PATH_TOOL_QT5 := $(PATH_SDK_QT5)"
1787 CfgPrint "VBOX_PATH_QT := $(PATH_SDK_QT5)"
1788 end if
1789 if strPathQt5 = "" then
1790 CfgPrint "VBOX_WITH_QTGUI :="
1791 end if
1792end sub
1793
1794
1795''
1796' Checks if the specified path points to an usable Qt5 library.
1797function CheckForQt5Sub(strPathQt5)
1798
1799 CheckForQt5Sub = False
1800 LogPrint "trying: strPathQt5=" & strPathQt5
1801
1802 if LogFileExists(strPathQt5, "bin/moc.exe") _
1803 And LogFileExists(strPathQt5, "bin/uic.exe") _
1804 And LogFileExists(strPathQt5, "include/QtWidgets/qwidget.h") _
1805 And LogFileExists(strPathQt5, "include/QtWidgets/QApplication") _
1806 And LogFileExists(strPathQt5, "include/QtGui/QImage") _
1807 And LogFileExists(strPathQt5, "include/QtNetwork/QHostAddress") _
1808 And ( LogFileExists(strPathQt5, "lib/Qt5Core.lib") _
1809 Or LogFileExists(strPathQt5, "lib/Qt5CoreVBox.lib")) _
1810 And ( LogFileExists(strPathQt5, "lib/Qt5Network.lib") _
1811 Or LogFileExists(strPathQt5, "lib/Qt5NetworkVBox.lib")) _
1812 then
1813 CheckForQt5Sub = True
1814 end if
1815
1816end function
1817
1818
1819'
1820'
1821function CheckForPython(strPathPython)
1822
1823 PrintHdr "Python"
1824
1825 CheckForPython = False
1826 LogPrint "trying: strPathPython=" & strPathPython
1827
1828 if LogFileExists(strPathPython, "python.exe") then
1829 CfgPrint "VBOX_BLD_PYTHON := " & strPathPython & "\python.exe"
1830 CheckForPython = True
1831 end if
1832
1833 PrintResult "Python ", strPathPython
1834end function
1835
1836
1837''
1838' Show usage.
1839sub usage
1840 Print "Usage: cscript configure.vbs [options]"
1841 Print ""
1842 Print "Configuration:"
1843 Print " -h, --help"
1844 Print " --internal"
1845 Print " --internal-last"
1846 Print " --target-arch=x86|amd64"
1847 Print ""
1848 Print "Components:"
1849 Print " --disable-COM"
1850 Print " --disable-UDPTunnel"
1851 Print " --disable-SDL"
1852 Print ""
1853 Print "Locations:"
1854 Print " --with-kBuild=PATH "
1855 Print " --with-libSDL=PATH "
1856 Print " --with-Qt5=PATH "
1857 Print " --with-DDK=PATH "
1858 Print " --with-SDK=PATH "
1859 Print " --with-VC=PATH "
1860 Print " --with-VC-Common=PATH "
1861 Print " --with-VC-Express-Edition"
1862 Print " --with-W32API=PATH "
1863 Print " --with-libxml2=PATH "
1864 Print " --with-openssl=PATH "
1865 Print " --with-openssl32=PATH (only for 64-bit targets)"
1866 Print " --with-libcurl=PATH "
1867 Print " --with-libcurl32=PATH (only for 64-bit targets)"
1868 Print " --with-python=PATH "
1869end sub
1870
1871
1872''
1873' The main() like function.
1874'
1875Sub Main
1876 '
1877 ' Write the log header and check that we're not using wscript.
1878 '
1879 LogInit
1880 If UCase(Right(Wscript.FullName, 11)) = "WSCRIPT.EXE" Then
1881 Wscript.Echo "This script must be run under CScript."
1882 Wscript.Quit(1)
1883 End If
1884
1885 '
1886 ' Parse arguments.
1887 '
1888 strOptDDK = ""
1889 strOptDXDDK = ""
1890 strOptkBuild = ""
1891 strOptlibSDL = ""
1892 strOptQt5 = ""
1893 strOptSDK = ""
1894 strOptVC = ""
1895 strOptVCCommon = ""
1896 blnOptVCExpressEdition = False
1897 strOptW32API = ""
1898 strOptXml2 = ""
1899 strOptSsl = ""
1900 strOptSsl32 = ""
1901 strOptCurl = ""
1902 strOptCurl32 = ""
1903 strOptPython = ""
1904 blnOptDisableCOM = False
1905 blnOptDisableUDPTunnel = False
1906 blnOptDisableSDL = False
1907 for i = 1 to Wscript.Arguments.Count
1908 dim str, strArg, strPath
1909
1910 ' Separate argument and path value
1911 str = Wscript.Arguments.item(i - 1)
1912 if InStr(1, str, "=") > 0 then
1913 strArg = Mid(str, 1, InStr(1, str, "=") - 1)
1914 strPath = Mid(str, InStr(1, str, "=") + 1)
1915 if strPath = "" then MsgFatal "Syntax error! Argument #" & i & " is missing the path."
1916 else
1917 strArg = str
1918 strPath = ""
1919 end if
1920
1921 ' Process the argument
1922 select case LCase(strArg)
1923 case "--with-ddk"
1924 strOptDDK = strPath
1925 case "--with-dxsdk"
1926 MsgWarning "Ignoring --with-dxsdk (the DirectX SDK is no longer required)."
1927 case "--with-kbuild"
1928 strOptkBuild = strPath
1929 case "--with-libsdl"
1930 strOptlibSDL = strPath
1931 case "--with-mingw32"
1932 ' ignore
1933 case "--with-mingw-w64"
1934 ' ignore
1935 case "--with-qt5"
1936 strOptQt5 = strPath
1937 case "--with-sdk"
1938 strOptSDK = strPath
1939 case "--with-vc"
1940 strOptVC = strPath
1941 case "--with-vc-common"
1942 strOptVCCommon = strPath
1943 case "--with-vc-express-edition"
1944 blnOptVCExpressEdition = True
1945 case "--with-w32api"
1946 strOptW32API = strPath
1947 case "--with-libxml2"
1948 strOptXml2 = strPath
1949 case "--with-openssl"
1950 strOptSsl = strPath
1951 case "--with-openssl32"
1952 strOptSsl32 = strPath
1953 case "--with-libcurl"
1954 strOptCurl = strPath
1955 case "--with-libcurl32"
1956 strOptCurl32 = strPath
1957 case "--with-python"
1958 strOptPython = strPath
1959 case "--disable-com"
1960 blnOptDisableCOM = True
1961 case "--enable-com"
1962 blnOptDisableCOM = False
1963 case "--disable-udptunnel"
1964 blnOptDisableUDPTunnel = True
1965 case "--disable-sdl"
1966 blnOptDisableSDL = True
1967 case "--internal"
1968 g_blnInternalMode = True
1969 case "--internal-last"
1970 g_blnInternalFirst = False
1971 case "--target-arch"
1972 g_strTargetArch = strPath
1973 case "-h", "--help", "-?"
1974 usage
1975 Wscript.Quit(0)
1976 case else
1977 Wscript.echo "syntax error: Unknown option '" & str &"'."
1978 usage
1979 Wscript.Quit(1)
1980 end select
1981 next
1982
1983 '
1984 ' Initialize output files.
1985 '
1986 CfgInit
1987 EnvInit
1988
1989 '
1990 ' Check that the Shell function is sane.
1991 '
1992 g_objShell.Environment("PROCESS")("TESTING_ENVIRONMENT_INHERITANCE") = "This works"
1993 if Shell("set TESTING_ENVIRONMENT_INHERITANC", False) <> 0 then ' The 'E' is missing on purpose (4nt).
1994 MsgFatal "shell execution test failed!"
1995 end if
1996 if g_strShellOutput <> "TESTING_ENVIRONMENT_INHERITANCE=This works" & CHR(13) & CHR(10) then
1997 Print "Shell test Test -> '" & g_strShellOutput & "'"
1998 MsgFatal "shell inheritance or shell execution isn't working right. Make sure you use cmd.exe."
1999 end if
2000 g_objShell.Environment("PROCESS")("TESTING_ENVIRONMENT_INHERITANCE") = ""
2001 Print "Shell inheritance test: OK"
2002
2003 '
2004 ' Do the checks.
2005 '
2006 if blnOptDisableCOM = True then
2007 DisableCOM "--disable-com"
2008 end if
2009 if blnOptDisableUDPTunnel = True then
2010 DisableUDPTunnel "--disable-udptunnel"
2011 end if
2012 CheckSourcePath
2013 CheckForkBuild strOptkBuild
2014 CheckForWinDDK strOptDDK
2015 CheckForVisualCPP strOptVC, strOptVCCommon, blnOptVCExpressEdition
2016 CheckForPlatformSDK strOptSDK
2017 CheckForMidl
2018 CfgPrint "VBOX_WITH_OPEN_WATCOM := " '' @todo look for openwatcom 1.9+
2019 CfgPrint "VBOX_WITH_LIBVPX := " '' @todo look for libvpx 1.1.0+
2020 CfgPrint "VBOX_WITH_LIBOPUS := " '' @todo look for libopus 1.2.1+
2021 EnvPrint "set PATH=%PATH%;" & g_strPath& "/tools/win." & g_strTargetArch & "/bin;" '' @todo look for yasm
2022 if blnOptDisableSDL = True then
2023 DisableSDL "--disable-sdl"
2024 else
2025 CheckForlibSDL strOptlibSDL
2026 end if
2027 CheckForXml2 strOptXml2
2028 CheckForSsl strOptSsl, False
2029 if g_strTargetArch = "amd64" then
2030 ' 32-bit openssl required as well
2031 CheckForSsl strOptSsl32, True
2032 end if
2033 CheckForCurl strOptCurl, False
2034 if g_strTargetArch = "amd64" then
2035 ' 32-bit Curl required as well
2036 CheckForCurl strOptCurl32, True
2037 end if
2038 CheckForQt strOptQt5
2039 if (strOptPython <> "") then
2040 CheckForPython strOptPython
2041 end if
2042 if g_blnInternalMode then
2043 EnvPrint "call " & g_strPathDev & "/env.cmd %1 %2 %3 %4 %5 %6 %7 %8 %9"
2044 end if
2045
2046 Print ""
2047 Print "Execute env.bat once before you start to build VBox:"
2048 Print ""
2049 Print " env.bat"
2050 Print " kmk"
2051 Print ""
2052
2053End Sub
2054
2055
2056Main
2057
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