Skip to content

Commit d89d51a

Browse files
committed
Replace Sys.ocaml_release with Sys.ocaml_version to avoid opam installation failure on 4.12
1 parent 497ea77 commit d89d51a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/dynarray/dune

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@
33
(* We generate an appropriate dune stanza to avoid Dynarray tests build failures
44
on 5.0 and 5.1 with the opam-less CI GitHub action setup *)
55

6-
let at_least_52 = Sys.(ocaml_release.major,ocaml_release.minor) >= (5,2)
6+
(* Use ocaml_version instead of ocaml_release (from 4.14) to support 4.12 opam install *)
7+
let ocaml_version_pair =
8+
let (major,minor) = match String.split_on_char '.' Sys.ocaml_version with
9+
| major::minor::_ -> (major,minor)
10+
| _ -> failwith "Unable to extract OCaml version" in
11+
try (int_of_string major, int_of_string minor)
12+
with Failure _ -> failwith "Failed to parse OCaml version"
713

814
let dune =
9-
if at_least_52
15+
if ocaml_version_pair >= (5,2)
1016
then Printf.sprintf {|
1117
(test
1218
(name lin_tests)

0 commit comments

Comments
 (0)