source: main/tags/3.04/gsdl/makegs2.bat@ 21181

Last change on this file since 21181 was 20183, checked in by ak19, 15 years ago
  1. Updated makefiles to ensure that the local Apache web server gets compiled up on Windows. 2. sqlite3.lib must be deleted upon clean.
File size: 9.7 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=""
9
10:: Path to Microsoft Platform SDK's SetEnv.cmd -- You can set this variable manually if needed
11set SDK_ENV=""
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%=="" GOTO PROMPT
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
102:PROMPT
103echo.
104rem Ask the user what to compile
105echo What do you want to compile?
106echo.
107echo 1. Local library only
108echo 2. Web library only
109echo 3. Both
110echo 4. Apache local library (needs Microsoft Platform SDK)
111echo 5. Quit
112echo.
113echo Please choose a number from the menu. Otherwise both libraries will be compiled in 15 seconds.
114.\bin\windows\choice.exe /N /T:3,15 /C:12345
115 IF errorlevel 5 GOTO END
116 IF errorlevel 4 GOTO WITHAPACHE
117 IF errorlevel 3 GOTO WITHBOTH
118 IF errorlevel 2 GOTO WITHOUTLOCALLIB
119 IF errorlevel 1 GOTO WITHLOCALLIB
120 IF errorlevel 0 GOTO END
121
122
123:WITHAPACHE
124:: Only compile up the Apache web server if we're asked to
125
126rem Check known path(s) to SetEnv.cmd
127:: if the user has set SDK_ENV don't look in the default places at all
128IF NOT %SDK_ENV%=="" GOTO CALL_SDK
129
130IF EXIST "%programfiles%\Microsoft Platform SDK\SetEnv.cmd" set SDK_ENV="%programfiles%\Microsoft Platform SDK\SetEnv.cmd"
131
132IF %SDK_ENV%=="" GOTO ENDNOSDKENV
133
134:CALL_SDK
135call %SDK_ENV%
136echo.
137echo.
138
139call %VCVARS%
140echo.
141echo.
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
151call %VCVARS%
152echo.
153echo.
154nmake /f win32.mak
155GOTO ENDOK
156
157:WITHLOCALLIB
158call %VCVARS%
159echo.
160echo.
161nmake /f win32.mak LOCAL_LIBRARY=1
162GOTO ENDOK
163
164:WITHBOTH
165call %VCVARS%
166echo.
167echo.
168nmake /f win32.mak
169nmake /f win32.mak LOCAL_LIBRARY=1
170GOTO ENDOK
171
172:NEEDUNZIP
173echo.
174echo /!\ Error /!\ - Some or all the packages are not properly extracted.
175echo.
176echo If you wish to compile Greenstone 2 you need to unzip the required packages now.
177echo.
178rem Ask to Unzip the packages now otherwise quit
179echo Do you want to unzip these required packages now? This will be the default action in 10 seconds.
180.\bin\windows\choice.exe /T:Y,10 /c:YN
181 IF errorlevel 2 GOTO END
182 IF errorlevel 1 GOTO UNZIP
183 IF errorlevel 0 GOTO END
184
185:ENDNOWINBIN
186echo.
187echo /!\ Error /!\ - Winbin has not been found.
188echo This is required to get the conversion tools used for importing different types of files.
189echo For more info please visit this page
190echo http://wiki.greenstone.org/wiki/index.php/Installing_Greenstone_2_from_SVN_source_on_Windows#Getting_winbin
191GOTO END
192
193:ENDNOUNZIP
194echo.
195echo /!\ Error /!\ - Extacting tools are missing.
196echo They are required to extract all packages needed for compilation.
197echo These tools are contained in the Winbin folder, more info on this web page:
198echo http://wiki.greenstone.org/wiki/index.php/Installing_Greenstone_2_from_SVN_source_on_Windows#Getting_winbin
199GOTO END
200
201:ENDNOWINPACK
202echo.
203echo /!\ Error /!\ - Windows packages are missing.
204echo Some required packages are missing in .\common-src\packages\windows\
205echo Please go to this page for more information on how to get everything:
206echo http://wiki.greenstone.org/wiki/index.php/Installing_Greenstone_2_from_SVN_source_on_Windows
207GOTO END
208
209:ENDNOSQLITE
210echo.
211echo /!\ Error /!\ - SQLite is missing.
212echo Some required packages are missing in .\common-src\packages\sqlite\
213echo Please go to this page for more information on how to get everything:
214echo http://wiki.greenstone.org/wiki/index.php/Installing_Greenstone_2_from_SVN_source_on_Windows
215GOTO END
216
217:ENDNOICONV
218echo.
219echo /!\ Error /!\ - Indexers are missing.
220echo Some required packages are missing in .\common-src\indexers\packages\windows\
221echo Please go to this page for more information on how to get everything:
222echo http://wiki.greenstone.org/wiki/index.php/Installing_Greenstone_2_from_SVN_source_on_Windows
223GOTO END
224
225:ENDNOVCVARS32
226echo.
227echo /!\ Error /!\ - Not able to find 'vcvars32.bat'.
228echo You need Visual Studio to compile the source code but we were
229echo unable to find the file vcvars32.bat in your system.
230echo.
231echo Please edit this bat file and manually set the full path to
232echo vcvars32.bat then run this script again.
233GOTO END
234
235:ENDNOSDKENV
236echo.
237echo /!\ Error /!\ - Not able to find 'SetEnv.cmd'.
238echo You need Microsoft Platform SDK to compile up the Apache web server
239echo but we were unable to find the SDK file SetEnv.cmd on your system.
240echo.
241echo Please edit the makegs2.bat file and manually set the full path to
242echo SetEnv.cmd then run this script again.
243GOTO END
244
245:ENDOK
246echo.
247echo Done!
248echo.
249echo This program is free software; you can redistribute it and/or
250echo modify it under the terms of the GNU General Public License
251echo as published by the Free Software Foundation; either version 2
252echo of the License, or (at your option) any later version.
253echo.
254echo This program is distributed in the hope that it will be useful,
255echo but WITHOUT ANY WARRANTY; without even the implied warranty of
256echo MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
257echo GNU General Public License for more details.
258echo.
259GOTO END
260
261:END
262popd
Note: See TracBrowser for help on using the repository browser.