diff mbox

gnu: Add qscintilla.

Message ID 87wpi7imww.fsf@openmailbox.org
State New
Headers show

Commit Message

Kei Yamashita Sept. 19, 2016, 9:45 p.m. UTC
Leo Famulari <leo@famulari.name> writes:

> On Mon, Sep 19, 2016 at 10:47:56AM -0400, Kei Kebreau wrote:
>> Using
>> 
>>   #:use-module (gnu packages qt)
>> 
>> and
>> 
>>   (define qscintilla-qt4
>>     (package
>>       (inherit qscintilla)
>>       ...))
>> 
>> gives me an unbound variable error. Any idea what's going wrong here?
>
> Can you send the patch that gives the error?

Sure thing. It's the combination of these two patches.
From f60fc09f3f200276b2789a5e305efd5df17666d2 Mon Sep 17 00:00:00 2001
From: Kei Kebreau <kei@openmailbox.org>
Date: Mon, 19 Sep 2016 10:09:33 -0400
Subject: [PATCH] gnu: Add qscintilla.

* gnu/packages/qt.scm (qscintilla): New variable.
---
 gnu/packages/qt.scm | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

Comments

Leo Famulari Sept. 19, 2016, 11:52 p.m. UTC | #1
On Mon, Sep 19, 2016 at 05:45:35PM -0400, Kei Kebreau wrote:
> * gnu/packages/qt.scm (qscintilla): New variable.

> +              (uri (string-append "mirror://sourceforge/QScintilla2/QScintilla-"
> +                                  version "/QScintilla_gpl-" version ".tar.gz"))

This URI returns 404. It needs 'pyqt' inserted after 'sourceforge':

s!sourceforge/Qscintilla2!sourceforge/pyqt/Qscintilla2!

I'm not sure yet about the other problem. I tried to define 'hi', which
inherits from 'hello', and I got a similar error.
Ricardo Wurmus Sept. 22, 2016, 7:02 p.m. UTC | #2
Leo Famulari <leo@famulari.name> writes:

> I'm not sure yet about the other problem. I tried to define 'hi', which
> inherits from 'hello', and I got a similar error.

I don’t understand this.  What is the problem here?

I’m successfully inheriting from packages in other modules.  For
example, we have a separate module for bioinformatics variants.  The
module uses the upstream bioinformatics module and adds its own variants
of existing packages using inheritance.

~~ Ricardo
Leo Famulari Sept. 24, 2016, 3:30 a.m. UTC | #3
On Thu, Sep 22, 2016 at 09:02:20PM +0200, Ricardo Wurmus wrote:
> 
> Leo Famulari <leo@famulari.name> writes:
> 
> > I'm not sure yet about the other problem. I tried to define 'hi', which
> > inherits from 'hello', and I got a similar error.
> 
> I don’t understand this.  What is the problem here?
> 
> I’m successfully inheriting from packages in other modules.  For
> example, we have a separate module for bioinformatics variants.  The
> module uses the upstream bioinformatics module and adds its own variants
> of existing packages using inheritance.

I was getting failures reminiscent of an ABI break. But, I can't
reproduce it now.

Kei, maybe you should try applying the patches to a fresh Git checkout?
If they work like that, then I think it's okay to push, assuming the
qscintilla URL is fixed.
Kei Yamashita Sept. 24, 2016, 5:13 a.m. UTC | #4
Leo Famulari <leo@famulari.name> writes:

> On Thu, Sep 22, 2016 at 09:02:20PM +0200, Ricardo Wurmus wrote:
>> 
>> Leo Famulari <leo@famulari.name> writes:
>> 
>> > I'm not sure yet about the other problem. I tried to define 'hi', which
>> > inherits from 'hello', and I got a similar error.
>> 
>> I don’t understand this.  What is the problem here?
>> 
>> I’m successfully inheriting from packages in other modules.  For
>> example, we have a separate module for bioinformatics variants.  The
>> module uses the upstream bioinformatics module and adds its own variants
>> of existing packages using inheritance.
>
> I was getting failures reminiscent of an ABI break. But, I can't
> reproduce it now.
>
> Kei, maybe you should try applying the patches to a fresh Git checkout?
> If they work like that, then I think it's okay to push, assuming the
> qscintilla URL is fixed.

No luck...
Leo Famulari Sept. 25, 2016, 5:05 p.m. UTC | #5
On Sat, Sep 24, 2016 at 01:13:33AM -0400, Kei Kebreau wrote:
> Leo Famulari <leo@famulari.name> writes:
> > I was getting failures reminiscent of an ABI break. But, I can't
> > reproduce it now.
> >
> > Kei, maybe you should try applying the patches to a fresh Git checkout?
> > If they work like that, then I think it's okay to push, assuming the
> > qscintilla URL is fixed.
> 
> No luck...

Hm, how about if you apply the first patch, `make`, then apply the
second patch, and `make` again? Or some dance like that. Maybe deleting
one of qt.go or maths.go in between. Something like that worked for me
but I don't remember all the steps.

Of course that is not acceptable for code pushed to the master branch,
but if you figure out how to reproduce a "successful" case, it will make
this easier to debug.
Kei Yamashita Sept. 25, 2016, 7:25 p.m. UTC | #6
Leo Famulari <leo@famulari.name> writes:

> On Sat, Sep 24, 2016 at 01:13:33AM -0400, Kei Kebreau wrote:
>> Leo Famulari <leo@famulari.name> writes:
>> > I was getting failures reminiscent of an ABI break. But, I can't
>> > reproduce it now.
>> >
>> > Kei, maybe you should try applying the patches to a fresh Git checkout?
>> > If they work like that, then I think it's okay to push, assuming the
>> > qscintilla URL is fixed.
>> 
>> No luck...
>
> Hm, how about if you apply the first patch, `make`, then apply the
> second patch, and `make` again? Or some dance like that. Maybe deleting
> one of qt.go or maths.go in between. Something like that worked for me
> but I don't remember all the steps.
>
> Of course that is not acceptable for code pushed to the master branch,
> but if you figure out how to reproduce a "successful" case, it will make
> this easier to debug.

I found a lead on our problem!

Applying the qscintilla patch and building it with `guix build` works
fine.

Applying the qscintilla-qt4 patch (not even the octave one) and building
octave with `guix build` gives me the following:

  In unknown file:
     ?: 0 [memoize-variable-access! #<memoized fftw> #<directory # 51eaf30>]

  ERROR: In procedure memoize-variable-access!:
  ERROR: Unbound variable: fftw

I doubt that anything is wrong with the fftw package, because I'm only
given the error when I define qscintilla-qt4 (public or not). Should I
be doing something like what is done with the curl package,
i.e. defining the replacement variable? I'm kind of confused by this situation.
Ludovic Courtès Oct. 3, 2016, 4:17 p.m. UTC | #7
Kei Kebreau <kei@openmailbox.org> skribis:

> From ae862b8a51d15f165dc9b40dc46c2e209736f3a8 Mon Sep 17 00:00:00 2001
> From: Kei Kebreau <kei@openmailbox.org>
> Date: Mon, 19 Sep 2016 10:11:20 -0400
> Subject: [PATCH] gnu: Add qscintilla-qt4.
>
> * gnu/packages/maths.scm (qscintilla-qt4): New variable.
> ---
>  gnu/packages/maths.scm | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
> index 44a24ef..829fc7a 100644
> --- a/gnu/packages/maths.scm
> +++ b/gnu/packages/maths.scm
> @@ -77,6 +77,7 @@
>    #:use-module (gnu packages perl)
>    #:use-module (gnu packages pkg-config)
>    #:use-module (gnu packages python)
> +  #:use-module (gnu packages qt)
>    #:use-module (gnu packages readline)
>    #:use-module (gnu packages tbb)
>    #:use-module (gnu packages shells)
> @@ -747,6 +748,16 @@ Work may be performed both at the interactive command-line as well as via
>  script files.")
>      (license license:gpl3+)))
>  
> +;; required for Octave until its GUI is updated to Qt 5
> +(define qscintilla-qt4
> +  (package
> +    (inherit qscintilla)
> +    (name "qscintilla-qt4")
> +    (native-inputs
> +     `(("python-pyqt" ,python-pyqt-4)
> +       ("qt" ,qt-4))) ; for qmake
> +    (synopsis "Qt4 port of the Scintilla editing component")))

In general we must not have packages that inherit from packages coming
from another module.

This restriction stems from the fact that there are circular
dependencies among (gnu packages …) modules.  Here, running the
top-level of (gnu packages maths) requires evaluating the top-level of
(gnu packages qt), which in turn presumably requires evaluating the
top-level of (gnu packages maths).  Boom.

The solution would be to move this package variant in the same module as
qscintilla itself.  Is it OK?

HTH,
Ludo’.
diff mbox

Patch

diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index a482d75..b6a649f 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -4,6 +4,7 @@ 
 ;;; Copyright © 2015 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2015, 2016 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
+;;; Copyright © 2016 Kei Kebreau <kei@openmailbox.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1112,3 +1113,45 @@  contain over 620 classes.")
       "QtKeychain is a Qt library to store passwords and other secret data
 securely.  It will not store any data unencrypted unless explicitly requested.")
     (license license:bsd-3)))
+
+(define-public qscintilla
+  (package
+    (name "qscintilla")
+    (version "2.9.3")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://sourceforge/QScintilla2/QScintilla-"
+                                  version "/QScintilla_gpl-" version ".tar.gz"))
+              (sha256
+               (base32
+                "0znvdncpj64zcpbkyvj11dm8bdc3nfn5girggj33ammhfcyvkalq"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-before 'configure 'change-directory
+           (lambda _ (chdir "Qt4Qt5") #t))
+         (replace 'configure
+           (lambda _ (zero? (system* "qmake" "qscintilla.pro"))))
+         (add-before 'install 'fix-Makefiles
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let ((out    (assoc-ref outputs "out"))
+                   (qt (assoc-ref inputs "qt")))
+               (substitute* (find-files "." "Makefile")
+                 (((string-append "INSTALL_ROOT)" qt))
+                   (string-append "INSTALL_ROOT)" out))))
+             #t)))))
+    (native-inputs
+     `(("python-pyqt" ,python-pyqt)
+       ("qt" ,qtbase))) ; for qmake
+    (home-page "https://www.riverbankcomputing.com/software/qscintilla/intro")
+    (synopsis "Qt5 port of the Scintilla editing component")
+    (description
+     "QScintilla is a port to Qt of Neil Hodgson's Scintilla C++ editor control.
+As well as features found in standard text editing components, QScintilla
+includes features especially useful when editing and debugging source code.
+These include support for syntax styling, error indicators, code completion and
+call tips.")
+    (license (list license:bsd-2 ; Python/configure.py
+                   license:expat ; src/ and include/
+                   license:gpl3))))