1 | @echo off
|
---|
2 | pushd "%CD%"
|
---|
3 | CD /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"
|
---|
8 | set VCVARS=""
|
---|
9 |
|
---|
10 | :: Path to Microsoft Platform SDK's SetEnv.cmd -- You can set this variable manually if needed
|
---|
11 | set SDK_ENV=""
|
---|
12 |
|
---|
13 |
|
---|
14 | rem Checking for Winbin and Unzip utility
|
---|
15 | IF NOT EXIST .\bin\windows\*.* GOTO ENDNOWINBIN
|
---|
16 | IF NOT EXIST .\bin\windows\choice.exe GOTO ENDNOWINBIN
|
---|
17 |
|
---|
18 |
|
---|
19 | echo.
|
---|
20 | echo.
|
---|
21 | echo #### # ###
|
---|
22 | echo ## # #
|
---|
23 | echo # ### ## ## ### ### ### ## ### ## #
|
---|
24 | echo # # # #### #### # # ## # # # # # #### ##
|
---|
25 | echo ## # # # # # # # # # # # # # ##
|
---|
26 | echo #### # ### ### # # ### ## ## # # ### ####
|
---|
27 | echo (C) 2008, New Zealand Digital Library Project
|
---|
28 | echo.
|
---|
29 | echo.
|
---|
30 | echo.
|
---|
31 |
|
---|
32 |
|
---|
33 | rem Checking for existance of the packages extracted / zipped
|
---|
34 | IF NOT EXIST .\common-src\packages\windows\crypt\crypt\nul IF NOT EXIST .\common-src\packages\windows\crypt\crypt.zip GOTO ENDNOWINPACK
|
---|
35 |
|
---|
36 | IF 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 |
|
---|
40 | IF NOT EXIST .\common-src\packages\windows\stlport\stlport\nul IF NOT EXIST .\common-src\packages\windows\stlport\stlport.zip GOTO ENDNOWINPACK
|
---|
41 |
|
---|
42 | IF NOT EXIST .\common-src\indexers\packages\windows\iconv\iconv\nul IF NOT EXIST .\common-src\indexers\packages\windows\iconv\iconv.zip GOTO ENDNOICONV
|
---|
43 |
|
---|
44 | IF NOT EXIST .\common-src\packages\sqlite\sqlite* IF NOT EXIST .\common-src\packages\sqlite\sqlite*.tar.gz GOTO ENDNOSQLITE
|
---|
45 |
|
---|
46 | rem Ask the user to extract now or to directly compile
|
---|
47 | echo 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
|
---|
55 | IF NOT EXIST .\bin\windows\unzip.exe GOTO ENDNOUNZIP
|
---|
56 | IF NOT EXIST .\bin\windows\gunzip.exe GOTO ENDNOUNZIP
|
---|
57 | IF NOT EXIST .\bin\windows\tar.exe GOTO ENDNOUNZIP
|
---|
58 |
|
---|
59 | rem Extracting the packages
|
---|
60 | 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\
|
---|
61 |
|
---|
62 | IF 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 |
|
---|
64 | 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\
|
---|
65 |
|
---|
66 | 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\
|
---|
67 |
|
---|
68 | 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\
|
---|
69 |
|
---|
70 | 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
|
---|
71 |
|
---|
72 |
|
---|
73 | echo.
|
---|
74 | echo.
|
---|
75 | :COMPILE
|
---|
76 |
|
---|
77 | rem Last check if all the packages have been extracted prior compilation
|
---|
78 | IF NOT EXIST .\common-src\packages\windows\crypt\crypt\*.* GOTO NEEDUNZIP
|
---|
79 | IF NOT EXIST .\common-src\packages\windows\expat\expat\*.* GOTO NEEDUNZIP
|
---|
80 | :: IF NOT EXIST .\common-src\packages\windows\gdbm\gdbm\*.* GOTO NEEDUNZIP
|
---|
81 | IF NOT EXIST .\common-src\packages\windows\stlport\stlport\*.* GOTO NEEDUNZIP
|
---|
82 | IF NOT EXIST .\common-src\indexers\packages\windows\iconv\iconv\*.* GOTO NEEDUNZIP
|
---|
83 | IF NOT EXIST .\common-src\packages\sqlite\sqlite* GOTO NEEDUNZIP
|
---|
84 |
|
---|
85 | rem Check some known paths to VCVARS32.BAT
|
---|
86 | :: if the user has set VCVARS32 don't look in the default places at all
|
---|
87 | IF NOT %VCVARS%=="" GOTO PROMPT
|
---|
88 |
|
---|
89 | :: Visual Studio 2005 Pro --- NOT READY YET
|
---|
90 | IF 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
|
---|
93 | 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"
|
---|
94 |
|
---|
95 | :: Visual Studio 6 \ VS6
|
---|
96 | IF %VCVARS%=="" IF EXIST "%programfiles%\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT" set VCVARS="%programfiles%\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT"
|
---|
97 |
|
---|
98 | IF %VCVARS%=="" GOTO ENDNOVCVARS32
|
---|
99 | :: Now VCVARS has been set so it can be used when we need it
|
---|
100 |
|
---|
101 |
|
---|
102 | :PROMPT
|
---|
103 | echo.
|
---|
104 | rem Ask the user what to compile
|
---|
105 | echo What do you want to compile?
|
---|
106 | echo.
|
---|
107 | echo 1. Local library only
|
---|
108 | echo 2. Web library only
|
---|
109 | echo 3. Both
|
---|
110 | echo 4. Apache local library (needs Microsoft Platform SDK)
|
---|
111 | echo 5. Quit
|
---|
112 | echo.
|
---|
113 | echo 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 |
|
---|
126 | rem Check known path(s) to SetEnv.cmd
|
---|
127 | :: if the user has set SDK_ENV don't look in the default places at all
|
---|
128 | IF NOT %SDK_ENV%=="" GOTO CALL_SDK
|
---|
129 |
|
---|
130 | IF EXIST "%programfiles%\Microsoft Platform SDK\SetEnv.cmd" set SDK_ENV="%programfiles%\Microsoft Platform SDK\SetEnv.cmd"
|
---|
131 |
|
---|
132 | IF %SDK_ENV%=="" GOTO ENDNOSDKENV
|
---|
133 |
|
---|
134 | :CALL_SDK
|
---|
135 | call %SDK_ENV%
|
---|
136 | echo.
|
---|
137 | echo.
|
---|
138 |
|
---|
139 | call %VCVARS%
|
---|
140 | echo.
|
---|
141 | echo.
|
---|
142 |
|
---|
143 | :: Now unpack the custom GS2 apache web server tar.gz file
|
---|
144 | 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
|
---|
145 |
|
---|
146 | nmake /f win32.mak APACHE_HTTPD=1
|
---|
147 | GOTO ENDOK
|
---|
148 |
|
---|
149 |
|
---|
150 | :WITHOUTLOCALLIB
|
---|
151 | call %VCVARS%
|
---|
152 | echo.
|
---|
153 | echo.
|
---|
154 | nmake /f win32.mak
|
---|
155 | GOTO ENDOK
|
---|
156 |
|
---|
157 | :WITHLOCALLIB
|
---|
158 | call %VCVARS%
|
---|
159 | echo.
|
---|
160 | echo.
|
---|
161 | nmake /f win32.mak LOCAL_LIBRARY=1
|
---|
162 | GOTO ENDOK
|
---|
163 |
|
---|
164 | :WITHBOTH
|
---|
165 | call %VCVARS%
|
---|
166 | echo.
|
---|
167 | echo.
|
---|
168 | nmake /f win32.mak
|
---|
169 | nmake /f win32.mak LOCAL_LIBRARY=1
|
---|
170 | GOTO ENDOK
|
---|
171 |
|
---|
172 | :NEEDUNZIP
|
---|
173 | echo.
|
---|
174 | echo /!\ Error /!\ - Some or all the packages are not properly extracted.
|
---|
175 | echo.
|
---|
176 | echo If you wish to compile Greenstone 2 you need to unzip the required packages now.
|
---|
177 | echo.
|
---|
178 | rem Ask to Unzip the packages now otherwise quit
|
---|
179 | echo 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
|
---|
186 | echo.
|
---|
187 | echo /!\ Error /!\ - Winbin has not been found.
|
---|
188 | echo This is required to get the conversion tools used for importing different types of files.
|
---|
189 | echo For more info please visit this page
|
---|
190 | echo http://wiki.greenstone.org/wiki/index.php/Installing_Greenstone_2_from_SVN_source_on_Windows#Getting_winbin
|
---|
191 | GOTO END
|
---|
192 |
|
---|
193 | :ENDNOUNZIP
|
---|
194 | echo.
|
---|
195 | echo /!\ Error /!\ - Extacting tools are missing.
|
---|
196 | echo They are required to extract all packages needed for compilation.
|
---|
197 | echo These tools are contained in the Winbin folder, more info on this web page:
|
---|
198 | echo http://wiki.greenstone.org/wiki/index.php/Installing_Greenstone_2_from_SVN_source_on_Windows#Getting_winbin
|
---|
199 | GOTO END
|
---|
200 |
|
---|
201 | :ENDNOWINPACK
|
---|
202 | echo.
|
---|
203 | echo /!\ Error /!\ - Windows packages are missing.
|
---|
204 | echo Some required packages are missing in .\common-src\packages\windows\
|
---|
205 | echo Please go to this page for more information on how to get everything:
|
---|
206 | echo http://wiki.greenstone.org/wiki/index.php/Installing_Greenstone_2_from_SVN_source_on_Windows
|
---|
207 | GOTO END
|
---|
208 |
|
---|
209 | :ENDNOSQLITE
|
---|
210 | echo.
|
---|
211 | echo /!\ Error /!\ - SQLite is missing.
|
---|
212 | echo Some required packages are missing in .\common-src\packages\sqlite\
|
---|
213 | echo Please go to this page for more information on how to get everything:
|
---|
214 | echo http://wiki.greenstone.org/wiki/index.php/Installing_Greenstone_2_from_SVN_source_on_Windows
|
---|
215 | GOTO END
|
---|
216 |
|
---|
217 | :ENDNOICONV
|
---|
218 | echo.
|
---|
219 | echo /!\ Error /!\ - Indexers are missing.
|
---|
220 | echo Some required packages are missing in .\common-src\indexers\packages\windows\
|
---|
221 | echo Please go to this page for more information on how to get everything:
|
---|
222 | echo http://wiki.greenstone.org/wiki/index.php/Installing_Greenstone_2_from_SVN_source_on_Windows
|
---|
223 | GOTO END
|
---|
224 |
|
---|
225 | :ENDNOVCVARS32
|
---|
226 | echo.
|
---|
227 | echo /!\ Error /!\ - Not able to find 'vcvars32.bat'.
|
---|
228 | echo You need Visual Studio to compile the source code but we were
|
---|
229 | echo unable to find the file vcvars32.bat in your system.
|
---|
230 | echo.
|
---|
231 | echo Please edit this bat file and manually set the full path to
|
---|
232 | echo vcvars32.bat then run this script again.
|
---|
233 | GOTO END
|
---|
234 |
|
---|
235 | :ENDNOSDKENV
|
---|
236 | echo.
|
---|
237 | echo /!\ Error /!\ - Not able to find 'SetEnv.cmd'.
|
---|
238 | echo You need Microsoft Platform SDK to compile up the Apache web server
|
---|
239 | echo but we were unable to find the SDK file SetEnv.cmd on your system.
|
---|
240 | echo.
|
---|
241 | echo Please edit the makegs2.bat file and manually set the full path to
|
---|
242 | echo SetEnv.cmd then run this script again.
|
---|
243 | GOTO END
|
---|
244 |
|
---|
245 | :ENDOK
|
---|
246 | echo.
|
---|
247 | echo Done!
|
---|
248 | echo.
|
---|
249 | echo This program is free software; you can redistribute it and/or
|
---|
250 | echo modify it under the terms of the GNU General Public License
|
---|
251 | echo as published by the Free Software Foundation; either version 2
|
---|
252 | echo of the License, or (at your option) any later version.
|
---|
253 | echo.
|
---|
254 | echo This program is distributed in the hope that it will be useful,
|
---|
255 | echo but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
256 | echo MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
257 | echo GNU General Public License for more details.
|
---|
258 | echo.
|
---|
259 | GOTO END
|
---|
260 |
|
---|
261 | :END
|
---|
262 | popd |
---|