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