Changing build flags without modifying the dune file?

When packaging OCaml libs that use dune for the Linux distros, I want to change the flags being used (e.g. add -g for including debug symbols). Is there any unobtrusive solution that doesn’t require modifying the jbuilder/dune file?

Have you tried setting OCAMLPARAM? Note that unless the package explicitly sets the compilation flags and doesn’t inherit the default ones, -g is part of the default flags that are passed by dune to the compiler.

The proposal here should give you some level of control for the flags.