Skip to content

ocamldoc: use ocamldoc.opt when available to build documentation and manpages#8837

Merged
dra27 merged 5 commits intoocaml:trunkfrom
gasche:manpage-ocamldoc.opt
Aug 30, 2019
Merged

ocamldoc: use ocamldoc.opt when available to build documentation and manpages#8837
dra27 merged 5 commits intoocaml:trunkfrom
gasche:manpage-ocamldoc.opt

Conversation

@gasche
Copy link
Copy Markdown
Member

@gasche gasche commented Jul 27, 2019

This PR tweaks the build system of ocamldoc to use ocamldoc.opt to build documentation when available, and it also tweaks the root Makefile to build manpages (whose compilation time has been a hot topic of discussion in #8835) later in the build, when ocamldoc.opt may be available.

Before that PR, building the manpages takes 14s on my machine (it was 16s before #8836). After that PR, it takes 4s (5s before #8836). All other document targets benefit (html_doc, introduced to test HTML rendering of documentation comments, goes from 36s to 8.5s) but they are not part of the default build.

To check this PR I tried to run all the tests from ocamldoc's Makefile; it looks like some of them have bitrotten away, and I removed one that could not be run at all.

@dra27
Copy link
Copy Markdown
Member

dra27 commented Jul 27, 2019

I've never been sure why opam-repository does this, but the ocaml-base-compiler packages all do make world followed by make world.opt - as they stand, they'd fail to take advantage of this change, therefore (hopefully they've just done it that by accident).

Copy link
Copy Markdown
Member

@dra27 dra27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In these autoconf days, it would be good if we were heading towards ./configure && make all && make install - i.e. no more world, opt, opt.opt, world.opt, etc. but configure properly determining what's to be built and then make just doing it. That would certainly make this change simpler, but it's a very clear win - modulo the fix I note.

else
OCAMLDOC_RUN=$(OCAMLRUN) ./$(OCAMLDOC)
endif
OCAMLDOC_RUN_BYTE=$(OCAMLRUN) -I $(ROOTDIR)/otherlibs/$(UNIXLIB) -I $(ROOTDIR)/otherlibs/str ./$(OCAMLDOC)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks make world on a --disable-shared build. The issue is that when shared support isn't available, ocamldoc is built with -custom so mustn't be invoked via ocamlrun

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: I can't find where in the Makefile logic -custom is used in absence of shared libraries (or at all) to compile ocamldoc. (There is logic to that effect in Makefile.tools but as far as I can tell it's not used to build ocamldoc.)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's done using the "lib_custom" flag in and str.cmo & unix.cmo - on a system without shared linking, using the .cmo forces -custom mode (see https://github.com/ocaml/ocaml/blob/trunk/file_formats/cmo_format.mli#L55 and https://github.com/ocaml/ocaml/blob/trunk/bytecomp/bytelink.ml#L55)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow. Thanks. I'll definitely add a comment in the ocamldoc Makefile to point this out.

@gasche
Copy link
Copy Markdown
Member Author

gasche commented Jul 28, 2019

@dra27, do you approve of this change? The root-Makefile part of the PR conflicts somewhat with #8839, and I think this one is "more ready", so I would be interested in building on top of it instead of in parallel.

@dra27
Copy link
Copy Markdown
Member

dra27 commented Jul 28, 2019

I do entirely approve, but I’d like Sébastien to have a chance to comment, if that’s ok?

@gasche
Copy link
Copy Markdown
Member Author

gasche commented Jul 28, 2019

That's fine with me, thanks.

(Re. make all && make install: it seems like a fine goal, but I'm not volunteering to do the restructuration work. I don't think this PR or the sucessor to #8839 would make it any easier or more difficult, given that they are not invasive -- they don't change the Makefile structure.)

@xavierleroy xavierleroy changed the title ocamldoc: use ocamldot.opt when available to build documentation and manpages ocamldoc: use ocamldoc.opt when available to build documentation and manpages Jul 29, 2019
@xavierleroy
Copy link
Copy Markdown
Contributor

Just to annoy everyone: what happens with platforms where ocamlopt is not supported? There was a time when Debian (people who care about man pages) cared about hppa, m68k, and ia64, while ocamlopt support for these platforms was removed. It was important for them that a fully-functional, bytecode-only OCaml system could be built. In all honesty, I don't know if they or anyone else still care.

@gasche
Copy link
Copy Markdown
Member Author

gasche commented Jul 30, 2019

If ocamldoc.opt is not present, then it is not used -- see the logic below.

ifeq "$(wildcard $(OCAMLDOC_OPT))" ""
  OCAMLDOC_RUN=$(OCAMLDOC_RUN_BYTE)
else
  OCAMLDOC_RUN=$(OCAMLDOC_RUN_OPT)
endif

I'm industrializing this technique in #8840.

@gasche
Copy link
Copy Markdown
Member Author

gasche commented Aug 9, 2019

(cc @shindere)

@shindere
Copy link
Copy Markdown
Contributor

shindere commented Aug 27, 2019 via email

@gasche gasche force-pushed the manpage-ocamldoc.opt branch from 212b88b to ab217a7 Compare August 30, 2019 07:57
@gasche
Copy link
Copy Markdown
Member Author

gasche commented Aug 30, 2019

Thanks @shindere; I rebased and updated the PR.

Most commits are independent of each other and have their specific purpose, but I merged the Changes-entry commit into the main commit.

gasche added 2 commits August 30, 2019 09:59
The odoc_fhtml file required by this test seems to have been part of
the ocamldoc distribution sometime in the distant past (see
27934ab from 2002) but I can't find
traces of it in the git history of the compiler distribution.
@shindere
Copy link
Copy Markdown
Contributor

shindere commented Aug 30, 2019 via email

@gasche gasche force-pushed the manpage-ocamldoc.opt branch from ab217a7 to 9067d0e Compare August 30, 2019 08:18
@dra27 dra27 merged commit 354bf8e into ocaml:trunk Aug 30, 2019
@shindere
Copy link
Copy Markdown
Contributor

shindere commented Aug 30, 2019 via email

dra27 added a commit to dra27/ocaml that referenced this pull request Jul 28, 2024
ocamldoc: use ocamldoc.opt when available to build documentation and manpages
(cherry picked from commit 354bf8e)
dra27 added a commit to dra27/ocaml that referenced this pull request Jul 28, 2024
ocamldoc: use ocamldoc.opt when available to build documentation and manpages
(cherry picked from commit 354bf8e)
dra27 added a commit to dra27/ocaml that referenced this pull request Jul 28, 2024
ocamldoc: use ocamldoc.opt when available to build documentation and manpages
(cherry picked from commit 354bf8e)
dra27 added a commit to dra27/ocaml that referenced this pull request Jul 28, 2024
ocamldoc: use ocamldoc.opt when available to build documentation and manpages
(cherry picked from commit 354bf8e)
dra27 added a commit to dra27/ocaml that referenced this pull request Aug 4, 2024
ocamldoc: use ocamldoc.opt when available to build documentation and manpages
(cherry picked from commit 354bf8e)
dra27 added a commit to dra27/ocaml that referenced this pull request Aug 4, 2024
ocamldoc: use ocamldoc.opt when available to build documentation and manpages
(cherry picked from commit 354bf8e)
dra27 added a commit to dra27/ocaml that referenced this pull request Aug 4, 2024
ocamldoc: use ocamldoc.opt when available to build documentation and manpages
(cherry picked from commit 354bf8e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants