SDRPlusPlus/macos/set_library_path.sh

18 lines
329 B
Bash
Raw Normal View History

2021-11-15 17:15:59 +01:00
#!/bin/sh
set -e
# Options
2021-11-15 17:15:59 +01:00
WANTED_LIB=$1
NEW_PATH=$2
EXEC=$3
# Function to extract the first element of a space seperated list
2021-11-15 17:15:59 +01:00
get_first_arg() {
echo $1
}
# Get current path
CURRENT_PATH=$(get_first_arg $(otool -L $EXEC | grep $WANTED_LIB))
2021-11-15 17:15:59 +01:00
# Change to the new path
install_name_tool -change $CURRENT_PATH $NEW_PATH $EXEC