|
| 1 | +@echo off |
| 2 | +set GRASS_VERSION=6.4.0 |
| 3 | +set SVNVERSION=c:/cygwin/bin/svnversion |
| 4 | + |
| 5 | +set BUILDDIR=%CD%\build |
| 6 | +REM set BUILDDIR=%TEMP%\qgis_unstable |
| 7 | +set LOG=%BUILDDIR%\build.log |
| 8 | + |
| 9 | +if not exist "%BUILDDIR%" mkdir %BUILDDIR% |
| 10 | +if not exist "%BUILDDIR%" goto error |
| 11 | + |
| 12 | +set VERSION=%1 |
| 13 | +set PACKAGE=%2 |
| 14 | +set PACKAGENAME=%3 |
| 15 | +if "%VERSION%"=="" goto error |
| 16 | +if "%PACKAGE%"=="" goto error |
| 17 | +if "%PACKAGENAME%"=="" set PACKAGENAME=qgis-dev |
| 18 | + |
| 19 | +path %SYSTEMROOT%\system32;%SYSTEMROOT%;%SYSTEMROOT%\System32\Wbem;%PROGRAMFILES%\CMake 2.8\bin |
| 20 | +set PYTHONPATH= |
| 21 | + |
| 22 | +set VS90COMNTOOLS=%PROGRAMFILES%\Microsoft Visual Studio 9.0\Common7\Tools\ |
| 23 | +call "%PROGRAMFILES%\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86 |
| 24 | + |
| 25 | +if "%OSGEO4W_ROOT%"=="" set OSGEO4W_ROOT=%PROGRAMFILES%\OSGeo4W |
| 26 | +if not exist "%OSGEO4W_ROOT%\bin\o4w_env.bat" goto error |
| 27 | + |
| 28 | +call "%OSGEO4W_ROOT%\bin\o4w_env.bat" |
| 29 | + |
| 30 | +set O4W_ROOT=%OSGEO4W_ROOT:\=/% |
| 31 | +set LIB_DIR=%O4W_ROOT% |
| 32 | + |
| 33 | +set DEVENV= |
| 34 | +if exist "%DevEnvDir%\vcexpress.exe" set DEVENV=vcexpress |
| 35 | +if exist "%DevEnvDir%\devenv.exe" set DEVENV=devenv |
| 36 | +if "%DEVENV%"=="" goto error |
| 37 | + |
| 38 | +PROMPT qgis%VERSION%$g |
| 39 | + |
| 40 | +set BUILDCONF=RelWithDebInfo |
| 41 | +REM set BUILDCONF=Release |
| 42 | + |
| 43 | + |
| 44 | +cd ..\.. |
| 45 | +set SRCDIR=%CD% |
| 46 | + |
| 47 | +if "%BUILDDIR:~1,1%"==":" %BUILDDIR:~0,2% |
| 48 | +cd %BUILDDIR% |
| 49 | + |
| 50 | +if not exist build.log goto build |
| 51 | + |
| 52 | +REM |
| 53 | +REM try renaming the logfile to see if it's locked |
| 54 | +REM |
| 55 | + |
| 56 | +if exist build.tmp del build.tmp |
| 57 | +if exist build.tmp goto error |
| 58 | + |
| 59 | +ren build.log build.tmp |
| 60 | +if exist build.log goto locked |
| 61 | +if not exist build.tmp goto locked |
| 62 | + |
| 63 | +ren build.tmp build.log |
| 64 | +if exist build.tmp goto locked |
| 65 | +if not exist build.log goto locked |
| 66 | + |
| 67 | +goto build |
| 68 | + |
| 69 | +:locked |
| 70 | +echo Logfile locked |
| 71 | +if exist build.tmp del build.tmp |
| 72 | +goto error |
| 73 | + |
| 74 | +:build |
| 75 | +echo Logging to %LOG% |
| 76 | +echo BEGIN: %DATE% %TIME%>>%LOG% 2>&1 |
| 77 | +if errorlevel 1 goto error |
| 78 | + |
| 79 | +set >buildenv.log |
| 80 | + |
| 81 | +if exist CMakeCache.txt goto skipcmake |
| 82 | + |
| 83 | +echo CMAKE: %DATE% %TIME%>>%LOG% 2>&1 |
| 84 | +if errorlevel 1 goto error |
| 85 | + |
| 86 | +set LIB=%LIB%;%OSGEO4W_ROOT%\lib |
| 87 | +set INCLUDE=%INCLUDE%;%OSGEO4W_ROOT%\include |
| 88 | + |
| 89 | +cmake -G "Visual Studio 9 2008" ^ |
| 90 | + -D PEDANTIC=TRUE ^ |
| 91 | + -D WITH_SPATIALITE=TRUE ^ |
| 92 | + -D WITH_MAPSERVER=TRUE ^ |
| 93 | + -D WITH_INTERNAL_SPATIALITE=TRUE ^ |
| 94 | + -D CMAKE_BUILD_TYPE=%BUILDCONF% ^ |
| 95 | + -D CMAKE_CONFIGURATION_TYPES=%BUILDCONF% ^ |
| 96 | + -D GEOS_LIBRARY=%OSGEO4W_ROOT%/lib/geos_c_i.lib ^ |
| 97 | + -D PYTHON_EXECUTABLE=%O4W_ROOT%/bin/python.exe ^ |
| 98 | + -D PYTHON_INCLUDE_PATH=%O4W_ROOT%/apps/Python25/include ^ |
| 99 | + -D PYTHON_LIBRARY=%O4W_ROOT%/apps/Python25/libs/python25.lib ^ |
| 100 | + -D SIP_BINARY_PATH=%O4W_ROOT%/apps/Python25/sip.exe ^ |
| 101 | + -D GRASS_PREFIX=%O4W_ROOT%/apps/grass/grass-%GRASS_VERSION% ^ |
| 102 | + -D QT_BINARY_DIR=%O4W_ROOT%/bin ^ |
| 103 | + -D QT_LIBRARY_DIR=%O4W_ROOT%/lib ^ |
| 104 | + -D QT_HEADERS_DIR=%O4W_ROOT%/include/qt4 ^ |
| 105 | + -D QT_ZLIB_LIBRARY=%O4W_ROOT%/lib/zlib.lib ^ |
| 106 | + -D QT_PNG_LIBRARY=%O4W_ROOT%/lib/libpng13.lib ^ |
| 107 | + -D QWT_INCLUDE_DIR=%O4W_ROOT%/include/qwt ^ |
| 108 | + -D QWT_LIBRARY=%O4W_ROOT%/lib/qwt5.lib ^ |
| 109 | + -D CMAKE_INSTALL_PREFIX=%O4W_ROOT%/apps/%PACKAGENAME% ^ |
| 110 | + -D CMAKE_CXX_FLAGS_RELWITHDEBINFO="/MD /ZI /Od /D NDEBUG" ^ |
| 111 | + -D FCGI_INCLUDE_DIR=%O4W_ROOT%/include ^ |
| 112 | + -D FCGI_LIBRARY=%O4W_ROOT%/lib/libfcgi.lib ^ |
| 113 | + -D SVNVERSION="%SVNVERSION%" ^ |
| 114 | + %SRCDIR%>>%LOG% 2>&1 |
| 115 | +if errorlevel 1 goto error |
| 116 | + |
| 117 | +REM bail out if python or grass was not found |
| 118 | +grep -Eq "^(Python not being built|Could not find GRASS)" %LOG% |
| 119 | +if not errorlevel 1 goto error |
| 120 | + |
| 121 | +:skipcmake |
| 122 | + |
| 123 | +echo ZERO_CHECK: %DATE% %TIME%>>%LOG% 2>&1 |
| 124 | +%DEVENV% qgis%VERSION%.sln /Project ZERO_CHECK /Build %BUILDCONF% /Out %LOG%>>%LOG% 2>&1 |
| 125 | +if errorlevel 1 goto error |
| 126 | + |
| 127 | +echo ALL_BUILD: %DATE% %TIME%>>%LOG% 2>&1 |
| 128 | +%DEVENV% qgis%VERSION%.sln /Project ALL_BUILD /Build %BUILDCONF% /Out %LOG%>>%LOG% 2>&1 |
| 129 | +if errorlevel 1 goto error |
| 130 | + |
| 131 | +echo INSTALL: %DATE% %TIME%>>%LOG% 2>&1 |
| 132 | +%DEVENV% qgis%VERSION%.sln /Project INSTALL /Build %BUILDCONF% /Out %LOG%>>%LOG% 2>&1 |
| 133 | +if errorlevel 1 goto error |
| 134 | + |
| 135 | +echo PACKAGE: %DATE% %TIME%>>%LOG% 2>&1 |
| 136 | + |
| 137 | +cd .. |
| 138 | +sed -e 's/@package@/%PACKAGENAME%/g' -e 's/@version@/%VERSION%/g' postinstall.bat >%OSGEO4W_ROOT%\etc\postinstall\%PACKAGENAME%.bat |
| 139 | +sed -e 's/@package@/%PACKAGENAME%/g' -e 's/@version@/%VERSION%/g' preremove.bat >%OSGEO4W_ROOT%\etc\preremove\%PACKAGENAME%.bat |
| 140 | +sed -e 's/@package@/%PACKAGENAME%/g' -e 's/@version@/%VERSION%/g' qgis.bat.tmpl >%OSGEO4W_ROOT%\bin\%PACKAGENAME%.bat.tmpl |
| 141 | +sed -e 's/@package@/%PACKAGENAME%/g' -e 's/@version@/%VERSION%/g' qgis.reg.tmpl >%OSGEO4W_ROOT%\apps\%PACKAGENAME%\bin\qgis.reg.tmpl |
| 142 | + |
| 143 | +REM sed -e 's/%OSGEO4W_ROOT:\=\\\\\\\\%/@osgeo4w@/' %OSGEO4W_ROOT%\apps\%PACKAGENAME%\python\qgis\qgisconfig.py >%OSGEO4W_ROOT%\apps\%PACKAGENAME%\python\qgis\qgisconfig.py.tmpl |
| 144 | +REM if errorlevel 1 goto error |
| 145 | + |
| 146 | +REM del %OSGEO4W_ROOT%\apps\%PACKAGENAME%\python\qgis\qgisconfig.py |
| 147 | + |
| 148 | +touch exclude |
| 149 | + |
| 150 | +tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME%-%VERSION%-%PACKAGE%.tar.bz2 ^ |
| 151 | + --exclude-from exclude ^ |
| 152 | + apps/%PACKAGENAME% ^ |
| 153 | + bin/%PACKAGENAME%.bat.tmpl ^ |
| 154 | + etc/postinstall/%PACKAGENAME%.bat ^ |
| 155 | + etc/preremove/%PACKAGENAME%.bat ^ |
| 156 | + >>%LOG% 2>&1 |
| 157 | +if errorlevel 1 goto error |
| 158 | + |
| 159 | +REM tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME%-grass-%VERSION%-%PACKAGE%.tar.bz2 ^ |
| 160 | +REM --exclude-from exclude ^ |
| 161 | +REM "apps/%PACKAGENAME%/themes/classic/grass" ^ |
| 162 | +REM "apps/%PACKAGENAME%/themes/default/grass" ^ |
| 163 | +REM "apps/%PACKAGENAME%/themes/gis/grass" ^ |
| 164 | +REM "apps/%PACKAGENAME%/grass" ^ |
| 165 | +REM "apps/%PACKAGENAME%/bin/qgisgrass.dll" ^ |
| 166 | +REM "apps/%PACKAGENAME%/plugins/grassrasterprovider.dll" ^ |
| 167 | +REM "apps/%PACKAGENAME%/plugins/grassplugin.dll" ^ |
| 168 | +REM "apps/%PACKAGENAME%/plugins/grassprovider.dll" ^ |
| 169 | +REM >>%LOG% 2>&1 |
| 170 | +REM if errorlevel 1 goto error |
| 171 | + |
| 172 | +goto end |
| 173 | + |
| 174 | +:error |
| 175 | +echo BUILD ERROR %ERRORLEVEL%: %DATE% %TIME% |
| 176 | +echo BUILD ERROR %ERRORLEVEL%: %DATE% %TIME%>>%LOG% 2>&1 |
| 177 | +if exist %PACKAGENAME%-%VERSION%-%PACKAGE%.tar.bz2 del %PACKAGENAME%-%VERSION%-%PACKAGE%.tar.bz2 |
| 178 | +REM if exist %PACKAGENAME%-grass-plugin-%VERSION%-%PACKAGE%.tar.bz2 del %PACKAGENAME%-grass-plugin-%VERSION%-%PACKAGE%.tar.bz2 |
| 179 | + |
| 180 | +:end |
| 181 | +echo FINISHED: %DATE% %TIME% >>%LOG% 2>&1 |
0 commit comments