Support architectures without natdynlink
This commit is contained in:
parent
ae674faa78
commit
d5d861b40c
|
@ -31,6 +31,7 @@ type t =
|
||||||
; findlib : Findlib.t
|
; findlib : Findlib.t
|
||||||
; arch_sixtyfour : bool
|
; arch_sixtyfour : bool
|
||||||
; opam_var_cache : (string, string) Hashtbl.t
|
; opam_var_cache : (string, string) Hashtbl.t
|
||||||
|
; natdynlink_supported : bool
|
||||||
; ocamlc_config : (string * string) list
|
; ocamlc_config : (string * string) list
|
||||||
; version : string
|
; version : string
|
||||||
; stdlib_dir : Path.t
|
; stdlib_dir : Path.t
|
||||||
|
@ -197,6 +198,7 @@ let create ~(kind : Kind.t) ~path ~env ~name ~merlin =
|
||||||
in
|
in
|
||||||
let get_path var = Path.absolute (get var) in
|
let get_path var = Path.absolute (get var) in
|
||||||
let stdlib_dir = get_path "standard_library" in
|
let stdlib_dir = get_path "standard_library" in
|
||||||
|
let natdynlink_supported = Path.exists (Path.relative stdlib_dir "dynlink.cmxa") in
|
||||||
return
|
return
|
||||||
{ name
|
{ name
|
||||||
; kind
|
; kind
|
||||||
|
@ -221,6 +223,8 @@ let create ~(kind : Kind.t) ~path ~env ~name ~merlin =
|
||||||
|
|
||||||
; opam_var_cache
|
; opam_var_cache
|
||||||
|
|
||||||
|
; natdynlink_supported
|
||||||
|
|
||||||
; stdlib_dir
|
; stdlib_dir
|
||||||
; ocamlc_config = String_map.bindings ocamlc_config
|
; ocamlc_config = String_map.bindings ocamlc_config
|
||||||
; version = get "version"
|
; version = get "version"
|
||||||
|
|
|
@ -70,6 +70,9 @@ type t =
|
||||||
|
|
||||||
; opam_var_cache : (string, string) Hashtbl.t
|
; opam_var_cache : (string, string) Hashtbl.t
|
||||||
|
|
||||||
|
; (** Native dynlink *)
|
||||||
|
natdynlink_supported : bool
|
||||||
|
|
||||||
; (** Output of [ocamlc -config] *)
|
; (** Output of [ocamlc -config] *)
|
||||||
ocamlc_config : (string * string) list
|
ocamlc_config : (string * string) list
|
||||||
; version : string
|
; version : string
|
||||||
|
|
|
@ -1407,29 +1407,30 @@ module Gen(P : Params) = struct
|
||||||
List.iter Mode.all ~f:(fun mode ->
|
List.iter Mode.all ~f:(fun mode ->
|
||||||
build_lib lib ~flags ~dir ~mode ~modules ~dep_graph);
|
build_lib lib ~flags ~dir ~mode ~modules ~dep_graph);
|
||||||
|
|
||||||
Option.iter ctx.ocamlopt ~f:(fun ocamlopt ->
|
if ctx.natdynlink_supported then
|
||||||
let src = lib_archive lib ~dir ~ext:(Mode.compiled_lib_ext Native) in
|
Option.iter ctx.ocamlopt ~f:(fun ocamlopt ->
|
||||||
let dst = lib_archive lib ~dir ~ext:".cmxs" in
|
let src = lib_archive lib ~dir ~ext:(Mode.compiled_lib_ext Native) in
|
||||||
let build =
|
let dst = lib_archive lib ~dir ~ext:".cmxs" in
|
||||||
Build.run
|
let build =
|
||||||
(Dep ocamlopt)
|
Build.run
|
||||||
[ Ocaml_flags.get flags Native
|
(Dep ocamlopt)
|
||||||
; A "-shared"; A "-linkall"
|
[ Ocaml_flags.get flags Native
|
||||||
; A "-I"; Path dir
|
; A "-shared"; A "-linkall"
|
||||||
; A "-o"; Target dst
|
; A "-I"; Path dir
|
||||||
; Dep src
|
; A "-o"; Target dst
|
||||||
]
|
; Dep src
|
||||||
in
|
]
|
||||||
let build =
|
in
|
||||||
if Library.has_stubs lib then
|
let build =
|
||||||
Build.path (stubs_archive ~dir lib)
|
if Library.has_stubs lib then
|
||||||
>>>
|
Build.path (stubs_archive ~dir lib)
|
||||||
build
|
>>>
|
||||||
else
|
build
|
||||||
build
|
else
|
||||||
in
|
build
|
||||||
add_rule build
|
in
|
||||||
);
|
add_rule build
|
||||||
|
);
|
||||||
|
|
||||||
let flags =
|
let flags =
|
||||||
match alias_module with
|
match alias_module with
|
||||||
|
@ -1833,10 +1834,16 @@ module Gen(P : Params) = struct
|
||||||
(match ctx.ocamlopt with
|
(match ctx.ocamlopt with
|
||||||
| None -> []
|
| None -> []
|
||||||
| Some _ ->
|
| Some _ ->
|
||||||
[ lib_archive ~dir lib ~ext:".cmxa"
|
let files =
|
||||||
; lib_archive ~dir lib ~ext:ctx.ext_lib
|
[ lib_archive ~dir lib ~ext:".cmxa"
|
||||||
; lib_archive ~dir lib ~ext:".cmxs"
|
; lib_archive ~dir lib ~ext:ctx.ext_lib
|
||||||
])
|
]
|
||||||
|
in
|
||||||
|
if ctx.natdynlink_supported then
|
||||||
|
files @ [ lib_archive ~dir lib ~ext:".cmxs" ]
|
||||||
|
else
|
||||||
|
files
|
||||||
|
)
|
||||||
; (match lib.js_of_ocaml with
|
; (match lib.js_of_ocaml with
|
||||||
| None -> []
|
| None -> []
|
||||||
| Some { javascript_files = l; _ } ->
|
| Some { javascript_files = l; _ } ->
|
||||||
|
|
Loading…
Reference in New Issue