Use dune to build any package

Hello,

In the context of reproducible builds, I was wondering how can I use to dune to build any ocaml package. When doing dune pkg lock, build “recipes” are describes in .pkg files.

For example fmt - which is not using dune for packaging - can be build with dune using the “recipe” (derived from opam files)

(version 0.11.0)

(build
 (run
  ocaml
  pkg/pkg.ml
  build
  --dev-pkg
  %{pkg-self:dev}
  --with-base-unix
  %{pkg:base-unix:installed}
  --with-cmdliner
  %{pkg:cmdliner:installed}))

(depends ocaml ocamlfind ocamlbuild topkg base-unix)

(source
 (fetch
  (url https://erratique.ch/software/fmt/releases/fmt-0.11.0.tbz)
  (checksum
 sha512=3f40155fc6a7315202e410585964307d63416c8001fd243667ed9d8d1a02b67deecacb25e9c2feb409c537bbdfb7817d91168de4ddd643532ff51d6c1c696a4a)))


My question si how to build fmt with dune (independently of any dune project)?

Is there any library exposed by dune that lets do it?

Thanks for helping