1 | @echo off
|
---|
2 |
|
---|
3 | REM $Id $
|
---|
4 | REM /*
|
---|
5 | REM * Environment Setup Script for VBoxPkg + EDK2.
|
---|
6 | REM */
|
---|
7 |
|
---|
8 | REM /*
|
---|
9 | REM Copyright (C) 2009 Oracle Corporation
|
---|
10 | REM
|
---|
11 | REM This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
12 | REM available from http://www.virtualbox.org. This file is free software;
|
---|
13 | REM you can redistribute it and/or modify it under the terms of the GNU
|
---|
14 | REM General Public License (GPL) as published by the Free Software
|
---|
15 | REM Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
16 | REM VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
17 | REM hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
18 | REM
|
---|
19 | REM */
|
---|
20 |
|
---|
21 | rem
|
---|
22 | rem Figure where the VBox tools are, i.e. that tools/env.cmd has been execute.
|
---|
23 | rem
|
---|
24 | if not "%KBUILD_DEVTOOLS%"=="" goto kbuild_devtools_set
|
---|
25 | if "%PATH_DEVTOOLS%"=="" goto error_devtools
|
---|
26 | set KBUILD_DEVTOOLS=%PATH_DEVTOOLS%
|
---|
27 | :kbuild_devtools_set
|
---|
28 |
|
---|
29 | rem
|
---|
30 | rem Check that all the tools we need are there.
|
---|
31 | rem
|
---|
32 | set MY_MISSING=
|
---|
33 | if not exist "%KBUILD_DEVTOOLS%\win.x86\vcc\v8sp1\bin\cl.exe" echo env.cmd: missing v8sp1.
|
---|
34 | if not exist "%KBUILD_DEVTOOLS%\win.x86\vcc\v8sp1\bin\cl.exe" set MY_MISSING=1
|
---|
35 | if not exist "%KBUILD_DEVTOOLS%\win.x86\vcc\v8sp1\env-x86.cmd" set MY_MISSING=1
|
---|
36 | if not exist "%KBUILD_DEVTOOLS%\win.x86\ddk\6000\bin\x86\nmake.exe" echo env.cmd: missing ddk/6001.
|
---|
37 | if not exist "%KBUILD_DEVTOOLS%\win.x86\ddk\6000\bin\x86\nmake.exe" set MY_MISSING=1
|
---|
38 | if not exist "%KBUILD_DEVTOOLS%\win.x86\sdk\200504\env-x86.cmd" echo env.cmd: missing sdk/200504.
|
---|
39 | if not exist "%KBUILD_DEVTOOLS%\win.x86\sdk\200504\env-x86.cmd" set MY_MISSING=1
|
---|
40 | if "%MY_MISSING%"=="" goto devtools_ok
|
---|
41 | echo env.cmd: Please run kmk -C %KBUILD_DEVTOOLS% KBUILD_TARGET_ARCH=amd64 to fetch the missing tools
|
---|
42 | set MY_MISSING=
|
---|
43 | exit /b1
|
---|
44 | :devtools_ok
|
---|
45 |
|
---|
46 | rem
|
---|
47 | rem Figure out where the EDK2 checkout is.
|
---|
48 | rem
|
---|
49 | if "%CD%"=="" goto error_cd_not_set
|
---|
50 | pushd .
|
---|
51 | cd %~dp0
|
---|
52 | cd ..
|
---|
53 | set WORKSPACE=%CD%
|
---|
54 | popd
|
---|
55 | if exist "%WORKSPACE%\VBoxPkg\VBoxPkg.dsc" goto found_edk2
|
---|
56 | set WORKSPACE=%CD%
|
---|
57 | if exist "%WORKSPACE%\VBoxPkg\VBoxPkg.dsc" goto found_edk2
|
---|
58 | set WORKSPACE=%CD%\..
|
---|
59 | if exist "%WORKSPACE%\VBoxPkg\VBoxPkg.dsc" goto found_edk2
|
---|
60 | set WORKSPACE=%CD%\..\..
|
---|
61 | if exist "%WORKSPACE%\VBoxPkg\VBoxPkg.dsc" goto found_edk2
|
---|
62 | set WORKSPACE=
|
---|
63 | echo env.cmd: Cannot find EDK2. Please enter the VBoxPkg directory in your EDK2 checkout and re-run this script.
|
---|
64 | exit /b 1
|
---|
65 | :found_edk2
|
---|
66 |
|
---|
67 | rem
|
---|
68 | rem Config the workspace.
|
---|
69 | rem
|
---|
70 | if exist "%WORKSPACE%\Conf\target.txt" goto reconfig
|
---|
71 | echo env.cmd: Configuring the workspace...
|
---|
72 |
|
---|
73 | echo # Edited by VBoxPkg/env.cmd (%DATE% %TIME%)> "%WORKSPACE%\Conf\tools_def.txt"
|
---|
74 | echo # > tmp_vbox_env.sed
|
---|
75 | echo s,C:\\Program Files\\Microsoft Visual Studio \.NET 2003\\Vc7,%KBUILD_DEVTOOLS%/win.x86/vcc/v7,>> tmp_vbox_env.sed
|
---|
76 | echo s,C:\\Program Files\\Microsoft Visual Studio \.NET 2003\\Common7\\IDE,%KBUILD_DEVTOOLS%/win.x86/vcc/v7/bin,>> tmp_vbox_env.sed
|
---|
77 | echo s,C:\\Program Files\\Microsoft Visual Studio 8\\Vc,%KBUILD_DEVTOOLS%/win.x86/vcc/v8sp1,>> tmp_vbox_env.sed
|
---|
78 | echo s,C:\\Program Files\\Microsoft Visual Studio 8\\Common7\\IDE,%KBUILD_DEVTOOLS%/win.x86/vcc/v8sp1/bin,>> tmp_vbox_env.sed
|
---|
79 | echo s,C:\\Program Files (x86)\\Microsoft Visual Studio 8\\Vc,%KBUILD_DEVTOOLS%/win.x86/vcc/v8sp1,>> tmp_vbox_env.sed
|
---|
80 | echo s,C:\\Program Files (x86)\\Microsoft Visual Studio 8\\Common7\\IDE,%KBUILD_DEVTOOLS%/win.x86/vcc/v8sp1/bin,>> tmp_vbox_env.sed
|
---|
81 | echo s,C:\\WINDDK\\3790.1830,%KBUILD_DEVTOOLS%/win.x86/ddk/6001,>> tmp_vbox_env.sed
|
---|
82 | echo s,C:\ASL,%KBUILD_DEVTOOLS%/win.x86/bin,>> tmp_vbox_env.sed
|
---|
83 | echo s,c:/cygwin,c:/no-cygwin-please,>> tmp_vbox_env.sed
|
---|
84 | kmk_sed -f tmp_vbox_env.sed --append "%WORKSPACE%\Conf\tools_def.txt" "%WORKSPACE%\BaseTools\Conf\tools_def.template"
|
---|
85 | if not errorlevel 0 goto error_sed
|
---|
86 | del tmp_vbox_env.sed
|
---|
87 |
|
---|
88 | copy "%WORKSPACE%\BaseTools\Conf\build_rule.template" "%WORKSPACE%\Conf\build_rule.txt"
|
---|
89 | if not errorlevel 0 goto error_copy
|
---|
90 |
|
---|
91 | rem must come last
|
---|
92 | echo # Generated by VBoxPkg/env.cmd (%DATE% %TIME%)> "%WORKSPACE%\Conf\target.txt"
|
---|
93 | echo ACTIVE_PLATFORM=VBoxPkg/VBoxPkg.dsc>> "%WORKSPACE%\Conf\target.txt"
|
---|
94 | echo TARGET=DEBUG>> "%WORKSPACE%\Conf\target.txt"
|
---|
95 | echo TARGET_ARCH=IA32>> "%WORKSPACE%\Conf\target.txt"
|
---|
96 | echo TOOL_CHAIN_CONF=Conf/tools_def.txt>> "%WORKSPACE%\Conf\target.txt"
|
---|
97 | echo TOOL_CHAIN_TAG=MYTOOLS>> "%WORKSPACE%\Conf\target.txt"
|
---|
98 | echo MAX_CONCURRENT_THREAD_NUMBER=%NUMBER_OF_PROCESSORS% >> "%WORKSPACE%\Conf\target.txt"
|
---|
99 | echo BUID_RULE_CONF=Conf/build_rule.txt>> "%WORKSPACE%\Conf\target.txt"
|
---|
100 |
|
---|
101 | goto configured
|
---|
102 | :reconfig
|
---|
103 | echo env.cmd: Already configured.
|
---|
104 | echo env.cmd: If you want to reconfigure delete the following files and
|
---|
105 | echo env.cmd: re-run VBoxPkg\env.cmd:
|
---|
106 | echo env.cmd: %WORKSPACE%\Conf\target.txt
|
---|
107 | echo env.cmd: %WORKSPACE%\Conf\tools_def.txt
|
---|
108 | echo env.cmd: %WORKSPACE%\Conf\build_rule.txt
|
---|
109 | :configured
|
---|
110 |
|
---|
111 | rem
|
---|
112 | rem Make sure ComSpec is pointing to the standard Windows shell.
|
---|
113 | rem 4NT and other replacements may cause trouble.
|
---|
114 | rem
|
---|
115 | if "%ComSpec%"=="%SystemRoot%\system32\cmd.exe" goto comspec_ok
|
---|
116 | echo env.cmd: ComSpec does not seem to point at %SystemRoot%\system32\cmd.exe, fixing.
|
---|
117 | echo env.cmd: (ComSpec=%ComSpec%)
|
---|
118 | if not exist "%ComSpec%" echo env.cmd: Huh?? %SystemRoot%\system32\cmd.exe does not exist!
|
---|
119 | if not exist "%ComSpec%" exit /b 1
|
---|
120 | set ComSpec=%SystemRoot%\system32\cmd.exe
|
---|
121 | :comspec_ok
|
---|
122 |
|
---|
123 | rem
|
---|
124 | rem Load the environment.
|
---|
125 | rem
|
---|
126 | echo env.cmd: Loading the environment...
|
---|
127 | call "%KBUILD_DEVTOOLS%\win.x86\sdk\200504\env-x86.cmd"
|
---|
128 | if not errorlevel 0 goto error_sdk_env
|
---|
129 |
|
---|
130 | call "%KBUILD_DEVTOOLS%\win.x86\vcc\v8sp1\env-x86.cmd"
|
---|
131 | if not errorlevel 0 goto error_vcc_env
|
---|
132 |
|
---|
133 | set EDK_TOOLS_PATH=%WORKSPACE%\BaseTools
|
---|
134 | call "%WORKSPACE%\BaseTools\toolsetup.bat"
|
---|
135 | if not errorlevel 0 goto error_edk2_toolsetup
|
---|
136 |
|
---|
137 | echo env.cmd: Done.
|
---|
138 | exit /b 0
|
---|
139 |
|
---|
140 |
|
---|
141 | rem
|
---|
142 | rem Error messages.
|
---|
143 | rem
|
---|
144 | :error_devtools
|
---|
145 | echo env.cmd: Cannot find the VirtualBox devtools. Did you remember run tools/env.cmd in the VirtualBox tree first?
|
---|
146 | exit /b 1
|
---|
147 |
|
---|
148 | :error_sdk_env
|
---|
149 | echo env.cmd: the SDK env script failed.
|
---|
150 | exit /b 1
|
---|
151 |
|
---|
152 | :error_vcc_env
|
---|
153 | echo env.cmd: the Visual C++ env script failed.
|
---|
154 | exit /b 1
|
---|
155 |
|
---|
156 | :error_edk2_toolsetup
|
---|
157 | echo env.cmd: the EDK2 env script failed.
|
---|
158 | exit /b 1
|
---|
159 |
|
---|
160 | :error_cd_not_set
|
---|
161 | echo env.cmd: the internal CD variable isn't set. Complain to bird.
|
---|
162 | exit /b 1
|
---|
163 |
|
---|
164 | :error_sed
|
---|
165 | echo env.cmd: kmk_sed failed, see above error messages(s).
|
---|
166 | exit /b 1
|
---|
167 |
|
---|
168 | :error_copy
|
---|
169 | echo env.cmd: copy fails, see above error message(s).
|
---|
170 | del tmp_vbox_env.sed
|
---|
171 | exit /b 1
|
---|