]>
git.saurik.com Git - wxWidgets.git/blob - misc/scripts/set_install_name
3 # Name: set_install_name
4 # Purpose: set install_name for wx shared libraries under Mac OS X
5 # Usage: run with --help option to see the instructions
6 # Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org>
8 # Licence: wxWindows licence
9 ################################################################################
22 Usage: $name [OPTIONS] [--prefix=PFX] [--libdir=DIR] [install_path]
24 Change the install name of all wxWidgets libraries in the directory DIR (or
25 current directory if libdir option is not specified) to correspond to the given
26 install_path (defaults to the libraries directory if not specified).
28 If prefix option is given, its value is prefixed to the tool names used. E.g.
29 to use this script when cross-building, use "--prefix=powerpc-apple-darwin8-".
31 -n, --dry-run Don't really do anything, just print the commands
32 -q, --quiet Don't display any non error messages
33 -v, --verbose Just show the commands being executed, don't run them
34 -h, --help Show this help screen and exit
37 * do "$name --libdir=MyApp.app/Contents/Frameworks @executable_path/../Frameworks"
38 when distributing wxWidgets shared libraries with application MyApp
39 * run "$name" without parameters in the directory containing wxWidgets libraries
40 to use them without installing
47 if [ $quiet != 1 ]; then
54 if [ $verbose = 1 ]; then
64 GiveUsageErrorAndExit
()
72 # only change the libs themselves, not symlinks to them
73 all_libs
=`find "$libdir" -type f -name libwx_\*.dylib`
74 if [ -z "$all_libs" ]; then
75 Error
"No wx libraries found in \"$libdir\"."
79 VerboseMessage
"Processing $all_libs\n"
81 for lib
in $all_libs; do
82 libname
=`basename $lib`
83 oldname
=`${tool_prefix}otool -D $lib | tail -1`
84 Message
"Updating install name of and references to $libname:"
85 for lib2
in $all_libs; do
86 VerboseMessage
" updating $lib2"
87 eval "$cmd ${tool_prefix}install_name_tool -change "$oldname" $install_path/$libname $lib2"
89 VerboseMessage
" updating $libname id"
90 eval "$cmd ${tool_prefix}install_name_tool -id $install_path/$libname $lib"
94 while [ $# -ge 1 ]; do
113 if [ -n "$libdir" ]; then
114 GiveUsageErrorAndExit
"Multiple --libdir options not allowed."
116 libdir
=`echo $1 | cut -c10-`
120 if [ -n "$tool_prefix" ]; then
121 GiveUsageErrorAndExit
"At most one --prefix option can be given."
123 tool_prefix
=`echo $1 | cut -c10-`
127 GiveUsageErrorAndExit
"Unknown option \"$1\"."
131 if [ -n "$install_path" ]; then
132 GiveUsageErrorAndExit
"Too many parameters."
140 if [ -z $libdir ]; then
144 if [ -z $install_path ]; then