Skip to content

Commit 51e4fa1

Browse files
authored
refactor(boot): pass arch and ccomp_type (#12293)
This way, we know which parts of the config these functions use. Signed-off-by: Rudi Grinberg <[email protected]>
1 parent ca1422d commit 51e4fa1

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
@@ -1079,7 +1079,8 @@ module Library = struct
10791079
; root_module
10801080
}
10811081
~ext_obj
1082-
~ocaml_config
1082+
~ccomp_type
1083+
~architecture
10831084
=
10841085
let scan_subdirs =
10851086
match include_subdirs with
@@ -1155,8 +1156,6 @@ module Library = struct
11551156
| None -> files
11561157
| Some fn -> fn :: files
11571158
in
1158-
let ccomp_type = String.Map.find "ccomp_type" ocaml_config in
1159-
let architecture = String.Map.find "architecture" ocaml_config in
11601159
List.partition_map_skip files ~f:(fun (src, fn) ->
11611160
match src.kind with
11621161
| C c ->
@@ -1300,7 +1299,12 @@ let get_dependencies libraries =
13001299
deps
13011300
;;
13021301

1303-
let assemble_libraries { local_libraries; target = _, main; _ } ~ext_obj ~ocaml_config =
1302+
let assemble_libraries
1303+
{ local_libraries; target = _, main; _ }
1304+
~ext_obj
1305+
~ccomp_type
1306+
~architecture
1307+
=
13041308
(* In order to assemble all the sources in one place, the executables
13051309
modules are also put in a namespace *)
13061310
local_libraries
@@ -1309,7 +1313,7 @@ let assemble_libraries { local_libraries; target = _, main; _ } ~ext_obj ~ocaml_
13091313
in
13101314
{ Libs.main with main_module_name = Some namespace })
13111315
]
1312-
|> Fiber.parallel_map ~f:(Library.process ~ext_obj ~ocaml_config)
1316+
|> Fiber.parallel_map ~f:(Library.process ~ext_obj ~ccomp_type ~architecture)
13131317
;;
13141318

13151319
type status =
@@ -1521,7 +1525,9 @@ let main () =
15211525
try String.Map.find "ext_obj" ocaml_config with
15221526
| Not_found -> ".o"
15231527
in
1524-
let* libraries = assemble_libraries ~ext_obj ~ocaml_config task in
1528+
let ccomp_type = String.Map.find "ccomp_type" ocaml_config in
1529+
let architecture = String.Map.find "architecture" ocaml_config in
1530+
let* libraries = assemble_libraries task ~ext_obj ~ccomp_type ~architecture in
15251531
let c_files = List.concat_map ~f:(fun (lib : Library.t) -> lib.c_files) libraries in
15261532
let asm_files = List.concat_map ~f:(fun (lib : Library.t) -> lib.asm_files) libraries in
15271533
let* dependencies = get_dependencies libraries in

0 commit comments

Comments
 (0)