diff mbox series

[bug#61674,1/4] gnu: Add calcmysky.

Message ID 20230226004406.6215-1-sharlatanus@gmail.com
State New
Headers show
Series [bug#61674,1/4] gnu: Add calcmysky. | expand

Commit Message

Sharlatan Hellseher Feb. 26, 2023, 12:44 a.m. UTC
* gnu/packages/astronomy.scm (calcmysky, calcmysky-qt5): New variables.
---
 gnu/packages/astronomy.scm | 59 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

Comments

Leo Famulari Feb. 26, 2023, 2:55 a.m. UTC | #1
On Sun, Feb 26, 2023 at 12:44:03AM +0000, Sharlatan Hellseher wrote:
> * gnu/packages/astronomy.scm (calcmysky, calcmysky-qt5): New variables.

Thanks for these patches!

> +  #:use-module ((guix build utils) #:select (alist-replace))
[...]
> +(define-public calcmysky-qt5
> +  (package
> +    (inherit calcmysky)
> +    (name "calcmysky-qt5")
> +    (arguments
> +     (list #:configure-flags
> +           #~(list "-DQT_VERSION=5"
> +                   "-DCMAKE_CXX_FLAGS=-fPIC")))
> +    (inputs
> +     (alist-replace "qtbase" (list qtbase-5)
> +                    (package-inputs calcmysky)))

Can you try rewriting this using modify-inputs, rather than
alist-replace?

https://guix.gnu.org/manual/devel/en/html_node/Defining-Package-Variants.html#Defining-Package-Variants

Feel free to ask for help if you get stuck.
Ludovic Courtès Feb. 27, 2023, 9:14 p.m. UTC | #2
Hi!

Thanks for a nice patch series!

Sharlatan Hellseher <sharlatanus@gmail.com> skribis:

> * gnu/packages/astronomy.scm (calcmysky, calcmysky-qt5): New variables.

[...]

> +    (license license:gpl3)))

Please double-check whether something explicitly says “version 3 only”;
if not, it’s ‘gpl3+’.

> +(define-public calcmysky-qt5
> +  (package
> +    (inherit calcmysky)

Rather:

  (package/inherit calcmysky
    (name "calcmysky-qt5")
    …)

> +    (inputs
> +     (alist-replace "qtbase" (list qtbase-5)
> +                    (package-inputs calcmysky)))

Instead of ‘alist-replace’, write

  (modify-inputs (package-inputs calcmysky)
    (replace "qtbase" qtbase-5))

You can remove the corresponding #:use-module form at the top.

Ludo’.
Simon Tournier Feb. 28, 2023, 10:35 a.m. UTC | #3
Hi Ludo,

On lun., 27 févr. 2023 at 22:14, Ludovic Courtès <ludo@gnu.org> wrote:

>> +(define-public calcmysky-qt5
>> +  (package
>> +    (inherit calcmysky)
>
> Rather:
>
>   (package/inherit calcmysky
>     (name "calcmysky-qt5")
>     …)

Out of curiosity, what is the rationale for this suggestion?

Cheers,
simon
Ludovic Courtès March 3, 2023, 10:49 a.m. UTC | #4
Hi,

Simon Tournier <zimon.toutoune@gmail.com> skribis:

> On lun., 27 févr. 2023 at 22:14, Ludovic Courtès <ludo@gnu.org> wrote:
>
>>> +(define-public calcmysky-qt5
>>> +  (package
>>> +    (inherit calcmysky)
>>
>> Rather:
>>
>>   (package/inherit calcmysky
>>     (name "calcmysky-qt5")
>>     …)
>
> Out of curiosity, what is the rationale for this suggestion?

This is so that the ‘replacement’ field of ‘calcmysky’, when there is
one, inherits the same transformations in ‘calcmysky-qt5’.  Quoth the
‘package/inherit’ docstring:

  Like (package (inherit P) OVERRIDES ...), except that the same
  transformation is done to the package P's replacement, if any.  P must
  be a bare identifier, and will be bound to either P or its replacement
  when evaluating OVERRIDES.

Ludo’.
Simon Tournier March 3, 2023, 11:04 a.m. UTC | #5
Hi,

On Fri, 3 Mar 2023 at 11:49, Ludovic Courtès <ludo@gnu.org> wrote:

> This is so that the ‘replacement’ field of ‘calcmysky’, when there is
> one, inherits the same transformations in ‘calcmysky-qt5’.  Quoth the
> ‘package/inherit’ docstring:
>
>   Like (package (inherit P) OVERRIDES ...), except that the same
>   transformation is done to the package P's replacement, if any.  P must
>   be a bare identifier, and will be bound to either P or its replacement
>   when evaluating OVERRIDES.

Thanks for the explanations but it is still unclear.  Sorry to be slow.

It is not clear for me why you choose one over the other.  From my
current understanding, I would be tempted to always use
'package/inherit' and never plain 'inherit'.

Cheers,
simon
Maxim Cournoyer March 3, 2023, 3:54 p.m. UTC | #6
Hi Simon,

Simon Tournier <zimon.toutoune@gmail.com> writes:

> Hi,
>
> On Fri, 3 Mar 2023 at 11:49, Ludovic Courtès <ludo@gnu.org> wrote:
>
>> This is so that the ‘replacement’ field of ‘calcmysky’, when there is
>> one, inherits the same transformations in ‘calcmysky-qt5’.  Quoth the
>> ‘package/inherit’ docstring:
>>
>>   Like (package (inherit P) OVERRIDES ...), except that the same
>>   transformation is done to the package P's replacement, if any.  P must
>>   be a bare identifier, and will be bound to either P or its replacement
>>   when evaluating OVERRIDES.
>
> Thanks for the explanations but it is still unclear.  Sorry to be slow.
>
> It is not clear for me why you choose one over the other.  From my
> current understanding, I would be tempted to always use
> 'package/inherit' and never plain 'inherit'.

I also got confused by that in the past;  The way I process it
internally now is this:

If the inheritance is for *same-source/same-version* variants of a
package, they should use package/inherit, as any security issues found
in the parent package should also be applied to that package (since they
use the same source).  Otherwise, plain 'inherit' should be used
(e.g. for newer version variants).

I hope that helps!

Yours in slowness,
Simon Tournier March 3, 2023, 6:19 p.m. UTC | #7
Hi Maxim,

On Fri, 3 Mar 2023 at 16:54, Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:

> If the inheritance is for *same-source/same-version* variants of a
> package, they should use package/inherit, as any security issues found
> in the parent package should also be applied to that package (since they
> use the same source).  Otherwise, plain 'inherit' should be used
> (e.g. for newer version variants).

Aahh, that makes sense. :-)  Thank you.

For instance, does it mean that

--8<---------------cut here---------------start------------->8---
(define-public gst-plugins-good-qt
  (package
    (inherit gst-plugins-good)
    (name "gst-plugins-good-qt")
    (inputs
     (modify-inputs (package-inputs gst-plugins-good)
       (prepend qtbase-5
                qtdeclarative-5
                qtwayland-5
                qtx11extras)))))
--8<---------------cut here---------------end--------------->8---

would be incorrect?  It should be 'package/inherit', right?

Cheers,
simon
Maxim Cournoyer March 4, 2023, 3:32 a.m. UTC | #8
Hi Simon,

Simon Tournier <zimon.toutoune@gmail.com> writes:

> Hi Maxim,
>
> On Fri, 3 Mar 2023 at 16:54, Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:
>
>> If the inheritance is for *same-source/same-version* variants of a
>> package, they should use package/inherit, as any security issues found
>> in the parent package should also be applied to that package (since they
>> use the same source).  Otherwise, plain 'inherit' should be used
>> (e.g. for newer version variants).
>
> Aahh, that makes sense. :-)  Thank you.
>
> For instance, does it mean that
>
> (define-public gst-plugins-good-qt
>   (package
>     (inherit gst-plugins-good)
>     (name "gst-plugins-good-qt")
>     (inputs
>      (modify-inputs (package-inputs gst-plugins-good)
>        (prepend qtbase-5
>                 qtdeclarative-5
>                 qtwayland-5
>                 qtx11extras)))))
>
> would be incorrect?  It should be 'package/inherit', right?

It should be package/inherit yes, since they share the same source, thus
the same defects, thus should receive the same replacements/grafts (if
my preceding reasoning is correct :-)).
Sharlatan Hellseher March 4, 2023, 11:11 a.m. UTC | #9
Hi all,

It was very insightful patch series I ever sent :-)
I hope I covered all recommendations in v3.

Thanks,
Oleg

On Sat, 4 Mar 2023, 03:32 Maxim Cournoyer, <maxim.cournoyer@gmail.com>
wrote:

> Hi Simon,
>
> Simon Tournier <zimon.toutoune@gmail.com> writes:
>
> > Hi Maxim,
> >
> > On Fri, 3 Mar 2023 at 16:54, Maxim Cournoyer <maxim.cournoyer@gmail.com>
> wrote:
> >
> >> If the inheritance is for *same-source/same-version* variants of a
> >> package, they should use package/inherit, as any security issues found
> >> in the parent package should also be applied to that package (since they
> >> use the same source).  Otherwise, plain 'inherit' should be used
> >> (e.g. for newer version variants).
> >
> > Aahh, that makes sense. :-)  Thank you.
> >
> > For instance, does it mean that
> >
> > (define-public gst-plugins-good-qt
> >   (package
> >     (inherit gst-plugins-good)
> >     (name "gst-plugins-good-qt")
> >     (inputs
> >      (modify-inputs (package-inputs gst-plugins-good)
> >        (prepend qtbase-5
> >                 qtdeclarative-5
> >                 qtwayland-5
> >                 qtx11extras)))))
> >
> > would be incorrect?  It should be 'package/inherit', right?
>
> It should be package/inherit yes, since they share the same source, thus
> the same defects, thus should receive the same replacements/grafts (if
> my preceding reasoning is correct :-)).
>
> --
> Thanks,
> Maxim
>
diff mbox series

Patch

diff --git a/gnu/packages/astronomy.scm b/gnu/packages/astronomy.scm
index 5cee981671..0f3176bc3e 100644
--- a/gnu/packages/astronomy.scm
+++ b/gnu/packages/astronomy.scm
@@ -26,6 +26,7 @@ 
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages astronomy)
+  #:use-module ((guix build utils) #:select (alist-replace))
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages algebra)
   #:use-module (gnu packages autotools)
@@ -209,6 +210,64 @@  (define-public calceph
 @end itemize\n")
     (license license:cecill)))
 
+(define-public calcmysky
+  (package
+    (name "calcmysky")
+    (version "0.2.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/10110111/CalcMySky")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0bib5shy8wzc7j5ph218dl9hqrqip491mn25gakyghbvaqxgm27d"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list #:configure-flags
+           #~(list "-DQT_VERSION=6"
+                   "-DCMAKE_CXX_FLAGS=-fPIC")))
+    (inputs
+     (list eigen glm qtbase))
+    (home-page "https://10110111.github.io/CalcMySky/")
+    (synopsis "Simulator of light scattering by planetary atmospheres")
+    (description
+     "CalcMySky is a software package that simulates scattering of light by the
+atmosphere to render daytime and twilight skies (without stars).  Its primary
+purpose is to enable realistic view of the sky in applications such as
+planetaria.  Secondary objective is to make it possible to explore atmospheric
+effects such as glories, fogbows etc., as well as simulate unusual environments
+such as on Mars or an exoplanet orbiting a star with a non-solar spectrum of
+radiation.
+
+This package consists of three parts:
+
+@itemize
+@item @code{calcmysky} utility that does the precomputation of the atmosphere
+model to enable rendering.
+
+@item @code{libShowMySky} library that lets the applications render the
+atmosphere model.
+
+@item @code{ShowMySky} preview GUI that makes it possible to preview the
+rendering of the atmosphere model and examine its properties.
+@end itemize")
+    (license license:gpl3)))
+
+(define-public calcmysky-qt5
+  (package
+    (inherit calcmysky)
+    (name "calcmysky-qt5")
+    (arguments
+     (list #:configure-flags
+           #~(list "-DQT_VERSION=5"
+                   "-DCMAKE_CXX_FLAGS=-fPIC")))
+    (inputs
+     (alist-replace "qtbase" (list qtbase-5)
+                    (package-inputs calcmysky)))
+    (synopsis "Qt5 build for the CalcMySky library.")))
+
 (define-public aoflagger
   (package
     (name "aoflagger")