X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=extras%2Fcontrib%2Fchange_prefix.sh;h=df9c0a2bef817c1420233c2f2423b4f9d709cb6d;hb=63b8b9fee10e6896845b2ae5b60939b4a2293d05;hp=3b8043223ac7892f0e54829c03d90913c226f618;hpb=fe087a38282e93addb25fa9598393e40ea233b09;p=vlc diff --git a/extras/contrib/change_prefix.sh b/extras/contrib/change_prefix.sh index 3b8043223a..df9c0a2bef 100755 --- a/extras/contrib/change_prefix.sh +++ b/extras/contrib/change_prefix.sh @@ -19,7 +19,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. # *************************************************************************** usage="Usage: $0 " @@ -34,7 +34,8 @@ fi top_dir=`cd $1; pwd` prefix=$2 -new_prefix=$3 +new_prefix2=$3 +new_prefix=/$new_prefix2 if test -z $prefix -o -z $new_prefix; then echo $usage @@ -42,19 +43,42 @@ if test -z $prefix -o -z $new_prefix; then fi cd $top_dir +pwd files=`find . -type f` for file in $files; do - if test ".`file $file | grep Mach-O`" != "." ; then + if test ".`file $file | grep Mach-O`" != "." ; then + echo "Changing prefixes of '$file'" + islib=n + if test ".`file $file | grep 'dynamically linked shared library'`" != "." ; then + islib=y + fi libs=`otool -L $file 2>/dev/null | grep $prefix | cut -d\ -f 1` + first=y for i in "" $libs; do if ! test -z $i; then - install_name_tool -change $i \ - `echo $i | sed -e "s,$prefix,$new_prefix,"` \ - $file + if test $islib = y -a $first = y; then + install_name_tool -id `echo $i | sed -e "s,$prefix,$new_prefix,"` $file + first=n + else + install_name_tool -change $i `echo $i | sed -e "s,$prefix,$new_prefix,"` $file + fi fi done - elif test ".`file $file | grep \"text\|shell\"`" != "." ; then + elif test ".`file $file | grep \"text\|shell\"`" != "." -o ".`echo $file | grep pc$`" != "."; then + echo "Fixing up shell/text/pc file "$file"" + cp $file $file.tmp sed -e "s,$prefix,$new_prefix,g" < $file > $file.tmp mv -f $file.tmp $file + else + echo "Not doing anything with $file" fi done + +files=`find . -name *.la` +for file in $files; do + echo "Fixing up .la $file" + cp $file $file.tmp + sed -e "s,$prefix,$new_prefix,g" < $file > $file.tmp + mv -f $file.tmp $file +done +