diff mbox series

[bug#45889] Nextcloud Client (v15)

Message ID e6a29632-3161-a559-fc6d-fed0a928ffde@raghavgururajan.name
State Accepted
Headers show
Series [bug#45889] Nextcloud Client (v15) | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Raghav Gururajan March 9, 2021, 6 a.m. UTC
Hi Leo!

> I'm still not convinced, that this can't be made a package or perhaps
> multiple packages, one per "solution".  Each of the folder seems to
> contain a project file, which to be fair do have some non-Unix-related
> install declarations, but it should at least install a statically
> linked package *somewhere*.  We can go from there.
> 
> Alternatively, as I see this as a source, that will get copied around
> in the same way I copied libgd from gedit, you can at least extract the
> origin into a function in qt.scm, potentially named qt-solutions.


In attached v15, I have:

[1] Packaged QtSolutions.
[2] Removed QtLockedFile, QtSingleApplication, and KMessageWidget from 
3rdparty.
[3] Patched the source to use KMessageWidget from KWidgetsAddons, and, 
to use QtLockedFile and QtSingleApplication from QtSolutions.

\o/

Regards,
RG.

Comments

Leo Prikler March 9, 2021, 7:03 a.m. UTC | #1
Hi Raghav,

> Subject: [PATCH 2/3] gnu: Add qtsolutions.
> +      (version
> +       (git-version "0" revision commit))

> +         (file-name
> +          (git-file-name name version))

> +                 (("qt5")
> +                  "qt")

> +                 (("-head")
> +                  "")

> +                 (("SUBDIRS\\+=examples")
> +                  ""))
Try not to arbitrarily use too many new lines.  If you break Scheme
code in such a manner for no good reason, it will look odd.

> +                 (("toAscii")
> +                  "toLatin1"))
Why not to UTF-8?  Is the input already UTF-8 and we want to convert it
to a single-byte character set?

> +                 (("\\$\\$PWD")
> +                  (assoc-ref outputs "out")))
You should install the shared libraries in the install phase.

> +                         (list
> +                          "qtlockedfile"
> +                          "qtpropertybrowser"
> +                          "qtservice"
> +                          "qtsingleapplication"
> +                          "qtsoap")
Use '(...) for fixed input.

> Subject: [PATCH 3/3] gnu: Add nextcloud-client.
> +         (commit
> +          (string-append "v" version)))

> +                 (("    \\.\\./3rdparty/qtlockedfile/?.*")
> +                  "")
> +                 (("    \\.\\./3rdparty/qtsingleapplication/?.*")
> +                  "")
> +                 (("    \\.\\./3rdparty/kmessagewidget/?.*")
> +                  "")
> +                 (("   list\\(APPEND 3rdparty_SRC
> \\.\\./3rdparty/?.*\\)")
> +                  "")
I'm starting to grow a little suspicious about matching the leading
spaces.  You probably want to lead this (and similar stuff in 0001)
with [ \t]*.

> +                 (("\\$\\{CMAKE_SOURCE_DIR\\}/src/3rdparty/qtlockedf
> ile")
> +                  (string-append (assoc-ref inputs "qtsolutions")
> +                                 "/include/qtlockedfile/"))
> +                 (("\\$\\{CMAKE_SOURCE_DIR\\}/src/3rdparty/qtsinglea
> pplication")
> +                  (string-append (assoc-ref inputs "qtsolutions")
> +                                 "/include/qtsingleapplication/"))
> +                 (("\\$\\{CMAKE_SOURCE_DIR\\}/src/3rdparty/kmessagew
> idget")
> +                  (string-append (assoc-ref inputs "kwidgetsaddons")
> +                                 "/include/KF5/KWidgetsAddons/"))
LGTM, but probably deserves a comment.
Also, you might skip the stuff leading up to /3rdparty, i.e. have
".*/3rdparty/qtlockedfile", etc.  Perhaps this gives you enough wiggle
room to do lockedfile and single application on the same line, but it
doesn't hurt if it doesn't.

> +                 (("\\$\\{synclib_NAME\\}")
> +                  (string-append "${synclib_NAME} "
> +                                 "QtSolutions_LockedFile "
> +                                 "QtSolutions_SingleApplication "
> +                                 "KF5WidgetsAddons")))
Definitely deserves a comment and perhaps a less broad match?

> +               (substitute* '("application.h" "application.cpp")
> +                 (("SharedTools::QtSingleApplication")
> +                  "QtSingleApplication")
> +                 (("slotParseMessage\\(const QString &(msg)?.*\\)")
> +                  "slotParseMessage(const QString &msg)")))
Also deserves a comment about QtSingleApplication differences.

> +                (string-append "set(_install_dir
> \"${CMAKE_INSTALL_PREFIX}"
> +                               "/share/dbus-1/services\")")))
Would the raw string here exceed a line?

> +      ;; All ThirdParty (except QtProgressIndicator)
> +      license:lgpl2.1+
This is now just qtokenizer, right?

Regards,
Leo
diff mbox series

Patch

From 7bc3348585c325208fab89232f720d81fbaa5d0a Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <rg@raghavgururajan.name>
Date: Tue, 23 Feb 2021 08:24:47 -0500
Subject: [PATCH 3/3] gnu: Add nextcloud-client.

* gnu/packages/sync.scm (nextcloud-client): New variable.
---
 gnu/packages/sync.scm | 159 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 159 insertions(+)

diff --git a/gnu/packages/sync.scm b/gnu/packages/sync.scm
index 76b822ecbc..964746b1b2 100644
--- a/gnu/packages/sync.scm
+++ b/gnu/packages/sync.scm
@@ -28,6 +28,7 @@ 
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system go)
   #:use-module (guix build-system meson)
+  #:use-module (guix build-system qt)
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix packages)
@@ -40,8 +41,11 @@ 
   #:use-module (gnu packages crypto)
   #:use-module (gnu packages curl)
   #:use-module (gnu packages documentation)
+  #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages glib)
+  #:use-module (gnu packages gnome)
   #:use-module (gnu packages golang)
+  #:use-module (gnu packages graphviz)
   #:use-module (gnu packages image)
   #:use-module (gnu packages kde-frameworks)
   #:use-module (gnu packages linux)
@@ -49,14 +53,169 @@ 
   #:use-module (gnu packages pcre)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages python)
+  #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages qt)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages rsync)
+  #:use-module (gnu packages ruby)
   #:use-module (gnu packages selinux)
   #:use-module (gnu packages sphinx)
   #:use-module (gnu packages sqlite)
   #:use-module (gnu packages tls))
 
+(define-public nextcloud-client
+  (package
+    (name "nextcloud-client")
+    (version "3.1.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/nextcloud/desktop")
+         (commit
+          (string-append "v" version))))
+       (file-name
+        (git-file-name name version))
+       (sha256
+        (base32 "15ymk3gvfmgwzmqbhlw7jjy9y65ib3391h1dlmpll65iaj2miajk"))
+       (modules '((guix build utils)
+                  (ice-9 ftw)
+                  (srfi srfi-1)))
+       (snippet
+        `(begin
+           (let* ((keep
+                   ;; Not available in Guix.
+                   (list
+                    "QProgressIndicator"
+                    "qtokenizer")))
+             (with-directory-excursion "src/3rdparty"
+               (for-each delete-file-recursively
+                         (lset-difference string=?
+                                          (scandir ".")
+                                          (cons* "." ".." keep))))
+             #t)))))
+    (build-system qt-build-system)
+    (arguments
+     `(#:configure-flags
+       (list
+        "-DUNIT_TESTING=ON"
+        ;; Upstream Bug: https://github.com/nextcloud/desktop/issues/2885
+        "-DNO_SHIBBOLETH=ON")
+       #:imported-modules
+       ((guix build glib-or-gtk-build-system)
+        ,@%qt-build-system-modules)
+       #:modules
+       (((guix build glib-or-gtk-build-system)
+         #:prefix glib-or-gtk:)
+        (guix build qt-build-system)
+        (guix build utils))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-source
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (with-directory-excursion "src/gui"
+               (substitute* "CMakeLists.txt"
+                 (("    \\.\\./3rdparty/qtlockedfile/?.*")
+                  "")
+                 (("    \\.\\./3rdparty/qtsingleapplication/?.*")
+                  "")
+                 (("    \\.\\./3rdparty/kmessagewidget/?.*")
+                  "")
+                 (("   list\\(APPEND 3rdparty_SRC \\.\\./3rdparty/?.*\\)")
+                  "")
+                 (("\\$\\{CMAKE_SOURCE_DIR\\}/src/3rdparty/qtlockedfile")
+                  (string-append (assoc-ref inputs "qtsolutions")
+                                 "/include/qtlockedfile/"))
+                 (("\\$\\{CMAKE_SOURCE_DIR\\}/src/3rdparty/qtsingleapplication")
+                  (string-append (assoc-ref inputs "qtsolutions")
+                                 "/include/qtsingleapplication/"))
+                 (("\\$\\{CMAKE_SOURCE_DIR\\}/src/3rdparty/kmessagewidget")
+                  (string-append (assoc-ref inputs "kwidgetsaddons")
+                                 "/include/KF5/KWidgetsAddons/"))
+                 (("\\$\\{synclib_NAME\\}")
+                  (string-append "${synclib_NAME} "
+                                 "QtSolutions_LockedFile "
+                                 "QtSolutions_SingleApplication "
+                                 "KF5WidgetsAddons")))
+               (substitute* '("application.h" "application.cpp")
+                 (("SharedTools::QtSingleApplication")
+                  "QtSingleApplication")
+                 (("slotParseMessage\\(const QString &(msg)?.*\\)")
+                  "slotParseMessage(const QString &msg)")))
+             #t))
+         (add-after 'patch-source 'patch-cmake
+           (lambda* (#:key outputs #:allow-other-keys)
+             ;; Patch install directory for dbus service files.
+             (substitute* "shell_integration/libcloudproviders/CMakeLists.txt"
+               (("PKGCONFIG_GETVAR\\(.+ _install_dir\\)")
+                (string-append "set(_install_dir \"${CMAKE_INSTALL_PREFIX}"
+                               "/share/dbus-1/services\")")))
+             ;; Make sure, that Qt modules are installed under $prefix.
+             (substitute* "shell_integration/dolphin/CMakeLists.txt"
+               (("ON CACHE")
+                "OFF CACHE"))
+             #t))
+         (add-before 'check 'pre-check
+           (lambda _
+             ;; Tests write to $HOME.
+             (setenv "HOME" (getcwd))
+             #t))
+         (add-after 'install 'glib-or-gtk-compile-schemas
+           (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
+         (add-after 'glib-or-gtk-compile-schemas 'glib-or-gtk-wrap
+           (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
+    (native-inputs
+     `(("cmocka" ,cmocka)
+       ("dot" ,graphviz)
+       ("doxygen" ,doxygen)
+       ("extra-cmake-modules" ,extra-cmake-modules)
+       ("glib:bin" ,glib "bin")
+       ("perl" ,perl)
+       ("pkg-config" ,pkg-config)
+       ("python" ,python-wrapper)
+       ("qttools" ,qttools)
+       ("ruby" ,ruby)))
+    (inputs
+     `(("appstream" ,appstream)
+       ("glib" ,glib)
+       ("kconfig" ,kconfig)
+       ("kcoreaddons" ,kcoreaddons)
+       ("kio" ,kio)
+       ("kjs" ,kjs)
+       ("kwidgetsaddons" ,kwidgetsaddons)
+       ("libcloudproviders" ,libcloudproviders)
+       ("libzip" ,libzip)
+       ("openssl" ,openssl)
+       ("python-nautilus" ,python-nautilus)
+       ("qtbase" ,qtbase)
+       ("qtdeclarative" ,qtdeclarative)
+       ("qtgraphicaleffects" ,qtgraphicaleffects)
+       ("qtkeychain" ,qtkeychain)
+       ("qtquickcontrols2" ,qtquickcontrols2)
+       ("qtsolutions" ,qtsolutions)
+       ("qtsvg" ,qtsvg)
+       ("qtwebchannel" ,qtwebchannel)
+       ("qtwebsockets" ,qtwebsockets)
+       ("qtwebkit" ,qtwebkit)
+       ("sqlite" ,sqlite)
+       ("zlib" ,zlib)))
+    (propagated-inputs
+     `(("qtwebengine" ,qtwebengine)))
+    (synopsis "Desktop sync client for Nextcloud")
+    (description "Nextcloud-Desktop is a tool to synchronize files from
+Nextcloud Server with your computer.")
+    (home-page "https://nextcloud.com/install/#install-clients")
+    (license
+     (list
+      ;; QtProgressIndicator
+      license:expat
+      ;; All ThirdParty (except QtProgressIndicator)
+      license:lgpl2.1+
+      ;; Others
+      license:gpl2+))))
+
 (define-public megacmd
   (package
     (name "megacmd")
-- 
2.30.1