Skip to content

Instantly share code, notes, and snippets.

@mseri
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mseri/494c17bd1f1918f0e86c to your computer and use it in GitHub Desktop.
Save mseri/494c17bd1f1918f0e86c to your computer and use it in GitHub Desktop.
Fixes dyld libraries path to be able to install rust in /opt/local
#!/usr/bin/env bash
set -euo pipefail
#IFS=$'\n\t'
E_BADARGS=85
if [ ! -n "$1" ]
then
echo "Usage: `basename $0` hash"
exit $E_BADARGS
fi
if [ ! ${#1} -eq 8 ]
then
echo "hash must be 8 characters long"
exit $E_BADARGS
fi
for i in `otool -L /opt/local/bin/rustc | grep x86_64 | awk '{print $1}'`
do
install_name_tool -change $i /opt/local/lib/`basename $i` /opt/local/bin/rustc
done
for i in `otool -L /opt/local/bin/rustdoc | grep x86_64 | awk '{print $1}'`
do
install_name_tool -change $i /opt/local/lib/`basename $i` /opt/local/bin/rustdoc
done
for rlib in `ls /opt/local/lib/*$1*`
do
for i in `otool -L $rlib | grep x86_64 | awk '{print $1}'`
do
install_name_tool -change $i /opt/local/lib/`basename $i` $rlib
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment