1 kumpf 1.1 @echo off
2 REM ***********************************************************
3 REM ***********************************************************
4 REM Batch file for building the Pegasus-WMI Mapper on Windows
5 REM
|
6 kumpf 1.7 REM NOTE: To run this script, GNU make (gnumake.exe) and
|
7 kumpf 1.1 REM Pegasus mu.exe MUST BE in the PATH or in PEGASUS_ROOT
8 REM
9 REM Also, this batch file assumes Visual C++ 6.0 and the
10 REM Microsoft Platform SDK are installed, vcvars32.bat is
|
11 kumpf 1.7 REM in the PATH and the MSSdk env var is defined. Other
12 REM environments (e.g., VisualStudio.NET) may require
|
13 kumpf 1.1 REM modifications to this batch file.
14 REM
15 REM Environment Variables:
|
16 kumpf 1.7 REM PLATFORM
|
17 kumpf 1.1 REM - Indicates the target platform for the build
18 REM - Valid settings are "Win32" and "Win64"
19 REM - Default(if not set) = "Win32"
|
20 kumpf 1.7 REM FLAVOR
|
21 kumpf 1.1 REM - Indicates whether to build debug or product/release bits
22 REM - Valid settings are "product" and "debug"
23 REM - Default(if not set) = "product"
24 REM PEGASUS_ROOT
25 REM - Root directory of the Pegasus "source" to build from
26 REM (e.g., "C:\Pegasus")
27 REM - No default -- MUST BE SET prior to running this script
28 REM or the script will fail.
29 REM PEGASUS_HOME
|
30 kumpf 1.7 REM - Root directory where the built Pegasus binaries, etc.,
|
31 kumpf 1.1 REM are to be "installed" (e.g., "C:\Pegasus")
32 REM - No default -- MUST BE SET prior to running this script
33 REM or the script will fail.
34 REM PEGASUS_HAS_SSL
35 REM - If set, indicates Pegasus to be built with SSL support
36 REM - If not set, Pegasus is still built with SSL by default
37 REM (may be overridden by the command line param, below)
38 REM OPENSSL_HOME
39 REM - Root directory of the OpenSSL libraries/sdk
40 REM - No default -- must be set prior to running this script
41 REM if SSL support is specified (see PEGASUS_HAS_SSL, above).
42 REM
43 REM Command Line Parameters (used to override environment vars)
44 REM [-]Win32 overrides PLATFORM=Win32
45 REM [-]Win64 overrides PLATFORM=Win64
46 REM [-]d[ebug] overrides FLAVOR=debug
47 REM [-]p[rodcut] overrides FLAVOR=product
48 REM [-]r[elease] overrides FLAVOR=product
49 REM [-]ssl overrides PEGASUS_HAS_SSL defined
50 REM [-]nossl overrides PEGASUS_HAS_SSL not defined
51 REM
52 kumpf 1.1 REM ***********************************************************
53 REM ***********************************************************
54 echo Building Pegasus...
55
56 REM ***********************************************************
57 REM Keep any environment changes local
58 REM ***********************************************************
59 SETLOCAL
60
61 REM ***********************************************************
62 REM Default variables, if not already set
63 REM ***********************************************************
64 if not defined PLATFORM set PLATFORM=Win32
65 if not defined FLAVOR set FLAVOR=product
66 if not defined PEGASUS_HAS_SSL set PEGASUS_HAS_SSL=Yes
67 if not defined PEGASUS_WMIMAPPER set PEGASUS_WMIMAPPER=Yes
68 if not defined PEGASUS_ROOT goto ERR_NO_PEGASUS_ROOT
69 if not defined PEGASUS_HOME goto ERR_NO_PEGASUS_HOME
70
71 REM ***********************************************************
|
72 kumpf 1.2 REM Add %PEGASUS_HOME%\bin to the PATH (needed for tests, etc.)
73 REM ***********************************************************
74 set PATH=%PEGASUS_HOME%\bin;%PATH%
75
76 REM ***********************************************************
|
77 kumpf 1.1 REM Process command line args
78 REM
79 REM Valid args are (NOT case-sensitive):
80 REM [-]Win32 overrides PLATFORM=Win32
81 REM [-]Win64 overrides PLATFORM=Win64
82 REM [-]d[ebug] overrides FLAVOR=debug
83 REM [-]p[rodcut] overrides FLAVOR=product
84 REM [-]r[elease] overrides FLAVOR=product
85 REM [-]ssl overrides PEGASUS_HAS_SSL defined
86 REM [-]nossl overrides PEGASUS_HAS_SSL not defined
87 REM ***********************************************************
88 :CHECK_COMMAND_LINE_ARG
89 if "%1" == "" goto DONE_WITH_COMMAND_LINE
90
91 if /i "%1"=="-Win32" goto ARG_PLATFORM_WIN32
92 if /i "%1"=="Win32" goto ARG_PLATFORM_WIN32
93
94 if /i "%1"=="-Win64" goto ARG_PLATFORM_WIN64
95 if /i "%1"=="Win64" goto ARG_PLATFORM_WIN64
96
97 if /i "%1"=="-debug" goto ARG_FLAVOR_DEBUG
98 kumpf 1.1 if /i "%1"=="debug" goto ARG_FLAVOR_DEBUG
99 if /i "%1"=="-d" goto ARG_FLAVOR_DEBUG
100 if /i "%1"=="d" goto ARG_FLAVOR_DEBUG
101
102 if /i "%1"=="-product" goto ARG_FLAVOR_PRODUCT
103 if /i "%1"=="product" goto ARG_FLAVOR_PRODUCT
104 if /i "%1"=="-p" goto ARG_FLAVOR_PRODUCT
105 if /i "%1"=="p" goto ARG_FLAVOR_PRODUCT
106
107 if /i "%1"=="-release" goto ARG_FLAVOR_PRODUCT
108 if /i "%1"=="release" goto ARG_FLAVOR_PRODUCT
109 if /i "%1"=="-r" goto ARG_FLAVOR_PRODUCT
110 if /i "%1"=="r" goto ARG_FLAVOR_PRODUCT
111
112 if /i "%1"=="-ssl" goto ARG_SSL
113 if /i "%1"=="ssl" goto ARG_SSL
114
115 if /i "%1"=="-nossl" goto ARG_NOSSL
116 if /i "%1"=="nossl" goto ARG_NOSSL
117
118 REM: If here, have an INVALID ARGUMENT:
119 kumpf 1.1 echo Invalid argument on the command line: %1. Ignoring...
120 goto NEXT_ARG
121
122 :ARG_PLATFORM_WIN32
123 set PLATFORM=Win32
124 goto NEXT_ARG
125
126 :ARG_PLATFORM_WIN64
127 set PLATFORM=Win64
128 goto NEXT_ARG
129
130 :ARG_FLAVOR_DEBUG
131 set FLAVOR=debug
132 goto NEXT_ARG
133
134 :ARG_FLAVOR_PRODUCT
135 set FLAVOR=product
136 goto NEXT_ARG
137
138 :ARG_SSL
139 set PEGASUS_HAS_SSL=Yes
140 kumpf 1.1 if not defined OPENSSL_HOME goto ERR_NO_OPENSSL_HOME
|
141 kumpf 1.2 set PATH=%OPENSSL_HOME%\bin;%PATH%
|
142 kumpf 1.1 goto NEXT_ARG
143
144 :ARG_NOSSL
145 set PEGASUS_HAS_SSL=
146 goto NEXT_ARG
147
148 :NEXT_ARG
149 shift
150 goto CHECK_COMMAND_LINE_ARG
151
152 :DONE_WITH_COMMAND_LINE
153
154 REM ***********************************************************
155 REM Translate the PLATFORM and FLAVOR vars into environment
156 REM variables used by Pegasus for specifying platform & flavor
157 REM ***********************************************************
158 if /i "%FLAVOR%" == "product" set PEGASUS_DEBUG=
159 if /i "%FLAVOR%" == "debug" set PEGASUS_DEBUG=1
160
|
161 kumpf 1.7 REM If/when Pegasus has a Win64/IPF config, the following can be
|
162 kumpf 1.1 REM used for setting the appropriate config, based on the PLATFORM:
163 REM if "%PLATFORM%" == "Win32" set PEGASUS_PLATFORM=WIN32_IX86_MSVC
164 REM if "%PLATFORM%" == "Win64" set PEGASUS_PLATFORM=WIN64_IA64_MSVC
165 REM For now, using WIN32_IX86_MSVC, (even for Win64/IPF builds):
166 set PEGASUS_PLATFORM=WIN32_IX86_MSVC
167
168 REM ***********************************************************
169 REM This sets up the Visual C++/Platform SDK environment
170 REM ***********************************************************
171
172 REM The MS Platform SDK has the following platform options:
173 REM /2000 - target Windows 2000 and IE 5.0
174 REM /XP32 (default) - target Windows XP 32
175 REM /XP64 - target Windows XP 64
176 REM /SRV32 - target Windows Server 2003 32 bit
177 REM /SRV64 - target Windows Server 2003 64 bit
178 REM /x86_64 - target Windows for the x86_64 bit platform
179 REM
180 if /i "%PLATFORM%" == "Win32" set PSDKPLATFORM=/2000
181 if /i "%PLATFORM%" == "Win64" set PSDKPLATFORM=/SRV64
182
183 kumpf 1.1 REM The MS Platform SDK has the following flavor options:
184 REM /DEBUG - set the environment to DEBUG
185 REM /RETAIL - set the environment to RETAIL
186 REM
187 if /i "%FLAVOR%" == "product" set PSDKFLAVOR=/RETAIL
188 if /i "%FLAVOR%" == "debug" set PSDKFLAVOR=/DEBUG
189
190 REM Configure the development environment
191 call vcvars32.bat
192 call "%MSSdk%\setenv.bat" %PSDKPLATFORM% %PSDKFLAVOR%
193
194 REM ***********************************************************
195 REM Finally, run the builds
196 REM ***********************************************************
197
198 REM ***********************************************************
199 REM Makefiles must be run from the directory where they reside
200 REM ***********************************************************
201 pushd %PEGASUS_ROOT%
202
203 echo.
204 kumpf 1.1 echo "======================================="
205 echo "Building the Pegasus core lib's & app's"
206 echo "======================================="
|
207 kumpf 1.2 REM NOTE: Remove "rebuild" from the make command, below,
|
208 kumpf 1.7 REM for a simpler build of Pegasus (build new/updated
|
209 kumpf 1.2 REM files/dependencies only, no repository & no tests)
|
210 kumpf 1.1 make rebuild
|
211 kumpf 1.2
212 REM NOTE: Comment-out the following line to ignore Pegasus
213 REM build/test errors, and go on to build the Mapper:
|
214 kumpf 1.1 if %errorlevel% NEQ 0 goto ERR_BUILD_FAILED
215
216 REM ***********************************************************
217 REM return to the original directory
218 REM ***********************************************************
219 popd
220
221 REM ***********************************************************
222 REM Now build the WMI Mapper
223 REM ***********************************************************
224 pushd %PEGASUS_ROOT%\src\WMIMapper
225
226 echo.
227 echo "======================================="
228 echo "Building the Pegasus WMI Mapper "
229 echo "======================================="
230 make mapper
231 if %errorlevel% NEQ 0 goto ERR_BUILD_FAILED
232
233 REM ***********************************************************
234 REM return to the original directory
235 kumpf 1.1 REM ***********************************************************
236 popd
237
238 REM ***********************************************************
239 REM Copy header files to PEGASUS_HOME, to complete the SDK
240 REM ***********************************************************
241 REM First, delete any existing include directory:
242 rmdir /S /Q %PEGASUS_HOME%\include
243
244 REM Now, create the include directory structure:
245 set COMMON_INCL=%PEGASUS_HOME%\include\Pegasus\Common
246 set CLIENT_INCL=%PEGASUS_HOME%\include\Pegasus\Client
247 set PROVDR_INCL=%PEGASUS_HOME%\include\Pegasus\Provider
248
249 REM This is how to do it if NT extensions are not enabled:
250 REM mkdir %PEGASUS_HOME%\include
251 REM mkdir %PEGASUS_HOME%\include\Pegasus
252 REM mkdir %PEGASUS_HOME%\include\Pegasus\Common
253 REM mkdir %PEGASUS_HOME%\include\Pegasus\Client
254 REM mkdir %PEGASUS_HOME%\include\Pegasus\Provider
255
256 kumpf 1.1 REM With NT extensions enabled, can just do this:
257 mkdir %COMMON_INCL%
258 mkdir %CLIENT_INCL%
259 mkdir %PROVDR_INCL%
260
261 REM Finally, copy the headers:
262
263 pushd %PEGASUS_ROOT%\src\Pegasus\Common
|
264 kumpf 1.6 copy AcceptLanguageList.h %COMMON_INCL%
|
265 kumpf 1.1 copy Array.h %COMMON_INCL%
266 copy ArrayInter.h %COMMON_INCL%
267 copy Char16.h %COMMON_INCL%
268 copy CIMClass.h %COMMON_INCL%
269 copy CIMDateTime.h %COMMON_INCL%
270 copy CIMFlavor.h %COMMON_INCL%
271 copy CIMIndication.h %COMMON_INCL%
272 copy CIMInstance.h %COMMON_INCL%
273 copy CIMMethod.h %COMMON_INCL%
274 copy CIMName.h %COMMON_INCL%
275 copy CIMObject.h %COMMON_INCL%
276 copy CIMObjectPath.h %COMMON_INCL%
277 copy CIMParameter.h %COMMON_INCL%
278 copy CIMParamValue.h %COMMON_INCL%
279 copy CIMProperty.h %COMMON_INCL%
280 copy CIMPropertyList.h %COMMON_INCL%
281 copy CIMQualifier.h %COMMON_INCL%
282 copy CIMQualifierDecl.h %COMMON_INCL%
283 copy CIMScope.h %COMMON_INCL%
284 copy CIMStatusCode.h %COMMON_INCL%
285 copy CIMType.h %COMMON_INCL%
286 kumpf 1.1 copy CIMValue.h %COMMON_INCL%
287 copy Config.h %COMMON_INCL%
|
288 kumpf 1.6 copy ContentLanguageList.h %COMMON_INCL%
|
289 kumpf 1.1 copy Exception.h %COMMON_INCL%
290 copy Formatter.h %COMMON_INCL%
291 copy LanguageParser.h %COMMON_INCL%
|
292 kumpf 1.5 copy LanguageTag.h %COMMON_INCL%
|
293 kumpf 1.1 copy Linkage.h %COMMON_INCL%
294 copy Logger.h %COMMON_INCL%
295 copy MessageLoader.h %COMMON_INCL%
296 copy OperationContext.h %COMMON_INCL%
297 copy Platform_WIN32_IX86_MSVC.h %COMMON_INCL%
298 copy ResponseHandler.h %COMMON_INCL%
299 copy SSLContext.h %COMMON_INCL%
300 copy String.h %COMMON_INCL%
301 copy System.h %COMMON_INCL%
302 popd
303
304 pushd %PEGASUS_ROOT%\src\Pegasus\Client
305 copy CIMClient.h %CLIENT_INCL%
306 copy CIMClientException.h %CLIENT_INCL%
307 copy Linkage.h %CLIENT_INCL%
308 popd
309
310 pushd %PEGASUS_ROOT%\src\Pegasus\Provider
311 copy CIMAssociationProvider.h %PROVDR_INCL%
|
312 kumpf 1.4 copy CIMIndicationConsumerProvider.h %PROVDR_INCL%
|
313 kumpf 1.1 copy CIMIndicationProvider.h %PROVDR_INCL%
314 copy CIMInstanceProvider.h %PROVDR_INCL%
315 copy CIMMethodProvider.h %PROVDR_INCL%
316 copy CIMOMHandle.h %PROVDR_INCL%
317 copy CIMProvider.h %PROVDR_INCL%
318 copy CIMQueryProvider.h %PROVDR_INCL%
319 copy Linkage.h %PROVDR_INCL%
320 copy ProviderException.h %PROVDR_INCL%
321 copy ResponseHandler.h %PROVDR_INCL%
322 popd
323
324
325 goto DONE
326 REM ***********************************************************
327 REM Error Message Sub-Routines
328 REM ***********************************************************
329 :ERR_NO_PEGASUS_ROOT
330 echo "Error: The environment variable PEGASUS_ROOT is not set!"
331 goto DONE
332 :ERR_NO_PEGASUS_HOME
333 echo "Error: The environment variable PEGASUS_HOME is not set!"
334 kumpf 1.1 goto DONE
335 :ERR_NO_OPENSSL_HOME
336 echo "Error: The environment variable OPENSSL_HOME is not set!"
337 goto DONE
338 :ERR_BUILD_FAILED
339 echo Error: An error occured during the build.
340 goto DONE
341
342 :DONE
343 ENDLOCAL
344
345 :EOF
|