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