root/gsdl/trunk/makegs2.bat @ 17900

Revision 17900, 7.5 KB (checked in by max, 11 years ago)

Add makegs2.bat which is a script that automate the building process of Greenstone2.

Line 
1@echo off
2
3
4:: Path to VCVARS32.bat -- You can set this variable manually if needed
5:: e.g. set VCVARS="C:\Program Files\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT"
6set VCVARS=""
7
8
9
10
11rem Checking for Winbin and Unzip utility
12IF NOT EXIST .\bin\windows\*.* GOTO ENDNOWINBIN
13IF NOT EXIST .\bin\windows\choice.exe GOTO ENDNOWINBIN
14
15
16echo.
17echo.
18echo  ####                        #                  ### 
19echo ##                           #                     #
20echo #     ###  ##   ##  ### ### ###  ##  ###  ##       #
21echo #   # #   #### #### # # ##   #  #  # # # ####    ## 
22echo ##  # #   #    #    # #   #  #  #  # # # #      ##   
23echo  #### #    ###  ### # # ###  ##  ##  # #  ###   ####
24echo   (C) 2009, New Zealand Digital Library Project
25echo.
26echo.
27echo.
28
29
30rem Checking for existance of the packages extracted / zipped
31IF NOT EXIST .\common-src\packages\windows\crypt\crypt\*.* IF NOT EXIST .\common-src\packages\windows\crypt\crypt.zip GOTO ENDNOWINPACK
32
33IF NOT EXIST .\common-src\packages\windows\expat\expat\*.* IF NOT EXIST .\common-src\packages\windows\expat\expat.zip GOTO ENDNOWINPACK
34
35IF NOT EXIST .\common-src\packages\windows\gdbm\gdbm\*.* IF NOT EXIST .\common-src\packages\windows\gdbm\gdbm.zip GOTO ENDNOWINPACK
36
37IF NOT EXIST .\common-src\packages\windows\stlport\stlport\*.* IF NOT EXIST .\common-src\packages\windows\stlport\stlport.zip GOTO ENDNOWINPACK
38
39IF NOT EXIST .\common-src\indexers\packages\windows\iconv\iconv\*.* IF NOT EXIST .\common-src\indexers\packages\windows\iconv\iconv.zip GOTO ENDNOICONV
40
41rem Ask the user to extract now or to directly compile
42echo Do you want to unzip the required packages (Recommended)? This will be the default action in 10 seconds.
43.\bin\windows\choice.exe /T:Y,10 /C:YN
44    IF errorlevel 2 GOTO COMPILE
45    IF errorlevel 1 GOTO UNZIP
46    IF errorlevel 0 GOTO END
47   
48
49:UNZIP
50IF NOT EXIST .\bin\windows\unzip.exe GOTO ENDNOUNZIP
51
52rem Extracting the packages
53IF 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\
54
55IF 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\
56
57IF 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\
58
59IF 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\
60
61IF 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\
62echo.
63echo.
64:COMPILE
65
66rem Last check if all the packages have been extracted prior compilation
67IF NOT EXIST .\common-src\packages\windows\crypt\crypt\*.* GOTO NEEDUNZIP
68IF NOT EXIST .\common-src\packages\windows\expat\expat\*.* GOTO NEEDUNZIP
69IF NOT EXIST .\common-src\packages\windows\gdbm\gdbm\*.* GOTO NEEDUNZIP
70IF NOT EXIST .\common-src\packages\windows\stlport\stlport\*.* GOTO NEEDUNZIP
71IF NOT EXIST .\common-src\indexers\packages\windows\iconv\iconv\*.* GOTO NEEDUNZIP
72
73rem Check some known paths to VCVARS32.BAT
74:: if the user has set VCVARS32 don't look in the default places at all
75IF NOT %VCVARS%=="" GOTO CALLVCVARS
76
77:: Visual Studio 2005 Express
78IF EXIST "C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat" set VCVARS="C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat"
79
80:: Visual Studio 2005
81IF EXIST "C:\Program Files\Microsoft Visual Studio 8\VC\vcvars32.bat" set VCVARS="C:\Program Files\Microsoft Visual Studio 8\VC\vcvars32.bat"
82
83:: Visual Studio 2003
84IF EXIST "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\vcvars32.bat" set VCVARS="C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\vcvars32.bat"
85
86:: Visual Studio 6
87IF EXIST "C:\Program Files\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT" set VCVARS="C:\Program Files\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT"
88
89
90IF %VCVARS%=="" GOTO ENDNOVCVARS32
91
92:CALLVCVARS
93call %VCVARS%
94echo.
95echo.
96echo.
97rem Ask the user what to compile
98echo What do you want to compile?
99echo.
100echo 1. Local library only
101echo 2. Web library only
102echo 3. Both
103echo 4. Quit
104echo.
105echo Please choose a number from the menu. Otherwise both libraries will be compiled in 15 seconds.
106.\bin\windows\choice.exe /N /T:3,15 /C:1234
107    IF errorlevel 4 GOTO END
108    IF errorlevel 3 GOTO WITHBOTH
109    IF errorlevel 2 GOTO WITHOUTLOCALLIB
110    IF errorlevel 1 GOTO WITHLOCALLIB
111    IF errorlevel 0 GOTO END
112
113
114:WITHOUTLOCALLIB
115nmake /f win32.mak
116GOTO ENDOK
117
118:WITHLOCALLIB
119nmake /f win32.mak LOCAL_LIBRARY=1
120GOTO ENDOK
121
122:WITHBOTH
123nmake /f win32.mak
124nmake /f win32.mak LOCAL_LIBRARY=1
125GOTO ENDOK
126
127:NEEDUNZIP
128echo.
129echo /!\ Error /!\ - Some or all the packages are not properly extracted.
130echo.
131echo If you wish to compile Greenstone 2 you need to unzip the required packages now.
132echo.
133rem Ask to Unzip the packages now otherwise quit
134echo Do you want to unzip these required packages now? This will be the default action in 10 seconds.
135.\bin\windows\choice.exe /T:Y,10 /c:YN
136    IF errorlevel 2 GOTO END
137    IF errorlevel 1 GOTO UNZIP
138    IF errorlevel 0 GOTO END
139
140:ENDNOWINBIN
141echo.
142echo /!\ Error /!\ - Winbin has not been found.
143echo This is required to get the conversion tools used for importing different types of files.
144echo For more info please visit this page
145echo http://wiki.greenstone.org/wiki/index.php/Installing_Greenstone_2_from_SVN_source_on_Windows#Getting_winbin
146GOTO END
147
148:ENDNOUNZIP
149echo.
150echo /!\ Error /!\ - unzip.exe has not been found.
151echo This is required to extract the packages required for compilation.
152echo This tool is part of the Winbin folder, more info on this web page:
153echo http://wiki.greenstone.org/wiki/index.php/Installing_Greenstone_2_from_SVN_source_on_Windows#Getting_winbin
154GOTO END
155
156:ENDNOWINPACK
157echo.
158echo /!\ Error /!\ - Windows packages are missing.
159echo Some required packages are missing in .\common-src\packages\windows\
160echo Please go to this page for more information on how to get everything:
161echo http://wiki.greenstone.org/wiki/index.php/Installing_Greenstone_2_from_SVN_source_on_Windows
162GOTO END
163
164:ENDNOICONV
165echo.
166echo /!\ Error /!\ - Indexers are missing.
167echo Some required packages are missing in .\common-src\indexers\packages\windows\
168echo Please go to this page for more information on how to get everything:
169echo http://wiki.greenstone.org/wiki/index.php/Installing_Greenstone_2_from_SVN_source_on_Windows
170GOTO END
171
172:ENDNOVCVARS32
173echo.
174echo /!\ Error /!\ - Not able to find 'vcvars32.bat'.
175echo You need Visual Studio to compile the source code but we were
176echo unable to find the file vcvars32.bat in your system.
177echo.
178echo Please edit this bat file and manually set the full path to
179echo vcvars32.bat then run this script again.
180GOTO END
181
182:ENDOK
183echo.
184echo Done!
185echo.
186echo This program is free software; you can redistribute it and/or
187echo modify it under the terms of the GNU General Public License
188echo as published by the Free Software Foundation; either version 2
189echo of the License, or (at your option) any later version.
190echo.
191echo This program is distributed in the hope that it will be useful,
192echo but WITHOUT ANY WARRANTY; without even the implied warranty of
193echo MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
194echo GNU General Public License for more details.
195echo.
196GOTO END
197
198:END
Note: See TracBrowser for help on using the browser.