source: gsdl/stable/makegs2.bat@ 20749

Last change on this file since 20749 was 20745, checked in by ak19, 15 years ago

Removed two fixed strings I had left in on last commit.

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