mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-02 05:41:16 -03:00
Include prebuilt man pages again
Historically, Sphinx was required when building "standalone" builds,
else they would have no man pages.
This means that commit 0709e4be8b (Use standalone code paths by
default, 2025-10-26) broke man pages for users who build from a
tarball where non-standalone builds would use prebuilt docs.
Add a hack to use prebuilt docs again.
In future, we'll remove prebuilt docs, see #12052.
This commit is contained in:
@@ -3,6 +3,8 @@ fish 4.2.1 (released ???)
|
||||
|
||||
This release fixes the following problems identified in 4.2.0:
|
||||
|
||||
- When building from a tarball without Sphinx (that is, with ``-DBUILD_DOCS=OFF`` or when ``sphinx-build`` is not found),
|
||||
builtin man pages and help files were missing, which has been fixed (:issue:`12052`).
|
||||
- ``fish_config``'s theme selector (the "colors" tab) was broken, which has been fixed (:issue:`12053`).
|
||||
|
||||
fish 4.2.0 (released November 10, 2025)
|
||||
|
||||
@@ -44,6 +44,7 @@ set(VARS_FOR_CARGO
|
||||
"${FISH_PCRE2_BUILDFLAG}"
|
||||
"RUSTFLAGS=$ENV{RUSTFLAGS} ${rust_debugflags}"
|
||||
"FISH_SPHINX=${SPHINX_EXECUTABLE}"
|
||||
"FISH_USE_PREBUILT_DOCS=${USE_PREBUILT_DOCS}"
|
||||
)
|
||||
|
||||
# Let fish pick up when we're running out of the build directory without installing
|
||||
|
||||
1
build.rs
1
build.rs
@@ -82,6 +82,7 @@ fn detect_cfgs(target: &mut Target) {
|
||||
("apple", &detect_apple),
|
||||
("bsd", &detect_bsd),
|
||||
("using_cmake", &|_| option_env!("FISH_CMAKE_BINARY_DIR").is_some()),
|
||||
("use_prebuilt_docs", &|_| env_var("FISH_USE_PREBUILT_DOCS").is_some_and(|v| v == "TRUE") ),
|
||||
("cygwin", &detect_cygwin),
|
||||
("small_main_stack", &has_small_stack),
|
||||
// See if libc supports the thread-safe localeconv_l(3) alternative to localeconv(3).
|
||||
|
||||
@@ -66,13 +66,15 @@ PREFIX_TMPDIR=$(mktemp -d)
|
||||
cd "$PREFIX_TMPDIR"
|
||||
echo "$VERSION" > version
|
||||
cmake -G "$BUILD_GENERATOR" -DCMAKE_BUILD_TYPE=Debug "$wd"
|
||||
mkdir $PWD/user_doc/src
|
||||
FISH_SPHINX_BUILD_DATE=$tag_creation_date \
|
||||
FISH_SPHINX_HELP_SECTIONS_OUTPUT=$PWD/user_doc/src/help_sections.rs \
|
||||
$BUILD_TOOL doc
|
||||
|
||||
TAR_APPEND="$TAR --append --file=$path --mtime=now --owner=0 --group=0 \
|
||||
--mode=g+w,a+rX --transform s/^/$prefix\//"
|
||||
$TAR_APPEND --no-recursion user_doc
|
||||
$TAR_APPEND user_doc/html user_doc/man
|
||||
$TAR_APPEND user_doc/html user_doc/man user_doc/src/help_sections.rs
|
||||
$TAR_APPEND version
|
||||
|
||||
cd -
|
||||
|
||||
@@ -66,6 +66,7 @@ endif()
|
||||
|
||||
add_feature_info(Documentation INSTALL_DOCS "user manual and documentation")
|
||||
|
||||
set(USE_PREBUILT_DOCS FALSE)
|
||||
if(BUILD_DOCS)
|
||||
configure_file("${SPHINX_SRC_DIR}/conf.py" "${SPHINX_BUILD_DIR}/conf.py" @ONLY)
|
||||
add_custom_target(doc ALL
|
||||
@@ -76,6 +77,7 @@ if(BUILD_DOCS)
|
||||
PROPERTY FOLDER cmake/DocTargets)
|
||||
|
||||
elseif(HAVE_PREBUILT_DOCS)
|
||||
set(USE_PREBUILT_DOCS TRUE)
|
||||
if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
|
||||
# Out of tree build - link the prebuilt documentation to the build tree
|
||||
add_custom_target(link_doc ALL)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use fish_build_helper::env_var;
|
||||
use fish_build_helper::{env_var, workspace_root};
|
||||
use std::path::Path;
|
||||
|
||||
fn main() {
|
||||
@@ -9,6 +9,16 @@ fn main() {
|
||||
let _ = std::fs::create_dir_all(&sec1_dir);
|
||||
|
||||
let help_sections_path = Path::new(&env_var("OUT_DIR").unwrap()).join("help_sections.rs");
|
||||
|
||||
if env_var("FISH_USE_PREBUILT_DOCS").is_some_and(|v| v == "TRUE") {
|
||||
std::fs::copy(
|
||||
workspace_root().join("user_doc/src/help_sections.rs"),
|
||||
help_sections_path,
|
||||
)
|
||||
.unwrap();
|
||||
return;
|
||||
}
|
||||
|
||||
std::fs::write(
|
||||
help_sections_path.clone(),
|
||||
r#"pub static HELP_SECTIONS: &str = "";"#,
|
||||
@@ -26,8 +36,6 @@ fn build_man(man_dir: &Path, sec1_dir: &Path, help_sections_path: &Path) {
|
||||
process::{Command, Stdio},
|
||||
};
|
||||
|
||||
use fish_build_helper::workspace_root;
|
||||
|
||||
let workspace_root = workspace_root();
|
||||
let doc_src_dir = workspace_root.join("doc_src");
|
||||
|
||||
|
||||
@@ -97,7 +97,12 @@ def setup(app):
|
||||
app.add_directive("synopsis", FishSynopsisDirective)
|
||||
|
||||
app.add_config_value("issue_url", default=None, rebuild="html")
|
||||
app.add_config_value("fish_help_sections_output", "", "man", str)
|
||||
app.add_config_value(
|
||||
"fish_help_sections_output",
|
||||
default=os.environ.get("FISH_SPHINX_HELP_SECTIONS_OUTPUT", ""),
|
||||
rebuild="man",
|
||||
types=str,
|
||||
)
|
||||
app.add_role("issue", issue_role)
|
||||
|
||||
app.connect("builder-inited", remove_fish_indent_lexer)
|
||||
|
||||
@@ -334,10 +334,19 @@ fn parse_cmd_opts(
|
||||
use rust_embed::RustEmbed;
|
||||
|
||||
#[cfg(feature = "embed-data")]
|
||||
#[derive(RustEmbed)]
|
||||
#[folder = "$FISH_RESOLVED_BUILD_DIR/fish-man/man1"]
|
||||
#[prefix = "man/man1/"]
|
||||
struct Docs;
|
||||
cfg_if!(
|
||||
if #[cfg(use_prebuilt_docs)] {
|
||||
#[derive(RustEmbed)]
|
||||
#[folder = "user_doc/man/man1"]
|
||||
#[prefix = "man/man1/"]
|
||||
struct Docs;
|
||||
} else {
|
||||
#[derive(RustEmbed)]
|
||||
#[folder = "$FISH_RESOLVED_BUILD_DIR/fish-man/man1"]
|
||||
#[prefix = "man/man1/"]
|
||||
struct Docs;
|
||||
}
|
||||
);
|
||||
|
||||
#[cfg(all(using_cmake, feature = "embed-data"))]
|
||||
#[derive(RustEmbed)]
|
||||
|
||||
Reference in New Issue
Block a user