Subject: [bug#44191] gnu: Add kristall

From: Nicolò Balzarotti <[email-masked]>
Date: Sat, 24 Oct 2020 15:07:46 +0200

Hi guix!

This patch adds kristall, a qt browser for gemini and gopher.

There were some problems with the latest tagged version (V0.3), such as
directories that had to be created manually before install.  I preferred
to use the latest commit (as the author still does not know when a new
release will happen).  Let me know if it's fine.

Without the wrap-qt-program icons were missing.

guix lint reports no warnings.

Thanks!
Nicolò

>From c52c3ea7297c1b11cb3dd2ca7f5a12492e42defe Mon Sep 17 00:00:00 2001
From: nixo <[email-masked]>
Date: Sat, 24 Oct 2020 15:00:30 +0200
Subject: [PATCH] gnu: Add kristall.

* gnu/packages/web-browsers.scm (kristall): New variable.
---
 gnu/packages/web-browsers.scm | 59 +++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/gnu/packages/web-browsers.scm b/gnu/packages/web-browsers.scm
index eb49a8fdea..f564f25f20 100644
--- a/gnu/packages/web-browsers.scm
+++ b/gnu/packages/web-browsers.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2020 Raghav Gururajan <[email-masked]>
 ;;; Copyright © 2020 B. Wilson <[email-masked]>
 ;;; Copyright © 2020 Michael Rohleder <[email-masked]>
+;;; Copyright © 2020 Nicolò Balzarotti <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -341,6 +342,64 @@ access.")
     (properties `((lint-hidden-cve . ("CVE-2016-9179"))))
     (license license:gpl2)))
 
+(define-public kristall
+  ;; Fixes to the build system applied after the latest tag
+  ;; Use tagged release when updating
+  (let ((commit "b684f94f1af9a19c1a6fd70d72097a13b75e1ca6")
+        (revision "1"))
+    (package
+      (name "kristall")
+      (version (string-append "0.3-" revision "." (string-take commit 7)))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/MasterQ32/kristall")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32
+           "0kbn98pn8iplqkg7gxx4nysvgsn1621z95ynfr2f9jhsfsgz4r0z"))
+         (modules '((guix build utils)))))
+      (build-system gnu-build-system)
+      (arguments
+       `(#:modules ((guix build gnu-build-system)
+                    (guix build qt-utils)
+                    (guix build utils))
+         #:imported-modules (,@%gnu-build-system-modules
+                             (guix build qt-utils))
+         #:make-flags
+         (list (string-append "PREFIX=" %output))
+         #:phases
+         (modify-phases %standard-phases
+           (delete 'configure)          ; no ./configure script
+           (delete 'check)              ; no check target
+           (add-before 'build 'set-program-version
+             ;; runs git describe --tags by default
+             (lambda _
+               ;; configure.ac relies on ‘git --describe’ to get the version.
+               ;; Patch it to just return the real version number directly.
+               (substitute* "src/kristall.pro"
+                 (("(KRISTALL_VERSION=).*" _ match)
+                  (string-append match ,version "\n")))))
+           (add-after 'install 'wrap-program
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let ((out (assoc-ref outputs "out")))
+                 (wrap-qt-program out "kristall"))
+               #t)))))
+      (inputs
+       `(("openssl" ,openssl)
+         ("qtbase" ,qtbase)
+         ("qtmultimedia" ,qtmultimedia)
+         ("qtsvg" ,qtsvg)))
+      (home-page "https://github.com/MasterQ32/kristall")
+      (synopsis "Small-internet graphical client")
+      (description "Graphical small-internet client with with many features
+including multi-protocol support (gemini, http, https, gopher, finger),
+bookmarks, TSL certificates management, outline generation, tabbed interface
+and more.")
+      (license license:gpl3))))
+
 (define-public qutebrowser
   (package
     (name "qutebrowser")
-- 
2.28.0