(address . guix-patches@gnu.org)
Hi guix! Today nheko 0.8.0 was released.
This patch series upgrades it and its dependency, mtxclient.
I alsotook some time to unbundle all its dependencies (adding
cpp-httplib, blurhash, and single-applicaiton-qt5).
About this last dependency (single-applicaiton-qt5), I'm unsure on how
to name it. Also, devs are suggested to include its source directly,
and by default builds a static library. The main SingleApplication
class inherit from a Qt*Application class which is choosen at build
time, so the library to be useful in the target program must be built
with the correct flag (I'm using the one used by nheko by default).
Nheko builds and run fine. It should support voice call now, but I
cannot test it (I get `[error] WebRTC: failed to start device monitor',
not sure if the problem is in my setup, in gstreamer or in my package).
From 38be202dce880dd77a5ce774c0c8877bed84975e Mon Sep 17 00:00:00 2001
From: nixo <nicolo@nixo.xyz>
Date: Wed, 20 Jan 2021 10:08:20 +0100
Subject: [PATCH 1/5] gnu: Add cpp-httplib.
* gnu/packages/cpp.scm (cpp-httplib): New variable.
---
gnu/packages/cpp.scm | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
Toggle diff (67 lines)
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 45d3faeafb..2a03ec58c5 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -16,6 +16,7 @@
;;; Copyright © 2020 Alexandros Theodotou <alex@zrythm.org>
;;; Copyright © 2020 Greg Hogan <code@greghogan.com>
;;; Copyright © 2020 Brett Gilio <brettg@gnu.org>
+;;; Copyright © 2021 Nicolò Balzarotti <nicolo@nixo.xyz>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -57,6 +58,7 @@
#:use-module (gnu packages logging)
#:use-module (gnu packages maths)
#:use-module (gnu packages perl)
+ #:use-module (gnu packages python)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages popt)
#:use-module (gnu packages pretty-print)
@@ -475,6 +477,44 @@ tools:
@end itemize\n")
(license license:bsd-3)))
+(define-public cpp-httplib
+ (package
+ (name "cpp-httplib")
+ (version "0.8.1")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/yhirose/cpp-httplib")
+ (commit (string-append "v" version))))
+ (sha256
+ (base32 "1l9n58ml7sygy723ws0z6brdbx4spc6fya6vgim11hpiy5b7zdkx"))
+ (file-name (git-file-name name version))))
+ (build-system cmake-build-system)
+ (arguments
+ `(#:configure-flags
+ '("-DBUILD_SHARED_LIBS=ON"
+ "-DHTTPLIB_COMPILE=ON")
+ #:phases
+ (modify-phases %standard-phases
+ (replace 'check
+ (lambda* (#:key source #:allow-other-keys)
+ ;; openssl genrsa wants to write a file in the git checkout
+ (copy-file (string-append source "/test") "test")
+ (chmod "test" #o744)
+ (invoke "make"))))))
+ (native-inputs
+ `(("python" ,python) ; required to build shared lib
+ ;; required for tests
+ ("openssl" ,openssl)
+ ("zlib" ,zlib)))
+ (home-page "https://github.com/yhirose/cpp-httplib")
+ (synopsis "C++ header-only HTTP/HTTPS server and client library")
+ (description "cpp-httplib is a C++11 single-file header-only cross
+platform blocking HTTP/HTTPS library, easy to setup. Just include the
+@file{httplib.h} file in your code!")
+ (license license:expat)))
+
(define-public cpplint
(package
(name "cpplint")
--
2.29.2
From 8fb37dd519fcc7038e54cdc858310983e29770f1 Mon Sep 17 00:00:00 2001
From: nixo <nicolo@nixo.xyz>
Date: Wed, 20 Jan 2021 17:56:04 +0100
Subject: [PATCH 2/5] gnu: Add blurhash.
* gnu/packages/image.scm (blurhash): New variable.
---
gnu/packages/image.scm | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
Toggle diff (53 lines)
diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm
index 935333dee2..d633b2aeab 100644
--- a/gnu/packages/image.scm
+++ b/gnu/packages/image.scm
@@ -28,6 +28,7 @@
;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2020 Zhu Zihao <all_but_last@163.com>
;;; Copyright © 2020 Vinicius Monego <monego@posteo.net>
+;;; Copyright © 2021 Nicolò Balzarotti <nicolo@nixo.xyz>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -59,6 +60,7 @@
#:use-module (gnu packages fontutils)
#:use-module (gnu packages freedesktop)
#:use-module (gnu packages gettext)
+ #:use-module (gnu packages gcc)
#:use-module (gnu packages ghostscript)
#:use-module (gnu packages gimp)
#:use-module (gnu packages gl)
@@ -1996,6 +1998,30 @@ SNG is implemented by a compiler/decompiler called sng that
losslessly translates between SNG and PNG.")
(license license:zlib)))
+(define-public blurhash
+ (package
+ (name "blurhash")
+ (version "0.0.1")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/Nheko-Reborn/blurhash")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "0jy2iigarskwfhskyladbb6l92x1fb3i3vz4bvcks0za4w5hfxk5"))))
+ (build-system meson-build-system)
+ (native-inputs
+ `(("cmake" ,cmake)
+ ("doctest" ,doctest)
+ ("gcc" ,gcc-8)))
+ (home-page "https://github.com/Nheko-Reborn/blurhash")
+ (synopsis "C++ blurhash encoder/decoder")
+ (description "Simple encoder and decoder for blurhashes. Contains a
+command line program as well as a shared library.")
+ (license license:boost1.0)))
+
(define-public lodepng
;; There are no tags in the repository, so we take the version as defined in
;; lodepng.cpp.
--
2.29.2
From 170fd188f809dd5f1f613a7bbfcf336efc191bd0 Mon Sep 17 00:00:00 2001
From: nixo <nicolo@nixo.xyz>
Date: Wed, 20 Jan 2021 17:59:24 +0100
Subject: [PATCH 3/5] gnu: mtxclient: Update to 0.4.0.
* gnu/packages/messaging.scm (mtxclient): Update to 0.4.0.
---
gnu/packages/messaging.scm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Toggle diff (33 lines)
diff --git a/gnu/packages/messaging.scm b/gnu/packages/messaging.scm
index c585326124..0368780fa6 100644
--- a/gnu/packages/messaging.scm
+++ b/gnu/packages/messaging.scm
@@ -18,7 +18,7 @@
;;; Copyright © 2019 Tanguy Le Carrour <tanguy@bioneland.org>
;;; Copyright © 2019, 2020 Brett Gilio <brettg@gnu.org>
;;; Copyright © 2019, 2020 Timotej Lazar <timotej.lazar@araneo.si>
-;;; Copyright © 2020 Nicolò Balzarotti <nicolo@nixo.xyz>
+;;; Copyright © 2020, 2021 Nicolò Balzarotti <nicolo@nixo.xyz>
;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2020 Reza Alizadeh Majd <r.majd@pantherx.org>
@@ -2227,7 +2227,7 @@ QMatrixClient project.")
(define-public mtxclient
(package
(name "mtxclient")
- (version "0.3.1")
+ (version "0.4.0")
(source
(origin
(method git-fetch)
@@ -2236,7 +2236,7 @@ QMatrixClient project.")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
- (base32 "1dg4dq20g0ah62j5s3gpsxqq4ny7lxkxdxa9q6g54hdwkrb9ms7x"))))
+ (base32 "1x820rcfz5r203dc8a0rzavcjjx10fsv1dicqg65m6kxx1w95j5r"))))
(arguments
`(#:configure-flags
(list
--
2.29.2
From e04e1025240dbe2abb990d7dcc39189a39179d69 Mon Sep 17 00:00:00 2001
From: nixo <nicolo@nixo.xyz>
Date: Wed, 20 Jan 2021 19:23:17 +0100
Subject: [PATCH 4/5] gnu: Add single-application-qt5.
* gnu/packages/qt.scm (single-application-qt5): New variable.
---
gnu/packages/qt.scm | 56 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
Toggle diff (76 lines)
diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index 79d41b3e73..205d99c017 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -20,6 +20,7 @@
;;; Copyright © 2020 Jonathan Brielmaier <jonathan.brielmaier@web.de>
;;; Copyright © 2020 Michael Rohleder <mike@rohleder.de>
;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2021 Nicolò Balzarotti <nicolo@nixo.xyz>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -1947,6 +1948,61 @@ using the Chromium browser project. The Chromium source code has Google service
and binaries removed, and adds modular support for using system libraries.")
(license license:lgpl2.1+)))
+(define-public single-application-qt5
+ ;; Change in function signature, nheko requires at least this commit
+ (let ((commit "dc8042b5db58f36e06ba54f16f38b16c5eea9053"))
+ (package
+ (name "single-application-qt5")
+ (version (string-append "3.2.0-" (string-take commit 7)))
+ (source
+ (origin
+ (method git-fetch)
+ (uri
+ (git-reference
+ (url "https://github.com/itay-grudev/SingleApplication")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "163aa2x2qb0h8w26si5ql833ilj427jjbdwlz1p2p8iaq6dh0vq1"))))
+ (build-system cmake-build-system)
+ (arguments
+ `(#:tests? #f ; no check target
+ ;; Projects can decide how to build this library. You might need to
+ ;; override this flag (QApplication, QGuiApplication or
+ ;; QCoreApplication).
+ #:configure-flags '("-DQAPPLICATION_CLASS=QApplication")
+ #:phases
+ (modify-phases %standard-phases
+ ;; No install target, install things manually
+ (replace 'install
+ (lambda* (#:key inputs outputs source #:allow-other-keys)
+ (let* ((qt (assoc-ref inputs "qtbase"))
+ (qt-version ,(version-major (package-version qt)))
+ (out (assoc-ref outputs "out")))
+ (install-file
+ "libSingleApplication.a" (string-append out "/lib"))
+ (for-each
+ (lambda (file)
+ (install-file
+ (string-append source "/" file)
+ (string-append out "/include")))
+ '("SingleApplication"
+ "singleapplication.h" "singleapplication_p.h"))
+ #t))))))
+ (inputs
+ `(("qtbase" ,qtbase)))
+ (home-page "https://github.com/itay-grudev/SingleApplication")
+ (synopsis "Replacement of QtSingleApplication for Qt5 and Qt6")
+ (description
+ "SingleApplication is a replacement of the QtSingleApplication for Qt5 and Qt6.
+
+nKeeps the Primary Instance of your Application and kills each subsequent
+instances. It can (if enabled) spawn secondary (non-related to the primary)
+instances and can send data to the primary instance from secondary
+instances.")
+ (license license:expat))))
+
(define-public python-sip
(package
(name "python-sip")
--
2.29.2
From 5308eda5d0210beb1edfb0cdf44530a13673af41 Mon Sep 17 00:00:00 2001
From: nixo <nicolo@nixo.xyz>
Date: Wed, 20 Jan 2021 18:00:51 +0100
Subject: [PATCH 5/5] gnu: nheko: Update to 0.8.0.
* gnu/packages/messaging.scm (nheko): Update to 0.8.0.
---
gnu/packages/messaging.scm | 50 +++++++++++++++++++++++++++++---------
1 file changed, 39 insertions(+), 11 deletions(-)
Toggle diff (97 lines)
diff --git a/gnu/packages/messaging.scm b/gnu/packages/messaging.scm
index 0368780fa6..c5e0c828b0 100644
--- a/gnu/packages/messaging.scm
+++ b/gnu/packages/messaging.scm
@@ -2277,7 +2277,7 @@ for the Matrix protocol. It is built on to of @code{Boost.Asio}.")
(define-public nheko
(package
(name "nheko")
- (version "0.7.2")
+ (version "0.8.0")
(source
(origin
(method git-fetch)
@@ -2286,19 +2286,40 @@ for the Matrix protocol. It is built on to of @code{Boost.Asio}.")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
- (base32 "1cbhgaf9klgxdirrxj571fqwspm0byl75c1xc40l727a6qswvp7s"))))
+ (base32 "00d6wx3lcgbks74jkdyifqxf8nlravqh88fyljd0sy7kzbah9msf"))
+ (modules '((guix build utils)))
+ (snippet
+ '(begin
+ (delete-file-recursively "third_party")
+ #t))))
(arguments
`(#:tests? #f ;no test target
#:configure-flags
- (list
- "-DCMAKE_BUILD_TYPE=Release"
- "-DCMAKE_CXX_FLAGS=-fpermissive")
+ '("-DCMAKE_BUILD_TYPE=Release"
+ "-DBUILD_DOCS=ON"
+ ;; Fix required because we are using a static SingleApplication
+ "-DCMAKE_CXX_FLAGS= \"-DQAPPLICATION_CLASS=QApplication\" "
+ ;; Compile Qml will make Nheko faster, but you will need to recompile
+ ;; it, when you update Qt. That's fine for us.
+ "-DCOMPILE_QML=ON")
#:phases
(modify-phases %standard-phases
- (add-after 'unpack 'remove-Werror
- (lambda _
- (substitute* "CMakeLists.txt"
- (("-Werror") ""))
+ (add-after 'unpack 'unbundle-dependencies
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((single-app (assoc-ref inputs "single-application")))
+ (substitute* "CMakeLists.txt"
+ ;; Remove include and source dirs,replace with the correct one
+ (("third_party/blurhash/blurhash.cpp") "")
+ (("third_party/cpp-httplib-0.5.12")
+ (string-append "\"" single-app "/include\""))
+ (("add_subdirectory.*third_party/SingleApplication.*") "")
+ ;; Link using the correct static/shared libs
+ (("SingleApplication::SingleApplication")
+ (string-append
+ ;; Dynamic libraries
+ "httplib" "\n" "blurhash" "\n"
+ ;; Static library
+ single-app "/lib/libSingleApplication.a"))))
#t))
(add-after 'unpack 'fix-determinism
(lambda _
@@ -2308,7 +2329,10 @@ for the Matrix protocol. It is built on to of @code{Boost.Asio}.")
(build-system qt-build-system)
(inputs
`(("boost" ,boost)
+ ("blurhash" ,blurhash)
+ ("cpp-httplib" ,cpp-httplib)
("cmark" ,cmark)
+ ("gst-plugins-bad" ,gst-plugins-bad) ; sdp & webrtc for calls
("json-modern-cxx" ,json-modern-cxx)
("libolm" ,libolm)
("lmdb" ,lmdb)
@@ -2317,6 +2341,7 @@ for the Matrix protocol. It is built on to of @code{Boost.Asio}.")
("openssl" ,openssl)
("qtbase" ,qtbase)
("qtdeclarative" ,qtdeclarative)
+ ("qtkeychain" ,qtkeychain)
("qtgraphicaleffects" ,qtgraphicaleffects)
("qtmultimedia" ,qtmultimedia)
("qtquickcontrols2" ,qtquickcontrols2)
@@ -2325,8 +2350,11 @@ for the Matrix protocol. It is built on to of @code{Boost.Asio}.")
("tweeny" ,tweeny)
("zlib" ,zlib)))
(native-inputs
- `(("pkg-config" ,pkg-config)
- ("qtlinguist" ,qttools)))
+ `(("doxygen" ,doxygen)
+ ("graphviz" ,graphviz)
+ ("pkg-config" ,pkg-config)
+ ("qtlinguist" ,qttools)
+ ("single-application" ,single-application-qt5)))
(home-page "https://github.com/Nheko-Reborn/nheko")
(synopsis "Desktop client for Matrix using Qt and C++14")
(description "@code{Nheko} want to provide a native desktop app for the
--
2.29.2