root/main/trunk/greenstone2/makegs2.bat @ 24461

Revision 24461, 11.0 KB (checked in by ak19, 8 years ago)

Updated automated compilation script with clean command and a (compile) All command in place of a compile Both command (that used to compile local-lib server and web server, but not apache server).

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