Subject: [PATCH] gnu: gpsbabel: Update to 1.9.0.
From: Sergey Trofimov <[email-masked]>
To: [email-masked]
Cc: Sergey Trofimov <[email-masked]>
Date: Sun, 4 Aug 2024 07:34:20 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

* gnu/packages/gps.scm (gpsbabel): Update to 1.9.0.
[build-system]: Use cmake-build-system.
[arguments]: Adjust for the new build system.
* gnu/packages/patches/gpsbabel-fix-i686-test.patch: Delete no longer
needed patch.
* gnu/local.mk: Delete patch line.
---
 gnu/local.mk                                  |  1 -
 gnu/packages/gps.scm                          | 42 ++++++++++-------
 .../patches/gpsbabel-fix-i686-test.patch      | 46 -------------------
 3 files changed, 26 insertions(+), 63 deletions(-)
 delete mode 100644 gnu/packages/patches/gpsbabel-fix-i686-test.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index fac7b5973b..f739ae74c1 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1428,7 +1428,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/gpaste-fix-paths.patch			\
   %D%/packages/patches/gpm-glibc-2.26.patch			\
   %D%/packages/patches/gpodder-disable-updater.patch		\
-  %D%/packages/patches/gpsbabel-fix-i686-test.patch		\
   %D%/packages/patches/grantlee-fix-i586-precision.patch	\
   %D%/packages/patches/grantlee-register-metaenumvariable.patch	\
   %D%/packages/patches/grep-timing-sensitive-test.patch		\
diff --git a/gnu/packages/gps.scm b/gnu/packages/gps.scm
index ebb7eed99c..d79656494f 100644
--- a/gnu/packages/gps.scm
+++ b/gnu/packages/gps.scm
@@ -29,6 +29,7 @@ (define-module (gnu packages gps)
   #:use-module (guix download)
   #:use-module (guix gexp)
   #:use-module (guix git-download)
+  #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system scons)
   #:use-module (guix build-system qt)
@@ -40,6 +41,7 @@ (define-module (gnu packages gps)
   #:use-module (gnu packages build-tools)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages docbook)
+  #:use-module (gnu packages geo)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages image)
@@ -58,7 +60,7 @@ (define-module (gnu packages gps)
 (define-public gpsbabel
   (package
     (name "gpsbabel")
-    (version "1.7.0")
+    (version "1.9.0")
     (source (origin
               (method git-fetch)
               (uri (git-reference
@@ -69,28 +71,37 @@ (define-public gpsbabel
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "010g0vd2f5knpq5p7qfnl31kv3r8m5sjdsafcinbj5gh02j2nzpy"))
-              (patches (search-patches "gpsbabel-fix-i686-test.patch"))
+                "0pyrbykf15znn63y9j1npdv148i9b8sgc947xq6dqw8gwx023ji5"))
               (modules '((guix build utils)))
               (snippet
                '(begin
                   (delete-file-recursively "zlib")
-                  (substitute* "Makefile.in"
-                    ((" zlib/z.*\\.h") ""))
-                  ;; Delete files under GPL-compatible licences but never used
-                  ;; on GNU systems, rather than bloating the LICENSE field.
-                  (delete-file "gui/serial_mac.cc")           ; Apple MIT
-                  (delete-file "mingw/include/ddk/hidsdi.h") ; public domain
+                  (delete-file-recursively "shapelib")
+                  (delete-file-recursively "mac")
                   #t))))
-    (build-system gnu-build-system)
     ;; TODO: "make doc" requires Docbook & co.
+    (build-system cmake-build-system)
     (arguments
-     `(#:configure-flags
-       '("--with-zlib=system")))
+     (list #:phases
+           #~(modify-phases %standard-phases
+               (add-before 'check 'set-up-test-environment
+                 (lambda* (#:key inputs #:allow-other-keys)
+                   (setenv "TZDIR" (search-input-directory inputs "share/zoneinfo"))))
+
+               (replace 'install
+                 (lambda _
+                   (install-file "gpsbabel" (string-append #$output "/bin")))))
+
+           #:configure-flags
+           #~(list
+              "-DGPSBABEL_MAPPREVIEW=OFF"
+              "-DGPSBABEL_WITH_LIBUSB=pkgconfig"
+              "-DGPSBABEL_WITH_SHAPELIB=pkgconfig"
+              "-DGPSBABEL_WITH_ZLIB=pkgconfig")))
     (inputs
-     (list expat libusb qtbase-5 zlib))
+     (list expat libusb libxkbcommon shapelib qt5compat qtbase qtserialport qttranslations zlib))
     (native-inputs
-     (list which qttools-5 libxml2))              ;'xmllint' needed for the KML tests
+     (list which pkg-config qttools libxml2 tzdata-for-tests)) ;'xmllint' needed for the KML tests
     (home-page "https://www.gpsbabel.org/")
     (synopsis "Convert and exchange data with GPS and map programs")
     (description
@@ -99,8 +110,7 @@ (define-public gpsbabel
 manipulation abilities making it a convenient for server-side processing or as
 the back-end for other tools.  It does not convert, transfer, send, or
 manipulate maps.")
-    (license (list license:expat        ; shapelib/*.[ch]
-                   license:gpl2+))))    ; everything else
+    (license (list license:gpl2+))))
 
 (define-public gpscorrelate
   (package
diff --git a/gnu/packages/patches/gpsbabel-fix-i686-test.patch b/gnu/packages/patches/gpsbabel-fix-i686-test.patch
deleted file mode 100644
index 5ba0305113..0000000000
--- a/gnu/packages/patches/gpsbabel-fix-i686-test.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-https://github.com/gpsbabel/gpsbabel/commit/465a74194d53acea5c8d74c5cf3cb2940546ec92.patch
-Can be removed next release
-
-From 465a74194d53acea5c8d74c5cf3cb2940546ec92 Mon Sep 17 00:00:00 2001
-From: tsteven4 <[email-masked]>
-Date: Fri, 7 Aug 2020 11:29:22 -0600
-Subject: [PATCH] fix i386 regression error with engima. (#620)
-
-this was motivated by the test failure seen at
-https://buildd.debian.org/status/fetch.php?pkg=gpsbabel&arch=i386&ver=1.7.0%2Bds-4&stamp=1596794554&raw=0
----
- enigma.cc | 13 ++++++++++---
- 1 file changed, 10 insertions(+), 3 deletions(-)
-
-diff --git a/enigma.cc b/enigma.cc
-index 850f27b4e..32fea92d6 100644
---- a/enigma.cc
-+++ b/enigma.cc
-@@ -21,9 +21,16 @@
- 
-  */
- 
-+#include <cmath>           // for fabs, lround
-+#include <cstdint>         // for int32_t, uint8_t, uint32_t
-+#include <cstdlib>         // for abs
-+#include <cstring>         // for strlen, memcpy, memset
-+
-+#include <QtCore/QString>  // for QString
-+
- #include "defs.h"
--#include <cmath>
--#include <cstdlib>
-+#include "gbfile.h"        // for gbfclose, gbfopen_le, gbfread, gbfwrite, gbfile
-+
- 
- #define MYNAME "Enigma binary route and waypoint file format"
- 
-@@ -177,7 +184,7 @@ enigma_waypt_disp(const Waypoint* wpt)
-   le_write32(&ewpt.longitude, decToEnigmaPosition(wpt->longitude));
-   ewpt.waypoint_type = WTYPE_WAYPOINT;
-   if (wpt->altitude != unknown_alt) {
--    le_write32(&ewpt.data.wp_altitude, METERS_TO_FEET(wpt->altitude) + 1000);
-+    le_write32(&ewpt.data.wp_altitude, lround(METERS_TO_FEET(wpt->altitude)) + 1000);
-   }
-   if (wpt->shortname != nullptr) {
-     ewpt.shortname_len = (uint8_t) min(6, strlen(CSTRc(wpt->shortname)));

base-commit: 46a64c7fdd057283063aae6df058579bb07c4b6a
--
2.45.2