root/gsdl/trunk/makegs2.bat @ 17966

Revision 17966, 7.3 KB (checked in by max, 11 years ago)

Allow this file to be run from anywhere (allowing Vista elevation).

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