From: Vadim Zeitlin Date: Sun, 20 Nov 2005 18:11:44 +0000 (+0000) Subject: script to set the install name correctly for all wx libraries from the given install... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/233c6e7fb063aa09ae72a3aef1d00d678ea70cc8 script to set the install name correctly for all wx libraries from the given install prefix git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36213 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/misc/scripts/set_install_name b/misc/scripts/set_install_name new file mode 100755 index 0000000000..80c2beed97 --- /dev/null +++ b/misc/scripts/set_install_name @@ -0,0 +1,138 @@ +#!/bin/sh +# +# Name: set_install_name +# Purpose: set install_name for wx shared libraries under Mac OS X +# Usage: run with --help option to see the instructions +# Copyright: (c) 2005 Vadim Zeitlin +# Version: $Id$ +# Licence: wxWindows licence +################################################################################ + +quiet=0 +verbose=0 +libdir= +install_path= +cmd= + +Usage() +{ + cat 1>&2 <&2 +} + +GiveUsageErrorAndExit() +{ + Error "$@" + Usage +} + +ChangeInstallNames() +{ + # only change the libs themselves, not symlinks to them + all_libs=`find $libdir -type f -name libwx_\*.dylib` + if [ -z "$all_libs" ]; then + Error "No wx libraries found in \"$libdir\"." + exit 1 + fi + + VerboseMessage "Processing $all_libs\n" + + for lib in $all_libs; do + libname=`basename $lib` + oldname=`otool -D $lib | tail -1` + Message "Updating install name of and references to $libname:" + for lib2 in $all_libs; do + VerboseMessage " updating $lib2" + eval "$cmd install_name_tool -change "$oldname" $install_path/$libname $lib2" + done + VerboseMessage " updating $libname id" + eval "$cmd install_name_tool -id $install_path/$libname $lib" + done +} + +while [ $# -ge 1 ]; do + case "$1" in + --help|-h) + Usage + ;; + + --dry-run|-n) + cmd="echo" + ;; + + --quiet|-q) + quiet=1 + ;; + + --verbose|-v) + verbose=1 + ;; + + --libdir=*) + if [ -n "$libdir" ]; then + GiveUsageErrorAndExit "Multiple --libdir options not allowed." + fi + libdir=`echo $1 | cut -c10-` + ;; + + -*) + GiveUsageErrorAndExit "Unknown option \"$1\"." + ;; + + *) + if [ -n "$install_path" ]; then + GiveUsageErrorAndExit "Too many parameters." + fi + install_path=$1 + esac + + shift +done + +if [ -z $libdir ]; then + libdir=`pwd` +fi + +if [ -z $install_path ]; then + install_path=$libdir +fi + +ChangeInstallNames + +exit 0