GNU bug report logs - #50442
[PATCH] gnu: xygrib: Fix finding resources in the data directory

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Thiago Jung Bauermann <bauermann@HIDDEN>; Keywords: patch; Done: Guillaume Le Vaillant <glv@HIDDEN>; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at 50442-done <at> debbugs.gnu.org:


Received: (at 50442-done) by debbugs.gnu.org; 16 Sep 2021 08:00:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 16 04:00:01 2021
Received: from localhost ([127.0.0.1]:53731 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mQmJM-0001MW-Tp
	for submit <at> debbugs.gnu.org; Thu, 16 Sep 2021 04:00:01 -0400
Received: from mout02.posteo.de ([185.67.36.66]:50033)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <glv@HIDDEN>) id 1mQmJK-0001MI-Rk
 for 50442-done <at> debbugs.gnu.org; Thu, 16 Sep 2021 03:59:59 -0400
Received: from submission (posteo.de [89.146.220.130]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 7254C240108
 for <50442-done <at> debbugs.gnu.org>; Thu, 16 Sep 2021 09:59:52 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1631779192; bh=IKsCoMjtsrJPRMiBfwpp2ffeliP2fGqu22StHemhLLM=;
 h=From:To:Cc:Subject:Date:From;
 b=Y7tunA8PPaS/0TE8efMtFlE0/CCffXOT2jqXoF1CycANhlEoeNdS37d4jZ+RQB67n
 SVvENTYJduoLY4vDONcN4jeMVX2spwRWJs9QHi/17UszscHMAKJcMjdJs0UCZJQo2n
 KS950CsNnLBfEBGUvle5KlVG9h8aBKRI0Pqc3yIiefR6kYnvL7SxIA0Fq7Sxdi6zQr
 LiHiO3hojPGIoMZ1CeWV71dFisE+fJwoR8C3sealied06rhT8QApR835Joq9JBLfnA
 J6Cb5QW0DMlv5CwAxrEIfrPyEKSYF8WeskQ2gxTnfbGctJfho1wJdKFyjrm/+tIEn5
 fqdFH9uga33Pw==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4H98d33vGTz9rxT;
 Thu, 16 Sep 2021 09:59:50 +0200 (CEST)
References: <20210907001857.141403-1-bauermann@HIDDEN>
 <20210916051816.133019-1-bauermann@HIDDEN>
From: Guillaume Le Vaillant <glv@HIDDEN>
To: Thiago Jung Bauermann <bauermann@HIDDEN>
Subject: Re: [bug#50442] [PATCH core-updates-frozen v2] gnu: xygrib: Fix
 finding resources in the data directory.
Date: Thu, 16 Sep 2021 07:58:51 +0000
In-reply-to: <20210916051816.133019-1-bauermann@HIDDEN>
Message-ID: <87sfy5ne6i.fsf@kitej>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 50442-done
Cc: 50442-done <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

--=-=-=
Content-Type: text/plain

Patch pushed as b3ee04cde70579f84061342d62d86fcc2093dd6c.
Thanks.

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iIUEAREKAC0WIQTLxZxm7Ce5cXlAaz5r6CCK3yH+PwUCYUL5dQ8cZ2x2QHBvc3Rl
by5uZXQACgkQa+ggit8h/j/1mwD9GhIro1a8TuXjk3qSgmIGuykdJ4aJO1dIdHOA
uSvSycQA/3ovQs/w4khy3h43HipBJTyOvB47+W909hjWcI5xVuXl
=MCcA
-----END PGP SIGNATURE-----
--=-=-=--




Notification sent to Thiago Jung Bauermann <bauermann@HIDDEN>:
bug acknowledged by developer. Full text available.
Reply sent to Guillaume Le Vaillant <glv@HIDDEN>:
You have taken responsibility. Full text available.

Message received at 50442 <at> debbugs.gnu.org:


Received: (at 50442) by debbugs.gnu.org; 16 Sep 2021 05:18:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 16 01:18:48 2021
Received: from localhost ([127.0.0.1]:53594 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mQjnI-0005l7-Jm
	for submit <at> debbugs.gnu.org; Thu, 16 Sep 2021 01:18:48 -0400
Received: from mx.kolabnow.com ([95.128.36.40]:61810
 helo=ext-mx-out003.mykolab.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <bauermann@HIDDEN>) id 1mQjnE-0005kp-3e
 for 50442 <at> debbugs.gnu.org; Thu, 16 Sep 2021 01:18:43 -0400
Received: from localhost (unknown [127.0.0.1])
 by ext-mx-out003.mykolab.com (Postfix) with ESMTP id DE4FD4054F
 for <50442 <at> debbugs.gnu.org>; Thu, 16 Sep 2021 07:18:33 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kolabnow.com; h=
 content-transfer-encoding:content-type:content-type:mime-version
 :references:in-reply-to:message-id:date:date:subject:subject
 :from:from:received:received:received; s=dkim20160331; t=
 1631769511; x=1633583912; bh=3c55mbe0HTzkuR01djwCQ5dCPS2j0cUd2xe
 2ik8vXws=; b=p7n4MaI3StdgsRvmGFxxl/JlxhG3R725GbO+S4g0dMW/DC4e1/+
 nKzT5reqeOP3MxHj2meq1pq5RuxUEXsu98ncP5XlyQx7VhxYeGzyjWsOrtm+p1Dm
 xS2CPK2Fss0O+B9qQ+kxttXUEyrKsie1yYLbHfUF9c5ZGyuSvXnWCVmpvBwGqXl5
 4Iw6+B5DrAugJJ2dxKYn8k5aCCLgUuVnvVSPSOkosTVXSvNxoj9I12hRxuHSfZBI
 qshRg2MCTK5NQX0VJ03Km+qiDs0YiWSQpmJTkXjWxzCZgQMrm04UpE/Hf03XOrA9
 V6qgnY6Pya1V2ncfwF0B7S537sNAoIwNJuJqhfJIMm9Xyjvyif0H7e01sFB8EaCR
 b7YlSRs+KZ2A1aRur+HbCBACPpZlURL/fL9xlv9qU4uajMMeonrHohRxa2SlL+sp
 bnHj7Jza50o1jeNsmDxYzpVk6VT9lf7ALfrWYDL1VtGXfJp4Lnx557Im2sHcbfFE
 IpASMYYeJUVxGZaezusOABXqcsgWMDuk15Laez+vtpjiTfMrsELiFFu+YquCUSrX
 riGSRinb7YVUrVkzOry50ja1SXN+oF08O88bgj2U+pH255TLW/vWd8VOB/44++zN
 LAr+373zzJr2iPWHudG8bnirlHgllMD6Q1Bk8N1MmjAS4VnsbsEHnQ90=
X-Virus-Scanned: amavisd-new at mykolab.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 tagged_above=-10 required=5
 tests=[BAYES_00=-1.9] autolearn=ham autolearn_force=no
Received: from ext-mx-out003.mykolab.com ([127.0.0.1])
 by localhost (ext-mx-out003.mykolab.com [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id 9eDacUu0x354 for <50442 <at> debbugs.gnu.org>;
 Thu, 16 Sep 2021 07:18:31 +0200 (CEST)
Received: from int-mx003.mykolab.com (unknown [10.9.13.3])
 by ext-mx-out003.mykolab.com (Postfix) with ESMTPS id 9EDB54033B
 for <50442 <at> debbugs.gnu.org>; Thu, 16 Sep 2021 07:18:31 +0200 (CEST)
Received: from ext-subm002.mykolab.com (unknown [10.9.6.2])
 by int-mx003.mykolab.com (Postfix) with ESMTPS id 401C0400A;
 Thu, 16 Sep 2021 07:18:31 +0200 (CEST)
From: Thiago Jung Bauermann <bauermann@HIDDEN>
To: 50442 <at> debbugs.gnu.org
Subject: [PATCH core-updates-frozen v2] gnu: xygrib: Fix finding resources in
 the data directory.
Date: Thu, 16 Sep 2021 02:18:16 -0300
Message-Id: <20210916051816.133019-1-bauermann@HIDDEN>
In-Reply-To: <20210907001857.141403-1-bauermann@HIDDEN>
References: <20210907001857.141403-1-bauermann@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: 50442
Cc: Thiago Jung Bauermann <bauermann@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.3 (/)

Currently, if you start up XyGrib it will not show icons in the toolbar
buttons, translated strings in the UI nor the map in the main view.  These
are all items stored in the data directory, which XyGrib can’t find.

Backport upstream PR 235 (already merged upstream) which makes it use XDG
directories correctly.

As a bonus, the PR also contains a fix to find libjpeg, so we don’t need
the substitution for that anymore.

* gnu/packages/patches/xygrib-fix-finding-data.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/geo.scm (xygrib)[source]: Use it.
[arguments]<#:configure-flags>: Pass ‘-DGNU_PACKAGE=ON’.
[arguments]<#:phases>{patch-directories}: Remove fix to find libjpeg.
Remove trailing ‘#t’.
[native-search-paths]: Add ‘XDG_DATA_DIRS’.
---

Hello,

This is slightly changed version of the patch, meant to apply on
core-updates-frozen in order to fix xygrib’s build failure on that branch.
The build failure is caused by the build process’ inability to find the
openjpeg-2.4 header file.

Strictly speaking, it wouldn’t be necessary to backport PR 235 to fix the
build failure but then there would still be the problem of XyGrib not being
able to find its data files, so that would be a bit pointless.

The patch is also suitable for the master branch.

I also moved the comment about the purpose of the backported patch from the
package definition to the patch file itself, which seems to be the
preferred location for this kind of information.

Thanks,
Thiago

 gnu/local.mk                                  |   1 +
 gnu/packages/geo.scm                          |  17 +--
 .../patches/xygrib-fix-finding-data.patch     | 131 ++++++++++++++++++
 3 files changed, 141 insertions(+), 8 deletions(-)
 create mode 100644 gnu/packages/patches/xygrib-fix-finding-data.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 724ab2f67d26..ca22e9600a0f 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1884,6 +1884,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/xsane-fix-snprintf-buffer-length.patch	\
   %D%/packages/patches/xsane-support-ipv6.patch			\
   %D%/packages/patches/xsane-tighten-default-umask.patch	\
+  %D%/packages/patches/xygrib-fix-finding-data.patch		\
   %D%/packages/patches/yggdrasil-extra-config.patch	\
   %D%/packages/patches/ytfzf-programs.patch        \
   %D%/packages/patches/ytfzf-updates.patch        \
diff --git a/gnu/packages/geo.scm b/gnu/packages/geo.scm
index 5d06fe08e2cf..8d5111bea8df 100644
--- a/gnu/packages/geo.scm
+++ b/gnu/packages/geo.scm
@@ -1217,6 +1217,7 @@ map display.  Downloads map data from a number of websites, including
                      (url "https://github.com/opengribs/XyGrib")
                      (commit (string-append "v" version))))
               (file-name (git-file-name name version))
+              (patches (search-patches "xygrib-fix-finding-data.patch"))
               (sha256
                (base32
                 "0xzsm8pr0zjk3f8j880fg5n82jyxn8xf1330qmmq1fqv7rsrg9ia"))
@@ -1231,18 +1232,15 @@ map display.  Downloads map data from a number of websites, including
                   #t))))
     (build-system cmake-build-system)
     (arguments
-     `(#:phases
+     `(#:configure-flags (list "-DGNU_PACKAGE=ON")
+
+       #:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'patch-directories
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((jpeg (assoc-ref inputs "openjpeg"))
                    (font (assoc-ref inputs "font-liberation")))
                (substitute* "CMakeLists.txt"
-                 ;; Find libjpeg.
-                 (("/usr") jpeg)
-                 ;; Fix install locations.
-                 (("set\\(PREFIX_BIN.*") "set(PREFIX_BIN \"bin\")\n")
-                 (("set\\(PREFIX_PKGDATA.*") "set(PREFIX_PKGDATA \"share/${PROJECT_NAME}\")\n")
                  ;; Skip looking for the static library.
                  (("\"libnova.a\"") ""))
                ;; Don't use the bundled font-liberation.
@@ -1251,8 +1249,7 @@ map display.  Downloads map data from a number of websites, including
                   (string-append "\"" font "/share/fonts/truetype/\"")))
                (substitute* "src/util/Util.h"
                  (("pathData\\(\\)\\+\"data/fonts/\"")
-                  (string-append "\"" font "/share/fonts/\""))))
-             #t)))
+                  (string-append "\"" font "/share/fonts/\"")))))))
        #:tests? #f)) ; no tests
     (native-inputs
      `(("qttools" ,qttools)))
@@ -1265,6 +1262,10 @@ map display.  Downloads map data from a number of websites, including
        ("proj.4" ,proj.4)
        ("qtbase" ,qtbase-5)
        ("zlib" ,zlib)))
+    (native-search-paths
+     (list (search-path-specification
+            (variable "XDG_DATA_DIRS")
+            (files '("share")))))
     (synopsis "Weather Forecast Visualization")
     (description
      "XyGrib is a Grib file reader and visualizes meteorological data providing
diff --git a/gnu/packages/patches/xygrib-fix-finding-data.patch b/gnu/packages/patches/xygrib-fix-finding-data.patch
new file mode 100644
index 000000000000..0b718b0eff45
--- /dev/null
+++ b/gnu/packages/patches/xygrib-fix-finding-data.patch
@@ -0,0 +1,131 @@
+This is a backport of the commits in PR 235 (“Fixes for packaging on
+linux-like systems”), which was merged upstream:
+
+https://github.com/opengribs/XyGrib/pull/235
+
+It fixes finding resources such as icons, maps and translations installed in
+the data directory.  This patch has been merged upstream and can be removed
+with the next release.
+
+Sightly adapted to find openjpg-2.4.
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 64059ab65dae..00cc5d6aea6f 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -7,6 +7,9 @@ set(VERSION_PATCH 6)
+ set(XYGRIB_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
+ set(XYGRIB_VERSION_DATE "2019-07-05")
+ 
++option(GNU_PACKAGE "Install into GNU standard directories" OFF)
++option(GEN_TRANSLATIONS "Generate translations" ON)
++
+ set(CMAKE_VERBOSE_MAKEFILE ON)
+ 
+ # Find includes in corresponding build directories
+@@ -25,7 +28,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
+ set(CMAKE_CXX_STANDARD 11)
+ #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
+ if(UNIX AND NOT APPLE)
+-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC")
++add_compile_options(-Wall -fPIC)
+ endif()
+ 
+ # Add support for address etc sanitizers, part 1/2 (other half after ADD_EXECUTABLE)
+@@ -108,17 +111,12 @@ find_path(OPENJPEG_INCLUDE_DIR
+      ~/Library/Frameworks/include
+      /Library/Frameworks/include
+      /usr/local/include
+-     /usr/local/include/openjpeg-2.3
+-     /usr/include/openjpeg-2.3
+-     /usr/local/include/openjpeg-2.1
+-     /usr/include/openjpeg-2.1
+-     /usr/local/include/openjpeg-2.2
+-     /usr/include/openjpeg-2.2
+      /usr/include
+      /sw/include # Fink
+      /opt/local/include # DarwinPorts
+      /opt/csw/include # Blastwave
+      /opt/include
++     PATH_SUFFIXES openjpeg-2.4 openjpeg-2.3 openjpeg-2.2 openjpeg-2.1
+      REQUIRED
+  )
+ include_directories(${OPENJPEG_INCLUDE_DIR})
+@@ -212,22 +210,24 @@ include_directories(${PNG_INCLUDE_DIR})
+ configure_file(cmake/Version.h.in ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/include/Version.h)
+ include_directories(${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/include)
+ 
+-if(APPLE)
+-set(PREFIX_BIN ${PROJECT_NAME})
+-set(PREFIX_PKGDATA ${PROJECT_NAME})
+-endif()
+-if(WIN32)
+-set(PREFIX_BIN ".")
+-set(PREFIX_PKGDATA ".")
+-endif()
+-if(UNIX AND NOT APPLE)
+-# This is not exactly a good idea on linux - the code should be changed so that the executable would go to /usr/local/bin and the data to /usr/local/share/XyGrib
+-set(PREFIX_BIN ${PROJECT_NAME})
+-set(PREFIX_PKGDATA ${PROJECT_NAME})
++if(GNU_PACKAGE)
++    include(GNUInstallDirs)
++    set(PREFIX_BIN ${CMAKE_INSTALL_FULL_BINDIR})
++    set(PREFIX_PKGDATA ${CMAKE_INSTALL_FULL_DATADIR}/openGribs/${PROJECT_NAME})
++else()
++    if(WIN32)
++        set(PREFIX_BIN ".")
++        set(PREFIX_PKGDATA ".")
++    else()
++        set(PREFIX_BIN ${PROJECT_NAME})
++        set(PREFIX_PKGDATA ${PROJECT_NAME})
++    endif()
+ endif()
+ 
+ add_subdirectory(src)
+-add_subdirectory(data/tr)
++if(GEN_TRANSLATIONS)
++    add_subdirectory(data/tr)
++endif()
+ 
+ # Installation
+ # macOS bundle parameters
+@@ -241,4 +241,14 @@ set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE_SHORT_VERSION_STR
+ set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE_BUNDLE_VERSION "${XYGRIB_VERSION}")
+ set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE_COPYRIGHT "${PROJECT_NAME} Authors")
+ # Install data
+-install(DIRECTORY data DESTINATION ${PREFIX_PKGDATA})
++install(DIRECTORY data DESTINATION ${PREFIX_PKGDATA}
++        PATTERN "CMakeFiles" EXCLUDE
++        PATTERN "CMakeLists.txt" EXCLUDE
++        PATTERN "Makefile" EXCLUDE
++        PATTERN "cmake_install.cmake" EXCLUDE)
++if(GNU_PACKAGE)
++    install(FILES debian/xygrib.desktop
++            DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/applications)
++    install(FILES debian/xygrib.png
++            DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/pixmaps)
++endif()
+diff --git a/INSTALL.md b/INSTALL.md
+index 2c9d3ab4da03..1190cc780182 100644
+--- a/INSTALL.md
++++ b/INSTALL.md
+@@ -22,7 +22,19 @@ https://gihub.com/opengribs/XyGrib/releases or on https://opengribs.org in the d
+   - openSUSE Tumbleweed: `sudo zypper install gcc git cmake libqt5-qtbase-devel libpng-devel openjpeg2-devel libnova-devel libproj-devel zlib-devel libbz2-devel
+ 
+ ## Build and package
++### Options
+ 
++XyGrib has two CMake options
++- GNU_PACKAGE (DEFAULT: OFF)
++```
++Files will be installed in GNU standard installation directories such as prefix/bin and prefix/share.
++Packagers are recommended to test this option.
++```
++- GEN_TRANSLATION (DEFAULT: ON)
++```
++Create targets to generate translation files.
++Turning this off removes the need for qt-linguist, part of qttools qt5 submodule, during build.
++```
+ ### macOS
+ 
+ - Get the source




Information forwarded to guix-patches@HIDDEN:
bug#50442; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 7 Sep 2021 00:19:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 06 20:19:28 2021
Received: from localhost ([127.0.0.1]:54765 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mNOpe-0003QR-A5
	for submit <at> debbugs.gnu.org; Mon, 06 Sep 2021 20:19:28 -0400
Received: from lists.gnu.org ([209.51.188.17]:34596)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <bauermann@HIDDEN>) id 1mNOpd-0003QK-9Z
 for submit <at> debbugs.gnu.org; Mon, 06 Sep 2021 20:19:21 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:57882)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <bauermann@HIDDEN>)
 id 1mNOpc-0002Ar-DL
 for guix-patches@HIDDEN; Mon, 06 Sep 2021 20:19:20 -0400
Received: from mx.kolabnow.com ([95.128.36.41]:11724)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <bauermann@HIDDEN>)
 id 1mNOpY-00014n-Vn
 for guix-patches@HIDDEN; Mon, 06 Sep 2021 20:19:19 -0400
Received: from localhost (unknown [127.0.0.1])
 by ext-mx-out002.mykolab.com (Postfix) with ESMTP id EBE41E4A
 for <guix-patches@HIDDEN>; Tue,  7 Sep 2021 02:19:13 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kolabnow.com; h=
 content-transfer-encoding:content-type:content-type:mime-version
 :message-id:date:date:subject:subject:from:from:received
 :received:received; s=dkim20160331; t=1630973952; x=1632788353;
 bh=2K9QW1p0XDyCZDg1oahnQxQ8rmUsiU/3uBJLERCL7GE=; b=e1/iuRllKCXs
 xLejb/Vanj+SxWluAILr8JM/nLLBqu6Rfo210lX/0ngTQl6EI6Z4JV9N88IpG8Z4
 2B6sIUm/HQAMoAFt6mq6Jo51XA6OTe8IUF+AMLvm/jHs2wTORnvRmtqHPXuRCXEs
 uPbzeadG35wu0iO8OqQ1DzuCSC3jGb2d6S8xpUNPKFryPBAU6IYZvcJk0IG/8RXw
 8t04mhkL2PJNkIUQ/k45zH5AFSc5CDf83FcbDLqLAooMgOVlqD0ex7ms7Ku2tcmG
 Gw6B5dK1j1tvFlUFES69ZhhVuGaoYGOYs8Ydy/f6089b2QhENH11/8T71q4Q3M/p
 xyJWehXnUTDBwXLnAtwi3W3blchJBlBs6eOYFFqly+j55Oey0TrKrNVNSsaxcb91
 I1aO91CfwONceCjGTBnFqHDSyxV5pKssFsEFkGYZ0jPQzijYFtAbiIwGxzLZSLOn
 LZahE7w1HkkgM8T873ucMx+YRgsluDMA5k7Lnh2BnsDIqXVwkfMDCZLZhf/+4bCn
 P8LSbXD9rfcb3Opi/ZMzP9NX5QIbNsT2h0/DdCdTByYtEjOIJHAzZ/GivuxA+98m
 fehzQ9OYXMJfj74bFYyavuCds7043M6CBOksCemtTW8GliNa/JTpjrOv4PLjwydD
 3848WAJutmcZ/Ntq9FhKZhzH+xM4HmY=
X-Virus-Scanned: amavisd-new at mykolab.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 tagged_above=-10 required=5
 tests=[BAYES_00=-1.9] autolearn=ham autolearn_force=no
Received: from mx.kolabnow.com ([127.0.0.1])
 by localhost (ext-mx-out002.mykolab.com [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id aSDaAX6a7WNB for <guix-patches@HIDDEN>;
 Tue,  7 Sep 2021 02:19:12 +0200 (CEST)
Received: from int-mx002.mykolab.com (unknown [10.9.13.2])
 by ext-mx-out002.mykolab.com (Postfix) with ESMTPS id D54176A1
 for <guix-patches@HIDDEN>; Tue,  7 Sep 2021 02:19:11 +0200 (CEST)
Received: from ext-subm003.mykolab.com (unknown [10.9.6.3])
 by int-mx002.mykolab.com (Postfix) with ESMTPS id 312203BBB;
 Tue,  7 Sep 2021 02:19:10 +0200 (CEST)
From: Thiago Jung Bauermann <bauermann@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH] gnu: xygrib: Fix finding resources in the data directory
Date: Mon,  6 Sep 2021 21:18:57 -0300
Message-Id: <20210907001857.141403-1-bauermann@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=95.128.36.41; envelope-from=bauermann@HIDDEN;
 helo=mx.kolabnow.com
X-Spam_score_int: -3
X-Spam_score: -0.4
X-Spam_bar: /
X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001, URIBL_SBL=1.623,
 URIBL_SBL_A=0.1 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -0.6 (/)
X-Debbugs-Envelope-To: submit
Cc: Thiago Jung Bauermann <bauermann@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.7 (/)

Currently, if you start up XyGrib it will not show icons in the toolbar
buttons, translated strings in the UI nor the map in the main view.  These
are all items stored in the data directory, which XyGrib can’t find.

Backport upstream PR 235 which makes it use XDG directories correctly.

As a bonus, the PR also contains a fix to find libjpeg, so we don’t need
the substitution for that anymore.

* gnu/packages/patches/xygrib-fix-finding-data.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/geo.scm (xygrib)[source]: Use it.
[arguments]<#:configure-flags>: Pass ‘-DGNU_PACKAGE=ON’.
[arguments]<#:phases>{patch-directories}: Remove fix to find libjpeg.
Remove trailing ‘#t’.
[native-search-paths]: Add ‘XDG_DATA_DIRS’.
---

Hi,

This patch isn’t related to either powerpc64le-linux nor
‘core-updates-frozen’, for a change. :-)

 gnu/local.mk                                  |   1 +
 gnu/packages/geo.scm                          |  22 +--
 .../patches/xygrib-fix-finding-data.patch     | 125 ++++++++++++++++++
 3 files changed, 140 insertions(+), 8 deletions(-)
 create mode 100644 gnu/packages/patches/xygrib-fix-finding-data.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index f848a8c61fdd..a3c5f7344489 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1897,6 +1897,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/xsane-fix-snprintf-buffer-length.patch	\
   %D%/packages/patches/xsane-support-ipv6.patch			\
   %D%/packages/patches/xsane-tighten-default-umask.patch	\
+  %D%/packages/patches/xygrib-fix-finding-data.patch		\
   %D%/packages/patches/yggdrasil-extra-config.patch	\
   %D%/packages/patches/ytfzf-programs.patch        \
   %D%/packages/patches/ytfzf-updates.patch        \
diff --git a/gnu/packages/geo.scm b/gnu/packages/geo.scm
index bf864f246c0c..bbf7bb166a54 100644
--- a/gnu/packages/geo.scm
+++ b/gnu/packages/geo.scm
@@ -1228,6 +1228,12 @@ map display.  Downloads map data from a number of websites, including
                      (url "https://github.com/opengribs/XyGrib")
                      (commit (string-append "v" version))))
               (file-name (git-file-name name version))
+              (patches (search-patches
+                        ;; Fix finding resources such as icons, maps and
+                        ;; translations installed in the data directory.  This
+                        ;; patch has been merged upstream and can be removed
+                        ;; with the next release.
+                        "xygrib-fix-finding-data.patch"))
               (sha256
                (base32
                 "0xzsm8pr0zjk3f8j880fg5n82jyxn8xf1330qmmq1fqv7rsrg9ia"))
@@ -1242,18 +1248,15 @@ map display.  Downloads map data from a number of websites, including
                   #t))))
     (build-system cmake-build-system)
     (arguments
-     `(#:phases
+     `(#:configure-flags (list "-DGNU_PACKAGE=ON")
+
+       #:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'patch-directories
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((jpeg (assoc-ref inputs "openjpeg"))
                    (font (assoc-ref inputs "font-liberation")))
                (substitute* "CMakeLists.txt"
-                 ;; Find libjpeg.
-                 (("/usr") jpeg)
-                 ;; Fix install locations.
-                 (("set\\(PREFIX_BIN.*") "set(PREFIX_BIN \"bin\")\n")
-                 (("set\\(PREFIX_PKGDATA.*") "set(PREFIX_PKGDATA \"share/${PROJECT_NAME}\")\n")
                  ;; Skip looking for the static library.
                  (("\"libnova.a\"") ""))
                ;; Don't use the bundled font-liberation.
@@ -1262,8 +1265,7 @@ map display.  Downloads map data from a number of websites, including
                   (string-append "\"" font "/share/fonts/truetype/\"")))
                (substitute* "src/util/Util.h"
                  (("pathData\\(\\)\\+\"data/fonts/\"")
-                  (string-append "\"" font "/share/fonts/\""))))
-             #t)))
+                  (string-append "\"" font "/share/fonts/\"")))))))
        #:tests? #f)) ; no tests
     (native-inputs
      `(("qttools" ,qttools)))
@@ -1276,6 +1278,10 @@ map display.  Downloads map data from a number of websites, including
        ("proj.4" ,proj.4)
        ("qtbase" ,qtbase-5)
        ("zlib" ,zlib)))
+    (native-search-paths
+     (list (search-path-specification
+            (variable "XDG_DATA_DIRS")
+            (files '("share")))))
     (synopsis "Weather Forecast Visualization")
     (description
      "XyGrib is a Grib file reader and visualizes meteorological data providing
diff --git a/gnu/packages/patches/xygrib-fix-finding-data.patch b/gnu/packages/patches/xygrib-fix-finding-data.patch
new file mode 100644
index 000000000000..f712153061a1
--- /dev/null
+++ b/gnu/packages/patches/xygrib-fix-finding-data.patch
@@ -0,0 +1,125 @@
+This i a backport of the commits in PR 235 (“Fixes for packaging on
+linux-like systems”), which was merged upstream:
+
+https://github.com/opengribs/XyGrib/pull/235
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 64059ab65dae..00cc5d6aea6f 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -7,6 +7,9 @@ set(VERSION_PATCH 6)
+ set(XYGRIB_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
+ set(XYGRIB_VERSION_DATE "2019-07-05")
+ 
++option(GNU_PACKAGE "Install into GNU standard directories" OFF)
++option(GEN_TRANSLATIONS "Generate translations" ON)
++
+ set(CMAKE_VERBOSE_MAKEFILE ON)
+ 
+ # Find includes in corresponding build directories
+@@ -25,7 +28,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
+ set(CMAKE_CXX_STANDARD 11)
+ #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
+ if(UNIX AND NOT APPLE)
+-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC")
++add_compile_options(-Wall -fPIC)
+ endif()
+ 
+ # Add support for address etc sanitizers, part 1/2 (other half after ADD_EXECUTABLE)
+@@ -108,17 +111,12 @@ find_path(OPENJPEG_INCLUDE_DIR
+      ~/Library/Frameworks/include
+      /Library/Frameworks/include
+      /usr/local/include
+-     /usr/local/include/openjpeg-2.3
+-     /usr/include/openjpeg-2.3
+-     /usr/local/include/openjpeg-2.1
+-     /usr/include/openjpeg-2.1
+-     /usr/local/include/openjpeg-2.2
+-     /usr/include/openjpeg-2.2
+      /usr/include
+      /sw/include # Fink
+      /opt/local/include # DarwinPorts
+      /opt/csw/include # Blastwave
+      /opt/include
++     PATH_SUFFIXES openjpeg-2.3 openjpeg-2.2 openjpeg-2.1
+      REQUIRED
+  )
+ include_directories(${OPENJPEG_INCLUDE_DIR})
+@@ -212,22 +210,24 @@ include_directories(${PNG_INCLUDE_DIR})
+ configure_file(cmake/Version.h.in ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/include/Version.h)
+ include_directories(${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/include)
+ 
+-if(APPLE)
+-set(PREFIX_BIN ${PROJECT_NAME})
+-set(PREFIX_PKGDATA ${PROJECT_NAME})
+-endif()
+-if(WIN32)
+-set(PREFIX_BIN ".")
+-set(PREFIX_PKGDATA ".")
+-endif()
+-if(UNIX AND NOT APPLE)
+-# This is not exactly a good idea on linux - the code should be changed so that the executable would go to /usr/local/bin and the data to /usr/local/share/XyGrib
+-set(PREFIX_BIN ${PROJECT_NAME})
+-set(PREFIX_PKGDATA ${PROJECT_NAME})
++if(GNU_PACKAGE)
++    include(GNUInstallDirs)
++    set(PREFIX_BIN ${CMAKE_INSTALL_FULL_BINDIR})
++    set(PREFIX_PKGDATA ${CMAKE_INSTALL_FULL_DATADIR}/openGribs/${PROJECT_NAME})
++else()
++    if(WIN32)
++        set(PREFIX_BIN ".")
++        set(PREFIX_PKGDATA ".")
++    else()
++        set(PREFIX_BIN ${PROJECT_NAME})
++        set(PREFIX_PKGDATA ${PROJECT_NAME})
++    endif()
+ endif()
+ 
+ add_subdirectory(src)
+-add_subdirectory(data/tr)
++if(GEN_TRANSLATIONS)
++    add_subdirectory(data/tr)
++endif()
+ 
+ # Installation
+ # macOS bundle parameters
+@@ -241,4 +241,14 @@ set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE_SHORT_VERSION_STR
+ set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE_BUNDLE_VERSION "${XYGRIB_VERSION}")
+ set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE_COPYRIGHT "${PROJECT_NAME} Authors")
+ # Install data
+-install(DIRECTORY data DESTINATION ${PREFIX_PKGDATA})
++install(DIRECTORY data DESTINATION ${PREFIX_PKGDATA}
++        PATTERN "CMakeFiles" EXCLUDE
++        PATTERN "CMakeLists.txt" EXCLUDE
++        PATTERN "Makefile" EXCLUDE
++        PATTERN "cmake_install.cmake" EXCLUDE)
++if(GNU_PACKAGE)
++    install(FILES debian/xygrib.desktop
++            DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/applications)
++    install(FILES debian/xygrib.png
++            DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/pixmaps)
++endif()
+diff --git a/INSTALL.md b/INSTALL.md
+index 2c9d3ab4da03..1190cc780182 100644
+--- a/INSTALL.md
++++ b/INSTALL.md
+@@ -22,7 +22,19 @@ https://gihub.com/opengribs/XyGrib/releases or on https://opengribs.org in the d
+   - openSUSE Tumbleweed: `sudo zypper install gcc git cmake libqt5-qtbase-devel libpng-devel openjpeg2-devel libnova-devel libproj-devel zlib-devel libbz2-devel
+ 
+ ## Build and package
++### Options
+ 
++XyGrib has two CMake options
++- GNU_PACKAGE (DEFAULT: OFF)
++```
++Files will be installed in GNU standard installation directories such as prefix/bin and prefix/share.
++Packagers are recommended to test this option.
++```
++- GEN_TRANSLATION (DEFAULT: ON)
++```
++Create targets to generate translation files.
++Turning this off removes the need for qt-linguist, part of qttools qt5 submodule, during build.
++```
+ ### macOS
+ 
+ - Get the source




Acknowledgement sent to Thiago Jung Bauermann <bauermann@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#50442; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 16 Sep 2021 08:15:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.