diff mbox series

[bug#36623] gnu: gdal: add python support

Message ID 20190712213247.23250-1-arne_bab@web.de
State Accepted
Headers show
Series [bug#36623] gnu: gdal: add python support | expand

Commit Message

Dr. Arne Babenhauserheide July 12, 2019, 9:32 p.m. UTC
* gnu/packages/geo.scm (gdal): add python support
---
 gnu/packages/geo.scm | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

--
2.22.0

Comments

Julien Lepiller July 13, 2019, 8:15 a.m. UTC | #1
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?

>     (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.

>     (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!
diff mbox series

Patch

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)
+           ))))
     (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