unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Arne Babenhauserheide <arne_bab@web.de>
To: Julien Lepiller <julien@lepiller.eu>
Cc: 36623@debbugs.gnu.org
Subject: [bug#36623] [PATCH] gnu: gdal: add python support
Date: Sat, 13 Jul 2019 23:14:56 +0200	[thread overview]
Message-ID: <87pnmdr60f.fsf@web.de> (raw)
In-Reply-To: <5E0BF317-99AC-43D9-9E30-1528A1A61DAA@lepiller.eu>


[-- Attachment #1.1: Type: text/plain, Size: 3746 bytes --]


Julien Lepiller <julien@lepiller.eu> writes:

> Le 12 juillet 2019 23:32:47 GMT+02:00, Arne Babenhauserheide <arne_bab@web.de> a écrit :
>>* gnu/packages/geo.scm (gdal): add python support
>>---
>> gnu/packages/geo.scm | 29 +++++++++++++++++++++++++++--
>> 1 file changed, 27 insertions(+), 2 deletions(-)
>>
>>diff --git a/gnu/packages/geo.scm b/gnu/packages/geo.scm
>>index 4cccd97643..3e2ec04b53 100644
>>--- a/gnu/packages/geo.scm
>>+++ b/gnu/packages/geo.scm
>>@@ -537,6 +537,8 @@ development.")
>>     (build-system gnu-build-system)
>>     (arguments
>>      `(#:tests? #f
>>+       ;; validating runpath does not work yet for Python, so skip
>>this phase.
>>+       #:validate-runpath? #f
>>        #:configure-flags
>>        (let-syntax ((with (syntax-rules ()
>>                             ((_ option input)
>>@@ -544,6 +546,10 @@ development.")
>>                                   (assoc-ref %build-inputs input))))))
>>          (list
>>            ;; TODO: --with-pcidsk, --with-pcraster
>>+           ;; Add $libdir to the RUNPATH of all the executables.
>>+           (string-append "LDFLAGS=-Wl,-rpath=" %output "/apps/.libs")
>>+           (string-append "LD_RUN_PATH=" %output "/apps/.libs")
>>+           (string-append "LD_LIBRARY_PATH=" %output "/apps/.libs")
>>            (with "--with-freexl" "freexl")
>>            (with "--with-libjson-c" "json-c")
>>            (with "--with-png" "libpng")
>>@@ -553,13 +559,27 @@ development.")
>>            (with "--with-libtiff" "libtiff")
>>            (with "--with-geotiff" "libgeotiff")
>>            (with "--with-libz" "zlib")
>>-           "--with-pcre"))
>>+           "--with-pcre"
>>+           "--with-python"))
>>        #:phases
>>        (modify-phases %standard-phases
>>          (add-before 'build 'fix-path
>>            (lambda _
>>              (substitute* "frmts/mrf/mrf_band.cpp"
>>-               (("\"../zlib/zlib.h\"") "<zlib.h>")))))))
>>+               (("\"../zlib/zlib.h\"") "<zlib.h>"))))
>>+         (add-after
>>+             'unpack 'patch-test-shebangs
>>+           (lambda _
>>+             (substitute* '("apps/GNUmakefile")
>>+               (("/bin/sh") (which "sh")))
>>+             #t))
>>+         (add-after
>>+             'unpack 'patch-test-shebangs
>>+           (lambda _
>>+             (substitute* '("GDALmake.opt.in")
>>+               (("LDFLAGS     = @LDFLAGS@") (string-append "LDFLAGS   
>>= @LDFLAGS@ -Wl,-rpath=" %output "/apps -Wl,-rpath=" %output
>>"/apps/.libs")))
>>+             #t)
>>+           ))))
>
> Could you rename that phase to something like 'patch-rpath? Is it needed since you already pass it to the configure?

Renamed, see the new patch :-)

I did not get this to work without it.

>>     (inputs
>>      `(("freexl" ,freexl)
>>        ("geos" ,geos)
>>@@ -572,6 +592,11 @@ development.")
>>        ("libwebp" ,libwebp)
>>        ("pcre" ,pcre)
>>        ("zlib" ,zlib)))
>>+    (native-inputs
>>+     `(("pkg-config" ,pkg-config)))
>>+    (propagated-inputs
>>+     `(("python" ,python)
>>+       ("python-setuptools" ,python-setuptools)))
>
> Is setuptools really necessary at runtime? Can we patch gdal so to embed python's store path? I'd prefer not to propagate it.

I’m not really sure why it is, but I did not get it working
without. Activating Python-support was harder than I thought (but I need
it working for a project on a deadline).

>>     (home-page "http://www.gdal.org/")
>>     (synopsis "Raster and vector geospatial data format library")
>>(description "GDAL is a translator library for raster and vector
>>geospatial
>>--
>>2.22.0
>
> Thank you!

Thank you for reviewing!


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-gnu-gdal-add-python-support.patch --]
[-- Type: text/x-patch, Size: 3101 bytes --]

From 5f8b1dc1bb5ce7b061bcca10174f9330cf89696c Mon Sep 17 00:00:00 2001
From: Arne Babenhauserheide <arne_bab@web.de>
Date: Sat, 11 May 2019 15:16:22 +0200
Subject: [PATCH] gnu: gdal: add python support

* gnu/packages/geo.scm (gdal): add python support
---
 gnu/packages/geo.scm | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/geo.scm b/gnu/packages/geo.scm
index 4cccd97643..a6942d2a45 100644
--- a/gnu/packages/geo.scm
+++ b/gnu/packages/geo.scm
@@ -537,6 +537,8 @@ development.")
     (build-system gnu-build-system)
     (arguments
      `(#:tests? #f
+       ;; validating runpath does not work yet for Python, so skip this phase.
+       #:validate-runpath? #f
        #:configure-flags
        (let-syntax ((with (syntax-rules ()
                             ((_ option input)
@@ -544,6 +546,10 @@ development.")
                                             (assoc-ref %build-inputs input))))))
          (list
            ;; TODO: --with-pcidsk, --with-pcraster
+           ;; Add $libdir to the RUNPATH of all the executables.
+           (string-append "LDFLAGS=-Wl,-rpath=" %output "/apps/.libs")
+           (string-append "LD_RUN_PATH=" %output "/apps/.libs")
+           (string-append "LD_LIBRARY_PATH=" %output "/apps/.libs")
            (with "--with-freexl" "freexl")
            (with "--with-libjson-c" "json-c")
            (with "--with-png" "libpng")
@@ -553,13 +559,27 @@ development.")
            (with "--with-libtiff" "libtiff")
            (with "--with-geotiff" "libgeotiff")
            (with "--with-libz" "zlib")
-           "--with-pcre"))
+           "--with-pcre"
+           "--with-python"))
        #:phases
        (modify-phases %standard-phases
          (add-before 'build 'fix-path
            (lambda _
              (substitute* "frmts/mrf/mrf_band.cpp"
-               (("\"../zlib/zlib.h\"") "<zlib.h>")))))))
+               (("\"../zlib/zlib.h\"") "<zlib.h>"))))
+         (add-after
+             'unpack 'patch-test-shebangs
+           (lambda _
+             (substitute* '("apps/GNUmakefile")
+               (("/bin/sh") (which "sh")))
+             #t))
+         (add-after
+             'unpack 'patch-rpath
+           (lambda _
+             (substitute* '("GDALmake.opt.in")
+               (("LDFLAGS     = @LDFLAGS@") (string-append "LDFLAGS     = @LDFLAGS@ -Wl,-rpath=" %output "/apps -Wl,-rpath=" %output "/apps/.libs")))
+             #t)
+           ))))
     (inputs
      `(("freexl" ,freexl)
        ("geos" ,geos)
@@ -572,6 +592,11 @@ development.")
        ("libwebp" ,libwebp)
        ("pcre" ,pcre)
        ("zlib" ,zlib)))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (propagated-inputs
+     `(("python" ,python)
+       ("python-setuptools" ,python-setuptools)))
     (home-page "http://www.gdal.org/")
     (synopsis "Raster and vector geospatial data format library")
     (description "GDAL is a translator library for raster and vector geospatial
-- 
2.22.0


[-- Attachment #1.3: Type: text/plain, Size: 87 bytes --]


Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein
ohne es zu merken

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

  reply	other threads:[~2019-07-13 21:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-12 21:32 [bug#36623] [PATCH] gnu: gdal: add python support Arne Babenhauserheide
2019-07-13  8:15 ` Julien Lepiller
2019-07-13 21:14   ` Arne Babenhauserheide [this message]
2019-07-17 12:57     ` Ludovic Courtès
2019-07-17 16:22       ` Arne Babenhauserheide
2019-07-19 12:07         ` Ludovic Courtès
2019-07-19 15:06           ` Arne Babenhauserheide
2019-07-20 14:55             ` 宋文武
2019-07-21  7:48               ` Arne Babenhauserheide
2019-07-21 13:07                 ` bug#36623: " 宋文武
2019-07-22 10:23                 ` [bug#36623] " Ludovic Courtès

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=87pnmdr60f.fsf@web.de \
    --to=arne_bab@web.de \
    --cc=36623@debbugs.gnu.org \
    --cc=julien@lepiller.eu \
    /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).