-
-
Notifications
You must be signed in to change notification settings - Fork 3k
/
package.cmd
480 lines (397 loc) · 20 KB
/
package.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
@echo off
REM ***************************************************************************
REM package.cmd
REM ---------------------
REM begin : July 2009
REM copyright : (C) 2009 by Juergen E. Fischer
REM email : jef at norbit dot de
REM ***************************************************************************
REM * *
REM * This program is free software; you can redistribute it and/or modify *
REM * it under the terms of the GNU General Public License as published by *
REM * the Free Software Foundation; either version 2 of the License, or *
REM * (at your option) any later version. *
REM * *
REM ***************************************************************************
setlocal enabledelayedexpansion
set VERSION=%1
set PACKAGE=%2
set PACKAGENAME=%3
set ARCH=%4
set SHA=%5
set SITE=%6
if "%VERSION%"=="" goto usage
if "%PACKAGE%"=="" goto usage
if "%PACKAGENAME%"=="" goto usage
if "%ARCH%"=="" goto usage
if not "%SHA%"=="" set SHA=-%SHA%
if "%SITE%"=="" set SITE=qgis.org
set BUILDDIR=%CD%\build-%PACKAGENAME%-%ARCH%
if "%OSGEO4W_ROOT%"=="" (
if "%ARCH%"=="x86" (
set OSGEO4W_ROOT=C:\OSGeo4W
) else (
set OSGEO4W_ROOT=C:\OSGeo4W64
)
)
if not exist "%BUILDDIR%" mkdir %BUILDDIR%
if not exist "%BUILDDIR%" (echo could not create build directory %BUILDDIR% & goto error)
if not exist "%OSGEO4W_ROOT%\bin\o4w_env.bat" (echo o4w_env.bat not found & goto error)
call "%OSGEO4W_ROOT%\bin\o4w_env.bat"
set O4W_ROOT=%OSGEO4W_ROOT:\=/%
set LIB_DIR=%O4W_ROOT%
if not "%PROGRAMFILES(X86)%"=="" set PF86=%PROGRAMFILES(X86)%
if "%PF86%"=="" set PF86=%PROGRAMFILES%
if "%PF86%"=="" (echo PROGRAMFILES not set & goto error)
if "%ARCH%"=="x86" goto cmake_x86
goto cmake_x86_64
:cmake_x86
set GRASS6_VERSION=6.4.4
call "%PF86%\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86
if exist "c:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" call "c:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /x86 /Release
path %path%;%PF86%\Microsoft Visual Studio 10.0\VC\bin
set CMAKE_COMPILER_PATH=%PF86%\Microsoft Visual Studio 10.0\VC\bin
set CMAKE_OPT=^
-D SIP_BINARY_PATH=%O4W_ROOT%/apps/Python27/sip.exe ^
-D QWT_LIBRARY=%O4W_ROOT%/lib/qwt.lib
goto cmake
:cmake_x86_64
set GRASS6_VERSION=6.4.3
call "%PF86%\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" amd64
if exist "c:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" call "c:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /x64 /Release
path %path%;%PF86%\Microsoft Visual Studio 10.0\VC\bin
set SETUPAPI_LIBRARY=%PF86%\Microsoft SDKs\Windows\v7.0A\Lib\x64\SetupAPI.Lib
if not exist "%SETUPAPI_LIBRARY%" set SETUPAPI_LIBRARY=%PROGRAMFILES%\Microsoft SDKs\Windows\v7.1\Lib\x64\SetupAPI.lib
if not exist "%SETUPAPI_LIBRARY%" (echo SETUPAPI_LIBRARY not found & goto error)
set CMAKE_OPT=^
-D SPATIALINDEX_LIBRARY=%O4W_ROOT%/lib/spatialindex-64.lib ^
-D SIP_BINARY_PATH=%O4W_ROOT%/bin/sip.exe ^
-D QWT_LIBRARY=%O4W_ROOT%/lib/qwt5.lib ^
-D SETUPAPI_LIBRARY="%SETUPAPI_LIBRARY%" ^
-D CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS=TRUE
:cmake
for /f "usebackq tokens=1" %%a in (`%OSGEO4W_ROOT%\bin\grass70 --config path`) do set GRASS70_PATH=%%a
for %%i in ("%GRASS70_PATH%") do set GRASS70_VERSION=%%~nxi
set GRASS70_VERSION=%GRASS70_VERSION:grass-=%
set GRASS_VERSIONS=%GRASS6_VERSION% %GRASS70_VERSION%
set PYTHONPATH=
path %PF86%\CMake\bin;%PATH%;c:\cygwin\bin
PROMPT qgis%VERSION%$g
set BUILDCONF=Release
cd ..\..
set SRCDIR=%CD%
if "%BUILDDIR:~1,1%"==":" %BUILDDIR:~0,2%
cd %BUILDDIR%
set PKGDIR=%OSGEO4W_ROOT%\apps\%PACKAGENAME%
if exist repackage goto package
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 (echo could not remove 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 BEGIN: %DATE% %TIME%
set >buildenv.log
if exist qgsversion.h del qgsversion.h
if exist CMakeCache.txt if exist skipcmake goto skipcmake
touch %SRCDIR%\CMakeLists.txt
echo CMAKE: %DATE% %TIME%
if errorlevel 1 goto error
set LIB=%LIB%;%OSGEO4W_ROOT%\lib
set INCLUDE=%INCLUDE%;%OSGEO4W_ROOT%\include
cmake -G Ninja ^
-D BUILDNAME="%PACKAGENAME%-%VERSION%%SHA%-Release-VC10-%ARCH%" ^
-D SITE="%SITE%" ^
-D PEDANTIC=TRUE ^
-D WITH_QSPATIALITE=TRUE ^
-D WITH_SERVER=TRUE ^
-D SERVER_SKIP_ECW=TRUE ^
-D WITH_GRASS=TRUE ^
-D WITH_GRASS6=TRUE ^
-D WITH_GRASS7=TRUE ^
-D GRASS_PREFIX=%O4W_ROOT%/apps/grass/grass-%GRASS6_VERSION% ^
-D GRASS_PREFIX7=%GRASS70_PATH:\=/% ^
-D WITH_GLOBE=TRUE ^
-D WITH_TOUCH=TRUE ^
-D WITH_ORACLE=TRUE ^
-D WITH_CUSTOM_WIDGETS=TRUE ^
-D CMAKE_CXX_FLAGS_RELEASE="/MD /MP /O2 /Ob2 /D NDEBUG" ^
-D CMAKE_BUILD_TYPE=%BUILDCONF% ^
-D CMAKE_CONFIGURATION_TYPES=%BUILDCONF% ^
-D GEOS_LIBRARY=%O4W_ROOT%/lib/geos_c.lib ^
-D SQLITE3_LIBRARY=%O4W_ROOT%/lib/sqlite3_i.lib ^
-D SPATIALITE_LIBRARY=%O4W_ROOT%/lib/spatialite_i.lib ^
-D PYTHON_EXECUTABLE=%O4W_ROOT%/bin/python.exe ^
-D PYTHON_INCLUDE_PATH=%O4W_ROOT%/apps/Python27/include ^
-D PYTHON_LIBRARY=%O4W_ROOT%/apps/Python27/libs/python27.lib ^
-D QT_BINARY_DIR=%O4W_ROOT%/bin ^
-D QT_LIBRARY_DIR=%O4W_ROOT%/lib ^
-D QT_HEADERS_DIR=%O4W_ROOT%/include/qt4 ^
-D QWT_INCLUDE_DIR=%O4W_ROOT%/include/qwt ^
-D CMAKE_INSTALL_PREFIX=%O4W_ROOT%/apps/%PACKAGENAME% ^
-D FCGI_INCLUDE_DIR=%O4W_ROOT%/include ^
-D FCGI_LIBRARY=%O4W_ROOT%/lib/libfcgi.lib ^
-D WITH_INTERNAL_JINJA2=FALSE ^
-D WITH_INTERNAL_MARKUPSAFE=FALSE ^
-D WITH_INTERNAL_PYGMENTS=FALSE ^
-D WITH_INTERNAL_REQUESTS=FALSE ^
-D WITH_INTERNAL_DATEUTIL=FALSE ^
-D WITH_INTERNAL_PYTZ=FALSE ^
-D WITH_INTERNAL_SIX=FALSE ^
-D WITH_INTERNAL_FUTURE=FALSE ^
%CMAKE_OPT% ^
%SRCDIR:\=/%
if errorlevel 1 (echo cmake failed & goto error)
:skipcmake
if exist noclean (echo skip clean & goto skipclean)
echo CLEAN: %DATE% %TIME%
cmake --build %BUILDDIR% --target clean --config %BUILDCONF%
if errorlevel 1 (echo clean failed & goto error)
:skipclean
echo ALL_BUILD: %DATE% %TIME%
cmake --build %BUILDDIR% --config %BUILDCONF%
if errorlevel 1 cmake --build %BUILDDIR% --config %BUILDCONF%
if errorlevel 1 (echo build failed twice & goto error)
if exist ..\skiptests goto skiptests
echo RUN_TESTS: %DATE% %TIME%
set oldpath=%PATH%
for %%g IN (%GRASS_VERSIONS%) do (
set path=!path!;%OSGEO4W_ROOT%\apps\grass\grass-%%g\lib
set GISBASE=%OSGEO4W_ROOT%\apps\grass\grass-%%g
)
PATH %path%;%BUILDDIR%\output\plugins\%BUILDCONF%
cmake --build %BUILDDIR% --target Experimental --config %BUILDCONF%
if errorlevel 1 echo TESTS WERE NOT SUCCESSFUL.
PATH %oldpath%
:skiptests
:package
if exist "%PKGDIR%" (
echo REMOVE: %DATE% %TIME%
rmdir /s /q "%PKGDIR%"
)
echo INSTALL: %DATE% %TIME%
cmake --build %BUILDDIR% --target install --config %BUILDCONF%
if errorlevel 1 (echo INSTALL failed & goto error)
echo PACKAGE: %DATE% %TIME%
cd ..
sed -e 's/@package@/%PACKAGENAME%/g' -e 's/@version@/%VERSION%/g' postinstall-common.bat >%OSGEO4W_ROOT%\etc\postinstall\%PACKAGENAME%-common.bat
if errorlevel 1 (echo creation of common postinstall failed & goto error)
sed -e 's/@package@/%PACKAGENAME%/g' -e 's/@version@/%VERSION%/g' postinstall-desktop.bat >%OSGEO4W_ROOT%\etc\postinstall\%PACKAGENAME%.bat
if errorlevel 1 (echo creation of desktop postinstall failed & goto error)
sed -e 's/@package@/%PACKAGENAME%/g' -e 's/@version@/%VERSION%/g' preremove-desktop.bat >%OSGEO4W_ROOT%\etc\preremove\%PACKAGENAME%.bat
if errorlevel 1 (echo creation of desktop preremove failed & goto error)
sed -e 's/@package@/%PACKAGENAME%/g' -e 's/@version@/%VERSION%/g' qgis.bat.tmpl >%OSGEO4W_ROOT%\bin\%PACKAGENAME%.bat.tmpl
if errorlevel 1 (echo creation of desktop template failed & goto error)
sed -e 's/@package@/%PACKAGENAME%/g' -e 's/@version@/%VERSION%/g' browser.bat.tmpl >%OSGEO4W_ROOT%\bin\%PACKAGENAME%-browser.bat.tmpl
if errorlevel 1 (echo creation of browser template & goto error)
sed -e 's/@package@/%PACKAGENAME%/g' -e 's/@version@/%VERSION%/g' designer.bat.tmpl >%OSGEO4W_ROOT%\bin\%PACKAGENAME%-designer.bat.tmpl
if errorlevel 1 (echo creation of designer template failed & goto error)
sed -e 's/@package@/%PACKAGENAME%/g' -e 's/@version@/%VERSION%/g' python.bat.tmpl >%OSGEO4W_ROOT%\bin\python-%PACKAGENAME%.bat.tmpl
if errorlevel 1 (echo creation of python wrapper template failed & goto error)
sed -e 's/@package@/%PACKAGENAME%/g' -e 's/@version@/%VERSION%/g' qgis.reg.tmpl >%PKGDIR%\bin\qgis.reg.tmpl
if errorlevel 1 (echo creation of registry template & goto error)
sed -e 's/@package@/%PACKAGENAME%/g' -e 's/@version@/%VERSION%/g' postinstall-server.bat >%OSGEO4W_ROOT%\etc\postinstall\%PACKAGENAME%-server.bat
if errorlevel 1 (echo creation of server postinstall failed & goto error)
sed -e 's/@package@/%PACKAGENAME%/g' -e 's/@version@/%VERSION%/g' preremove-server.bat >%OSGEO4W_ROOT%\etc\preremove\%PACKAGENAME%-server.bat
if errorlevel 1 (echo creation of server preremove failed & goto error)
if not exist %OSGEO4W_ROOT%\httpd.d mkdir %OSGEO4W_ROOT%\httpd.d
sed -e 's/@package@/%PACKAGENAME%/g' -e 's/@version@/%VERSION%/g' httpd.conf.tmpl >%OSGEO4W_ROOT%\httpd.d\httpd_%PACKAGENAME%.conf.tmpl
if errorlevel 1 (echo creation of httpd.conf template failed & goto error)
set packages="" "-common" "-server" "-devel" "-globe-plugin" "-oracle-provider" "-grass-plugin-common"
for %%g IN (%GRASS_VERSIONS%) do (
for /F "delims=." %%i in ("%%g") do set v=%%i
set w=!v!
if !v!==6 set w=
sed -e 's/@package@/%PACKAGENAME%/g' -e 's/@version@/%VERSION%/g' -e 's/@grassversion@/%%g/g' -e 's/@grassmajor@/!v!/g' postinstall-grass.bat >%OSGEO4W_ROOT%\etc\postinstall\%PACKAGENAME%-grass-plugin!w!.bat
if errorlevel 1 (echo creation of grass desktop postinstall failed & goto error)
sed -e 's/@package@/%PACKAGENAME%/g' -e 's/@version@/%VERSION%/g' -e 's/@grassversion@/%%g/g' -e 's/@grassmajor@/!v!/g' preremove-grass.bat >%OSGEO4W_ROOT%\etc\preremove\%PACKAGENAME%-grass-plugin!w!.bat
if errorlevel 1 (echo creation of grass desktop preremove failed & goto error)
sed -e 's/@package@/%PACKAGENAME%/g' -e 's/@version@/%VERSION%/g' -e 's/@grassversion@/%%g/g' -e 's/@grassmajor@/!v!/g' qgis-grass.bat.tmpl >%OSGEO4W_ROOT%\bin\%PACKAGENAME%-grass!v!.bat.tmpl
if errorlevel 1 (echo creation of grass desktop template failed & goto error)
sed -e 's/@package@/%PACKAGENAME%/g' -e 's/@version@/%VERSION%/g' -e 's/@grassversion@/%%g/g' -e 's/@grassmajor@/!v!/g' browser-grass.bat.tmpl >%OSGEO4W_ROOT%\bin\%PACKAGENAME%-browser-grass!v!.bat.tmpl
if errorlevel 1 (echo creation of grass browser template & goto error)
set packages=!packages! "-grass-plugin!w!"
)
touch exclude
for %%i in (%packages%) do (
if not exist %ARCH%\release\qgis\%PACKAGENAME%%%i mkdir %ARCH%\release\qgis\%PACKAGENAME%%%i
)
tar -C %OSGEO4W_ROOT% -cjf %ARCH%/release/qgis/%PACKAGENAME%-common/%PACKAGENAME%-common-%VERSION%-%PACKAGE%.tar.bz2 ^
--exclude-from exclude ^
--exclude "*.pyc" ^
"apps/%PACKAGENAME%/bin/qgispython.dll" ^
"apps/%PACKAGENAME%/bin/qgis_analysis.dll" ^
"apps/%PACKAGENAME%/bin/qgis_core.dll" ^
"apps/%PACKAGENAME%/bin/qgis_gui.dll" ^
"apps/%PACKAGENAME%/doc/" ^
"apps/%PACKAGENAME%/plugins/basicauthmethod.dll" ^
"apps/%PACKAGENAME%/plugins/delimitedtextprovider.dll" ^
"apps/%PACKAGENAME%/plugins/gdalprovider.dll" ^
"apps/%PACKAGENAME%/plugins/gpxprovider.dll" ^
"apps/%PACKAGENAME%/plugins/identcertauthmethod.dll" ^
"apps/%PACKAGENAME%/plugins/memoryprovider.dll" ^
"apps/%PACKAGENAME%/plugins/mssqlprovider.dll" ^
"apps/%PACKAGENAME%/plugins/db2provider.dll" ^
"apps/%PACKAGENAME%/plugins/ogrprovider.dll" ^
"apps/%PACKAGENAME%/plugins/owsprovider.dll" ^
"apps/%PACKAGENAME%/plugins/pkcs12authmethod.dll" ^
"apps/%PACKAGENAME%/plugins/pkipathsauthmethod.dll" ^
"apps/%PACKAGENAME%/plugins/postgresprovider.dll" ^
"apps/%PACKAGENAME%/plugins/spatialiteprovider.dll" ^
"apps/%PACKAGENAME%/plugins/virtuallayerprovider.dll" ^
"apps/%PACKAGENAME%/plugins/wcsprovider.dll" ^
"apps/%PACKAGENAME%/plugins/wfsprovider.dll" ^
"apps/%PACKAGENAME%/plugins/wmsprovider.dll" ^
"apps/%PACKAGENAME%/plugins/arcgismapserverprovider.dll" ^
"apps/%PACKAGENAME%/plugins/arcgisfeatureserverprovider.dll" ^
"apps/%PACKAGENAME%/resources/qgis.db" ^
"apps/%PACKAGENAME%/resources/spatialite.db" ^
"apps/%PACKAGENAME%/resources/srs.db" ^
"apps/%PACKAGENAME%/resources/symbology-ng-style.xml" ^
"apps/%PACKAGENAME%/resources/cpt-city-qgis-min/" ^
"apps/%PACKAGENAME%/svg/" ^
"apps/%PACKAGENAME%/crssync.exe" ^
"etc/postinstall/%PACKAGENAME%-common.bat"
if errorlevel 1 (echo tar common failed & goto error)
tar -C %OSGEO4W_ROOT% -cjf %ARCH%/release/qgis/%PACKAGENAME%-server/%PACKAGENAME%-server-%VERSION%-%PACKAGE%.tar.bz2 ^
--exclude-from exclude ^
--exclude "*.pyc" ^
"apps/%PACKAGENAME%/bin/qgis_mapserv.fcgi.exe" ^
"apps/%PACKAGENAME%/bin/qgis_server.dll" ^
"apps/%PACKAGENAME%/bin/admin.sld" ^
"apps/%PACKAGENAME%/bin/wms_metadata.xml" ^
"apps/%PACKAGENAME%/bin/schemaExtension.xsd" ^
"apps/%PACKAGENAME%/python/qgis/_server.pyd" ^
"apps/%PACKAGENAME%/python/qgis/server/" ^
"httpd.d/httpd_%PACKAGENAME%.conf.tmpl" ^
"etc/postinstall/%PACKAGENAME%-server.bat" ^
"etc/preremove/%PACKAGENAME%-server.bat"
if errorlevel 1 (echo tar server failed & goto error)
move %PKGDIR%\bin\qgis.exe %OSGEO4W_ROOT%\bin\%PACKAGENAME%-bin.exe
if errorlevel 1 (echo move of desktop executable failed & goto error)
move %PKGDIR%\bin\qbrowser.exe %OSGEO4W_ROOT%\bin\%PACKAGENAME%-browser-bin.exe
if errorlevel 1 (echo move of browser executable failed & goto error)
if not exist %PKGDIR%\qtplugins\sqldrivers mkdir %PKGDIR%\qtplugins\sqldrivers
move %OSGEO4W_ROOT%\apps\qt4\plugins\sqldrivers\qsqlocispatial.dll %PKGDIR%\qtplugins\sqldrivers
if errorlevel 1 (echo move of oci sqldriver failed & goto error)
move %OSGEO4W_ROOT%\apps\qt4\plugins\sqldrivers\qsqlspatialite.dll %PKGDIR%\qtplugins\sqldrivers
if errorlevel 1 (echo move of spatialite sqldriver failed & goto error)
if not exist %PKGDIR%\qtplugins\designer mkdir %PKGDIR%\qtplugins\designer
move %OSGEO4W_ROOT%\apps\qt4\plugins\designer\qgis_customwidgets.dll %PKGDIR%\qtplugins\designer
if errorlevel 1 (echo move of customwidgets failed & goto error)
if not exist %PKGDIR%\python\PyQt4\uic\widget-plugins mkdir %PKGDIR%\python\PyQt4\uic\widget-plugins
move %OSGEO4W_ROOT%\apps\Python27\Lib\site-packages\PyQt4\uic\widget-plugins\qgis_customwidgets.py %PKGDIR%\python\PyQt4\uic\widget-plugins
if errorlevel 1 (echo move of customwidgets binding failed & goto error)
if not exist %ARCH%\release\qgis\%PACKAGENAME% mkdir %ARCH%\release\qgis\%PACKAGENAME%
tar -C %OSGEO4W_ROOT% -cjf %ARCH%/release/qgis/%PACKAGENAME%/%PACKAGENAME%-%VERSION%-%PACKAGE%.tar.bz2 ^
--exclude-from exclude ^
--exclude "*.pyc" ^
--exclude "apps/%PACKAGENAME%/python/qgis/_server.pyd" ^
--exclude "apps/%PACKAGENAME%/python/qgis/_server.lib" ^
--exclude "apps/%PACKAGENAME%/python/qgis/server" ^
"bin/%PACKAGENAME%-browser-bin.exe" ^
"bin/%PACKAGENAME%-bin.exe" ^
"bin/python-%PACKAGENAME%.bat.tmpl" ^
"apps/%PACKAGENAME%/bin/qgis_app.dll" ^
"apps/%PACKAGENAME%/bin/qgis.reg.tmpl" ^
"apps/%PACKAGENAME%/i18n/" ^
"apps/%PACKAGENAME%/icons/" ^
"apps/%PACKAGENAME%/images/" ^
"apps/%PACKAGENAME%/plugins/coordinatecaptureplugin.dll" ^
"apps/%PACKAGENAME%/plugins/evis.dll" ^
"apps/%PACKAGENAME%/plugins/georefplugin.dll" ^
"apps/%PACKAGENAME%/plugins/gpsimporterplugin.dll" ^
"apps/%PACKAGENAME%/plugins/offlineeditingplugin.dll" ^
"apps/%PACKAGENAME%/plugins/oracleplugin.dll" ^
"apps/%PACKAGENAME%/plugins/spatialqueryplugin.dll" ^
"apps/%PACKAGENAME%/plugins/topolplugin.dll" ^
"apps/%PACKAGENAME%/plugins/geometrycheckerplugin.dll" ^
"apps/%PACKAGENAME%/qgis_help.exe" ^
"apps/%PACKAGENAME%/qtplugins/sqldrivers/qsqlspatialite.dll" ^
"apps/%PACKAGENAME%/qtplugins/designer/" ^
"apps/%PACKAGENAME%/python/" ^
"apps/%PACKAGENAME%/resources/customization.xml" ^
"apps/%PACKAGENAME%/resources/themes/" ^
"bin/%PACKAGENAME%.bat.tmpl" ^
"bin/%PACKAGENAME%-browser.bat.tmpl" ^
"bin/%PACKAGENAME%-designer.bat.tmpl" ^
"etc/postinstall/%PACKAGENAME%.bat" ^
"etc/preremove/%PACKAGENAME%.bat"
if errorlevel 1 (echo tar desktop failed & goto error)
tar -C %OSGEO4W_ROOT% -cjf %ARCH%/release/qgis/%PACKAGENAME%-grass-plugin-common/%PACKAGENAME%-grass-plugin-common-%VERSION%-%PACKAGE%.tar.bz2 ^
--exclude-from exclude ^
--exclude "*.pyc" ^
--exclude "apps/%PACKAGENAME%/grass/modules/qgis.d.rast6.exe" ^
--exclude "apps/%PACKAGENAME%/grass/modules/qgis.d.rast7.exe" ^
--exclude "apps/%PACKAGENAME%/grass/modules/qgis.g.info6.exe" ^
--exclude "apps/%PACKAGENAME%/grass/modules/qgis.g.info7.exe" ^
--exclude "apps/%PACKAGENAME%/grass/modules/qgis.r.in6.exe" ^
--exclude "apps/%PACKAGENAME%/grass/modules/qgis.r.in7.exe" ^
--exclude "apps/%PACKAGENAME%/grass/modules/qgis.v.in6.exe" ^
--exclude "apps/%PACKAGENAME%/grass/modules/qgis.v.in7.exe" ^
--exclude "apps/%PACKAGENAME%/grass/bin/qgis.g.browser6.exe" ^
--exclude "apps/%PACKAGENAME%/grass/bin/qgis.g.browser7.exe" ^
"apps/%PACKAGENAME%/grass"
if errorlevel 1 (echo tar grass-plugin failed & goto error)
for %%g IN (%GRASS_VERSIONS%) do (
for /F "delims=." %%i in ("%%g") do set v=%%i
set w=!v!
if !v!==6 set w=
tar -C %OSGEO4W_ROOT% -cjf %ARCH%/release/qgis/%PACKAGENAME%-grass-plugin!w!/%PACKAGENAME%-grass-plugin!w!-%VERSION%-%PACKAGE%.tar.bz2 ^
"apps/%PACKAGENAME%/bin/qgisgrass!v!.dll" ^
"apps/%PACKAGENAME%/grass/bin/qgis.g.browser!v!.exe" ^
"apps/%PACKAGENAME%/grass/modules/qgis.d.rast!v!.exe" ^
"apps/%PACKAGENAME%/grass/modules/qgis.g.info!v!.exe" ^
"apps/%PACKAGENAME%/grass/modules/qgis.r.in!v!.exe" ^
"apps/%PACKAGENAME%/grass/modules/qgis.v.in!v!.exe" ^
"apps/%PACKAGENAME%/plugins/grassplugin!v!.dll" ^
"apps/%PACKAGENAME%/plugins/grassprovider!v!.dll" ^
"apps/%PACKAGENAME%/plugins/grassrasterprovider!v!.dll" ^
"bin/%PACKAGENAME%-browser-grass!v!.bat.tmpl" ^
"bin/%PACKAGENAME%-grass!v!.bat.tmpl" ^
"etc/postinstall/%PACKAGENAME%-grass-plugin!w!.bat" ^
"etc/preremove/%PACKAGENAME%-grass-plugin!w!.bat"
if errorlevel 1 (echo tar grass-plugin!w! failed & goto error)
)
tar -C %OSGEO4W_ROOT% -cjf %ARCH%/release/qgis/%PACKAGENAME%-globe-plugin/%PACKAGENAME%-globe-plugin-%VERSION%-%PACKAGE%.tar.bz2 ^
--exclude-from exclude ^
--exclude "*.pyc" ^
"apps/%PACKAGENAME%/globe" ^
"apps/%PACKAGENAME%/plugins/globeplugin.dll"
if errorlevel 1 (echo tar globe-plugin failed & goto error)
tar -C %OSGEO4W_ROOT% -cjf %ARCH%/release/qgis/%PACKAGENAME%-oracle-provider/%PACKAGENAME%-oracle-provider-%VERSION%-%PACKAGE%.tar.bz2 ^
"apps/%PACKAGENAME%/plugins/oracleprovider.dll" ^
"apps/%PACKAGENAME%/qtplugins/sqldrivers/qsqlocispatial.dll"
if errorlevel 1 (echo tar oracle-provider failed & goto error)
tar -C %OSGEO4W_ROOT% -cjf %ARCH%/release/qgis/%PACKAGENAME%-devel/%PACKAGENAME%-devel-%VERSION%-%PACKAGE%.tar.bz2 ^
--exclude-from exclude ^
--exclude "*.pyc" ^
"apps/%PACKAGENAME%/FindQGIS.cmake" ^
"apps/%PACKAGENAME%/include/" ^
"apps/%PACKAGENAME%/lib/"
if errorlevel 1 (echo tar devel failed & goto error)
goto end
:usage
echo usage: %0 version package packagename arch [sha [site]]
echo sample: %0 2.0.1 3 qgis x86 f802808
exit
:error
echo BUILD ERROR %ERRORLEVEL%: %DATE% %TIME%
for %%i in ("" "-common" "-server" "-devel" "-grass-plugin" "-globe-plugin" "-oracle-provider") do (
if exist %ARCH%\release\qgis\%PACKAGENAME%%%i\%PACKAGENAME%%%i-%VERSION%-%PACKAGE%.tar.bz2 del %ARCH%\release\qgis\%PACKAGENAME%%%i\%PACKAGENAME%%%i-%VERSION%-%PACKAGE%.tar.bz2
)
:end
echo FINISHED: %DATE% %TIME%
endlocal