4 rem EXAMPLE - Build entire openIB-windows release & WIX installers (.msi) files.
\r
5 rem Binary release is constructed in WinOF\Wix\OS\bin.
\r
6 rem Processor architecture specific WIX installers are constructed
\r
9 rem BuildRelease option
\r
10 rem option: all | allnoforce | allf | compile | compilenoforce | compf path |
\r
11 rem makebin | msi |sign | wix | clean | msi-label | msi-del |
\r
12 rem msi-dir {OPENIB_REV}
\r
14 rem This script is an 'example' of a one-command entire IB stack build to
\r
15 rem single-file installer; used to build a WinOF releases.
\r
16 rem Script is designed to be invoked from the <whatever>\gen1\trunk folder with
\r
17 rem <whatever>\gen1\trunk\WinOF\Wix\* present.
\r
19 rem Verify the following env vars are suitible for your system configuration.
\r
20 rem _DDK, _PSDK, SVN, IDIR
\r
22 if "%1" == "" goto usage
\r
23 if "%1" == "/?" goto usage
\r
24 if "%1" == "-h" goto usage
\r
25 if "%1" == "all" goto OK
\r
26 if "%1" == "allnoforce" goto OK
\r
28 if "%2" == "" goto usage
\r
31 if "%1" == "compile" goto OK
\r
32 if "%1" == "compilenoforce" goto OK
\r
33 if "%1" == "compf" (
\r
34 if "%2" == "" goto usage
\r
37 if "%1" == "makebin" goto OK
\r
38 if "%1" == "msi" goto OK
\r
39 if "%1" == "sign" goto OK
\r
40 if "%1" == "wix" goto OK
\r
41 if "%1" == "clean" goto OK
\r
42 if "%1" == "msi-label" goto OK
\r
43 if "%1" == "msi-del" goto OK
\r
44 if "%1" == "msi-dir" goto OK
\r
46 echo Unknown arg '%1' ?
\r
50 echo "usage: BuildRelease command {OPENIB_REV value}"
\r
51 echo where 'command' may be:
\r
52 echo all - force recompile, install binaries to WIX tree(makebin),
\r
53 echo sign drivers and build installers.
\r
54 echo allnoforce - recompile only if needed, makebin, sign drivers and
\r
55 echo build installers.
\r
56 echo allf path - force recompile the specified folder, makebin,
\r
57 echo sign drivers and build installers.
\r
58 echo compile - force a recompile/link of everything then exit.
\r
59 echo compilenoforce - recompile/link only if needed then exit.
\r
60 echo compf path - force recompile (all arch*) specified folder
\r
61 echo makebin - assumes binaries are built, installs binaries to WIX tree
\r
63 echo msi - assumes binaries are installed in WIX tree, signs drivers and
\r
64 echo create installers (.msi files) in IDIR.
\r
65 echo sign - assumes binaries are built and installed, sign drivers, exit.
\r
66 echo wix - build .msi installers, assumes (drivers signed) .cat files exist
\r
67 echo clean - remove build artifacts for a clean build: .obj, .sys, ...
\r
68 echo msi-label {OPENIB_REV}
\r
69 echo rename WOF_os*_arch*.msi to WOF_os*_arch*_svn#.msi
\r
70 echo Uniquely identify installers just created.
\r
71 echo If OPENIB_REV arg used, then rename WOF_os*_arch*argVal.msi
\r
72 echo otherwise, use SVN# from path.
\r
73 echo msi-del - del %windir%\temp\WOF_os*_arch*.msi
\r
74 echo msi-dir - del %windir%\temp\WOF_os*_arch*.msi
\r
77 echo optional, if set then OPENIB_REV is assigned this value.
\r
78 echo example: BuildRelease all 1414
\r
84 if not "%WDM_INC_PATH%" == "" (
\r
85 echo %0: Error - %0 unable to run from WDK window,
\r
90 rem assumes %CD% == '<...>\gen1\trunk'
\r
92 set WIX=%CD%\WinOF\WIX
\r
94 rem Use Wix V2 binaries.
\r
95 rem set WIX_BIN=wix-2.0.5325.0-binaries
\r
96 set WIX_BIN=wix-2.0.5805.0-binaries
\r
98 set RBIN_WLH=%WIX%\wlh\bin%
\r
99 set RBIN_WNET=%WIX%\wnet\bin%
\r
100 set RBIN_WXP=%WIX%\wxp\bin%
\r
102 rem remove build artifacts
\r
103 if "%1" == "clean" (
\r
104 echo Removing build artifacts and folders...
\r
105 call %CD%\etc\clean-build.bat
\r
106 if exist %WIX%\wlh\bin (
\r
107 echo Removing %WIX%\wlh\bin
\r
108 rmdir /Q /S %WIX%\wlh\bin
\r
110 if exist %WIX%\wnet\bin (
\r
111 echo Removing %WIX%\wnet\bin
\r
112 rmdir /Q /S %WIX%\wnet\bin
\r
114 if exist %WIX%\wxp\bin (
\r
115 echo Removing %WIX%\wxp\bin
\r
116 rmdir /Q /S %WIX%\wxp\bin
\r
121 rem Driver Signing Certificate filename, assumes %WIX%\%CERTFILE% is valid.
\r
122 rem set CERTFILE=noCert
\r
123 set CERTFILE=MSCV-VSClass3.cer
\r
124 set SW_PUBLISHER="OpenFabrics Alliance"
\r
126 rem A Digital driver signing certificate store name may be required.
\r
128 if "%1" == "all" goto chk_cert
\r
129 if "%1" == "allf" goto chk_cert
\r
130 if "%1" == "msi" goto chk_cert
\r
131 if "%1" == "sign" goto chk_cert
\r
136 if "%CERTFILE%" == "noCert" set /P CERTFILE=[Enter Certificate FileName]
\r
137 if "%CERTFILE%" == "" (
\r
139 echo %0: Err - driver signing certificate filename required.
\r
140 echo %0: see certmgr.exe
\r
149 set _DDK=%SystemDrive%\WinDDK\6001.18001
\r
151 if NOT EXIST %_DDK% (
\r
152 echo Missing WDK @ %_DDK%
\r
156 rem Platform SDK path - watchout for missing LoadPerf.h (installsp.c)
\r
157 set _PSDK=%SystemDrive%\progra~1\mi2578~1
\r
159 rem set this to be the current svn commit number; overrides svn in path
\r
160 rem processing. Additionally if set to 'latest' code expects ..\..\..\latest.txt
\r
161 rem to contain the SVN number to use.
\r
162 rem set USE_SVN=1748
\r
165 if "%1" == "allf" (
\r
169 if "%1" == "compf" (
\r
174 rem setup value for OPENIB_REV assignment; AND supported by if would be nice.
\r
175 if not "%2" == "" (
\r
176 rem set SVN commit number.
\r
184 rem Determine SVN value from current path.
\r
185 rem WARNING - SVN value depends on the path '\openIB-windows-svn\XXX\gen1',
\r
186 rem where SVN is set to XXX
\r
187 rem substring[23rd...26th] chars (offset counting) == xxxx
\r
188 rem Note - OPENIB_REV is assigned SVN in a child script.
\r
190 if "%USE_SVN%" == "" (
\r
193 if "%USE_SVN%" == "latest" (
\r
194 rem set /P SVN=<F:\openIB-windows-svn\latest.txt
\r
195 set /P SVN=< ..\..\..\latest.txt
\r
204 if NOT EXIST "%WIX%\build-all-MSI.bat" (
\r
205 echo %0 - Missing .msi installer build script
\r
206 echo %WIX%\build-all-MSI.bat
\r
210 rem WIX Installer files (.msi) destination folder - set for local environment.
\r
211 set IDIR=%SystemRoot%\temp
\r
213 if "%1" == "msi-label" (
\r
215 if exist WOF_wxp_x86.msi (
\r
216 if exist WOF_wxp_x86%LBL%.msi del /F/Q WOF_wxp_x86%LBL%.msi
\r
217 rename WOF_wxp_x86.msi WOF_wxp_x86%LBL%.msi
\r
220 if exist WOF_wnet_x86.msi (
\r
221 if exist WOF_wnet_x86%LBL%.msi del /F/Q WOF_wnet_x86%LBL%.msi
\r
222 rename WOF_wnet_x86.msi WOF_wnet_x86%LBL%.msi
\r
224 if exist WOF_wnet_x64.msi (
\r
225 if exist WOF_wnet_x64%LBL%.msi del /F/Q WOF_wnet_x64%LBL%.msi
\r
226 rename WOF_wnet_x64.msi WOF_wnet_x64%LBL%.msi
\r
228 if exist WOF_wnet_ia64.msi (
\r
229 if exist WOF_wnet_ia64%LBL%.msi del /F/Q WOF_wnet_ia64%LBL%.msi
\r
230 rename WOF_wnet_ia64.msi WOF_wnet_ia64%LBL%.msi
\r
233 if exist WOF_wlh_x86.msi (
\r
234 if exist WOF_wlh_x86%LBL%.msi del /F/Q WOF_wlh_x86%LBL%.msi
\r
235 rename WOF_wlh_x86.msi WOF_wlh_x86%LBL%.msi
\r
237 if exist WOF_wlh_x64.msi (
\r
238 if exist WOF_wlh_x64%LBL%.msi del /F/Q WOF_wlh_x64%LBL%.msi
\r
239 rename WOF_wlh_x64.msi WOF_wlh_x64%LBL%.msi
\r
241 if exist WOF_wlh_ia64.msi (
\r
242 if exist WOF_wlh_ia64%LBL%.msi del /F/Q WOF_wlh_ia64%LBL%.msi
\r
243 rename WOF_wlh_ia64.msi WOF_wlh_ia64%LBL%.msi
\r
250 if "%1" == "msi-del" (
\r
251 echo Deleting WOF_{wxp,wnet,wlh}_{x86,x64,ia64}%LBL%.msi
\r
253 if exist WOF_wxp_x86%LBL%.msi del /F/P WOF_wxp_x86%LBL%.msi
\r
255 if exist WOF_wnet_x86%LBL%.msi del /F/P WOF_wnet_x86%LBL%.msi
\r
256 if exist WOF_wnet_x64%LBL%.msi del /F/P WOF_wnet_x64%LBL%.msi
\r
257 if exist WOF_wnet_ia64%LBL%.msi del /F/P WOF_wnet_ia64%LBL%.msi
\r
259 if exist WOF_wlh_x86%LBL%.msi del /F/P WOF_wlh_x86%LBL%.msi
\r
260 if exist WOF_wlh_x64%LBL%.msi del /F/P WOF_wlh_x64%LBL%.msi
\r
261 if exist WOF_wlh_ia64%LBL%.msi del /F/P WOF_wlh_ia64%LBL%.msi
\r
263 dir /N/OD WOF_*.msi
\r
268 if "%1" == "msi-dir" (
\r
270 dir /N/OD WOF_*.msi
\r
275 echo %0 - Building with WDK @ %_DDK%
\r
276 echo Building for OPENIB_REV %SVN%, installer files (.msi) @ %IDIR%
\r
277 echo Drivers signed using Certificate '%CERTFILE%'
\r
279 rem pause thoughtfully.
\r
280 if exist %windir%\system32\timeout.exe (
\r
286 if NOT EXIST "%IDIR%" (
\r
287 echo %0 - Missing Installer file destination folder
\r
292 rem Verify WIX 2.0 toolset is available - if not, download from
\r
293 rem http://sourceforge.net/project/showfiles.php?group_id=105970&package_id=114109
\r
294 rem select wix-2.0.5805.0-binaries.zip download and unzip to
\r
295 rem <...>\gen1\trunk\WinOF\WIX\WIX_tools\
\r
297 if NOT EXIST %WIX%\WIX_tools\%WIX_BIN% (
\r
298 echo %0 - Missing WIX tools @ %WIX%\WIX_tools\%WIX_BIN%
\r
302 if NOT EXIST etc\makebin.bat (
\r
303 echo %0 - Missing etc\makebin.bat, script must run from gen1\trunk
\r
308 rem skip build - assumes binaries already built and installed.
\r
315 if "%1" == "makebin" goto InstallBin
\r
318 if "%1" == "sign" (
\r
324 if "%1" == "msi" goto do_msi_chk
\r
329 rem make sure building a msi has files to work with.
\r
330 if not EXIST "%RBIN_WLH%" goto InstallBin
\r
331 if not EXIST "%RBIN_WNET%" goto InstallBin
\r
332 if not EXIST "%RBIN_WXP%" goto InstallBin
\r
338 if "%1" == "allnoforce" (
\r
339 rem Compile everything only if needed.
\r
342 if "%1" == "compilenoforce" (
\r
343 rem Compile everything only if needed.
\r
346 if "%1" == "allf" (
\r
347 rem Force Compile everything
\r
350 if "%1" == "compf" (
\r
351 rem Force Compile everything
\r
356 echo Removing build artifacts and folders...
\r
357 call %CD%\etc\clean-build.bat
\r
358 if exist %WIX%\wlh\bin (
\r
359 echo Removing %WIX%\wlh\bin
\r
360 rmdir /Q /S %WIX%\wlh\bin
\r
362 if exist %WIX%\wnet\bin (
\r
363 echo Removing %WIX%\wnet\bin
\r
364 rmdir /Q /S %WIX%\wnet\bin
\r
366 if exist %WIX%\wxp\bin (
\r
367 echo Removing %WIX%\wxp\bin
\r
368 rmdir /Q /S %WIX%\wxp\bin
\r
372 rem ************ Setup Env for Building
\r
374 set WDK_PATH=%_DDK%
\r
375 set WINOF_PATH=%CD%
\r
376 set OPENIB_REV=%SVN%
\r
377 set PLATFORM_SDK_PATH=%_PSDK%
\r
379 rem Compile in a specific folder? compf | allf
\r
380 if EXIST "%FPATH%" pushd %FPATH%
\r
382 rem ********* Compile for WLH - Windows Server 2008 & Vista
\r
385 echo %0 - Build WLH x64 Checked
\r
386 %COMSPEC% /C "call %BSE%\etc\bldwo.bat chk x64 2008 %OPS%"
\r
387 if ERRORLEVEL 1 exit /B 1
\r
388 echo %0 - Build WLH x64 Free
\r
389 %COMSPEC% /C "call %BSE%\etc\bldwo.bat fre x64 2008 %OPS%"
\r
390 if ERRORLEVEL 1 exit /B 1
\r
394 echo %0 - Build WLH x86 Checked
\r
395 %COMSPEC% /C "call %BSE%\etc\bldwo.bat chk x86 2008 %OPS%"
\r
396 if ERRORLEVEL 1 exit /B 1
\r
397 echo %0 - Build WLH x86 Free
\r
398 %COMSPEC% /C "call %BSE%\etc\bldwo.bat fre x86 2008 %OPS%"
\r
399 if ERRORLEVEL 1 exit /B 1
\r
402 echo %0 - Build WLH ia64 Checked
\r
403 %COMSPEC% /C "call %BSE%\etc\bldwo.bat chk ia64 2008 %OPS%"
\r
404 if ERRORLEVEL 1 exit /B 1
\r
405 echo %0 - Build WLH ia64 Free
\r
406 %COMSPEC% /C "call %BSE%\etc\bldwo.bat fre ia64 2008 %OPS%"
\r
407 if ERRORLEVEL 1 exit /B 1
\r
409 rem ********* WXP - Windows XP - x86 only
\r
411 echo %0 - Build XP x86 Checked
\r
412 %COMSPEC% /C "call %BSE%\etc\bldwo.bat chk x86 xp %OPS%"
\r
413 if ERRORLEVEL 1 exit /B 1
\r
415 echo %0 - Build XP x86 Free
\r
416 %COMSPEC% /C "call %BSE%\etc\bldwo.bat fre x86 xp %OPS%"
\r
417 if ERRORLEVEL 1 exit /B 1
\r
419 rem ********* WNET - Windows Server 2003
\r
421 echo %0 - Build WNET x64 Checked
\r
422 %COMSPEC% /C "call %BSE%\etc\bldwo.bat chk x64 2003 %OPS%"
\r
423 if ERRORLEVEL 1 exit /B 1
\r
424 echo %0 - Build WNET x64 Free
\r
425 %COMSPEC% /C "call %BSE%\etc\bldwo.bat fre x64 2003 %OPS%"
\r
426 if ERRORLEVEL 1 exit /B 1
\r
428 echo %0 - Build WNET x86 Checked
\r
429 %COMSPEC% /C "call %BSE%\etc\bldwo.bat chk x86 2003 %OPS%"
\r
430 if ERRORLEVEL 1 exit /B 1
\r
431 echo %0 - Build WNET x86 Free
\r
432 %COMSPEC% /C "call %BSE%\etc\bldwo.bat fre x86 2003 %OPS%"
\r
433 if ERRORLEVEL 1 exit /B 1
\r
435 echo %0 - Build WNET ia64 Checked
\r
436 %COMSPEC% /C "call %BSE%\etc\bldwo.bat chk ia64 2003 %OPS%"
\r
437 if ERRORLEVEL 1 exit /B 1
\r
438 echo %0 - Build WNET ia64 Free
\r
439 %COMSPEC% /C "call %BSE%\etc\bldwo.bat fre ia64 2003 %OPS%"
\r
440 if ERRORLEVEL 1 exit /B 1
\r
443 if EXIST "%FPATH%" popd
\r
445 if "%1" == "compf" goto finito
\r
446 if "%1" == "compile" goto finito
\r
447 if "%1" == "compilenoforce" goto finito
\r
449 rem Install binaries into WIX environment, build msi installers.
\r
453 echo Create binary release tree - suitible for WinOF-WIX installer build.
\r
455 if EXIST "%RBIN_WLH%" (rmdir /S /Q %RBIN_WLH% & echo %0 - removed %RBIN_WLH%)
\r
456 if EXIST "%RBIN_WNET%" (rmdir /S /Q %RBIN_WNET% & echo %0 - removed %RBIN_WNET%)
\r
457 if EXIST "%RBIN_WXP%" (rmdir /S /Q %RBIN_WXP% & echo %0 - removed %RBIN_WXP%)
\r
463 if EXIST "%BSE%\etc\makebin.bat" (
\r
464 call %BSE%\etc\makebin.bat %BSE% %RBIN_WLH% wlh
\r
466 echo %0: Err in makebin.bat %BSE% %RBIN_WLH% wlh
\r
469 call %BSE%\etc\makebin.bat %BSE% %RBIN_WNET% wnet
\r
471 echo %0: Err in makebin.bat %BSE% %RBIN_WNET% wnet
\r
474 call %BSE%\etc\makebin.bat %BSE% %RBIN_WXP% wxp
\r
476 echo %0: Err in makebin.bat %BSE% %RBIN_WXP% wxp
\r
481 if "%1" == "makebin" goto finito
\r
485 echo %0 - Drivers Signed with %CERTFILE%
\r
486 echo Binary releases created in
\r
491 rem build WIX installers --> see WinOF\WIX
\r
493 %COMSPEC% /V:on /E:on /C "%_DDK%\bin\setenv.bat %_DDK% fre X64 WNET & cd /D %WIX% & build-all-MSI %MSI_CMD% %CERTFILE% %SW_PUBLISHER% %IDIR%"
\r
499 echo %0: Finished %0 %*
\r
500 echo %0: Started %STIME%
\r
501 echo %0: Finished %TIME%
\r