Skip to content
This repository was archived by the owner on Aug 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions install-template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,25 @@ install_components() {
_file_install_path="$CFG_MANDIR/$_f"
fi

# HACK: Try to support overriding --docdir. Paths with the form
# "share/doc/$product/" can be redirected to a single --docdir
# path. If the following detects that --docdir has been specified
# then it will replace everything preceeding the "$product" path
# component. The problem here is that the combined rust installer
# contains two "products": rust and cargo; so the contents of those
# directories will both be dumped into the same directory; and the
# contents of those directories are _not_ disjoint. Since this feature
# is almost entirely to support 'make install' anyway I don't expect
# this problem to be a big deal in practice.
if [ "$CFG_DOCDIR" != "<default>" ]
then
if echo "$_file" | grep "^share/doc/" > /dev/null
then
local _f="$(echo "$_file" | sed 's/^share\/doc\/[^/]*\///')"
_file_install_path="$CFG_DOCDIR/$_f"
fi
fi

# Make sure there's a directory for it
make_dir_recursive "$(dirname "$_file_install_path")"
critical_need_ok "directory creation failed"
Expand Down Expand Up @@ -834,6 +853,9 @@ valopt components "" "comma-separated list of components to install"
flag list-components "list available components"
valopt libdir "$CFG_DESTDIR_PREFIX/lib" "install libraries"
valopt mandir "$CFG_DESTDIR_PREFIX/share/man" "install man pages in PATH"
# NB See the docdir handling in install_components for an explanation of this
# weird <default> string
valopt docdir "\<default\>" "install documentation in PATH"
opt ldconfig 1 "run ldconfig after installation (Linux only)"
opt verify 1 "obsolete"
flag verbose "run with verbose output"
Expand Down
50 changes: 50 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1370,6 +1370,56 @@ CDPATH_does_not_destroy_things() {
}
runtest CDPATH_does_not_destroy_things

docdir_default() {
try sh "$S/gen-installer.sh" \
--image-dir="$TEST_DIR/image-docdir1" \
--work-dir="$WORK_DIR" \
--output-dir="$OUT_DIR"
try "$WORK_DIR/package/install.sh" --prefix="$PREFIX_DIR"
try test -e "$PREFIX_DIR/share/doc/rust/README"
try test -e "$PREFIX_DIR/share/doc/rust/rustdocs.txt"
}
runtest docdir_default

docdir() {
try sh "$S/gen-installer.sh" \
--image-dir="$TEST_DIR/image-docdir1" \
--work-dir="$WORK_DIR" \
--output-dir="$OUT_DIR"
try mkdir "$WORK_DIR/docdir"
try "$WORK_DIR/package/install.sh" --prefix="$PREFIX_DIR" --docdir="$WORK_DIR/docdir"
try test -e "$WORK_DIR/docdir/README"
try test -e "$WORK_DIR/docdir/rustdocs.txt"
}
runtest docdir

docdir_combined() {
try sh "$S/gen-installer.sh" \
--image-dir="$TEST_DIR/image-docdir1" \
--work-dir="$WORK_DIR" \
--output-dir="$OUT_DIR" \
--package-name="rustc" \
--component-name="rustc"
try sh "$S/gen-installer.sh" \
--image-dir="$TEST_DIR/image-docdir2" \
--work-dir="$WORK_DIR" \
--output-dir="$OUT_DIR" \
--package-name="cargo" \
--component-name="cargo"
try sh "$S/combine-installers.sh" \
--work-dir="$WORK_DIR" \
--output-dir="$OUT_DIR" \
--package-name=rust \
--input-tarballs="$OUT_DIR/rustc.tar.gz,$OUT_DIR/cargo.tar.gz"
try mkdir "$WORK_DIR/docdir"
try "$WORK_DIR/rust/install.sh" --prefix="$PREFIX_DIR" --docdir="$WORK_DIR/docdir"
try test -e "$WORK_DIR/docdir/README"
try test -e "$WORK_DIR/docdir/rustdocs.txt"
try test -e "$WORK_DIR/docdir/README"
try test -e "$WORK_DIR/docdir/cargodocs.txt"
}
runtest docdir_combined

echo
echo "TOTAL SUCCESS!"
echo
1 change: 1 addition & 0 deletions test/image-docdir1/share/doc/rust/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rust
1 change: 1 addition & 0 deletions test/image-docdir1/share/doc/rust/rustdocs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rust
1 change: 1 addition & 0 deletions test/image-docdir2/share/doc/cargo/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cargo
1 change: 1 addition & 0 deletions test/image-docdir2/share/doc/cargo/cargodocs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cargo