diff --git a/src/build.ml b/src/build.ml index 4e859b1f..3214e366 100644 --- a/src/build.ml +++ b/src/build.ml @@ -122,6 +122,11 @@ let fanout3 a b c = (a &&& (b &&& c)) >>> arr (fun (a, (b, c)) -> (a, b, c)) +let fanout4 a b c d = + let open O in + (a &&& (b &&& (c &&& d))) + >>> + arr (fun (a, (b, (c, d))) -> (a, b, c, d)) let rec all = function | [] -> arr (fun _ -> []) diff --git a/src/build.mli b/src/build.mli index 96555071..ba950ec1 100644 --- a/src/build.mli +++ b/src/build.mli @@ -30,6 +30,7 @@ val second : ('a, 'b) t -> ('c * 'a, 'c * 'b) t The default definition may be overridden with a more efficient version if desired. *) val fanout : ('a, 'b) t -> ('a, 'c) t -> ('a, 'b * 'c) t val fanout3 : ('a, 'b) t -> ('a, 'c) t -> ('a, 'd) t -> ('a, 'b * 'c * 'd) t +val fanout4 : ('a, 'b) t -> ('a, 'c) t -> ('a, 'd) t -> ('a, 'e) t -> ('a, 'b * 'c * 'd * 'e) t val all : ('a, 'b) t list -> ('a, 'b list) t diff --git a/src/gen_rules.ml b/src/gen_rules.ml index 47bad378..a906c98b 100644 --- a/src/gen_rules.ml +++ b/src/gen_rules.ml @@ -87,7 +87,7 @@ module Gen(P : Params) = struct fun x -> x in SC.add_rule sctx - (Build.fanout3 + (Build.fanout4 (dep_graph >>> Build.arr (fun dep_graph -> Ocamldep.names_to_top_closed_cm_files @@ -98,21 +98,22 @@ module Gen(P : Params) = struct (String_map.keys modules))) (SC.expand_and_eval_set sctx ~scope ~dir lib.c_library_flags ~standard:[]) (Ocaml_flags.get flags mode) + (SC.expand_and_eval_set sctx ~scope ~dir lib.library_flags ~standard:[]) >>> Build.run ~context:ctx (Dep compiler) ~extra_targets:( match mode with | Byte -> [] | Native -> [lib_archive lib ~dir ~ext:ctx.ext_lib]) - [ Dyn (fun (_, _, flags) -> As flags) + [ Dyn (fun (_, _, flags, _) -> As flags) ; A "-a"; A "-o"; Target target ; As stubs_flags - ; Dyn (fun (_, cclibs, _) -> Arg_spec.quote_args "-cclib" (map_cclibs cclibs)) - ; As (List.map lib.library_flags ~f:(SC.expand_vars sctx ~scope ~dir)) + ; Dyn (fun (_, cclibs, _, _) -> Arg_spec.quote_args "-cclib" (map_cclibs cclibs)) + ; Dyn (fun (_, _, _, library_flags) -> As library_flags) ; As (match lib.kind with | Normal -> [] | Ppx_deriver | Ppx_rewriter -> ["-linkall"]) - ; Dyn (fun (cm_files, _, _) -> Deps cm_files) + ; Dyn (fun (cm_files, _, _, _) -> Deps cm_files) ])) let build_c_file (lib : Library.t) ~scope ~dir ~requires ~h_files c_name = diff --git a/src/jbuild.ml b/src/jbuild.ml index 52af9fae..14298b07 100644 --- a/src/jbuild.ml +++ b/src/jbuild.ml @@ -533,7 +533,7 @@ module Library = struct ; c_names : string list ; cxx_flags : Ordered_set_lang.Unexpanded.t ; cxx_names : string list - ; library_flags : String_with_vars.t list + ; library_flags : Ordered_set_lang.Unexpanded.t ; c_library_flags : Ordered_set_lang.Unexpanded.t ; self_build_stubs_archive : string option ; virtual_deps : string list @@ -555,7 +555,7 @@ module Library = struct field_oslu "cxx_flags" >>= fun cxx_flags -> field "c_names" (list string) ~default:[] >>= fun c_names -> field "cxx_names" (list string) ~default:[] >>= fun cxx_names -> - field "library_flags" (list String_with_vars.t) ~default:[] >>= fun library_flags -> + field_oslu "library_flags" >>= fun library_flags -> field_oslu "c_library_flags" >>= fun c_library_flags -> field "virtual_deps" (list string) ~default:[] >>= fun virtual_deps -> field "modes" Mode.Dict.Set.t ~default:Mode.Dict.Set.all >>= fun modes -> diff --git a/src/jbuild.mli b/src/jbuild.mli index 3bf19fd1..a11147a6 100644 --- a/src/jbuild.mli +++ b/src/jbuild.mli @@ -138,7 +138,7 @@ module Library : sig ; c_names : string list ; cxx_flags : Ordered_set_lang.Unexpanded.t ; cxx_names : string list - ; library_flags : String_with_vars.t list + ; library_flags : Ordered_set_lang.Unexpanded.t ; c_library_flags : Ordered_set_lang.Unexpanded.t ; self_build_stubs_archive : string option ; virtual_deps : string list