--- bin/gwrepl/mk_data.ml.orig 2024-04-21 10:35:20 +++ bin/gwrepl/mk_data.ml 2024-04-21 10:33:38 @@ -43,35 +43,8 @@ before_after_ocaml_version "5.1.0" ~before ~after let () = - let opam_switch_prefix = Sys.getenv "OPAM_SWITCH_PREFIX" in - let opam_switch_prefix_lib = opam_switch_prefix // "lib" in - let ocaml_stdlib_directory = - let output_filename, error_filename = - let temporary_filename = Filename.temp_file "gwrepl_" "_ocaml_stdlib" in - (temporary_filename ^ ".out", temporary_filename ^ ".err") - in - let command = - let double_quote_if_win32 = if Sys.win32 then "\"" else "" in - Printf.sprintf "%sopam exec -- ocamlc -where > %s 2> %s%s" - double_quote_if_win32 - (Filename.quote output_filename) - (Filename.quote error_filename) - double_quote_if_win32 - in - let exit_code = Sys.command command in - if exit_code <> 0 then - failwith - @@ Printf.sprintf "Command '%s' failed:\nexit code: %d\nerror: %s" command - exit_code - (String.concat "\n" (read_lines @@ open_in error_filename)) - else - match read_lines @@ open_in output_filename with - | ([] | _ :: _ :: _) as lines -> - failwith - @@ Printf.sprintf "Unexpected output of command '%s':\n%s" command - (String.concat "\n" lines) - | [ line ] -> line - in + let mp_ocaml_site_lib = "__MACPORTS_PREFIX__/lib/ocaml/site-lib/" in + let ocaml_stdlib_directory = "__MACPORTS_PREFIX__/lib/ocaml/" in let dune_root, root, (directories0, files0) = let ic = open_in ".depend" in @@ -93,8 +66,8 @@ (String.length fn - String.length prefix)) else None in - match aux opam_switch_prefix_lib with - | Some x -> Some (`opam (opam_switch_prefix_lib, x)) + match aux mp_ocaml_site_lib with + | Some x -> Some (`opam (mp_ocaml_site_lib, x)) | None -> ( match aux root with Some x -> Some (`root x) | None -> None) in ( dune_root, @@ -219,7 +192,7 @@ ~after:(fun () -> "dllunixbyt.so") ); ]; if_sosa_zarith out (fun () -> - aux (opam_switch_prefix_lib, "stublibs" // "dllzarith.so"))); + aux (mp_ocaml_site_lib, "stublibs" // "dllzarith.so"))); Printf.fprintf out {||];;|}; let b = Buffer.create 1024 in let aux =