From a4a4639d9369115cada819a757f51614fc60e2c2 Mon Sep 17 00:00:00 2001 From: Ryan Gibb Date: Fri, 23 Sep 2022 15:51:22 +0200 Subject: [PATCH] remove opam dependancy if the `opam config subst` call fails, substitute the jobs variable with the number of physical cores in the machine --- src/dune | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/dune b/src/dune index 61d33a6..3b776e0 100644 --- a/src/dune +++ b/src/dune @@ -23,8 +23,10 @@ "%{ocaml-config:native_c_libraries}")))) (rule - (targets build.sh) + (target build.sh) (deps build.sh.in) (mode fallback) (action - (run opam config subst "build.sh"))) + (bash "opam config subst %{target} || + (CORES=`grep '^core id' /proc/cpuinfo | sort -u| wc -l`; + sed \"s/\%{jobs}\%/$CORES/g\" %{target}.in > %{target})")))