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