diff --git a/compiler/lib/dune b/compiler/lib/dune index 768d293c15..07cc98ed02 100644 --- a/compiler/lib/dune +++ b/compiler/lib/dune @@ -3,8 +3,8 @@ (public_name js_of_ocaml-compiler) (synopsis "Js_of_ocaml compiler library") (libraries - compiler-libs.common - compiler-libs.bytecomp + ocaml-compiler-libs.common + ocaml-compiler-libs.bytecomp menhirLib sedlex yojson) diff --git a/compiler/lib/magic_number.ml b/compiler/lib/magic_number.ml index 693430bc5e..3cff4be55b 100644 --- a/compiler/lib/magic_number.ml +++ b/compiler/lib/magic_number.ml @@ -64,22 +64,14 @@ let compare (p1, n1) (p2, n2) = let equal a b = compare a b = 0 -let v = +let () = let current = Ocaml_version.current in - match current with - | 4 :: 13 :: _ -> 30 - | 4 :: 14 :: _ -> 31 - | 5 :: 00 :: _ -> 32 - | 5 :: 01 :: _ -> 33 - | 5 :: 02 :: _ -> 34 - | 5 :: 03 :: _ -> 35 - | 5 :: 04 :: _ -> 36 - | _ -> - if Ocaml_version.compare current [ 4; 13 ] < 0 - then failwith "OCaml version unsupported. Upgrade to OCaml 4.13 or newer." - else ( - assert (Ocaml_version.compare current [ 5; 5 ] >= 0); - failwith "OCaml version unsupported. Upgrade js_of_ocaml.") + if Ocaml_version.compare current [ 4; 13 ] < 0 + then failwith "OCaml version unsupported. Upgrade to OCaml 4.13 or newer." + else if Ocaml_version.compare current [ 5; 5 ] >= 0 + then failwith "OCaml version unsupported. Upgrade js_of_ocaml." + +let v = snd (of_string Ocaml_common.Config.exec_magic_number) let current_exe = "Caml1999X", v diff --git a/dune-project b/dune-project index 676fe82cb9..45b9ce66de 100644 --- a/dune-project +++ b/dune-project @@ -21,6 +21,7 @@ (num :with-test) (ppx_expect (and (>= v0.16.1) :with-test)) (ppxlib (>= 0.35)) + (ocaml-compiler-libs (>= v0.12.4)) (re :with-test) (cmdliner (>= 1.1.0)) (sedlex (>= 3.3)) diff --git a/js_of_ocaml-compiler.opam b/js_of_ocaml-compiler.opam index 98e4e00b15..4d3cbdde9c 100644 --- a/js_of_ocaml-compiler.opam +++ b/js_of_ocaml-compiler.opam @@ -17,6 +17,7 @@ depends: [ "num" {with-test} "ppx_expect" {>= "v0.16.1" & with-test} "ppxlib" {>= "0.35"} + "ocaml-compiler-libs" {>= "v0.12.4"} "re" {with-test} "cmdliner" {>= "1.1.0"} "sedlex" {>= "3.3"}