Is there a convenient way to build the corresponding coqdoc for a coq package installed with opam? (I've tried web searches, but every query has only found results about installing coqdoc itself). Or is using "opam source" and figuring out each package's build instructions the only way?
Indeed there is no general way to run coqdoc on a package.
Too bad. At least coq_makefile has a target for it. Does dune? The closest I found was @doc but that only runs odoc and doesn't cover Coq files.
Dune doesn't have a way to build doc with coqdoc (yet)
We can however generate rules for coqdoc ourselves, and we will do this in the test-suite soon.
It shouldn't be a huge leap to port that to dune.
https://github.com/ocaml/dune/issues/3760
That should be indeed very easy!
I'll be happy to assist anyone interested in doing that
First step is to write a rule .v -> .html
this is trivial
Second step is to take care of the deps
likely a trivial step too, but you may need to add some flags to tell coqdoc where to find .glob files of other theories
Don't you just pass the same flags as we do to coqc?
Ali Caglayan said:
Don't you just pass the same flags as we do to coqc?
we need to check as the logic in coqdoc is very different
many flags are not accepted, so I'm unsure
maybe instead of flags it expects a list of .glbo files?
composition / incremental build of docs is not easy actually, IIRC from odoc discussions
coqdoc understands -Q and -R
@Emilio Jesús Gallego Arias doc builds are AFAIK not incremental today, but they take negligible time compared to building vo
files, so making the latter incremental is enough
I've began an implementation, but it will not be incremental. coqdoc seems to do everything at once when called via coq_makefile, which gives it a separate html/ directory and creates a table of contents and index. I am trying to mimic the same in dune right now.
With a few tweaks to coqdoc it could be possible to make an incremental build, but I am unsure how much desire there is for that.
odoc support in dune is quite complicated, so it is not really worth sharing any work there.
Another question is: What to do when there are multiple theory stanzas? At the moment coq_makefile shoves theories/ doc into html, but if there are multiple what then?
There are various config options for coqdoc (html/latex, utf8 etc.) which we could add to the coq.theory stanza
Here is the PR: https://github.com/ocaml/dune/pull/5695 currently ran into a dune issue which will need a separate fix first, so this is not the final form
For the issue of multiple theories, you probably want a directory target named theory.html or theory.latex
Last updated: Sep 23 2023 at 13:01 UTC