Skip to content

Commit

Permalink
Support new locations of unix, str and dynlink
Browse files Browse the repository at this point in the history
  • Loading branch information
dra27 committed Mar 19, 2022
1 parent 47da7ee commit e11720f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
16 changes: 13 additions & 3 deletions src/ocaml_specific.ml
Original file line number Diff line number Diff line change
Expand Up @@ -819,9 +819,19 @@ camlp4_flags' ["camlp4orr", S[A"camlp4of"; A"-parser"; A"reloaded"];

flag ["ocaml"; "pp"; "camlp4:no_quot"] (A"-no_quot");;

ocaml_lib ~extern:true "dynlink";;
ocaml_lib ~extern:true "unix";;
ocaml_lib ~extern:true "str";;
let ocaml_otherlibs_lib =
match split_ocaml_version with
| Some (major, minor, _, _) when (major, minor) >= (5, 0) ->
fun name ->
let dir = "+" ^ name in
ocaml_lib ~extern:true ~dir name;
flag ["ocaml"; "compile"; "use_" ^ name] (S[A"-I"; A dir])
| _ ->
fun name -> ocaml_lib ~extern:true name;;

ocaml_otherlibs_lib "dynlink";;
ocaml_otherlibs_lib "unix";;
ocaml_otherlibs_lib "str";;
ocaml_lib ~extern:true "bigarray";;
ocaml_lib ~extern:true "nums";;
ocaml_lib ~extern:true "dbm";;
Expand Down
10 changes: 8 additions & 2 deletions src/plugin.ml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,12 @@ module Make(U:sig end) =
let unix_lib =
if use_ocamlfind_pkgs then `Package "unix"
else if use_light_mode then `Nothing
else `Lib "unix" in
else let dir = match split_ocaml_version with
| Some (major, minor, _, _) when (major, minor) >= (5, 0) ->
Some "unix"
| _ -> None
in
`Lib ("unix", dir) in

let ocamlbuild_lib =
if use_ocamlfind_pkgs then `Package "ocamlbuild"
Expand All @@ -198,7 +203,8 @@ module Make(U:sig end) =
let spec = function
| `Nothing -> N
| `Package pkg -> S[A "-package"; A pkg]
| `Lib lib -> P (lib -.- cma)
| `Lib (lib, Some dir) -> S[A "-I"; A ("+" ^ dir); P (lib -.- cma)]
| `Lib (lib, None) -> P (lib -.- cma)
| `Local_lib llib -> S [A "-I"; A dir; P (in_dir (llib -.- cma))]
| `Local_mod lmod -> P (in_dir (lmod -.- cmo)) in

Expand Down

0 comments on commit e11720f

Please sign in to comment.