[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
|
---|
| 133 | echo 3. Both
|
---|
[20183] | 134 | echo 4. Apache local library (needs Microsoft Platform SDK)
|
---|
| 135 | echo 5. Quit
|
---|
[17900] | 136 | echo.
|
---|
| 137 | echo Please choose a number from the menu. Otherwise both libraries will be compiled in 15 seconds.
|
---|
[20183] | 138 | .\bin\windows\choice.exe /N /T:3,15 /C:12345
|
---|
| 139 | IF errorlevel 5 GOTO END
|
---|
| 140 | IF errorlevel 4 GOTO WITHAPACHE
|
---|
[17900] | 141 | IF errorlevel 3 GOTO WITHBOTH
|
---|
| 142 | IF errorlevel 2 GOTO WITHOUTLOCALLIB
|
---|
| 143 | IF errorlevel 1 GOTO WITHLOCALLIB
|
---|
| 144 | IF errorlevel 0 GOTO END
|
---|
| 145 |
|
---|
| 146 |
|
---|
[20183] | 147 | :WITHAPACHE
|
---|
| 148 | :: Only compile up the Apache web server if we're asked to
|
---|
| 149 |
|
---|
| 150 | :: Now unpack the custom GS2 apache web server tar.gz file
|
---|
| 151 | 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
|
---|
| 152 |
|
---|
| 153 | nmake /f win32.mak APACHE_HTTPD=1
|
---|
| 154 | GOTO ENDOK
|
---|
| 155 |
|
---|
| 156 |
|
---|
[17900] | 157 | :WITHOUTLOCALLIB
|
---|
[20183] | 158 | echo.
|
---|
| 159 | echo.
|
---|
[17900] | 160 | nmake /f win32.mak
|
---|
| 161 | GOTO ENDOK
|
---|
| 162 |
|
---|
| 163 | :WITHLOCALLIB
|
---|
[20183] | 164 | echo.
|
---|
| 165 | echo.
|
---|
[17900] | 166 | nmake /f win32.mak LOCAL_LIBRARY=1
|
---|
| 167 | GOTO ENDOK
|
---|
| 168 |
|
---|
| 169 | :WITHBOTH
|
---|
[20183] | 170 | echo.
|
---|
| 171 | echo.
|
---|
[17900] | 172 | nmake /f win32.mak
|
---|
| 173 | nmake /f win32.mak LOCAL_LIBRARY=1
|
---|
| 174 | GOTO ENDOK
|
---|
| 175 |
|
---|
| 176 | :NEEDUNZIP
|
---|
| 177 | echo.
|
---|
| 178 | echo /!\ Error /!\ - Some or all the packages are not properly extracted.
|
---|
| 179 | echo.
|
---|
| 180 | echo If you wish to compile Greenstone 2 you need to unzip the required packages now.
|
---|
| 181 | echo.
|
---|
| 182 | rem Ask to Unzip the packages now otherwise quit
|
---|
| 183 | echo Do you want to unzip these required packages now? This will be the default action in 10 seconds.
|
---|
| 184 | .\bin\windows\choice.exe /T:Y,10 /c:YN
|
---|
| 185 | IF errorlevel 2 GOTO END
|
---|
| 186 | IF errorlevel 1 GOTO UNZIP
|
---|
| 187 | IF errorlevel 0 GOTO END
|
---|
| 188 |
|
---|
| 189 | :ENDNOWINBIN
|
---|
| 190 | echo.
|
---|
| 191 | echo /!\ Error /!\ - Winbin has not been found.
|
---|
| 192 | echo This is required to get the conversion tools used for importing different types of files.
|
---|
| 193 | echo For more info please visit this page
|
---|
| 194 | echo http://wiki.greenstone.org/wiki/index.php/Installing_Greenstone_2_from_SVN_source_on_Windows#Getting_winbin
|
---|
| 195 | GOTO END
|
---|
| 196 |
|
---|
| 197 | :ENDNOUNZIP
|
---|
| 198 | echo.
|
---|
[18090] | 199 | echo /!\ Error /!\ - Extacting tools are missing.
|
---|
| 200 | echo They are required to extract all packages needed for compilation.
|
---|
| 201 | echo These tools are contained in the Winbin folder, more info on this web page:
|
---|
[17900] | 202 | echo http://wiki.greenstone.org/wiki/index.php/Installing_Greenstone_2_from_SVN_source_on_Windows#Getting_winbin
|
---|
| 203 | GOTO END
|
---|
| 204 |
|
---|
| 205 | :ENDNOWINPACK
|
---|
| 206 | echo.
|
---|
| 207 | echo /!\ Error /!\ - Windows packages are missing.
|
---|
| 208 | echo Some required packages are missing in .\common-src\packages\windows\
|
---|
| 209 | echo Please go to this page for more information on how to get everything:
|
---|
| 210 | echo http://wiki.greenstone.org/wiki/index.php/Installing_Greenstone_2_from_SVN_source_on_Windows
|
---|
| 211 | GOTO END
|
---|
| 212 |
|
---|
[18090] | 213 | :ENDNOSQLITE
|
---|
| 214 | echo.
|
---|
| 215 | echo /!\ Error /!\ - SQLite is missing.
|
---|
| 216 | echo Some required packages are missing in .\common-src\packages\sqlite\
|
---|
| 217 | echo Please go to this page for more information on how to get everything:
|
---|
| 218 | echo http://wiki.greenstone.org/wiki/index.php/Installing_Greenstone_2_from_SVN_source_on_Windows
|
---|
| 219 | GOTO END
|
---|
| 220 |
|
---|
[17900] | 221 | :ENDNOICONV
|
---|
| 222 | echo.
|
---|
| 223 | echo /!\ Error /!\ - Indexers are missing.
|
---|
| 224 | echo Some required packages are missing in .\common-src\indexers\packages\windows\
|
---|
| 225 | echo Please go to this page for more information on how to get everything:
|
---|
| 226 | echo http://wiki.greenstone.org/wiki/index.php/Installing_Greenstone_2_from_SVN_source_on_Windows
|
---|
| 227 | GOTO END
|
---|
| 228 |
|
---|
| 229 | :ENDNOVCVARS32
|
---|
| 230 | echo.
|
---|
| 231 | echo /!\ Error /!\ - Not able to find 'vcvars32.bat'.
|
---|
| 232 | echo You need Visual Studio to compile the source code but we were
|
---|
| 233 | echo unable to find the file vcvars32.bat in your system.
|
---|
| 234 | echo.
|
---|
| 235 | echo Please edit this bat file and manually set the full path to
|
---|
| 236 | echo vcvars32.bat then run this script again.
|
---|
| 237 | GOTO END
|
---|
| 238 |
|
---|
[20183] | 239 | :ENDNOSDKENV
|
---|
| 240 | echo.
|
---|
| 241 | echo /!\ Error /!\ - Not able to find 'SetEnv.cmd'.
|
---|
[20431] | 242 | echo We were unable to find the SDK file SetEnv.cmd on your system.
|
---|
| 243 | echo You need Microsoft Platform SDK (which is available for free) to compile
|
---|
| 244 | echo up the Apache web server. You also need it if you're working with
|
---|
| 245 | echo Microsoft Visual Studio 8 or higher.
|
---|
[20183] | 246 | echo.
|
---|
[20431] | 247 | echo If you already have it installed, please edit the makegs2.bat file and
|
---|
| 248 | echo manually set the full path to SetEnv.cmd, then run this script again.
|
---|
| 249 | echo If you have an older version of Visual Studio, then you do not need the
|
---|
| 250 | echo Platform SDK and can compile the Web and/or Local libraries up from the
|
---|
| 251 | echo DOS command prompt using:
|
---|
| 252 | echo nmake /f win32.mak
|
---|
| 253 | echo and/or
|
---|
| 254 | echo nmake /f win32.mak LOCAL_LIBRARY=1
|
---|
[20183] | 255 | GOTO END
|
---|
| 256 |
|
---|
[17900] | 257 | :ENDOK
|
---|
| 258 | echo.
|
---|
| 259 | echo Done!
|
---|
| 260 | echo.
|
---|
| 261 | echo This program is free software; you can redistribute it and/or
|
---|
| 262 | echo modify it under the terms of the GNU General Public License
|
---|
| 263 | echo as published by the Free Software Foundation; either version 2
|
---|
| 264 | echo of the License, or (at your option) any later version.
|
---|
| 265 | echo.
|
---|
| 266 | echo This program is distributed in the hope that it will be useful,
|
---|
| 267 | echo but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 268 | echo MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 269 | echo GNU General Public License for more details.
|
---|
| 270 | echo.
|
---|
| 271 | GOTO END
|
---|
| 272 |
|
---|
[17966] | 273 | :END
|
---|
| 274 | popd |
---|