source: main/trunk/greenstone2/makegs2.bat@ 25525

Last change on this file since 25525 was 25525, checked in by ak19, 12 years ago

Added a Compile All command without turning debugging on.

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