From 778bde78cf184f4a713c67d0ae8af7899c4c95be Mon Sep 17 00:00:00 2001 From: Sharlatan Hellseher Date: Wed, 11 Sep 2024 14:09:22 +0100 Subject: [PATCH] gnu: Add healpix. * gnu/packages/astronomy.scm (healpix): New variable. (healpix-source): New procedure. Change-Id: I41dcee1ba9df1988dd9c4ee40b07daab5418e001 --- gnu/packages/astronomy.scm | 62 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/gnu/packages/astronomy.scm b/gnu/packages/astronomy.scm index c8d4cbfef3..5987afc478 100644 --- a/gnu/packages/astronomy.scm +++ b/gnu/packages/astronomy.scm @@ -111,6 +111,7 @@ (define-module (gnu packages astronomy) #:use-module (guix packages) #:use-module (guix utils) #:use-module (ice-9 match) + #:use-module (ice-9 format) #:use-module (srfi srfi-1)) (define-public alfa @@ -601,6 +602,67 @@ (define-public cfitsio-4.4 (sha256 (base32 "098x1l8ijwsjp2ivp3v7pamrmpgwj5xmgb4yppm9w3w044zxr8b6")))))) +(define* (healpix-source #:key version sha256-base32-hash) + ;; The sources of HEALPix containing 6 independent packages (Fortran90, + ;; IDL, C, C++, java and python) and distributed togather libsharp. + (origin + (method url-fetch) + (uri + (let* ((name "Healpix") + (version-list (string-split version #\.)) + (name+version (format #f "~a_~{~a.~a~a~}" name version-list))) + (string-append "mirror://sourceforge/healpix/" + name+version "/" name+version "_" "2022Jul28.tar.gz"))) + (sha256 + (base32 sha256-base32-hash )))) + +(define-public healpix + (package + (name "healpix") + (version "3.8.2") + (source + (healpix-source + #:version version + #:sha256-base32-hash "09x1lafq01gzk16yvmz2pdhrxnqfjp3b2p9hlgy0dbrdg82ryqj7")) + (build-system gnu-build-system) + (arguments + (list + #:tests? #f ; no tests + #:make-flags + #~(list "shared" + "AR=ar -rsv" + "OPT=-O2 -Wall" + "PIC=-fPIC" + (string-append "CC=" #$(cc-for-target)) + (string-append "CFITSIO_INCDIR=" + #$(this-package-input "cfitsio") "/include") + (string-append "CFITSIO_LIBDIR=" + #$(this-package-input "cfitsio") "/lib") + (string-append "INCDIR=" #$output "/include") + (string-append "LIBDIR=" #$output "/lib")) + #:phases + #~(modify-phases %standard-phases + (delete 'configure) ; no configure + (add-after 'unpack 'chdir-c + (lambda _ + (chdir "src/C/subs"))) + (add-before 'install 'set-output-directories + (lambda _ + (mkdir-p (string-append #$output "/include")) + (mkdir-p (string-append #$output "/lib"))))))) + (native-inputs + (list pkg-config autoconf automake)) + (inputs + (list cfitsio)) + (home-page "https://healpix.jpl.nasa.gov/") + (synopsis "Representation of spherical data") + (description + "@acronym{HEALPix, Hierarchical Equal Area isoLatitude Pixelation} of a +sphere produces a subdivision of a spherical surface in which each pixel +covers the same surface area as every other pixel. This package provides the +dynamic library for the C language implementation of HEALPix.") + (license license:gpl2+))) + (define-public erfa (package (name "erfa")