unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Nicolò Balzarotti" <anothersms@gmail.com>
To: Christopher Baines <mail@cbaines.net>
Cc: 44191@debbugs.gnu.org, nicolo@nixo.xyz
Subject: [bug#44191] gnu: Add kristall
Date: Sat, 14 Nov 2020 15:52:35 +0100	[thread overview]
Message-ID: <87y2j47zyk.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me> (raw)
In-Reply-To: <87ft5hougw.fsf@cbaines.net>

[-- Attachment #1: Type: text/plain, Size: 301 bytes --]

Hi Chris!

Sorry for the delay, here's the updated patch.  I addedd
breeze-stylesheet as an input, and added the phase
"dont-use-bundled-fonts" that replaces relative links to absolute links
to the fonts, as you suggested.  I also added the copyright line I
forgot.

Thanks again!
Nicolò


[-- Attachment #2: v2-0001-gnu-Add-kristall.patch --]
[-- Type: text/x-patch, Size: 6945 bytes --]

From 08f2cf3033d763ffc0c753bbb7817cdb5484f362 Mon Sep 17 00:00:00 2001
From: nixo <nicolo@nixo.xyz>
Date: Tue, 27 Oct 2020 14:18:23 +0100
Subject: [PATCH v2] gnu: Add kristall.

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

diff --git a/gnu/packages/web-browsers.scm b/gnu/packages/web-browsers.scm
index eb49a8fdea..11928ef696 100644
--- a/gnu/packages/web-browsers.scm
+++ b/gnu/packages/web-browsers.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2020 Raghav Gururajan <raghavgururajan@disroot.org>
 ;;; Copyright © 2020 B. Wilson <elaexuotee@wilsonb.com>
 ;;; Copyright © 2020 Michael Rohleder <mike@rohleder.de>
+;;; Copyright © 2020 Nicolò Balzarotti <nicolo@nixo.xyz>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -46,6 +47,7 @@
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages fltk)
   #:use-module (gnu packages fontutils)
+  #:use-module (gnu packages fonts)
   #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages glib)
@@ -60,6 +62,7 @@
   #:use-module (gnu packages lisp)
   #:use-module (gnu packages lisp-xyz)
   #:use-module (gnu packages lua)
+  #:use-module (gnu packages markup)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
@@ -341,6 +344,125 @@ 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
+           "1zakhxr30n7dawig7c8mizaqxwnqn3a7pz0yi7hc55nn7n7iyr6l"))
+         (modules '((srfi srfi-1)
+                    (ice-9 ftw)
+                    (guix build utils)))
+         (snippet
+          '(let ((preserved-lib-files '("luis-l-gist")))
+             (with-directory-excursion "lib"
+               (for-each
+                (lambda (directory)
+                  (simple-format #t "deleting: ~A\n" directory)
+                  (delete-file-recursively directory))
+                (lset-difference string=?
+                                 (scandir ".")
+                                 (cons* "." ".." preserved-lib-files))))
+             ;; Contains executable of 7z and pscp
+             (delete-file-recursively "ci/tools")
+             ;; Remove bundled fonts
+             (delete-file-recursively "src/fonts")
+             #t))))
+      (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
+             (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")))
+               #t))
+           (add-before 'build 'dont-use-bundled-cmark
+             (lambda _
+               (substitute* "src/kristall.pro"
+                 (("(^include\\(.*cmark.*)" _ match)
+                  (string-append
+                   "LIBS += -I" (assoc-ref %build-inputs "cmark") " -lcmark")))
+               #t))
+           (add-before 'build 'dont-use-bundled-breeze-stylesheet
+             (lambda _
+               (substitute* "src/kristall.pro"
+                 (("../lib/BreezeStyleSheets/breeze.qrc")
+                  (string-append
+                   (assoc-ref %build-inputs "breeze-stylesheet") "/breeze.qrc")))
+               #t))
+           (add-before 'build 'dont-use-bundled-fonts
+             (lambda _
+               (substitute* "src/kristall.pro"
+                   ((".*fonts.qrc.*") ""))
+               (substitute* "src/main.cpp"
+                 (("/fonts/OpenMoji-Color")
+                  (string-append
+                   (assoc-ref %build-inputs "font-openmoji")
+                   "/share/fonts/truetype/OpenMoji-Color"))
+                 (("/fonts/NotoColorEmoji")
+                  (string-append
+                   (assoc-ref %build-inputs "font-google-noto")
+                   "/share/fonts/truetype/NotoColorEmoji")))
+               #t))
+           (add-after 'install 'wrap-program
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let ((out (assoc-ref outputs "out")))
+                 (wrap-qt-program out "kristall"))
+               #t)))))
+      (inputs
+       `(("breeze-stylesheet"
+          ,(origin
+             (method git-fetch)
+             (uri
+              (git-reference
+               (url "https://github.com/Alexhuszagh/BreezeStyleSheets")
+               (commit "2d595a956f8a5f493aa51139a470b768a6d82cce")))
+             (file-name (git-file-name name version))
+             (sha256
+              (base32
+               "1kvkxkisi3czldnb43ig60l55pi4a3m2a4ixp7krhpf9fc5wp294"))))
+         ("cmark" ,cmark)
+         ("font-google-noto" ,font-google-noto)
+         ("font-openmoji" ,font-openmoji)
+         ("openssl" ,openssl)
+         ("qtbase" ,qtbase)
+         ("qtmultimedia" ,qtmultimedia)
+         ("qtsvg" ,qtsvg)))
+      (home-page "https://kristall.random-projects.net")
+      (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 and tabbed
+interface.")
+      (license (list license:gpl3+
+                     ;; for breeze-stylesheet
+                     license:expat)))))
+
 (define-public qutebrowser
   (package
     (name "qutebrowser")
-- 
2.29.2


[-- Attachment #3: Type: text/plain, Size: 2380 bytes --]


Christopher Baines <mail@cbaines.net> writes:

> Nicolò Balzarotti <anothersms@gmail.com> writes:
>
>> Christopher Baines <mail@cbaines.net> writes:
>>>
>>> Given this is a stylesheet, rather than cmark, I don't think it's a
>>> blocker, although I do think it would be neater to have a package for
>>> it.
>>>
>> Would it be better to at least pass it's origin as an input?
>>
>> #+begin_src scheme
>>   ("breeze-stylesheet"
>>    ,(origin
>>       (method git-fetch)
>>       (uri
>>        (git-reference
>> 	(url "https://github.com/Alexhuszagh/BreezeStyleSheets")
>> 	(commit "2d595a956f8a5f493aa51139a470b768a6d82cce")))
>>       (file-name (git-file-name name version))
>>       (sha256
>>        (base32
>> 	"1kvkxkisi3czldnb43ig60l55pi4a3m2a4ixp7krhpf9fc5wp294"))))
>> #+end_src
>>
>> I'm ok with making a package for it, but in that case I'm not sure what
>> to do.  I think I'd use the copy-build-system, right? Should the package
>> be hidden?
>
> I don't mind, I think it's OK as is.
>
>>> I've made some more comments below, and I wanted to enquire about
>>> exactly how the fonts are used, but I think this is pretty much ready to
>>> merge.
>>>
>>> I'd maybe use symlink rather than copy file, since you want the fonts to
>>> be used from the respective packages in the store, however, is this just
>>> to satisfy the build system? It looks to me like the XDG_DATA_DIRS
>>> wrapping is probably what'll make the fonts work at runtime (if
>>> anything)?
>>
>> Regarding fonts,
>> I tried removing both from the inputs, and emojis at this page [1]
>> rendered just fine.
>> Should I just remove them from the inputs and let the user install them?
>> The code tries to load them with the relative path:
>>
>> #+begin_src cpp
>> // Provide OpenMoji font for a safe fallback
>> QFontDatabase::addApplicationFont(":/fonts/OpenMoji-Color.ttf");
>> QFontDatabase::addApplicationFont(":/fonts/NotoColorEmoji.ttf");
>> #+end_src
>>
>> This function fails silently (The function returns -1 if the font could
>> not be loaded.) and the error code is not checked, so we don't even need
>> to patch kristall source for this.
>
> If there's an expectation or a use in making sure these fonts are
> available, it would be good to patch the relative paths to be the
> absolute paths within the font-openmoji package.

  reply	other threads:[~2020-11-14 14:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-24 13:07 [bug#44191] gnu: Add kristall Nicolò Balzarotti
2020-10-25  9:47 ` Christopher Baines
2020-10-25 16:47   ` Nicolò Balzarotti
2020-10-26 16:43     ` Christopher Baines
2020-10-26 18:12       ` Nicolò Balzarotti
2020-10-27 13:22         ` Nicolò Balzarotti
2020-10-31 20:26           ` Christopher Baines
2020-11-03 10:14             ` Nicolò Balzarotti
2020-11-10 19:57               ` Christopher Baines
2020-11-14 14:52                 ` Nicolò Balzarotti [this message]
2020-11-14 16:23                   ` bug#44191: " Christopher Baines

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y2j47zyk.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me \
    --to=anothersms@gmail.com \
    --cc=44191@debbugs.gnu.org \
    --cc=mail@cbaines.net \
    --cc=nicolo@nixo.xyz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).