1@echo off
2::	$Id: winbuild.bat,v 1.8 2008/04/17 01:59:10 alexg Exp $
3::	Helper script to build Berkeley DB libraries and executables
4::	using MSDEV
5::
6
7cd build_windows
8
9:: One of these calls should find the desired batch file
10
11call :TryBat "c:\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat" && goto BATFOUND0
12
13call :TryBat "c:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\vsvars32.bat" && goto BATFOUND1
14
15call :TryBat "c:\Program Files\Microsoft Visual Studio .NET\Common7\Tools\vsvars32.bat" && goto BATFOUND2
16
17call :TryBat "c:\Program Files\Microsoft Visual Studio.NET\Common7\Tools\vsvars32.bat" && goto BATFOUND3
18
19goto BATNOTFOUND
20
21:BATFOUND0
22echo Using Visual Studio 2005
23goto BATFOUND
24
25:BATFOUND1
26echo Using Visual Studio .NET 2003
27goto BATFOUND
28
29:BATFOUND2
30echo Using Visual Studio .NET
31echo *********** CHECK: Make sure the binaries are built with the same system libraries that are shipped.
32goto BATFOUND
33
34:BATFOUND3
35echo Using Visual Studio.NET
36echo *********** CHECK: Make sure the binaries are built with the same system libraries that are shipped.
37goto BATFOUND
38
39:BATFOUND
40:CONVERSION
41start /wait devenv /useenv Berkeley_DB.dsw
42
43:CONVERSION0
44:: For some reason, the command doesn't wait, at least on XP.
45:: So we ask for input to continue.
46
47
48echo.
49echo ============================================================
50echo.
51echo    Converting the Berkeley DB Workspace to a .NET Solution.
52echo    This will run the IDE to interactively convert.
53echo.
54echo    When prompted during the conversion, say: Yes-to-All.
55echo    When finished with the conversion, do a Save-All and Exit.
56echo    Then hit ENTER to continue this script.
57echo.
58echo ============================================================
59set result=y
60set /P result="Continue? [y] "
61if %result% == n goto NSTOP
62
63if exist Berkeley_DB.sln goto ENDCONVERSION
64echo ************* Berkeley_DB.sln was not created ***********
65echo Trying the conversion again...
66goto CONVERSION
67:ENDCONVERSION
68
69::intenv is used to set environment variables but this isn't used anymore
70::devenv /useenv /build Release /project instenv ..\instenv\instenv.sln >> ..\winbld.out 2>&1
71::if not %errorlevel% == 0 goto ERROR
72
73echo Building Berkeley DB
74devenv /useenv /build "Debug x86" /project build_all Berkeley_DB.sln >> ..\winbld.out 2>&1
75if not %errorlevel% == 0 goto ERROR
76devenv /useenv /build "Release x86" /project build_all Berkeley_DB.sln >> ..\winbld.out 2>&1
77if not %errorlevel% == 0 goto ERROR
78devenv /useenv /build "Debug x86" /project db_java Berkeley_DB.sln >> ..\winbld.out 2>&1
79if not %errorlevel% == 0 goto ERROR
80devenv /useenv /build "Release x86" /project db_java Berkeley_DB.sln >> ..\winbld.out 2>&1
81if not %errorlevel% == 0 goto ERROR
82devenv /useenv /build "Debug x86" /project db_tcl Berkeley_DB.sln >> ..\winbld.out 2>&1
83if not %errorlevel% == 0 goto ERROR
84devenv /useenv /build "Release x86" /project db_tcl Berkeley_DB.sln >> ..\winbld.out 2>&1
85if not %errorlevel% == 0 goto ERROR
86
87
88goto END
89
90
91:ERROR
92echo *********** ERROR: during win_build.bat *************
93echo *********** ERROR: during win_build.bat *************  >> ..\winbld.err
94exit 1
95goto END
96
97:NSTOP
98echo *********** ERROR: win_build.bat stop requested *************
99echo *********** ERROR: win_built.bat stop requested *************  >> ..\winbld.err
100exit 2
101goto END
102
103:BATNOTFOUND
104echo *********** ERROR: VC Config batch file not found *************
105echo *********** ERROR: VC Config batch file not found *************  >> ..\winbld.err
106exit 3
107goto END
108
109:: TryBat(BATPATH)
110:: If the BATPATH exists, use it and return 0,
111:: otherwise, return 1.
112
113:TryBat
114:: Filename = %1
115if not exist %1 exit /b 1
116call %1
117exit /b 0
118goto :EOF
119
120:END
121