unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Marius Bakke <mbakke@fastmail.com>
To: "Wiktor Żelazny" <wz@freeshell.de>, 38150@debbugs.gnu.org
Subject: [bug#38150] [WIP] gnu: Add grass.
Date: Sat, 09 Nov 2019 23:46:55 +0100	[thread overview]
Message-ID: <87d0e0mzvk.fsf@devup.no> (raw)
In-Reply-To: <20191109113154.20481-1-wz@freeshell.de>

[-- Attachment #1: Type: text/plain, Size: 5171 bytes --]

Hello Wiktor,

Wiktor Żelazny <wz@freeshell.de> writes:

> From: Wiktor Żelazny <wzelazny@vurv.cz>
>
> * gnu/packages/geo.scm (grass): New variable.
> No GUI due to wxpython not found on runtime.
> ---
> Another GIS beast. This one builds, at least on my machine, but
>    $ grass78
>    Starting GRASS GIS...
>    ERROR: wxGUI requires wxPython. No module named 'wx'
> Perhaps this is something specific to Python module treatment by Guix.

No doubt!

> Only one of these
>    guix environment python python-wxpython
>    guix environment python --ad-hoc python-wxpython
>    guix environment --ad-hoc python python-wxpython
> , for instance, gives a desired result.

I'm guessing it's the latter?  :-)

The issue has to do with how Python modules are located at run-time.
Adding 'python' to the environment will populate the PYTHONPATH variable
with all packages in the profile that have a
'/lib/python3.7/site-packages' directory in its output.  Without
'python', Guix does not know that this variable should exist (see
<https://bugs.gnu.org/22138>).

To overcome this, the common approach is to wrap the executable with the
required variables, along these lines:

(wrap-program (string-append out "/bin/grass")
  `("PYTHONPATH" ":" prefix (,(string-append wxpython "/lib/python"
                                             (python-version python)
                                             "/site-packages"))))

Can you try that?

Some comments on the patch itself:

> +(define-public grass
> +  (package
> +    (name "grass")
> +    (version "7.8.0")
> +    (source
> +      (origin
> +        (method url-fetch)
> +        (uri (string-append
> +               "https://grass.osgeo.org/" name
> +               (match (string-split version #\.)
> +                      ((major minor _ ...)
> +                       (string-append major minor)))
> +               "/source/" name "-" version ".tar.gz"))
> +        ;; md5sum checked

We don't really need to acknowledge that we've verified checksums; it's
explicitly part of the packaging process per the "Submitting patches"
section of the manual.  Besides, MD5SUMs are not useful for security
these days, as it has become trivial to forge.

> +        (sha256
> +          (base32
> +            "1ynclznkpnm18vi0brmbfcplgi15yd7lwd424abgv7wm9qlr44ab"))))

Indentation seems to be off here.  If you are not using Emacs, please
run ./etc/indent-code.el on this file.

> +    (build-system gnu-build-system)
> +    (arguments
> +     '(#:phases
> +       (modify-phases %standard-phases
> +         ;; Replace configure phase as the ./configure script does not like
> +         ;; CONFIG_SHELL and SHELL passed as parameters
> +         (replace 'configure
> +           (lambda* (#:key outputs build target #:allow-other-keys)
> +             (let* ((out   (assoc-ref outputs "out"))
> +                    (bash  (which "bash"))
> +                    (flags `(,(string-append "--prefix=" out)

Note: you can use (list (string-append ...) ...) here instead of
quote/unquote.

> +                             ,(string-append "--build=" build)
> +                             ;; Fix `Unable to locate FreeType includes.'
> +                             ,(string-append
> +                                  "--with-freetype-includes="
> +                                  (assoc-ref %build-inputs "freetype")
> +                                  "/include/freetype2")
> +                             ;; Fix `Unable to locate PROJ data files.'

I'm not sure this (and the previous) comment add anything: it's fairly
obvious that these flags are here to tell the build system where to find
these files.

> +                             ,(string-append
> +                                  "--with-proj-share="
> +                                  (assoc-ref %build-inputs "proj.4")
> +                                  "/share/proj")
> +                             ,"--with-postgres")))
                                ^
This line does not need to be unquoted.

> +               (setenv "CONFIG_SHELL" bash)
> +               (apply invoke bash "./configure" flags)))))
> +        #:tests? #f))  ;no check target
> +    (native-inputs
> +      `(("flex" ,flex)
> +        ("bison" ,bison)
> +        ("pkg-config" ,pkg-config)
> +        ("python" ,python)
> +        ("python-six" ,python-six)))

I'm surprised to see python-six as a native-input, do you know what it's
used for?

> +    (inputs
> +      `(("proj.4" ,proj.4)
> +        ("gdal" ,gdal)
> +        ("zlib" ,zlib)
> +        ("zstd:lib" ,zstd "lib")
> +        ("libtiff" ,libtiff)
> +        ("libpng" ,libpng)
> +        ("sqlite" ,sqlite)
> +        ("freeglut" ,freeglut)
> +        ("fftw" ,fftw)
> +        ("cairo" ,cairo)
> +        ("freetype" ,freetype)
> +        ("libxt" ,libxt)
> +        ("python-wxpython" ,python-wxpython) ;; for gui
                                                ^
Nit-pick: Only one semicolon in margin comments.

Apart from these minor remarks, the patch looks great :-)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

  reply	other threads:[~2019-11-09 22:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-09 11:31 [bug#38150] [WIP] gnu: Add grass Wiktor Żelazny
2019-11-09 22:46 ` Marius Bakke [this message]
2019-11-12 15:04   ` [bug#38178] [WIP v2] " Wiktor Żelazny
     [not found]     ` <handler.38178.B.15735711166598.ack@debbugs.gnu.org>
2019-11-14 15:30       ` Wiktor Żelazny
2020-03-21 20:21         ` Marius Bakke
2020-03-22  8:57           ` Guillaume Le Vaillant
2020-03-24 10:57             ` bug#38178: " Guillaume Le Vaillant
2020-03-24 21:16           ` [bug#38178] " Wiktor Żelazny
2020-03-24 21:19             ` Wiktor Żelazny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d0e0mzvk.fsf@devup.no \
    --to=mbakke@fastmail.com \
    --cc=38150@debbugs.gnu.org \
    --cc=wz@freeshell.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).