From 1b08d3011e0ef1e14d6e4f5fe89c900e7efb2da4 Mon Sep 17 00:00:00 2001 From: Tobiasz Laskowski Date: Tue, 4 Feb 2025 19:26:27 +0000 Subject: [PATCH] Use system libuv when conf-libuv is available conf-libuv is now an optional dependency, and if installed then by default, the system libuv will be used instead of the vendored build. This provides a more convenient way to control how luv is built. This can still be overridden by setting: LUV_USE_SYSTEM_LIBUV=no --- luv.opam | 8 ++++++++ src/c/dune | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/luv.opam b/luv.opam index 8167ccf3..d0c40131 100644 --- a/luv.opam +++ b/luv.opam @@ -23,6 +23,14 @@ depends: [ "odoc" {with-doc & = "2.4.0"} ] +depopts: [ + "conf-libuv" +] + +build-env: [ + [LUV_USE_SYSTEM_LIBUV_DEFAULT = "%{conf-libuv:installed?yes:no}%"] +] + build: [ ["dune" "build" "-p" name "-j" jobs] ] diff --git a/src/c/dune b/src/c/dune index 027ba93a..dbd62b54 100644 --- a/src/c/dune +++ b/src/c/dune @@ -13,7 +13,11 @@ let foreign_archives, uv_library_flag, include_dirs, i_option, install_h = match Sys.getenv "LUV_USE_SYSTEM_LIBUV" with | "yes" -> true | _ -> false - | exception Not_found -> false + | exception Not_found -> + match Sys.getenv "LUV_USE_SYSTEM_LIBUV_DEFAULT" with + | "yes" -> true + | _ -> false + | exception Not_found -> false in if use_system_libuv then