[4746] | 1 | ' $Id: configure.vbs 4746 2007-09-13 06:43:53Z vboxsync $
|
---|
| 2 | '' @file
|
---|
[1] | 3 | ' The purpose of this script is to check for all external tools, headers, and
|
---|
| 4 | ' libraries VBox OSE depends on.
|
---|
| 5 | '
|
---|
| 6 | ' The script generates the build configuration file 'AutoConfig.kmk' and the
|
---|
| 7 | ' environment setup script 'env.bat'. A log of what has been done is
|
---|
| 8 | ' written to 'configure.log'.
|
---|
| 9 | '
|
---|
| 10 |
|
---|
| 11 | '
|
---|
[2992] | 12 | ' Copyright (C) 2006-2007 innotek GmbH
|
---|
[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
|
---|
| 17 | ' General Public License as published by the Free Software Foundation,
|
---|
| 18 | ' in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
| 19 | ' distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
| 20 | ' be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
| 21 | '
|
---|
| 22 |
|
---|
| 23 |
|
---|
| 24 | '*****************************************************************************
|
---|
| 25 | '* Global Variables *
|
---|
| 26 | '*****************************************************************************
|
---|
| 27 | dim g_strPath, g_strEnvFile, g_strLogFile, g_strCfgFile, g_strShellOutput
|
---|
| 28 | g_strPath = Left(Wscript.ScriptFullName, Len(Wscript.ScriptFullName) - Len("\configure.vbs"))
|
---|
| 29 | g_strEnvFile = g_strPath & "\env.bat"
|
---|
| 30 | g_strCfgFile = g_strPath & "\AutoConfig.kmk"
|
---|
| 31 | g_strLogFile = g_strPath & "\configure.log"
|
---|
| 32 | 'g_strTmpFile = g_strPath & "\configure.tmp"
|
---|
| 33 |
|
---|
| 34 | dim g_objShell, g_objFileSys
|
---|
| 35 | Set g_objShell = WScript.CreateObject("WScript.Shell")
|
---|
| 36 | Set g_objFileSys = WScript.CreateObject("Scripting.FileSystemObject")
|
---|
| 37 |
|
---|
| 38 | dim g_strPathkBuild, g_strPathkBuildBin, g_strPathDev, g_strPathVCC, g_strPathPSDK, g_strSubOutput
|
---|
| 39 | g_strPathkBuild = ""
|
---|
| 40 | g_strPathDev = ""
|
---|
| 41 | g_strPathVCC = ""
|
---|
| 42 | g_strPathPSDK = ""
|
---|
| 43 |
|
---|
| 44 | dim g_blnDisableCOM, g_strDisableCOM
|
---|
| 45 | g_blnDisableCOM = False
|
---|
| 46 | g_strDisableCOM = ""
|
---|
| 47 |
|
---|
| 48 | ' The internal mode is primarily for skipping the xerces and xalan monsters.
|
---|
| 49 | dim g_blnInternalMode
|
---|
| 50 | g_blnInternalMode = False
|
---|
| 51 |
|
---|
| 52 |
|
---|
| 53 |
|
---|
| 54 | ''
|
---|
| 55 | ' Converts to unix slashes
|
---|
| 56 | function UnixSlashes(str)
|
---|
| 57 | UnixSlashes = replace(str, "\", "/")
|
---|
| 58 | end function
|
---|
| 59 |
|
---|
| 60 |
|
---|
| 61 | ''
|
---|
| 62 | ' Converts to dos slashes
|
---|
| 63 | function DosSlashes(str)
|
---|
| 64 | DosSlashes = replace(str, "/", "\")
|
---|
| 65 | end function
|
---|
| 66 |
|
---|
| 67 |
|
---|
| 68 | ''
|
---|
| 69 | ' Read a file (typically the tmp file) into a string.
|
---|
| 70 | function FileToString(strFilename)
|
---|
| 71 | const ForReading = 1, TristateFalse = 0
|
---|
| 72 | dim objLogFile, str
|
---|
| 73 |
|
---|
| 74 | set objFile = g_objFileSys.OpenTextFile(DosSlashes(strFilename), ForReading, False, TristateFalse)
|
---|
| 75 | str = objFile.ReadAll()
|
---|
| 76 | objFile.Close()
|
---|
| 77 |
|
---|
| 78 | FileToString = str
|
---|
| 79 | end function
|
---|
| 80 |
|
---|
| 81 |
|
---|
| 82 | ''
|
---|
| 83 | ' Deletes a file
|
---|
| 84 | sub FileDelete(strFilename)
|
---|
| 85 | if g_objFileSys.FileExists(DosSlashes(strFilename)) then
|
---|
| 86 | g_objFileSys.DeleteFile(DosSlashes(strFilename))
|
---|
| 87 | end if
|
---|
| 88 | end sub
|
---|
| 89 |
|
---|
| 90 |
|
---|
| 91 | ''
|
---|
| 92 | ' Appends a line to an ascii file.
|
---|
| 93 | sub FileAppendLine(strFilename, str)
|
---|
| 94 | const ForAppending = 8, TristateFalse = 0
|
---|
| 95 | dim objFile
|
---|
| 96 |
|
---|
| 97 | set objFile = g_objFileSys.OpenTextFile(DosSlashes(strFilename), ForAppending, True, TristateFalse)
|
---|
| 98 | objFile.WriteLine(str)
|
---|
| 99 | objFile.Close()
|
---|
| 100 | end sub
|
---|
| 101 |
|
---|
| 102 |
|
---|
| 103 | ''
|
---|
| 104 | ' Checks if the file exists.
|
---|
| 105 | function FileExists(strFilename)
|
---|
| 106 | FileExists = g_objFileSys.FileExists(DosSlashes(strFilename))
|
---|
| 107 | end function
|
---|
| 108 |
|
---|
| 109 |
|
---|
| 110 | ''
|
---|
| 111 | ' Checks if the directory exists.
|
---|
| 112 | function DirExists(strDirectory)
|
---|
| 113 | DirExists = g_objFileSys.FolderExists(DosSlashes(strDirectory))
|
---|
| 114 | end function
|
---|
| 115 |
|
---|
| 116 | ''
|
---|
| 117 | ' Gets a value from the registry. Returns "" if string wasn't found / valid.
|
---|
| 118 | function RegGetString(strName)
|
---|
| 119 | RegGetString = ""
|
---|
| 120 | On Error Resume Next
|
---|
| 121 | RegGetString = g_objShell.RegRead(strName)
|
---|
| 122 | end function
|
---|
| 123 |
|
---|
| 124 | ''
|
---|
| 125 | ' Returns an array of subkey strings.
|
---|
| 126 | function RegEnumSubKeys(strRoot, strKeyPath)
|
---|
| 127 | const HKEY_LOCAL_MACHINE = &H80000002
|
---|
| 128 | const HKEY_CURRENT_USER = &H80000001
|
---|
| 129 | dim objReg, iRoot
|
---|
| 130 | set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
|
---|
| 131 |
|
---|
| 132 | select case strRoot
|
---|
| 133 | case "HKLM"
|
---|
| 134 | iRoot = HKEY_LOCAL_MACHINE
|
---|
| 135 | case "HKCU"
|
---|
| 136 | iRoot = HKEY_CURRENT_USER
|
---|
| 137 | case else
|
---|
| 138 | MsgFatal "RegEnumSubKeys: Unknown root: " & strRoot
|
---|
| 139 | end select
|
---|
| 140 |
|
---|
| 141 | On Error Resume Next
|
---|
| 142 | rc = objReg.EnumKey(iRoot, strKeyPath, arrSubKeys)
|
---|
| 143 | if rc = 0 then
|
---|
| 144 | RegEnumSubKeys = arrSubKeys
|
---|
| 145 | else
|
---|
| 146 | RegEnumSubKeys = Array()
|
---|
| 147 | end if
|
---|
| 148 | end function
|
---|
| 149 |
|
---|
| 150 |
|
---|
| 151 | ''
|
---|
| 152 | ' Gets the commandline used to invoke the script.
|
---|
| 153 | function GetCommandline()
|
---|
| 154 | dim str, i
|
---|
| 155 |
|
---|
| 156 | '' @todo find an api for querying it instead of reconstructing it like this...
|
---|
| 157 | GetCommandline = "cscript configure.vbs"
|
---|
| 158 | for i = 1 to WScript.Arguments.Count
|
---|
| 159 | str = WScript.Arguments.Item(i - 1)
|
---|
| 160 | if str = "" then
|
---|
| 161 | str = """"""
|
---|
| 162 | elseif (InStr(1, str, " ")) then
|
---|
| 163 | str = """" & str & """"
|
---|
| 164 | end if
|
---|
| 165 | GetCommandline = GetCommandline & " " & str
|
---|
| 166 | next
|
---|
| 167 | end function
|
---|
| 168 |
|
---|
| 169 |
|
---|
| 170 | ''
|
---|
| 171 | ' Gets an environment variable.
|
---|
| 172 | function EnvGet(strName)
|
---|
| 173 | EnvGet = g_objShell.Environment("PROCESS")(strName)
|
---|
| 174 | end function
|
---|
| 175 |
|
---|
| 176 |
|
---|
| 177 | ''
|
---|
| 178 | ' Sets an environment variable.
|
---|
| 179 | sub EnvSet(strName, strValue)
|
---|
| 180 | g_objShell.Environment("PROCESS")(strName) = strValue
|
---|
| 181 | LogPrint "EnvSet: " & strName & "=" & strValue
|
---|
| 182 | end sub
|
---|
| 183 |
|
---|
| 184 |
|
---|
| 185 | ''
|
---|
| 186 | ' Appends a string to an environment variable
|
---|
| 187 | sub EnvAppend(strName, strValue)
|
---|
| 188 | dim str
|
---|
| 189 | str = g_objShell.Environment("PROCESS")(strName)
|
---|
| 190 | g_objShell.Environment("PROCESS")(strName) = str & strValue
|
---|
| 191 | LogPrint "EnvAppend: " & strName & "=" & str & strValue
|
---|
| 192 | end sub
|
---|
| 193 |
|
---|
| 194 |
|
---|
| 195 | ''
|
---|
| 196 | ' Prepends a string to an environment variable
|
---|
| 197 | sub EnvPrepend(strName, strValue)
|
---|
| 198 | dim str
|
---|
| 199 | str = g_objShell.Environment("PROCESS")(strName)
|
---|
| 200 | g_objShell.Environment("PROCESS")(strName) = strValue & str
|
---|
| 201 | LogPrint "EnvPrepend: " & strName & "=" & strValue & str
|
---|
| 202 | end sub
|
---|
| 203 |
|
---|
| 204 |
|
---|
| 205 | ''
|
---|
| 206 | ' Get the path of the parent directory. Returns root if root was specified.
|
---|
| 207 | ' Expects abs path.
|
---|
| 208 | function PathParent(str)
|
---|
| 209 | PathParent = g_objFileSys.GetParentFolderName(DosSlashes(str))
|
---|
| 210 | end function
|
---|
| 211 |
|
---|
| 212 |
|
---|
| 213 | ''
|
---|
| 214 | ' Strips the filename from at path.
|
---|
| 215 | function PathStripFilename(str)
|
---|
| 216 | PathStripFilename = g_objFileSys.GetParentFolderName(DosSlashes(str))
|
---|
| 217 | end function
|
---|
| 218 |
|
---|
| 219 |
|
---|
| 220 | ''
|
---|
| 221 | ' Get the abs path, use the short version if necessary.
|
---|
| 222 | function PathAbs(str)
|
---|
| 223 | PathAbs = g_objFileSys.GetAbsolutePathName(DosSlashes(str))
|
---|
| 224 | if (InStr(1, PathAbs, " ") > 0) _
|
---|
| 225 | Or (InStr(1, PathAbs, "&") > 0) _
|
---|
| 226 | Or (InStr(1, PathAbs, "$") > 0) _
|
---|
| 227 | then
|
---|
| 228 | if FileExists(PathAbs) then
|
---|
| 229 | dim objFile
|
---|
| 230 | set objFile = g_objFileSys.GetFile(PathAbs)
|
---|
| 231 | PathAbs = objFile.ShortPath
|
---|
| 232 | elseif DirExists(PathAbs) then
|
---|
| 233 | dim objFolder
|
---|
| 234 | set objFolder = g_objFileSys.GetFolder(PathAbs)
|
---|
| 235 | PathAbs = objFolder.ShortPath
|
---|
| 236 | else
|
---|
| 237 | ' ignore non-existing paths.
|
---|
| 238 | end if
|
---|
| 239 | end if
|
---|
| 240 |
|
---|
| 241 |
|
---|
| 242 | if (FileExists(PathAbs) Or DirExists(PathAbs)) _
|
---|
| 243 | And ( (InStr(1, PathAbs, " ") > 0) _
|
---|
| 244 | Or (InStr(1, PathAbs, "&") > 0) _
|
---|
| 245 | Or (InStr(1, PathAbs, "$") > 0)) _
|
---|
| 246 | then
|
---|
| 247 | MsgFatal "PathAbs(" & str & ") attempted to return filename with problematic " _
|
---|
| 248 | & "characters in it (" & PathAbs & "). The tool/sdk referenced will probably " _
|
---|
| 249 | & "need to be copied or reinstalled to a location without 'spaces', '$', ';' " _
|
---|
| 250 | & "or '&' in the path name. (Unless it's a problem with this script of course...)"
|
---|
| 251 | end if
|
---|
| 252 | end function
|
---|
| 253 |
|
---|
| 254 |
|
---|
| 255 | ''
|
---|
| 256 | ' Executes a command in the shell catching output in g_strShellOutput
|
---|
| 257 | function Shell(strCommand, blnBoth)
|
---|
| 258 | dim strShell, strCmdline, objExec, str
|
---|
| 259 |
|
---|
| 260 | strShell = g_objShell.ExpandEnvironmentStrings("%ComSpec%")
|
---|
| 261 | if blnBoth = true then
|
---|
| 262 | strCmdline = strShell & " /c " & strCommand & " 2>&1"
|
---|
| 263 | else
|
---|
| 264 | strCmdline = strShell & " /c " & strCommand & " 2>nul"
|
---|
| 265 | end if
|
---|
| 266 |
|
---|
| 267 | LogPrint "# Shell: " & strCmdline
|
---|
| 268 | Set objExec = g_objShell.Exec(strCmdLine)
|
---|
| 269 | g_strShellOutput = objExec.StdOut.ReadAll()
|
---|
| 270 | objExec.StdErr.ReadAll()
|
---|
| 271 | do while objExec.Status = 0
|
---|
| 272 | Wscript.Sleep 20
|
---|
| 273 | g_strShellOutput = g_strShellOutput & objExec.StdOut.ReadAll()
|
---|
| 274 | objExec.StdErr.ReadAll()
|
---|
| 275 | loop
|
---|
| 276 |
|
---|
| 277 | LogPrint "# Status: " & objExec.ExitCode
|
---|
| 278 | LogPrint "# Start of Output"
|
---|
| 279 | LogPrint g_strShellOutput
|
---|
| 280 | LogPrint "# End of Output"
|
---|
| 281 |
|
---|
| 282 | Shell = objExec.ExitCode
|
---|
| 283 | end function
|
---|
| 284 |
|
---|
| 285 |
|
---|
| 286 | ''
|
---|
| 287 | ' Try find the specified file in the path.
|
---|
| 288 | function Which(strFile)
|
---|
| 289 | dim strPath, iStart, iEnd, str
|
---|
| 290 |
|
---|
| 291 | ' the path
|
---|
| 292 | strPath = EnvGet("Path")
|
---|
| 293 | iStart = 1
|
---|
| 294 | do while iStart <= Len(strPath)
|
---|
| 295 | iEnd = InStr(iStart, strPath, ";")
|
---|
| 296 | if iEnd <= 0 then iEnd = Len(strPath) + 1
|
---|
| 297 | if iEnd > iStart then
|
---|
| 298 | str = Mid(strPath, iStart, iEnd - iStart) & "/" & strFile
|
---|
| 299 | if FileExists(str) then
|
---|
| 300 | Which = str
|
---|
| 301 | exit function
|
---|
| 302 | end if
|
---|
| 303 | end if
|
---|
| 304 | iStart = iEnd + 1
|
---|
| 305 | loop
|
---|
| 306 |
|
---|
| 307 | ' registry or somewhere?
|
---|
| 308 |
|
---|
| 309 | Which = ""
|
---|
| 310 | end function
|
---|
| 311 |
|
---|
| 312 |
|
---|
| 313 | ''
|
---|
| 314 | ' Append text to the log file and echo it to stdout
|
---|
| 315 | sub Print(str)
|
---|
| 316 | LogPrint str
|
---|
| 317 | Wscript.Echo str
|
---|
| 318 | end sub
|
---|
| 319 |
|
---|
| 320 |
|
---|
| 321 | ''
|
---|
| 322 | ' Prints a test header
|
---|
| 323 | sub PrintHdr(strTest)
|
---|
| 324 | LogPrint "***** Checking for " & strTest & " *****"
|
---|
| 325 | Wscript.Echo "Checking for " & StrTest & "..."
|
---|
| 326 | end sub
|
---|
| 327 |
|
---|
| 328 |
|
---|
| 329 | ''
|
---|
| 330 | ' Prints a success message
|
---|
| 331 | sub PrintResult(strTest, strResult)
|
---|
| 332 | LogPrint "** " & strTest & ": " & strResult
|
---|
| 333 | Wscript.Echo " Found "& strTest & ": " & strResult
|
---|
| 334 | end sub
|
---|
| 335 |
|
---|
| 336 |
|
---|
| 337 | ''
|
---|
| 338 | ' Warning message.
|
---|
| 339 | sub MsgWarning(strMsg)
|
---|
| 340 | Print "warning: " & strMsg
|
---|
| 341 | end sub
|
---|
| 342 |
|
---|
| 343 |
|
---|
| 344 | ''
|
---|
| 345 | ' Fatal error.
|
---|
| 346 | sub MsgFatal(strMsg)
|
---|
| 347 | Print "fatal error: " & strMsg
|
---|
| 348 | Wscript.Quit
|
---|
| 349 | end sub
|
---|
| 350 |
|
---|
| 351 |
|
---|
| 352 | ''
|
---|
| 353 | ' Error message, fatal unless flag to ignore errors is given.
|
---|
| 354 | sub MsgError(strMsg)
|
---|
| 355 | Print "error: " & strMsg
|
---|
| 356 | if g_blnInternalMode = False then
|
---|
| 357 | Wscript.Quit
|
---|
| 358 | end if
|
---|
| 359 | end sub
|
---|
| 360 |
|
---|
| 361 |
|
---|
| 362 | ''
|
---|
| 363 | ' Write a log header with some basic info.
|
---|
| 364 | sub LogInit
|
---|
| 365 | FileDelete g_strLogFile
|
---|
| 366 | LogPrint "# Log file generated by " & Wscript.ScriptFullName
|
---|
| 367 | for i = 1 to WScript.Arguments.Count
|
---|
| 368 | LogPrint "# Arg #" & i & ": " & WScript.Arguments.Item(i - 1)
|
---|
| 369 | next
|
---|
| 370 | if Wscript.Arguments.Count = 0 then
|
---|
| 371 | LogPrint "# No arguments given"
|
---|
| 372 | end if
|
---|
| 373 | LogPrint "# Reconstructed command line: " & GetCommandline()
|
---|
| 374 |
|
---|
| 375 | ' some Wscript stuff
|
---|
| 376 | LogPrint "# Wscript properties:"
|
---|
| 377 | LogPrint "# ScriptName: " & Wscript.ScriptName
|
---|
| 378 | LogPrint "# Version: " & Wscript.Version
|
---|
| 379 | LogPrint "# Build: " & Wscript.BuildVersion
|
---|
| 380 | LogPrint "# Name: " & Wscript.Name
|
---|
| 381 | LogPrint "# Full Name: " & Wscript.FullName
|
---|
| 382 | LogPrint "# Path: " & Wscript.Path
|
---|
| 383 | LogPrint "#"
|
---|
| 384 |
|
---|
| 385 |
|
---|
| 386 | ' the environment
|
---|
| 387 | LogPrint "# Environment:"
|
---|
| 388 | dim objEnv
|
---|
| 389 | for each strVar in g_objShell.Environment("PROCESS")
|
---|
| 390 | LogPrint "# " & strVar
|
---|
| 391 | next
|
---|
| 392 | LogPrint "#"
|
---|
| 393 | end sub
|
---|
| 394 |
|
---|
| 395 |
|
---|
| 396 | ''
|
---|
| 397 | ' Append text to the log file.
|
---|
| 398 | sub LogPrint(str)
|
---|
| 399 | FileAppendLine g_strLogFile, str
|
---|
| 400 | 'Wscript.Echo "dbg: " & str
|
---|
| 401 | end sub
|
---|
| 402 |
|
---|
| 403 |
|
---|
| 404 | ''
|
---|
| 405 | ' Checks if the file exists and logs failures.
|
---|
| 406 | function LogFileExists(strPath, strFilename)
|
---|
| 407 | LogFileExists = FileExists(strPath & "/" & strFilename)
|
---|
| 408 | if LogFileExists = False then
|
---|
| 409 | LogPrint "Testing '" & strPath & "': " & strFilename & " not found"
|
---|
| 410 | end if
|
---|
| 411 |
|
---|
| 412 | end function
|
---|
| 413 |
|
---|
| 414 |
|
---|
| 415 | ''
|
---|
| 416 | ' Finds the first file matching the pattern.
|
---|
| 417 | ' If no file is found, log the failure.
|
---|
| 418 | function LogFindFile(strPath, strPattern)
|
---|
| 419 | dim str
|
---|
| 420 |
|
---|
| 421 | '
|
---|
| 422 | ' Yes, there are some facy database kinda interface to the filesystem
|
---|
| 423 | ' however, breaking down the path and constructing a usable query is
|
---|
| 424 | ' too much hassle. So, we'll do it the unix way...
|
---|
| 425 | '
|
---|
| 426 | if Shell("dir /B """ & DosSlashes(strPath) & "\" & DosSlashes(strPattern) & """", True) = 0 _
|
---|
| 427 | And InStr(1, g_strShellOutput, Chr(13)) > 1 _
|
---|
| 428 | then
|
---|
| 429 | ' return the first word.
|
---|
| 430 | LogFindFile = Left(g_strShellOutput, InStr(1, g_strShellOutput, Chr(13)) - 1)
|
---|
| 431 | else
|
---|
| 432 | LogPrint "Testing '" & strPath & "': " & strPattern & " not found"
|
---|
| 433 | LogFindFile = ""
|
---|
| 434 | end if
|
---|
| 435 | end function
|
---|
| 436 |
|
---|
| 437 |
|
---|
| 438 | ''
|
---|
| 439 | ' Initializes the config file.
|
---|
| 440 | sub CfgInit
|
---|
| 441 | FileDelete g_strCfgFile
|
---|
| 442 | CfgPrint "# -*- Makefile -*-"
|
---|
| 443 | CfgPrint "#"
|
---|
| 444 | CfgPrint "# Build configuration generated by " & GetCommandline()
|
---|
| 445 | CfgPrint "#"
|
---|
| 446 | if g_blnInternalMode = False then
|
---|
| 447 | CfgPrint "VBOX_OSE := 1"
|
---|
| 448 | end if
|
---|
| 449 | end sub
|
---|
| 450 |
|
---|
| 451 |
|
---|
| 452 | ''
|
---|
| 453 | ' Prints a string to the config file.
|
---|
| 454 | sub CfgPrint(str)
|
---|
| 455 | FileAppendLine g_strCfgFile, str
|
---|
| 456 | end sub
|
---|
| 457 |
|
---|
| 458 |
|
---|
| 459 | ''
|
---|
| 460 | ' Initializes the environment batch script.
|
---|
| 461 | sub EnvInit
|
---|
| 462 | FileDelete g_strEnvFile
|
---|
| 463 | EnvPrint "@echo off"
|
---|
| 464 | EnvPrint "rem"
|
---|
| 465 | EnvPrint "rem Environment setup script generated by " & GetCommandline()
|
---|
| 466 | EnvPrint "rem"
|
---|
| 467 | end sub
|
---|
| 468 |
|
---|
| 469 |
|
---|
| 470 | ''
|
---|
| 471 | ' Prints a string to the environment batch script.
|
---|
| 472 | sub EnvPrint(str)
|
---|
| 473 | FileAppendLine g_strEnvFile, str
|
---|
| 474 | end sub
|
---|
| 475 |
|
---|
| 476 |
|
---|
| 477 | ''
|
---|
| 478 | ' No COM
|
---|
| 479 | sub DisableCOM(strReason)
|
---|
| 480 | if g_blnDisableCOM = False then
|
---|
| 481 | LogPrint "Disabled COM components: " & strReason
|
---|
| 482 | g_blnDisableCOM = True
|
---|
| 483 | g_strDisableCOM = strReason
|
---|
| 484 | CfgPrint "VBOX_WITH_MAIN="
|
---|
| 485 | CfgPrint "VBOX_WITH_QTGUI="
|
---|
| 486 | CfgPrint "VBOX_WITH_VBOXSDL="
|
---|
| 487 | CfgPrint "VBOX_WITH_DEBUGGER_GUI="
|
---|
| 488 | CfgPrint "VBOX_WITHOUT_COM=1"
|
---|
| 489 | end if
|
---|
| 490 | end sub
|
---|
| 491 |
|
---|
| 492 |
|
---|
| 493 | ''
|
---|
[66] | 494 | ' Checks the the path doesn't contain characters the tools cannot deal with.
|
---|
| 495 | sub CheckSourcePath
|
---|
[67] | 496 | dim sPwd
|
---|
[66] | 497 |
|
---|
[67] | 498 | sPwd = PathAbs(g_strPath)
|
---|
[66] | 499 | if InStr(1, sPwd, " ") > 0 then
|
---|
| 500 | MsgError "Source path contains spaces! Please move it. (" & sPwd & ")"
|
---|
| 501 | end if
|
---|
| 502 | if InStr(1, sPwd, "$") > 0 then
|
---|
| 503 | MsgError "Source path contains the '$' char! Please move it. (" & sPwd & ")"
|
---|
| 504 | end if
|
---|
| 505 | if InStr(1, sPwd, "%") > 0 then
|
---|
| 506 | MsgError "Source path contains the '%' char! Please move it. (" & sPwd & ")"
|
---|
| 507 | end if
|
---|
| 508 | if InStr(1, sPwd, Chr(10)) > 0 _
|
---|
| 509 | Or InStr(1, sPwd, Chr(13)) > 0 _
|
---|
| 510 | Or InStr(1, sPwd, Chr(9)) > 0 _
|
---|
| 511 | then
|
---|
| 512 | MsgError "Source path contains control characters! Please move it. (" & sPwd & ")"
|
---|
| 513 | end if
|
---|
| 514 | Print "Source path: OK"
|
---|
| 515 | end sub
|
---|
| 516 |
|
---|
| 517 |
|
---|
| 518 | ''
|
---|
[1] | 519 | ' Checks for kBuild - very simple :)
|
---|
| 520 | sub CheckForkBuild(strOptkBuild)
|
---|
| 521 | PrintHdr "kBuild"
|
---|
| 522 |
|
---|
| 523 | '
|
---|
| 524 | ' Check if there is a 'kmk' in the path somewhere without
|
---|
| 525 | ' any PATH_KBUILD* stuff around.
|
---|
| 526 | '
|
---|
| 527 | blnNeedEnvVars = True
|
---|
| 528 | g_strPathkBuild = strOptkBuild
|
---|
| 529 | g_strPathkBuildBin = ""
|
---|
| 530 | if (g_strPathkBuild = "") _
|
---|
| 531 | And (EnvGet("PATH_KBUILD") = "") _
|
---|
| 532 | And (EnvGet("PATH_KBUILD_BIN") = "") _
|
---|
| 533 | And (Shell("kmk.exe --version", True) = 0) _
|
---|
| 534 | And (InStr(1,g_strShellOutput, "kBuild Make 0.1") > 0) _
|
---|
| 535 | And (InStr(1,g_strShellOutput, "PATH_KBUILD") > 0) _
|
---|
| 536 | And (InStr(1,g_strShellOutput, "PATH_KBUILD_BIN") > 0) then
|
---|
| 537 | '' @todo Need to parse out the PATH_KBUILD and PATH_KBUILD_BIN values to complete the other tests.
|
---|
| 538 | 'blnNeedEnvVars = False
|
---|
| 539 | MsgWarning "You've installed kBuild it seems. configure.vbs hasn't been updated to " _
|
---|
| 540 | & "deal with that yet and will use the one it ships with. Sorry."
|
---|
| 541 | end if
|
---|
| 542 |
|
---|
| 543 | '
|
---|
| 544 | ' Check for the PATH_KBUILD env.var. and fall back on root/kBuild otherwise.
|
---|
| 545 | '
|
---|
| 546 | if g_strPathkBuild = "" then
|
---|
| 547 | g_strPathkBuild = EnvGet("PATH_KBUILD")
|
---|
| 548 | if (g_strPathkBuild <> "") and (FileExists(g_strPathkBuild & "/footer.kmk") = False) then
|
---|
| 549 | MsgWarning "Ignoring incorrect kBuild path (PATH_KBUILD=" & g_strPathkBuild & ")"
|
---|
| 550 | g_strPathkBuild = ""
|
---|
| 551 | end if
|
---|
| 552 |
|
---|
| 553 | if g_strPathkBuild = "" then
|
---|
| 554 | g_strPathkBuild = g_strPath & "/kBuild"
|
---|
| 555 | end if
|
---|
| 556 | end if
|
---|
| 557 |
|
---|
| 558 | g_strPathkBuild = UnixSlashes(PathAbs(g_strPathkBuild))
|
---|
| 559 |
|
---|
| 560 | '
|
---|
| 561 | ' Determin the location of the kBuild binaries.
|
---|
| 562 | '
|
---|
| 563 | if g_strPathkBuildBin = "" then
|
---|
| 564 | dim str2
|
---|
| 565 | if EnvGet("PROCESSOR_ARCHITECTURE") = "x86" then
|
---|
| 566 | g_strPathkBuildBin = g_strPathkBuild & "/bin/win.x86"
|
---|
| 567 | else ' boldly assumes there is only x86 and amd64.
|
---|
| 568 | g_strPathkBuildBin = g_strPathkBuild & "/bin/win.amd64"
|
---|
| 569 | if FileExists(g_strPathkBuild & "/kmk.exe") = False then
|
---|
| 570 | g_strPathkBuildBin = g_strPathkBuild & "/bin/win.x86"
|
---|
| 571 | end if
|
---|
| 572 | end if
|
---|
| 573 | if FileExists(g_strPathkBuild & "/kmk.exe") = False then
|
---|
| 574 | g_strPathkBuildBin = g_strPathkBuild & "/bin/win.x86"
|
---|
| 575 | end if
|
---|
| 576 | end if
|
---|
| 577 |
|
---|
| 578 | '
|
---|
| 579 | ' Perform basic validations of the kBuild installation.
|
---|
| 580 | '
|
---|
| 581 | if (FileExists(g_strPathkBuild & "/footer.kmk") = False) _
|
---|
| 582 | Or (FileExists(g_strPathkBuild & "/header.kmk") = False) _
|
---|
| 583 | Or (FileExists(g_strPathkBuild & "/rules.kmk") = False) then
|
---|
| 584 | MsgFatal "Can't find valid kBuild at '" & g_strPathkBuild & "'. Either there is an " _
|
---|
| 585 | & "incorrect PATH_KBUILD in the environment or the checkout didn't succeed."
|
---|
| 586 | exit sub
|
---|
| 587 | end if
|
---|
| 588 | if (FileExists(g_strPathkBuildBin & "/kmk.exe") = False) _
|
---|
| 589 | Or (FileExists(g_strPathkBuildBin & "/kmk_ash.exe") = False) then
|
---|
| 590 | MsgFatal "Can't find valid kBuild binaries at '" & g_strPathkBuildBin & "'. Either there is an " _
|
---|
| 591 | & "incorrect PATH_KBUILD in the environment or the checkout didn't succeed."
|
---|
| 592 | exit sub
|
---|
| 593 | end if
|
---|
| 594 |
|
---|
| 595 | if (Shell(DosSlashes(g_strPathkBuildBin & "/kmk.exe") & " --version", True) <> 0) Then
|
---|
| 596 | MsgFatal "Can't execute '" & g_strPathkBuildBin & "/kmk.exe --version'. check configure.log for the out."
|
---|
| 597 | exit sub
|
---|
| 598 | end if
|
---|
| 599 |
|
---|
| 600 | '
|
---|
| 601 | ' Check for env.vars that kBuild uses.
|
---|
| 602 | '
|
---|
| 603 | str = EnvGet("BUILD_TYPE")
|
---|
| 604 | if (str <> "") _
|
---|
| 605 | And (InStr(1, "|release|debug|profile|kprofile", str) <= 0) then
|
---|
| 606 | EnvPrint "set BUILD_TYPE=release"
|
---|
| 607 | EnvSet "BUILD_TYPE", "release"
|
---|
| 608 | MsgWarning "Found unknown BUILD_TYPE value '" & str &"' in your environment. Setting it to 'release'."
|
---|
| 609 | end if
|
---|
| 610 |
|
---|
| 611 | str = EnvGet("BUILD_TARGET")
|
---|
| 612 | if (str <> "") _
|
---|
| 613 | And (InStr(1, "win|win32|win64", str) <= 0) then '' @todo later only 'win' will be valid. remember to fix this check!
|
---|
| 614 | EnvPrint "set BUILD_TARGET=win"
|
---|
| 615 | EnvSet "BUILD_TARGET", "win"
|
---|
| 616 | MsgWarning "Found unknown BUILD_TARGET value '" & str &"' in your environment. Setting it to 'win32'."
|
---|
| 617 | end if
|
---|
| 618 |
|
---|
| 619 | str = EnvGet("BUILD_TARGET_ARCH")
|
---|
| 620 | if (str <> "") _
|
---|
| 621 | And (InStr(1, "x86|amd64", str) <= 0) then
|
---|
| 622 | EnvPrint "set BUILD_TARGET_ARCH=x86"
|
---|
| 623 | EnvSet "BUILD_TARGET_ARCH", "x86"
|
---|
| 624 | MsgWarning "Found unknown BUILD_TARGET_ARCH value '" & str &"' in your environment. Setting it to 'x86'."
|
---|
| 625 | end if
|
---|
| 626 |
|
---|
| 627 | str = EnvGet("BUILD_TARGET_CPU")
|
---|
| 628 | ' perhaps a bit pedantic this since this isn't clearly define nor used much...
|
---|
| 629 | if (str <> "") _
|
---|
| 630 | And (InStr(1, "i386|i486|i686|i786|i868|k5|k6|k7|k8", str) <= 0) then
|
---|
| 631 | EnvPrint "set BUILD_TARGET_CPU=i386"
|
---|
| 632 | EnvSet "BUILD_TARGET_CPU", "i386"
|
---|
| 633 | MsgWarning "Found unknown BUILD_TARGET_CPU value '" & str &"' in your environment. Setting it to 'i386'."
|
---|
| 634 | end if
|
---|
| 635 |
|
---|
| 636 | str = EnvGet("BUILD_PLATFORM")
|
---|
| 637 | if (str <> "") _
|
---|
| 638 | And (InStr(1, "win|win32|win64", str) <= 0) then '' @todo later only 'win' will be valid. remember to fix this check!
|
---|
| 639 | EnvPrint "set BUILD_PLATFORM=win"
|
---|
| 640 | EnvSet "BUILD_PLATFORM", "win"
|
---|
| 641 | MsgWarning "Found unknown BUILD_PLATFORM value '" & str &"' in your environment. Setting it to 'win32'."
|
---|
| 642 | end if
|
---|
| 643 |
|
---|
| 644 | str = EnvGet("BUILD_PLATFORM_ARCH")
|
---|
| 645 | if (str <> "") _
|
---|
| 646 | And (InStr(1, "x86|amd64", str) <= 0) then
|
---|
| 647 | EnvPrint "set BUILD_PLATFORM_ARCH=x86"
|
---|
| 648 | EnvSet "BUILD_PLATFORM_ARCH", "x86"
|
---|
| 649 | MsgWarning "Found unknown BUILD_PLATFORM_ARCH value '" & str &"' in your environment. Setting it to 'x86'."
|
---|
| 650 | end if
|
---|
| 651 |
|
---|
| 652 | str = EnvGet("BUILD_PLATFORM_CPU")
|
---|
| 653 | ' perhaps a bit pedantic this since this isn't clearly define nor used much...
|
---|
| 654 | if (str <> "") _
|
---|
| 655 | And (InStr(1, "i386|i486|i686|i786|i868|k5|k6|k7|k8", str) <= 0) then
|
---|
| 656 | EnvPrint "set BUILD_PLATFORM_CPU=i386"
|
---|
| 657 | EnvSet "BUILD_PLATFORM_CPU", "i386"
|
---|
| 658 | MsgWarning "Found unknown BUILD_PLATFORM_CPU value '" & str &"' in your environment. Setting it to 'i386'."
|
---|
| 659 | end if
|
---|
| 660 |
|
---|
| 661 | '
|
---|
| 662 | ' If PATH_DEV is set, check that it's pointing to something useful.
|
---|
| 663 | '
|
---|
| 664 | str = EnvGet("PATH_DEV")
|
---|
| 665 | g_strPathDev = str
|
---|
| 666 | if (str <> "") _
|
---|
| 667 | And False then '' @todo add some proper tests here.
|
---|
| 668 | strNew = UnixSlashes(g_strPath & "/tools")
|
---|
| 669 | EnvPrint "set PATH_DEV=" & strNew
|
---|
| 670 | EnvSet "PATH_DEV", strNew
|
---|
| 671 | MsgWarning "Found PATH_DEV='" & str &"' in your environment. Setting it to '" & strNew & "'."
|
---|
| 672 | g_strPathDev = strNew
|
---|
| 673 | end if
|
---|
| 674 | if g_strPathDev = "" then g_strPathDev = UnixSlashes(g_strPath & "/tools")
|
---|
| 675 |
|
---|
| 676 | '
|
---|
| 677 | ' Write PATH_KBUILD to the environment script if necessary.
|
---|
| 678 | '
|
---|
| 679 | if blnNeedEnvVars = True then
|
---|
| 680 | EnvPrint "set PATH_KBUILD=" & g_strPathkBuild
|
---|
| 681 | EnvSet "PATH_KBUILD", g_strPathkBuild
|
---|
| 682 | EnvPrint "set PATH=" & g_strPathkBuildBin & ";%PATH%"
|
---|
| 683 | EnvPrepend "PATH", g_strPathkBuildBin & ";"
|
---|
| 684 | end if
|
---|
| 685 |
|
---|
| 686 | PrintResult "kBuild", g_strPathkBuild
|
---|
| 687 | PrintResult "kBuild binaries", g_strPathkBuildBin
|
---|
| 688 | end sub
|
---|
| 689 |
|
---|
| 690 |
|
---|
| 691 | ''
|
---|
| 692 | ' Checks for Visual C++ version 7 or 8.
|
---|
| 693 | sub CheckForVisualCPP(strOptVC, strOptVCCommon, blnOptVCExpressEdition)
|
---|
| 694 | dim strPathVC, strPathVCCommon, str, str2, blnNeedMsPDB
|
---|
| 695 | PrintHdr "Visual C++"
|
---|
| 696 |
|
---|
| 697 | '
|
---|
| 698 | ' Try find it...
|
---|
| 699 | '
|
---|
| 700 | strPathVC = ""
|
---|
| 701 | strPathVCCommon = ""
|
---|
| 702 | if (strPathVC = "") And (strOptVC <> "") then
|
---|
| 703 | if CheckForVisualCPPSub(strOptVC, strOptVCCommon, blnOptVCExpressEdition) then
|
---|
| 704 | strPathVC = strOptVC
|
---|
| 705 | strPathVCCommon = strOptVCCommon
|
---|
| 706 | end if
|
---|
| 707 | end if
|
---|
| 708 |
|
---|
| 709 | if strPathVC = "" Then
|
---|
| 710 | strPathVC = g_strPathDev & "/win.x86/vcc/v8"
|
---|
| 711 | if CheckForVisualCPPSub(strPathVC, "", blnOptVCExpressEdition) = False then
|
---|
| 712 | strPathVC = g_strPathDev & "/win.x86/vcc/v7"
|
---|
| 713 | if CheckForVisualCPPSub(strPathVC, "", blnOptVCExpressEdition) = False then
|
---|
| 714 | strPathVC = ""
|
---|
| 715 | end if
|
---|
| 716 | end if
|
---|
| 717 | end if
|
---|
| 718 |
|
---|
| 719 | if (strPathVC = "") _
|
---|
| 720 | And (Shell("cl.exe", True) = 0) then
|
---|
| 721 | str = Which("cl.exe")
|
---|
| 722 | if FileExists(PathStripFilename(strClExe) & "/build.exe") then
|
---|
| 723 | ' don't know how to deal with this cl.
|
---|
| 724 | Warning "Ignoring DDK cl.exe (" & str & ")."
|
---|
| 725 | else
|
---|
| 726 | strPathVC = PathParent(PathStripFilename(str))
|
---|
| 727 | strPathVCCommon = PathParent(strPathVC) & "/Common7"
|
---|
| 728 | end if
|
---|
| 729 | end if
|
---|
| 730 |
|
---|
| 731 | if strPathVC = "" then
|
---|
| 732 | str = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\8.0\Setup\VS\ProductDir")
|
---|
| 733 | str2 = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\8.0\Setup\VS\EnvironmentDirectory")
|
---|
| 734 | if str <> "" And str2 <> "" Then
|
---|
| 735 | str = str & "VC"
|
---|
| 736 | str2 = PathParent(str2)
|
---|
| 737 | if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
|
---|
| 738 | strPathVC = str
|
---|
| 739 | strPathVCCommon = str2
|
---|
| 740 | end if
|
---|
| 741 | end if
|
---|
| 742 | end if
|
---|
| 743 |
|
---|
| 744 | if strPathVC = "" then
|
---|
| 745 | '' @todo check what this really looks like on 7.1
|
---|
| 746 | str = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\7.1\Setup\VS\ProductDir")
|
---|
| 747 | str2 = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\7.1\Setup\VS\EnvironmentDirectory")
|
---|
| 748 | if str <> "" And str2 <> "" Then
|
---|
| 749 | str = str & "VC7"
|
---|
| 750 | str2 = PathParent(str2)
|
---|
| 751 | if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
|
---|
| 752 | strPathVC = str
|
---|
| 753 | strPathVCCommon = str2
|
---|
| 754 | end if
|
---|
| 755 | end if
|
---|
| 756 | end if
|
---|
| 757 |
|
---|
| 758 | if strPathVC = "" then
|
---|
| 759 | str = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\7.0\Setup\VS\ProductDir")
|
---|
| 760 | str2 = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\7.0\Setup\VS\EnvironmentDirectory")
|
---|
| 761 | if str <> "" And str2 <> "" Then
|
---|
| 762 | str = str & "VC7"
|
---|
| 763 | str2 = PathParent(str2)
|
---|
| 764 | if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
|
---|
| 765 | strPathVC = str
|
---|
| 766 | strPathVCCommon = str2
|
---|
| 767 | end if
|
---|
| 768 | end if
|
---|
| 769 | end if
|
---|
| 770 |
|
---|
| 771 | if strPathVC = "" then
|
---|
| 772 | str = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VC7\8.0")
|
---|
| 773 | if str <> "" then
|
---|
| 774 | str2 = PathParent(str) & "/Common7"
|
---|
| 775 | if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
|
---|
| 776 | strPathVC = str
|
---|
| 777 | strPathVCCommon = str2
|
---|
| 778 | end if
|
---|
| 779 | end if
|
---|
| 780 | end if
|
---|
| 781 |
|
---|
| 782 | ' finally check for the express edition.
|
---|
| 783 | if strPathVC = "" then
|
---|
| 784 | str = RegGetString("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Visual C++ 2005 Express Edition - ENU\InstallLocation")
|
---|
| 785 | if str <> "" then
|
---|
| 786 | str2 = str & "Common7"
|
---|
| 787 | str = str & "VC/"
|
---|
| 788 | if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
|
---|
| 789 | strPathVC = str
|
---|
| 790 | strPathVCCommon = str2
|
---|
| 791 | end if
|
---|
| 792 | end if
|
---|
| 793 | end if
|
---|
| 794 |
|
---|
| 795 | if strPathVC = "" then
|
---|
| 796 | MsgError "Cannot find cl.exe (Visual C++) anywhere on your system. Check the build requirements."
|
---|
| 797 | exit sub
|
---|
| 798 | end if
|
---|
| 799 |
|
---|
| 800 | '
|
---|
| 801 | ' Clean up the path and determin the VC directory.
|
---|
| 802 | '
|
---|
| 803 | strPathVC = UnixSlashes(PathAbs(strPathVC))
|
---|
| 804 | g_strPathVCC = strPathVC
|
---|
| 805 |
|
---|
| 806 | '
|
---|
| 807 | ' Check the version.
|
---|
| 808 | ' We'll have to make sure mspdbXX.dll is somewhere in the PATH.
|
---|
| 809 | '
|
---|
| 810 | if (strPathVCCommon <> "") Then
|
---|
| 811 | EnvAppend "PATH", ";" & strPathVCCommon & "/IDE"
|
---|
| 812 | end if
|
---|
| 813 | if Shell(DosSlashes(strPathVC & "/bin/cl.exe"), True) <> 0 then
|
---|
| 814 | MsgError "Executing '" & strClExe & "' (which we believe to be the Visual C++ compiler driver) failed."
|
---|
| 815 | exit sub
|
---|
| 816 | end if
|
---|
| 817 |
|
---|
| 818 | if (InStr(1, g_strShellOutput, "Version 13.10") <= 0) _
|
---|
| 819 | And (InStr(1, g_strShellOutput, "Version 14.") <= 0) then
|
---|
| 820 | MsgError "The Visual C++ compiler we found ('" & strPathVC & "') isn't 7.1 or 8.0. Check the build requirements."
|
---|
| 821 | exit sub
|
---|
| 822 | end if
|
---|
| 823 |
|
---|
| 824 | '
|
---|
| 825 | ' Ok, emit build config variables.
|
---|
| 826 | '
|
---|
| 827 | if InStr(1, g_strShellOutput, "Version 14.") > 0 then
|
---|
| 828 | CfgPrint "VBOX_USE_VCC80 := 1"
|
---|
| 829 | CfgPrint "PATH_TOOL_VCC80 := " & g_strPathVCC
|
---|
| 830 | CfgPrint "PATH_TOOL_VCC80X86 = $(PATH_TOOL_VCC80)"
|
---|
| 831 | CfgPrint "PATH_TOOL_VCC80AMD64 = $(PATH_TOOL_VCC80)"
|
---|
| 832 | if blnOptVCExpressEdition _
|
---|
| 833 | And LogFileExists(strPathVC, "atlmfc/include/atlbase.h") = False _
|
---|
| 834 | then
|
---|
| 835 | CfgPrint "TOOL_VCC80X86_MT = $(PATH_SDK_WINPSDK)/Bin/mt.exe"
|
---|
| 836 | CfgPrint "TOOL_VCC80AMD64_MT = $(TOOL_VCC80X86_MT)"
|
---|
| 837 | CfgPrint "VBOX_WITHOUT_COMPILER_REDIST=1"
|
---|
| 838 | DisableCOM "No ATL"
|
---|
| 839 | PrintResult "Visual C++ v8 (or later) without ATL", g_strPathVCC
|
---|
| 840 | else
|
---|
| 841 | PrintResult "Visual C++ v8 (or later)", g_strPathVCC
|
---|
| 842 | end if
|
---|
| 843 | else
|
---|
| 844 | CfgPrint "PATH_TOOL_VCC70 := " & g_strPathVCC
|
---|
| 845 | if blnOptVCExpressEdition _
|
---|
| 846 | And LogFileExists(strPathVC, "atlmfc/include/atlbase.h") = False _
|
---|
| 847 | then
|
---|
| 848 | CfgPrint "VBOX_WITHOUT_COMPILER_REDIST=1"
|
---|
| 849 | DisableCOM "No ATL"
|
---|
| 850 | PrintResult "Visual C++ v7.1 without ATL", g_strPathVCC
|
---|
| 851 | else
|
---|
| 852 | PrintResult "Visual C++ v7.1", g_strPathVCC
|
---|
| 853 | end if
|
---|
| 854 | end if
|
---|
| 855 |
|
---|
| 856 | ' and the env.bat path fix.
|
---|
| 857 | if strPathVCCommon <> "" then
|
---|
| 858 | EnvPrint "set PATH=%PATH%;" & strPathVCCommon & "/IDE;"
|
---|
| 859 | end if
|
---|
| 860 | end sub
|
---|
| 861 |
|
---|
| 862 | ''
|
---|
| 863 | ' Checks if the specified path points to a usable PSDK.
|
---|
| 864 | function CheckForVisualCPPSub(strPathVC, strPathVCCommon, blnOptVCExpressEdition)
|
---|
| 865 | strPathVC = UnixSlashes(PathAbs(strPathVC))
|
---|
| 866 | CheckForVisualCPPSub = False
|
---|
| 867 | LogPrint "trying: strPathVC=" & strPathVC & " strPathVCCommon=" & strPathVCCommon & " blnOptVCExpressEdition=" & blnOptVCExpressEdition
|
---|
| 868 | if LogFileExists(strPathVC, "bin/cl.exe") _
|
---|
| 869 | And LogFileExists(strPathVC, "bin/link.exe") _
|
---|
| 870 | And LogFileExists(strPathVC, "include/string.h") _
|
---|
| 871 | And LogFileExists(strPathVC, "lib/libcmt.lib") _
|
---|
| 872 | And LogFileExists(strPathVC, "lib/msvcrt.lib") _
|
---|
| 873 | then
|
---|
| 874 | if blnOptVCExpressEdition _
|
---|
| 875 | Or ( LogFileExists(strPathVC, "atlmfc/include/atlbase.h") _
|
---|
| 876 | And LogFileExists(strPathVC, "atlmfc/lib/atls.lib")) _
|
---|
| 877 | Then
|
---|
| 878 | '' @todo figure out a way we can verify the version/build!
|
---|
| 879 | CheckForVisualCPPSub = True
|
---|
| 880 | end if
|
---|
| 881 | end if
|
---|
| 882 | end function
|
---|
| 883 |
|
---|
| 884 |
|
---|
| 885 | ''
|
---|
| 886 | ' Checks for a platform SDK that works with the compiler
|
---|
| 887 | sub CheckForPlatformSDK(strOptSDK)
|
---|
| 888 | dim strPathPSDK, str
|
---|
| 889 | PrintHdr "Windows Platform SDK (recent)"
|
---|
| 890 |
|
---|
| 891 | strPathPSDK = ""
|
---|
| 892 |
|
---|
| 893 | ' Check the supplied argument first.
|
---|
| 894 | str = strOptSDK
|
---|
| 895 | if str <> "" then
|
---|
| 896 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
| 897 | end if
|
---|
| 898 |
|
---|
| 899 | ' The tools location.
|
---|
| 900 | if strPathPSDK = "" then
|
---|
| 901 | str = g_strPathDev & "/win.x86/sdk/200604"
|
---|
| 902 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
| 903 | end if
|
---|
| 904 |
|
---|
| 905 | if strPathPSDK = "" then
|
---|
| 906 | str = g_strPathDev & "/win.x86/sdk/200504"
|
---|
| 907 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
| 908 | end if
|
---|
| 909 |
|
---|
| 910 | if strPathPSDK = "" then
|
---|
| 911 | str = g_strPathDev & "/win.x86/sdk/200209"
|
---|
| 912 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
| 913 | end if
|
---|
| 914 |
|
---|
| 915 | ' Look for it in the environment
|
---|
| 916 | str = EnvGet("MSSdk")
|
---|
| 917 | if (strPathPSDK = "") And (str <> "") then
|
---|
| 918 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
| 919 | end if
|
---|
| 920 |
|
---|
| 921 | str = EnvGet("Mstools")
|
---|
| 922 | if (strPathPSDK = "") And (str <> "") then
|
---|
| 923 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
| 924 | end if
|
---|
| 925 |
|
---|
| 926 | ' Check if there is one installed with the compiler.
|
---|
| 927 | if (strPathPSDK = "") And (str <> "") then
|
---|
| 928 | str = g_strPathVCC & "/PlatformSDK"
|
---|
| 929 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
| 930 | end if
|
---|
| 931 |
|
---|
| 932 | ' Check the registry next.
|
---|
| 933 | arrSubKeys = RegEnumSubKeys("HKLM", "SOFTWARE\Microsoft\MicrosoftSDK\InstalledSDKs")
|
---|
| 934 | for Each strSubKey In arrSubKeys
|
---|
| 935 | str = RegGetString("HKLM\SOFTWARE\Microsoft\MicrosoftSDK\InstalledSDKs\" & strSubKey & "\Install Dir")
|
---|
| 936 | if (strPathPSDK = "") And (str <> "") then
|
---|
| 937 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
| 938 | end if
|
---|
| 939 | Next
|
---|
| 940 | arrSubKeys = RegEnumSubKeys("HKCU", "SOFTWARE\Microsoft\MicrosoftSDK\InstalledSDKs")
|
---|
| 941 | for Each strSubKey In arrSubKeys
|
---|
| 942 | str = RegGetString("HKCU\SOFTWARE\Microsoft\MicrosoftSDK\InstalledSDKs\" & strSubKey & "\Install Dir")
|
---|
| 943 | if (strPathPSDK = "") And (str <> "") then
|
---|
| 944 | if CheckForPlatformSDKSub(str) then strPathPSDK = str
|
---|
| 945 | end if
|
---|
| 946 | Next
|
---|
| 947 |
|
---|
| 948 | ' Give up.
|
---|
| 949 | if strPathPSDK = "" then
|
---|
| 950 | MsgError "Cannot find a suitable Platform SDK. Check configure.log and the build requirements."
|
---|
| 951 | exit sub
|
---|
| 952 | end if
|
---|
| 953 |
|
---|
| 954 | '
|
---|
| 955 | ' Emit the config.
|
---|
| 956 | '
|
---|
| 957 | strPathPSDK = UnixSlashes(PathAbs(strPathPSDK))
|
---|
| 958 | CfgPrint "PATH_SDK_WINPSDK := " & strPathPSDK
|
---|
| 959 | CfgPrint "PATH_SDK_WINPSDKINCS = $(PATH_SDK_WINPSDK)"
|
---|
| 960 | CfgPrint "PATH_SDK_WIN32SDK = $(PATH_SDK_WINPSDK)"
|
---|
| 961 | CfgPrint "PATH_SDK_WIN64SDK = $(PATH_SDK_WINPSDK)"
|
---|
| 962 |
|
---|
| 963 | PrintResult "Windows Platform SDK", strPathPSDK
|
---|
| 964 | g_strPathPSDK = strPathPSDK
|
---|
| 965 | end sub
|
---|
| 966 |
|
---|
| 967 | ''
|
---|
| 968 | ' Checks if the specified path points to a usable PSDK.
|
---|
| 969 | function CheckForPlatformSDKSub(strPathPSDK)
|
---|
| 970 | CheckForPlatformSDKSub = False
|
---|
| 971 | LogPrint "trying: strPathPSDK=" & strPathPSDK
|
---|
| 972 | if LogFileExists(strPathPSDK, "include/Windows.h") _
|
---|
| 973 | And LogFileExists(strPathPSDK, "lib/Kernel32.Lib") _
|
---|
| 974 | And LogFileExists(strPathPSDK, "lib/User32.Lib") _
|
---|
| 975 | then
|
---|
| 976 | CheckForPlatformSDKSub = True
|
---|
| 977 | end if
|
---|
| 978 | end function
|
---|
| 979 |
|
---|
| 980 |
|
---|
| 981 | ''
|
---|
| 982 | ' Checks for a Windows 2003 DDK that works with the compiler intrinsics.
|
---|
| 983 | sub CheckForWin2k3DDK(strOptDDK)
|
---|
| 984 | dim strPathDDK, str, strSubKeys
|
---|
| 985 | PrintHdr "Windows 2003 DDK, build 3790 or later"
|
---|
| 986 |
|
---|
| 987 | '
|
---|
| 988 | ' Find the DDK.
|
---|
| 989 | '
|
---|
| 990 | strPathDDK = ""
|
---|
| 991 | ' The specified path.
|
---|
| 992 | if (strPathDDK = "") And (strOptDDK <> "") then
|
---|
| 993 | if CheckForWin2k3DDKSub(strOptDDK, True) then strPathDDK = strOptDDK
|
---|
| 994 | end if
|
---|
| 995 |
|
---|
| 996 | ' The tools location.
|
---|
| 997 | if strPathDDK = "" then
|
---|
| 998 | str = g_strPathDev & "/win.x86/ddkwin2k3/200503"
|
---|
| 999 | if CheckForWin2k3DDKSub(str, False) then strPathDDK = str
|
---|
| 1000 | end if
|
---|
| 1001 |
|
---|
| 1002 | if strPathDDK = "" then
|
---|
| 1003 | str = g_strPathDev & "/win.x86/ddkwin2k3/2004"
|
---|
| 1004 | if CheckForWin2k3DDKSub(str, False) then strPathDDK = str
|
---|
| 1005 | end if
|
---|
| 1006 |
|
---|
| 1007 | if strPathDDK = "" then
|
---|
| 1008 | MsgError "Cannot find a suitable Windows 2003 DDK. Check configure.log and the build requirements."
|
---|
| 1009 | exit sub
|
---|
| 1010 | end if
|
---|
| 1011 |
|
---|
| 1012 | ' Check the environment
|
---|
| 1013 | str = EnvGet("DDK_INC_PATH")
|
---|
| 1014 | if (strPathDDK = "") And (str <> "") then
|
---|
| 1015 | str = PathParent(PathParent(str))
|
---|
| 1016 | if CheckForWin2k3DDKSub(str, True) then strPathDDK = str
|
---|
| 1017 | end if
|
---|
| 1018 |
|
---|
| 1019 | str = EnvGet("BASEDIR")
|
---|
| 1020 | if (strPathDDK = "") And (str <> "") then
|
---|
| 1021 | if CheckForWin2k3DDKSub(str, True) then strPathDDK = str
|
---|
| 1022 | end if
|
---|
| 1023 |
|
---|
| 1024 | ' Check the registry next.
|
---|
| 1025 | arrSubKeys = RegEnumSubKeys("HKLM", "SOFTWARE\Microsoft\WINDDK") '' @todo Need some sorting stuff here.
|
---|
| 1026 | for Each strSubKey In arrSubKeys
|
---|
| 1027 | str = RegGetString("HKLM\SOFTWARE\Microsoft\WINDDK\" & strSubKey & "\SFNDirectory")
|
---|
| 1028 | if (strPathDDK = "") And (str <> "") then
|
---|
| 1029 | if CheckForWin2k3DDKSub(str, False) then strPathDDK = str
|
---|
| 1030 | end if
|
---|
| 1031 | Next
|
---|
| 1032 | arrSubKeys = RegEnumSubKeys("HKCU", "SOFTWARE\Microsoft\WINDDK") '' @todo Need some sorting stuff here.
|
---|
| 1033 | for Each strSubKey In arrSubKeys
|
---|
| 1034 | str = RegGetString("HKCU\SOFTWARE\Microsoft\WINDDK\" & strSubKey & "\SFNDirectory")
|
---|
| 1035 | if (strPathDDK = "") And (str <> "") then
|
---|
| 1036 | if CheckForWin2k3DDKSub(str, False) then strPathDDK = str
|
---|
| 1037 | end if
|
---|
| 1038 | Next
|
---|
| 1039 |
|
---|
| 1040 | '
|
---|
| 1041 | ' Emit the config.
|
---|
| 1042 | '
|
---|
| 1043 | strPathDDK = UnixSlashes(PathAbs(strPathDDK))
|
---|
| 1044 | CfgPrint "PATH_SDK_W2K3DDK := " & strPathDDK
|
---|
| 1045 | CfgPrint "PATH_SDK_W2K3DDKX86 = $(PATH_SDK_W2K3DDK)"
|
---|
| 1046 | CfgPrint "PATH_SDK_W2K3DDKAMD64 = $(PATH_SDK_W2K3DDK)"
|
---|
| 1047 |
|
---|
| 1048 | PrintResult "Windows 2003 DDK", strPathDDK
|
---|
| 1049 | end sub
|
---|
| 1050 |
|
---|
| 1051 | '' Quick check if the DDK is in the specified directory or not.
|
---|
| 1052 | function CheckForWin2k3DDKSub(strPathDDK, blnCheckBuild)
|
---|
| 1053 | CheckForWin2k3DDKSub = False
|
---|
| 1054 | LogPrint "trying: strPathDDK=" & strPathDDK & " blnCheckBuild=" & blnCheckBuild
|
---|
| 1055 | if LogFileExists(strPathDDK, "inc/ddk/wnet/ntdef.h") _
|
---|
| 1056 | And LogFileExists(strPathDDK, "lib/wnet/i386/int64.lib") _
|
---|
| 1057 | then
|
---|
| 1058 | '' @todo figure out a way we can verify the version/build!
|
---|
| 1059 | CheckForWin2k3DDKSub = True
|
---|
| 1060 | end if
|
---|
| 1061 | end function
|
---|
| 1062 |
|
---|
| 1063 |
|
---|
| 1064 | ''
|
---|
| 1065 | ' Checks for a recent DirectX SDK.
|
---|
| 1066 | sub CheckForDirectXSDK(strOptDXSDK)
|
---|
| 1067 | dim strPathDXSDK, str, arrSubKeys, arrSubKeys2, strKey, strKey2
|
---|
| 1068 | PrintHdr "Direct X SDK"
|
---|
| 1069 |
|
---|
| 1070 | '
|
---|
| 1071 | ' Find the DX SDK.
|
---|
| 1072 | '
|
---|
| 1073 | strPathDXSDK = ""
|
---|
| 1074 | ' The specified path.
|
---|
| 1075 | if (strPathDXSDK = "") And (strOptDXSDK <> "") then
|
---|
| 1076 | if CheckForDirectXSDKSub(strOptDXSDK) then strPathDXSDK = strOptDXSDK
|
---|
| 1077 | end if
|
---|
| 1078 |
|
---|
| 1079 | ' The tools location.
|
---|
| 1080 | if strPathDXSDK = "" then
|
---|
| 1081 | str = g_strPathDev & "/win.x86/dxsdk/200610"
|
---|
| 1082 | if CheckForDirectXSDKSub(str) then strPathDXSDK = str
|
---|
| 1083 | end if
|
---|
| 1084 |
|
---|
| 1085 | ' Check the installer registry (sucks a bit).
|
---|
| 1086 | arrSubKeys = RegEnumSubKeys("HKLM", "SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData")
|
---|
| 1087 | for Each strSubKey In arrSubKeys
|
---|
| 1088 | strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\" & strSubKey & "\Products"
|
---|
| 1089 | arrSubKeys2 = RegEnumSubKeys("HKLM", strKey)
|
---|
| 1090 | for Each strSubKey2 In arrSubKeys2
|
---|
| 1091 | strKey2 = "HKLM\" & strKey & "\" & strSubKey2 & "\InstallProperties"
|
---|
| 1092 | str = RegGetString(strKey2 & "\DisplayName")
|
---|
| 1093 | if InStr(1, str, "Microsoft DirectX SDK") > 0 then
|
---|
| 1094 | str = RegGetString(strKey2 & "\InstallLocation")
|
---|
| 1095 | if (str <> "") And (strPathDXSDK = "") then
|
---|
| 1096 | if CheckForDirectXSDKSub(str) then
|
---|
| 1097 | strPathDXSDK = str
|
---|
| 1098 | Exit For
|
---|
| 1099 | end if
|
---|
| 1100 | end if
|
---|
| 1101 | end if
|
---|
| 1102 | Next
|
---|
| 1103 | Next
|
---|
| 1104 |
|
---|
| 1105 | if strPathDXSDK = "" then
|
---|
| 1106 | MsgError "Cannot find a suitable Direct X SDK. Check configure.log and the build requirements."
|
---|
| 1107 | exit sub
|
---|
| 1108 | end if
|
---|
| 1109 |
|
---|
| 1110 | '
|
---|
| 1111 | ' Emit the config.
|
---|
| 1112 | '
|
---|
| 1113 | strPathDXSDK = UnixSlashes(PathAbs(strPathDXSDK))
|
---|
| 1114 | CfgPrint "PATH_SDK_DXSDK := " & strPathDXSDK
|
---|
| 1115 | CfgPrint "PATH_SDK_DXSDKX86 = $(PATH_SDK_DXSDK)"
|
---|
| 1116 | CfgPrint "PATH_SDK_DXSDKAMD64 = $(PATH_SDK_DXSDK)"
|
---|
| 1117 |
|
---|
| 1118 | PrintResult "Direct X SDK", strPathDXSDK
|
---|
| 1119 | end sub
|
---|
| 1120 |
|
---|
| 1121 | '' Quick check if the DXSDK is in the specified directory or not.
|
---|
| 1122 | function CheckForDirectXSDKSub(strPathDXSDK)
|
---|
| 1123 | CheckForDirectXSDKSub = False
|
---|
| 1124 | LogPrint "trying: strPathDXSDK=" & strPathDXSDK
|
---|
| 1125 | if LogFileExists(strPathDXSDK, "Lib/x86/dxguid.lib") _
|
---|
| 1126 | then
|
---|
| 1127 | '' @todo figure out a way we can verify the version/build!
|
---|
| 1128 | CheckForDirectXSDKSub = True
|
---|
| 1129 | end if
|
---|
| 1130 | end function
|
---|
| 1131 |
|
---|
| 1132 |
|
---|
| 1133 | ''
|
---|
| 1134 | ' Checks for a MingW32 suitable for building the recompiler.
|
---|
| 1135 | '
|
---|
| 1136 | ' strOptW32API is currently ignored.
|
---|
| 1137 | '
|
---|
| 1138 | sub CheckForMingW(strOptMingw, strOptW32API)
|
---|
| 1139 | dim strPathMingW, strPathW32API, str
|
---|
| 1140 | PrintHdr "MinGW GCC v3.3.x + Binutils + Runtime + W32API"
|
---|
| 1141 |
|
---|
| 1142 | '
|
---|
| 1143 | ' Find the MinGW and W32API tools.
|
---|
| 1144 | '
|
---|
| 1145 | strPathMingW = ""
|
---|
| 1146 | strPathW32API = ""
|
---|
| 1147 |
|
---|
| 1148 | ' The specified path.
|
---|
| 1149 | if (strPathMingW = "") And (strOptMingW <> "") then
|
---|
| 1150 | if CheckForMingWSub(strOptMingW, strOptW32API) then
|
---|
| 1151 | strPathMingW = strOptMingW
|
---|
| 1152 | strPathW32API = strOptW32API
|
---|
| 1153 | end if
|
---|
| 1154 | end if
|
---|
| 1155 |
|
---|
| 1156 | ' The tools location.
|
---|
| 1157 | if strPathMingW = "" then
|
---|
| 1158 | str = g_strPathDev & "/win.x86/mingw32/v3.3.3"
|
---|
| 1159 | str2 = g_strPathDev & "/win.x86/w32api/v2.5"
|
---|
| 1160 | if CheckForMingWSub(str, str2) then
|
---|
| 1161 | strPathMingW = str
|
---|
| 1162 | strPathW32API = str2
|
---|
| 1163 | end if
|
---|
| 1164 | end if
|
---|
| 1165 |
|
---|
| 1166 | ' See if there is any gcc around.
|
---|
| 1167 | if strPathMingW = "" then
|
---|
| 1168 | str = Which("mingw32-gcc.exe")
|
---|
| 1169 | if (str <> "") then
|
---|
| 1170 | str = PathParent(PathStripFilename(str))
|
---|
| 1171 | if CheckForMingWSub(str, str) then strPathMingW = str
|
---|
| 1172 | end if
|
---|
| 1173 | end if
|
---|
| 1174 |
|
---|
| 1175 | if strPathMingW = "" then
|
---|
| 1176 | str = Which("gcc.exe")
|
---|
| 1177 | if (str <> "") then
|
---|
| 1178 | str = PathParent(PathStripFilename(str))
|
---|
| 1179 | if CheckForMingWSub(str, str) then strPathMingW = str
|
---|
| 1180 | end if
|
---|
| 1181 | end if
|
---|
| 1182 |
|
---|
| 1183 | ' Success?
|
---|
| 1184 | if strPathMingW = "" then
|
---|
| 1185 | if strOptMingw = "" then
|
---|
| 1186 | MsgError "Can't locate a suitable MinGW installation. Try specify the path with " _
|
---|
| 1187 | & "the --with-MinGW=<path> argument. If still no luck, consult the configure.log and the build requirements."
|
---|
| 1188 | else
|
---|
| 1189 | MsgError "Can't locate a suitable MinGW installation. Please consult the configure.log and the build requirements."
|
---|
| 1190 | end if
|
---|
| 1191 | exit sub
|
---|
| 1192 | end if
|
---|
| 1193 |
|
---|
| 1194 | '
|
---|
| 1195 | ' Emit the config.
|
---|
| 1196 | '
|
---|
| 1197 | strPathMingW = UnixSlashes(PathAbs(strPathMingW))
|
---|
| 1198 | CfgPrint "PATH_TOOL_MINGW32 := " & strPathMingW
|
---|
| 1199 | PrintResult "MinGW (GCC v" & g_strSubOutput & ")", strPathMingW
|
---|
| 1200 | if (strPathMingW = strPathW32API) Or strPathW32API = "" then
|
---|
| 1201 | CfgPrint "PATH_SDK_W32API = $(PATH_TOOL_MINGW32)"
|
---|
| 1202 | else
|
---|
| 1203 | CfgPrint "PATH_SDK_W32API = " & strPathW32API
|
---|
| 1204 | PrintResult "W32API", strPathW32API
|
---|
| 1205 | end if
|
---|
| 1206 | end sub
|
---|
| 1207 |
|
---|
| 1208 | ''
|
---|
| 1209 | ' Checks if the specified path points to an usable MinGW or not.
|
---|
| 1210 | function CheckForMingWSub(strPathMingW, strPathW32API)
|
---|
| 1211 | g_strSubOutput = ""
|
---|
| 1212 | if strPathW32API = "" then strPathW32API = strPathMingW
|
---|
| 1213 | LogPrint "trying: strPathMingW=" &strPathMingW & " strPathW32API=" & strPathW32API
|
---|
| 1214 |
|
---|
| 1215 | if LogFileExists(strPathMingW, "bin/mingw32-gcc.exe") _
|
---|
| 1216 | And LogFileExists(strPathMingW, "bin/ld.exe") _
|
---|
| 1217 | And LogFileExists(strPathMingW, "bin/objdump.exe") _
|
---|
| 1218 | And LogFileExists(strPathMingW, "bin/dllwrap.exe") _
|
---|
| 1219 | And LogFileExists(strPathMingW, "bin/as.exe") _
|
---|
| 1220 | And LogFileExists(strPathMingW, "include/string.h") _
|
---|
| 1221 | And LogFileExists(strPathMingW, "include/_mingw.h") _
|
---|
| 1222 | And LogFileExists(strPathMingW, "lib/dllcrt1.o") _
|
---|
| 1223 | And LogFileExists(strPathMingW, "lib/dllcrt2.o") _
|
---|
| 1224 | And LogFileExists(strPathMingW, "lib/libmsvcrt.a") _
|
---|
| 1225 | _
|
---|
| 1226 | And LogFileExists(strPathW32API, "lib/libkernel32.a") _
|
---|
| 1227 | And LogFileExists(strPathW32API, "include/windows.h") _
|
---|
| 1228 | then
|
---|
| 1229 | if Shell(DosSlashes(strPathMingW & "/bin/gcc.exe") & " --version", True) = 0 then
|
---|
| 1230 | dim offVer, iMajor, iMinor, iPatch, strVer
|
---|
| 1231 |
|
---|
| 1232 | ' extract the version.
|
---|
| 1233 | strVer = ""
|
---|
| 1234 | offVer = InStr(1, g_strShellOutput, "(GCC) ")
|
---|
| 1235 | if offVer > 0 then
|
---|
| 1236 | strVer = LTrim(Mid(g_strShellOutput, offVer + Len("(GCC) ")))
|
---|
| 1237 | strVer = RTrim(Left(strVer, InStr(1, strVer, " ")))
|
---|
| 1238 | if (Mid(strVer, 2, 1) = ".") _
|
---|
| 1239 | And (Mid(strVer, 4, 1) = ".") then
|
---|
| 1240 | iMajor = Int(Left(strVer, 1)) ' Is Int() the right thing here? I want atoi()!!!
|
---|
| 1241 | iMinor = Int(Mid(strVer, 3, 1))
|
---|
| 1242 | iPatch = Int(Mid(strVer, 5))
|
---|
| 1243 | else
|
---|
| 1244 | LogPrint "Malformed version: '" & strVer & "'"
|
---|
| 1245 | strVer = ""
|
---|
| 1246 | end if
|
---|
| 1247 | end if
|
---|
| 1248 | if strVer <> "" then
|
---|
| 1249 | if (iMajor = 3) And (iMinor = 3) then
|
---|
| 1250 | CheckForMingWSub = True
|
---|
| 1251 | g_strSubOutput = strVer
|
---|
| 1252 | else
|
---|
| 1253 | LogPrint "MinGW version '" & iMajor & "." & iMinor & "." & iPatch & "' is not supported (or configure.vbs failed to parse it correctly)."
|
---|
| 1254 | end if
|
---|
| 1255 | else
|
---|
| 1256 | LogPrint "Couldn't locate the GCC version in the output!"
|
---|
| 1257 | end if
|
---|
| 1258 |
|
---|
| 1259 | else
|
---|
| 1260 | LogPrint "Failed to run gcc.exe!"
|
---|
| 1261 | end if
|
---|
| 1262 | end if
|
---|
| 1263 | end function
|
---|
| 1264 |
|
---|
| 1265 |
|
---|
| 1266 | ''
|
---|
| 1267 | ' Checks for any libSDL binaries.
|
---|
| 1268 | sub CheckForlibSDL(strOptlibSDL)
|
---|
| 1269 | dim strPathlibSDL, str
|
---|
| 1270 | PrintHdr "libSDL"
|
---|
| 1271 |
|
---|
| 1272 | '
|
---|
| 1273 | ' Try find some SDL library.
|
---|
| 1274 | '
|
---|
| 1275 |
|
---|
| 1276 | ' First, the specific location.
|
---|
| 1277 | strPathlibSDL = ""
|
---|
| 1278 | if (strPathlibSDL = "") And (strOptlibSDL <> "") then
|
---|
| 1279 | if CheckForlibSDLSub(strOptlibSDL) then strPathlibSDL = strOptlibSDL
|
---|
| 1280 | end if
|
---|
| 1281 |
|
---|
| 1282 | ' The tools location.
|
---|
| 1283 | if strPathlibSDL = "" Then
|
---|
| 1284 | str = g_strPathDev & "/win.x86/libsdl/v1.2.11"
|
---|
| 1285 | if CheckForlibSDLSub(str) then strPathlibSDL = str
|
---|
| 1286 | end if
|
---|
| 1287 |
|
---|
| 1288 | if strPathlibSDL = "" Then
|
---|
| 1289 | str = g_strPathDev & "/win.x86/libsdl/v1.2.7-InnoTek"
|
---|
| 1290 | if CheckForlibSDLSub(str) then strPathlibSDL = str
|
---|
| 1291 | end if
|
---|
| 1292 |
|
---|
| 1293 | ' Poke about in the path.
|
---|
| 1294 | str = Which("SDLmain.lib")
|
---|
| 1295 | if (strPathlibSDL = "") And (str <> "") Then
|
---|
| 1296 | str = PathParent(PathStripFilename(str))
|
---|
| 1297 | if CheckForlibSDLSub(str) then strPathlibSDL = str
|
---|
| 1298 | end if
|
---|
| 1299 |
|
---|
| 1300 | str = Which("SDL.dll")
|
---|
| 1301 | if (strPathlibSDL = "") And (str <> "") Then
|
---|
| 1302 | str = PathParent(PathStripFilename(str))
|
---|
| 1303 | if CheckForlibSDLSub(str) then strPathlibSDL = str
|
---|
| 1304 | end if
|
---|
| 1305 |
|
---|
| 1306 | ' Success?
|
---|
| 1307 | if strPathlibSDL = "" then
|
---|
| 1308 | if strOptlibSDL = "" then
|
---|
| 1309 | MsgError "Can't locate libSDL. Try specify the path with the --with-libSDL=<path> argument. " _
|
---|
| 1310 | & "If still no luck, consult the configure.log and the build requirements."
|
---|
| 1311 | else
|
---|
| 1312 | MsgError "Can't locate libSDL. Please consult the configure.log and the build requirements."
|
---|
| 1313 | end if
|
---|
| 1314 | exit sub
|
---|
| 1315 | end if
|
---|
| 1316 |
|
---|
| 1317 | strPathLibSDL = UnixSlashes(PathAbs(strPathLibSDL))
|
---|
| 1318 | CfgPrint "PATH_SDK_LIBSDL := " & strPathlibSDL
|
---|
| 1319 |
|
---|
| 1320 | PrintResult "libSDL", strPathlibSDL
|
---|
| 1321 | end sub
|
---|
| 1322 |
|
---|
| 1323 | ''
|
---|
| 1324 | ' Checks if the specified path points to an usable libSDL or not.
|
---|
| 1325 | function CheckForlibSDLSub(strPathlibSDL)
|
---|
| 1326 | CheckForlibSDLSub = False
|
---|
| 1327 | LogPrint "trying: strPathlibSDL=" & strPathlibSDL
|
---|
| 1328 | if LogFileExists(strPathlibSDL, "lib/SDL.lib") _
|
---|
| 1329 | And LogFileExists(strPathlibSDL, "lib/SDLmain.lib") _
|
---|
| 1330 | And LogFileExists(strPathlibSDL, "lib/SDL.dll") _
|
---|
| 1331 | And LogFileExists(strPathlibSDL, "include/SDL.h") _
|
---|
| 1332 | And LogFileExists(strPathlibSDL, "include/SDL_syswm.h") _
|
---|
| 1333 | And LogFileExists(strPathlibSDL, "include/SDL_version.h") _
|
---|
| 1334 | then
|
---|
| 1335 | CheckForlibSDLSub = True
|
---|
| 1336 | end if
|
---|
| 1337 | end function
|
---|
| 1338 |
|
---|
| 1339 |
|
---|
| 1340 | dim g_strXercesVer
|
---|
| 1341 | g_strXercesVer = ""
|
---|
| 1342 |
|
---|
| 1343 | ''
|
---|
| 1344 | ' Checks for xerces.
|
---|
| 1345 | sub CheckForXerces(strOptXerces)
|
---|
| 1346 | dim strPathXerces, str
|
---|
| 1347 | PrintHdr "Xerces"
|
---|
| 1348 |
|
---|
| 1349 | ' Skip if no COM/ATL.
|
---|
| 1350 | if g_blnDisableCOM then
|
---|
| 1351 | PrintResult "Xerces", "Skipped (" & g_strDisableCOM & ")"
|
---|
| 1352 | exit sub
|
---|
| 1353 | end if
|
---|
| 1354 |
|
---|
| 1355 | '
|
---|
| 1356 | ' Try find some xerces dll/lib.
|
---|
| 1357 | '
|
---|
| 1358 | strPathXerces = ""
|
---|
| 1359 | if (strPathXerces = "") And (strOptXerces <> "") then
|
---|
| 1360 | if CheckForXercesSub(strOptXerces) then strPathXerces = strOptXerces
|
---|
| 1361 | end if
|
---|
| 1362 |
|
---|
| 1363 | if strPathXerces = "" Then
|
---|
| 1364 | str = Which("xerces-c_2_9.lib")
|
---|
| 1365 | if str = "" then str = Which("xerces-c_2_8.lib")
|
---|
| 1366 | if str = "" then str = Which("xerces-c_2_7.lib")
|
---|
| 1367 | if str = "" then str = Which("xerces-c_2_6.lib")
|
---|
| 1368 | if str <> "" Then
|
---|
| 1369 | str = PathParent(PathStripFilename(str))
|
---|
| 1370 | if CheckForXercesSub(str) then strPathXerces = str
|
---|
| 1371 | end if
|
---|
| 1372 | end if
|
---|
| 1373 |
|
---|
| 1374 | if strPathXerces = "" Then
|
---|
| 1375 | str = Which("xerces-c_2_9.dll")
|
---|
| 1376 | if str = "" then str = Which("xerces-c_2_8.dll")
|
---|
| 1377 | if str = "" then str = Which("xerces-c_2_7.dll")
|
---|
| 1378 | if str = "" then str = Which("xerces-c_2_6.dll")
|
---|
| 1379 | if str <> "" Then
|
---|
| 1380 | str = PathParent(PathStripFilename(str))
|
---|
| 1381 | if CheckForXercesSub(str) then strPathXerces = str
|
---|
| 1382 | end if
|
---|
| 1383 | end if
|
---|
| 1384 |
|
---|
| 1385 | ' Ignore failure if we're in 'internal' mode.
|
---|
| 1386 | if (strPathXerces = "") and g_blnInternalMode then
|
---|
| 1387 | PrintResult "Xerces", "ignored (internal mode)"
|
---|
| 1388 | exit sub
|
---|
| 1389 | end if
|
---|
| 1390 |
|
---|
| 1391 | ' Success?
|
---|
| 1392 | if strPathXerces = "" then
|
---|
| 1393 | if strOptXerces = "" then
|
---|
| 1394 | MsgError "Can't locate Xerces. Try specify the path with the --with-xerces=<path> argument. " _
|
---|
| 1395 | & "If still no luck, consult the configure.log and the build requirements."
|
---|
| 1396 | else
|
---|
| 1397 | MsgError "Can't locate Xerces. Please consult the configure.log and the build requirements."
|
---|
| 1398 | end if
|
---|
| 1399 | exit sub
|
---|
| 1400 | end if
|
---|
| 1401 |
|
---|
| 1402 | strPathXerces = UnixSlashes(PathAbs(strPathXerces))
|
---|
| 1403 | CfgPrint "SDK_VBOX_XERCES_INCS := " & strPathXerces & "/include"
|
---|
| 1404 | CfgPrint "SDK_VBOX_XERCES_LIBS := " & strPathXerces & "/lib/xerces-c_" & Left(g_strXercesVer, 1) & ".lib"
|
---|
| 1405 | CfgPrint "DLL_SDK_VBOX_XERCES_XERCES := " & strPathXerces & "/bin/xerces-c_" & g_strXercesVer & ".dll"
|
---|
| 1406 |
|
---|
| 1407 | PrintResult "Xerces", strPathXerces
|
---|
| 1408 | end sub
|
---|
| 1409 |
|
---|
| 1410 | ''
|
---|
| 1411 | ' Checks if the specified path points to an usable libSDL or not.
|
---|
| 1412 | function CheckForXercesSub(strPathXerces)
|
---|
| 1413 | dim str
|
---|
| 1414 |
|
---|
| 1415 | CheckForXercersSub = False
|
---|
| 1416 | LogPrint "trying: strPathXerces=" & strPathXerces
|
---|
| 1417 | if LogFileExists(strPathXerces, "include/xercesc/dom/DOM.hpp") _
|
---|
| 1418 | And LogFileExists(strPathXerces, "include/xercesc/validators/datatype/DatatypeValidator.hpp") _
|
---|
| 1419 | then
|
---|
| 1420 | ' The version is encoded in the dll/lib name, so try first
|
---|
| 1421 | ' to find the dll and then a matching lib.
|
---|
| 1422 | str = LogFindFile(strPathXerces, "bin/xerces-c_*.dll")
|
---|
| 1423 | if str <> "" then
|
---|
| 1424 | g_strXercesVer = Mid(str, Len("xerces-c_") + 1, Len(str) - Len("xerces-c_.dll"))
|
---|
| 1425 | ' the library omits the minor version (in the current distro).
|
---|
| 1426 | if LogFileExists(strPathXerces, "lib/xerces-c_" & Left(g_strXercesVer, 1) & ".lib") then
|
---|
| 1427 | CheckForXercesSub = True
|
---|
| 1428 | end if
|
---|
| 1429 | end if
|
---|
| 1430 | end if
|
---|
| 1431 | end function
|
---|
| 1432 |
|
---|
| 1433 |
|
---|
| 1434 | dim g_strXalanVer
|
---|
| 1435 | g_strXalanVer = ""
|
---|
| 1436 |
|
---|
| 1437 | ''
|
---|
| 1438 | ' Checks for Xalan.
|
---|
| 1439 | sub CheckForXalan(strOptXalan)
|
---|
| 1440 | dim strPathXalan, str
|
---|
| 1441 | PrintHdr "Xalan"
|
---|
| 1442 |
|
---|
| 1443 | ' Skip if no COM/ATL.
|
---|
| 1444 | if g_blnDisableCOM then
|
---|
| 1445 | PrintResult "Xalan", "Skipped (" & g_strDisableCOM & ")"
|
---|
| 1446 | exit sub
|
---|
| 1447 | end if
|
---|
| 1448 |
|
---|
| 1449 | '
|
---|
| 1450 | ' Try find some Xalan dll/lib.
|
---|
| 1451 | '
|
---|
| 1452 | strPathXalan = ""
|
---|
| 1453 | if (strPathXalan = "") And (strOptXalan <> "") then
|
---|
| 1454 | if CheckForXalanSub(strOptXalan) then strPathXalan = strOptXalan
|
---|
| 1455 | end if
|
---|
| 1456 |
|
---|
| 1457 | if strPathXalan = "" Then
|
---|
| 1458 | str = Which("Xalan-c_1_12.lib")
|
---|
| 1459 | if str = "" then str = Which("Xalan-c_1_11.lib")
|
---|
| 1460 | if str = "" then str = Which("Xalan-c_1_10.lib")
|
---|
| 1461 | if str = "" then str = Which("Xalan-c_1_9.lib")
|
---|
| 1462 | if str <> "" Then
|
---|
| 1463 | str = PathParent(PathStripFilename(str))
|
---|
| 1464 | if CheckForXalanSub(str) then strPathXalan = str
|
---|
| 1465 | end if
|
---|
| 1466 | end if
|
---|
| 1467 |
|
---|
| 1468 | if strPathXalan = "" Then
|
---|
| 1469 | str = Which("Xalan-c_1_12.dll")
|
---|
| 1470 | if str = "" then str = Which("Xalan-c_1_11.dll")
|
---|
| 1471 | if str = "" then str = Which("Xalan-c_1_10.dll")
|
---|
| 1472 | if str = "" then str = Which("Xalan-c_1_9.dll")
|
---|
| 1473 | if str <> "" Then
|
---|
| 1474 | str = PathParent(PathStripFilename(str))
|
---|
| 1475 | if CheckForXalanSub(str) then strPathXalan = str
|
---|
| 1476 | end if
|
---|
| 1477 | end if
|
---|
| 1478 |
|
---|
| 1479 | ' Ignore failure if we're in 'internal' mode.
|
---|
| 1480 | if (strPathXalan = "") and g_blnInternalMode then
|
---|
| 1481 | PrintResult "Xalan", "ignored (internal mode)"
|
---|
| 1482 | exit sub
|
---|
| 1483 | end if
|
---|
| 1484 |
|
---|
| 1485 | ' Success?
|
---|
| 1486 | if strPathXalan = "" then
|
---|
| 1487 | if strOptXalan = "" then
|
---|
| 1488 | MsgError "Can't locate Xalan. Try specify the path with the --with-Xalan=<path> argument. " _
|
---|
| 1489 | & "If still no luck, consult the configure.log and the build requirements."
|
---|
| 1490 | else
|
---|
| 1491 | MsgError "Can't locate Xalan. Please consult the configure.log and the build requirements."
|
---|
| 1492 | end if
|
---|
| 1493 | exit sub
|
---|
| 1494 | end if
|
---|
| 1495 |
|
---|
| 1496 | strPathXalan = UnixSlashes(PathAbs(strPathXalan))
|
---|
| 1497 | CfgPrint "SDK_VBOX_XALAN_INCS := " & strPathXalan & "/include"
|
---|
| 1498 | CfgPrint "SDK_VBOX_XALAN_LIBS := " & strPathXalan & "/lib/Xalan-C_" & Left(g_strXalanVer, 1) & ".lib"
|
---|
| 1499 | CfgPrint "DLL_SDK_VBOX_XALAN_XALAN := " & strPathXalan & "/bin/Xalan-C_" & g_strXalanVer & ".dll"
|
---|
| 1500 | CfgPrint "DLL_SDK_VBOX_XALAN_XALAN-MESSAGES := " & strPathXalan & "/bin/XalanMessages_" & g_strXalanVer & ".dll"
|
---|
| 1501 |
|
---|
| 1502 | PrintResult "Xalan", strPathXalan
|
---|
| 1503 | end sub
|
---|
| 1504 |
|
---|
| 1505 | ''
|
---|
| 1506 | ' Checks if the specified path points to an usable Xalan or not.
|
---|
| 1507 | function CheckForXalanSub(strPathXalan)
|
---|
| 1508 | dim str
|
---|
| 1509 |
|
---|
| 1510 | CheckForXercersSub = False
|
---|
| 1511 | LogPrint "trying: strPathXalan=" & strPathXalan
|
---|
| 1512 |
|
---|
| 1513 | if LogFileExists(strPathXalan, "include/xalanc/DOMSupport/DOMSupport.hpp") _
|
---|
| 1514 | And LogFileExists(strPathXalan, "include/xalanc/XalanDOM/XalanText.hpp") _
|
---|
| 1515 | then
|
---|
| 1516 | ' The version is encoded in the dll/lib name, so try first
|
---|
| 1517 | ' to find the dll and then a matching lib.
|
---|
| 1518 | str = LogFindFile(strPathXalan, "bin/Xalan-C_*.dll")
|
---|
| 1519 | if str <> "" then
|
---|
| 1520 | g_strXalanVer = Mid(str, Len("Xalan-C_") + 1, Len(str) - Len("Xalan-C_.dll"))
|
---|
| 1521 | ' the library omits the minor version (in the current distro).
|
---|
| 1522 | if LogFileExists(strPathXalan, "bin/XalanMessages_" & g_strXalanVer & ".dll") _
|
---|
| 1523 | And LogFileExists(strPathXalan, "lib/Xalan-C_" & Left(g_strXalanVer, 1) & ".lib") _
|
---|
| 1524 | then
|
---|
| 1525 | CheckForXalanSub = True
|
---|
| 1526 | end if
|
---|
| 1527 | end if
|
---|
| 1528 | end if
|
---|
| 1529 | end function
|
---|
| 1530 |
|
---|
| 1531 |
|
---|
| 1532 | dim g_strQtVer
|
---|
| 1533 | g_strQtVer = ""
|
---|
| 1534 |
|
---|
| 1535 | ''
|
---|
| 1536 | ' Checks for any Qt binaries. Failure here isn't fatal.
|
---|
| 1537 | sub CheckForQt(strOptQt)
|
---|
| 1538 | dim strPathQt, str
|
---|
| 1539 |
|
---|
| 1540 | PrintHdr "Qt"
|
---|
| 1541 |
|
---|
| 1542 | '
|
---|
| 1543 | ' Try find the Qt installation.
|
---|
| 1544 | '
|
---|
| 1545 | strPathQt = ""
|
---|
| 1546 |
|
---|
| 1547 | if (strPathQt = "") And (strOptQt <> "") then
|
---|
| 1548 | if CheckForQtSub(strOptQt) then strPathQt = strOptQt
|
---|
| 1549 | end if
|
---|
| 1550 |
|
---|
| 1551 | if strPathQt = "" then
|
---|
| 1552 | str = g_strPathDev & "/win.x86/qt/v3.3.3"
|
---|
| 1553 | if CheckForQtSub(str) then strPathQt = str
|
---|
| 1554 | end if
|
---|
| 1555 |
|
---|
| 1556 | '' @todo check for Qt installations and stuff later.
|
---|
| 1557 |
|
---|
| 1558 | ' Found anything?
|
---|
| 1559 | if strPathQt = "" then
|
---|
| 1560 | CfgPrint "VBOX_WITH_QTGUI="
|
---|
| 1561 | PrintResult "Qt", "not found"
|
---|
| 1562 | else
|
---|
| 1563 | CfgPrint "VBOX_PATH_QT := " & strPathQt
|
---|
| 1564 | CfgPrint "QTDIR = $(VBOX_PATH_QT)"
|
---|
| 1565 | CfgPrint "LIB_QT = $(VBOX_PATH_QT)/lib/dynamic/qt-mt" & g_strQtVer & ".lib"
|
---|
| 1566 | CfgPrint "VBOX_DLL_QT = $(VBOX_PATH_QT)/bin/qt-mt" & g_strQtVer & ".dll"
|
---|
| 1567 | PrintResult "Qt (" & g_strQtVer & ")", strPathQt
|
---|
| 1568 | end if
|
---|
| 1569 | end sub
|
---|
| 1570 |
|
---|
| 1571 | ''
|
---|
| 1572 | ' Checks if the specified path points to an usable Qt install or not.
|
---|
| 1573 | function CheckForQtSub(strPathQt)
|
---|
| 1574 |
|
---|
| 1575 | CheckForQtSub = False
|
---|
| 1576 | LogPrint "trying: strPathQt=" & strPathQt
|
---|
| 1577 | if LogFileExists(strPathQt, "bin/moc.exe") _
|
---|
| 1578 | And LogFileExists(strPathQt, "bin/uic.exe") _
|
---|
| 1579 | And LogFileExists(strPathQt, "include/qvbox.h") _
|
---|
| 1580 | And LogFileExists(strPathQt, "include/qt_windows.h") _
|
---|
| 1581 | And LogFileExists(strPathQt, "include/qapplication.h") _
|
---|
| 1582 | And LogFileExists(strPathQt, "include/qtextedit.h") _
|
---|
| 1583 | And LogFileExists(strPathQt, "lib/dynamic/qtmain.lib") _
|
---|
| 1584 | then
|
---|
| 1585 | dim str
|
---|
| 1586 |
|
---|
| 1587 | ' This check might need improving.
|
---|
| 1588 | str = LogFindFile(strPathQt, "lib/dynamic/qt-mt33*.lib")
|
---|
| 1589 | if str <> "" then
|
---|
| 1590 | g_strQtVer = Mid(str, Len("qt-mt") + 1, Len(str) - Len("qt-mt.lib"))
|
---|
| 1591 | if LogFileExists(strPathQt, "bin/qt-mt" & g_strQtVer & ".dll") then
|
---|
| 1592 | CheckForQtSub = True
|
---|
| 1593 | end if
|
---|
| 1594 | end if
|
---|
| 1595 | end if
|
---|
| 1596 | end function
|
---|
| 1597 |
|
---|
| 1598 |
|
---|
| 1599 | ''
|
---|
| 1600 | ' Show usage.
|
---|
| 1601 | sub usage
|
---|
| 1602 | Print "Usage: cscript configure.vbs [options]"
|
---|
| 1603 | Print ""
|
---|
| 1604 | Print "Configuration:"
|
---|
| 1605 | Print " -h, --help"
|
---|
| 1606 | Print " --internal"
|
---|
| 1607 | Print ""
|
---|
| 1608 | Print "Components:"
|
---|
| 1609 | Print " --disable-COM"
|
---|
| 1610 | Print ""
|
---|
| 1611 | Print "Locations:"
|
---|
| 1612 | Print " --with-DDK=PATH "
|
---|
| 1613 | Print " --with-DXSDK=PATH "
|
---|
| 1614 | Print " --with-kBuild=PATH "
|
---|
| 1615 | Print " --with-libSDL=PATH "
|
---|
| 1616 | Print " --with-MinGW=PATH "
|
---|
| 1617 | Print " --with-Qt3=PATH "
|
---|
| 1618 | Print " --with-SDK=PATH "
|
---|
| 1619 | Print " --with-VC=PATH "
|
---|
| 1620 | Print " --with-VC-Common=PATH "
|
---|
| 1621 | Print " --with-VC-Express-Edition"
|
---|
| 1622 | Print " --with-W32API=PATH "
|
---|
| 1623 | Print " --with-Xalan=PATH "
|
---|
| 1624 | Print " --with-Xerces=PATH "
|
---|
| 1625 | end sub
|
---|
| 1626 |
|
---|
| 1627 | ''
|
---|
| 1628 | ' The main() like function.
|
---|
| 1629 | '
|
---|
| 1630 | Sub Main
|
---|
| 1631 | '
|
---|
| 1632 | ' Write the log header and check that we're not using wscript.
|
---|
| 1633 | '
|
---|
| 1634 | LogInit
|
---|
| 1635 | If UCase(Right(Wscript.FullName, 11)) = "WSCRIPT.EXE" Then
|
---|
| 1636 | Wscript.Echo "This script must be run under CScript."
|
---|
| 1637 | Wscript.Quit(1)
|
---|
| 1638 | End If
|
---|
| 1639 |
|
---|
| 1640 | '
|
---|
| 1641 | ' Parse arguments.
|
---|
| 1642 | '
|
---|
| 1643 | strOptDDK = ""
|
---|
| 1644 | strOptDXDDK = ""
|
---|
| 1645 | strOptkBuild = ""
|
---|
| 1646 | strOptlibSDL = ""
|
---|
| 1647 | strOptMingW = ""
|
---|
| 1648 | strOptQt = ""
|
---|
| 1649 | strOptSDK = ""
|
---|
| 1650 | strOptVC = ""
|
---|
| 1651 | strOptVCCommon = ""
|
---|
| 1652 | blnOptVCExpressEdition = False
|
---|
| 1653 | strOptW32API = ""
|
---|
| 1654 | blnOptXalan = ""
|
---|
| 1655 | blnOptXerces = ""
|
---|
| 1656 | blnOptDisableCOM = False
|
---|
| 1657 | for i = 1 to Wscript.Arguments.Count
|
---|
| 1658 | dim str, strArg, strPath
|
---|
| 1659 |
|
---|
| 1660 | ' Separate argument and path value
|
---|
| 1661 | str = Wscript.Arguments.item(i - 1)
|
---|
| 1662 | if InStr(1, str, "=") > 0 then
|
---|
| 1663 | strArg = Mid(str, 1, InStr(1, str, "=") - 1)
|
---|
| 1664 | strPath = Mid(str, InStr(1, str, "=") + 1)
|
---|
| 1665 | if strPath = "" then MsgFatal "Syntax error! Argument #" & i & " is missing the path."
|
---|
| 1666 | else
|
---|
| 1667 | strArg = str
|
---|
| 1668 | strPath = ""
|
---|
| 1669 | end if
|
---|
| 1670 |
|
---|
| 1671 | ' Process the argument
|
---|
| 1672 | select case LCase(strArg)
|
---|
| 1673 | case "--with-ddk"
|
---|
| 1674 | strOptDDK = strPath
|
---|
| 1675 | case "--with-dxsdk"
|
---|
| 1676 | strOptDXSDK = strPath
|
---|
| 1677 | case "--with-kbuild"
|
---|
| 1678 | strOptkBuild = strPath
|
---|
| 1679 | case "--with-libsdl"
|
---|
| 1680 | strOptlibSDL = strPath
|
---|
| 1681 | case "--with-mingw"
|
---|
| 1682 | strOptMingW = strPath
|
---|
| 1683 | case "--with-qt"
|
---|
| 1684 | strOptQt = strPath
|
---|
| 1685 | case "--with-sdk"
|
---|
| 1686 | strOptSDK = strPath
|
---|
| 1687 | case "--with-vc"
|
---|
| 1688 | strOptVC = strPath
|
---|
| 1689 | case "--with-vc-common"
|
---|
| 1690 | strOptVCCommon = strPath
|
---|
| 1691 | case "--with-vc-express-edition"
|
---|
| 1692 | blnOptVCExpressEdition = True
|
---|
| 1693 | case "--with-w32api"
|
---|
| 1694 | strOptW32API = strPath
|
---|
| 1695 | case "--with-xalan"
|
---|
| 1696 | strOptXalan = strPath
|
---|
| 1697 | case "--with-xerces"
|
---|
| 1698 | strOptXerces = strPath
|
---|
| 1699 | case "--disable-com"
|
---|
| 1700 | blnOptDisableCOM = True
|
---|
| 1701 | case "--enable-com"
|
---|
| 1702 | blnOptDisableCOM = False
|
---|
| 1703 | case "--internal"
|
---|
| 1704 | g_blnInternalMode = True
|
---|
| 1705 | case "-h", "--help", "-?"
|
---|
| 1706 | usage
|
---|
| 1707 | Wscript.Quit(0)
|
---|
| 1708 | case else
|
---|
| 1709 | Wscript.echo "syntax error: Unknown option '" & str &"'."
|
---|
| 1710 | usage
|
---|
| 1711 | Wscript.Quit(1)
|
---|
| 1712 | end select
|
---|
| 1713 | next
|
---|
| 1714 |
|
---|
| 1715 | '
|
---|
| 1716 | ' Initialize output files.
|
---|
| 1717 | '
|
---|
| 1718 | CfgInit
|
---|
| 1719 | EnvInit
|
---|
| 1720 |
|
---|
| 1721 | '
|
---|
| 1722 | ' Check that the Shell function is sane.
|
---|
| 1723 | '
|
---|
| 1724 | g_objShell.Environment("PROCESS")("TESTING_ENVIRONMENT_INHERITANCE") = "This works"
|
---|
| 1725 | if Shell("set TESTING_ENVIRONMENT_INHERITANC", False) <> 0 then ' The 'E' is missing on purpose (4nt).
|
---|
| 1726 | MsgFatal "shell execution test failed!"
|
---|
| 1727 | end if
|
---|
| 1728 | if g_strShellOutput <> "TESTING_ENVIRONMENT_INHERITANCE=This works" & CHR(13) & CHR(10) then
|
---|
| 1729 | MsgFatal "shell inheritance or shell execution isn't working right."
|
---|
| 1730 | end if
|
---|
| 1731 | g_objShell.Environment("PROCESS")("TESTING_ENVIRONMENT_INHERITANCE") = ""
|
---|
| 1732 | Print "Shell inheritance test: OK"
|
---|
| 1733 |
|
---|
| 1734 | '
|
---|
| 1735 | ' Do the checks.
|
---|
| 1736 | '
|
---|
| 1737 | if blnOptDisableCOM = True then
|
---|
| 1738 | DisableCOM "--disable-com"
|
---|
| 1739 | end if
|
---|
[66] | 1740 | CheckSourcePath
|
---|
[1] | 1741 | CheckForkBuild strOptkBuild
|
---|
| 1742 | CheckForVisualCPP strOptVC, strOptVCCommon, blnOptVCExpressEdition
|
---|
| 1743 | CheckForPlatformSDK strOptSDK
|
---|
| 1744 | CheckForWin2k3DDK strOptDDK
|
---|
| 1745 | CheckForDirectXSDK strOptDXSDK
|
---|
| 1746 | CheckForMingW strOptMingw, strOptW32API
|
---|
| 1747 | CheckForlibSDL strOptlibSDL
|
---|
| 1748 | CheckForXerces strOptXerces
|
---|
| 1749 | CheckForXalan strOptXalan
|
---|
| 1750 | CheckForQt strOptQt
|
---|
| 1751 | if g_blnInternalMode then
|
---|
| 1752 | EnvPrint "call " & g_strPathDev & "/env.cmd %1 %2 %3 %4 %5 %6 %7 %8 %9"
|
---|
| 1753 | end if
|
---|
| 1754 |
|
---|
| 1755 | End Sub
|
---|
| 1756 |
|
---|
| 1757 |
|
---|
| 1758 | Main
|
---|
| 1759 |
|
---|