diff mbox series

[bug#69185,master] gnu: ocaml: Update to 5.1.1

Message ID f12147e60124381318d6f422628c669c081da36d.1708191568.git.marc@mccd.space
State New
Headers show
Series [bug#69185,master] gnu: ocaml: Update to 5.1.1 | expand

Commit Message

Marc Coquand Feb. 17, 2024, 5:39 p.m. UTC
* gnu/packages/ocaml.scm (ocaml): Update to 5.1.1

Change-Id: Ie95f2e31185a5f5ef345839d357d5768e4299fcc
---
 gnu/packages/ocaml.scm | 56 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)


base-commit: 3cf199dbcf85a44fa8370e786e568fc3feb7067c

Comments

pukkamustard March 24, 2024, 6:57 a.m. UTC | #1
Thanks!

I wonder how useful the OCaml compiler itself is without a
`package-with-ocaml5.1` transformation? The `ocaml` package itself just
provides the compiler but no nice way (afaik) of using the compiler with
dependencies and all. Do you think it would make sense to add a
`package-with-ocaml5.1` transformation in `(guix build-system ocaml)`?

Maybe even better we can replace the OCaml 5.0 compiler with a newer
version. The only packages depending on ocaml-5.0 are ocaml5.0-merlin
and ocaml5.0-eio. They could be updated to use a newer OCaml
version. Maybe no point in keeping OCaml 5.0 around. What do you think?

-pukkamustard


Marc Coquand <marc@mccd.space> writes:

> * gnu/packages/ocaml.scm (ocaml): Update to 5.1.1
>
> Change-Id: Ie95f2e31185a5f5ef345839d357d5768e4299fcc
> ---
>  gnu/packages/ocaml.scm | 56 ++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 56 insertions(+)
>
> diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
> index 0f4c351141..f7b9f9b81a 100644
> --- a/gnu/packages/ocaml.scm
> +++ b/gnu/packages/ocaml.scm
> @@ -191,6 +191,62 @@ (define-public camlboot
>  This package produces a native @command{ocamlc} and a bytecode @command{ocamllex}.")
>        (license license:expat))))
>  
> +(define-public ocaml-5.1
> +  (package
> +    (name "ocaml")
> +    (version "5.1.1")
> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri (git-reference
> +             (url "https://github.com/ocaml/ocaml")
> +             (commit version)))
> +       (file-name (git-file-name name version))
> +       (sha256
> +        (base32 "19sjc8r2c78y7g47jjxb1c30zzvkdhgy8yp3i1kkz1hm6nj96adr"))))
> +    (build-system gnu-build-system)
> +    (native-search-paths
> +     (list (search-path-specification
> +            (variable "OCAMLPATH")
> +            (files (list "lib/ocaml" "lib/ocaml/site-lib")))
> +           (search-path-specification
> +            (variable "CAML_LD_LIBRARY_PATH")
> +            (files (list "lib/ocaml/site-lib/stubslibs"
> +                         "lib/ocaml/site-lib/stublibs")))))
> +    (native-inputs (list perl pkg-config))
> +    (inputs (list libx11 libiberty ;needed for objdump support
> +                  zlib)) ;also needed for objdump support
> +    (arguments
> +     `(#:configure-flags '("--enable-ocamltest")
> +       #:test-target "tests"
> +       #:make-flags '("defaultentry")
> +       #:phases (modify-phases %standard-phases
> +                  (add-after 'unpack 'patch-/bin/sh-references
> +                    (lambda* (#:key inputs #:allow-other-keys)
> +                      (let* ((sh (search-input-file inputs "/bin/sh"))
> +                             (quoted-sh (string-append "\"" sh "\"")))
> +                        (with-fluids ((%default-port-encoding #f))
> +                                     (for-each (lambda (file)
> +                                                 (substitute* file
> +                                                   (("\"/bin/sh\"")
> +                                                    (begin
> +                                                      (format (current-error-port)
> +                                                       "patch-/bin/sh-references: ~a: changing `\"/bin/sh\"' to `~a'~%"
> +                                                       file quoted-sh)
> +                                                      quoted-sh))))
> +                                               (find-files "." "\\.ml$")))))))))
> +    (home-page "https://ocaml.org/")
> +    (synopsis "The OCaml programming language")
> +    (description
> +     "OCaml is a general purpose industrial-strength programming language with
> +an emphasis on expressiveness and safety.  Developed for more than 20 years at
> +Inria it benefits from one of the most advanced type systems and supports
> +functional, imperative and object-oriented styles of programming.")
> +    ;; The compiler is distributed under qpl1.0 with a change to choice of
> +    ;; law: the license is governed by the laws of France.  The library is
> +    ;; distributed under lgpl2.0.
> +    (license (list license:qpl license:lgpl2.0))))
> +
>  (define-public ocaml-5.0
>    (package
>      (name "ocaml")
>
> base-commit: 3cf199dbcf85a44fa8370e786e568fc3feb7067c
pukkamustard March 26, 2024, 9:03 p.m. UTC | #2
Marc Coquand <marc@mccd.space> writes:

>> Do you think it would make sense to add a
>> `package-with-ocaml5.1` transformation in `(guix build-system ocaml)`?
>
> Absolutely, or replace the ocaml5.0 one.
>
>> Maybe even better we can replace the OCaml 5.0 compiler with a newer
>> version. The only packages depending on ocaml-5.0 are ocaml5.0-merlin
>> and ocaml5.0-eio. They could be updated to use a newer OCaml
>> version. Maybe no point in keeping OCaml 5.0 around. What do you think?
>
> I see there is also in packages/ocaml.scm:
>
> - ocaml5.0-merlin-reader
> - ocaml5.0-ppx-expect
> - ocaml5.0-dune-bootstrap
> - ocaml5.0-crowbar
> - ocaml5.0-findlib
>
> I assume that if we replace the old 5.0 version, we would need to bump
> these packages as well, since they use Ocaml 5.0?

Yes.

> I am relatively new to software packaging, so I do not know what best
> practice is here: if it is best to replace the old version or create an
> entry for the new version.

Hm, I'd say it's good to keep versions around that are being used by
other packages in Guix or it is a version where we can assume that
significant amount of people are using it from Guix for things outside
of Guix.

I think OCaml 5.0 is neither:

- The ocaml5.0-* packages are mostly to get a working development
  environment (ocaml5.0-merlin and dependencies).
- Our ocaml5.0-eio is outdated and the recently released Eio 1.0.0 only
  supports OCaml 5.1.1 or later.
- There's not much reason to use OCaml 5.0 when OCaml 5.1 is available.

I'd suggest replacing OCaml 5.0 with OCaml 5.1 in Guix.

Happy hacking!

-pukkamustard

> pukkamustard <pukkamustard@posteo.net> writes:
>
>> Thanks!
>>
>> I wonder how useful the OCaml compiler itself is without a
>> `package-with-ocaml5.1` transformation? The `ocaml` package itself just
>> provides the compiler but no nice way (afaik) of using the compiler with
>> dependencies and all. Do you think it would make sense to add a
>> `package-with-ocaml5.1` transformation in `(guix build-system ocaml)`?
>>
>> Maybe even better we can replace the OCaml 5.0 compiler with a newer
>> version. The only packages depending on ocaml-5.0 are ocaml5.0-merlin
>> and ocaml5.0-eio. They could be updated to use a newer OCaml
>> version. Maybe no point in keeping OCaml 5.0 around. What do you think?
>>
>> -pukkamustard
>>
>>
>> Marc Coquand <marc@mccd.space> writes:
>>
>>> * gnu/packages/ocaml.scm (ocaml): Update to 5.1.1
>>>
>>> Change-Id: Ie95f2e31185a5f5ef345839d357d5768e4299fcc
>>> ---
>>>  gnu/packages/ocaml.scm | 56 ++++++++++++++++++++++++++++++++++++++++++
>>>  1 file changed, 56 insertions(+)
>>>
>>> diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
>>> index 0f4c351141..f7b9f9b81a 100644
>>> --- a/gnu/packages/ocaml.scm
>>> +++ b/gnu/packages/ocaml.scm
>>> @@ -191,6 +191,62 @@ (define-public camlboot
>>>  This package produces a native @command{ocamlc} and a bytecode @command{ocamllex}.")
>>>        (license license:expat))))
>>>  
>>> +(define-public ocaml-5.1
>>> +  (package
>>> +    (name "ocaml")
>>> +    (version "5.1.1")
>>> +    (source
>>> +     (origin
>>> +       (method git-fetch)
>>> +       (uri (git-reference
>>> +             (url "https://github.com/ocaml/ocaml")
>>> +             (commit version)))
>>> +       (file-name (git-file-name name version))
>>> +       (sha256
>>> +        (base32 "19sjc8r2c78y7g47jjxb1c30zzvkdhgy8yp3i1kkz1hm6nj96adr"))))
>>> +    (build-system gnu-build-system)
>>> +    (native-search-paths
>>> +     (list (search-path-specification
>>> +            (variable "OCAMLPATH")
>>> +            (files (list "lib/ocaml" "lib/ocaml/site-lib")))
>>> +           (search-path-specification
>>> +            (variable "CAML_LD_LIBRARY_PATH")
>>> +            (files (list "lib/ocaml/site-lib/stubslibs"
>>> +                         "lib/ocaml/site-lib/stublibs")))))
>>> +    (native-inputs (list perl pkg-config))
>>> +    (inputs (list libx11 libiberty ;needed for objdump support
>>> +                  zlib)) ;also needed for objdump support
>>> +    (arguments
>>> +     `(#:configure-flags '("--enable-ocamltest")
>>> +       #:test-target "tests"
>>> +       #:make-flags '("defaultentry")
>>> +       #:phases (modify-phases %standard-phases
>>> +                  (add-after 'unpack 'patch-/bin/sh-references
>>> +                    (lambda* (#:key inputs #:allow-other-keys)
>>> +                      (let* ((sh (search-input-file inputs "/bin/sh"))
>>> +                             (quoted-sh (string-append "\"" sh "\"")))
>>> +                        (with-fluids ((%default-port-encoding #f))
>>> +                                     (for-each (lambda (file)
>>> +                                                 (substitute* file
>>> +                                                   (("\"/bin/sh\"")
>>> +                                                    (begin
>>> +                                                      (format (current-error-port)
>>> +                                                       "patch-/bin/sh-references: ~a: changing `\"/bin/sh\"' to `~a'~%"
>>> +                                                       file quoted-sh)
>>> +                                                      quoted-sh))))
>>> +                                               (find-files "." "\\.ml$")))))))))
>>> +    (home-page "https://ocaml.org/")
>>> +    (synopsis "The OCaml programming language")
>>> +    (description
>>> +     "OCaml is a general purpose industrial-strength programming language with
>>> +an emphasis on expressiveness and safety.  Developed for more than 20 years at
>>> +Inria it benefits from one of the most advanced type systems and supports
>>> +functional, imperative and object-oriented styles of programming.")
>>> +    ;; The compiler is distributed under qpl1.0 with a change to choice of
>>> +    ;; law: the license is governed by the laws of France.  The library is
>>> +    ;; distributed under lgpl2.0.
>>> +    (license (list license:qpl license:lgpl2.0))))
>>> +
>>>  (define-public ocaml-5.0
>>>    (package
>>>      (name "ocaml")
>>>
>>> base-commit: 3cf199dbcf85a44fa8370e786e568fc3feb7067c
Ludovic Courtès March 29, 2024, 10:19 p.m. UTC | #3
Hello pukkamustard,

pukkamustard <pukkamustard@posteo.net> skribis:

> Hm, I'd say it's good to keep versions around that are being used by
> other packages in Guix or it is a version where we can assume that
> significant amount of people are using it from Guix for things outside
> of Guix.
>
> I think OCaml 5.0 is neither:
>
> - The ocaml5.0-* packages are mostly to get a working development
>   environment (ocaml5.0-merlin and dependencies).
> - Our ocaml5.0-eio is outdated and the recently released Eio 1.0.0 only
>   supports OCaml 5.1.1 or later.
> - There's not much reason to use OCaml 5.0 when OCaml 5.1 is available.
>
> I'd suggest replacing OCaml 5.0 with OCaml 5.1 in Guix.

Can removing 5.0 be done in a followup patch?  Should we apply this
patch in this meantime, or would you suggest adjusting it beforehand?

Thanks,
Ludo’.
pukkamustard April 1, 2024, 6:19 a.m. UTC | #4
Hi Ludo`,

Ludovic Courtès <ludo@gnu.org> writes:

>
> Can removing 5.0 be done in a followup patch?  Should we apply this
> patch in this meantime, or would you suggest adjusting it beforehand?
>

Yes, that can be done. Might even be good to keep the update to 5.1.1 in
two smaller patche sets (one to add 5.1.1, one to remove 5.0.0).

I would suggest adding a package-with-ocaml5.1 transformation to this
patch series (as dependencies probably ocaml5.1-findlib and
ocaml5.1-dune). This would make the new compiler more directly usable
and would help in testing the new compiler for OCaml packages already in
Guix.

-pukkamustard
Ludovic Courtès April 2, 2024, 3:50 p.m. UTC | #5
Hello,

pukkamustard <pukkamustard@posteo.net> skribis:

> I would suggest adding a package-with-ocaml5.1 transformation to this
> patch series (as dependencies probably ocaml5.1-findlib and
> ocaml5.1-dune). This would make the new compiler more directly usable
> and would help in testing the new compiler for OCaml packages already in
> Guix.

Marc, could you look into adding this?

(I’m not on the OCaml team but I Cc’d Julien who’s one of them.  If
Julien is unavailable and pukkamustard gives a green light, I can apply
the revised patch on their behalf.)

Ludo’.
Marc Coquand April 2, 2024, 5:42 p.m. UTC | #6
Hey!

I'll have a look at this when I have time, hopefully tomorrow or end of
the week.  :)

Sincerely,
Marc

Ludovic Courtès <ludo@gnu.org> writes:

> Hello,
>
> pukkamustard <pukkamustard@posteo.net> skribis:
>
>> I would suggest adding a package-with-ocaml5.1 transformation to this
>> patch series (as dependencies probably ocaml5.1-findlib and
>> ocaml5.1-dune). This would make the new compiler more directly usable
>> and would help in testing the new compiler for OCaml packages already in
>> Guix.
>
> Marc, could you look into adding this?
>
> (I’m not on the OCaml team but I Cc’d Julien who’s one of them.  If
> Julien is unavailable and pukkamustard gives a green light, I can apply
> the revised patch on their behalf.)
>
> Ludo’.
diff mbox series

Patch

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 0f4c351141..f7b9f9b81a 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -191,6 +191,62 @@  (define-public camlboot
 This package produces a native @command{ocamlc} and a bytecode @command{ocamllex}.")
       (license license:expat))))
 
+(define-public ocaml-5.1
+  (package
+    (name "ocaml")
+    (version "5.1.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/ocaml/ocaml")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "19sjc8r2c78y7g47jjxb1c30zzvkdhgy8yp3i1kkz1hm6nj96adr"))))
+    (build-system gnu-build-system)
+    (native-search-paths
+     (list (search-path-specification
+            (variable "OCAMLPATH")
+            (files (list "lib/ocaml" "lib/ocaml/site-lib")))
+           (search-path-specification
+            (variable "CAML_LD_LIBRARY_PATH")
+            (files (list "lib/ocaml/site-lib/stubslibs"
+                         "lib/ocaml/site-lib/stublibs")))))
+    (native-inputs (list perl pkg-config))
+    (inputs (list libx11 libiberty ;needed for objdump support
+                  zlib)) ;also needed for objdump support
+    (arguments
+     `(#:configure-flags '("--enable-ocamltest")
+       #:test-target "tests"
+       #:make-flags '("defaultentry")
+       #:phases (modify-phases %standard-phases
+                  (add-after 'unpack 'patch-/bin/sh-references
+                    (lambda* (#:key inputs #:allow-other-keys)
+                      (let* ((sh (search-input-file inputs "/bin/sh"))
+                             (quoted-sh (string-append "\"" sh "\"")))
+                        (with-fluids ((%default-port-encoding #f))
+                                     (for-each (lambda (file)
+                                                 (substitute* file
+                                                   (("\"/bin/sh\"")
+                                                    (begin
+                                                      (format (current-error-port)
+                                                       "patch-/bin/sh-references: ~a: changing `\"/bin/sh\"' to `~a'~%"
+                                                       file quoted-sh)
+                                                      quoted-sh))))
+                                               (find-files "." "\\.ml$")))))))))
+    (home-page "https://ocaml.org/")
+    (synopsis "The OCaml programming language")
+    (description
+     "OCaml is a general purpose industrial-strength programming language with
+an emphasis on expressiveness and safety.  Developed for more than 20 years at
+Inria it benefits from one of the most advanced type systems and supports
+functional, imperative and object-oriented styles of programming.")
+    ;; The compiler is distributed under qpl1.0 with a change to choice of
+    ;; law: the license is governed by the laws of France.  The library is
+    ;; distributed under lgpl2.0.
+    (license (list license:qpl license:lgpl2.0))))
+
 (define-public ocaml-5.0
   (package
     (name "ocaml")