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 REM NOTE: To run this script, GNU make (gnumake.exe) and
7 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 REM in the PATH and the MSSdk env var is defined. Other
12 REM environments (e.g., VisualStudio.NET) may require
13 REM modifications to this batch file.
14 REM
15 REM Environment Variables:
16 REM PLATFORM
17 REM - Indicates the target platform for the build
18 REM - Valid settings are "Win32" and "Win64"
19 REM - Default(if not set) = "Win32"
20 REM FLAVOR
21 REM - Indicates whether to build debug or product/release bits
22 kumpf 1.1 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 REM - Root directory where the built Pegasus binaries, etc.,
31 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 kumpf 1.1 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 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 kumpf 1.1 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 REM If/when Pegasus has a Win64/IPF config, the following can be
162 REM used for setting the appropriate config, based on the PLATFORM:
163 kumpf 1.1 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 REM The MS Platform SDK has the following flavor options:
184 kumpf 1.1 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 echo "======================================="
205 kumpf 1.1 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 REM for a simpler build of Pegasus (build new/updated
209 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 copy AcceptLanguageElement.h %COMMON_INCL%
265 copy AcceptLanguages.h %COMMON_INCL%
266 copy Array.h %COMMON_INCL%
267 copy ArrayInter.h %COMMON_INCL%
268 copy Char16.h %COMMON_INCL%
269 copy CIMClass.h %COMMON_INCL%
270 copy CIMDateTime.h %COMMON_INCL%
271 copy CIMFlavor.h %COMMON_INCL%
272 copy CIMIndication.h %COMMON_INCL%
273 copy CIMInstance.h %COMMON_INCL%
274 copy CIMMethod.h %COMMON_INCL%
275 copy CIMName.h %COMMON_INCL%
276 copy CIMObject.h %COMMON_INCL%
277 kumpf 1.1 copy CIMObjectPath.h %COMMON_INCL%
278 copy CIMParameter.h %COMMON_INCL%
279 copy CIMParamValue.h %COMMON_INCL%
280 copy CIMProperty.h %COMMON_INCL%
281 copy CIMPropertyList.h %COMMON_INCL%
282 copy CIMQualifier.h %COMMON_INCL%
283 copy CIMQualifierDecl.h %COMMON_INCL%
284 copy CIMScope.h %COMMON_INCL%
285 copy CIMStatusCode.h %COMMON_INCL%
286 copy CIMType.h %COMMON_INCL%
287 copy CIMValue.h %COMMON_INCL%
288 copy Config.h %COMMON_INCL%
289 copy ContentLanguageElement.h %COMMON_INCL%
290 copy ContentLanguages.h %COMMON_INCL%
291 copy Exception.h %COMMON_INCL%
292 copy Formatter.h %COMMON_INCL%
293 copy LanguageElement.h %COMMON_INCL%
294 copy LanguageElementContainer.h %COMMON_INCL%
295 copy LanguageParser.h %COMMON_INCL%
296 copy Linkage.h %COMMON_INCL%
297 copy Logger.h %COMMON_INCL%
298 kumpf 1.1 copy MessageLoader.h %COMMON_INCL%
299 copy OperationContext.h %COMMON_INCL%
300 copy Platform_WIN32_IX86_MSVC.h %COMMON_INCL%
301 copy ResponseHandler.h %COMMON_INCL%
302 copy SSLContext.h %COMMON_INCL%
303 copy String.h %COMMON_INCL%
304 copy System.h %COMMON_INCL%
305 popd
306
307 pushd %PEGASUS_ROOT%\src\Pegasus\Client
308 copy CIMClient.h %CLIENT_INCL%
309 copy CIMClientException.h %CLIENT_INCL%
310 copy Linkage.h %CLIENT_INCL%
311 popd
312
313 pushd %PEGASUS_ROOT%\src\Pegasus\Provider
314 copy CIMAssociationProvider.h %PROVDR_INCL%
315 copy CIMBaseProvider.h %PROVDR_INCL%
316 copy CIMClassProvider.h %PROVDR_INCL%
317 copy CIMIndicationConsumer.h %PROVDR_INCL%
318 copy CIMIndicationProvider.h %PROVDR_INCL%
319 kumpf 1.1 copy CIMInstanceProvider.h %PROVDR_INCL%
320 copy CIMMethodProvider.h %PROVDR_INCL%
321 copy CIMOMHandle.h %PROVDR_INCL%
322 copy CIMPropertyProvider.h %PROVDR_INCL%
323 copy CIMProvider.h %PROVDR_INCL%
324 copy CIMQueryProvider.h %PROVDR_INCL%
325 copy Linkage.h %PROVDR_INCL%
326 copy ProviderException.h %PROVDR_INCL%
327 copy ResponseHandler.h %PROVDR_INCL%
328 popd
329
330
331 goto DONE
332 REM ***********************************************************
333 REM Error Message Sub-Routines
334 REM ***********************************************************
335 :ERR_NO_PEGASUS_ROOT
336 echo "Error: The environment variable PEGASUS_ROOT is not set!"
337 goto DONE
338 :ERR_NO_PEGASUS_HOME
339 echo "Error: The environment variable PEGASUS_HOME is not set!"
340 kumpf 1.1 goto DONE
341 :ERR_NO_OPENSSL_HOME
342 echo "Error: The environment variable OPENSSL_HOME is not set!"
343 goto DONE
344 :ERR_BUILD_FAILED
345 echo Error: An error occured during the build.
346 goto DONE
347
348 :DONE
349 ENDLOCAL
350
351 :EOF
|