all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#31175] [PATCH] gnu: Add postgis.
@ 2018-04-16  9:18 Julien Lepiller
  2018-04-17 22:26 ` Björn Höfling
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Julien Lepiller @ 2018-04-16  9:18 UTC (permalink / raw)
  To: 31175

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

Hi, here are two patches to add postgis and its dependency gdal.

[-- Attachment #2: 0001-gnu-Add-gdal.patch --]
[-- Type: text/x-patch, Size: 4863 bytes --]

From ef9ce433164c4018642d436fa5a7849ddd6c37b6 Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
Date: Mon, 16 Apr 2018 10:36:53 +0200
Subject: [PATCH 1/2] gnu: Add gdal.

* gnu/packages/geo.scm (gdal): New variable.
---
 gnu/packages/geo.scm | 93 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 93 insertions(+)

diff --git a/gnu/packages/geo.scm b/gnu/packages/geo.scm
index 9c7c071db..08c843728 100644
--- a/gnu/packages/geo.scm
+++ b/gnu/packages/geo.scm
@@ -43,6 +43,7 @@
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages image)
   #:use-module (gnu packages icu4c)
+  #:use-module (gnu packages pcre)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
   #:use-module (gnu packages statistics)
@@ -611,3 +612,95 @@ spatial data and models on top of static maps from various online sources (e.g
 Google Maps and Stamen Maps).  It includes tools common to those tasks,
 including functions for geolocation and routing.")
    (license license:gpl2)))
+
+(define-public gdal
+  (package
+    (name "gdal")
+    (version "2.2.4")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                     "http://download.osgeo.org/gdal/" version "/gdal-"
+                     version ".tar.gz"))
+              (sha256
+               (base32
+                "1951f7b69x3d1vic0rmq92q8f4bj3hbxnxmj5jl0cc3zg0isgmdr"))
+              (modules '((guix build utils)))
+              (snippet
+                `(begin
+                   ;; TODO: frmts contains a lot more bundled code.
+                   (for-each delete-file-recursively
+                     ;; bundled code
+                     '("frmts/png/libpng"
+                       "frmts/gif/giflib"
+                       "frmts/jpeg/libjpeg"
+                       "frmts/jpeg/libjpeg12"
+                       "frmts/gtiff/libtiff"
+                       "frmts/gtiff/libgeotiff"
+                       "frmts/zlib"
+                       "ogr/ogrsf_frmts/geojson/libjson"))))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f
+       #:configure-flags
+       (let-syntax ((with (syntax-rules ()
+                            ((_ option input)
+                             (string-append option "="
+                                            (assoc-ref %build-inputs input))))))
+         (list
+           ;; TODO: --with-pcidsk, --with-pcraster
+           (with "--with-freexl" "freexl")
+           (with "--with-libjson-c" "json-c")
+           (with "--with-png" "libpng")
+           (with "--with-webp" "libwebp")
+           (with "--with-gif" "giflib")
+           (with "--with-jpeg" "libjpeg")
+           (with "--with-libtiff" "libtiff")
+           (with "--with-geotiff" "libgeotiff")
+           (with "--with-libz" "zlib")
+           "--with-pcre"))
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'fix-path
+           (lambda _
+             (substitute* "frmts/mrf/mrf_band.cpp"
+               (("\"../zlib/zlib.h\"") "<zlib.h>")))))))
+    (inputs
+     `(("freexl" ,freexl)
+       ("geos" ,geos)
+       ("giflib" ,giflib)
+       ("json-c" ,json-c)
+       ("libgeotiff" ,libgeotiff)
+       ("libjpeg" ,libjpeg)
+       ("libpng" ,libpng)
+       ("libtiff" ,libtiff)
+       ("libwebp" ,libwebp)
+       ("pcre" ,pcre)
+       ("zlib" ,zlib)))
+    (home-page "http://www.gdal.org/")
+    (synopsis "Raster and vector geospation data format library")
+    (description "GDAL is a translator library for raster and vector geospatial
+data formats.  As a library, it presents a single raster abstract data model
+and single vector abstract data model to the calling application for all
+supported formats.  It also comes with a variety of useful command line
+utilities for data translation and processing.")
+    (license (list
+               ; general license
+               license:expat
+               ; frmts/gtiff/tif_float.c, frmts/pcraster/libcsf,
+               ; ogr/ogrsf_frmts/dxf/intronurbs.cpp, frmts/pdf/pdfdataset.cpp
+               ; frmts/mrf/
+               license:bsd-3
+               ; frmts/hdf4/hdf-eos/*
+               ; similar to the expat license, but without guarantee exclusion
+               (license:non-copyleft "file://frmts/hdf4/hdf-eos/README")
+               ; frmts/grib/degrib/
+               license:public-domain ; with guarantee exclusion
+               ; port/cpl_minizip*
+               ; Some bsd-inspired license
+               (license:non-copyleft "file://port/LICENCE_minizip")
+               ; alg/internal_libqhull
+               ; Some 5-clause license
+               (license:non-copyleft "file://alg/internal_libqhull/COPYING.txt")
+               ; frmts/mrf/libLERC
+               license:asl2.0))))
-- 
2.17.0


[-- Attachment #3: 0002-gnu-Add-postgis.patch --]
[-- Type: text/x-patch, Size: 3140 bytes --]

From 0f844a0c65c484d0d52e67db1f63bc2892ef0aec Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
Date: Mon, 16 Apr 2018 10:45:52 +0200
Subject: [PATCH 2/2] gnu: Add postgis.

* gnu/packages/geo.scm (postgis): New variable.
---
 gnu/packages/geo.scm | 54 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/gnu/packages/geo.scm b/gnu/packages/geo.scm
index 08c843728..1739e1e68 100644
--- a/gnu/packages/geo.scm
+++ b/gnu/packages/geo.scm
@@ -44,6 +44,7 @@
   #:use-module (gnu packages image)
   #:use-module (gnu packages icu4c)
   #:use-module (gnu packages pcre)
+  #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
   #:use-module (gnu packages statistics)
@@ -704,3 +705,56 @@ utilities for data translation and processing.")
                (license:non-copyleft "file://alg/internal_libqhull/COPYING.txt")
                ; frmts/mrf/libLERC
                license:asl2.0))))
+
+(define-public postgis
+  (package
+    (name "postgis")
+    (version "2.4.4")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://download.osgeo.org/postgis/source/postgis-"
+                                  version ".tar.gz"))
+              (sha256
+               (base32
+                "1hm8migjb53cymp4qvg1h20yqllmy9f7x0awv5450391i6syyqq6"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f
+       #:make-flags
+       (list (string-append "datadir=" (assoc-ref %outputs "out") "/share")
+             (string-append "docdir="(assoc-ref %outputs "out") "/share/doc")
+             (string-append "pkglibdir="(assoc-ref %outputs "out") "/lib")
+             (string-append "bindir=" (assoc-ref %outputs "out") "/bin"))
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'fix-install-path
+           (lambda* (#:key outputs #:allow-other-keys)
+             (substitute* '("raster/loader/Makefile" "raster/scripts/python/Makefile")
+               (("\\$\\(DESTDIR\\)\\$\\(PGSQL_BINDIR\\)")
+                (string-append (assoc-ref outputs "out") "/bin"))))))))
+    (inputs
+     `(("gdal" ,gdal)
+       ("geos" ,geos)
+       ("libxml2" ,libxml2)
+       ("pcre" ,pcre)
+       ("postgresql" ,postgresql)
+       ("proj.4" ,proj.4)))
+    (native-inputs
+     `(("perl" ,perl)
+       ("pkg-config" ,pkg-config)))
+    (home-page "https://postgis.net")
+    (synopsis "Spatial database extender for PostgreSQL")
+    (description " PostGIS is a spatial database extender for PostgreSQL
+object-relational database.  It adds support for geographic objects allowing
+location queries to be run in SQL.")
+    (license (list
+               ; General license
+               license:gpl2+
+               ; loader/dbfopen, safileio.*, shapefil.h, shpopen.c
+               license:expat
+               ; loader/getopt.*
+               license:public-domain
+               ; doc/xsl
+               license:bsd-3 ; files only say "BSD"
+               ; doc
+               license:cc-by-sa3.0))))
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bug#31175] [PATCH] gnu: Add postgis.
  2018-04-16  9:18 [bug#31175] [PATCH] gnu: Add postgis Julien Lepiller
@ 2018-04-17 22:26 ` Björn Höfling
  2018-05-09  5:44 ` Björn Höfling
  2018-05-09  6:50 ` [bug#31175] " Björn Höfling
  2 siblings, 0 replies; 6+ messages in thread
From: Björn Höfling @ 2018-04-17 22:26 UTC (permalink / raw)
  To: Julien Lepiller; +Cc: 31175

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

Hi Julien,

cool! Thanks for adding GDAL (and PostGIS). I have this on my TODO-list
but haven't done it yet because of the long license list and all the
dependencies. That's also the reason of why I haven't (yet?) done a
full review. I only noticed two things:


* Add a Copyright header for you.


On Mon, 16 Apr 2018 11:18:21 +0200
Julien Lepiller <julien@lepiller.eu> wrote:

> * gnu/packages/geo.scm (gdal): New variable.
> ---
>  gnu/packages/geo.scm | 93
> ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93
> insertions(+)

[..]

> +    (home-page "http://www.gdal.org/")
> +    (synopsis "Raster and vector geospation data format library")
This should be:                     geospatiAL 

> +    (description "GDAL is a translator library for raster and vector
> geospatial +data formats.  As a library, it presents a single raster
> abstract data model +and single vector abstract data model to the
> calling application for all +supported formats.  It also comes with a
> variety of useful command line +utilities for data translation and
> processing.")

OK.

> +    (license (list

Not looked into this.

Björn


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#31175] [PATCH] gnu: Add postgis.
  2018-04-16  9:18 [bug#31175] [PATCH] gnu: Add postgis Julien Lepiller
  2018-04-17 22:26 ` Björn Höfling
@ 2018-05-09  5:44 ` Björn Höfling
  2018-05-23 21:08   ` bug#31175: " Julien Lepiller
  2018-05-09  6:50 ` [bug#31175] " Björn Höfling
  2 siblings, 1 reply; 6+ messages in thread
From: Björn Höfling @ 2018-05-09  5:44 UTC (permalink / raw)
  To: Julien Lepiller; +Cc: 31175

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

On Mon, 16 Apr 2018 11:18:21 +0200
Julien Lepiller <julien@lepiller.eu> wrote:

> Hi, here are two patches to add postgis and its dependency gdal.

Hi Julien,

I did a concise review of GDAL now. Besides of my above remarks, I have
the following small notes:

   (license (list
               ; general license
 --> I think full-line comments should start with ";;" double semi-colons.


       ("libjpeg" ,libjpeg)

--> Can you use libjpeg-turbo?

The list of dependencies/supported algorithms could of cause be
extended, but as a first start, this is OK.

 I could successfully use in
a guix container ogr2ogr with a shapefile, transforming coordinates from
EPSG:31468 to EPSG:4326. Furthermore, I could gdal_translate a tif+tfw
into a jpeg*world-file.

Thanks,

Björn

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#31175] [PATCH] gnu: Add postgis.
  2018-04-16  9:18 [bug#31175] [PATCH] gnu: Add postgis Julien Lepiller
  2018-04-17 22:26 ` Björn Höfling
  2018-05-09  5:44 ` Björn Höfling
@ 2018-05-09  6:50 ` Björn Höfling
  2018-05-09 20:44   ` Julien Lepiller
  2 siblings, 1 reply; 6+ messages in thread
From: Björn Höfling @ 2018-05-09  6:50 UTC (permalink / raw)
  To: 31175

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

Hu Julien,

looking at PostGIS:

On Mon, 16 Apr 2018 11:18:21 +0200
Julien Lepiller <julien@lepiller.eu> wrote:

> Hi, here are two patches to add postgis and its dependency gdal.

+    (description " PostGIS is a spatial database extender for PostgreSQL

--> There is a space at the beginning.

Besides of that, this looks good.

I have successfully tried shp2pgsql. 

I have not tried and have no idea of how to use Postgresql+PostGIS
within GuixSD or with a temp database in a Guix container.

Thanks,

Björn

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#31175] [PATCH] gnu: Add postgis.
  2018-05-09  6:50 ` [bug#31175] " Björn Höfling
@ 2018-05-09 20:44   ` Julien Lepiller
  0 siblings, 0 replies; 6+ messages in thread
From: Julien Lepiller @ 2018-05-09 20:44 UTC (permalink / raw)
  To: 31175

Le Wed, 9 May 2018 08:50:52 +0200,
Björn Höfling <bjoern.hoefling@bjoernhoefling.de> a écrit :

> Hu Julien,
> 
> looking at PostGIS:
> 
> On Mon, 16 Apr 2018 11:18:21 +0200
> Julien Lepiller <julien@lepiller.eu> wrote:
> 
> > Hi, here are two patches to add postgis and its dependency gdal.  
> 
> +    (description " PostGIS is a spatial database extender for
> PostgreSQL
> 
> --> There is a space at the beginning.  
> 
> Besides of that, this looks good.
> 
> I have successfully tried shp2pgsql. 
> 
> I have not tried and have no idea of how to use Postgresql+PostGIS
> within GuixSD or with a temp database in a Guix container.

I've tried to, but the extension directory is hardcoded. Nix has this
patch for postgresql:

https://github.com/NixOS/nixpkgs/blob/master/pkgs/servers/sql/postgresql/specify_pkglibdir_at_runtime.patch

With this, we could add a field to the postgresql configuration that
would take a list of extension packages and set the environment
variable accordingly. The patch only allows one path though. Do you
think it's worth it to adjust it and allow more paths?

> 
> Thanks,
> 
> Björn

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#31175: [PATCH] gnu: Add postgis.
  2018-05-09  5:44 ` Björn Höfling
@ 2018-05-23 21:08   ` Julien Lepiller
  0 siblings, 0 replies; 6+ messages in thread
From: Julien Lepiller @ 2018-05-23 21:08 UTC (permalink / raw)
  To: 31175-done

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

Pushed as 2b9be1a63aef1a0e67e94bfd9a676b6cb5c8463f and
996e45cbf7e46977e16c4ebc5ecc394db28f4a21, thank you for your review!

[-- Attachment #2: Signature digitale OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-05-23 21:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-16  9:18 [bug#31175] [PATCH] gnu: Add postgis Julien Lepiller
2018-04-17 22:26 ` Björn Höfling
2018-05-09  5:44 ` Björn Höfling
2018-05-23 21:08   ` bug#31175: " Julien Lepiller
2018-05-09  6:50 ` [bug#31175] " Björn Höfling
2018-05-09 20:44   ` Julien Lepiller

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.