Subject: [bug#30259] [PATCH] gnu: octave: Add audio and Qt GUI support.

From: Kei Kebreau <[email-masked]>
Date: Sat, 27 Jan 2018 16:14:52 -0500

[email-masked] writes:

> On Fri, 26 Jan 2018, Kei Kebreau <[email-masked]> wrote:
>> [email-masked] writes:
>>
>>> On Fri, 26 Jan 2018, [email-masked] wrote:
>>>> On Fri, 26 Jan 2018, Kei Kebreau <[email-masked]> wrote:
>>>>> * gnu/packages/maths.scm (octave)[inputs]: Add qscintilla, qt, suitesparse,
>>>>> libsndfile, portaudio and alsa-lib.
>>>>> [native-inputs]: Add qttools.
>>>>> [arguments]: Add 'patch-qscintilla-library-name' phase.
>>>>
>>>> Woo! Nice :) I've started work on the Qt GUI a while ago but
>>>> never finished it. Do you think we should split this into octave
>>>> and octave-qt (or octave-gui)? Qt is quiet huge and not everyone
>>>> will want this I think.
>>>>
>>>> Building this now and getting back to you with results.
>>>>
> […]
>>> Build, compiled, installed, LGTM and works for me. At least the
>>> minimal basics I've tested.
>>>
>>
>> Excellent! Thanks for testing this.
>>
>>> However I still think we should split it later on. I'm not sure
>>> if other systems just provide it in one piece or if they provide
>>> octave-cli, octave-qt, etc.
>>> In my scenario we don't have substitutes for Qt all the time and
>>> someone running a
>>> machine which isn't capable of building Qt wants to use octave.
>>
>> I agree that this package should be split. Should a split be made now
>> while we leave the lighter CLI-only Octave package available on master,
>> or should it be postponed until later on?
>>
>
> It could be done later on, but if you think it wouldn't be too
> much work you could do it now.

Done, I think!

> Ideally this would leave 'octave' as it is and add
> 'octave-whatever' ... octave-qt? Debian calls the package (with
> just the Qt Gui) "qtoctave". octave-* should be reserved for
> extensions (which we don't have right now), so maybe qtoctave
> would fit into our naming scheme?
>
>
>  / I think I'm going to switch the subscribed address once more,
>  now that I have proper filtering I don't need the server-side
>  filtering. /

Can you (and/or any bystanders reading this) test these?

From da42c35c7d779c99a198e73d2872f5cde5401134 Mon Sep 17 00:00:00 2001
From: Kei Kebreau <[email-masked]>
Date: Fri, 26 Jan 2018 10:08:52 -0500
Subject: [PATCH 1/2] gnu: octave: Add audio and more sparse matrix support.

* gnu/packages/maths.scm (octave)[inputs]: Add suitesparse, libsndfile, portaudio and alsa-lib.
---
 gnu/packages/maths.scm | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index bce662737..bbfd41b1e 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -11,7 +11,7 @@
 ;;; Copyright © 2015, 2016, 2017 Efraim Flashner <[email-masked]>
 ;;; Copyright © 2015 Fabian Harfert <[email-masked]>
 ;;; Copyright © 2016 Roel Janssen <[email-masked]>
-;;; Copyright © 2016 Kei Kebreau <[email-masked]>
+;;; Copyright © 2016, 2018 Kei Kebreau <[email-masked]>
 ;;; Copyright © 2016, 2017 Ludovic Courtès <[email-masked]>
 ;;; Copyright © 2016 Leo Famulari <[email-masked]>
 ;;; Copyright © 2016, 2017 Thomas Danckaert <[email-masked]>
@@ -52,6 +52,7 @@
   #:use-module (guix build-system ocaml)
   #:use-module (guix build-system r)
   #:use-module (gnu packages algebra)
+  #:use-module (gnu packages audio)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages boost)
@@ -74,6 +75,7 @@
   #:use-module (gnu packages image)
   #:use-module (gnu packages java)
   #:use-module (gnu packages less)
+  #:use-module (gnu packages linux)
   #:use-module (gnu packages lisp)
   #:use-module (gnu packages logging)
   #:use-module (gnu packages lua)
@@ -91,6 +93,7 @@
   #:use-module (gnu packages popt)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages pulseaudio)
   #:use-module (gnu packages python)
   #:use-module (gnu packages python-web)
   #:use-module (gnu packages readline)
@@ -1310,7 +1313,11 @@ can solve two kinds of problems:
        ("zlib" ,zlib)
        ("curl" ,curl)
        ("texinfo" ,texinfo)
-       ("graphicsmagick" ,graphicsmagick)))
+       ("graphicsmagick" ,graphicsmagick)
+       ("suitesparse" ,suitesparse)
+       ("libsndfile" ,libsndfile)
+       ("portaudio" ,portaudio)
+       ("alsa-lib" ,alsa-lib)))
     (native-inputs
      `(("lzip" ,lzip)
        ("gfortran" ,gfortran)
-- 
2.16.1

From a4cb4580413f81f83a57cd046e5a0d228e9b9aff Mon Sep 17 00:00:00 2001
From: Kei Kebreau <[email-masked]>
Date: Sat, 27 Jan 2018 16:06:13 -0500
Subject: [PATCH 2/2] gnu: Add qtoctave.

* gnu/packages/maths.scm (qtoctave): New variable.
---
 gnu/packages/maths.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index bbfd41b1e..b7ae069ad 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -96,6 +96,7 @@
   #:use-module (gnu packages pulseaudio)
   #:use-module (gnu packages python)
   #:use-module (gnu packages python-web)
+  #:use-module (gnu packages qt)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages tbb)
   #:use-module (gnu packages scheme)
@@ -1357,6 +1358,31 @@ Work may be performed both at the interactive command-line as well as via
 script files.")
     (license license:gpl3+)))
 
+(define-public qtoctave
+  (package (inherit octave)
+    (name "qtoctave")
+    (inputs
+     `(("qscintilla" ,qscintilla)
+       ("qt" ,qtbase)
+       ,@(package-inputs octave)))
+    (native-inputs
+     `(("qttools" , qttools) ;for lrelease
+       ,@(package-native-inputs octave)))
+    (arguments
+     (substitute-keyword-arguments (package-arguments octave)
+       ((#:phases phases)
+        `(modify-phases ,phases
+           (add-before 'configure 'patch-qscintilla-library-name
+             (lambda* (#:key inputs #:allow-other-keys)
+               ;; The QScintilla library that the Octave configure script tries
+               ;; to link with should be named libqscintilla-qt5.so, but the
+               ;; QScintilla input provides the shared library as
+               ;; libqscintilla2_qt5.so.
+               (substitute* "configure"
+                 (("qscintilla2-qt5")
+                  "qscintilla2_qt5"))
+               #t))))))))
+
 (define-public opencascade-oce
   (package
     (name "opencascade-oce")
-- 
2.16.1