source: gsdl/trunk/makegs2.bat@ 20619

Last change on this file since 20619 was 20431, checked in by ak19, 15 years ago

Changed makegs2.bat to always run Microsoft Platform SDK's Setenv.Cmd first since this is now necessary for Visual Studio 8 and onwards (version 8 does not come with windows.h anymore).

File size: 10.3 KB
Line 
1@echo off
2pushd "%CD%"
3CD /D "%~dp0"
4
5
6:: Path to VCVARS32.bat -- You can set this variable manually if needed
7:: e.g. set VCVARS="C:\Program Files\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT"
8set VCVARS="C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat"
9
10:: Path to Microsoft Platform SDK's SetEnv.cmd -- You can set this variable manually if needed
11set SDK_ENV="C:\Program Files\Microsoft Platform SDK\SetEnv.Cmd"
12
13
14rem Checking for Winbin and Unzip utility
15IF NOT EXIST .\bin\windows\*.* GOTO ENDNOWINBIN
16IF NOT EXIST .\bin\windows\choice.exe GOTO ENDNOWINBIN
17
18
19echo.
20echo.
21echo #### # ###
22echo ## # #
23echo # ### ## ## ### ### ### ## ### ## #
24echo # # # #### #### # # ## # # # # # #### ##
25echo ## # # # # # # # # # # # # # ##
26echo #### # ### ### # # ### ## ## # # ### ####
27echo (C) 2008, New Zealand Digital Library Project
28echo.
29echo.
30echo.
31
32
33rem Checking for existance of the packages extracted / zipped
34IF NOT EXIST .\common-src\packages\windows\crypt\crypt\nul IF NOT EXIST .\common-src\packages\windows\crypt\crypt.zip GOTO ENDNOWINPACK
35
36IF NOT EXIST .\common-src\packages\windows\expat\expat\nul IF NOT EXIST .\common-src\packages\windows\expat\expat.zip GOTO ENDNOWINPACK
37
38:: IF NOT EXIST .\common-src\packages\windows\gdbm\gdbm\nul IF NOT EXIST .\common-src\packages\windows\gdbm\gdbm.zip GOTO ENDNOWINPACK
39
40IF NOT EXIST .\common-src\packages\windows\stlport\stlport\nul IF NOT EXIST .\common-src\packages\windows\stlport\stlport.zip GOTO ENDNOWINPACK
41
42IF NOT EXIST .\common-src\indexers\packages\windows\iconv\iconv\nul IF NOT EXIST .\common-src\indexers\packages\windows\iconv\iconv.zip GOTO ENDNOICONV
43
44IF NOT EXIST .\common-src\packages\sqlite\sqlite* IF NOT EXIST .\common-src\packages\sqlite\sqlite*.tar.gz GOTO ENDNOSQLITE
45
46rem Ask the user to extract now or to directly compile
47echo Do you want to extract the required packages (Recommended)? This will be the default action in 10 seconds.
48.\bin\windows\choice.exe /T:Y,10 /C:YN
49 IF errorlevel 2 GOTO COMPILE
50 IF errorlevel 1 GOTO UNZIP
51 IF errorlevel 0 GOTO END
52
53
54:UNZIP
55IF NOT EXIST .\bin\windows\unzip.exe GOTO ENDNOUNZIP
56IF NOT EXIST .\bin\windows\gunzip.exe GOTO ENDNOUNZIP
57IF NOT EXIST .\bin\windows\tar.exe GOTO ENDNOUNZIP
58
59rem Extracting the packages
60IF EXIST .\common-src\packages\windows\crypt\crypt.zip .\bin\windows\unzip.exe -o .\common-src\packages\windows\crypt\crypt.zip -d .\common-src\packages\windows\crypt\
61
62IF EXIST .\common-src\packages\windows\expat\expat.zip .\bin\windows\unzip.exe -o .\common-src\packages\windows\expat\expat.zip -d .\common-src\packages\windows\expat\
63
64IF EXIST .\common-src\packages\windows\gdbm\gdbm.zip .\bin\windows\unzip.exe -o .\common-src\packages\windows\gdbm\gdbm.zip -d .\common-src\packages\windows\gdbm\
65
66IF EXIST .\common-src\packages\windows\stlport\stlport.zip .\bin\windows\unzip.exe -o .\common-src\packages\windows\stlport\stlport.zip -d .\common-src\packages\windows\stlport\
67
68IF EXIST .\common-src\indexers\packages\windows\iconv\iconv.zip .\bin\windows\unzip.exe -o .\common-src\indexers\packages\windows\iconv\iconv.zip -d .\common-src\indexers\packages\windows\iconv\
69
70IF EXIST .\common-src\packages\sqlite\sqlite*.tar.gz .\bin\windows\gunzip.exe -cd .\common-src\packages\sqlite\sqlite*.tar.gz | .\bin\windows\tar.exe xv --directory=./common-src/packages/sqlite
71
72
73echo.
74echo.
75:COMPILE
76
77rem Last check if all the packages have been extracted prior compilation
78IF NOT EXIST .\common-src\packages\windows\crypt\crypt\*.* GOTO NEEDUNZIP
79IF NOT EXIST .\common-src\packages\windows\expat\expat\*.* GOTO NEEDUNZIP
80:: IF NOT EXIST .\common-src\packages\windows\gdbm\gdbm\*.* GOTO NEEDUNZIP
81IF NOT EXIST .\common-src\packages\windows\stlport\stlport\*.* GOTO NEEDUNZIP
82IF NOT EXIST .\common-src\indexers\packages\windows\iconv\iconv\*.* GOTO NEEDUNZIP
83IF NOT EXIST .\common-src\packages\sqlite\sqlite* GOTO NEEDUNZIP
84
85rem Check some known paths to VCVARS32.BAT
86:: if the user has set VCVARS32 don't look in the default places at all
87IF NOT %VCVARS%=="" echo ******* VCVARS set, checking for MS Platform SDK...& GOTO SET_SDK
88
89:: Visual Studio 2005 Pro --- NOT READY YET
90IF EXIST "%programfiles%\Microsoft Visual Studio 8\VC\bin\vcvars32.bat" set VCVARS="%programfiles%\Microsoft Visual Studio 8\VC\bin\vcvars32.bat"
91
92:: Visual Studio 2003 \ VS7
93IF %VCVARS%=="" IF EXIST "%programfiles%\Microsoft Visual Studio .NET 2003\Vc7\bin\vcvars32.bat" set VCVARS="%programfiles%\Microsoft Visual Studio .NET 2003\Vc7\bin\vcvars32.bat"
94
95:: Visual Studio 6 \ VS6
96IF %VCVARS%=="" IF EXIST "%programfiles%\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT" set VCVARS="%programfiles%\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT"
97
98IF %VCVARS%=="" GOTO ENDNOVCVARS32
99:: Now VCVARS has been set so it can be used when we need it
100
101:SET_SDK
102rem Check known path(s) to SetEnv.cmd
103:: if the user has set SDK_ENV don't look in the default places at all
104IF NOT %SDK_ENV%=="" GOTO CALL_SDK
105
106IF EXIST "%programfiles%\Microsoft Platform SDK\SetEnv.cmd" set SDK_ENV="%programfiles%\Microsoft Platform SDK\SetEnv.cmd"
107
108IF %SDK_ENV%=="" GOTO ENDNOSDKENV
109
110:CALL_SDK
111call %SDK_ENV%
112echo.
113echo.
114
115call %VCVARS%
116echo.
117echo.
118
119:PROMPT
120echo.
121rem Ask the user what to compile
122echo What do you want to compile?
123echo.
124echo 1. Local library only
125echo 2. Web library only
126echo 3. Both
127echo 4. Apache local library (needs Microsoft Platform SDK)
128echo 5. Quit
129echo.
130echo Please choose a number from the menu. Otherwise both libraries will be compiled in 15 seconds.
131.\bin\windows\choice.exe /N /T:3,15 /C:12345
132 IF errorlevel 5 GOTO END
133 IF errorlevel 4 GOTO WITHAPACHE
134 IF errorlevel 3 GOTO WITHBOTH
135 IF errorlevel 2 GOTO WITHOUTLOCALLIB
136 IF errorlevel 1 GOTO WITHLOCALLIB
137 IF errorlevel 0 GOTO END
138
139
140:WITHAPACHE
141:: Only compile up the Apache web server if we're asked to
142
143:: Now unpack the custom GS2 apache web server tar.gz file
144IF NOT EXIST .\runtime-src\packages\apache-httpd\httpd-2.2.11\nul .\bin\windows\gunzip.exe -cd .\runtime-src\packages\apache-httpd\httpd-*.tar.gz | .\bin\windows\tar.exe xv --directory=./runtime-src/packages/apache-httpd
145
146nmake /f win32.mak APACHE_HTTPD=1
147GOTO ENDOK
148
149
150:WITHOUTLOCALLIB
151echo.
152echo.
153nmake /f win32.mak
154GOTO ENDOK
155
156:WITHLOCALLIB
157echo.
158echo.
159nmake /f win32.mak LOCAL_LIBRARY=1
160GOTO ENDOK
161
162:WITHBOTH
163echo.
164echo.
165nmake /f win32.mak
166nmake /f win32.mak LOCAL_LIBRARY=1
167GOTO ENDOK
168
169:NEEDUNZIP
170echo.
171echo /!\ Error /!\ - Some or all the packages are not properly extracted.
172echo.
173echo If you wish to compile Greenstone 2 you need to unzip the required packages now.
174echo.
175rem Ask to Unzip the packages now otherwise quit
176echo Do you want to unzip these required packages now? This will be the default action in 10 seconds.
177.\bin\windows\choice.exe /T:Y,10 /c:YN
178 IF errorlevel 2 GOTO END
179 IF errorlevel 1 GOTO UNZIP
180 IF errorlevel 0 GOTO END
181
182:ENDNOWINBIN
183echo.
184echo /!\ Error /!\ - Winbin has not been found.
185echo This is required to get the conversion tools used for importing different types of files.
186echo For more info please visit this page
187echo http://wiki.greenstone.org/wiki/index.php/Installing_Greenstone_2_from_SVN_source_on_Windows#Getting_winbin
188GOTO END
189
190:ENDNOUNZIP
191echo.
192echo /!\ Error /!\ - Extacting tools are missing.
193echo They are required to extract all packages needed for compilation.
194echo These tools are contained in the Winbin folder, more info on this web page:
195echo http://wiki.greenstone.org/wiki/index.php/Installing_Greenstone_2_from_SVN_source_on_Windows#Getting_winbin
196GOTO END
197
198:ENDNOWINPACK
199echo.
200echo /!\ Error /!\ - Windows packages are missing.
201echo Some required packages are missing in .\common-src\packages\windows\
202echo Please go to this page for more information on how to get everything:
203echo http://wiki.greenstone.org/wiki/index.php/Installing_Greenstone_2_from_SVN_source_on_Windows
204GOTO END
205
206:ENDNOSQLITE
207echo.
208echo /!\ Error /!\ - SQLite is missing.
209echo Some required packages are missing in .\common-src\packages\sqlite\
210echo Please go to this page for more information on how to get everything:
211echo http://wiki.greenstone.org/wiki/index.php/Installing_Greenstone_2_from_SVN_source_on_Windows
212GOTO END
213
214:ENDNOICONV
215echo.
216echo /!\ Error /!\ - Indexers are missing.
217echo Some required packages are missing in .\common-src\indexers\packages\windows\
218echo Please go to this page for more information on how to get everything:
219echo http://wiki.greenstone.org/wiki/index.php/Installing_Greenstone_2_from_SVN_source_on_Windows
220GOTO END
221
222:ENDNOVCVARS32
223echo.
224echo /!\ Error /!\ - Not able to find 'vcvars32.bat'.
225echo You need Visual Studio to compile the source code but we were
226echo unable to find the file vcvars32.bat in your system.
227echo.
228echo Please edit this bat file and manually set the full path to
229echo vcvars32.bat then run this script again.
230GOTO END
231
232:ENDNOSDKENV
233echo.
234echo /!\ Error /!\ - Not able to find 'SetEnv.cmd'.
235echo We were unable to find the SDK file SetEnv.cmd on your system.
236echo You need Microsoft Platform SDK (which is available for free) to compile
237echo up the Apache web server. You also need it if you're working with
238echo Microsoft Visual Studio 8 or higher.
239echo.
240echo If you already have it installed, please edit the makegs2.bat file and
241echo manually set the full path to SetEnv.cmd, then run this script again.
242echo If you have an older version of Visual Studio, then you do not need the
243echo Platform SDK and can compile the Web and/or Local libraries up from the
244echo DOS command prompt using:
245echo nmake /f win32.mak
246echo and/or
247echo nmake /f win32.mak LOCAL_LIBRARY=1
248GOTO END
249
250:ENDOK
251echo.
252echo Done!
253echo.
254echo This program is free software; you can redistribute it and/or
255echo modify it under the terms of the GNU General Public License
256echo as published by the Free Software Foundation; either version 2
257echo of the License, or (at your option) any later version.
258echo.
259echo This program is distributed in the hope that it will be useful,
260echo but WITHOUT ANY WARRANTY; without even the implied warranty of
261echo MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
262echo GNU General Public License for more details.
263echo.
264GOTO END
265
266:END
267popd
Note: See TracBrowser for help on using the repository browser.