1# vi:syntax=spec
2# TODO: Run test suite (see debian/rules)
3
4# Template variables
5# - _version
6# - _relver
7# - _timestamp (optional)
8
9# Force the python interpreter to python3:
10# brp-python-bytecompile is unable to identify
11# the proper required version of python for
12# py files located under /usr/share/qgis/python/plugins
13%global __python %{__python3}
14
15# SPEC do not support elseif until very recent releases
16%if 0%{?fedora} >= 31
17%define grass grass78
18%endif
19%if 0%{?fedora} == 30
20%define grass grass76
21%endif
22%if 0%{?fedora} < 30
23%define grass grass74
24%endif
25
26%if %{_timestamp} > 0
27# Epoch is set only when building packages from master
28Epoch: %{_timestamp}
29%define configure_with_sha -D SHA=%(sha=%{_relver}; echo ${sha##git})
30%define combinedversion %{epoch}:%{version}
31%define builddate %(date -d @%{_timestamp} '+%a %b %d %Y')
32%else
33%define combinedversion %{version}
34%define builddate %(date '+%a %b %d %Y')
35%endif
36
37Name:           qgis
38Version:        %{_version}
39Release:        %{_relver}%{?dist}
40Summary:        A user friendly Open Source Geographic Information System
41
42License:        GPLv2+
43URL:            http://www.qgis.org
44
45Source0:        http://qgis.org/downloads/%{name}-%{version}.tar.bz2
46
47# Sample configuration files for QGIS server
48Source1:        %{name}-server-httpd.conf
49Source2:        %{name}-server-nginx.conf
50Source3:        %{name}-server-fcgi.socket
51Source4:        %{name}-server-fcgi.service
52Source5:        %{name}-server-README.fedora
53
54# MIME definitions
55# Based on debian/qgis.xml but excluding already defined or proprietary types
56Source6:        %{name}-mime.xml
57
58# Fix builds on 64-bit machines
59# https://github.com/qgis/QGIS/issues/23525
60# https://github.com/qgis/QGIS/commit/718581ffb12b723f9a3c0ae01b7ec2d8aed9d4bb.patch
61Patch0:         %{name}-lib64.patch
62
63# Compiling stuff
64BuildRequires:  bison
65BuildRequires:  clang
66BuildRequires:  cmake
67BuildRequires:  expat-devel
68BuildRequires:  flex
69BuildRequires:  desktop-file-utils
70
71# Geo stuff
72BuildRequires:  gdal-devel
73BuildRequires:  gdal-python3
74BuildRequires:  geos-devel
75BuildRequires:  gsl-devel
76BuildRequires:  libspatialite-devel
77BuildRequires:  PDAL
78BuildRequires:  PDAL-devel
79BuildRequires:  proj-devel
80BuildRequires:  spatialindex-devel
81BuildRequires:  grass-devel
82
83# Other stuff
84BuildRequires:  exiv2-devel
85BuildRequires:  gsl-devel
86BuildRequires:  laszip-devel
87BuildRequires:  libzip-devel
88BuildRequires:  libzstd-devel
89BuildRequires:  postgresql-devel
90BuildRequires:  sqlite-devel
91BuildRequires:  hdf5-devel
92BuildRequires:  netcdf-devel
93BuildRequires:  fcgi-devel
94BuildRequires:  protobuf-compiler
95BuildRequires:  protobuf-devel
96BuildRequires:  protobuf-lite-devel
97
98# OpenCL
99BuildRequires:  opencl-headers
100BuildRequires:  ocl-icd-devel
101
102# Python stuff
103BuildRequires:  python3-devel
104BuildRequires:  python3-future
105BuildRequires:  python3-jinja2
106BuildRequires:  python3-OWSLib
107BuildRequires:  python3-psycopg2
108BuildRequires:  python3-pygments
109BuildRequires:  python3-PyYAML
110BuildRequires:  python3-qscintilla-qt5
111BuildRequires:  python3-qscintilla-qt5-devel
112BuildRequires:  python3-qt5-devel
113BuildRequires:  python3-sip-devel
114
115# Qca stuff
116BuildRequires:  qca-qt5-devel
117BuildRequires:  qca-qt5-ossl
118BuildRequires:  qscintilla-qt5-devel
119
120# Qt5 stuff
121BuildRequires:  qt5-qtlocation-devel
122BuildRequires:  qt5-qtsvg-devel
123BuildRequires:  qt5-qttools-static
124BuildRequires:  qt5-qtwebkit-devel
125BuildRequires:  qtkeychain-qt5-devel
126BuildRequires:  qt5-qtserialport-devel
127BuildRequires:  qt5-qt3d-devel
128
129# In F30+ qt5-qtbase-devel has been split
130# in qt5-qtbase-devel and qt5-qtbase-private-devel
131# qt5-qtbase-private-devel is needed by
132# external/qspatialite/qsql_spatialite.cpp:49:10
133%if 0%{?fedora} >= 30
134BuildRequires:  qt5-qtbase-private-devel
135%endif
136
137# Qwt stuff
138BuildRequires:  qwt-devel
139BuildRequires:  qwt-qt5-devel
140BuildRequires:  qwt-qt5-devel
141
142# GDAL must be explicit. It is required by some raster tools
143# like Warp (Reproject) which relies on gdalwarp
144Requires:       gdal
145
146# Installation of QCA plugins must be explicit
147Requires:       qca-qt5-ossl
148Requires:       gpsbabel
149Requires:       PDAL
150Requires:       qt5-qtcharts
151
152# We don't want to provide private Python extension libs
153%global __provides_exclude_from ^(%{python3_sitearch}|%{_libdir}/%{name}/plugins)/.*\.so(\.%{version})?$
154
155%description
156Geographic Information System (GIS) manages, analyzes, and displays
157databases of geographic information. QGIS supports shape file
158viewing and editing, spatial data storage with PostgreSQL/PostGIS, projection
159on-the-fly, map composition, and a number of other features via a plugin
160interface. QGIS also supports display of various geo-referenced raster and
161Digital Elevation Model (DEM) formats including GeoTIFF, Arc/Info ASCII Grid,
162and USGS ASCII DEM.
163
164%package devel
165Summary:        Development Libraries for the QGIS
166Requires:       %{name}%{?_isa} = %{combinedversion}-%{release}
167
168%description devel
169Development packages for QGIS including the C header files.
170
171%package grass
172Summary:        GRASS Support Libraries for QGIS
173Requires:       %{name}%{?_isa} = %{combinedversion}-%{release}
174
175# The plug-in requires more than just the grass-libs.
176# This questions the sense of the libs package.
177# WARNING: Rebuild QGIS whenever a new version of GRASS is shipped! Even though
178# the soname might stay the same, it won't work anymore.
179# https://github.com/qgis/QGIS/issues/14999
180Requires:       grass%{?_isa} = %{grass_version}
181
182%description grass
183GRASS plugin for QGIS required to interface with the GRASS system.
184
185%package -n python3-qgis
186%{?python_provide:%python_provide python3-qgis}
187# Remove before F30
188Provides:       %{name}-python = %{combinedversion}-%{release}
189Provides:       %{name}-python%{?_isa} = %{combinedversion}-%{release}
190Obsoletes:      %{name}-python < %{version}-%{release}
191Obsoletes:      python2-%{name} < %{version}-%{release}
192Summary:        Python integration and plug-ins for QGIS
193Requires:       %{name}%{?_isa} = %{combinedversion}-%{release}
194Requires:       gdal-python3
195# Starting from Fedora 30 python2-gdal package
196# has been renamed to gdal-python-tools
197%if 0%{?fedora} >= 30
198Requires:       gdal-python-tools
199%else
200Requires:       python2-gdal
201%endif
202Requires:       python3-future
203Requires:       python3-jinja2
204Requires:       python3-OWSLib
205Requires:       python3-psycopg2
206Requires:       python3-pygments
207Requires:       python3-PyYAML
208Requires:       python3-qscintilla-qt5
209Requires:       python3-qt5
210%{?_sip_api:Requires: python3-pyqt5-sip-api(%{_sip_api_major}) >= %{_sip_api}}
211
212%description -n python3-qgis
213Python integration and plug-ins for QGIS.
214
215%package server
216Summary:        FCGI-based OGC web map server
217Requires:       %{name}%{?_isa} = %{combinedversion}-%{release}
218Provides:       mapserver = %{version}-%{release}
219Obsoletes:      mapserver < 2.8.1-1
220
221%description server
222This FastCGI OGC web map server implements OGC WMS 1.3.0 and 1.1.1.
223The services are prepared as regular projects in QGIS. They're rendered using
224the QGIS libraries. The server also supports SLD (Styled Layer Descriptor)
225for styling. Sample configurations for HTTPD and Nginx are included.
226
227Please refer to %{name}-server-README.fedora for details!
228
229%prep
230%setup -q
231%patch0 -p0 -b .lib64
232
233# Remove executable permissions from source code files
234find . \( -name "*.cpp" -o -name "*.h" \) -type f -perm /111 -execdir chmod -x {} \+
235
236# Readme file for QGIS server configuration HTTPD and Nginx example
237install -pm0644 %{SOURCE1} .
238install -pm0644 %{SOURCE2} .
239install -pm0644 %{SOURCE3} .
240install -pm0644 %{SOURCE4} .
241install -pm0644 %{SOURCE5} .
242
243gzip ChangeLog
244
245%build
246%cmake \
247      %{_cmake_skip_rpath} \
248      -D QGIS_LIB_SUBDIR=%{_lib} \
249      -D QGIS_MANUAL_SUBDIR=/share/man \
250      -D QGIS_CGIBIN_SUBDIR=%{_libexecdir}/%{name} \
251      -D WITH_BINDINGS:BOOL=TRUE \
252      -D WITH_GRASS7:BOOL=TRUE \
253      -D GRASS_PREFIX7=%{_libdir}/%{grass} \
254      -D WITH_CUSTOM_WIDGETS:BOOL=TRUE \
255      -D BINDINGS_GLOBAL_INSTALL:BOOL=TRUE \
256      -D ENABLE_TESTS:BOOL=FALSE \
257      -D WITH_EPT:BOOL=TRUE \
258      -D WITH_PDAL:BOOL=TRUE \
259      -D WITH_QSPATIALITE:BOOL=TRUE \
260      -D WITH_SERVER:BOOL=TRUE \
261      -D WITH_3D:BOOL=TRUE \
262      -D USE_OPENCL:BOOL=TRUE \
263      %{configure_with_sha} \
264      .
265
266%cmake_build
267
268%install
269# Necessary for the test suite
270#export LD_LIBRARY_PATH=%{_builddir}%{name}-%{version}/output/%{_lib}
271%cmake_install
272
273# Install MIME type definitions
274install -d %{buildroot}%{_datadir}/mime/packages
275install -pm0644 %{SOURCE6} \
276    %{buildroot}%{_datadir}/mime/packages/%{name}.xml
277
278# See qgis-server-README.fedora
279rm -f %{buildroot}%{_libexecdir}/%{name}/wms_metadata.xml
280rm -f %{buildroot}%{_libexecdir}/%{name}/admin.sld
281
282# Remove install instructions
283rm -f %{buildroot}%{_datadir}/%{name}/doc/INSTALL*
284
285%find_lang %{name} --with-qt
286
287%files -f %{name}.lang
288%doc BUGS NEWS.md Exception_to_GPL_for_Qt.txt ChangeLog.gz
289# QGIS shows the following files in the GUI, including the license text
290%doc %{_datadir}/%{name}/doc/
291%dir %{_datadir}/%{name}/i18n/
292%lang(zh-Hans) %{_datadir}/%{name}/i18n/%{name}_zh-Hans.qm
293%lang(zh-Hant) %{_datadir}/%{name}/i18n/%{name}_zh-Hant.qm
294%{_libdir}/lib%{name}_native.so.*
295%{_libdir}/lib%{name}_app.so.*
296%{_libdir}/lib%{name}_analysis.so.*
297%{_libdir}/lib%{name}_core.so.*
298%{_libdir}/lib%{name}_gui.so.*
299%{_libdir}/lib%{name}_3d.so.*
300%{_libdir}/%{name}/
301%{?_qt5_plugindir}/sqldrivers/libqsqlspatialite.so
302%{_bindir}/%{name}
303%{_bindir}/%{name}_process
304%{_mandir}/man1/%{name}.1*
305%dir %{_datadir}/%{name}/
306%{_datadir}/mime/packages/qgis.xml
307%{_datadir}/metainfo/org.qgis.qgis.appdata.xml
308%{_datadir}/icons/hicolor/*/apps/*
309%{_datadir}/icons/hicolor/*/mimetypes/*
310%{_datadir}/applications/*%{name}.desktop
311%{_datadir}/%{name}/images/
312%{_datadir}/%{name}/resources/
313%{_datadir}/%{name}/svg/
314%exclude %{_libdir}/libqgisgrass*.so.*
315%exclude %{_libdir}/%{name}/plugins/libgrassplugin*.so
316%exclude %{_libdir}/%{name}/plugins/libprovider_grassraster*.so
317%exclude %{_libdir}/%{name}/plugins/libprovider_grass*.so
318%exclude %{_libdir}/%{name}/server/
319%exclude %{_libdir}/%{name}/grass/
320
321%files devel
322%{_datadir}/%{name}/FindQGIS.cmake
323%{_includedir}/%{name}/
324%{_libdir}/lib%{name}*.so
325%{?_qt5_plugindir}/designer/libqgis_customwidgets.so*
326
327%files grass
328%{_libdir}/lib%{name}grass*.so.*
329%{_libdir}/%{name}/plugins/libgrassplugin*.so
330%{_libdir}/%{name}/plugins/libprovider_grassraster*.so
331%{_libdir}/%{name}/plugins/libprovider_grass*.so
332%{_libdir}/%{name}/grass/
333%{_datadir}/%{name}/grass/
334
335%files -n python3-qgis
336%{_libdir}/libqgispython.so.*
337%{_datadir}/%{name}/python/
338%{python3_sitearch}/%{name}/
339%{python3_sitearch}/PyQt5/uic/widget-plugins/
340%exclude %{python3_sitearch}/%{name}/server/
341%exclude %{python3_sitearch}/%{name}/_server.so
342
343%files server
344%doc src/server/admin.sld src/server/wms_metadata.xml %{name}-server-README.fedora
345%doc %{name}-server-httpd.conf %{name}-server-nginx.conf %{name}-server-fcgi.socket %{name}-server-fcgi.service
346%{_bindir}/%{name}_mapserver
347%{_libdir}/%{name}/server/
348%{_libdir}/lib%{name}_server.so.*
349%{_libexecdir}/%{name}/
350%{python3_sitearch}/%{name}/server/
351%{python3_sitearch}/%{name}/_server.so
352
353%changelog
354* %{builddate} Daniele Viganò <daniele@vigano.me> %{_version}-%{_relver}
355- Automatic build
356