added --prefix option which is useful when cross-building

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49351 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-10-23 13:38:29 +00:00
parent 96d38a8a71
commit f283c68310

View File

@@ -11,27 +11,32 @@
quiet=0 quiet=0
verbose=0 verbose=0
libdir= libdir=
tool_prefix=
install_path= install_path=
cmd= cmd=
Usage() Usage()
{ {
name=`basename $0`
cat 1>&2 <<EOF cat 1>&2 <<EOF
Usage: $0 [OPTIONS] [--libdir=DIR] [install_path] Usage: $name [OPTIONS] [--prefix=PFX] [--libdir=DIR] [install_path]
Change the install name of all wxWidgets libraries in the directory DIR (or Change the install name of all wxWidgets libraries in the directory DIR (or
current directory if libdir option is not specified) to correspond to the given current directory if libdir option is not specified) to correspond to the given
install_path (defaults to the libraries directory if not specified). install_path (defaults to the libraries directory if not specified).
If prefix option is given, its value is prefixed to the tool names used. E.g.
to use this script when cross-building, use "--prefix=powerpc-apple-darwin8-".
-n, --dry-run Don't really do anything, just print the commands -n, --dry-run Don't really do anything, just print the commands
-q, --quiet Don't display any non error messages -q, --quiet Don't display any non error messages
-v, --verbose Just show the commands being executed, don't run them -v, --verbose Just show the commands being executed, don't run them
-h, --help Show this help screen and exit -h, --help Show this help screen and exit
Examples: Examples:
* do "$0 --libdir=MyApp.app/Contents/Frameworks @executable_path/../Frameworks" * do "$name --libdir=MyApp.app/Contents/Frameworks @executable_path/../Frameworks"
when distributing wxWidgets shared libraries with application MyApp when distributing wxWidgets shared libraries with application MyApp
* run "$0" without parameters in the directory containing wxWidgets libraries * run "$name" without parameters in the directory containing wxWidgets libraries
to use them without installing to use them without installing
EOF EOF
exit 2 exit 2
@@ -75,14 +80,14 @@ ChangeInstallNames()
for lib in $all_libs; do for lib in $all_libs; do
libname=`basename $lib` libname=`basename $lib`
oldname=`otool -D $lib | tail -1` oldname=`${tool_prefix}otool -D $lib | tail -1`
Message "Updating install name of and references to $libname:" Message "Updating install name of and references to $libname:"
for lib2 in $all_libs; do for lib2 in $all_libs; do
VerboseMessage " updating $lib2" VerboseMessage " updating $lib2"
eval "$cmd install_name_tool -change "$oldname" $install_path/$libname $lib2" eval "$cmd ${tool_prefix}install_name_tool -change "$oldname" $install_path/$libname $lib2"
done done
VerboseMessage " updating $libname id" VerboseMessage " updating $libname id"
eval "$cmd install_name_tool -id $install_path/$libname $lib" eval "$cmd ${tool_prefix}install_name_tool -id $install_path/$libname $lib"
done done
} }
@@ -111,6 +116,13 @@ while [ $# -ge 1 ]; do
libdir=`echo $1 | cut -c10-` libdir=`echo $1 | cut -c10-`
;; ;;
--prefix=*)
if [ -n "$tool_prefix" ]; then
GiveUsageErrorAndExit "At most one --prefix option can be given."
fi
tool_prefix=`echo $1 | cut -c10-`
;;
-*) -*)
GiveUsageErrorAndExit "Unknown option \"$1\"." GiveUsageErrorAndExit "Unknown option \"$1\"."
;; ;;