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

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


Nicolò Balzarotti <anothersms@gmail.com> writes:

> The PR has been merged (so now I can link to cmark just fine).

Great, that's good news :)

> Find attached the new patches.

I've gone ahead and pushed the font-openmoji package. I tweaked the
synopsis and description a bit to try and make them more objective, and
removed the comment about building the font, as that could (hopefully)
get out of date.

> I'm unsure about BreezeStyleSheets, as the install instructions
> specifically say:
>
> #+begin_quote
> Copy breeze.qrc, dark.qss, light.qss and the dark and light folders into
> your project directory and add the qrc file to your project file.
> #+end_quote

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.

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.


+(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 "bf5b2ecd0fde117d550adeadee48d74034ed2cdb")))

You can use the commit here, so (commit commit)))

+         (file-name (git-file-name name version))
+         (sha256
+          (base32
+           "1zakhxr30n7dawig7c8mizaqxwnqn3a7pz0yi7hc55nn7n7iyr6l"))
+         (modules '((guix build utils)))
+         (snippet
+          '(begin
+             ;; Remove bundled programs.
+             (with-directory-excursion "lib"
+               ;; Delete extra (bundled) files
+               (map (lambda (dir) (delete-file-recursively dir))
+                    ;; "BreezeStyleSheets"
+                    '("cmark")))
+             ;; Contains executable of 7z and pscp
+             (delete-file-recursively "ci/tools")
+             ;; Remove bundled fonts
+             (delete-file-recursively "src/fonts")
+             #t)))

I'd rework this so that rather than saying what's deleted, it says
what's kept, as that's the important thing. So something like:

         (modules '((srfi srfi-1)
                    (ice-9 ftw)
                    (guix build utils)))
         (snippet
          '(let ((preserved-lib-files
                  '("BreezeStyleSheets"
                    "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
+             ;; runs git describe --tags by default

This comment above is probably unnecessary, the one below is better.

+             (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")))))

I think it's still practice to have #t at the end of phases, so I'd add
that in here.

+           (add-before 'build 'replace-bundled-cmark

This doesn't really replace the bundled cmark, it's stripped out by the
source snippet. I'd say something like dont-use-bundled-cmark.

+             (lambda _
+               (substitute* "src/kristall.pro"
+                 (("(^include\\(.*cmark.*)" _ match)
+                  (string-append
+                   "LIBS += -I" (assoc-ref %build-inputs "cmark") " -lcmark")))
+               (substitute* "src/renderers/markdownrenderer.cpp"
+                 (("(include.*node.*)" _ match)
+                  (string-append "// " match)))))

As above with #t at the end.

+           (add-before 'build 'replace-bundled-fonts
+             (lambda _
+               (let ((noto (assoc-ref %build-inputs "font-google-noto"))
+                     (openmoji (assoc-ref %build-inputs "font-openmoji"))
+                     (srcdir "/share/fonts/truetype/")
+                     (outdir "src/fonts/"))
+                 (mkdir-p outdir)
+                 (copy-file
+                  (string-append noto srcdir "NotoColorEmoji.ttf")
+                  (string-append outdir "NotoColorEmoji.ttf"))
+                 (copy-file
+                  (string-append openmoji srcdir "OpenMoji-Color.ttf")
+                  (string-append outdir "OpenMoji-Color.ttf")))
+               #t))

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)?

+           (add-after 'install 'wrap-program
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let ((out (assoc-ref outputs "out")))
+                 (wrap-qt-program out "kristall"))
+               #t)))))
+      (inputs
+       `(("cmark" ,cmark)
+         ("font-google-noto" ,font-google-noto)
+         ("font-openmoji" ,font-openmoji)
+         ("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.")

I think this is good, but I'd change the end to "outline generation and
tabbed interface.", "and more" is a bit too unnecessary/unobjective for
me.

+      (license license:gpl3))))

The README suggests the intention is gpl3+, additionally, with the
bundled copy of BreezeStyleSheets it would be good to mention expat here
as well, so something like:

  (license (list license:gpl3+
                 license:expat)) ; for BreezeStyleSheets

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 987 bytes --]

  reply	other threads:[~2020-10-31 20:28 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 [this message]
2020-11-03 10:14             ` Nicolò Balzarotti
2020-11-10 19:57               ` Christopher Baines
2020-11-14 14:52                 ` Nicolò Balzarotti
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=87sg9uxhtc.fsf@cbaines.net \
    --to=mail@cbaines.net \
    --cc=44191@debbugs.gnu.org \
    --cc=anothersms@gmail.com \
    --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).