1
+ @ echo off
1
2
REM ***************************************************************************
2
3
REM package.cmd
3
4
REM ---------------------
@@ -12,47 +13,74 @@ REM * the Free Software Foundation; either version 2 of the License, or *
12
13
REM * (at your option) any later version. *
13
14
REM * *
14
15
REM ***************************************************************************
15
- @ echo off
16
16
set GRASS_VERSION = 6.4.3
17
17
18
- set BUILDDIR = %CD% \build
19
- REM set BUILDDIR=%TEMP%\qgis_unstable
20
- set LOG = %BUILDDIR% \build.log
21
-
22
- if not exist " %BUILDDIR% " mkdir %BUILDDIR%
23
- if not exist " %BUILDDIR% " goto error
24
-
25
18
set VERSION = %1
26
19
set PACKAGE = %2
27
20
set PACKAGENAME = %3
28
- if " %VERSION% " == " " goto error
29
- if " %PACKAGE% " == " " goto error
30
- if " %PACKAGENAME% " == " " set PACKAGENAME = qgis
21
+ set ARCH = %4
22
+ if " %VERSION% " == " " goto usage
23
+ if " %PACKAGE% " == " " goto usage
24
+ if " %PACKAGENAME% " == " " goto usage
25
+ if " %ARCH% " == " " goto usage
31
26
32
- path %SYSTEMROOT% \system32; %SYSTEMROOT% ; %SYSTEMROOT% \System32\Wbem; %PROGRAMFILES% \CMake 2.8\bin
33
- set PYTHONPATH =
27
+ set BUILDDIR = %CD% \build- %ARCH%
28
+ set LOG = %BUILDDIR% \build.log
34
29
35
- set VS90COMNTOOLS = %PROGRAMFILES% \Microsoft Visual Studio 9.0\Common7\Tools\
36
- call " %PROGRAMFILES% \Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86
30
+ if " %OSGEO4W_ROOT% " == " " (
31
+ if " %ARCH% " == " x86" (
32
+ set OSGEO4W_ROOT = C:\OSGeo4W
33
+ ) else (
34
+ set OSGEO4W_ROOT = C:\OSGeo4W64
35
+ )
36
+ )
37
+
38
+ if not exist " %BUILDDIR% " mkdir %BUILDDIR%
39
+ if not exist " %BUILDDIR% " (echo " could not create build directory %BUILDDIR% " & goto error)
37
40
38
- if " %OSGEO4W_ROOT% " == " " set OSGEO4W_ROOT = %PROGRAMFILES% \OSGeo4W
39
- if not exist " %OSGEO4W_ROOT% \bin\o4w_env.bat" goto error
41
+ if not exist " %OSGEO4W_ROOT% \bin\o4w_env.bat" (echo " o4w_env.bat not found" & goto error)
40
42
call " %OSGEO4W_ROOT% \bin\o4w_env.bat"
41
- path %PATH% ;c:\cygwin\bin
42
43
43
44
set O4W_ROOT = %OSGEO4W_ROOT:\ =/ %
44
45
set LIB_DIR = %O4W_ROOT%
45
46
47
+ if " %ARCH% " == " x86" goto devenv_x86
48
+ goto devenv_x86_64
49
+
50
+ :devenv_x86
51
+ if " %PROGRAMFILES(X86)% " == " " set " PROGRAMFILES(X86)" = %PROGRAMFILES%
52
+ set VS90COMNTOOLS=%PROGRAMFILES(X86)% \Microsoft Visual Studio 9.0\Common7\Tools\
53
+ call " %PROGRAMFILES(X86)% \Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86
54
+
46
55
set DEVENV =
47
56
if exist " %DevEnvDir% \vcexpress.exe" set DEVENV = vcexpress
48
57
if exist " %DevEnvDir% \devenv.exe" set DEVENV = devenv
49
- if " %DEVENV% " == " " goto error
50
58
51
- PROMPT qgis%VERSION% $g
59
+ set CMAKE_OPT = ^
60
+ -G " Visual Studio 9 2008" ^
61
+ -D SIP_BINARY_PATH=%O4W_ROOT% /apps/Python27/sip.exe ^
62
+ -D QT_ZLIB_LIBRARY=%O4W_ROOT% /lib/zlib.lib ^
63
+ -D QT_PNG_LIBRARY=%O4W_ROOT% /lib/libpng13.lib
64
+ goto devenv
52
65
53
- set BUILDCONF = RelWithDebInfo
54
- REM set BUILDCONF=Release
66
+ :devenv_x86_64
67
+ call " %PROGRAMFILES(X86)% \Microsoft Visual Studio 10.0\VC\vcvarsall.bat" amd64
68
+
69
+ set DEVENV = devenv
70
+ set CMAKE_OPT = ^
71
+ -G " Visual Studio 10 Win64" ^
72
+ -D SPATIALINDEX_LIBRARY=%O4W_ROOT% /lib/spatialindex-64.lib ^
73
+ -D SIP_BINARY_PATH=%O4W_ROOT% /bin/sip.exe ^
74
+ -D SETUPAPI_LIBRARY=" %PROGRAMFILES(X86)% /Microsoft SDKs/Windows/v7.0A/Lib/x64/SetupAPI.Lib"
75
+
76
+ :devenv
77
+ set PYTHONPATH =
78
+ path %PROGRAMFILES(X86)% \CMake 2.8\bin;%PATH% ;c:\cygwin\bin
79
+ if " %DEVENV% " == " " (echo " DEVENV not found" & goto error)
80
+
81
+ PROMPT qgis%VERSION% $g
55
82
83
+ set BUILDCONF = Release
56
84
57
85
cd ..\..
58
86
set SRCDIR = %CD%
@@ -69,7 +97,7 @@ REM try renaming the logfile to see if it's locked
69
97
REM
70
98
71
99
if exist build.tmp del build.tmp
72
- if exist build.tmp goto error
100
+ if exist build.tmp (echo " could not remove build.tmp " & goto error)
73
101
74
102
ren build.log build.tmp
75
103
if exist build.log goto locked
@@ -89,7 +117,7 @@ goto error
89
117
:build
90
118
echo Logging to %LOG%
91
119
echo BEGIN: %DATE% %TIME% >> %LOG% 2 >& 1
92
- if errorlevel 1 goto error
120
+ if errorlevel 1 (echo " could not write to log %LOG% " & goto error)
93
121
94
122
set > buildenv.log
95
123
@@ -102,14 +130,16 @@ set LIB=%LIB%;%OSGEO4W_ROOT%\lib
102
130
set INCLUDE = %INCLUDE% ;%OSGEO4W_ROOT% \include
103
131
set GRASS_PREFIX = %O4W_ROOT% /apps/grass/grass-%GRASS_VERSION%
104
132
105
- cmake -G " Visual Studio 9 2008 " ^
133
+ cmake %CMAKE_OPT% ^
106
134
-D PEDANTIC=TRUE ^
107
135
-D WITH_QSPATIALITE=TRUE ^
108
136
-D WITH_MAPSERVER=TRUE ^
109
137
-D MAPSERVER_SKIP_ECW=TRUE ^
110
138
-D WITH_GLOBE=TRUE ^
111
139
-D WITH_TOUCH=TRUE ^
112
140
-D WITH_ORACLE=TRUE ^
141
+ -D WITH_GRASS=TRUE ^
142
+ -D CMAKE_CXX_FLAGS_RELEASE=" /MD /MP /O2 /Ob2 /D NDEBUG" ^
113
143
-D CMAKE_BUILD_TYPE=%BUILDCONF% ^
114
144
-D CMAKE_CONFIGURATION_TYPES=%BUILDCONF% ^
115
145
-D GEOS_LIBRARY=%O4W_ROOT% /lib/geos_c.lib ^
@@ -118,43 +148,42 @@ cmake -G "Visual Studio 9 2008" ^
118
148
-D PYTHON_EXECUTABLE=%O4W_ROOT% /bin/python.exe ^
119
149
-D PYTHON_INCLUDE_PATH=%O4W_ROOT% /apps/Python27/include ^
120
150
-D PYTHON_LIBRARY=%O4W_ROOT% /apps/Python27/libs/python27.lib ^
121
- -D SIP_BINARY_PATH=%O4W_ROOT% /apps/Python27/sip.exe ^
122
151
-D QT_BINARY_DIR=%O4W_ROOT% /bin ^
123
152
-D QT_LIBRARY_DIR=%O4W_ROOT% /lib ^
124
153
-D QT_HEADERS_DIR=%O4W_ROOT% /include/qt4 ^
125
- -D QT_ZLIB_LIBRARY=%O4W_ROOT% /lib/zlib.lib ^
126
- -D QT_PNG_LIBRARY=%O4W_ROOT% /lib/libpng13.lib ^
127
154
-D QWT_INCLUDE_DIR=%O4W_ROOT% /include/qwt ^
128
155
-D QWT_LIBRARY=%O4W_ROOT% /lib/qwt5.lib ^
129
156
-D CMAKE_INSTALL_PREFIX=%O4W_ROOT% /apps/%PACKAGENAME% ^
130
- -D CMAKE_CXX_FLAGS_RELWITHDEBINFO=" /MD /ZI /Od /D NDEBUG" ^
131
157
-D FCGI_INCLUDE_DIR=%O4W_ROOT% /include ^
132
158
-D FCGI_LIBRARY=%O4W_ROOT% /lib/libfcgi.lib ^
133
159
%SRCDIR% >> %LOG% 2 >& 1
134
- if errorlevel 1 goto error
160
+ if errorlevel 1 (echo " cmake failed " & goto error)
135
161
136
162
REM bail out if python or grass was not found
137
163
grep -Eq " ^(Python not being built|Could not find GRASS)" %LOG%
138
- if not errorlevel 1 goto error
164
+ if not errorlevel 1 (echo " python or grass not found " & goto error)
139
165
140
166
:skipcmake
141
167
142
168
echo ZERO_CHECK: %DATE% %TIME% >> %LOG% 2 >& 1
143
169
%DEVENV% qgis%VERSION% .sln /Project ZERO_CHECK /Build %BUILDCONF% /Out %LOG% >> %LOG% 2 >& 1
144
- if errorlevel 1 goto error
170
+ if errorlevel 1 (echo " ZERO_CHECK failed " & goto error)
145
171
146
172
echo ALL_BUILD: %DATE% %TIME% >> %LOG% 2 >& 1
147
173
%DEVENV% qgis%VERSION% .sln /Project ALL_BUILD /Build %BUILDCONF% /Out %LOG% >> %LOG% 2 >& 1
148
- if errorlevel 1 goto error
174
+ if errorlevel 1 (echo " ALL_BUILD failed" & goto error)
175
+
176
+ set PKGDIR = %OSGEO4W_ROOT% \apps\%PACKAGENAME%
149
177
150
- if exist %OSGEO4W_ROOT% \apps\ %PACKAGENAME % (
178
+ if exist %PKGDIR % (
151
179
echo REMOVE: %DATE% %TIME% >> %LOG% 2 >& 1
152
- rmdir /s /q %OSGEO4W_ROOT% \apps\%PACKAGENAME%
180
+ rmdir /s /q %PKGDIR%
181
+ if errorlevel 1 (echo " could not remove package directory %PKGDIR% " & goto error)
153
182
)
154
183
155
184
echo INSTALL: %DATE% %TIME% >> %LOG% 2 >& 1
156
185
%DEVENV% qgis%VERSION% .sln /Project INSTALL /Build %BUILDCONF% /Out %LOG% >> %LOG% 2 >& 1
157
- if errorlevel 1 goto error
186
+ if errorlevel 1 (echo INSTALL failed & goto error)
158
187
159
188
:package
160
189
echo PACKAGE: %DATE% %TIME% >> %LOG% 2 >& 1
@@ -174,19 +203,19 @@ if not exist %OSGEO4W_ROOT%\httpd.d mkdir %OSGEO4W_ROOT%\httpd.d
174
203
sed -e 's/@ package@ /%PACKAGENAME% /g' -e 's/@ version@ /%VERSION% /g' -e 's/@ grassversion@ /%GRASS_VERSION% /g' httpd.conf.tmpl > %OSGEO4W_ROOT% \httpd.d\httpd_%PACKAGENAME% .conf.tmpl
175
204
176
205
REM sed -e 's/%OSGEO4W_ROOT:\=\\\\\\\\%/@osgeo4w@/' %OSGEO4W_ROOT%\apps\%PACKAGENAME%\python\qgis\qgisconfig.py > %OSGEO4W_ROOT%\apps\%PACKAGENAME%\python\qgis\qgisconfig.py.tmpl
177
- REM if errorlevel 1 goto error
206
+ REM if errorlevel 1 (echo creation of qgisconfig.py.tmpl failed & goto error)
178
207
179
- REM del %OSGEO4W_ROOT%\apps\%PACKAGENAME %\python\qgis\qgisconfig.py
208
+ REM del %PKGDIR %\python\qgis\qgisconfig.py
180
209
181
210
touch exclude
182
211
183
- tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME% -common-%VERSION% -%PACKAGE% .tar.bz2 ^
212
+ for %%i in (" " " -common" " -server" " -devel" " -grass-plugin" " -globe-plugin" " -oracle-provider" ) do (
213
+ if not exist %ARCH% \release\qgis\%PACKAGENAME% %%i mkdir %ARCH% \release\qgis\%PACKAGENAME% %%i
214
+ )
215
+
216
+ tar -C %OSGEO4W_ROOT% -cjf %ARCH% /release/qgis/%PACKAGENAME% -common/%PACKAGENAME% -common-%VERSION% -%PACKAGE% .tar.bz2 ^
184
217
--exclude-from exclude ^
185
218
--exclude " *.pyc" ^
186
- " apps/%PACKAGENAME% /bin/Microsoft.VC90.CRT.manifest" ^
187
- " apps/%PACKAGENAME% /bin/msvcm90.dll" ^
188
- " apps/%PACKAGENAME% /bin/msvcp90.dll" ^
189
- " apps/%PACKAGENAME% /bin/msvcr90.dll" ^
190
219
" apps/%PACKAGENAME% /bin/qgispython.dll" ^
191
220
" apps/%PACKAGENAME% /bin/qgis_analysis.dll" ^
192
221
" apps/%PACKAGENAME% /bin/qgis_networkanalysis.dll" ^
@@ -216,9 +245,9 @@ tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME%-common-%VERSION%-%PACKAGE%.tar.bz2 ^
216
245
" apps/%PACKAGENAME% /crssync.exe" ^
217
246
" etc/postinstall/%PACKAGENAME% -common.bat" ^
218
247
>> %LOG% 2 >& 1
219
- if errorlevel 1 goto error
248
+ if errorlevel 1 (echo tar common failed & goto error)
220
249
221
- tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME% -server-%VERSION% -%PACKAGE% .tar.bz2 ^
250
+ tar -C %OSGEO4W_ROOT% -cjf %ARCH% /release/qgis/ %PACKAGENAME% -server/ % PACKAGENAME% -server-%VERSION% -%PACKAGE% .tar.bz2 ^
222
251
--exclude-from exclude ^
223
252
--exclude " *.pyc" ^
224
253
" apps/%PACKAGENAME% /bin/qgis_mapserv.fcgi.exe" ^
@@ -228,11 +257,12 @@ tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME%-server-%VERSION%-%PACKAGE%.tar.bz2 ^
228
257
" etc/postinstall/%PACKAGENAME% -server.bat" ^
229
258
" etc/preremove/%PACKAGENAME% -server.bat" ^
230
259
>> %LOG% 2 >& 1
231
- if errorlevel 1 goto error
260
+ if errorlevel 1 (echo tar server failed & goto error)
261
+
262
+ move %PKGDIR% \bin\qgis.exe %OSGEO4W_ROOT% \bin\%PACKAGENAME% -bin.exe
263
+ move %PKGDIR% \bin\qbrowser.exe %OSGEO4W_ROOT% \bin\%PACKAGENAME% -browser-bin.exe
232
264
233
- move %OSGEO4W_ROOT% \apps\%PACKAGENAME% \bin\qgis.exe %OSGEO4W_ROOT% \bin\%PACKAGENAME% -bin.exe
234
- move %OSGEO4W_ROOT% \apps\%PACKAGENAME% \bin\qbrowser.exe %OSGEO4W_ROOT% \bin\%PACKAGENAME% -browser-bin.exe
235
- tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME% -%VERSION% -%PACKAGE% .tar.bz2 ^
265
+ tar -C %OSGEO4W_ROOT% -cjf %ARCH% /release/qgis/%PACKAGENAME% /%PACKAGENAME% -%VERSION% -%PACKAGE% .tar.bz2 ^
236
266
--exclude-from exclude ^
237
267
--exclude " *.pyc" ^
238
268
" bin/%PACKAGENAME% -browser-bin.exe" ^
@@ -266,9 +296,9 @@ tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME%-%VERSION%-%PACKAGE%.tar.bz2 ^
266
296
" etc/postinstall/%PACKAGENAME% .bat" ^
267
297
" etc/preremove/%PACKAGENAME% .bat" ^
268
298
>> %LOG% 2 >& 1
269
- if errorlevel 1 goto error
299
+ if errorlevel 1 (echo tar desktop failed & goto error)
270
300
271
- tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME% -grass-plugin-%VERSION% -%PACKAGE% .tar.bz2 ^
301
+ tar -C %OSGEO4W_ROOT% -cjf %ARCH% /release/qgis/ %PACKAGENAME% -grass-plugin/ % PACKAGENAME% -grass-plugin-%VERSION% -%PACKAGE% .tar.bz2 ^
272
302
--exclude-from exclude ^
273
303
--exclude " *.pyc" ^
274
304
" apps/%PACKAGENAME% /grass" ^
@@ -278,43 +308,44 @@ tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME%-grass-plugin-%VERSION%-%PACKAGE%.tar.bz
278
308
" apps/%PACKAGENAME% /plugins/grassprovider.dll" ^
279
309
" apps/%PACKAGENAME% /plugins/libgrass_gis.%GRASS_VERSION% .dll" ^
280
310
>> %LOG% 2 >& 1
281
- if errorlevel 1 goto error
311
+ if errorlevel 1 (echo tar grass-plugin failed & goto error)
282
312
283
- tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME% -globe-plugin-%VERSION% -%PACKAGE% .tar.bz2 ^
313
+ tar -C %OSGEO4W_ROOT% -cjf %ARCH% /release/qgis/ %PACKAGENAME% -globe-plugin/ % PACKAGENAME% -globe-plugin-%VERSION% -%PACKAGE% .tar.bz2 ^
284
314
--exclude-from exclude ^
285
315
--exclude " *.pyc" ^
286
316
" apps/%PACKAGENAME% /globe" ^
287
317
" apps/%PACKAGENAME% /plugins/globeplugin.dll" ^
288
318
>> %LOG% 2 >& 1
289
- if errorlevel 1 goto error
319
+ if errorlevel 1 (echo tar globe-plugin failed & goto error)
290
320
291
- tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME% -oracle-provider-%VERSION% -%PACKAGE% .tar.bz2 ^
321
+ tar -C %OSGEO4W_ROOT% -cjf %ARCH% /release/qgis/ %PACKAGENAME% -oracle-provider/ % PACKAGENAME% -oracle-provider-%VERSION% -%PACKAGE% .tar.bz2 ^
292
322
" apps/%PACKAGENAME% /plugins/oracleprovider.dll" ^
293
323
apps/qt4/plugins/sqldrivers/qsqlocispatial.dll ^
294
324
>> %LOG% 2 >& 1
295
- if errorlevel 1 goto error
325
+ if errorlevel 1 (echo tar oracle-provider failed & goto error)
296
326
297
- tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME% -devel-%VERSION% -%PACKAGE% .tar.bz2 ^
327
+ tar -C %OSGEO4W_ROOT% -cjf %ARCH% /release/qgis/ %PACKAGENAME% -devel/ % PACKAGENAME% -devel-%VERSION% -%PACKAGE% .tar.bz2 ^
298
328
--exclude-from exclude ^
299
329
--exclude " *.pyc" ^
300
330
" apps/%PACKAGENAME% /FindQGIS.cmake" ^
301
331
" apps/%PACKAGENAME% /include/" ^
302
332
" apps/%PACKAGENAME% /lib/" ^
303
333
>> %LOG% 2 >& 1
304
- if errorlevel 1 goto error
334
+ if errorlevel 1 (echo tar devel failed & goto error)
305
335
306
336
goto end
307
337
338
+ :usage
339
+ echo usage: %0 version package packagename arch
340
+ echo sample: %0 2.0.1 3 qgis x86
341
+ exit
342
+
308
343
:error
309
344
echo BUILD ERROR %ERRORLEVEL% : %DATE% %TIME%
310
345
echo BUILD ERROR %ERRORLEVEL% : %DATE% %TIME% >> %LOG% 2 >& 1
311
- if exist %PACKAGENAME% -common-%VERSION% -%PACKAGE% .tar.bz2 del %PACKAGENAME% -common-%VERSION% -%PACKAGE% .tar.bz2
312
- if exist %PACKAGENAME% -%VERSION% -%PACKAGE% .tar.bz2 del %PACKAGENAME% -%VERSION% -%PACKAGE% .tar.bz2
313
- if exist %PACKAGENAME% -server-%VERSION% -%PACKAGE% .tar.bz2 del %PACKAGENAME% -server-%VERSION% -%PACKAGE% .tar.bz2
314
- if exist %PACKAGENAME% -devel-%VERSION% -%PACKAGE% .tar.bz2 del %PACKAGENAME% -devel-%VERSION% -%PACKAGE% .tar.bz2
315
- if exist %PACKAGENAME% -grass-plugin-%VERSION% -%PACKAGE% .tar.bz2 del %PACKAGENAME% -grass-plugin-%VERSION% -%PACKAGE% .tar.bz2
316
- if exist %PACKAGENAME% -globe-plugin-%VERSION% -%PACKAGE% .tar.bz2 del %PACKAGENAME% -globe-plugin-%VERSION% -%PACKAGE% .tar.bz2
317
- if exist %PACKAGENAME% -oracle-provider-%VERSION% -%PACKAGE% .tar.bz2 del %PACKAGENAME% -oracle-provider-%VERSION% -%PACKAGE% .tar.bz2
346
+ for %%i in (" " " -common" " -server" " -devel" " -grass-plugin" " -globe-plugin" " -oracle-provider" ) do (
347
+ 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
348
+ )
318
349
319
350
:end
320
351
echo FINISHED: %DATE% %TIME% >> %LOG% 2 >& 1
0 commit comments