commit:     94639ce75a496f0fa5499e9fe91162556891370f
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 21 12:34:06 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Jun 21 12:34:06 2020 +0000
URL:        
https://gitweb.gentoo.org/proj/binutils-config.git/commit/?id=94639ce7

src/binutils-config: add --get-bin-path / --get-lib-path

The options are symmetric to gcc-config's --get-bin-path / --get-lib-path.

Useful to quickly get unprefixed tools into $PATH as:
    export PATH="$(gcc-config -B):$(binutils-config -B):$PATH"

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 src/binutils-config | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/src/binutils-config b/src/binutils-config
index da99021..625c1b8 100755
--- a/src/binutils-config
+++ b/src/binutils-config
@@ -42,6 +42,11 @@ ${HILITE}General Options:${NORMAL}
   ${GOOD}-u, --uninstall${NORMAL}            Remove all signs of specified 
target
   ${GOOD}-d, --debug${NORMAL}                Execute with debug output
 
+  ${GOOD}-B, --get-bin-path${NORMAL}         Print path where binaries of the 
given/current
+                             profile are located.
+  ${GOOD}-L, --get-lib-path${NORMAL}         Print path where libraries of the 
given/current
+                             profile are located.
+
 Profile names are of the form:  ${BRACKET}<CTARGET>-<binutils version>${NORMAL}
 For example:                    
${BRACKET}i686-pc-linux-gnu-2.15.92.0.2${NORMAL}
 
@@ -321,6 +326,16 @@ set_current_profile() {
 }
 get_current_profile() { echo "${PROFILE}" ; }
 
+get_bin_path() {
+       setup_env || return 1
+       echo "${BINPATH}"
+}
+
+get_lib_path() {
+       setup_env || return 1
+       echo "${LIBPATH}"
+}
+
 list_profiles() {
        local x i target
 
@@ -397,6 +412,8 @@ while [[ $# -gt 0 ]] ; do
        x=$1
        shift
        case ${x} in
+               -B|--get-bin-path)         select_action get_bin_path ;;
+               -L|--get-lib-path)         select_action get_lib_path ;;
                -c|--get-current-profile)  select_action get_current_profile ;;
                -l|--list|--list-profiles) select_action list_profiles ;;
                -u|--uninstall)            select_action uninstall_target ;;

Reply via email to