From fd003a00e5acb213236ba04d8d3000beda552ca8 Mon Sep 17 00:00:00 2001 From: David Allsopp Date: Sun, 12 May 2024 14:12:52 +0100 Subject: [PATCH] Hack through support for new layout - Fallback to pkgconf needs to be done in a more principled manner, possibly actually checking the opam environment for os-distribution? Basically, with upstream opam-repository we should _never_ use pkg-config, but this needs done without regressing OCaml for Windows where we _must_ use pkg-config (which has been shim'd) - Need to check the implications for MSYS2 Signed-off-by: David Allsopp --- otherlibs/configurator/src/v1.ml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/otherlibs/configurator/src/v1.ml b/otherlibs/configurator/src/v1.ml index e54ac7785dc..90561e2f39e 100644 --- a/otherlibs/configurator/src/v1.ml +++ b/otherlibs/configurator/src/v1.ml @@ -656,12 +656,18 @@ module Pkg_config = struct let pkg_config_exe_name = match Sys.getenv "PKG_CONFIG" with | s -> s - | exception Not_found -> "pkg-config" + | exception Not_found -> "pkgconf" + in + let pkg_config_args = + match ocaml_config_var c "system" with + | Some "mingw64" -> ["--personality=x86_64-w64-mingw32"] + | Some "mingw" -> ["--personality=i686-w64-mingw32"] + | _ -> [] in let pkg_config_args = match Sys.getenv "PKG_CONFIG_ARGN" with - | s -> String.split ~on:' ' s - | exception Not_found -> [] + | s -> pkg_config_args @ String.split ~on:' ' s + | exception Not_found -> pkg_config_args in Option.map (which c pkg_config_exe_name) ~f:(fun pkg_config -> { pkg_config; pkg_config_args; configurator = c })