Subject: [bug#59762] Add serial-studio

From: Maxim Cournoyer <[email-masked]>
Date: Mon, 16 Jan 2023 09:25:43 -0500

Hi Petr,

phodina <[email-masked]> writes:

> Hi,
>
> this adds a nice GUI program to monitor communication on serial interfaces (e.g. UART).
>
> ----
> Petr
> From b134cf1d200c867c6b6c8a729a4ad212687a101d Mon Sep 17 00:00:00 2001
> From: Petr Hodina <[email-masked]>
> Date: Fri, 21 Jan 2022 06:30:28 +0100
> Subject: [PATCH 4/4] gnu: Add serial-studio.
>
> * gnu/packages/qt.scm (serial-studio): New variable.
> * gnu/local.mk: Add patch.
> * gnu/packages/patches/serial-studio-remove-qsimple-updater.patch: New file.
>
> diff --git a/gnu/packages/patches/serial-studio-remove-qsimple-updater.patch b/gnu/packages/patches/serial-studio-remove-qsimple-updater.patch
> new file mode 100644
> index 0000000000..f8f93364d6
> --- /dev/null
> +++ b/gnu/packages/patches/serial-studio-remove-qsimple-updater.patch
> @@ -0,0 +1,80 @@
> +From 22b0b5014be7911406b262aeb0864d36f1fbbab5 Mon Sep 17 00:00:00 2001
> +From: Petr Hodina <[email-masked]>
> +Date: Wed, 19 Jan 2022 14:52:08 +0100
> +Subject: [PATCH] Remove code dependent on QSimpleUpdater. Don't include
> + qwt.pri, qtcsv.pri and qmqtt.pri.

Ideally, the disabling of QSimpleUpdater would be configurable at build
time and upstreamed.  The patch is not registered in gnu/local.mk in
this commit, although the commit log says it should be.

[...]

> diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
> index 4621de0dad..d0521b4894 100644
> --- a/gnu/packages/qt.scm
> +++ b/gnu/packages/qt.scm
> @@ -3017,6 +3017,78 @@ (define (delete-unwanted-files child stat flag base level)
>  system libraries.")
>      (license license:lgpl2.1+)))
>  
> +(define-public serial-studio
> +  (package
> +    (name "serial-studio")
> +    (version "1.1.4")
> +    (source (origin
> +              (method git-fetch)
> +              (uri (git-reference
> +                    (url "https://github.com/Serial-Studio/Serial-Studio")
> +                    (commit (string-append "v" version))))
> +              (file-name (git-file-name name version))
> +              (patches (search-patches
> +                        "serial-studio-remove-qsimple-updater.patch"))
> +              (modules '((guix build utils) (ice-9 ftw)
> +                         (srfi srfi-1)))

I think the only module you require in your snippet is (guix build
utils).

> +              (snippet '(begin
> +                          (with-directory-excursion "libs"
> +                                                    (for-each
> +                                                     delete-file-recursively
> +                                                     '("qwt" "qtcsv" "qmqtt"
> +                                                       "QSimpleUpdater")))))
> +              (sha256
> +               (base32
> +                "0qww2pmbvmq3cjx3xk8rxq0zf54y0b0j8bykn4aq3d2dii44m85y"))))
> +    (build-system qt-build-system)
> +    (arguments
> +     `(#:tests? #f ;no test suite

Please use (list #:tests? #f #:phases #~(modify-phases %standard-phases
 [...] for new packages definitions.

> +       #:phases
> +       (modify-phases %standard-phases
> +         (replace 'configure
> +           (lambda* (#:key outputs inputs #:allow-other-keys)
> +             (substitute* "Serial-Studio.pro"
> +               (("/usr") (assoc-ref outputs "out"))
> +               (("INCLUDEPATH \\+= src") (string-append "INCLUDEPATH += src
> +INCLUDEPATH += "
> +                                                        (assoc-ref inputs
> +                                                                   "qwt")
> +                                                        "/include/qwt
> +"
> +                                                        "LIBS += -L"
> +                                                        (assoc-ref inputs
> +                                                                   "qwt")
> +                                                        "/lib"
> +                                                        " -lqwt
> +"
> +                                                        "LIBS += -L"
> +                                                        (assoc-ref inputs
> +                                                                   "qtcsv")
> +                                                        "/lib"
> +                                                        " -lqtcsv
> +"
> +                                                        "LIBS += -L"
> +                                                        (assoc-ref inputs
> +                                                                   "qmqtt")
> +                                                        "/lib"
> +                                                        " -lQt5Qmqtt")))

The above indentation appears squashed right :-).  I'd bring the
(string-append "INCLUDEPATH += src [...] on a new line, which will help
the rest fit more nicely.

> +             (invoke "qmake"))))))
> +    (native-inputs (list qwt qttools pkg-config))

Please sort inputs.

> +    (inputs (list qtcsv
> +                  qmqtt
> +                  qwt
> +                  qtbase-5
> +                  qtserialport
> +                  qtsvg-5
> +                  qtdeclarative-5
> +                  qtquickcontrols2-5))

Ditto.

> +    (home-page "https://github.com/Serial-Studio/Serial-Studio")
> +    (synopsis "Multi-purpose serial data visualization & processing
> program")

Replace "&" with "and".

> +    (description
> +     "This package provides multi-purpose serial data visualization
> +and processing GUI program.")

This leaves me wanting to know a bit more, but upstream doesn't provide
much help, so OK.

> +    (license license:expat)))
> +
>  (define-public single-application-qt5
>    ;; Change in function signature, nheko requires at least this commit
>    (let ((commit "dc8042b5db58f36e06ba54f16f38b16c5eea9053"))

-- 
Thanks,
Maxim