Subject: [bug#44492] [PATCH v5 09/51] gnu: Add rust-gspell-sys-0.4.

From: Leo Prikler <[email-masked]>
Date: Tue, 16 Mar 2021 14:12:59 +0100

Am Dienstag, den 16.03.2021, 14:42 +0200 schrieb Efraim Flashner:
> Sometimes the rust-*-sys packages bundle the source code for the
> package
> they wrap, is that the case here? That it wants pkg-config is good,
> but
> it's worth checking.
As far as I'm aware, none of the GNOME crates do this.  Fractal would
even use a version of the gettext crate, that doesn't bundle gettext,
but alas, we ship the bundled one in Guix.

> On Mon, Mar 15, 2021 at 04:43:42PM +0100, Leo Prikler wrote:
> > * gnu/packages/crates-gtk.scm (rust-gspell-sys-0.4): New variable.
> > ---
> >  gnu/packages/crates-gtk.scm | 48
> > ++++++++++++++++++++++++++++++++++++-
> >  1 file changed, 47 insertions(+), 1 deletion(-)
> > 
> > diff --git a/gnu/packages/crates-gtk.scm b/gnu/packages/crates-
> > gtk.scm
> > index 0d72fbf321..09aa79daba 100644
> > --- a/gnu/packages/crates-gtk.scm
> > +++ b/gnu/packages/crates-gtk.scm
> > @@ -26,7 +26,8 @@
> >    #:use-module (gnu packages crates-io)
> >    #:use-module (gnu packages crates-graphics)
> >    #:use-module (gnu packages glib)
> > -  #:use-module (gnu packages gtk))
> > +  #:use-module (gnu packages gtk)
> > +  #:use-module (gnu packages pkg-config))
> >  
> >  ;;;
> >  ;;; Please: Try to add new module packages in alphabetic order.
> > @@ -887,6 +888,51 @@
> >         (("rust-shell-words" ,rust-shell-words-0.1)
> >          ("rust-tempfile" ,rust-tempfile-3))))))
> >  
> > +(define-public rust-gspell-sys-0.4
> > +  (package
> > +    (name "rust-gspell-sys")
> > +    (version "0.4.0")
> > +    (source
> > +     (origin
> > +       (method url-fetch)
> > +       (uri (crate-uri "gspell-sys" version))
> > +       (file-name
> > +        (string-append name "-" version ".tar.gz"))
> > +       (sha256
> > +        (base32
> > +         "07snannzd36wlms2x880ylkq7h1162g0kv9y54wlrc2nd11kjc2c")))
> > )
> > +    (build-system cargo-build-system)
> > +    (arguments
> > +     `(#:cargo-inputs
> > +       (("rust-glib-sys" ,rust-glib-sys-0.9)
> > +        ("rust-gobject-sys" ,rust-gobject-sys-0.9)
> > +        ("rust-gtk-sys" ,rust-gtk-sys-0.9)
> > +        ("rust-libc" ,rust-libc-0.2)
> > +        ("rust-pkg-config" ,rust-pkg-config-0.3))
> > +       #:cargo-development-inputs
> > +       (("rust-shell-words" ,rust-shell-words-0.1)
> > +        ("rust-tempfile" ,rust-tempfile-3))
> > +       #:phases
> > +       (modify-phases %standard-phases
> > +         (add-before 'check 'pre-check
> > +           (lambda* (#:key inputs #:allow-other-keys)
> > +             (setenv "CC" (which "gcc"))
> 
> Even if it can't be cross compiled now it should still be
> (cc-for-target)
Good catch, will do so in v8.

> > +             #t)))))
> > +    (native-inputs
> > +     `(("pkg-config" ,pkg-config)))
> > +    (inputs
> > +     `(("atk" ,atk)
> > +       ("cairo" ,cairo)
> > +       ("glib" ,glib)
> > +       ("gspell" ,(module-ref (resolve-module '(gnu packages
> > gnome))
> > +                              'gspell))
> 
> Unless there's a problem with circular package modules you should
> really
> just import gnome into the package module.
That's exactly the problem though.  Rust packages in gnome.scm need
stuff from crates-gtk and doing it this way helps resolve the issue. 
Should I add a comment about that?

Regards,
Leo