Skip to content

Commit a2b5ae0

Browse files
committed
refactor(boot): pass arch and ccomp_type
This way, we know which parts of the config these functions use. Signed-off-by: Rudi Grinberg <[email protected]> <!-- ps-id: 7057bf1d-3b73-4d11-84be-1d8448ba2a2d -->
1 parent 1d584f0 commit a2b5ae0

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

boot/duneboot.ml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,8 @@ module Library = struct
10821082
; root_module
10831083
}
10841084
~ext_obj
1085-
~ocaml_config
1085+
~ccomp_type
1086+
~architecture
10861087
=
10871088
let scan_subdirs =
10881089
match include_subdirs with
@@ -1161,8 +1162,6 @@ module Library = struct
11611162
| None -> files
11621163
| Some fn -> fn :: files
11631164
in
1164-
let ccomp_type = String.Map.find "ccomp_type" ocaml_config in
1165-
let architecture = String.Map.find "architecture" ocaml_config in
11661165
List.partition_map_skip files ~f:(fun (src, fn) ->
11671166
match src.kind with
11681167
| C c ->
@@ -1307,7 +1306,12 @@ let get_dependencies libraries =
13071306
deps
13081307
;;
13091308

1310-
let assemble_libraries { local_libraries; target = _, main; _ } ~ext_obj ~ocaml_config =
1309+
let assemble_libraries
1310+
{ local_libraries; target = _, main; _ }
1311+
~ext_obj
1312+
~ccomp_type
1313+
~architecture
1314+
=
13111315
(* In order to assemble all the sources in one place, the executables
13121316
modules are also put in a namespace *)
13131317
local_libraries
@@ -1316,7 +1320,7 @@ let assemble_libraries { local_libraries; target = _, main; _ } ~ext_obj ~ocaml_
13161320
in
13171321
{ Libs.main with main_module_name = Some namespace })
13181322
]
1319-
|> Fiber.parallel_map ~f:(Library.process ~ext_obj ~ocaml_config)
1323+
|> Fiber.parallel_map ~f:(Library.process ~ext_obj ~ccomp_type ~architecture)
13201324
;;
13211325

13221326
type status =
@@ -1528,7 +1532,9 @@ let main () =
15281532
try String.Map.find "ext_obj" ocaml_config with
15291533
| Not_found -> ".o"
15301534
in
1531-
let* libraries = assemble_libraries ~ext_obj ~ocaml_config task in
1535+
let ccomp_type = String.Map.find "ccomp_type" ocaml_config in
1536+
let architecture = String.Map.find "architecture" ocaml_config in
1537+
let* libraries = assemble_libraries task ~ext_obj ~ccomp_type ~architecture in
15321538
let c_files = List.concat_map ~f:(fun (lib : Library.t) -> lib.c_files) libraries in
15331539
let asm_files = List.concat_map ~f:(fun (lib : Library.t) -> lib.asm_files) libraries in
15341540
let* dependencies = get_dependencies libraries in

0 commit comments

Comments
 (0)