gnu: gnuastro: Update to 0.14.
[jackhill/guix/guix.git] / gnu / packages / astronomy.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016 John Darrington <jmd@gnu.org>
3 ;;; Copyright © 2018–2021 Tobias Geerinckx-Rice <me@tobias.gr>
4 ;;; Copyright © 2018, 2019, 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
5 ;;; Copyright © 2019 by Amar Singh <nly@disroot.org>
6 ;;; Copyright © 2020 R Veera Kumar <vkor@vkten.in>
7 ;;; Copyright © 2020 Guillaume Le Vaillant <glv@posteo.net>
8 ;;; Copyright © 2021 Sharlatan Hellseher <sharlatanus@gmail.com>
9 ;;;
10 ;;; This file is part of GNU Guix.
11 ;;;
12 ;;; GNU Guix is free software; you can redistribute it and/or modify it
13 ;;; under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 3 of the License, or (at
15 ;;; your option) any later version.
16 ;;;
17 ;;; GNU Guix is distributed in the hope that it will be useful, but
18 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
21 ;;;
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24
25 (define-module (gnu packages astronomy)
26 #:use-module (guix packages)
27 #:use-module ((guix licenses) #:prefix license:)
28 #:use-module (guix download)
29 #:use-module (guix git-download)
30 #:use-module (guix utils)
31 #:use-module (gnu packages)
32 #:use-module (gnu packages algebra)
33 #:use-module (gnu packages autotools)
34 #:use-module (gnu packages compression)
35 #:use-module (gnu packages curl)
36 #:use-module (gnu packages fontutils)
37 #:use-module (gnu packages gettext)
38 #:use-module (gnu packages gl)
39 #:use-module (gnu packages glib)
40 #:use-module (gnu packages gnome)
41 #:use-module (gnu packages gtk)
42 #:use-module (gnu packages image)
43 #:use-module (gnu packages lua)
44 #:use-module (gnu packages maths)
45 #:use-module (gnu packages netpbm)
46 #:use-module (gnu packages perl)
47 #:use-module (gnu packages pkg-config)
48 #:use-module (gnu packages pretty-print)
49 #:use-module (gnu packages qt)
50 #:use-module (gnu packages version-control)
51 #:use-module (gnu packages xiph)
52 #:use-module (gnu packages xorg)
53 #:use-module (guix build-system cmake)
54 #:use-module (guix build-system gnu)
55 #:use-module (ice-9 match)
56 #:use-module (srfi srfi-1))
57
58 (define-public cfitsio
59 (package
60 (name "cfitsio")
61 (version "3.49")
62 (source
63 (origin
64 (method url-fetch)
65 (uri (string-append
66 "http://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/"
67 "cfitsio-" version ".tar.gz"))
68 (sha256
69 (base32 "1cyl1qksnkl3cq1fzl4dmjvkd6329b57y9iqyv44wjakbh6s4rav"))))
70 (build-system gnu-build-system)
71 ;; XXX Building with curl currently breaks wcslib. It doesn't use
72 ;; pkg-config and hence won't link with -lcurl.
73 (arguments
74 `(#:tests? #f ; no tests
75 #:phases
76 (modify-phases %standard-phases
77 (add-after 'unpack 'patch-paths
78 (lambda _
79 (substitute* "Makefile.in" (("/bin/") ""))
80 #t)))))
81 (home-page "https://heasarc.gsfc.nasa.gov/fitsio/fitsio.html")
82 (synopsis "Library for reading and writing FITS files")
83 (description "CFITSIO provides simple high-level routines for reading and
84 writing @dfn{FITS} (Flexible Image Transport System) files that insulate the
85 programmer from the internal complexities of the FITS format. CFITSIO also
86 provides many advanced features for manipulating and filtering the information
87 in FITS files.")
88 (license (license:non-copyleft "file://License.txt"
89 "See License.txt in the distribution."))))
90
91 (define-public wcslib
92 (package
93 (name "wcslib")
94 (version "6.4")
95 (source
96 (origin
97 (method url-fetch)
98 (uri (string-append
99 "ftp://ftp.atnf.csiro.au/pub/software/wcslib/wcslib-" version
100 ".tar.bz2"))
101 (sha256
102 (base32 "003h23m6d5wcs29v2vbnl63f3z35k5x70lpsqlz5c9bp1bvizh8k"))))
103 (inputs
104 `(("cfitsio" ,cfitsio)))
105 (build-system gnu-build-system)
106 (arguments
107 `(#:configure-flags
108 (list (string-append "--with-cfitsiolib="
109 (assoc-ref %build-inputs "cfitsio") "/lib")
110 (string-append "--with-cfitsioinc="
111 (assoc-ref %build-inputs "cfitsio") "/include"))
112 #:phases
113 (modify-phases %standard-phases
114 (add-before 'configure 'patch-/bin/sh
115 (lambda _
116 (substitute* "makedefs.in"
117 (("/bin/sh") "sh"))
118 #t))
119 (delete 'install-license-files)) ; installed by ‘make install’
120 ;; Parallel execution of the test suite is not supported.
121 #:parallel-tests? #f))
122 (home-page "https://www.atnf.csiro.au/people/mcalabre/WCS")
123 (synopsis "Library which implements the FITS WCS standard")
124 (description "The FITS \"World Coordinate System\" (@dfn{WCS}) standard
125 defines keywords and usage that provide for the description of astronomical
126 coordinate systems in a @dfn{FITS} (Flexible Image Transport System) image
127 header.")
128 (license license:lgpl3+)))
129
130 (define-public gnuastro
131 (package
132 (name "gnuastro")
133 (version "0.14")
134 (source
135 (origin
136 (method url-fetch)
137 (uri (string-append "mirror://gnu/gnuastro/gnuastro-"
138 version ".tar.lz"))
139 (sha256
140 (base32
141 "1xp6n42qxv0x6yigi2w2l5k8006smv27lhrcssysgsvzbydghzg5"))))
142 (build-system gnu-build-system)
143 (arguments
144 '(#:configure-flags '("--disable-static")))
145 (inputs
146 `(("cfitsio" ,cfitsio)
147 ("curl" ,curl-minimal)
148 ("gsl" ,gsl)
149 ("libgit2" ,libgit2)
150 ("libjpeg" ,libjpeg-turbo)
151 ("libtiff" ,libtiff)
152 ("wcslib" ,wcslib)
153 ("zlib" ,zlib)))
154 (native-inputs
155 `(("libtool" ,libtool)
156 ("lzip" ,lzip)))
157 (home-page "https://www.gnu.org/software/gnuastro/")
158 (synopsis "Astronomy utilities")
159 (description "The GNU Astronomy Utilities (Gnuastro) is a suite of
160 programs for the manipulation and analysis of astronomical data.")
161 (license license:gpl3+)))
162
163 (define-public sextractor
164 (package
165 (name "sextractor")
166 (version "2.25.0")
167 (source
168 (origin
169 (method git-fetch)
170 (uri (git-reference
171 (url "https://github.com/astromatic/sextractor")
172 (commit version)))
173 (file-name (git-file-name name version))
174 (sha256
175 (base32 "0q69n3nyal57h3ik2xirwzrxzljrwy9ivwraxzv9566vi3n4z5mw"))))
176 (build-system gnu-build-system)
177 ;; NOTE: (Sharlatan-20210124T103117+0000): Building with `atlas' is failing
178 ;; due to missing shared library which required on configure phase. Switch
179 ;; build to use `openblas' instead. It requires FFTW with single precision
180 ;; `fftwf'.
181 (arguments
182 `(#:configure-flags
183 (list
184 "--enable-openblas"
185 (string-append
186 "--with-openblas-libdir=" (assoc-ref %build-inputs "openblas") "/lib")
187 (string-append
188 "--with-openblas-incdir=" (assoc-ref %build-inputs "openblas") "/include")
189 (string-append
190 "--with-fftw-libdir=" (assoc-ref %build-inputs "fftw") "/lib")
191 (string-append
192 "--with-fftw-incdir=" (assoc-ref %build-inputs "fftw") "/include"))))
193 (native-inputs
194 `(("autoconf" ,autoconf)
195 ("automake" ,automake)
196 ("libtool" ,libtool)))
197 (inputs
198 `(("openblas" ,openblas)
199 ("fftw" ,fftwf)))
200 (home-page "http://www.astromatic.net/software/sextractor")
201 (synopsis "Extract catalogs of sources from astronomical images")
202 (description
203 "SExtractor is a program that builds a catalogue of objects from an
204 astronomical image. Although it is particularly oriented towards reduction of
205 large scale galaxy-survey data, it can perform reasonably well on moderately
206 crowded star fields.")
207 (license license:gpl3+)))
208
209 (define-public stellarium
210 (package
211 (name "stellarium")
212 (version "0.20.4")
213 (source
214 (origin
215 (method url-fetch)
216 (uri (string-append "https://github.com/Stellarium/stellarium"
217 "/releases/download/v" version
218 "/stellarium-" version ".tar.gz"))
219 (sha256
220 (base32 "1253zlr0mi4kdbj119spxk7spg4rkahb4rlpd0hz1d81mnv3n0v3"))))
221 (build-system cmake-build-system)
222 (inputs
223 `(("qtbase" ,qtbase)
224 ("qtlocation" ,qtlocation)
225 ("qtmultimedia" ,qtmultimedia)
226 ("qtscript" ,qtscript)
227 ("qtserialport" ,qtserialport)
228 ("zlib" ,zlib)))
229 (native-inputs
230 `(("gettext" ,gettext-minimal) ; xgettext is used at compile time
231 ("perl" ,perl) ; for pod2man
232 ("qtbase" ,qtbase) ; Qt MOC is needed at compile time
233 ("qttools" ,qttools)))
234 (arguments
235 `(#:test-target "test"
236 #:configure-flags (list "-DENABLE_TESTING=1"
237 (string-append
238 "-DCMAKE_CXX_FLAGS=-isystem "
239 (assoc-ref %build-inputs "qtserialport")
240 "/include/qt5"))
241 #:phases (modify-phases %standard-phases
242 (add-before 'check 'set-offscreen-display
243 (lambda _
244 ;; Make Qt render "offscreen", required for tests.
245 (setenv "QT_QPA_PLATFORM" "offscreen")
246 (setenv "HOME" "/tmp")
247 #t)))))
248 (home-page "https://stellarium.org/")
249 (synopsis "3D sky viewer")
250 (description "Stellarium is a planetarium. It shows a realistic sky in
251 3D, just like what you see with the naked eye, binoculars, or a telescope. It
252 can be used to control telescopes over a serial port for tracking celestial
253 objects.")
254 (license license:gpl2+)))
255
256 (define-public celestia
257 (let ((commit "9dbdf29c4ac3d20afb2d9a80d3dff241ecf81dce"))
258 (package
259 (name "celestia")
260 (version (git-version "1.6.1" "815" commit))
261 (source (origin
262 (method git-fetch)
263 (uri (git-reference
264 (url "https://github.com/celestiaproject/celestia")
265 (commit commit)))
266 (file-name (git-file-name name version))
267 (sha256
268 (base32
269 "00xibg87l1arzifakgj7s828x9pszcgx7x7ij88a561ig49ryh78"))))
270 (build-system cmake-build-system)
271 (native-inputs
272 `(("perl" ,perl)
273 ("libgit2" ,libgit2)
274 ("pkg-config" ,pkg-config)
275 ("libtool" ,libtool)
276 ("gettext" ,gettext-minimal)))
277 (inputs
278 `(("glu" ,glu)
279 ("glew" ,glew)
280 ("libtheora" ,libtheora)
281 ("libjpeg" ,libjpeg-turbo)
282 ("libpng" ,libpng)
283 ;; maybe required?
284 ("mesa" ,mesa)
285 ;; optional: fmtlib, Eigen3;
286 ("fmt" ,fmt)
287 ("eigen" ,eigen)
288 ;; glut: for glut interface
289 ("freeglut" ,freeglut)))
290 (propagated-inputs
291 `(("lua" ,lua)))
292 (arguments
293 `(#:configure-flags '("-DENABLE_GLUT=ON" "-DENABLE_QT=OFF")
294 #:tests? #f)) ;no tests
295 (home-page "https://celestia.space/")
296 (synopsis "Real-time 3D visualization of space")
297 (description
298 "This simulation program lets you explore our universe in three
299 dimensions. Celestia simulates many different types of celestial objects.
300 From planets and moons to star clusters and galaxies, you can visit every
301 object in the expandable database and view it from any point in space and
302 time. The position and movement of solar system objects is calculated
303 accurately in real time at any rate desired.")
304 (license license:gpl2+))))
305
306 (define-public celestia-gtk
307 (package
308 (inherit celestia)
309 (name "celestia-gtk")
310 (inputs
311 (append (alist-delete "freeglut" (package-inputs celestia))
312 `(("gtk2" ,gtk+-2)
313 ("gtkglext" ,gtkglext))))
314 (arguments
315 `(#:configure-flags '("-DENABLE_GTK=ON" "-DENABLE_QT=OFF")
316 #:tests? #f))))
317
318 (define-public libnova
319 (package
320 (name "libnova")
321 (version "0.16")
322 (source
323 (origin
324 (method git-fetch)
325 (uri (git-reference
326 (url "https://git.code.sf.net/p/libnova/libnova.git")
327 (commit (string-append "v" version))))
328 (file-name (git-file-name name version))
329 (sha256
330 (base32
331 "0icwylwkixihzni0kgl0j8dx3qhqvym6zv2hkw2dy6v9zvysrb1b"))))
332 (build-system gnu-build-system)
333 (arguments
334 `(#:phases
335 (modify-phases %standard-phases
336 (add-after 'unpack 'patch-git-version
337 (lambda _
338 (substitute* "./git-version-gen"
339 (("/bin/sh") (which "sh")))
340 #t)))))
341 (native-inputs
342 `(("autoconf" ,autoconf)
343 ("automake" ,automake)
344 ("libtool" ,libtool)))
345 (synopsis "Celestial mechanics, astrometry and astrodynamics library")
346 (description "Libnova is a general purpose, double precision, Celestial
347 Mechanics, Astrometry and Astrodynamics library.")
348 (home-page "http://libnova.sourceforge.net/")
349 (license (list license:lgpl2.0+
350 license:gpl2+)))) ; examples/transforms.c & lntest/*.c
351
352 (define-public libpasastro
353 ;; NOTE: (Sharlatan-20210122T215921+0000): the version tag has a build
354 ;; error on spice which is resolved with the latest commit.
355 (let ((commit "e3c218d1502a18cae858c83a9a8812ab197fcb60")
356 (revision "1"))
357 (package
358 (name "libpasastro")
359 (version (git-version "1.4.0" revision commit))
360 (source (origin
361 (method git-fetch)
362 (uri (git-reference
363 (url "https://github.com/pchev/libpasastro")
364 (commit commit)))
365 (file-name (git-file-name name version))
366 (sha256
367 (base32
368 "0asp2sn34nds5va2ghppwc41vb6j3d1mf049j949rgrll817kx47"))))
369 (build-system gnu-build-system)
370 (arguments
371 `(#:tests? #f
372 #:make-flags
373 (list
374 ,(match (or (%current-target-system) (%current-system))
375 ((or "aarch64-linux" "armhf-linux" "i686-linux" "x86_64-linux")
376 "OS_TARGET=linux")
377 (_ #f))
378 ,(match (or (%current-target-system) (%current-system))
379 ("i686-linux" "CPU_TARGET=i386")
380 ("x86_64-linux" "CPU_TARGET=x86_64")
381 ((or "armhf-linux" "aarch64-linux") "CPU_TARGET=armv7l")
382 (_ #f))
383 (string-append "PREFIX=" (assoc-ref %outputs "out")))
384 #:phases
385 (modify-phases %standard-phases
386 (delete 'configure))))
387 (home-page "https://github.com/pchev/libpasastro")
388 (synopsis "Interface to astronomy library for use from Pascal program")
389 (description
390 "This package provides shared libraries to interface Pascal program with
391 standard astronomy libraries:
392
393 @itemize
394 @item @code{libpasgetdss.so}: Interface with GetDSS to work with DSS images.
395 @item @code{libpasplan404.so}: Interface with Plan404 to compute planets position.
396 @item @code{libpaswcs.so}: Interface with libwcs to work with FITS WCS.
397 @item @code{libpasspice.so}: To work with NAIF/SPICE kernel.
398 @end itemize\n")
399 (license license:gpl2+))))
400
401 (define-public xplanet
402 (package
403 (name "xplanet")
404 (version "1.3.1")
405 (source
406 (origin
407 (method url-fetch)
408 (uri
409 (string-append
410 "mirror://sourceforge/xplanet/xplanet/"
411 version "/xplanet-" version ".tar.gz"))
412 (sha256
413 (base32 "1rzc1alph03j67lrr66499zl0wqndiipmj99nqgvh9xzm1qdb023"))
414 (patches
415 (search-patches
416 "xplanet-1.3.1-cxx11-eof.patch"
417 "xplanet-1.3.1-libdisplay_DisplayOutput.cpp.patch"
418 "xplanet-1.3.1-libimage_gif.c.patch"
419 "xplanet-1.3.1-xpUtil-Add2017LeapSecond.cpp.patch"))))
420 (build-system gnu-build-system)
421 (native-inputs
422 `(("pkg-config" ,pkg-config)))
423 (inputs
424 `(("libx11" ,libx11)
425 ("libxscrnsaver" ,libxscrnsaver)
426 ("libice" ,libice)
427 ("freetype" ,freetype)
428 ("pango" ,pango)
429 ("giflib" ,giflib)
430 ("libjpeg" ,libjpeg-turbo)
431 ("libpng" ,libpng)
432 ("libtiff" ,libtiff)
433 ("netpbm" ,netpbm)
434 ("zlib" ,zlib)))
435 (arguments
436 `(#:configure-flags
437 (let ((netpbm (assoc-ref %build-inputs "netpbm")))
438 (append (list
439 ;; Give correct path for pnm.h header to configure script
440 (string-append "CPPFLAGS=-I" netpbm "/include/netpbm")
441 ;; no nasa jpl cspice support
442 "--without-cspice" )))))
443 (home-page "http://xplanet.sourceforge.net/")
444 (synopsis "Planetary body renderer")
445 (description
446 "Xplanet renders an image of a planet into an X window or file.
447 All of the major planets and most satellites can be drawn and different map
448 projections are also supported, including azimuthal, hemisphere, Lambert,
449 Mercator, Mollweide, Peters, polyconic, orthographic and rectangular.")
450 (license license:gpl2+)))
451
452 (define-public gpredict
453 (package
454 (name "gpredict")
455 (version "2.2.1")
456 (source
457 (origin
458 (method url-fetch)
459 (uri (string-append "https://github.com/csete/gpredict/releases"
460 "/download/v" version
461 "/gpredict-" version ".tar.bz2"))
462 (sha256
463 (base32 "0hwf97kng1zy8rxyglw04x89p0bg07zq30hgghm20yxiw2xc8ng7"))))
464 (build-system gnu-build-system)
465 (native-inputs
466 `(("intltool" ,intltool)
467 ("gettext" ,gettext-minimal)
468 ("pkg-config" ,pkg-config)))
469 (inputs
470 `(("curl" ,curl)
471 ("glib" ,glib)
472 ("goocanvas" ,goocanvas)
473 ("gtk+" ,gtk+)))
474 (arguments
475 `(#:phases
476 (modify-phases %standard-phases
477 (add-after 'unpack 'fix-tests
478 (lambda _
479 ;; Remove reference to non-existent file.
480 (substitute* "po/POTFILES.in"
481 (("src/gtk-sat-tree\\.c")
482 ""))
483 #t)))))
484 (synopsis "Satellite tracking and orbit prediction application")
485 (description
486 "Gpredict is a real-time satellite tracking and orbit prediction
487 application. It can track a large number of satellites and display their
488 position and other data in lists, tables, maps, and polar plots (radar view).
489 Gpredict can also predict the time of future passes for a satellite, and
490 provide you with detailed information about each pass.")
491 (home-page "http://gpredict.oz9aec.net/index.php")
492 (license license:gpl2+)))