Do not embed man pages in CMake builds

Commit 0709e4be8b (Use standalone code paths by default, 2025-10-26)
mainly wanted to embed internal functions to unbreak upgrade scenarios.

Embedding man pages in CMake has small-ish disadvantages:
1. extra space usage
2. less discoverability
3. a "cyclic" dependency:
   1. "sphinx-docs" depends on "fish_indent"
   2. "fish_indent" via "crates/build-man-pages" depends on "doc_src/".
   So every "touch doc_src/foo.rst && ninja -Cbuild sphinx-docs"
   re-builds fish, just to re-run sphinx-build.

The significant one is number 3.  It can be worked around by running
sphinx-build with stale "fish_indent" but I don't think we want to
do that.

Let's backtrack a little by stopping embedding man pages in CMake
builds; use the on-disk man pages (which we still install).

The remaining "regression" from 0709e4be8b is that "ninja -Cbuild
fish" needs to rebuild whenever anything in "share/" changes.  I don't
know if that's also annoying?

Since man pages for "build/fish" are not in share/, expose the exact
path as $__fish_man_dir.
This commit is contained in:
Johannes Altmanninger
2025-11-20 10:34:17 +01:00
parent 2a7c57035e
commit a1baf97f54
14 changed files with 86 additions and 39 deletions

View File

@@ -0,0 +1,13 @@
# RUN: %fish %s
set -l value (string join , \
embed-manpages="$(__fish_tried_to_embed_manpages && echo true || echo false)" \
"build-system=$(status build-info | string replace -rf 'Build system: (.*)' '$1')"
)
switch $value
case embed-manpages=true,build-system=Cargo
case embed-manpages=false,build-system=CMake
case '*'
echo Expected embedded man pages to be detected as true iff using Cargo
echo got: $value
end

View File

@@ -11,6 +11,7 @@
# NOTE: When our executable is located outside the build directory, these are different.
# CHECKERR: config: paths.data: {{.*}}/share
# CHECKERR: config: paths.man: {{.*/user_doc/man|\|not found\|}}
# CHECKERR: config: paths.doc: {{.*/user_doc/html|\|not found\|}}
# CHECKERR: config: sourcing {{.+}}/etc/config.fish

View File

@@ -1,12 +1,12 @@
# RUN: %fish %s
# Override the test-override again.
__fish_data_with_file functions/__fish_print_help.fish source
# REQUIRES: command -v sphinx-build
# REQUIRES: command -v man
# REQUIRES: test "$FISH_BUILD_DOCS" != "0"
# Override the test-override again.
__fish_data_with_file functions/__fish_print_help.fish source
set -l deroff col -b -p -x
set -lx MANWIDTH 80