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 REM Process command line args
73 REM
74 REM Valid args are (NOT case-sensitive):
75 REM [-]Win32 overrides PLATFORM=Win32
76 REM [-]Win64 overrides PLATFORM=Win64
77 REM [-]d[ebug] overrides FLAVOR=debug
78 REM [-]p[rodcut] overrides FLAVOR=product
79 REM [-]r[elease] overrides FLAVOR=product
80 REM [-]ssl overrides PEGASUS_HAS_SSL defined
81 REM [-]nossl overrides PEGASUS_HAS_SSL not defined
82 REM ***********************************************************
83 :CHECK_COMMAND_LINE_ARG
84 if "%1" == "" goto DONE_WITH_COMMAND_LINE
85 kumpf 1.1
86 if /i "%1"=="-Win32" goto ARG_PLATFORM_WIN32
87 if /i "%1"=="Win32" goto ARG_PLATFORM_WIN32
88
89 if /i "%1"=="-Win64" goto ARG_PLATFORM_WIN64
90 if /i "%1"=="Win64" goto ARG_PLATFORM_WIN64
91
92 if /i "%1"=="-debug" goto ARG_FLAVOR_DEBUG
93 if /i "%1"=="debug" goto ARG_FLAVOR_DEBUG
94 if /i "%1"=="-d" goto ARG_FLAVOR_DEBUG
95 if /i "%1"=="d" goto ARG_FLAVOR_DEBUG
96
97 if /i "%1"=="-product" goto ARG_FLAVOR_PRODUCT
98 if /i "%1"=="product" goto ARG_FLAVOR_PRODUCT
99 if /i "%1"=="-p" goto ARG_FLAVOR_PRODUCT
100 if /i "%1"=="p" goto ARG_FLAVOR_PRODUCT
101
102 if /i "%1"=="-release" goto ARG_FLAVOR_PRODUCT
103 if /i "%1"=="release" goto ARG_FLAVOR_PRODUCT
104 if /i "%1"=="-r" goto ARG_FLAVOR_PRODUCT
105 if /i "%1"=="r" goto ARG_FLAVOR_PRODUCT
106 kumpf 1.1
107 if /i "%1"=="-ssl" goto ARG_SSL
108 if /i "%1"=="ssl" goto ARG_SSL
109
110 if /i "%1"=="-nossl" goto ARG_NOSSL
111 if /i "%1"=="nossl" goto ARG_NOSSL
112
113 REM: If here, have an INVALID ARGUMENT:
114 echo Invalid argument on the command line: %1. Ignoring...
115 goto NEXT_ARG
116
117 :ARG_PLATFORM_WIN32
118 set PLATFORM=Win32
119 goto NEXT_ARG
120
121 :ARG_PLATFORM_WIN64
122 set PLATFORM=Win64
123 goto NEXT_ARG
124
125 :ARG_FLAVOR_DEBUG
126 set FLAVOR=debug
127 kumpf 1.1 goto NEXT_ARG
128
129 :ARG_FLAVOR_PRODUCT
130 set FLAVOR=product
131 goto NEXT_ARG
132
133 :ARG_SSL
134 set PEGASUS_HAS_SSL=Yes
135 if not defined OPENSSL_HOME goto ERR_NO_OPENSSL_HOME
136 goto NEXT_ARG
137
138 :ARG_NOSSL
139 set PEGASUS_HAS_SSL=
140 goto NEXT_ARG
141
142 :NEXT_ARG
143 shift
144 goto CHECK_COMMAND_LINE_ARG
145
146 :DONE_WITH_COMMAND_LINE
147
148 kumpf 1.1 REM ***********************************************************
149 REM Translate the PLATFORM and FLAVOR vars into environment
150 REM variables used by Pegasus for specifying platform & flavor
151 REM ***********************************************************
152 if /i "%FLAVOR%" == "product" set PEGASUS_DEBUG=
153 if /i "%FLAVOR%" == "debug" set PEGASUS_DEBUG=1
154
155 REM If/when Pegasus has a Win64/IPF config, the following can be
156 REM used for setting the appropriate config, based on the PLATFORM:
157 REM if "%PLATFORM%" == "Win32" set PEGASUS_PLATFORM=WIN32_IX86_MSVC
158 REM if "%PLATFORM%" == "Win64" set PEGASUS_PLATFORM=WIN64_IA64_MSVC
159 REM For now, using WIN32_IX86_MSVC, (even for Win64/IPF builds):
160 set PEGASUS_PLATFORM=WIN32_IX86_MSVC
161
162 REM ***********************************************************
163 REM This sets up the Visual C++/Platform SDK environment
164 REM ***********************************************************
165
166 REM The MS Platform SDK has the following platform options:
167 REM /2000 - target Windows 2000 and IE 5.0
168 REM /XP32 (default) - target Windows XP 32
169 kumpf 1.1 REM /XP64 - target Windows XP 64
170 REM /SRV32 - target Windows Server 2003 32 bit
171 REM /SRV64 - target Windows Server 2003 64 bit
172 REM /x86_64 - target Windows for the x86_64 bit platform
173 REM
174 if /i "%PLATFORM%" == "Win32" set PSDKPLATFORM=/2000
175 if /i "%PLATFORM%" == "Win64" set PSDKPLATFORM=/SRV64
176
177 REM The MS Platform SDK has the following flavor options:
178 REM /DEBUG - set the environment to DEBUG
179 REM /RETAIL - set the environment to RETAIL
180 REM
181 if /i "%FLAVOR%" == "product" set PSDKFLAVOR=/RETAIL
182 if /i "%FLAVOR%" == "debug" set PSDKFLAVOR=/DEBUG
183
184 REM Configure the development environment
185 call vcvars32.bat
186 call "%MSSdk%\setenv.bat" %PSDKPLATFORM% %PSDKFLAVOR%
187
188 REM ***********************************************************
189 REM Finally, run the builds
190 kumpf 1.1 REM ***********************************************************
191
192 REM ***********************************************************
193 REM Makefiles must be run from the directory where they reside
194 REM ***********************************************************
195 pushd %PEGASUS_ROOT%
196
197 echo.
198 echo "======================================="
199 echo "Building the Pegasus core lib's & app's"
200 echo "======================================="
201 make rebuild
202 if %errorlevel% NEQ 0 goto ERR_BUILD_FAILED
203
204 REM ***********************************************************
205 REM return to the original directory
206 REM ***********************************************************
207 popd
208
209 REM ***********************************************************
210 REM Now build the WMI Mapper
211 kumpf 1.1 REM ***********************************************************
212 pushd %PEGASUS_ROOT%\src\WMIMapper
213
214 echo.
215 echo "======================================="
216 echo "Building the Pegasus WMI Mapper "
217 echo "======================================="
218 make mapper
219 if %errorlevel% NEQ 0 goto ERR_BUILD_FAILED
220
221 REM ***********************************************************
222 REM return to the original directory
223 REM ***********************************************************
224 popd
225
226 REM ***********************************************************
227 REM Copy header files to PEGASUS_HOME, to complete the SDK
228 REM ***********************************************************
229 REM First, delete any existing include directory:
230 rmdir /S /Q %PEGASUS_HOME%\include
231
232 kumpf 1.1 REM Now, create the include directory structure:
233 set COMMON_INCL=%PEGASUS_HOME%\include\Pegasus\Common
234 set CLIENT_INCL=%PEGASUS_HOME%\include\Pegasus\Client
235 set PROVDR_INCL=%PEGASUS_HOME%\include\Pegasus\Provider
236
237 REM This is how to do it if NT extensions are not enabled:
238 REM mkdir %PEGASUS_HOME%\include
239 REM mkdir %PEGASUS_HOME%\include\Pegasus
240 REM mkdir %PEGASUS_HOME%\include\Pegasus\Common
241 REM mkdir %PEGASUS_HOME%\include\Pegasus\Client
242 REM mkdir %PEGASUS_HOME%\include\Pegasus\Provider
243
244 REM With NT extensions enabled, can just do this:
245 mkdir %COMMON_INCL%
246 mkdir %CLIENT_INCL%
247 mkdir %PROVDR_INCL%
248
249 REM Finally, copy the headers:
250
251 pushd %PEGASUS_ROOT%\src\Pegasus\Common
252 copy AcceptLanguageElement.h %COMMON_INCL%
253 kumpf 1.1 copy AcceptLanguages.h %COMMON_INCL%
254 copy Array.h %COMMON_INCL%
255 copy ArrayInter.h %COMMON_INCL%
256 copy Char16.h %COMMON_INCL%
257 copy CIMClass.h %COMMON_INCL%
258 copy CIMDateTime.h %COMMON_INCL%
259 copy CIMFlavor.h %COMMON_INCL%
260 copy CIMIndication.h %COMMON_INCL%
261 copy CIMInstance.h %COMMON_INCL%
262 copy CIMMethod.h %COMMON_INCL%
263 copy CIMName.h %COMMON_INCL%
264 copy CIMObject.h %COMMON_INCL%
265 copy CIMObjectPath.h %COMMON_INCL%
266 copy CIMParameter.h %COMMON_INCL%
267 copy CIMParamValue.h %COMMON_INCL%
268 copy CIMProperty.h %COMMON_INCL%
269 copy CIMPropertyList.h %COMMON_INCL%
270 copy CIMQualifier.h %COMMON_INCL%
271 copy CIMQualifierDecl.h %COMMON_INCL%
272 copy CIMScope.h %COMMON_INCL%
273 copy CIMStatusCode.h %COMMON_INCL%
274 kumpf 1.1 copy CIMType.h %COMMON_INCL%
275 copy CIMValue.h %COMMON_INCL%
276 copy Config.h %COMMON_INCL%
277 copy ContentLanguageElement.h %COMMON_INCL%
278 copy ContentLanguages.h %COMMON_INCL%
279 copy Exception.h %COMMON_INCL%
280 copy Formatter.h %COMMON_INCL%
281 copy LanguageElement.h %COMMON_INCL%
282 copy LanguageElementContainer.h %COMMON_INCL%
283 copy LanguageParser.h %COMMON_INCL%
284 copy Linkage.h %COMMON_INCL%
285 copy Logger.h %COMMON_INCL%
286 copy MessageLoader.h %COMMON_INCL%
287 copy OperationContext.h %COMMON_INCL%
288 copy Platform_WIN32_IX86_MSVC.h %COMMON_INCL%
289 copy ResponseHandler.h %COMMON_INCL%
290 copy SSLContext.h %COMMON_INCL%
291 copy String.h %COMMON_INCL%
292 copy System.h %COMMON_INCL%
293 popd
294
295 kumpf 1.1 pushd %PEGASUS_ROOT%\src\Pegasus\Client
296 copy CIMClient.h %CLIENT_INCL%
297 copy CIMClientException.h %CLIENT_INCL%
298 copy Linkage.h %CLIENT_INCL%
299 popd
300
301 pushd %PEGASUS_ROOT%\src\Pegasus\Provider
302 copy CIMAssociationProvider.h %PROVDR_INCL%
303 copy CIMBaseProvider.h %PROVDR_INCL%
304 copy CIMClassProvider.h %PROVDR_INCL%
305 copy CIMIndicationConsumer.h %PROVDR_INCL%
306 copy CIMIndicationProvider.h %PROVDR_INCL%
307 copy CIMInstanceProvider.h %PROVDR_INCL%
308 copy CIMMethodProvider.h %PROVDR_INCL%
309 copy CIMOMHandle.h %PROVDR_INCL%
310 copy CIMPropertyProvider.h %PROVDR_INCL%
311 copy CIMProvider.h %PROVDR_INCL%
312 copy CIMQueryProvider.h %PROVDR_INCL%
313 copy Linkage.h %PROVDR_INCL%
314 copy ProviderException.h %PROVDR_INCL%
315 copy ResponseHandler.h %PROVDR_INCL%
316 kumpf 1.1 popd
317
318
319 goto DONE
320 REM ***********************************************************
321 REM Error Message Sub-Routines
322 REM ***********************************************************
323 :ERR_NO_PEGASUS_ROOT
324 echo "Error: The environment variable PEGASUS_ROOT is not set!"
325 goto DONE
326 :ERR_NO_PEGASUS_HOME
327 echo "Error: The environment variable PEGASUS_HOME is not set!"
328 goto DONE
329 :ERR_NO_OPENSSL_HOME
330 echo "Error: The environment variable OPENSSL_HOME is not set!"
331 goto DONE
332 :ERR_BUILD_FAILED
333 echo Error: An error occured during the build.
334 goto DONE
335
336 :DONE
337 kumpf 1.1 ENDLOCAL
338
339 :EOF
|