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