configure.vbs revision 677833bc953b6cb418c701facbdcf4aa18d6c44e
2362N/A' The purpose of this script is to check for all external tools, headers, and 0N/A' libraries VBox OSE depends on. 0N/A' The script generates the build configuration file 'AutoConfig.kmk' and the 0N/A' environment setup script 'env.bat'. A log of what has been done is 2362N/A' written to 'configure.log'. 0N/A' Copyright (C) 2006 InnoTek Systemberatung GmbH 0N/A' This file is part of VirtualBox Open Source Edition (OSE), as 0N/A' you can redistribute it and/or modify it under the terms of the GNU 0N/A' General Public License as published by the Free Software Foundation, 0N/A' in version 2 as it comes in the "COPYING" file of the VirtualBox OSE 0N/A' distribution. VirtualBox OSE is distributed in the hope that it will 0N/A' be useful, but WITHOUT ANY WARRANTY of any kind. 2362N/A' If you received this file as part of a commercial VirtualBox 2362N/A' distribution, then only the terms of your commercial VirtualBox 2362N/A' license agreement apply instead of the previous paragraph. 0N/A'***************************************************************************** 0N/A'* Global Variables * 1652N/A'***************************************************************************** 0N/A'g_strTmpFile = g_strPath & "\configure.tmp" 0N/A' The internal mode is primarily for skipping the xerces and xalan monsters. 0N/A' Converts to unix slashes 0N/A' Converts to dos slashes 0N/A' Read a file (typically the tmp file) into a string. 0N/A' Appends a line to an ascii file. 0N/A' Checks if the file exists. 0N/A' Checks if the directory exists. 0N/A' Gets a value from the registry. Returns "" if string wasn't found / valid. 0N/A On Error Resume Next 0N/A' Returns an array of subkey strings. 0N/A set objReg =
GetObject(
"winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
0N/A On Error Resume Next 0N/A' Gets the commandline used to invoke the script. 0N/A '' @todo find an api for querying it instead of reconstructing it like this... 0N/A' Gets an environment variable. 0N/A' Sets an environment variable. 0N/A' Appends a string to an environment variable 0N/A' Prepends a string to an environment variable 0N/A' Get the path of the parent directory. Returns root if root was specified. 0N/A' Strips the filename from at path. 0N/A' Get the abs path, use the short version if necessary. 0N/A ' ignore non-existing paths. 0N/A MsgFatal "PathAbs(" &
str &
") attempted to return filename with problematic " _
0N/A &
"need to be copied or reinstalled to a location without 'spaces', '$', ';' " _
0N/A &
"or '&' in the path name. (Unless it's a problem with this script of course...)" 0N/A' Executes a command in the shell catching output in g_strShellOutput 0N/A' Try find the specified file in the path. 0N/A ' registry or somewhere? 0N/A' Append text to the log file and echo it to stdout 0N/A' Prints a test header 0N/A' Prints a success message 0N/A' Error message, fatal unless flag to ignore errors is given. 0N/A' Write a log header with some basic info. 0N/A ' some Wscript stuff 0N/A' Append text to the log file. 0N/A 'Wscript.Echo "dbg: " & str 0N/A' Checks if the file exists and logs failures. 0N/A' Finds the first file matching the pattern. 0N/A' If no file is found, log the failure. 0N/A ' Yes, there are some facy database kinda interface to the filesystem 0N/A ' however, breaking down the path and constructing a usable query is 0N/A ' too much hassle. So, we'll do it the unix way... 0N/A ' return the first word. 0N/A' Initializes the config file. 0N/A' Prints a string to the config file. 0N/A' Initializes the environment batch script. 0N/A' Prints a string to the environment batch script. ' Checks for kBuild - very simple :) ' Check if there is a 'kmk' in the path somewhere without ' any PATH_KBUILD* stuff around. And (
EnvGet(
"PATH_KBUILD") =
"") _
And (
EnvGet(
"PATH_KBUILD_BIN") =
"") _
And (
Shell(
"kmk.exe --version",
True) =
0) _
'' @todo Need to parse out the PATH_KBUILD and PATH_KBUILD_BIN values to complete the other tests. &
"deal with that yet and will use the one it ships with. Sorry." ' Check for the PATH_KBUILD env.var. and fall back on root/kBuild otherwise. ' Determin the location of the kBuild binaries. if EnvGet(
"PROCESSOR_ARCHITECTURE") =
"x86" then else ' boldly assumes there is only x86 and amd64. ' Perform basic validations of the kBuild installation. &
"incorrect PATH_KBUILD in the environment or the checkout didn't succeed." &
"incorrect PATH_KBUILD in the environment or the checkout didn't succeed." ' Check for env.vars that kBuild uses. And (
InStr(
1,
"|release|debug|profile|kprofile",
str) <=
0)
then EnvSet "BUILD_TYPE",
"release" MsgWarning "Found unknown BUILD_TYPE value '" &
str &
"' in your environment. Setting it to 'release'." And (
InStr(
1,
"win|win32|win64",
str) <=
0)
then '' @todo later only 'win' will be valid. remember to fix this check! MsgWarning "Found unknown BUILD_TARGET value '" &
str &
"' in your environment. Setting it to 'win32'." And (
InStr(
1,
"x86|amd64",
str) <=
0)
then EnvSet "BUILD_TARGET_ARCH",
"x86" MsgWarning "Found unknown BUILD_TARGET_ARCH value '" &
str &
"' in your environment. Setting it to 'x86'." ' perhaps a bit pedantic this since this isn't clearly define nor used much... And (
InStr(
1,
"i386|i486|i686|i786|i868|k5|k6|k7|k8",
str) <=
0)
then EnvSet "BUILD_TARGET_CPU",
"i386" MsgWarning "Found unknown BUILD_TARGET_CPU value '" &
str &
"' in your environment. Setting it to 'i386'." And (
InStr(
1,
"win|win32|win64",
str) <=
0)
then '' @todo later only 'win' will be valid. remember to fix this check! EnvSet "BUILD_PLATFORM",
"win" MsgWarning "Found unknown BUILD_PLATFORM value '" &
str &
"' in your environment. Setting it to 'win32'." And (
InStr(
1,
"x86|amd64",
str) <=
0)
then EnvSet "BUILD_PLATFORM_ARCH",
"x86" MsgWarning "Found unknown BUILD_PLATFORM_ARCH value '" &
str &
"' in your environment. Setting it to 'x86'." ' perhaps a bit pedantic this since this isn't clearly define nor used much... And (
InStr(
1,
"i386|i486|i686|i786|i868|k5|k6|k7|k8",
str) <=
0)
then EnvSet "BUILD_PLATFORM_CPU",
"i386" MsgWarning "Found unknown BUILD_PLATFORM_CPU value '" &
str &
"' in your environment. Setting it to 'i386'." ' If PATH_DEV is set, check that it's pointing to something useful. And False then '' @todo add some proper tests here. ' Write PATH_KBUILD to the environment script if necessary. ' Checks for Visual C++ version 7 or 8. And (
Shell(
"cl.exe",
True) =
0)
then ' don't know how to deal with this cl. str =
RegGetString(
"HKLM\SOFTWARE\Microsoft\VisualStudio\8.0\Setup\VS\ProductDir")
str2 =
RegGetString(
"HKLM\SOFTWARE\Microsoft\VisualStudio\8.0\Setup\VS\EnvironmentDirectory")
'' @todo check what this really looks like on 7.1 str =
RegGetString(
"HKLM\SOFTWARE\Microsoft\VisualStudio\7.1\Setup\VS\ProductDir")
str2 =
RegGetString(
"HKLM\SOFTWARE\Microsoft\VisualStudio\7.1\Setup\VS\EnvironmentDirectory")
str =
RegGetString(
"HKLM\SOFTWARE\Microsoft\VisualStudio\7.0\Setup\VS\ProductDir")
str2 =
RegGetString(
"HKLM\SOFTWARE\Microsoft\VisualStudio\7.0\Setup\VS\EnvironmentDirectory")
' finally check for the express edition. str =
RegGetString(
"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Visual C++ 2005 Express Edition - ENU\InstallLocation")
MsgError "Cannot find cl.exe (Visual C++) anywhere on your system. Check the build requirements." ' Clean up the path and determin the VC directory. ' We'll have to make sure mspdbXX.dll is somewhere in the PATH. MsgError "Executing '" &
strClExe &
"' (which we believe to be the Visual C++ compiler driver) failed." MsgError "The Visual C++ compiler we found ('" &
strPathVC &
"') isn't 7.1 or 8.0. Check the build requirements." ' Ok, emit build config variables. CfgPrint "PATH_TOOL_VCC80X86 = $(PATH_TOOL_VCC80)" CfgPrint "PATH_TOOL_VCC80AMD64 = $(PATH_TOOL_VCC80)" CfgPrint "TOOL_VCC80AMD64_MT = $(TOOL_VCC80X86_MT)" CfgPrint "VBOX_WITHOUT_COMPILER_REDIST=1" CfgPrint "VBOX_WITHOUT_COMPILER_REDIST=1" ' and the env.bat path fix. ' Checks if the specified path points to a usable PSDK. ' Checks for a platform SDK that works with the compiler PrintHdr "Windows Platform SDK (recent)" ' Check the supplied argument first. ' Look for it in the environment ' Check if there is one installed with the compiler. ' Check the registry next. MsgError "Cannot find a suitable Platform SDK. Check configure.log and the build requirements." CfgPrint "PATH_SDK_WINPSDKINCS = $(PATH_SDK_WINPSDK)" CfgPrint "PATH_SDK_WIN32SDK = $(PATH_SDK_WINPSDK)" CfgPrint "PATH_SDK_WIN64SDK = $(PATH_SDK_WINPSDK)" ' Checks if the specified path points to a usable PSDK. ' Checks for a Windows 2003 DDK that works with the compiler intrinsics. PrintHdr "Windows 2003 DDK, build 3790 or later" MsgError "Cannot find a suitable Windows 2003 DDK. Check configure.log and the build requirements." ' Check the registry next. CfgPrint "PATH_SDK_W2K3DDKX86 = $(PATH_SDK_W2K3DDK)" CfgPrint "PATH_SDK_W2K3DDKAMD64 = $(PATH_SDK_W2K3DDK)" '' Quick check if the DDK is in the specified directory or not. ' Checks for a recent DirectX SDK. ' Check the installer registry (sucks a bit). strKey =
"SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\" &
strSubKey &
"\Products" if InStr(
1,
str,
"Microsoft DirectX SDK") >
0 then MsgError "Cannot find a suitable Direct X SDK. Check configure.log and the build requirements." CfgPrint "PATH_SDK_DXSDKX86 = $(PATH_SDK_DXSDK)" CfgPrint "PATH_SDK_DXSDKAMD64 = $(PATH_SDK_DXSDK)" '' Quick check if the DXSDK is in the specified directory or not. ' Checks for a MingW32 suitable for building the recompiler. ' strOptW32API is currently ignored. PrintHdr "MinGW GCC v3.3.x + Binutils + Runtime + W32API" ' Find the MinGW and W32API tools. ' See if there is any gcc around. MsgError "Can't locate a suitable MinGW installation. Try specify the path with " _
&
"the --with-MinGW=<path> argument. If still no luck, consult the configure.log and the build requirements." MsgError "Can't locate a suitable MinGW installation. Please consult the configure.log and the build requirements." CfgPrint "PATH_SDK_W32API = $(PATH_TOOL_MINGW32)" ' Checks if the specified path points to an usable MinGW or not. LogPrint "Couldn't locate the GCC version in the output!" ' Checks for any libSDL binaries. ' Try find some SDL library. ' First, the specific location. ' Poke about in the path. MsgError "Can't locate libSDL. Try specify the path with the --with-libSDL=<path> argument. " _
&
"If still no luck, consult the configure.log and the build requirements." MsgError "Can't locate libSDL. Please consult the configure.log and the build requirements." ' Checks if the specified path points to an usable libSDL or not. ' Try find some xerces dll/lib. ' Ignore failure if we're in 'internal' mode. MsgError "Can't locate Xerces. Try specify the path with the --with-xerces=<path> argument. " _
&
"If still no luck, consult the configure.log and the build requirements." MsgError "Can't locate Xerces. Please consult the configure.log and the build requirements." ' Checks if the specified path points to an usable libSDL or not. ' The version is encoded in the dll/lib name, so try first ' to find the dll and then a matching lib. ' the library omits the minor version (in the current distro). ' Try find some Xalan dll/lib. ' Ignore failure if we're in 'internal' mode. MsgError "Can't locate Xalan. Try specify the path with the --with-Xalan=<path> argument. " _
&
"If still no luck, consult the configure.log and the build requirements." MsgError "Can't locate Xalan. Please consult the configure.log and the build requirements." ' Checks if the specified path points to an usable Xalan or not. ' The version is encoded in the dll/lib name, so try first ' to find the dll and then a matching lib. ' the library omits the minor version (in the current distro). ' Checks for any Qt binaries. Failure here isn't fatal. ' Try find the Qt installation. '' @todo check for Qt installations and stuff later. ' Checks if the specified path points to an usable Qt install or not. ' This check might need improving. Print " --with-DDK=PATH " Print " --with-DXSDK=PATH " Print " --with-kBuild=PATH " Print " --with-libSDL=PATH " Print " --with-MinGW=PATH " Print " --with-Qt3=PATH " Print " --with-SDK=PATH " Print " --with-VC-Common=PATH " Print " --with-VC-Express-Edition" Print " --with-W32API=PATH " Print " --with-Xalan=PATH " Print " --with-Xerces=PATH " ' The main() like function. ' Write the log header and check that we're not using wscript. ' Separate argument and path value if strPath =
"" then MsgFatal "Syntax error! Argument #" & i &
" is missing the path." case "--with-vc-express-edition" case "-h",
"--help",
"-?" ' Initialize output files. ' Check that the Shell function is sane. if Shell(
"set TESTING_ENVIRONMENT_INHERITANC",
False) <>
0 then ' The 'E' is missing on purpose (4nt). MsgFatal "shell inheritance or shell execution isn't working right." Print "Shell inheritance test: OK"