geo.scm
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu> |
3 | ;;; |
4 | ;;; This file is part of GNU Guix. |
5 | ;;; |
6 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
7 | ;;; under the terms of the GNU General Public License as published by |
8 | ;;; the Free Software Foundation; either version 3 of the License, or (at |
9 | ;;; your option) any later version. |
10 | ;;; |
11 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
12 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | ;;; GNU General Public License for more details. |
15 | ;;; |
16 | ;;; You should have received a copy of the GNU General Public License |
17 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
18 | |
19 | (define-module (more packages geo) |
20 | #:use-module (guix packages) |
21 | #:use-module (guix download) |
22 | #:use-module (guix git-download) |
23 | #:use-module (guix build-system gnu) |
24 | #:use-module (guix build-system go) |
25 | #:use-module ((guix licenses) #:prefix license:) |
26 | #:use-module (gnu packages) |
27 | #:use-module (gnu packages compression) |
28 | #:use-module (gnu packages databases) |
29 | #:use-module (gnu packages geo) |
30 | #:use-module (gnu packages image) |
31 | #:use-module (gnu packages pcre) |
32 | #:use-module (gnu packages perl) |
33 | #:use-module (gnu packages pkg-config) |
34 | #:use-module (gnu packages web) |
35 | #:use-module (gnu packages xml)) |
36 | |
37 | (define-public tegola |
38 | (package |
39 | (name "tegola") |
40 | (version "0.6.3") |
41 | (source (origin |
42 | (method url-fetch) |
43 | (uri (string-append |
44 | "https://github.com/go-spatial/tegola/archive/v" |
45 | version ".tar.gz")) |
46 | (sha256 |
47 | (base32 |
48 | "0172ikggayprxmhhm9yfk1gc4i8m48llc8zzgqklbijkdpvp1zh0")))) |
49 | (build-system go-build-system) |
50 | (arguments |
51 | `(#:import-path "github.com/go-spatial/tegola/cmd/tegola" |
52 | #:unpack-path "github.com/go-spatial" |
53 | #:phases |
54 | (modify-phases %standard-phases |
55 | (add-before 'build 'rename-import |
56 | (lambda _ |
57 | (rename-file (string-append "src/github.com/go-spatial/tegola-" ,version) |
58 | "src/github.com/go-spatial/tegola") |
59 | #t))))) |
60 | (home-page "http://tegola.io") |
61 | (synopsis "Vector tile server for maps") |
62 | (description "Tegola is a free vector tile server written in Go. Tegola |
63 | takes geospatial data and slices it into vector tiles that can be efficiently |
64 | delivered to any client.") |
65 | (license license:expat))) |
66 | |
67 | (define-public gdal |
68 | (package |
69 | (name "gdal") |
70 | (version "2.2.4") |
71 | (source (origin |
72 | (method url-fetch) |
73 | (uri (string-append |
74 | "http://download.osgeo.org/gdal/" version "/gdal-" |
75 | version ".tar.gz")) |
76 | (sha256 |
77 | (base32 |
78 | "1951f7b69x3d1vic0rmq92q8f4bj3hbxnxmj5jl0cc3zg0isgmdr")) |
79 | (modules '((guix build utils))) |
80 | (snippet |
81 | `(begin |
82 | ;; TODO: frmts contains a lot more bundled code. |
83 | (for-each delete-file-recursively |
84 | '("frmts/png/libpng" |
85 | "frmts/gif/giflib" |
86 | "frmts/jpeg/libjpeg" |
87 | "frmts/jpeg/libjpeg12" |
88 | "frmts/gtiff/libtiff" |
89 | "frmts/gtiff/libgeotiff" |
90 | ;; ? |
91 | "frmts/zlib" |
92 | "ogr/ogrsf_frmts/geojson/libjson")))))) |
93 | (build-system gnu-build-system) |
94 | (arguments |
95 | `(#:tests? #f |
96 | #:configure-flags |
97 | (let-syntax ((with (syntax-rules () |
98 | ((_ option input) |
99 | (string-append option "=" |
100 | (assoc-ref %build-inputs input)))))) |
101 | (list |
102 | ;; TODO: --with-pcidsk, --with-pcraster |
103 | (with "--with-freexl" "freexl") |
104 | (with "--with-libjson-c" "json-c") |
105 | (with "--with-png" "libpng") |
106 | (with "--with-webp" "libwebp") |
107 | (with "--with-gif" "giflib") |
108 | (with "--with-jpeg" "libjpeg") |
109 | (with "--with-libtiff" "libtiff") |
110 | (with "--with-geotiff" "libgeotiff") |
111 | (with "--with-libz" "zlib") |
112 | "--with-pcre")) |
113 | #:phases |
114 | (modify-phases %standard-phases |
115 | (add-before 'build 'fix-path |
116 | (lambda _ |
117 | (substitute* "frmts/mrf/mrf_band.cpp" |
118 | (("\"../zlib/zlib.h\"") "<zlib.h>"))))))) |
119 | (inputs |
120 | `(("freexl" ,freexl) |
121 | ("geos" ,geos) |
122 | ("giflib" ,giflib) |
123 | ("json-c" ,json-c) |
124 | ("libgeotiff" ,libgeotiff) |
125 | ("libjpeg" ,libjpeg) |
126 | ("libpng" ,libpng) |
127 | ("libtiff" ,libtiff) |
128 | ("libwebp" ,libwebp) |
129 | ("pcre" ,pcre) |
130 | ("zlib" ,zlib))) |
131 | (home-page "http://www.gdal.org/") |
132 | (synopsis "Raster and vector geospation data format library") |
133 | (description "GDAL is a translator library for raster and vector geospatial |
134 | data formats. As a library, it presents a single raster abstract data model |
135 | and single vector abstract data model to the calling application for all |
136 | supported formats. It also comes with a variety of useful command line |
137 | utilities for data translation and processing.") |
138 | ;; TODO: CHECK |
139 | (license (list |
140 | ; general license |
141 | license:expat |
142 | ; gdal/frmts/gtiff/tif_float.c, gdal/frmts/pcraster/libcsf, |
143 | ; gdal/ogr/ogrsf_frmts/dxf/intronurbs.cpp, gdal/frmts/pdf/pdfdataset.cpp |
144 | ; gdal/frmts/mrf/ |
145 | license:bsd-3 |
146 | ; gdal/frmts/hdf4/hdf-eos/* |
147 | ; similar to the expat license, but without guarantee exclusion |
148 | (license:non-copyleft "file://LICENSE.txt") |
149 | ; gdal/frmts/grib/degrib/ |
150 | license:public-domain ; with restriction on guarantee |
151 | ; port/cpl_minizip* |
152 | ; ??? |
153 | ; gdal/alg/thinplatespline.cpp |
154 | ; very short license, permission granted to copy, use, share and modify. |
155 | (license:non-copyleft "file://LICENSE.txt") |
156 | ; gdal/alg/libqhull |
157 | ; TODO: not used by default, so we may snip it away |
158 | ;license:bsd-5 |
159 | ; gdal/frmts/mrf/libLERC |
160 | license:asl2.0)))) |
161 | |
162 | (define-public postgis |
163 | (package |
164 | (name "postgis") |
165 | (version "2.4.4") |
166 | (source (origin |
167 | (method url-fetch) |
168 | (uri (string-append "https://download.osgeo.org/postgis/source/postgis-" |
169 | version ".tar.gz")) |
170 | (sha256 |
171 | (base32 |
172 | "1hm8migjb53cymp4qvg1h20yqllmy9f7x0awv5450391i6syyqq6")))) |
173 | (build-system gnu-build-system) |
174 | (home-page "postgis.net") |
175 | (arguments |
176 | `(#:tests? #f |
177 | #:make-flags |
178 | (list (string-append "datadir=" (assoc-ref %outputs "out") "/share") |
179 | (string-append "docdir="(assoc-ref %outputs "out") "/share/doc") |
180 | (string-append "pkglibdir="(assoc-ref %outputs "out") "/lib") |
181 | (string-append "bindir=" (assoc-ref %outputs "out") "/bin")) |
182 | #:phases |
183 | (modify-phases %standard-phases |
184 | (add-before 'build 'fix-install-path |
185 | (lambda* (#:key outputs #:allow-other-keys) |
186 | (substitute* '("raster/loader/Makefile" "raster/scripts/python/Makefile") |
187 | (("\\$\\(DESTDIR\\)\\$\\(PGSQL_BINDIR\\)") |
188 | (string-append (assoc-ref outputs "out") "/bin")))))))) |
189 | (inputs |
190 | `(("gdal" ,gdal) |
191 | ("geos" ,geos) |
192 | ("libxml2" ,libxml2) |
193 | ("pcre" ,pcre) |
194 | ("postgresql" ,postgresql) |
195 | ("proj.4" ,proj.4))) |
196 | (native-inputs |
197 | `(("perl" ,perl) |
198 | ("pkg-config" ,pkg-config))) |
199 | (synopsis "") |
200 | (description "") |
201 | ;; TODO: CHECK |
202 | (license license:expat))) |
203 |