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