diff mbox series

[bug#60793] gnu: Add julia-cfitsio-jll.

Message ID 20230113221658.8158-1-sharlatanus@gmail.com
State New
Headers show
Series [bug#60793] gnu: Add julia-cfitsio-jll. | expand

Commit Message

Sharlatan Hellseher Jan. 13, 2023, 10:16 p.m. UTC
* gnu/packages/julia-jll.scm (julia-cfitsio-jll): New variable.
---
 gnu/packages/julia-jll.scm | 45 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

Comments

Simon Tournier Jan. 16, 2023, 5:08 p.m. UTC | #1
Hi,

On ven., 13 janv. 2023 at 22:16, Sharlatan Hellseher <sharlatanus@gmail.com> wrote:
> * gnu/packages/julia-jll.scm (julia-cfitsio-jll): New variable.

Thank for this patch.

Well, out of curiosity, why is this package required?  I mean, usually
JLL packages are binding to access from Julia to some libraries.
Therefore, do you plan to use this package for another regular Julia
package?


> +  #:use-module (guix gexp)

[...]

> +      #~(modify-phases %standard-phases
> +          (add-after 'link-depot 'override-binary-path
> +            (lambda* (#:key inputs #:allow-other-keys)

[...]

> +                     (assoc-ref inputs "cfitsio") "\")\n"))))

I do not think (guix gexp) is required here.  For instance, other
packages just use, for instance:

--8<---------------cut here---------------start------------->8---
    (arguments
     '(#:tests? #f ; no runtests
       #:phases
       (modify-phases %standard-phases
         (add-after 'link-depot 'override-binary-path
           (lambda* (#:key inputs #:allow-other-keys)
             (map
               (lambda (wrapper)
                 (substitute* wrapper
                   (("artifact\"FFMPEG\"")
                    (string-append "\"" (assoc-ref inputs "ffmpeg") "\""))))
               ;; There's a Julia file for each platform, override them all
               (find-files "src/wrappers/" "\\.jl$")))))))
--8<---------------cut here---------------end--------------->8---


Cheers,
simon
Sharlatan Hellseher Jan. 16, 2023, 8:36 p.m. UTC | #2
Hi Simon,

Thanks for your review and comments.

Yes it's a long journey to bring Julia's Astronomical projects to Guix.

Here is my plan:
https://git.sr.ht/~hellseher/ffab/tree/main/item/org/astronomy.org#L1202

cfitsio, wcs and erfa would be essential jll bindings for base Julia
packages.

I've got a question on how to group Julia packages related just to
Astronomy. gnu/packages/astronomy.scm contains python bindings to cfitsio,
wcs and erfa would I follow the same pass and add Julia packages next to
them?

Regards,
Oleg

On Mon, 16 Jan 2023, 18:36 Simon Tournier, <zimon.toutoune@gmail.com> wrote:

> Hi,
>
> On ven., 13 janv. 2023 at 22:16, Sharlatan Hellseher <
> sharlatanus@gmail.com> wrote:
> > * gnu/packages/julia-jll.scm (julia-cfitsio-jll): New variable.
>
> Thank for this patch.
>
> Well, out of curiosity, why is this package required?  I mean, usually
> JLL packages are binding to access from Julia to some libraries.
> Therefore, do you plan to use this package for another regular Julia
> package?
>
>
> > +  #:use-module (guix gexp)
>
> [...]
>
> > +      #~(modify-phases %standard-phases
> > +          (add-after 'link-depot 'override-binary-path
> > +            (lambda* (#:key inputs #:allow-other-keys)
>
> [...]
>
> > +                     (assoc-ref inputs "cfitsio") "\")\n"))))
>
> I do not think (guix gexp) is required here.  For instance, other
> packages just use, for instance:
>
> --8<---------------cut here---------------start------------->8---
>     (arguments
>      '(#:tests? #f ; no runtests
>        #:phases
>        (modify-phases %standard-phases
>          (add-after 'link-depot 'override-binary-path
>            (lambda* (#:key inputs #:allow-other-keys)
>              (map
>                (lambda (wrapper)
>                  (substitute* wrapper
>                    (("artifact\"FFMPEG\"")
>                     (string-append "\"" (assoc-ref inputs "ffmpeg")
> "\""))))
>                ;; There's a Julia file for each platform, override them all
>                (find-files "src/wrappers/" "\\.jl$")))))))
> --8<---------------cut here---------------end--------------->8---
>
>
> Cheers,
> simon
>
Simon Tournier Jan. 17, 2023, 8:03 a.m. UTC | #3
Hi,

On Mon, 16 Jan 2023 at 20:36, Sharlatan Hellseher <sharlatanus@gmail.com> wrote:

> Yes it's a long journey to bring Julia's Astronomical projects to
> Guix.

Cool!  Thank you for this effort.


> I've got a question on how to group Julia packages related just to
> Astronomy. gnu/packages/astronomy.scm contains python bindings to cfitsio,
> wcs and erfa would I follow the same pass and add Julia packages next to
> them?

Well, I think all Julia packages should go to gnu/packages/julia-xyz.scm
with the prefix ’julia-’ for the symbol and the package name.

If, or when, the Julia packages related to astronomy will be too many,
then it will be possible to just move them to
gnu/packages/julia-astronomy.scm.

Last, when writing new Julia packages, please consider some implicit
conventions in these Julia-related modules:

 + sort alphabetically, package name and inputs,

 + if one test does not pass, please disallow it using something like:
   ’#~(modify-phases %standard-phases (add-after 'link-depot
   'skip-failing-test’ (gexp and after link-depot),

 + try set the packages used by the tests under native-inputs.

Cheers,
simon
Sharlatan Hellseher Jan. 29, 2023, 10:26 p.m. UTC | #4
Hi Simon,

I've prepared the full series of patches which include
julia-cfitsio-jll -> julia-cfitsio -> julia-fitsio.
All of the them put in alphabetical order, passed lint and build on
x86_64 hardware.

On Tue, 17 Jan 2023 at 08:39, Simon Tournier <zimon.toutoune@gmail.com> wrote:
>
> Hi,
>
> On Mon, 16 Jan 2023 at 20:36, Sharlatan Hellseher <sharlatanus@gmail.com> wrote:
>
> > Yes it's a long journey to bring Julia's Astronomical projects to
> > Guix.
>
> Cool!  Thank you for this effort.
>
>
> > I've got a question on how to group Julia packages related just to
> > Astronomy. gnu/packages/astronomy.scm contains python bindings to cfitsio,
> > wcs and erfa would I follow the same pass and add Julia packages next to
> > them?
>
> Well, I think all Julia packages should go to gnu/packages/julia-xyz.scm
> with the prefix ’julia-’ for the symbol and the package name.
>
> If, or when, the Julia packages related to astronomy will be too many,
> then it will be possible to just move them to
> gnu/packages/julia-astronomy.scm.
>
> Last, when writing new Julia packages, please consider some implicit
> conventions in these Julia-related modules:
>
>  + sort alphabetically, package name and inputs,
>
>  + if one test does not pass, please disallow it using something like:
>    ’#~(modify-phases %standard-phases (add-after 'link-depot
>    'skip-failing-test’ (gexp and after link-depot),
>
>  + try set the packages used by the tests under native-inputs.
>
> Cheers,
> simon
Simon Tournier Jan. 30, 2023, 11:11 a.m. UTC | #5
Hi,

On dim., 29 janv. 2023 at 22:26, Sharlatan Hellseher <sharlatanus@gmail.com> wrote:

> I've prepared the full series of patches which include
> julia-cfitsio-jll -> julia-cfitsio -> julia-fitsio.
> All of the them put in alphabetical order, passed lint and build on
> x86_64 hardware.

LGTM.  I have tweaked in v2.
Efraim?

Cheers,
simon
diff mbox series

Patch

diff --git a/gnu/packages/julia-jll.scm b/gnu/packages/julia-jll.scm
index 2b0f644736..364088c4b0 100644
--- a/gnu/packages/julia-jll.scm
+++ b/gnu/packages/julia-jll.scm
@@ -3,6 +3,7 @@ 
 ;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
 ;;; Copyright © 2021 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2021 Jean-Baptiste Volatier <jbv@pm.me>
+;;; Copyright © 2023 Sharlatan Hellseher <sharlatanus@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -21,12 +22,14 @@ 
 
 (define-module (gnu packages julia-jll)
   #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix git-download)
   #:use-module (guix utils)
   #:use-module (guix build-system julia)
   #:use-module (gnu packages)
   #:use-module (gnu packages audio)
+  #:use-module (gnu packages astronomy)
   #:use-module (gnu packages base)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages fontutils)
@@ -146,6 +149,48 @@  (define-public julia-cairo-jll
     (description "This package provides a wrapper for the cairo library.")
     (license license:expat)))
 
+(define-public julia-cfitsio-jll
+  (package
+    (name "julia-cfitsio-jll")
+    (version "4.0.0+0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/JuliaBinaryWrappers/CFITSIO_jll.jl")
+             (commit (string-append "CFITSIO-v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1k0mqmpyfjr3ibcmda08llw8m166zw0n3lh5y5aj81q37lrxw990"))))
+    (build-system julia-build-system)
+    (arguments
+     (list
+      #:tests? #f ; no runtests
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'link-depot 'override-binary-path
+            (lambda* (#:key inputs #:allow-other-keys)
+              (map
+               (lambda (wrapper)
+                 (substitute* wrapper
+                   (("using LibCURL_jll") "") ; Not require to download cfitsio.
+                   (("using Zlib_jll") "") ; Not require to upnpack not donwloaded archvie.
+                   (("generate_init_header.*") "generate_init_header()\n" )
+                   (("generate_wrapper_header.*")
+                    (string-append
+                     "generate_wrapper_header(\"CFITSIO\", \""
+                     (assoc-ref inputs "cfitsio") "\")\n"))))
+               ;; There's a Julia file for each platform, override them all
+               (find-files "src/wrappers/" "\\.jl$")))))))
+    (inputs
+     (list cfitsio))
+    (propagated-inputs
+     (list julia-jllwrappers))
+    (home-page "https://github.com/JuliaBinaryWrappers/CFITSIO_jll.jl")
+    (synopsis "cfitsio library wrappers")
+    (description "This package provides a wrapper for the cfitsio library.")
+    (license license:expat)))
+
 (define-public julia-compilersupportlibraries-jll
   (package
     (name "julia-compilersupportlibraries-jll")