Disable archives for virtual libraries
And refactor the archive building to allow for external o files to be provided Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
parent
6da1f199f7
commit
918ae9ab0a
|
@ -241,7 +241,7 @@ module Gen (P : Install_rules.Params) = struct
|
||||||
ocamlmklib ~sandbox:true ~custom:false ~targets:[dynamic]
|
ocamlmklib ~sandbox:true ~custom:false ~targets:[dynamic]
|
||||||
end
|
end
|
||||||
|
|
||||||
let build_stubs lib ~dir ~scope ~requires ~dir_contents =
|
let build_o_files lib ~dir ~scope ~requires ~dir_contents =
|
||||||
let all_dirs = Dir_contents.dirs dir_contents in
|
let all_dirs = Dir_contents.dirs dir_contents in
|
||||||
let h_files =
|
let h_files =
|
||||||
List.fold_left all_dirs ~init:[] ~f:(fun acc dc ->
|
List.fold_left all_dirs ~init:[] ~f:(fun acc dc ->
|
||||||
|
@ -265,7 +265,6 @@ module Gen (P : Install_rules.Params) = struct
|
||||||
;
|
;
|
||||||
(p, Path.relative dir (fn ^ ctx.ext_obj))
|
(p, Path.relative dir (fn ^ ctx.ext_obj))
|
||||||
in
|
in
|
||||||
let o_files =
|
|
||||||
let includes =
|
let includes =
|
||||||
Arg_spec.S
|
Arg_spec.S
|
||||||
[ Hidden_deps h_files
|
[ Hidden_deps h_files
|
||||||
|
@ -280,10 +279,18 @@ module Gen (P : Install_rules.Params) = struct
|
||||||
) @ List.map lib.cxx_names ~f:(fun name ->
|
) @ List.map lib.cxx_names ~f:(fun name ->
|
||||||
build_cxx_file lib ~scope ~dir ~includes (resolve_name name ~ext:".cpp")
|
build_cxx_file lib ~scope ~dir ~includes (resolve_name name ~ext:".cpp")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
let build_stubs lib ~dir ~scope ~requires ~dir_contents =
|
||||||
|
let vlib_stubs_o_files = [] in (* TODO *)
|
||||||
|
let lib_o_files =
|
||||||
|
if Library.has_stubs lib then
|
||||||
|
build_o_files lib ~dir ~scope ~requires ~dir_contents
|
||||||
|
else
|
||||||
|
[]
|
||||||
in
|
in
|
||||||
match lib.self_build_stubs_archive with
|
match vlib_stubs_o_files @ lib_o_files with
|
||||||
| Some _ -> ()
|
| [] -> ()
|
||||||
| None -> build_self_stubs lib ~dir ~scope ~o_files
|
| o_files -> build_self_stubs lib ~dir ~scope ~o_files
|
||||||
|
|
||||||
let build_shared lib ~dir ~flags ~(ctx : Context.t) =
|
let build_shared lib ~dir ~flags ~(ctx : Context.t) =
|
||||||
Option.iter ctx.ocamlopt ~f:(fun ocamlopt ->
|
Option.iter ctx.ocamlopt ~f:(fun ocamlopt ->
|
||||||
|
@ -406,6 +413,7 @@ module Gen (P : Install_rules.Params) = struct
|
||||||
Path.relative dir (header ^ ".h"))
|
Path.relative dir (header ^ ".h"))
|
||||||
|> Path.Set.of_list);
|
|> Path.Set.of_list);
|
||||||
|
|
||||||
|
if not (Library.is_virtual lib) then begin
|
||||||
(let modules =
|
(let modules =
|
||||||
Module.Name.Map.fold modules ~init:[] ~f:(fun m acc ->
|
Module.Name.Map.fold modules ~init:[] ~f:(fun m acc ->
|
||||||
if Module.has_impl m then
|
if Module.has_impl m then
|
||||||
|
@ -433,6 +441,7 @@ module Gen (P : Install_rules.Params) = struct
|
||||||
|
|
||||||
if Dynlink_supported.By_the_os.get ctx.natdynlink_supported then
|
if Dynlink_supported.By_the_os.get ctx.natdynlink_supported then
|
||||||
build_shared lib ~dir ~flags ~ctx;
|
build_shared lib ~dir ~flags ~ctx;
|
||||||
|
end;
|
||||||
|
|
||||||
Odoc.setup_library_odoc_rules lib ~requires ~modules ~dep_graphs ~scope;
|
Odoc.setup_library_odoc_rules lib ~requires ~modules ~dep_graphs ~scope;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue