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