commit:     6dfc79c76daecabfe0c69870c86e57aa361d1743
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 20 02:43:08 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Mar 20 03:23:26 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6dfc79c7

sci-geosciences/qgis: add 3.22.5

Almost supports GRASS 8, but not yet, due to a bug in GRASS.

3.22.5+ *does* support GRASS 8 but we can't enable it yet because of
https://github.com/OSGeo/grass/pull/2269 (=> unresolved SONAME dependencies)

Keep an eye on that bug / a fixed GRASS release and readd support
by unrestricting the dep in ${COMMON_DEPEND} once it's fixed!
(No need to change the supported GRASS versions in src_configure b/c
it won't find GRASS 8 with this dependency set.)

Bug: https://github.com/OSGeo/grass/pull/2269
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sci-geosciences/qgis/Manifest                      |  1 +
 .../files/qgis-3.22.5-install-grass8-scripts.patch | 17 +++++++
 .../qgis/{qgis-9999.ebuild => qgis-3.22.5.ebuild}  | 53 ++++++++++++++++++++--
 sci-geosciences/qgis/qgis-9999.ebuild              | 49 ++++++++++++++++++--
 4 files changed, 114 insertions(+), 6 deletions(-)

diff --git a/sci-geosciences/qgis/Manifest b/sci-geosciences/qgis/Manifest
index 9e380ed22b73..11bc127abd83 100644
--- a/sci-geosciences/qgis/Manifest
+++ b/sci-geosciences/qgis/Manifest
@@ -4,4 +4,5 @@ DIST qgis-3.22.1.tar.bz2 136772144 BLAKE2B 
ba3a5d9db2a487ff10800da0ab12de4b6d3c1
 DIST qgis-3.22.2.tar.bz2 136903329 BLAKE2B 
b1991944c05a9035dc91ea3fcc252a43da435199cb37c8a03647666f15dfd2367f2990bdddb2a124559993405ff61b4a110e6fa31da10d33411e24b756b9eb30
 SHA512 
6d893217d54483018ab5de06cc11da5da3faf24fb863da57a608429a75f3e1c4647dd809ae1bc0a7034e28296a116c8ebcb528b4886b2714e75654415b2f4c74
 DIST qgis-3.22.3.tar.bz2 136876983 BLAKE2B 
3b57af74829ca35802a09a8d83f4638ccd4d56674151d45e81f0d2af5544a6d59f20c3a68e5508f5bb5e32f5e98bf7f64f2c9f2d72e09a5137be63e4cbcaa1c0
 SHA512 
8918ee725f4f8d12c4cab009c446e137513b931583bf843356238122e22267211fffee9fd20382fbcb9b613be6d7af22bc0250d9e166ba53dd621e827aafda28
 DIST qgis-3.22.4.tar.bz2 137701974 BLAKE2B 
f1e7c35ace59b427a29c96eb6304c2e03ef6ad5304832d679f4a51fcca2c4868bd68058aa224be82e0cdef7b4f44fa310daa51e8c207c16de90b4e6536935f54
 SHA512 
423ba679618876fd4e3d308ad47903b47bfe758e78c01160e9d490121a863b83f5a60f6210fbfea090fb6dac9e42749d2b92777fa2756938bb6ab41fe75377e5
+DIST qgis-3.22.5.tar.bz2 137731586 BLAKE2B 
d5cad96ca7fadab58e2f680493469496d8c5e06141ac646a09cc1f5fa607b860a0e15e5b6257debb9e787d294d2183bd0b007e96e839aca7e9fb87d81001edd7
 SHA512 
d47bcd743a0c621b3a5a90923d98844056260f396e683b0874625e341cdf84d075505e909130cfc473fc550de37bc078fc5ebb54b437e582572d930e12411dcb
 DIST qgis_sample_data-2.8.14.tar.gz 22119181 BLAKE2B 
2d0565e91ec8119382bc9ab8e262dc04227fe8289146794891759ff5a32012245270614ba1119a6329fc45cf56852830c2079589309aa3467873f71f5c608eac
 SHA512 
6b2653d5b57ffc2c2317639dac212429840984ac917ca3e452b39aabb99ea106d1a77c1c1dd967244ef16ede9deae751b170affdf08b72239eafed5b8977da3d

diff --git 
a/sci-geosciences/qgis/files/qgis-3.22.5-install-grass8-scripts.patch 
b/sci-geosciences/qgis/files/qgis-3.22.5-install-grass8-scripts.patch
new file mode 100644
index 000000000000..5c801f23fe8c
--- /dev/null
+++ b/sci-geosciences/qgis/files/qgis-3.22.5-install-grass8-scripts.patch
@@ -0,0 +1,17 @@
+https://github.com/qgis/QGIS/pull/47881
+https://github.com/qgis/QGIS/pull/47456
+https://github.com/qgis/QGIS/pull/47456/commits/84e574dcc043e03bb1682d1dfc5bd3b9fbf87b3d
+
+From 84e574dcc043e03bb1682d1dfc5bd3b9fbf87b3d Mon Sep 17 00:00:00 2001
+From: Bas Couwenberg <[email protected]>
+Date: Fri, 18 Mar 2022 18:04:01 +0100
+Subject: [PATCH] Also install scripts for GRASS 8.
+
+--- a/src/plugins/grass/scripts/CMakeLists.txt
++++ b/src/plugins/grass/scripts/CMakeLists.txt
+@@ -1,4 +1,4 @@
+-if (GRASS_NUM_VERSION6 GREATER 60300 OR GRASS_NUM_VERSION7 GREATER 60300)
++if (GRASS_NUM_VERSION6 GREATER 60300 OR GRASS_NUM_VERSION7 GREATER 60300 OR 
GRASS_NUM_VERSION8 GREATER 60300)
+ file (GLOB MODULE_FILES *.py )
+ install (FILES ${MODULE_FILES}
+          DESTINATION ${QGIS_DATA_DIR}/grass/scripts

diff --git a/sci-geosciences/qgis/qgis-9999.ebuild 
b/sci-geosciences/qgis/qgis-3.22.5.ebuild
similarity index 73%
copy from sci-geosciences/qgis/qgis-9999.ebuild
copy to sci-geosciences/qgis/qgis-3.22.5.ebuild
index 12e8cd68f1e8..7aca973d344b 100644
--- a/sci-geosciences/qgis/qgis-9999.ebuild
+++ b/sci-geosciences/qgis/qgis-3.22.5.ebuild
@@ -1,7 +1,7 @@
 # Copyright 1999-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=7
+EAPI=8
 
 PYTHON_COMPAT=( python3_{8,9,10} )
 PYTHON_REQ_USE="sqlite"
@@ -28,6 +28,12 @@ REQUIRED_USE="${PYTHON_REQUIRED_USE} mapserver? ( python )"
 # Disabling test suite because upstream disallow running from install path
 RESTRICT="test"
 
+# 3.22.5+ *does* support GRASS 8 but we can't enable it yet because of
+# https://github.com/OSGeo/grass/pull/2269 (=> unresolved SONAME dependencies)
+# Keep an eye on that bug / a fixed GRASS release and readd support
+# by unrestricting the dep in ${COMMON_DEPEND} once it's fixed!
+# (No need to change the supported GRASS versions in src_configure b/c
+# it won't find GRASS 8 with this dependency set.)
 COMMON_DEPEND="
        app-crypt/qca:2[qt5(+),ssl]
        >=dev-db/spatialite-4.2.0
@@ -108,6 +114,10 @@ BDEPEND="
        sys-devel/flex
 "
 
+PATCHES=(
+       "${FILESDIR}"/${P}-install-grass8-scripts.patch
+)
+
 pkg_setup() {
        python-single-r1_pkg_setup
 }
@@ -134,7 +144,6 @@ src_configure() {
                -DENABLE_TESTS=OFF
                -DWITH_3D=$(usex 3d)
                -DWITH_GSL=$(usex georeferencer)
-               -DWITH_GRASS7=$(usex grass)
                $(cmake_use_find_package hdf5 HDF5)
                -DWITH_SERVER=$(usex mapserver)
                $(cmake_use_find_package netcdf NetCDF)
@@ -150,13 +159,51 @@ src_configure() {
                -DWITH_QTWEBKIT=OFF
        )
 
+       # We list all supported versions *by upstream for this version*
+       # here, even if we're not allowing it (e.g. bugs for now), so
+       # we enable/disable all the right versions. This is so qgis doesn't
+       # try to automatically use a version the build system knows about.
+       local supported_grass_versions=( 7 8 )
        if use grass; then
+               # We can do this because we have a := dep on grass &
+               # it changes subslot (ABI) when major versions change, so
+               # the logic here doesn't end up becoming stale.
                readarray -d'-' -t f <<<"$(best_version sci-geosciences/grass)"
                readarray -d'.' -t v <<<"${f[2]}"
                grassdir="grass${v[0]}${v[1]}"
 
                GRASSDIR=/usr/$(get_libdir)/${grassdir}
-               mycmakeargs+=( -DGRASS_PREFIX7=${GRASSDIR} )
+
+               einfo "Supported versions: ${supported_grass_versions[@]}"
+               einfo "Found GRASS version: ${v[0]}*"
+
+               local known_grass_version
+               # GRASS isn't slotted (in Gentoo, anyway) so we pick
+               # the best version we can to build against, and disable the 
others.
+               for known_grass_version in "${supported_grass_versions[@]}" ; do
+                       case "${known_grass_version}" in
+                               "${v[0]}")
+                                       einfo "GRASS version 
${known_grass_version} is supported. Enabling."
+                                       mycmakeargs+=(
+                                               
"-DGRASS_PREFIX${known_grass_version}=${GRASSDIR}"
+                                               
"-DWITH_GRASS${known_grass_version}=ON"
+                                       )
+                                       ;;
+                               *)
+                                       einfo "GRASS version 
${known_grass_version} is not supported or not latest found. Disabling."
+                                       mycmakeargs+=(
+                                               
"-DWITH_GRASS${known_grass_version}=OFF"
+                                       )
+                                       ;;
+                       esac
+               done
+       else
+               local known_grass_version
+               for known_grass_version in "${supported_grass_versions[@]}" ; do
+                       mycmakeargs+=(
+                               "-DWITH_GRASS${known_grass_version}=OFF"
+                       )
+               done
        fi
 
        use python && mycmakeargs+=( -DBINDINGS_GLOBAL_INSTALL=ON ) ||

diff --git a/sci-geosciences/qgis/qgis-9999.ebuild 
b/sci-geosciences/qgis/qgis-9999.ebuild
index 12e8cd68f1e8..157d86c11aaf 100644
--- a/sci-geosciences/qgis/qgis-9999.ebuild
+++ b/sci-geosciences/qgis/qgis-9999.ebuild
@@ -1,7 +1,7 @@
 # Copyright 1999-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=7
+EAPI=8
 
 PYTHON_COMPAT=( python3_{8,9,10} )
 PYTHON_REQ_USE="sqlite"
@@ -28,6 +28,12 @@ REQUIRED_USE="${PYTHON_REQUIRED_USE} mapserver? ( python )"
 # Disabling test suite because upstream disallow running from install path
 RESTRICT="test"
 
+# 3.22.5+ *does* support GRASS 8 but we can't enable it yet because of
+# https://github.com/OSGeo/grass/pull/2269 (=> unresolved SONAME dependencies)
+# Keep an eye on that bug / a fixed GRASS release and readd support
+# by unrestricting the dep in ${COMMON_DEPEND} once it's fixed!
+# (No need to change the supported GRASS versions in src_configure b/c
+# it won't find GRASS 8 with this dependency set.)
 COMMON_DEPEND="
        app-crypt/qca:2[qt5(+),ssl]
        >=dev-db/spatialite-4.2.0
@@ -134,7 +140,6 @@ src_configure() {
                -DENABLE_TESTS=OFF
                -DWITH_3D=$(usex 3d)
                -DWITH_GSL=$(usex georeferencer)
-               -DWITH_GRASS7=$(usex grass)
                $(cmake_use_find_package hdf5 HDF5)
                -DWITH_SERVER=$(usex mapserver)
                $(cmake_use_find_package netcdf NetCDF)
@@ -150,13 +155,51 @@ src_configure() {
                -DWITH_QTWEBKIT=OFF
        )
 
+       # We list all supported versions *by upstream for this version*
+       # here, even if we're not allowing it (e.g. bugs for now), so
+       # we enable/disable all the right versions. This is so qgis doesn't
+       # try to automatically use a version the build system knows about.
+       local supported_grass_versions=( 7 8 )
        if use grass; then
+               # We can do this because we have a := dep on grass &
+               # it changes subslot (ABI) when major versions change, so
+               # the logic here doesn't end up becoming stale.
                readarray -d'-' -t f <<<"$(best_version sci-geosciences/grass)"
                readarray -d'.' -t v <<<"${f[2]}"
                grassdir="grass${v[0]}${v[1]}"
 
                GRASSDIR=/usr/$(get_libdir)/${grassdir}
-               mycmakeargs+=( -DGRASS_PREFIX7=${GRASSDIR} )
+
+               einfo "Supported versions: ${supported_grass_versions[@]}"
+               einfo "Found GRASS version: ${v[0]}*"
+
+               local known_grass_version
+               # GRASS isn't slotted (in Gentoo, anyway) so we pick
+               # the best version we can to build against, and disable the 
others.
+               for known_grass_version in "${supported_grass_versions[@]}" ; do
+                       case "${known_grass_version}" in
+                               "${v[0]}")
+                                       einfo "GRASS version 
${known_grass_version} is supported. Enabling."
+                                       mycmakeargs+=(
+                                               
"-DGRASS_PREFIX${known_grass_version}=${GRASSDIR}"
+                                               
"-DWITH_GRASS${known_grass_version}=ON"
+                                       )
+                                       ;;
+                               *)
+                                       einfo "GRASS version 
${known_grass_version} is not supported or not latest found. Disabling."
+                                       mycmakeargs+=(
+                                               
"-DWITH_GRASS${known_grass_version}=OFF"
+                                       )
+                                       ;;
+                       esac
+               done
+       else
+               local known_grass_version
+               for known_grass_version in "${supported_grass_versions[@]}" ; do
+                       mycmakeargs+=(
+                               "-DWITH_GRASS${known_grass_version}=OFF"
+                       )
+               done
        fi
 
        use python && mycmakeargs+=( -DBINDINGS_GLOBAL_INSTALL=ON ) ||

Reply via email to