gnu: r-arrmdata: Use bioconductor-uri.
[jackhill/guix/guix.git] / gnu / packages / geo.scm
CommitLineData
03c1662e
LF
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
ad1ff78d 3;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
f6c507e1 4;;; Copyright © 2017, 2018 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
257c826c 5;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
8d26f48e 6;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
f2b005f6 7;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
3d60f426 8;;; Copyright © 2018 Joshua Sierles, Nextjournal <joshua@nextjournal.com>
6dd0e41d 9;;; Copyright © 2018, 2019 Julien Lepiller <julien@lepiller.eu>
ed72a133 10;;; Copyright © 2019 Guillaume Le Vaillant <glv@posteo.net>
0f7b8a7f 11;;; Copyright © 2019 Efraim Flashner <efraim@flashner.co.il>
41b4b713 12;;; Copyright © 2019 Wiktor Żelazny <wzelazny@vurv.cz>
03c1662e
LF
13;;;
14;;; This file is part of GNU Guix.
15;;;
16;;; GNU Guix is free software; you can redistribute it and/or modify it
17;;; under the terms of the GNU General Public License as published by
18;;; the Free Software Foundation; either version 3 of the License, or (at
19;;; your option) any later version.
20;;;
21;;; GNU Guix is distributed in the hope that it will be useful, but
22;;; WITHOUT ANY WARRANTY; without even the implied warranty of
23;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24;;; GNU General Public License for more details.
25;;;
26;;; You should have received a copy of the GNU General Public License
27;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28
29(define-module (gnu packages geo)
6dd0e41d 30 #:use-module (guix build-system ant)
8fa3451c 31 #:use-module (guix build-system cmake)
03c1662e 32 #:use-module (guix build-system glib-or-gtk)
065d0125 33 #:use-module (guix build-system gnu)
be7c64ba 34 #:use-module (guix build-system go)
5339d2bb 35 #:use-module (guix build-system meson)
f25e1e24 36 #:use-module (guix build-system python)
f2b005f6 37 #:use-module (guix build-system scons)
3d60f426 38 #:use-module (guix build-system r)
03c1662e 39 #:use-module (guix download)
d56af1ff 40 #:use-module (guix git-download)
f041db86 41 #:use-module (guix svn-download)
065d0125 42 #:use-module ((guix licenses) #:prefix license:)
03c1662e
LF
43 #:use-module (guix packages)
44 #:use-module (guix utils)
0f7b8a7f 45 #:use-module (gnu packages astronomy)
ed72a133 46 #:use-module (gnu packages autotools)
f2b005f6 47 #:use-module (gnu packages boost)
f25e1e24 48 #:use-module (gnu packages check)
1a39141d 49 #:use-module (gnu packages compression)
f2b005f6 50 #:use-module (gnu packages databases)
889e94e3
JL
51 #:use-module (gnu packages datastructures)
52 #:use-module (gnu packages documentation)
0f7b8a7f 53 #:use-module (gnu packages fonts)
f2b005f6 54 #:use-module (gnu packages fontutils)
03c1662e
LF
55 #:use-module (gnu packages glib)
56 #:use-module (gnu packages gnome)
57 #:use-module (gnu packages gtk)
1a39141d 58 #:use-module (gnu packages image)
f2b005f6 59 #:use-module (gnu packages icu4c)
f041db86 60 #:use-module (gnu packages java)
b0e2299a 61 #:use-module (gnu packages lua)
996e45cb 62 #:use-module (gnu packages pcre)
2b9be1a6 63 #:use-module (gnu packages perl)
03c1662e 64 #:use-module (gnu packages pkg-config)
dc8621a2 65 #:use-module (gnu packages protobuf)
f2b005f6 66 #:use-module (gnu packages python)
44d10b1f 67 #:use-module (gnu packages python-xyz)
0f7b8a7f 68 #:use-module (gnu packages qt)
cd0322a3 69 #:use-module (gnu packages sqlite)
5b19776e 70 #:use-module (gnu packages web)
03c1662e 71 #:use-module (gnu packages webkit)
a2a53274 72 #:use-module (gnu packages wxwidgets)
03c1662e
LF
73 #:use-module (gnu packages xml))
74
a7607572
BH
75(define-public geos
76 (package
77 (name "geos")
e3df159e 78 (version "3.7.1")
a7607572
BH
79 (source (origin
80 (method url-fetch)
81 (uri (string-append "http://download.osgeo.org/geos/geos-"
82 version
83 ".tar.bz2"))
84 (sha256
85 (base32
e3df159e 86 "1312m02xk4sp6f1xdpb9w0ic0zbxg90p5y66qnwidl5fksscf1h0"))))
a7607572
BH
87 (build-system gnu-build-system)
88 (arguments `(#:phases
89 (modify-phases %standard-phases
90 (add-after
91 'unpack 'patch-test-shebangs
92 (lambda _
93 (substitute* '("tests/xmltester/testrunner.sh"
94 "tests/geostest/testrunner.sh")
95 (("/bin/sh") (which "sh")))
96 #t)))))
97 (inputs
98 `(("glib" ,glib)))
99 (home-page "https://geos.osgeo.org/")
100 (synopsis "Geometry Engine for Geographic Information Systems")
101 (description
102 "GEOS provides a spatial object model and fundamental geometric
103functions. It is a C++ port of the Java Topology Suite (JTS). As such,
104it aims to contain the complete functionality of JTS in C++. This
105includes all the OpenGIS Simple Features for SQL spatial predicate
106functions and spatial operators, as well as specific JTS enhanced
107topology functions.")
108 (license (list license:lgpl2.1+ ; Main distribution.
109 license:zlib ; tests/xmltester/tinyxml/*
110 license:public-domain)))) ; include/geos/timeval.h
111
03c1662e
LF
112(define-public gnome-maps
113 (package
114 (name "gnome-maps")
2cf1e37c 115 (version "3.30.3.1")
03c1662e
LF
116 (source (origin
117 (method url-fetch)
118 (uri (string-append "mirror://gnome/sources/" name "/"
119 (version-major+minor version) "/"
120 name "-" version ".tar.xz"))
121 (sha256
122 (base32
2cf1e37c 123 "0xqk3yrds0w8bjmpf4jw0370phvm65av82nqrx7fp1648h9nq7xi"))))
5339d2bb 124 (build-system meson-build-system)
03c1662e 125 (arguments
5339d2bb 126 `(#:glib-or-gtk? #t
03c1662e
LF
127 #:phases
128 (modify-phases %standard-phases
b0a7c0c3
EF
129 (add-after 'unpack 'skip-gtk-update-icon-cache
130 ;; Don't create 'icon-theme.cache'.
131 (lambda _
132 (substitute* "meson_post_install.py"
133 (("gtk-update-icon-cache") "true"))
134 #t))
67bd376b
KK
135 (add-after 'install 'wrap
136 (lambda* (#:key inputs outputs #:allow-other-keys)
137 (let ((out (assoc-ref outputs "out"))
138 (gi-typelib-path (getenv "GI_TYPELIB_PATH"))
5339d2bb
RW
139 (geocode-glib-path (string-append
140 (assoc-ref inputs "geocode-glib")
141 "/lib"))
67bd376b 142 (goa-path (string-append
2cf1e37c 143 (assoc-ref inputs "gnome-online-accounts:lib")
67bd376b 144 "/lib"))
2cf1e37c
KK
145 (gdk-pixbuf-path (string-append
146 (assoc-ref inputs "gdk-pixbuf")
147 "/lib"))
67bd376b
KK
148 (webkitgtk-path (string-append
149 (assoc-ref inputs "webkitgtk")
150 "/lib")))
151 (wrap-program (string-append out "/bin/gnome-maps")
152 `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path))
03c1662e 153
67bd376b 154 ;; There seems to be no way to embed the path of
5339d2bb 155 ;; libgoa-1.0.so.0, libwebkit2gtk-4.0.so.37,
2cf1e37c
KK
156 ;; libgdk_pixbuf-2.0.so, libjavascriptcoregtk-4.0.so.18, and
157 ;; libgeocode-glib.so.0
5339d2bb
RW
158 `("LD_LIBRARY_PATH" ":" prefix (,goa-path
159 ,webkitgtk-path
2cf1e37c 160 ,gdk-pixbuf-path
5339d2bb 161 ,geocode-glib-path)))
67bd376b 162 #t))))))
03c1662e 163 (native-inputs
b0a7c0c3 164 `(("gobject-introspection" ,gobject-introspection)
03c1662e
LF
165 ("intltool" ,intltool)
166 ("pkg-config" ,pkg-config)))
167 (inputs
168 `(("folks" ,folks)
169 ("libchamplain" ,libchamplain)
170 ("libgee" ,libgee)
8d26f48e
RW
171 ("libsecret" ,libsecret)
172 ("libsoup" ,libsoup)
173 ("libgweather" ,libgweather)
03c1662e 174 ("libxml2" ,libxml2)
2cf1e37c 175 ("gdk-pixbuf" ,gdk-pixbuf+svg)
8d26f48e 176 ("glib-networking" ,glib-networking)
03c1662e
LF
177 ("geoclue" ,geoclue)
178 ("geocode-glib" ,geocode-glib)
179 ("gfbgraph" ,gfbgraph)
180 ("gjs" ,gjs)
181 ("glib" ,glib)
2cf1e37c 182 ("gnome-online-accounts:lib" ,gnome-online-accounts "lib")
8d26f48e 183 ("gsettings-desktop-schemas" ,gsettings-desktop-schemas)
03c1662e
LF
184 ("rest" ,rest)
185 ("webkitgtk" ,webkitgtk)))
186 (propagated-inputs
187 `(("gtk+3" ,gtk+)))
188 (synopsis "Graphical map viewer and wayfinding program")
189 (description "GNOME Maps is a graphical map viewer. It uses map data from
190the OpenStreetMap project. It can provide directions for walking, bicycling,
191and driving.")
192 (home-page "https://wiki.gnome.org/Apps/Maps")
065d0125
BH
193 (license license:gpl2+)))
194
22c7c775
BH
195(define-public libgaiagraphics
196 (package
197 (name "libgaiagraphics")
198 (version "0.5")
199 (source
200 (origin
201 (method url-fetch)
202 (uri (string-append "https://www.gaia-gis.it/gaia-sins/libgaiagraphics-"
203 version ".tar.gz"))
204 (sha256
205 (base32
206 "076afqv417ag3hfvnif0qc7qscmnq1dsf6y431yygwgf34rjkayc"))))
207 (build-system gnu-build-system)
208 (native-inputs
209 `(("pkg-config" ,pkg-config)))
210 (inputs
211 `(("cairo" ,cairo)
212 ("libpng" ,libpng)
56e53392 213 ("libjpeg-turbo" ,libjpeg-turbo)
22c7c775
BH
214 ("libtiff" ,libtiff)
215 ("libgeotiff" ,libgeotiff)
216 ("proj.4" ,proj.4)
217 ("libxml2" ,libxml2)
218 ("zlib" ,zlib)))
219 (synopsis "Gaia common graphics support")
220 (description "libgaiagraphics is a library supporting
221 common-utility raster handling methods.")
222 (home-page "https://www.gaia-gis.it/fossil/libgaiagraphics/index")
223 (license license:lgpl3+)))
224
1a39141d
BH
225(define-public libgeotiff
226 (package
227 (name "libgeotiff")
a3783aca 228 (version "1.4.3")
1a39141d
BH
229 (source
230 (origin
231 (method url-fetch)
232 (uri (string-append "http://download.osgeo.org/geotiff/libgeotiff/libgeotiff-"
233 version ".tar.gz"))
234 (sha256
a3783aca 235 (base32 "0rbjqixi4c8yz19larlzq6jda0px2gpmpp9c52cyhplbjsdhsldq"))
1a39141d
BH
236 (modules '((guix build utils)))
237 (snippet
238 '(begin
239 ;; Remove .csv files, distributed from EPSG under a restricted
240 ;; license. See LICENSE for full license text.
241 (for-each delete-file (find-files "." "\\.csv$"))
242 ;; Now that we have removed the csv files, we need to modify the Makefile.
243 (substitute* "Makefile.in"
244 (("^all-am: .*$")
245 "all-am: Makefile $(LTLIBRARIES) $(HEADERS) geo_config.h\n")
246 (("^install-data-am: .*$")
6cbee49d
MW
247 "install-data-am: install-includeHEADERS"))
248 #t))))
1a39141d
BH
249 (build-system gnu-build-system)
250 (inputs
251 `(("libjpeg-turbo" ,libjpeg-turbo)
252 ("libtiff" ,libtiff)
253 ("proj.4" ,proj.4)
254 ("zlib" ,zlib)))
255 (arguments
256 `(#:configure-flags
257 (list (string-append "--with-zlib")
258 (string-append "--with-jpeg")
259 (string-append "--with-libtiff=" (assoc-ref %build-inputs "libtiff")))))
260 (synopsis "Library for handling GeoTIFF (geographic enabled TIFF)")
261 (description "libgeotiff is a library on top of libtiff for reading and
262writing GeoTIFF information tags.")
263 (home-page "https://trac.osgeo.org/geotiff/")
264 ;; This is a mixture of various contributions under different licenses.
265 ;; Note that the EPSG database is NOT "free to use" as the LICENSE file
266 ;; states, as its commercial redistribution is restricted. Hence, we have
267 ;; removed it from the package.
268 (license (list license:public-domain
269 license:x11
270 license:bsd-3
271 (license:non-copyleft "file://LICENSE"
272 "See LICENSE in the distribution.")))))
273
f6c507e1
BH
274(define-public libspatialite
275 (package
276 (name "libspatialite")
277 (version "4.3.0a")
278 (source
279 (origin
280 (method url-fetch)
281 (uri (string-append "https://www.gaia-gis.it/gaia-sins/libspatialite-"
282 version ".tar.gz"))
283 (sha256
284 (base32
285 "16d4lpl7xrm9zy4gphy6nwanpjp8wn9g4wq2i2kh8abnlhq01448"))))
286 (build-system gnu-build-system)
287 (native-inputs
288 `(("pkg-config" ,pkg-config)))
289 (inputs
290 `(("freexl" ,freexl)
291 ("geos" ,geos)
292 ("libxml2" ,libxml2)
293 ("proj.4" ,proj.4)
294 ("sqlite" ,sqlite)
295 ("zlib" ,zlib)))
296 (arguments
297 `(#:phases
298 (modify-phases %standard-phases
299 ;; 3 tests are failing, ignore them:
300 (add-after 'unpack 'ignore-broken-tests
301 (lambda _
302 (substitute* '("test/Makefile.in")
303 (("\tcheck_sql_stm.*" all) "\tcheck_multithread$(EXEEXT) \\\n")
304 (("(\tch.*) check_v.*ble2.*$" all vt1) (string-append vt1 " \\\n"))
305 (("\tch.* (check_v.*ble4.*)$" all vt4) (string-append "\t" vt4)))
306 #t)))))
307 (synopsis "Extend SQLite to support Spatial SQL capabilities")
308 (description
309 "SpatiaLite is a library intended to extend the SQLite core to support
310fully fledged Spatial SQL capabilities.")
311 (home-page "https://www.gaia-gis.it/fossil/libspatialite/index")
312 ;; For the genuine libspatialite-sources holds:
313 ;; Any of the licenses MPL1.1, GPL2+ or LGPL2.1+ may be picked.
314 ;; Files under src/control_points are from GRASS
315 ;; and are licensed under GPL2+ only.
316 ;; src/md5.[ch]: Placed into the public domain by Alexander Peslyak.
317 (license (list license:gpl2+
318 license:lgpl2.1+
319 license:mpl1.1
320 license:public-domain))))
321
065d0125
BH
322(define-public proj.4
323 (package
324 (name "proj.4")
325 (version "4.9.3")
326 (source (origin
327 (method url-fetch)
328 (uri (string-append "http://download.osgeo.org/proj/proj-"
329 version ".tar.gz"))
330 (sha256
331 (base32
332 "1xw5f427xk9p2nbsj04j6m5zyjlyd66sbvl2bkg8hd1kx8pm9139"))))
333 (build-system gnu-build-system)
334 (arguments
335 `(#:phases
336 (modify-phases %standard-phases
337 (add-after 'unpack 'patch-test-paths
338 (lambda _
339 (substitute* '("nad/test27"
340 "nad/test83"
341 "nad/testvarious"
342 "nad/testdatumfile"
343 "nad/testflaky"
344 "nad/testIGNF")
345 (("/bin/rm") (which "rm")))
346 #t))
347 ;; Precision problems on i686 and other platforms. See:
348 ;; https://web.archive.org/web/20151006134301/http://trac.osgeo.org/proj/ticket/255
349 ;; Disable failing test.
350 (add-after 'patch-test-paths 'ignore-failing-tests
351 (lambda _
352 (substitute* '("nad/Makefile.in")
353 (("\tPROJ_LIB.*" all) (string-append "#" all)))
354 #t)))))
355 (inputs
356 `(("glib" ,glib)))
357 (home-page "http://proj4.org/")
358 (synopsis "Cartographic Projections Library")
359 (description
360 "Proj.4 is a library for converting coordinates between cartographic
361projections.")
362 (license (list license:expat
363 ;; src/PJ_patterson.c
364 license:asl2.0
365 ;; src/geodesic.c/h
366 license:x11
367 ;; Embedded EPSG database.
368 (license:non-copyleft "http://www.epsg.org/TermsOfUse")
369 ;; cmake/*
370 license:boost1.0))))
f2b005f6
AI
371
372(define-public mapnik
373 (package
374 (name "mapnik")
375 (version "3.0.18")
376 (source
377 (origin
378 (method url-fetch)
379 (uri (string-append "https://github.com/mapnik/mapnik/releases/download/v"
380 version "/mapnik-v" version ".tar.bz2"))
381 (sha256
382 (base32
383 "06frcikaj2mgz3abfk5h0z4j3hbksi0zikwjngbjv4p5f3pwxf8q"))))
384 (build-system scons-build-system)
385 (inputs
386 `(("boost" ,boost)
387 ("cairo" ,cairo)
388 ("freetype" ,freetype)
389 ("harfbuzz" ,harfbuzz)
390 ("icu4c" ,icu4c)
391 ("libjpeg-turbo" ,libjpeg-turbo)
392 ("libpng" ,libpng)
393 ("libtiff" ,libtiff)
394 ("libwebp" ,libwebp)
395 ("libxml2" ,libxml2)
396 ("proj.4" ,proj.4)
397 ("sqlite" ,sqlite)
398 ("zlib" ,zlib)))
399 (native-inputs
400 `(("pkg-config" ,pkg-config)))
401 (arguments
402 `(#:scons ,scons-python2
403 #:scons-flags
404 (list "CC=gcc"
405 (string-append "PREFIX=" %output)
406 (string-append "CUSTOM_LDFLAGS=-Wl,-rpath=" %output "/lib"))))
407 (home-page "http://mapnik.org/")
408 (synopsis "Toolkit for developing mapping applications")
409 (description "Mapnik is a toolkit for developing mapping applications. It
410is basically a collection of geographic objects like maps, layers,
411datasources, features, and geometries. At its core is a C++ shared library
412providing algorithms and patterns for spatial data access and visualization.
413The library does not rely on any specific windowing system and can be deployed
414to any server environment. It is intended to play fair in a multi-threaded
415environment and is aimed primarily, but not exclusively, at web-based
416development.")
417 (license (list license:lgpl2.1+
418 ;; demo/viewer, demo/python/rundemo.py
419 license:gpl2+
420 ;; deps/boost, deps/mapbox, deps/agg/include/agg_conv_offset.h
421 license:boost1.0
422 ;; deps/mapnik/sparsehash
423 license:bsd-3
424 ;; deps/agg
425 (license:non-copyleft "file://deps/agg/copying")))))
426
f25e1e24
AI
427(define-public python2-mapnik
428 (package
429 (name "python2-mapnik")
430 (version "3.0.16")
431 (source
432 (origin
433 (method url-fetch)
434 (uri (string-append "https://github.com/mapnik/python-mapnik/archive/v"
435 version ".tar.gz"))
436 (file-name (string-append name "-" version ".tar.gz"))
437 (sha256
438 (base32
439 "0w7wg72gnwmbjani9sqk42p2jwqkrl9hsdkawahni5m05xsifcb4"))))
440 (build-system python-build-system)
441 (inputs
442 `(("boost" ,boost)
443 ("harfbuzz" ,harfbuzz)
444 ("icu4c" ,icu4c)
445 ("libjpeg-turbo" ,libjpeg-turbo)
446 ("libpng" ,libpng)
447 ("libtiff" ,libtiff)
448 ("libwebp" ,libwebp)
449 ("mapnik" ,mapnik)
450 ("proj.4" ,proj.4)
451 ("python2-pycairo" ,python2-pycairo)))
452 (native-inputs
453 (let ((test-data-input
454 (lambda (repository version hash)
455 (origin
456 (method url-fetch)
457 (uri (string-append "https://github.com/mapnik/" repository
458 "/archive/v" version ".tar.gz"))
459 (file-name (string-append "python-mapnik-" repository
460 "-" version ".tar.gz"))
461 (sha256 (base32 hash))))))
462 `(("python2-nose" ,python2-nose)
463 ;; Test data is released as separate tarballs
464 ("test-data"
465 ,(test-data-input "test-data" "3.0.18"
466 "10cvgn5gxn8ldrszj24zr1vzm5w76kqk4s7bl2zzp5yvkhh8lj1n"))
467 ("test-data-visual"
468 ,(test-data-input "test-data-visual" "3.0.18"
469 "1cb9ghy8sis0w5fkp0dvwxdqqx44rhs9a9w8g9r9i7md1c40r80i")))))
470 (arguments
471 `(#:python ,python-2 ; Python 3 support is incomplete, and the build fails
472 #:phases
473 (modify-phases %standard-phases
474 ;; Unpack test data into the source tree
475 (add-after 'unpack 'unpack-submodules
476 (lambda* (#:key inputs #:allow-other-keys)
477 (let ((unpack (lambda (source target)
478 (with-directory-excursion target
479 (invoke "tar" "xvf" (assoc-ref inputs source)
480 "--strip-components=1")))))
481 (unpack "test-data" "test/data")
482 (unpack "test-data-visual" "test/data-visual"))))
483 ;; Skip failing tests
484 (add-after 'unpack 'skip-tests
485 (lambda _
486 (let ((skipped-tests (list "test_vrt_referring_to_missing_files"
487 "test_unicode_regex_replace"
488 "test_proj_antimeridian_bbox"
489 "test_render_with_scale_factor")))
490 (substitute* "setup.cfg"
491 (("\\[nosetests\\]" all)
492 (string-append all "\nexclude=^("
493 (string-join skipped-tests "|") ")$")))))))))
494 (home-page "https://github.com/mapnik/python-mapnik")
495 (synopsis "Python bindings for Mapnik")
496 (description "This package provides Python bindings for Mapnik.")
497 (license license:lgpl2.1+)))
a2a53274
BH
498
499(define-public spatialite-gui
500 (package
501 (name "spatialite-gui")
502 (version "1.7.1")
503 (source
504 (origin
505 (method url-fetch)
506 (uri (string-append "https://www.gaia-gis.it/gaia-sins/spatialite_gui-"
507 version ".tar.gz"))
508 (sha256
509 (base32
510 "1r05dz9pyc8vsd2wbqxcsracpfbaamz470rcyp2myfpqwznv376b"))))
511 (build-system gnu-build-system)
512 (native-inputs
513 `(("pkg-config" ,pkg-config)))
514 (inputs
515 `(("freexl" ,freexl)
516 ("geos" ,geos)
517 ("libgaiagraphics" ,libgaiagraphics)
518 ("libspatialite" ,libspatialite)
519 ("libxml2" ,libxml2)
520 ("proj.4" ,proj.4)
521 ("sqlite" ,sqlite)
522 ("wxwidgets" ,wxwidgets-2)
523 ("zlib" ,zlib)))
524 (synopsis "Graphical user interface for SpatiaLite")
525 (description "Spatialite-gui provides a visual interface for viewing and
526 maintaining a spatialite database. You can easily see the structure of the
527 tables and data contents using point and click functions, many of which
528 construct common SQL queries, or craft your own SQL queries.")
529 (home-page "https://www.gaia-gis.it/fossil/spatialite_gui/index")
530 (license license:gpl3+)))
3d60f426 531
996e45cb
JL
532(define-public gdal
533 (package
534 (name "gdal")
535 (version "2.2.4")
536 (source (origin
537 (method url-fetch)
538 (uri (string-append
539 "http://download.osgeo.org/gdal/" version "/gdal-"
540 version ".tar.gz"))
541 (sha256
542 (base32
543 "1951f7b69x3d1vic0rmq92q8f4bj3hbxnxmj5jl0cc3zg0isgmdr"))
544 (modules '((guix build utils)))
545 (snippet
546 `(begin
547 ;; TODO: frmts contains a lot more bundled code.
548 (for-each delete-file-recursively
549 ;; bundled code
550 '("frmts/png/libpng"
551 "frmts/gif/giflib"
552 "frmts/jpeg/libjpeg"
553 "frmts/jpeg/libjpeg12"
554 "frmts/gtiff/libtiff"
555 "frmts/gtiff/libgeotiff"
556 "frmts/zlib"
557 "ogr/ogrsf_frmts/geojson/libjson"))))))
558 (build-system gnu-build-system)
559 (arguments
560 `(#:tests? #f
561 #:configure-flags
562 (let-syntax ((with (syntax-rules ()
563 ((_ option input)
564 (string-append option "="
565 (assoc-ref %build-inputs input))))))
566 (list
567 ;; TODO: --with-pcidsk, --with-pcraster
568 (with "--with-freexl" "freexl")
569 (with "--with-libjson-c" "json-c")
570 (with "--with-png" "libpng")
571 (with "--with-webp" "libwebp")
572 (with "--with-gif" "giflib")
109f022e 573 (with "--with-jpeg" "libjpeg-turbo")
996e45cb
JL
574 (with "--with-libtiff" "libtiff")
575 (with "--with-geotiff" "libgeotiff")
576 (with "--with-libz" "zlib")
577 "--with-pcre"))
578 #:phases
579 (modify-phases %standard-phases
580 (add-before 'build 'fix-path
581 (lambda _
582 (substitute* "frmts/mrf/mrf_band.cpp"
583 (("\"../zlib/zlib.h\"") "<zlib.h>")))))))
584 (inputs
585 `(("freexl" ,freexl)
586 ("geos" ,geos)
587 ("giflib" ,giflib)
588 ("json-c" ,json-c)
589 ("libgeotiff" ,libgeotiff)
590 ("libjpeg-turbo" ,libjpeg-turbo)
591 ("libpng" ,libpng)
592 ("libtiff" ,libtiff)
593 ("libwebp" ,libwebp)
594 ("pcre" ,pcre)
595 ("zlib" ,zlib)))
596 (home-page "http://www.gdal.org/")
597 (synopsis "Raster and vector geospatial data format library")
598 (description "GDAL is a translator library for raster and vector geospatial
599data formats. As a library, it presents a single raster abstract data model
600and single vector abstract data model to the calling application for all
601supported formats. It also comes with a variety of useful command line
602utilities for data translation and processing.")
603 (license (list
604 ;; general license
605 license:expat
606 ;; frmts/gtiff/tif_float.c, frmts/pcraster/libcsf,
607 ;; ogr/ogrsf_frmts/dxf/intronurbs.cpp, frmts/pdf/pdfdataset.cpp
608 ;; frmts/mrf/
609 license:bsd-3
610 ;; frmts/hdf4/hdf-eos/*
611 ;; similar to the expat license, but without guarantee exclusion
612 (license:non-copyleft "file://frmts/hdf4/hdf-eos/README")
613 ;; frmts/grib/degrib/
614 license:public-domain ; with guarantee exclusion
615 ;; port/cpl_minizip*
616 ;; Some bsd-inspired license
617 (license:non-copyleft "file://port/LICENCE_minizip")
618 ;; alg/internal_libqhull
619 ;; Some 5-clause license
620 (license:non-copyleft "file://alg/internal_libqhull/COPYING.txt")
621 ;; frmts/mrf/libLERC
622 license:asl2.0))))
2b9be1a6 623
a18a27be
SB
624(define-public python-gdal
625 (package (inherit gdal)
626 (name "python-gdal")
627 (build-system python-build-system)
628 (arguments
629 '(#:tests? #f ; no tests
630 #:phases
631 (modify-phases %standard-phases
632 (add-before 'build 'chdir
633 (lambda _
634 (chdir "swig/python")
635 #t)))))
636 (native-inputs '())
637 (propagated-inputs
638 `(("python-numpy" ,python-numpy)))
639 (inputs
640 `(("gdal" ,gdal)))
641 (synopsis "GDAL (Geospatial Data Abstraction Library) python bindings")))
642
2b9be1a6
JL
643(define-public postgis
644 (package
645 (name "postgis")
6d18427f 646 (version "2.4.8")
2b9be1a6
JL
647 (source (origin
648 (method url-fetch)
649 (uri (string-append "https://download.osgeo.org/postgis/source/postgis-"
650 version ".tar.gz"))
651 (sha256
652 (base32
6d18427f 653 "0nanza15xzfhbpbq49p1xqz96dgbsam5332y9zj6snmz2mq685ll"))))
2b9be1a6
JL
654 (build-system gnu-build-system)
655 (arguments
656 `(#:tests? #f
657 #:make-flags
658 (list (string-append "datadir=" (assoc-ref %outputs "out") "/share")
659 (string-append "docdir="(assoc-ref %outputs "out") "/share/doc")
660 (string-append "pkglibdir="(assoc-ref %outputs "out") "/lib")
661 (string-append "bindir=" (assoc-ref %outputs "out") "/bin"))
662 #:phases
663 (modify-phases %standard-phases
664 (add-before 'build 'fix-install-path
665 (lambda* (#:key outputs #:allow-other-keys)
666 (substitute* '("raster/loader/Makefile" "raster/scripts/python/Makefile")
667 (("\\$\\(DESTDIR\\)\\$\\(PGSQL_BINDIR\\)")
668 (string-append (assoc-ref outputs "out") "/bin"))))))))
669 (inputs
670 `(("gdal" ,gdal)
671 ("geos" ,geos)
672 ("libxml2" ,libxml2)
673 ("pcre" ,pcre)
674 ("postgresql" ,postgresql)
675 ("proj.4" ,proj.4)))
676 (native-inputs
677 `(("perl" ,perl)
678 ("pkg-config" ,pkg-config)))
679 (home-page "https://postgis.net")
680 (synopsis "Spatial database extender for PostgreSQL")
681 (description "PostGIS is a spatial database extender for PostgreSQL
682object-relational database. It adds support for geographic objects allowing
8e3f06c9
JL
683location queries to be run in SQL. This package provides a PostgreSQL
684extension.")
2b9be1a6
JL
685 (license (list
686 ;; General license
687 license:gpl2+
688 ;; loader/dbfopen, safileio.*, shapefil.h, shpopen.c
689 license:expat
690 ;; loader/getopt.*
691 license:public-domain
692 ;; doc/xsl
693 license:bsd-3 ; files only say "BSD"
694 ;; doc
695 license:cc-by-sa3.0))))
be7c64ba
JL
696
697(define-public tegola
698 (package
699 (name "tegola")
700 (version "0.7.0")
701 (source (origin
702 (method url-fetch)
703 (uri (string-append
704 "https://github.com/go-spatial/tegola/archive/v"
705 version ".tar.gz"))
706 (file-name (string-append name "-" version ".tar.gz"))
707 (sha256
708 (base32
709 "09vnzxfn0r70kmd776kcdfqxhzdj11syxa0b27z4ci1k367v7viw"))))
710 (build-system go-build-system)
711 (arguments
712 `(#:import-path "github.com/go-spatial/tegola/cmd/tegola"
d9ef50b3 713 #:unpack-path "github.com/go-spatial/tegola"
be7c64ba
JL
714 #:phases
715 (modify-phases %standard-phases
716 (add-before 'build 'set-version
717 (lambda _
d9ef50b3 718 (with-directory-excursion "src/github.com/go-spatial/tegola"
be7c64ba
JL
719 (substitute* '("cmd/tegola/cmd/root.go"
720 "cmd/tegola_lambda/main.go")
721 (("version not set") ,version)))
be7c64ba
JL
722 #t)))))
723 (home-page "http://tegola.io")
724 (synopsis "Vector tile server for maps")
725 (description "Tegola is a free vector tile server written in Go. Tegola
726takes geospatial data and slices it into vector tiles that can be efficiently
727delivered to any client.")
728 (license (list
729 license:expat
730 ;; Some packages in vendor have other licenses
731 license:asl2.0
732 license:bsd-2
733 license:bsd-3
734 license:wtfpl2))))
3bd7611e
JL
735
736(define-public imposm3
737 (package
738 (name "imposm3")
739 (version "0.6.0-alpha.4")
740 (source
741 (origin
742 (method url-fetch)
743 (uri (string-append "https://github.com/omniscale/imposm3/archive/v"
744 version ".tar.gz"))
745 (file-name (string-append name "-" version ".tar.gz"))
746 (sha256
747 (base32
748 "06f0kwmv52yd5m9jlckqxqmkf0cnqy3hamakrvg9lspplyqrds80"))))
749 (build-system go-build-system)
750 (arguments
751 `(#:import-path "github.com/omniscale/imposm3/cmd/imposm"
bdc0c20c 752 #:unpack-path "github.com/omniscale/imposm3"
3bd7611e
JL
753 #:phases
754 (modify-phases %standard-phases
3bd7611e
JL
755 (add-before 'build 'set-version
756 (lambda _
757 (substitute* "src/github.com/omniscale/imposm3/version.go"
758 (("0.0.0-dev") ,version))
759 #t)))))
760 (inputs
761 `(("geos" ,geos)
762 ("leveldb" ,leveldb)))
763 (home-page "https://imposm.org/")
764 (synopsis "OpenStreetMap importer for PostGIS")
765 (description "Imposm is an importer for OpenStreetMap data. It reads PBF
766files and imports the data into PostgreSQL/PostGIS databases. It is designed
767to create databases that are optimized for rendering/tile/map-services.")
768 (license (list
769 license:asl2.0
770 ;; Some dependencies in vendor have different licenses
771 license:expat
772 license:bsd-2
773 license:bsd-3))))
8fa3451c 774
889e94e3
JL
775(define-public libosmium
776 (package
777 (name "libosmium")
778 (version "2.14.2")
779 (source
f4daf250
TGR
780 (origin
781 (method git-fetch)
782 (uri (git-reference
783 (url "https://github.com/osmcode/libosmium.git")
784 (commit (string-append "v" version))))
785 (file-name (git-file-name name version))
786 (sha256
787 (base32 "123ri1l0a2b9fljgpwsl7z2w4i3kmgxz79d4ns9z4mwbp8sw0250"))))
889e94e3
JL
788 (build-system cmake-build-system)
789 (propagated-inputs
790 `(("boost" ,boost)
791 ("expat" ,expat)
792 ("gdal" ,gdal)
793 ("geos" ,geos)
794 ("proj.4" ,proj.4)
795 ("protozero" ,protozero)
796 ("sparsehash" ,sparsehash)
797 ("zlib" ,zlib)))
798 (native-inputs
799 `(("doxygen" ,doxygen)))
800 (home-page "https://osmcode.org/libosmium/")
801 (synopsis "C++ library for working with OpenStreetMap data")
802 (description "Libosmium is a fast and flexible C++ library for working with
803OpenStreetMap data.")
804 (license license:boost1.0)))
b0e2299a
JL
805
806(define-public osm2pgsql
807 (package
808 (name "osm2pgsql")
809 (version "0.96.0")
82b47fd9
TGR
810 (source
811 (origin
812 (method git-fetch)
813 (uri (git-reference
814 (url "https://github.com/openstreetmap/osm2pgsql.git")
815 (commit version)))
816 (file-name (git-file-name name version))
817 (sha256
818 (base32 "032cydh8ynaqfhdzmkvgbmqyjql668y6qln1l59l2s3ni9963bbl"))
819 (modules '((guix build utils)))
820 (snippet
821 '(begin
822 (delete-file-recursively "contrib/protozero")
823 (delete-file-recursively "contrib/libosmium")
824 #t))))
b0e2299a
JL
825 (build-system cmake-build-system)
826 (arguments
827 `(#:tests? #f; tests fail because we need to setup a database
828 #:configure-flags
829 (list (string-append "-DOSMIUM_INCLUDE_DIR="
830 (assoc-ref %build-inputs "libosmium")
831 "/include")
832 (string-append "-DPROTOZERO_INCLUDE_DIR="
833 (assoc-ref %build-inputs "protozero")
834 "/include"))))
835 (inputs
836 `(("boost" ,boost)
837 ("expat" ,expat)
838 ("libosmium" ,libosmium)
839 ("lua" ,lua)
840 ("postgresql" ,postgresql)
841 ("proj.4" ,proj.4)
842 ("protozero" ,protozero)
843 ("zlib" ,zlib)))
844 (native-inputs
845 `(("python-2" ,python-2)
846 ("python2-psycopg2" ,python2-psycopg2)))
847 (home-page "https://github.com/openstreetmap/osm2pgsql")
848 (synopsis "OSM data importer to postgresql")
849 (description "Osm2pgsql is a tool for loading OpenStreetMap data into a
850PostgreSQL / PostGIS database suitable for applications like rendering into a
851map, geocoding with Nominatim, or general analysis.")
852 (license license:gpl2+)))
6f91223f
JL
853
854(define-public tippecanoe
855 (package
856 (name "tippecanoe")
857 (version "1.31.5")
8f33d05e
TGR
858 (source
859 (origin
860 (method git-fetch)
861 (uri (git-reference
862 (url "https://github.com/mapbox/tippecanoe.git")
863 (commit version)))
864 (file-name (git-file-name name version))
865 (sha256
866 (base32 "1m0x931a945sr7axyhcvpwh798m58hx1zxh6ikgf9gsgqhdhmszz"))))
6f91223f
JL
867 (build-system gnu-build-system)
868 (arguments
869 `(#:phases
870 (modify-phases %standard-phases (delete 'configure))
871 #:test-target "test"
872 #:make-flags
873 (list "CC=gcc"
874 (string-append "PREFIX=" (assoc-ref %outputs "out")))))
875 (inputs
876 `(("perl" ,perl)
877 ("sqlite" ,sqlite)
878 ("zlib" ,zlib)))
879 (home-page "https://github.com/mapbox/tippecanoe")
880 (synopsis "Vector tile server for maps")
881 (description "Tippecanoe creates scale-independent view of data, so that
882the texture and density of features is visible at every zoom level, instead of
883dropping features at lower levels.")
884 (license license:bsd-2)))
ed72a133
GLV
885
886(define-public osmctools
887 (package
888 (name "osmctools")
889 (version "0.9")
890 (source
891 (origin
892 (method git-fetch)
893 (uri (git-reference
894 (url "https://gitlab.com/osm-c-tools/osmctools")
895 (commit version)))
896 (file-name (git-file-name name version))
897 (sha256
898 (base32
899 "1m8d3r1q1v05pkr8k9czrmb4xjszw6hvgsf3kn9pf0v14gpn4r8f"))))
900 (build-system gnu-build-system)
901 (native-inputs
902 `(("autoconf" ,autoconf)
903 ("automake" ,automake)))
904 (inputs
905 `(("zlib" ,zlib)))
906 (home-page "https://gitlab.com/osm-c-tools/osmctools")
907 (synopsis "Tools to convert, filter and update OpenStreetMap data files")
908 (description "This project contains a few tools which are used in the
909OpenStreetMap project. They can be used to convert, filter and update
910OpenStreetMap data files.")
911 (license license:agpl3)))
ee34be73
GLV
912
913(define-public osm-gps-map
914 (package
915 (name "osm-gps-map")
916 (version "1.1.0")
917 (source
918 (origin
919 (method url-fetch)
920 (uri (string-append
921 "https://github.com/nzjrs/osm-gps-map/releases/download/"
922 version "/osm-gps-map-" version ".tar.gz"))
923 (sha256
924 (base32
925 "11imsf4cz1dpxdjh178k2s29axmq86rkfg1pqmn7incyxmjzhbwg"))))
926 (build-system gnu-build-system)
927 (native-inputs
928 `(("gnome-common" ,gnome-common)
929 ("gtk-doc" ,gtk-doc)
930 ("pkg-config" ,pkg-config)))
931 (inputs
932 `(("cairo" ,cairo)
933 ("glib" ,glib)
934 ("gobject-introspection" ,gobject-introspection)
935 ("gtk+" ,gtk+)
936 ("libsoup" ,libsoup)))
937 (home-page "https://nzjrs.github.io/osm-gps-map/")
938 (synopsis "GTK+ widget for displaying OpenStreetMap tiles")
939 (description
940 "This package provides a GTK+ widget (and Python bindings) that when
941given GPS coordinates,draws a GPS track, and points of interest on a moving
942map display. Downloads map data from a number of websites, including
943@url{https://www.openstreetmap.org}.")
944 (license license:gpl2+)))
0f7b8a7f
EF
945
946(define-public xygrib
947 (package
948 (name "xygrib")
29bdabb6 949 (version "1.2.6.1")
0f7b8a7f
EF
950 (source (origin
951 (method git-fetch)
952 (uri (git-reference
953 (url "https://github.com/opengribs/XyGrib.git")
954 (commit (string-append "v" version))))
955 (file-name (git-file-name name version))
956 (sha256
957 (base32
29bdabb6 958 "0xzsm8pr0zjk3f8j880fg5n82jyxn8xf1330qmmq1fqv7rsrg9ia"))
0f7b8a7f
EF
959 (modules '((guix build utils)))
960 (snippet
961 '(begin (delete-file-recursively "data/fonts") #t))))
962 (build-system cmake-build-system)
963 (arguments
964 `(#:phases
965 (modify-phases %standard-phases
966 (add-after 'unpack 'patch-directories
967 (lambda* (#:key inputs #:allow-other-keys)
968 (let ((jpeg (assoc-ref inputs "openjpeg"))
969 (font (assoc-ref inputs "font-liberation")))
970 (substitute* "CMakeLists.txt"
971 ;; Find libjpeg.
972 (("/usr") jpeg)
973 ;; Fix install locations.
974 (("set\\(PREFIX_BIN.*") "set(PREFIX_BIN \"bin\")\n")
975 (("set\\(PREFIX_PKGDATA.*") "set(PREFIX_PKGDATA \"share/${PROJECT_NAME}\")\n")
976 ;; Skip looking for the static library.
977 (("\"libnova.a\"") ""))
978 ;; Don't use the bundled font-liberation.
979 (substitute* "src/util/Font.cpp"
980 (("Util::pathFonts\\(\\)\\+\"liberation-fonts/\"")
981 (string-append "\"" font "/share/fonts/truetype/\"")))
982 (substitute* "src/util/Util.h"
983 (("pathData\\(\\)\\+\"data/fonts/\"")
984 (string-append "\"" font "/share/fonts/\""))))
985 #t)))
986 #:tests? #f)) ; no tests
987 (native-inputs
988 `(("qttools" ,qttools)))
989 (inputs
990 `(("bzip2" ,bzip2)
991 ("font-liberation" ,font-liberation)
992 ("libnova" ,libnova)
993 ("libpng" ,libpng)
994 ("openjpeg" ,openjpeg)
995 ("proj.4" ,proj.4)
996 ("qtbase" ,qtbase)
997 ("zlib" ,zlib)))
998 (synopsis "Weather Forecast Visualization")
999 (description
1000 "XyGrib is a Grib file reader and visualizes meteorological data providing
1001an off-line capability to analyse weather forecasts or hindcasts. It is
1002intended to be used as a capable weather work station for anyone with a serious
1003interest in examining weather. This would include members of the sailing
1004community, private and sport aviators, farmers, weather buffs and many more.
1005XyGrib is the continuation of the zyGrib software package with a new team of
1006volunteers.")
1007 (home-page "https://opengribs.org")
1008 (license license:gpl3+)))
41b4b713
1009
1010(define-public libspatialindex
1011 (package
1012 (name "libspatialindex")
1013 (version "1.8.5")
1014 (source
1015 (origin
1016 (method url-fetch)
1017 (uri (string-append "https://download.osgeo.org/libspatialindex/"
1018 "spatialindex-src-" version ".tar.gz"))
1019 (sha256
1020 (base32
1021 "1vxzm7kczwnb6qdmc0hb00z8ykx11zk3sb68gc7rch4vrfi4dakw"))))
1022 (build-system gnu-build-system)
1023 (home-page "https://libspatialindex.org")
1024 (synopsis "Spatial indexing library")
1025 (description "The purpose of this library is to provide:
1026
1027@itemize
1028 @item An extensible framework that will support robust spatial indexing
1029methods.
1030 @item Support for sophisticated spatial queries. Range, point location,
1031 nearest neighbor and k-nearest neighbor as well as parametric queries (defined
1032by spatial constraints) should be easy to deploy and run.
1033 @item Easy to use interfaces for inserting, deleting and updating information.
1034 @item Wide variety of customization capabilities. Basic index and storage
1035characteristics like the page size, node capacity, minimum fan-out, splitting
1036algorithm, etc. should be easy to customize.
1037 @item Index persistence. Internal memory and external memory structures
1038should be supported. Clustered and non-clustered indices should be easy to be
1039persisted.
1040@end itemize
1041")
1042 (license license:expat)))
6dd0e41d
JL
1043
1044(define-public java-jmapviewer
1045 (package
1046 (name "java-jmapviewer")
1047 (version "2.12")
1048 (source (origin
1049 (method url-fetch)
1050 (uri (string-append "https://svn.openstreetmap.org/applications/"
1051 "viewer/jmapviewer/releases/" version
1052 "/JMapViewer-" version "-Source.zip"))
1053 (sha256
1054 (base32
1055 "08hbqsbs859v4m5d90560fdifavd1apnpz9v9iry1v31dsvy5707"))))
1056 (build-system ant-build-system)
1057 (native-inputs
1058 `(("unzip" ,unzip)))
1059 (arguments
1060 `(#:build-target "pack"
1061 #:tests? #f; No tests
1062 #:phases
1063 (modify-phases %standard-phases
1064 (add-before 'build 'clean
1065 (lambda* _
1066 (invoke "ant" "clean")))
1067 (replace 'install
1068 (lambda* (#:key outputs #:allow-other-keys)
1069 (let ((dir (string-append (assoc-ref outputs "out") "/share/java/")))
1070 (mkdir-p dir)
1071 (copy-file "JMapViewer.jar" (string-append dir "JMapViewer.jar"))))))))
1072 (home-page "https://wiki.openstreetmap.org/wiki/JMapViewer")
1073 (synopsis "OSM map integration in Java")
1074 (description "JMapViewer is a Java component which allows to easily
1075integrate an OSM map view into your Java application. It is maintained as
1076an independent project by the JOSM team.")
1077 (license license:gpl2)))
f041db86
JL
1078
1079(define-public josm
1080 (package
1081 (name "josm")
1082 (version "15492")
1083 (source (origin
1084 (method svn-fetch)
1085 (uri (svn-reference
1086 (url "https://josm.openstreetmap.de/svn/trunk")
1087 (revision (string->number version))
1088 (recursive? #f)))
1089 (sha256
1090 (base32
1091 "12xkwcv77as30a61w1c8a0i2b0kiiks71d487gbdfv7azlj4vqia"))
1092 (file-name (string-append name "-" version "-checkout"))
1093 (modules '((guix build utils)))
1094 (snippet
1095 '(begin
1096 (for-each delete-file (find-files "." ".*.jar$"))
1097 #t))))
1098 (build-system ant-build-system)
1099 (native-inputs
1100 `(("javacc" ,javacc)))
1101 (inputs
1102 `(("java-commons-jcs" ,java-commons-jcs)
1103 ("java-commons-compress" ,java-commons-compress)
1104 ("java-jmapviewer" ,java-jmapviewer)
1105 ("java-jsonp-api" ,java-jsonp-api)
1106 ("java-jsonp-impl" ,java-jsonp-impl); runtime dependency
1107 ("java-metadata-extractor" ,java-metadata-extractor)
1108 ("java-openjfx-media" ,java-openjfx-media)
1109 ("java-signpost-core" ,java-signpost-core)
1110 ("java-svg-salamander" ,java-svg-salamander)))
1111 (arguments
1112 `(#:tests? #f
1113 #:jar-name "josm.jar"
1114 #:phases
1115 (modify-phases %standard-phases
1116 (add-after 'unpack 'rm-build.xml
1117 (lambda* _
1118 (delete-file "build.xml")
1119 #t))
1120 (add-before 'build 'fix-revision
1121 (lambda* _
1122 (with-output-to-file "REVISION.XML"
1123 (lambda _
1124 (display
1125 (string-append "<info><entry><commit revision=\"" ,version "\">"
1126 "<date>1970-01-01 00:00:00 +0000</date>"
1127 "</commit></entry></info>"))))
1128 #t))
1129 (add-before 'build 'fix-classpath
1130 (lambda* (#:key inputs #:allow-other-keys)
1131 (setenv "CLASSPATH"
1132 (string-join
1133 (filter
1134 (lambda (s)
1135 (let ((source (assoc-ref inputs "source")))
1136 (not (equal? (substring s 0 (string-length source)) source))))
1137 (string-split (getenv "CLASSPATH") #\:))
1138 ":"))
1139 #t))
1140 (add-before 'build 'generate-parser
1141 (lambda* _
1142 (let* ((dir "src/org/openstreetmap/josm/gui/mappaint/mapcss")
1143 (out (string-append dir "/parsergen"))
1144 (file (string-append dir "/MapCSSParser.jj")))
1145 (mkdir-p "src/org/openstreetmap/josm/gui/mappaint/mapcss/parsergen")
1146 (invoke "javacc" "-DEBUG_PARSER=false"
1147 "-DEBUG_TOKEN_MANAGER=false" "-JDK_VERSION=1.8"
1148 "-GRAMMAR_ENCODING=UTF-8"
1149 (string-append "-OUTPUT_DIRECTORY=" out)
1150 file))
1151 #t))
1152 (add-after 'build 'generate-epsg
1153 (lambda _
1154 (system* "javac" "scripts/BuildProjectionDefinitions.java"
1155 "-cp" "build/classes")
1156 (mkdir-p "data/projection")
1157 (with-output-to-file "data/projection/custom-epsg"
1158 (lambda _ (display "")))
1159 (invoke "java" "-cp" "build/classes:scripts:."
1160 "BuildProjectionDefinitions" ".")
1161 #t))
1162 (add-after 'generate-epsg 'copy-data
1163 (lambda _
1164 (mkdir-p "build/classes")
1165 (rename-file "data" "build/classes/data")
1166 #t))
1167 (add-before 'install 'regenerate-jar
1168 (lambda _
1169 ;; We need to regenerate the jar file to add data.
1170 (delete-file "build/jar/josm.jar")
1171 (invoke "jar" "-cf" "build/jar/josm.jar" "-C"
1172 "build/classes" ".")
1173 #t))
1174 (add-before 'build 'copy-styles
1175 (lambda _
1176 (mkdir-p "build/classes")
1177 (rename-file "styles" "build/classes/styles")
1178 #t))
1179 (add-before 'build 'copy-images
1180 (lambda _
1181 (mkdir-p "build/classes")
1182 (rename-file "images" "build/classes/images")
1183 #t))
1184 (add-before 'build 'copy-revision
1185 (lambda _
1186 (mkdir-p "build/classes")
1187 (with-output-to-file "build/classes/REVISION"
1188 (lambda _
1189 (display
1190 (string-append "Revision: " ,version "\n"
1191 "Is-Local-Build: true\n"
1192 "Build-Date: 1970-01-01 00:00:00 +0000\n"))))
1193 #t))
1194 (add-after 'install 'install-bin
1195 (lambda* (#:key outputs inputs #:allow-other-keys)
1196 (let* ((out (assoc-ref outputs "out"))
1197 (bin (string-append out "/bin")))
1198 (mkdir-p bin)
1199 (with-output-to-file (string-append bin "/josm")
1200 (lambda _
1201 (display
1202 (string-append "#!/bin/sh\n"
1203 (assoc-ref inputs "jdk") "/bin/java"
1204 " -cp " out "/share/java/josm.jar:"
1205 (getenv "CLASSPATH")
1206 " org.openstreetmap.josm.gui.MainApplication"))))
1207 (chmod (string-append bin "/josm") #o755))
1208 #t)))))
1209 (home-page "https://josm.openstreetmap.de")
1210 (synopsis "OSM editor")
1211 (description "JOSM is an extensible editor for OpenStreetMap (OSM). It
1212supports loading GPX tracks, background imagery and OSM data from local
1213sources as well as from online sources and allows to edit the OSM data (nodes,
1214ways, and relations) and their metadata tags.")
1215 (license license:gpl2+)))