1 # Copyright 1999-2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python3_{10..12} )
7 PYTHON_REQ_USE="sqlite"
9 # We only package the LTS releases right now
10 # We could package more but would ideally only stabilise the LTS ones
13 if [[ ${PV} == *9999* ]]; then
14 EGIT_REPO_URI="https://github.com/${PN}/${PN^^}.git"
17 SRC_URI="https://qgis.org/downloads/${P}.tar.bz2
18 examples? ( https://qgis.org/downloads/data/qgis_sample_data.tar.gz -> qgis_sample_data-2.8.14.tar.gz )"
21 inherit cmake flag-o-matic python-single-r1 virtualx xdg
23 DESCRIPTION="User friendly Geographic Information System"
24 HOMEPAGE="https://www.qgis.org/"
26 LICENSE="GPL-2+ GPL-3+"
28 IUSE="3d doc examples +georeferencer grass hdf5 mapserver netcdf opencl oracle pdal postgres python qml test webengine"
30 REQUIRED_USE="${PYTHON_REQUIRED_USE}
35 # Disabling test suite because upstream disallow running from install path
36 RESTRICT="!test? ( test )"
39 app-crypt/qca:2[qt6,ssl]
40 >=dev-db/spatialite-4.2.0
45 dev-libs/qtkeychain[qt6]
46 dev-qt/qttools:6[designer]
47 dev-qt/qtbase:6[concurrent,gui,network,sql,ssl,widgets,xml]
49 dev-qt/qtpositioning:6
54 >=sci-libs/gdal-3.0.4:=[geos,spatialite,sqlite]
56 sci-libs/libspatialindex:=
57 >=sci-libs/proj-4.9.3:=
59 >=x11-libs/qscintilla-2.10.1:=[qt6]
60 >=x11-libs/qwt-6.2.0-r3:=[polar(+),qt6,svg(+)]
62 georeferencer? ( sci-libs/gsl:= )
63 grass? ( sci-geosciences/grass:= )
64 hdf5? ( sci-libs/hdf5:= )
65 mapserver? ( dev-libs/fcgi )
66 netcdf? ( sci-libs/netcdf:= )
67 opencl? ( virtual/opencl )
69 dev-db/oracle-instantclient:=
70 sci-libs/gdal:=[oracle]
72 pdal? ( sci-libs/pdal:= )
73 postgres? ( dev-db/postgresql:= )
76 >=sci-libs/gdal-2.2.3[python,${PYTHON_SINGLE_USEDEP}]
77 $(python_gen_cond_dep '
78 dev-python/httplib2[${PYTHON_USEDEP}]
79 dev-python/jinja2[${PYTHON_USEDEP}]
80 dev-python/markupsafe[${PYTHON_USEDEP}]
81 dev-python/numpy[${PYTHON_USEDEP}]
82 dev-python/owslib[${PYTHON_USEDEP}]
83 dev-python/pygments[${PYTHON_USEDEP}]
84 dev-python/python-dateutil[${PYTHON_USEDEP}]
85 dev-python/pytz[${PYTHON_USEDEP}]
86 dev-python/pyyaml[${PYTHON_USEDEP}]
87 >=dev-python/qscintilla-2.10.1[${PYTHON_USEDEP}]
88 dev-python/requests[${PYTHON_USEDEP}]
89 dev-python/sip:=[${PYTHON_USEDEP}]
90 postgres? ( dev-python/psycopg:2[${PYTHON_USEDEP}] )
91 dev-python/pyqt6[designer,gui,multimedia,network,positioning,printsupport,serialport,sql,svg,widgets,${PYTHON_USEDEP}]
92 >=dev-python/qscintilla-2.10.1[qt6]
95 qml? ( dev-qt/qtdeclarative:6 )
96 webengine? ( dev-qt/qtwebengine:6 )
98 DEPEND="${COMMON_DEPEND}
102 app-text/poppler[cairo,utils]
106 RDEPEND="${COMMON_DEPEND}
107 sci-geosciences/gpsbabel
109 BDEPEND="${PYTHON_DEPS}
110 dev-qt/qttools:6[linguist]
111 app-alternatives/yacc
113 doc? ( app-text/doxygen )
116 $(python_gen_cond_dep '
117 dev-python/pyqt6[${PYTHON_USEDEP},testlib]
118 dev-python/nose2[${PYTHON_USEDEP}]
119 dev-python/mock[${PYTHON_USEDEP}]
126 # "${FILESDIR}/${PN}-3.36.3-qt6-Fix-broken-test.patch"
127 "${FILESDIR}/${PN}-3.36.3-qt6.patch"
128 "${FILESDIR}/${PN}-3.36.3-testReportDir.patch"
133 # Tests want to be run inside a git repo
134 if [[ ${PV} != *9999* ]]; then
136 git config --global --add safe.directory "${S}" || die
138 git config --local gc.auto 0 || die
139 git config --local user.email "larry@gentoo.org" || die
140 git config --local user.name "Larry the Cow" || die
143 git commit -m "init" || die
149 # -Werror=strict-aliasing
150 # https://bugs.gentoo.org/862660
151 # https://github.com/qgis/QGIS/issues/56859
153 # Do not trust with LTO either
154 append-flags -fno-strict-aliasing
158 -DQGIS_MANUAL_SUBDIR=share/man/
159 -DQGIS_LIB_SUBDIR=$(get_libdir)
160 -DQGIS_PLUGIN_SUBDIR=$(get_libdir)/qgis
162 # -DQWT_INCLUDE_DIR=/usr/include/qwt6
163 # -DQWT_LIBRARY=/usr/$(get_libdir)/libqwt6-qt5.so
164 # -DQGIS_QML_SUBDIR=/usr/$(get_libdir)/qt5/qml
170 -DWITH_APIDOC=$(usex doc)
172 -DWITH_INTERNAL_MDAL=ON # not packaged, bug 684538
173 -DWITH_QSPATIALITE=ON
174 -DENABLE_TESTS=$(usex test)
176 -DWITH_GSL=$(usex georeferencer)
177 $(cmake_use_find_package hdf5 HDF5)
178 -DWITH_SERVER=$(usex mapserver)
179 $(cmake_use_find_package netcdf NetCDF)
180 -DUSE_OPENCL=$(usex opencl)
181 -DWITH_ORACLE=$(usex oracle)
183 -DWITH_QTWEBENGINE=$(usex webengine)
184 -DWITH_PDAL=$(usex pdal)
185 -DWITH_POSTGRESQL=$(usex postgres)
186 -DWITH_BINDINGS=$(usex python)
187 -DWITH_CUSTOM_WIDGETS=$(usex python)
188 -DWITH_QUICK=$(usex qml)
193 # We list all supported versions *by upstream for this version*
194 # here, even if we're not allowing it (e.g. bugs for now), so
195 # we enable/disable all the right versions. This is so qgis doesn't
196 # try to automatically use a version the build system knows about.
197 local supported_grass_versions=( 7 8 )
199 # We can do this because we have a := dep on grass &
200 # it changes subslot (ABI) when major versions change, so
201 # the logic here doesn't end up becoming stale.
202 readarray -d'-' -t f <<<"$(best_version sci-geosciences/grass)"
203 readarray -d'.' -t v <<<"${f[2]}"
204 grassdir="grass${v[0]}${v[1]}"
206 GRASSDIR=/usr/$(get_libdir)/${grassdir}
208 einfo "Supported versions: ${supported_grass_versions[*]}"
209 einfo "Found GRASS version: ${v[0]}*"
211 local known_grass_version
212 # GRASS isn't slotted (in Gentoo, anyway) so we pick
213 # the best version we can to build against, and disable the others.
214 for known_grass_version in "${supported_grass_versions[@]}" ; do
215 case "${known_grass_version}" in
217 einfo "GRASS version ${known_grass_version} is supported. Enabling."
219 "-DGRASS_PREFIX${known_grass_version}=${GRASSDIR}"
220 "-DWITH_GRASS${known_grass_version}=ON"
224 einfo "GRASS version ${known_grass_version} is not supported or not latest found. Disabling."
226 "-DWITH_GRASS${known_grass_version}=OFF"
232 local known_grass_version
233 for known_grass_version in "${supported_grass_versions[@]}" ; do
235 "-DWITH_GRASS${known_grass_version}=OFF"
240 use python && mycmakeargs+=( -DBINDINGS_GLOBAL_INSTALL=ON )
242 CMAKE_BUILD_TYPE=Release # RelWithDebInfo enables debug logging
248 addwrite "/proc/self/mem"
249 addwrite "/proc/self/task/"
252 local -x CMAKE_SKIP_TESTS=(
255 PyQgsAuthenticationSystem$
256 PyQgsAuxiliaryStorage$
257 PyQgsBlockingNetworkRequest$
258 PyQgsBlockingProcess$
260 PyQgsDataItemProviderRegistry$
261 PyQgsDelimitedTextProvider$
263 PyQgsElevationProfileCanvas$
264 PyQgsEmbeddedSymbolRenderer$
265 PyQgsExternalStorageAwsS3$
266 PyQgsExternalStorageWebDav$
270 PyQgsGoogleMapsGeocoder$
272 PyQgsLayerDefinition$
276 PyQgsLineSymbolLayers$
277 PyQgsMapBoxGlStyleConverter$
278 PyQgsMapLayerComboBox$
279 PyQgsMapLayerProxyModel$
281 PyQgsNetworkAccessManager$
283 PyQgsOGRProviderGpkg$
285 PyQgsPalLabelingCanvas$
286 PyQgsPalLabelingLayout$
287 PyQgsPalLabelingPlacement$
289 PyQgsPointCloudAttributeByRampRenderer$
290 PyQgsPointCloudClassifiedRenderer$
291 PyQgsPointCloudRgbRenderer$
292 PyQgsProcessExecutablePt1$
293 PyQgsProcessExecutablePt2$
294 PyQgsProcessingAlgRunner$
295 PyQgsProcessingInPlace$
296 PyQgsProcessingPackageLayersAlgorithm$
297 PyQgsProcessingParameters$
300 PyQgsRasterFileWriter$
302 PyQgsRasterLayerRenderer$
303 PyQgsSelectiveMasking$
306 PyQgsShapefileProvider$
307 PyQgsSpatialiteProvider$
310 PyQgsSymbolLayerReadSld$
312 PyQgsVectorFileWriter$
313 PyQgsVectorLayerCache$
314 PyQgsVectorLayerEditBuffer$
315 PyQgsVectorLayerEditUtils$
316 PyQgsVectorLayerProfileGenerator$
318 TestQgsRandomMarkerSymbolLayer$
322 test_3d_mesh3drendering$
323 test_3d_pointcloud3drendering$
325 test_analysis_gcptransformer$
326 test_app_advanceddigitizing$
327 test_authmethod_authoauth2method$
328 test_core_mapdevicepixelratio$
330 test_core_openclutils$
331 test_core_vectortilelayer$
333 test_gui_ogrprovidergui$
340 test_core_blendmodes$
342 test_core_compositionconverter$
344 test_core_expression$
346 test_core_labelingengine$
348 test_core_layoutmapoverview$
349 test_core_layoutpicture$
350 test_core_linefillsymbol$
351 test_core_maprendererjob$
352 test_core_maprotation$
354 test_core_meshlayerrenderer$
355 test_core_networkaccessmanager$
356 test_core_pointcloudlayerexporter$
358 test_core_rastercontourrenderer$
359 test_core_rasterlayer$
360 test_core_simplemarker$
361 test_core_tiledownloadmanager$
362 test_gui_processinggui$
363 test_gui_filedownloader$
364 test_gui_newdatabasetablewidget$
365 test_gui_queryresultwidget$
366 test_analysis_processingalgspt2$
367 test_analysis_meshcontours$
368 test_analysis_triangulation$
369 test_analysis_processing$
370 test_provider_wcsprovider$
371 test_app_maptoolcircularstring$
375 if ! use netcdf; then
377 test_core_gdalprovider$
383 test_gui_meshlayerpropertiesdialog$
384 test_app_maptooleditmesh$
388 if ! use python || ! use postgres; then
390 ProcessingGrassAlgorithmsRasterTestPt2$
391 ProcessingCheckValidityAlgorithmTest$
392 ProcessingGdalAlgorithmsGeneralTest$
393 ProcessingGdalAlgorithmsRasterTest$
394 ProcessingGdalAlgorithmsVectorTest$
395 ProcessingGeneralTest$
396 ProcessingGenericAlgorithmsTest$
397 ProcessingGrassAlgorithmsImageryTest$
398 ProcessingGrassAlgorithmsRasterTestPt1$
399 ProcessingGrassAlgorithmsVectorTest$
401 ProcessingModelerTest$
402 ProcessingParametersTest$
403 ProcessingProjectProviderTest$
404 ProcessingQgisAlgorithmsTestPt1$
405 ProcessingQgisAlgorithmsTestPt2$
406 ProcessingQgisAlgorithmsTestPt3$
407 ProcessingQgisAlgorithmsTestPt4$
408 ProcessingQgisAlgorithmsTestPt5$
409 ProcessingQgisAlgorithmsTestPt5$
410 ProcessingScriptUtilsTest$
420 xdg_environment_reset
422 local -x QGIS_CONTINUOUS_INTEGRATION_RUN="true"
428 git config --global --add safe.directory "${S}" || die
432 insinto /usr/share/mime/packages
433 doins debian/qgis.xml
435 if use examples; then
437 dodoc -r "${WORKDIR}"/qgis_sample_data/.
438 docompress -x "/usr/share/doc/${PF}/examples"
443 python_optimize "${ED}"/usr/share/qgis/python
447 python_fix_shebang "${ED}"/usr/share/qgis/grass/scripts
452 if use postgres; then
453 elog "If you don't intend to use an external PostGIS server"
454 elog "you should install:"
455 elog " dev-db/postgis"
456 elif use python; then
457 elog "Support of PostgreSQL is disabled."
458 elog "But some installed python-plugins import the psycopg2 module."
459 elog "If you do not need these plugins just disable them"
460 elog "in the Plugins menu, else you need to set USE=\"postgres\""