From 66d188a1f122e701e67311572c5c51be6edaed96 Mon Sep 17 00:00:00 2001 From: Benoit Daloze <eregontp@gmail.com> Date: Mon, 23 Sep 2024 11:58:02 +0200 Subject: [PATCH] Add -d, --dir option to install to <prefix>/<definition> instead of <prefix> * Similar to ruby-install's -r, --rubies-dir flag. --- bin/ruby-build | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bin/ruby-build b/bin/ruby-build index 33883e7722..8600728d14 100755 --- a/bin/ruby-build +++ b/bin/ruby-build @@ -8,6 +8,7 @@ # --definitions List all local definitions, including outdated ones # --version Show version of ruby-build # +# -d, --dir Install the Ruby in <prefix>/<definition> instead of <prefix> # -v, --verbose Verbose mode: forward all build output to stdout/stderr # -p, --patch Apply a patch from stdin before building # -k, --keep Do not remove source tree after installation @@ -1358,6 +1359,7 @@ unset HAS_PATCH unset IPV4 unset IPV6 unset EARLY_EXIT +unset APPEND_DEFINITION_TO_PREFIX RUBY_BUILD_INSTALL_PREFIX="$(abs_dirname "$0")/.." @@ -1378,6 +1380,9 @@ for option in "${OPTIONS[@]}"; do "l" | "list") EARLY_EXIT=list_maintained_versions ;; + "d" | "dir") + APPEND_DEFINITION_TO_PREFIX=true + ;; "k" | "keep" ) KEEP_BUILD_PATH=true ;; @@ -1425,6 +1430,10 @@ if [ "${#EXTRA_ARGUMENTS[@]}" -gt 0 ]; then RUBY_CONFIGURE_OPTS_ARRAY=("${EXTRA_ARGUMENTS[@]}") fi +if [ "$APPEND_DEFINITION_TO_PREFIX" = "true" ]; then + PREFIX_PATH="$PREFIX_PATH/$(basename "$DEFINITION_PATH")" +fi + case "$EARLY_EXIT" in help ) version