Can we run pkg-config commands from a dune file?

cf. doesn't install on a Mac · Issue #15 · mkur/nlopt-ocaml · GitHub
and this dune file that I would like to correct:

1 Like

Not from a dune file, need to use dune configurator to generate options and then can include them in a dune file.


this “configurator” looks overkill.
I would just like to see “pkg-config --libs nlopt” and “pkg-config --cflags nlopt”
somewhere in the dune file.
Of course, those commands should be executed and replaced by their corresponding output.

ocaml-protoc-plugin has a good example of calling pkg-config directly from a dune file with a rule.

TLDR: use the with-stdout-to action to create a file with the output of pkg-config, and then read it using read-line(s)


This is way too complex; I just want to see in the dune file something like `pkg-config --libs nlopt`.