2009-07-29 08:59:18 +00:00
@ echo off
2012-02-20 00:51:52 +01:00
set GRASS_VERSION = 6.4.2
2009-07-29 08:59:18 +00:00
2009-08-18 21:32:20 +00:00
set BUILDDIR = %CD% \build
REM set BUILDDIR=%TEMP%\qgis_unstable
set LOG = %BUILDDIR% \build.log
if not exist " %BUILDDIR% " mkdir %BUILDDIR%
if not exist " %BUILDDIR% " goto error
2009-08-18 11:59:43 +00:00
set VERSION = %1
set PACKAGE = %2
2009-09-20 08:46:24 +00:00
set PACKAGENAME = %3
2009-08-18 11:59:43 +00:00
if " %VERSION% " == " " goto error
if " %PACKAGE% " == " " goto error
2009-09-20 08:46:24 +00:00
if " %PACKAGENAME% " == " " set PACKAGENAME = qgis-dev
2009-08-18 11:59:43 +00:00
2011-01-29 15:16:57 +00:00
path %SYSTEMROOT% \system32;%SYSTEMROOT% ;%SYSTEMROOT% \System32\Wbem;%PROGRAMFILES% \CMake 2.8\bin
2009-07-29 08:59:18 +00:00
set PYTHONPATH =
set VS90COMNTOOLS = %PROGRAMFILES% \Microsoft Visual Studio 9.0\Common7\Tools\
call " %PROGRAMFILES% \Microsoft Visual Studio 9.0\VC\vcvarsall.bat " x86
2009-08-18 11:59:43 +00:00
if " %OSGEO4W_ROOT% " == " " set OSGEO4W_ROOT = %PROGRAMFILES% \OSGeo4W
if not exist " %OSGEO4W_ROOT% \bin\o4w_env.bat " goto error
2009-07-29 08:59:18 +00:00
call " %OSGEO4W_ROOT% \bin\o4w_env.bat "
2009-08-12 10:28:40 +00:00
set O4W_ROOT = %OSGEO4W_ROOT:\=/%
set LIB_DIR = %O4W_ROOT%
2009-07-29 08:59:18 +00:00
2009-08-18 11:59:43 +00:00
set DEVENV =
if exist " %DevEnvDir% \vcexpress.exe " set DEVENV = vcexpress
if exist " %DevEnvDir% \devenv.exe " set DEVENV = devenv
if " %DEVENV% " == " " goto error
2009-07-29 08:59:18 +00:00
PROMPT qgis%VERSION% $g
set BUILDCONF = RelWithDebInfo
REM set BUILDCONF=Release
2009-08-18 11:59:43 +00:00
cd ..\..
set SRCDIR = %CD%
if " %BUILDDIR:~1,1% " == " : " %BUILDDIR:~0,2%
cd %BUILDDIR%
2009-07-29 08:59:18 +00:00
if not exist build.log goto build
REM
REM try renaming the logfile to see if it's locked
REM
if exist build.tmp del build.tmp
if exist build.tmp goto error
ren build.log build.tmp
if exist build.log goto locked
if not exist build.tmp goto locked
ren build.tmp build.log
if exist build.tmp goto locked
if not exist build.log goto locked
goto build
: locked
echo Logfile locked
if exist build.tmp del build.tmp
goto error
: build
echo Logging to %LOG%
echo BEGIN: %DATE% %TIME% >> %LOG% 2 >& 1
if errorlevel 1 goto error
set > buildenv.log
if exist CMakeCache.txt goto skipcmake
echo CMAKE: %DATE% %TIME% >> %LOG% 2 >& 1
if errorlevel 1 goto error
2011-01-29 15:16:57 +00:00
set LIB = %LIB% ;%OSGEO4W_ROOT% \lib
set INCLUDE = %INCLUDE% ;%OSGEO4W_ROOT% \include
2009-07-29 08:59:18 +00:00
cmake -G " Visual Studio 9 2008 " ^
2009-08-18 21:32:20 +00:00
-D PEDANTIC=TRUE ^
-D WITH_SPATIALITE=TRUE ^
2010-11-12 10:56:07 +00:00
-D WITH_MAPSERVER=TRUE ^
2011-07-10 13:36:29 +02:00
-D WITH_GLOBE=TRUE ^
2009-08-18 21:32:20 +00:00
-D CMAKE_BUILD_TYPE=%BUILDCONF% ^
-D CMAKE_CONFIGURATION_TYPES=%BUILDCONF% ^
2012-06-16 13:10:25 +02:00
-D GEOS_LIBRARY=%O4W_ROOT% /lib/geos_c_i.lib ^
-D SQLITE3_LIBRARY=%O4W_ROOT% /lib/sqlite3_i.lib ^
-D SPATIALITE_LIBRARY=%O4W_ROOT% /lib/spatialite_i.lib ^
2009-08-12 10:28:40 +00:00
-D PYTHON_EXECUTABLE=%O4W_ROOT% /bin/python.exe ^
2012-01-24 09:11:57 +01:00
-D PYTHON_INCLUDE_PATH=%O4W_ROOT% /apps/Python27/include ^
-D PYTHON_LIBRARY=%O4W_ROOT% /apps/Python27/libs/python27.lib ^
-D SIP_BINARY_PATH=%O4W_ROOT% /apps/Python27/sip.exe ^
2009-08-12 10:28:40 +00:00
-D GRASS_PREFIX=%O4W_ROOT% /apps/grass/grass-%GRASS_VERSION% ^
-D QT_BINARY_DIR=%O4W_ROOT% /bin ^
-D QT_LIBRARY_DIR=%O4W_ROOT% /lib ^
-D QT_HEADERS_DIR=%O4W_ROOT% /include/qt4 ^
-D QT_ZLIB_LIBRARY=%O4W_ROOT% /lib/zlib.lib ^
-D QT_PNG_LIBRARY=%O4W_ROOT% /lib/libpng13.lib ^
2010-01-07 18:30:33 +00:00
-D QWT_INCLUDE_DIR=%O4W_ROOT% /include/qwt ^
-D QWT_LIBRARY=%O4W_ROOT% /lib/qwt5.lib ^
2012-04-19 07:18:38 +02:00
-D ZLIB_INCLUDE_DIR=%O4W_ROOT% /include ^
-D ZLIB_LIBRARY=%O4W_ROOT% /lib/zlib.lib ^
2009-08-22 15:32:29 +00:00
-D CMAKE_INSTALL_PREFIX=%O4W_ROOT% /apps/%PACKAGENAME% ^
2009-08-20 15:31:45 +00:00
-D CMAKE_CXX_FLAGS_RELWITHDEBINFO=" /MD /ZI /Od /D NDEBUG " ^
2010-08-21 14:53:50 +00:00
-D FCGI_INCLUDE_DIR=%O4W_ROOT% /include ^
-D FCGI_LIBRARY=%O4W_ROOT% /lib/libfcgi.lib ^
2009-08-18 11:59:43 +00:00
%SRCDIR% >> %LOG% 2 >& 1
2009-07-29 08:59:18 +00:00
if errorlevel 1 goto error
2009-08-12 10:28:40 +00:00
REM bail out if python or grass was not found
grep -Eq " ^ (Python not being built|Could not find GRASS) " %LOG%
if not errorlevel 1 goto error
2009-08-10 16:08:11 +00:00
2009-07-29 08:59:18 +00:00
: skipcmake
echo ZERO_CHECK: %DATE% %TIME% >> %LOG% 2 >& 1
2009-08-18 11:59:43 +00:00
%DEVENV% qgis%VERSION% .sln /Project ZERO_CHECK /Build %BUILDCONF% /Out %LOG% >> %LOG% 2 >& 1
2012-06-16 13:10:25 +02:00
if errorlevel 1 goto error
2009-07-29 08:59:18 +00:00
echo ALL_BUILD: %DATE% %TIME% >> %LOG% 2 >& 1
2009-08-18 11:59:43 +00:00
%DEVENV% qgis%VERSION% .sln /Project ALL_BUILD /Build %BUILDCONF% /Out %LOG% >> %LOG% 2 >& 1
2012-06-16 13:10:25 +02:00
if errorlevel 1 goto error
2009-07-29 08:59:18 +00:00
echo INSTALL: %DATE% %TIME% >> %LOG% 2 >& 1
2009-08-18 11:59:43 +00:00
%DEVENV% qgis%VERSION% .sln /Project INSTALL /Build %BUILDCONF% /Out %LOG% >> %LOG% 2 >& 1
2009-07-29 08:59:18 +00:00
if errorlevel 1 goto error
echo PACKAGE: %DATE% %TIME% >> %LOG% 2 >& 1
cd ..
2011-04-28 20:54:43 +00:00
sed -e 's/@package@/%PACKAGENAME% /g' -e 's/@version@/%VERSION% /g' -e 's/@grassversion@/%GRASS_VERSION% /g' postinstall.bat > %OSGEO4W_ROOT% \etc\postinstall\%PACKAGENAME% .bat
sed -e 's/@package@/%PACKAGENAME% /g' -e 's/@version@/%VERSION% /g' -e 's/@grassversion@/%GRASS_VERSION% /g' preremove.bat > %OSGEO4W_ROOT% \etc\preremove\%PACKAGENAME% .bat
sed -e 's/@package@/%PACKAGENAME% /g' -e 's/@version@/%VERSION% /g' -e 's/@grassversion@/%GRASS_VERSION% /g' qgis.bat.tmpl > %OSGEO4W_ROOT% \bin\%PACKAGENAME% .bat.tmpl
2011-05-23 18:35:54 +02:00
sed -e 's/@package@/%PACKAGENAME% /g' -e 's/@version@/%VERSION% /g' -e 's/@grassversion@/%GRASS_VERSION% /g' browser.bat.tmpl > %OSGEO4W_ROOT% \bin\%PACKAGENAME% -browser.bat.tmpl
2011-04-28 20:54:43 +00:00
sed -e 's/@package@/%PACKAGENAME% /g' -e 's/@version@/%VERSION% /g' -e 's/@grassversion@/%GRASS_VERSION% /g' qgis.reg.tmpl > %OSGEO4W_ROOT% \apps\%PACKAGENAME% \bin\qgis.reg.tmpl
2009-07-29 08:59:18 +00:00
2010-01-20 18:24:59 +00:00
REM sed -e 's/%OSGEO4W_ROOT:\=\\\\\\\\%/@osgeo4w@/' %OSGEO4W_ROOT%\apps\%PACKAGENAME%\python\qgis\qgisconfig.py >%OSGEO4W_ROOT%\apps\%PACKAGENAME%\python\qgis\qgisconfig.py.tmpl
REM if errorlevel 1 goto error
2009-08-05 08:15:05 +00:00
2010-01-20 18:24:59 +00:00
REM del %OSGEO4W_ROOT%\apps\%PACKAGENAME%\python\qgis\qgisconfig.py
2009-08-05 08:15:05 +00:00
touch exclude
2009-08-22 15:32:29 +00:00
tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME% -%VERSION% -%PACKAGE% .tar.bz2 ^
2009-08-04 17:59:34 +00:00
--exclude-from exclude ^
2010-11-17 21:05:02 +00:00
--exclude " *.pyc " ^
2010-08-11 19:03:55 +00:00
--exclude " apps/ %PACKAGENAME% /grass " ^
--exclude " apps/ %PACKAGENAME% /bin/qgisgrass.dll " ^
--exclude " apps/ %PACKAGENAME% /plugins/grassrasterprovider.dll " ^
--exclude " apps/ %PACKAGENAME% /plugins/grassplugin.dll " ^
--exclude " apps/ %PACKAGENAME% /plugins/grassprovider.dll " ^
2011-07-10 13:36:29 +02:00
--exclude " apps/ %PACKAGENAME% /plugins/globeplugin.dll " ^
2009-08-22 15:32:29 +00:00
apps/%PACKAGENAME% ^
bin/%PACKAGENAME% .bat.tmpl ^
2011-05-25 20:28:03 +02:00
bin/%PACKAGENAME% -browser.bat.tmpl ^
2009-08-22 15:32:29 +00:00
etc/postinstall/%PACKAGENAME% .bat ^
2010-08-11 19:03:55 +00:00
etc/preremove/%PACKAGENAME% .bat ^
>> %LOG% 2 >& 1
if errorlevel 1 goto error
2010-11-17 21:05:02 +00:00
tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME% -grass-plugin-%VERSION% -%PACKAGE% .tar.bz2 ^
2010-08-11 19:03:55 +00:00
--exclude-from exclude ^
2010-11-17 22:03:14 +00:00
--exclude " *.pyc " ^
2010-08-11 19:03:55 +00:00
" apps/ %PACKAGENAME% /themes/classic/grass " ^
" apps/ %PACKAGENAME% /themes/default/grass " ^
" apps/ %PACKAGENAME% /themes/gis/grass " ^
" apps/ %PACKAGENAME% /grass " ^
" apps/ %PACKAGENAME% /bin/qgisgrass.dll " ^
" apps/ %PACKAGENAME% /plugins/grassrasterprovider.dll " ^
" apps/ %PACKAGENAME% /plugins/grassplugin.dll " ^
" apps/ %PACKAGENAME% /plugins/grassprovider.dll " ^
>> %LOG% 2 >& 1
2009-07-29 08:59:18 +00:00
if errorlevel 1 goto error
2011-07-10 13:36:29 +02:00
tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME% -globe-plugin-%VERSION% -%PACKAGE% .tar.bz2 ^
" apps/ %PACKAGENAME% /globe " ^
" apps/ %PACKAGENAME% /plugins/globeplugin.dll " ^
>> %LOG% 2 >& 1
if errorlevel 1 goto error
2009-07-29 08:59:18 +00:00
goto end
: error
echo BUILD ERROR %ERRORLEVEL% : %DATE% %TIME%
echo BUILD ERROR %ERRORLEVEL% : %DATE% %TIME% >> %LOG% 2 >& 1
2009-08-22 15:32:29 +00:00
if exist %PACKAGENAME% -%VERSION% -%PACKAGE% .tar.bz2 del %PACKAGENAME% -%VERSION% -%PACKAGE% .tar.bz2
2010-08-11 19:03:55 +00:00
if exist %PACKAGENAME% -grass-plugin-%VERSION% -%PACKAGE% .tar.bz2 del %PACKAGENAME% -grass-plugin-%VERSION% -%PACKAGE% .tar.bz2
2009-07-29 08:59:18 +00:00
: end
echo FINISHED: %DATE% %TIME% >> %LOG% 2 >& 1