@echo off pushd "%CD%" CD /D "%~dp0" :: Path to VCVARS32.bat -- You can set this variable manually if needed :: e.g. set VCVARS="C:\Program Files\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT" set VCVARS="" rem Checking for Winbin and Unzip utility IF NOT EXIST .\bin\windows\*.* GOTO ENDNOWINBIN IF NOT EXIST .\bin\windows\choice.exe GOTO ENDNOWINBIN echo. echo. echo #### # ### echo ## # # echo # ### ## ## ### ### ### ## ### ## # echo # # # #### #### # # ## # # # # # #### ## echo ## # # # # # # # # # # # # # ## echo #### # ### ### # # ### ## ## # # ### #### echo (C) 2009, New Zealand Digital Library Project echo. echo. echo. rem Checking for existance of the packages extracted / zipped IF NOT EXIST .\common-src\packages\windows\crypt\crypt\*.* IF NOT EXIST .\common-src\packages\windows\crypt\crypt.zip GOTO ENDNOWINPACK IF NOT EXIST .\common-src\packages\windows\expat\expat\*.* IF NOT EXIST .\common-src\packages\windows\expat\expat.zip GOTO ENDNOWINPACK IF NOT EXIST .\common-src\packages\windows\gdbm\gdbm\*.* IF NOT EXIST .\common-src\packages\windows\gdbm\gdbm.zip GOTO ENDNOWINPACK IF NOT EXIST .\common-src\packages\windows\stlport\stlport\*.* IF NOT EXIST .\common-src\packages\windows\stlport\stlport.zip GOTO ENDNOWINPACK IF NOT EXIST .\common-src\indexers\packages\windows\iconv\iconv\*.* IF NOT EXIST .\common-src\indexers\packages\windows\iconv\iconv.zip GOTO ENDNOICONV rem Ask the user to extract now or to directly compile echo Do you want to unzip the required packages (Recommended)? This will be the default action in 10 seconds. .\bin\windows\choice.exe /T:Y,10 /C:YN IF errorlevel 2 GOTO COMPILE IF errorlevel 1 GOTO UNZIP IF errorlevel 0 GOTO END :UNZIP IF NOT EXIST .\bin\windows\unzip.exe GOTO ENDNOUNZIP rem Extracting the packages 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\ IF 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\ 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\ 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\ 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\ echo. echo. :COMPILE rem Last check if all the packages have been extracted prior compilation IF NOT EXIST .\common-src\packages\windows\crypt\crypt\*.* GOTO NEEDUNZIP IF NOT EXIST .\common-src\packages\windows\expat\expat\*.* GOTO NEEDUNZIP IF NOT EXIST .\common-src\packages\windows\gdbm\gdbm\*.* GOTO NEEDUNZIP IF NOT EXIST .\common-src\packages\windows\stlport\stlport\*.* GOTO NEEDUNZIP IF NOT EXIST .\common-src\indexers\packages\windows\iconv\iconv\*.* GOTO NEEDUNZIP rem Check some known paths to VCVARS32.BAT :: if the user has set VCVARS32 don't look in the default places at all IF NOT %VCVARS%=="" GOTO CALLVCVARS :: Visual Studio 2005 Pro --- NOT READY YET ::IF EXIST "%programfiles%\Microsoft Visual Studio 8\VC\bin\vcvars32.bat" set VCVARS="%programfiles%\Microsoft Visual Studio 8\VC\bin\vcvars32.bat" :: Visual Studio 2003 \ VS7 IF EXIST "%programfiles%\Microsoft Visual Studio .NET 2003\Vc7\bin\vcvars32.bat" set VCVARS="%programfiles%\Microsoft Visual Studio .NET 2003\Vc7\bin\vcvars32.bat" :: Visual Studio 6 \ VS6 IF EXIST "%programfiles%\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT" set VCVARS="%programfiles%\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT" IF %VCVARS%=="" GOTO ENDNOVCVARS32 :CALLVCVARS call %VCVARS% echo. echo. echo. rem Ask the user what to compile echo What do you want to compile? echo. echo 1. Local library only echo 2. Web library only echo 3. Both echo 4. Quit echo. echo Please choose a number from the menu. Otherwise both libraries will be compiled in 15 seconds. .\bin\windows\choice.exe /N /T:3,15 /C:1234 IF errorlevel 4 GOTO END IF errorlevel 3 GOTO WITHBOTH IF errorlevel 2 GOTO WITHOUTLOCALLIB IF errorlevel 1 GOTO WITHLOCALLIB IF errorlevel 0 GOTO END :WITHOUTLOCALLIB nmake /f win32.mak GOTO ENDOK :WITHLOCALLIB nmake /f win32.mak LOCAL_LIBRARY=1 GOTO ENDOK :WITHBOTH nmake /f win32.mak nmake /f win32.mak LOCAL_LIBRARY=1 GOTO ENDOK :NEEDUNZIP echo. echo /!\ Error /!\ - Some or all the packages are not properly extracted. echo. echo If you wish to compile Greenstone 2 you need to unzip the required packages now. echo. rem Ask to Unzip the packages now otherwise quit echo Do you want to unzip these required packages now? This will be the default action in 10 seconds. .\bin\windows\choice.exe /T:Y,10 /c:YN IF errorlevel 2 GOTO END IF errorlevel 1 GOTO UNZIP IF errorlevel 0 GOTO END :ENDNOWINBIN echo. echo /!\ Error /!\ - Winbin has not been found. echo This is required to get the conversion tools used for importing different types of files. echo For more info please visit this page echo http://wiki.greenstone.org/wiki/index.php/Installing_Greenstone_2_from_SVN_source_on_Windows#Getting_winbin GOTO END :ENDNOUNZIP echo. echo /!\ Error /!\ - unzip.exe has not been found. echo This is required to extract the packages required for compilation. echo This tool is part of the Winbin folder, more info on this web page: echo http://wiki.greenstone.org/wiki/index.php/Installing_Greenstone_2_from_SVN_source_on_Windows#Getting_winbin GOTO END :ENDNOWINPACK echo. echo /!\ Error /!\ - Windows packages are missing. echo Some required packages are missing in .\common-src\packages\windows\ echo Please go to this page for more information on how to get everything: echo http://wiki.greenstone.org/wiki/index.php/Installing_Greenstone_2_from_SVN_source_on_Windows GOTO END :ENDNOICONV echo. echo /!\ Error /!\ - Indexers are missing. echo Some required packages are missing in .\common-src\indexers\packages\windows\ echo Please go to this page for more information on how to get everything: echo http://wiki.greenstone.org/wiki/index.php/Installing_Greenstone_2_from_SVN_source_on_Windows GOTO END :ENDNOVCVARS32 echo. echo /!\ Error /!\ - Not able to find 'vcvars32.bat'. echo You need Visual Studio to compile the source code but we were echo unable to find the file vcvars32.bat in your system. echo. echo Please edit this bat file and manually set the full path to echo vcvars32.bat then run this script again. GOTO END :ENDOK echo. echo Done! echo. echo This program is free software; you can redistribute it and/or echo modify it under the terms of the GNU General Public License echo as published by the Free Software Foundation; either version 2 echo of the License, or (at your option) any later version. echo. echo This program is distributed in the hope that it will be useful, echo but WITHOUT ANY WARRANTY; without even the implied warranty of echo MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the echo GNU General Public License for more details. echo. GOTO END :END popd