2008-03-15 18:31:52 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# $Id$
|
|
|
|
#
|
|
|
|
# USAGE
|
|
|
|
# osx-app [-s] [-l /path/to/libraries] -bp /path/to/wireshark/bin -p /path/to/Info.plist
|
|
|
|
#
|
|
|
|
# This script attempts to build an Wireshark.app package for OS X, resolving
|
|
|
|
# dynamic libraries, etc.
|
|
|
|
# It strips the executable and libraries if '-s' is given.
|
|
|
|
# It adds python modules if the '-py option' is given
|
|
|
|
# The Info.plist file can be found in the base wireshark directory once
|
|
|
|
# configure has been run.
|
|
|
|
#
|
|
|
|
# AUTHORS
|
|
|
|
# Kees Cook <kees@outflux.net>
|
|
|
|
# Michael Wybrow <mjwybrow@users.sourceforge.net>
|
|
|
|
# Jean-Olivier Irisson <jo.irisson@gmail.com>
|
|
|
|
#
|
|
|
|
# Copyright (C) 2005 Kees Cook
|
|
|
|
# Copyright (C) 2005-2007 Michael Wybrow
|
|
|
|
# Copyright (C) 2007 Jean-Olivier Irisson
|
|
|
|
#
|
|
|
|
# Released under GNU GPL, read the file 'COPYING' for more information
|
|
|
|
#
|
|
|
|
# Thanks to GNUnet's "build_app" script for help with library dep resolution.
|
|
|
|
# https://gnunet.org/svn/GNUnet/contrib/OSX/build_app
|
|
|
|
#
|
|
|
|
# NB:
|
2011-07-17 23:47:10 +00:00
|
|
|
# This originally came from Inkscape; Inkscape's configure script has an
|
|
|
|
# "--enable-osxapp", which causes some of Inkscape's installation data
|
|
|
|
# files to have OS X-ish paths under Contents/Resources of the package
|
|
|
|
# or under /Library/Application Support. We don't have such an option;
|
|
|
|
# we just put them in "bin", "etc", "lib", and "share" directories
|
|
|
|
# under Contents/Resources, rather than in the "bin", "etc", "lib",
|
|
|
|
# and "share" directories under the installation directory.
|
2008-03-15 18:31:52 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
# Defaults
|
|
|
|
strip=false
|
|
|
|
binary_path="/tmp/inst/bin"
|
|
|
|
plist="./Info.plist"
|
|
|
|
util_dir="./Utilities"
|
|
|
|
cli_dir="$util_dir/Command Line"
|
2009-04-22 20:37:48 +00:00
|
|
|
chmodbpf_dir="$util_dir/ChmodBPF"
|
2013-10-09 20:49:12 +00:00
|
|
|
exclude_prefixes="/System/|/Library/|/usr/lib/|/usr/X11/|/opt/X11/|@rpath|@executable_path"
|
|
|
|
|
2013-09-30 10:20:43 +00:00
|
|
|
|
|
|
|
# "qt" or "gtk"
|
|
|
|
ui_toolkit="gtk"
|
|
|
|
# Name of the Wireshark executable
|
|
|
|
wireshark_bin_name="wireshark"
|
2008-03-15 18:31:52 +00:00
|
|
|
|
|
|
|
binary_list="
|
|
|
|
capinfos
|
|
|
|
dftest
|
|
|
|
dumpcap
|
|
|
|
editcap
|
|
|
|
mergecap
|
|
|
|
randpkt
|
|
|
|
rawshark
|
|
|
|
text2pcap
|
|
|
|
tshark
|
|
|
|
"
|
|
|
|
|
2013-01-05 23:11:38 +00:00
|
|
|
# Location for libraries (macosx-setup.sh defaults to whatever the
|
|
|
|
# various support libraries use as their standard installation location,
|
|
|
|
# which is /usr/local)
|
2008-03-15 18:31:52 +00:00
|
|
|
if [ -z $LIBPREFIX ]; then
|
2013-01-05 23:11:38 +00:00
|
|
|
LIBPREFIX="/usr/local"
|
2008-03-15 18:31:52 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Help message
|
|
|
|
#----------------------------------------------------------
|
|
|
|
help()
|
|
|
|
{
|
|
|
|
echo -e "
|
|
|
|
Create an app bundle for OS X
|
|
|
|
|
2008-03-21 16:09:04 +00:00
|
|
|
USAGE
|
2013-09-30 10:20:43 +00:00
|
|
|
$0 [-s] [-l /path/to/libraries] [-qt] -bp /path/to/wireshark/binaries -p /path/to/Info.plist
|
2008-03-15 18:31:52 +00:00
|
|
|
|
2008-03-21 16:09:04 +00:00
|
|
|
OPTIONS
|
|
|
|
-h,--help
|
2008-03-15 18:31:52 +00:00
|
|
|
display this help message
|
2008-03-21 16:09:04 +00:00
|
|
|
-s
|
2008-03-15 18:31:52 +00:00
|
|
|
strip the libraries and executables from debugging symbols
|
2008-03-21 16:09:04 +00:00
|
|
|
-l,--libraries
|
2013-01-05 23:11:38 +00:00
|
|
|
specify the path to the libraries Wireshark depends on
|
|
|
|
(typically /sw or /opt/local). By default it is
|
|
|
|
/usr/local.
|
2008-03-21 16:09:04 +00:00
|
|
|
-bp,--binary-path
|
2008-03-15 18:31:52 +00:00
|
|
|
specify the path to the Wireshark binaries. By default it
|
2013-01-05 23:11:38 +00:00
|
|
|
is /tmp/inst/bin.
|
2008-03-21 16:09:04 +00:00
|
|
|
-p,--plist
|
2008-03-15 18:31:52 +00:00
|
|
|
specify the path to Info.plist. Info.plist can be found
|
|
|
|
in the base directory of the source code once configure
|
2013-01-05 23:11:38 +00:00
|
|
|
has been run.
|
2013-07-06 16:42:30 +00:00
|
|
|
-sdkroot
|
|
|
|
specify the root of the SDK to use
|
2013-09-30 10:20:43 +00:00
|
|
|
-qt,--qt-flavor
|
|
|
|
use the Qt flavor
|
2008-03-15 18:31:52 +00:00
|
|
|
|
2008-03-21 16:09:04 +00:00
|
|
|
EXAMPLE
|
2013-07-06 16:42:30 +00:00
|
|
|
$0 -s -l /opt/local -bp ../../Build/bin -p Info.plist -sdkroot /Developer/SDKs/MacOSX10.5.sdk
|
2008-03-15 18:31:52 +00:00
|
|
|
"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Parse command line arguments
|
|
|
|
#----------------------------------------------------------
|
|
|
|
while [ "$1" != "" ]
|
|
|
|
do
|
|
|
|
case $1 in
|
|
|
|
-s)
|
|
|
|
strip=true ;;
|
|
|
|
-l|--libraries)
|
|
|
|
LIBPREFIX="$2"
|
|
|
|
shift 1 ;;
|
|
|
|
-bp|--binary-path)
|
|
|
|
binary_path="$2"
|
|
|
|
shift 1 ;;
|
|
|
|
-p|--plist)
|
|
|
|
plist="$2"
|
|
|
|
shift 1 ;;
|
2013-09-30 10:20:43 +00:00
|
|
|
-qt|--qt-flavor)
|
|
|
|
ui_toolkit="qt"
|
|
|
|
wireshark_bin_name="wireshark-qt"
|
|
|
|
;;
|
2008-03-15 18:31:52 +00:00
|
|
|
-h|--help)
|
|
|
|
help
|
|
|
|
exit 0 ;;
|
2013-07-06 16:42:30 +00:00
|
|
|
-sdkroot)
|
|
|
|
sdkroot="$2"
|
|
|
|
shift 1 ;;
|
2008-03-15 18:31:52 +00:00
|
|
|
*)
|
|
|
|
echo "Invalid command line option: $1"
|
|
|
|
exit 2 ;;
|
|
|
|
esac
|
|
|
|
shift 1
|
|
|
|
done
|
|
|
|
|
2008-03-21 16:09:04 +00:00
|
|
|
echo -e "\nCREATE WIRESHARK APP BUNDLE\n"
|
2008-03-15 18:31:52 +00:00
|
|
|
|
|
|
|
# Safety tests
|
|
|
|
if [ ! -e "$LIBPREFIX" ]; then
|
2011-05-20 02:44:12 +00:00
|
|
|
echo "Cannot find the directory containing the libraries: $LIBPREFIX" >&2
|
2008-03-15 18:31:52 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2013-09-30 10:20:43 +00:00
|
|
|
for binary in $wireshark_bin_name $binary_list ; do
|
2008-03-15 18:31:52 +00:00
|
|
|
if [ ! -x "$binary_path/$binary" ]; then
|
|
|
|
echo "Couldn't find $binary (or it's not executable)" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ ! -f "$plist" ]; then
|
|
|
|
echo "Need plist file" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Handle some version specific details.
|
|
|
|
VERSION=`/usr/bin/sw_vers | grep ProductVersion | cut -f2 -d'.'`
|
|
|
|
if [ "$VERSION" -ge "4" ]; then
|
|
|
|
# We're on Tiger (10.4) or later.
|
|
|
|
# XCode behaves a little differently in Tiger and later.
|
|
|
|
XCODEFLAGS="-configuration Deployment"
|
|
|
|
SCRIPTEXECDIR="ScriptExec/build/Deployment/ScriptExec.app/Contents/MacOS"
|
|
|
|
EXTRALIBS=""
|
|
|
|
else
|
|
|
|
# Panther (10.3) or earlier.
|
|
|
|
XCODEFLAGS="-buildstyle Deployment"
|
|
|
|
SCRIPTEXECDIR="ScriptExec/build/ScriptExec.app/Contents/MacOS"
|
|
|
|
EXTRALIBS=""
|
|
|
|
fi
|
|
|
|
|
2013-07-06 16:42:30 +00:00
|
|
|
# Set the SDK root, if an SDK was specified.
|
|
|
|
# (-sdk is only supported by the xcodebuild in the version of the
|
|
|
|
# developer tools that came with Snow Leopard and later versions)
|
|
|
|
if [ ! -z "$sdkroot" ]
|
|
|
|
then
|
|
|
|
XCODEFLAGS="$XCODEFLAGS SDKROOT=$sdkroot"
|
|
|
|
fi
|
2008-03-15 18:31:52 +00:00
|
|
|
|
|
|
|
# Package always has the same name. Version information is stored in
|
|
|
|
# the Info.plist file which is filled in by the configure script.
|
|
|
|
package="Wireshark.app"
|
|
|
|
|
|
|
|
# Remove a previously existing package if necessary
|
|
|
|
if [ -d $package ]; then
|
|
|
|
echo "Removing previous Wireshark.app"
|
|
|
|
rm -Rf $package
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Remove a previously existing utility directory if necessary
|
|
|
|
if [ -d "$util_dir" ]; then
|
|
|
|
echo "Removing $util_dir directory"
|
|
|
|
rm -Rf "$util_dir"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Set the 'macosx' directory, usually the current directory.
|
|
|
|
resdir=`pwd`
|
|
|
|
|
|
|
|
|
|
|
|
# Prepare Package
|
|
|
|
#----------------------------------------------------------
|
|
|
|
pkgexec="$package/Contents/MacOS"
|
|
|
|
pkgres="$package/Contents/Resources"
|
2013-09-30 17:33:59 +00:00
|
|
|
pkgbin="$pkgexec"
|
2013-10-07 19:37:22 +00:00
|
|
|
if [ "$ui_toolkit" = "gtk" ] ; then
|
|
|
|
pkgbin="$pkgres/bin"
|
|
|
|
fi
|
2013-09-30 11:29:58 +00:00
|
|
|
# Should pkglib be Contents/Frameworks instead?
|
2013-09-30 13:12:28 +00:00
|
|
|
#pkglib="$pkgres/lib"
|
|
|
|
pkglib="$package/Contents/Frameworks"
|
|
|
|
pkgqtplugin="$package/Contents/PlugIns"
|
2008-03-15 18:31:52 +00:00
|
|
|
pkgplugin="$pkglib/wireshark/plugins"
|
2009-05-31 18:30:46 +00:00
|
|
|
pkgpython="$pkglib/wireshark/python"
|
2008-03-15 18:31:52 +00:00
|
|
|
|
|
|
|
mkdir -p "$pkgexec"
|
|
|
|
mkdir -p "$pkgbin"
|
2013-09-30 13:12:28 +00:00
|
|
|
mkdir -p "$pkgqtplugin"
|
2008-03-15 18:31:52 +00:00
|
|
|
mkdir -p "$pkgplugin"
|
2009-05-31 18:30:46 +00:00
|
|
|
mkdir -p "$pkgpython"
|
2008-03-15 18:31:52 +00:00
|
|
|
|
|
|
|
mkdir -p "$cli_dir"
|
|
|
|
|
2013-09-30 10:20:43 +00:00
|
|
|
if [ "$ui_toolkit" = "qt" ] ; then
|
|
|
|
cp "$binary_path/$wireshark_bin_name" "$pkgexec/Wireshark"
|
|
|
|
else
|
2008-03-15 18:31:52 +00:00
|
|
|
# Build and add the launcher
|
|
|
|
#----------------------------------------------------------
|
2013-09-30 10:20:43 +00:00
|
|
|
(
|
|
|
|
# Build fails if CC happens to be set (to anything other than CompileC)
|
|
|
|
unset CC
|
2008-03-15 18:31:52 +00:00
|
|
|
|
2013-09-30 10:20:43 +00:00
|
|
|
cd "$resdir/ScriptExec"
|
|
|
|
echo -e "Building launcher...\n"
|
|
|
|
xcodebuild $XCODEFLAGS clean build
|
|
|
|
)
|
|
|
|
cp "$resdir/$SCRIPTEXECDIR/ScriptExec" "$pkgexec/Wireshark"
|
2008-03-15 18:31:52 +00:00
|
|
|
|
2013-09-30 10:20:43 +00:00
|
|
|
fi
|
2008-03-15 18:31:52 +00:00
|
|
|
|
|
|
|
# Copy all files into the bundle
|
|
|
|
#----------------------------------------------------------
|
2008-03-21 16:09:04 +00:00
|
|
|
echo -e "\nFilling app bundle and utility directory...\n"
|
2008-03-15 18:31:52 +00:00
|
|
|
|
|
|
|
# Wireshark executables
|
2013-09-30 17:33:59 +00:00
|
|
|
if [ "$ui_toolkit" = "gtk" ] ; then
|
|
|
|
cp -v utility-launcher "$cli_dir/$binary"
|
2013-10-07 19:37:22 +00:00
|
|
|
for binary in $binary_list wireshark ; do
|
2013-09-30 17:33:59 +00:00
|
|
|
# Copy the binary to its destination
|
|
|
|
dest_path="$pkgbin/$binary-bin"
|
|
|
|
cp -v "$binary_path/$binary" "$dest_path"
|
|
|
|
# TODO Add a "$verbose" variable and command line switch, which sets wether these commands are verbose or not
|
|
|
|
|
2013-10-07 19:37:22 +00:00
|
|
|
if [ "$binary" != "wireshark" ] ; then
|
|
|
|
ln -sv ./wireshark "$pkgbin/$binary"
|
|
|
|
ln -sv ./wireshark "$cli_dir/$binary"
|
|
|
|
fi
|
2013-09-30 17:33:59 +00:00
|
|
|
done
|
|
|
|
elif [ "$ui_toolkit" = "qt" ] ; then
|
|
|
|
for binary in $binary_list ; do
|
|
|
|
# Copy the binary to its destination
|
|
|
|
cp -v "$binary_path/$binary" "$pkgexec"
|
|
|
|
done
|
|
|
|
fi
|
2008-03-15 18:31:52 +00:00
|
|
|
|
|
|
|
# ChmodBPF
|
2009-04-22 20:37:48 +00:00
|
|
|
mkdir -p "$chmodbpf_dir"
|
|
|
|
cp -v ChmodBPF/* "$chmodbpf_dir"
|
2011-05-20 02:35:05 +00:00
|
|
|
chmod -R g-w "$chmodbpf_dir"
|
2008-03-15 18:31:52 +00:00
|
|
|
|
|
|
|
# The rest of the Wireshark installation (we handled bin above)
|
|
|
|
rsync -av \
|
|
|
|
--exclude bin/ \
|
2013-09-30 17:19:48 +00:00
|
|
|
--exclude lib/ \
|
2008-03-15 18:31:52 +00:00
|
|
|
"$binary_path/.."/* "$pkgres"
|
|
|
|
|
2013-09-30 17:19:48 +00:00
|
|
|
rsync -av $binary_path/../lib/*.dylib "$pkglib/"
|
|
|
|
|
2008-03-15 18:31:52 +00:00
|
|
|
# Remove the version number from the plugin path
|
|
|
|
find "$binary_path/../lib/wireshark/plugins" -type f \
|
|
|
|
-exec cp -fv "{}" "$pkgplugin/" \;
|
|
|
|
|
2009-05-31 18:30:46 +00:00
|
|
|
# Remove the version number from the python path
|
|
|
|
find "$binary_path/../lib/wireshark/python" -type f \
|
|
|
|
-exec cp -fv "{}" "$pkgpython/" \;
|
|
|
|
|
2008-03-15 18:31:52 +00:00
|
|
|
cp "$plist" "$package/Contents/Info.plist"
|
|
|
|
|
|
|
|
# Icons and the rest of the script framework
|
2013-09-30 10:20:43 +00:00
|
|
|
res_list="
|
|
|
|
Wireshark.icns
|
|
|
|
Wiresharkdoc.icns
|
|
|
|
"
|
|
|
|
|
|
|
|
if [ "$ui_toolkit" = "gtk" ] ; then
|
|
|
|
res_list="
|
|
|
|
$res_list
|
2013-10-10 17:30:56 +00:00
|
|
|
bin
|
2013-09-30 10:20:43 +00:00
|
|
|
etc
|
2013-10-10 17:30:56 +00:00
|
|
|
openDoc
|
2013-09-30 10:20:43 +00:00
|
|
|
script
|
|
|
|
MenuBar.nib
|
|
|
|
ProgressWindow.nib
|
|
|
|
themes
|
|
|
|
"
|
|
|
|
fi
|
|
|
|
|
|
|
|
for rl_entry in $res_list ; do
|
|
|
|
rsync -av "$resdir"/Resources/$rl_entry "$package"/Contents/Resources/
|
|
|
|
done
|
2008-03-15 18:31:52 +00:00
|
|
|
|
|
|
|
# PkgInfo must match bundle type and creator code from Info.plist
|
|
|
|
echo "APPLWshk" > $package/Contents/PkgInfo
|
|
|
|
|
2013-09-30 10:20:43 +00:00
|
|
|
if [ "$ui_toolkit" = "gtk" ] ; then
|
|
|
|
|
|
|
|
# Pull in extra requirements for Pango and GTK
|
|
|
|
pkgetc="$package/Contents/Resources/etc"
|
|
|
|
mkdir -p $pkgetc/pango
|
|
|
|
cp $LIBPREFIX/etc/pango/pangox.aliases $pkgetc/pango/
|
|
|
|
# Need to adjust path and quote in case of spaces in path.
|
|
|
|
sed -e "s,$LIBPREFIX,\"\${CWD},g" -e 's,\.so ,.so" ,g' $LIBPREFIX/etc/pango/pango.modules > $pkgetc/pango/pango.modules
|
|
|
|
cat > $pkgetc/pango/pangorc <<END_PANGO
|
2008-03-15 18:31:52 +00:00
|
|
|
[Pango]
|
|
|
|
ModuleFiles=\${HOME}/.wireshark-etc/pango.modules
|
|
|
|
[PangoX]
|
|
|
|
AliasFiles=\${HOME}/.wireshark-etc/pangox.aliases
|
|
|
|
END_PANGO
|
|
|
|
|
2013-09-30 10:20:43 +00:00
|
|
|
# We use a modified fonts.conf file so only need the dtd
|
|
|
|
mkdir -p $pkgetc/fonts
|
|
|
|
cp $LIBPREFIX/etc/fonts/fonts.dtd $pkgetc/fonts/
|
|
|
|
cp -r $LIBPREFIX/etc/fonts/conf.avail $pkgetc/fonts/
|
|
|
|
cp -r $LIBPREFIX/etc/fonts/conf.d $pkgetc/fonts/
|
2008-03-15 18:31:52 +00:00
|
|
|
|
2013-09-30 10:20:43 +00:00
|
|
|
mkdir -p $pkgetc/gtk-2.0
|
2011-07-17 20:23:07 +00:00
|
|
|
#
|
2013-09-30 10:20:43 +00:00
|
|
|
# In newer versions of GTK+, the gdk-pixbuf library was split off from
|
|
|
|
# GTK+, and the gdk-pixbuf.loaders file moved, so we check for its
|
|
|
|
# existence here.
|
2011-07-17 20:23:07 +00:00
|
|
|
#
|
2013-09-30 10:20:43 +00:00
|
|
|
# The file is ultimately copied to the user's home directory, with
|
|
|
|
# the pathnames adjusted to refer to the installed package, so we
|
|
|
|
# always put it in the same location in the installed package,
|
|
|
|
# regardless of where it lives in the machine on which it's built.
|
2011-07-17 20:23:07 +00:00
|
|
|
#
|
2013-09-30 10:20:43 +00:00
|
|
|
if [ -e $LIBPREFIX/etc/gtk-2.0/gdk-pixbuf.loaders ]
|
2011-07-17 20:23:07 +00:00
|
|
|
then
|
2013-09-30 10:20:43 +00:00
|
|
|
sed -e "s,$LIBPREFIX,\${CWD},g" $LIBPREFIX/etc/gtk-2.0/gdk-pixbuf.loaders > $pkgetc/gtk-2.0/gdk-pixbuf.loaders
|
2011-07-17 20:23:07 +00:00
|
|
|
fi
|
2013-09-30 10:20:43 +00:00
|
|
|
sed -e "s,$LIBPREFIX,\${CWD},g" $LIBPREFIX/etc/gtk-2.0/gtk.immodules > $pkgetc/gtk-2.0/gtk.immodules
|
|
|
|
|
|
|
|
pango_version=`pkg-config --variable=pango_module_version pango`
|
|
|
|
mkdir -p $pkglib/pango/$pango_version/modules
|
|
|
|
cp $LIBPREFIX/lib/pango/$pango_version/modules/*.so $pkglib/pango/$pango_version/modules/
|
|
|
|
|
|
|
|
gtk_version=`pkg-config --variable=gtk_binary_version gtk+-2.0`
|
|
|
|
mkdir -p $pkglib/gtk-2.0/$gtk_version/{engines,immodules,loaders}
|
|
|
|
cp -r $LIBPREFIX/lib/gtk-2.0/$gtk_version/* $pkglib/gtk-2.0/$gtk_version/
|
|
|
|
|
|
|
|
gdk_pixbuf_version=`pkg-config --variable=gdk_pixbuf_binary_version gdk-pixbuf-2.0`
|
|
|
|
if [ ! -z $gdk_pixbuf_version ]; then
|
|
|
|
mkdir -p $pkglib/gdk-pixbuf-2.0/$gdk_pixbuf_version/loaders
|
|
|
|
#
|
|
|
|
# As per the above, check whether we have a loaders.cache file
|
|
|
|
# in $LIBPREFIX/lib/gdk-pixbuf-2.0/$gdk_pixbuf_version, as
|
|
|
|
# that's where the output of gdk-pixbuf-query-loaders gets
|
|
|
|
# put if gdk-pixbuf and GTK+ are separated.
|
|
|
|
#
|
|
|
|
# The file is ultimately copied to the user's home directory,
|
|
|
|
# with the pathnames adjusted to refer to the installed package,
|
|
|
|
# so we always put it in the same location in the installed
|
|
|
|
# package, regardless of where it lives in the machine on which
|
|
|
|
# it's built.
|
|
|
|
#
|
|
|
|
if [ -e $LIBPREFIX/lib/gdk-pixbuf-2.0/$gdk_pixbuf_version/loaders.cache ]
|
|
|
|
then
|
|
|
|
sed -e "s,$LIBPREFIX,\${CWD},g" $LIBPREFIX/lib/gdk-pixbuf-2.0/$gdk_pixbuf_version/loaders.cache > $pkgetc/gtk-2.0/gdk-pixbuf.loaders
|
|
|
|
fi
|
|
|
|
cp -r $LIBPREFIX/lib/gdk-pixbuf-2.0/$gdk_pixbuf_version/loaders/* $pkglib/gdk-pixbuf-2.0/$gdk_pixbuf_version/loaders
|
|
|
|
fi
|
|
|
|
fi # GTK+ / Qt
|
2010-10-20 10:37:11 +00:00
|
|
|
|
2011-07-17 20:23:07 +00:00
|
|
|
# Find out libs we need from Fink, MacPorts, or from a custom install
|
2008-03-15 18:31:52 +00:00
|
|
|
# (i.e. $LIBPREFIX), then loop until no changes.
|
|
|
|
a=1
|
|
|
|
nfiles=0
|
|
|
|
endl=true
|
|
|
|
lib_dep_search_list="
|
2013-09-30 10:20:43 +00:00
|
|
|
$pkglib/*
|
2008-03-15 18:31:52 +00:00
|
|
|
$pkgbin/*-bin
|
|
|
|
"
|
2013-09-30 10:20:43 +00:00
|
|
|
if [ "$ui_toolkit" = "gtk" ] ; then
|
|
|
|
lib_dep_search_list="
|
|
|
|
$lib_dep_search_list
|
|
|
|
$pkglib/gtk-2.0/$gtk_version/loaders/*
|
|
|
|
$pkglib/gtk-2.0/$gtk_version/immodules/*
|
|
|
|
$pkglib/gtk-2.0/$gtk_version/engines/*.so
|
|
|
|
$pkglib/pango/$pango_version/modules/*
|
|
|
|
$pkglib/gdk-pixbuf-2.0/$gdk_pixbuf_version/loaders/*
|
|
|
|
"
|
|
|
|
elif [ "$ui_toolkit" = "qt" ] ; then
|
|
|
|
lib_dep_search_list="
|
|
|
|
$pkgexec/Wireshark
|
|
|
|
$lib_dep_search_list
|
|
|
|
"
|
|
|
|
fi
|
|
|
|
|
2008-03-15 18:31:52 +00:00
|
|
|
while $endl; do
|
2008-03-21 16:09:04 +00:00
|
|
|
echo -e "Looking for dependencies. Round" $a
|
2013-10-09 20:49:12 +00:00
|
|
|
libs="`\
|
|
|
|
otool -L $lib_dep_search_list 2>/dev/null \
|
|
|
|
| fgrep compatibility \
|
|
|
|
| cut -d\( -f1 \
|
|
|
|
| egrep -v "$exclude_prefixes" \
|
|
|
|
| sort \
|
|
|
|
| uniq \
|
|
|
|
`"
|
2008-06-18 22:47:58 +00:00
|
|
|
cp -vn $libs "$pkglib"
|
2008-03-15 18:31:52 +00:00
|
|
|
let "a+=1"
|
|
|
|
nnfiles=`ls "$pkglib" | wc -l`
|
|
|
|
if [ $nnfiles = $nfiles ]; then
|
|
|
|
endl=false
|
|
|
|
else
|
|
|
|
nfiles=$nnfiles
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# Add extra libraries of necessary
|
|
|
|
for libfile in $EXTRALIBS
|
|
|
|
do
|
|
|
|
cp -f $libfile "$pkglib"
|
|
|
|
done
|
2013-09-30 10:20:43 +00:00
|
|
|
chmod 755 "$pkglib"/*.dylib
|
2008-03-15 18:31:52 +00:00
|
|
|
|
|
|
|
# Strip libraries and executables if requested
|
|
|
|
#----------------------------------------------------------
|
|
|
|
if [ "$strip" = "true" ]; then
|
2008-03-21 16:09:04 +00:00
|
|
|
echo -e "\nStripping debugging symbols...\n"
|
2008-03-15 18:31:52 +00:00
|
|
|
strip -x "$pkglib"/*.dylib
|
|
|
|
strip -ur "$binpath"
|
|
|
|
fi
|
|
|
|
|
2013-07-13 22:43:35 +00:00
|
|
|
# NOTE: we must rpathify *all* files, *including* plugins for GTK+ etc.,
|
|
|
|
# to keep GTK+ from crashing at startup.
|
2008-03-15 18:31:52 +00:00
|
|
|
#
|
2013-07-13 22:43:35 +00:00
|
|
|
rpathify_file () {
|
|
|
|
# Fix a given executable, library, or plugin to be relocatable
|
|
|
|
if [ ! -d "$1" ]; then
|
|
|
|
#
|
|
|
|
# OK, what type of file is this?
|
|
|
|
#
|
|
|
|
filetype=`otool -hv "$1" | sed -n '4p' | awk '{print $5}'`
|
|
|
|
case "$filetype" in
|
|
|
|
|
|
|
|
EXECUTE|DYLIB|BUNDLE)
|
|
|
|
#
|
|
|
|
# Executable, library, or plugin. (Plugins
|
|
|
|
# can be either DYLIB or BUNDLE; shared
|
|
|
|
# libraries are DYLIB.)
|
|
|
|
#
|
|
|
|
# For DYLIB and BUNDLE, fix the shared
|
|
|
|
# library identification.
|
|
|
|
#
|
|
|
|
if [[ "$filetype" = "DYLIB" || "$filetype" = "BUNDLE" ]]; then
|
|
|
|
echo "Changing shared library identification of $1"
|
|
|
|
base=`echo $1 | awk -F/ '{print $NF}'`
|
|
|
|
#
|
|
|
|
# The library will end up in a directory in
|
|
|
|
# the rpath; this is what we should change its
|
|
|
|
# ID to.
|
|
|
|
#
|
|
|
|
to=@rpath/$base
|
|
|
|
/usr/bin/install_name_tool -id $to $1
|
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# Get the list of dynamic libraries on which this
|
|
|
|
# file depends, and select only the libraries that
|
|
|
|
# are in $LIBPREFIX, as those are the only ones
|
|
|
|
# that we'll be shipping in the app bundle; the
|
|
|
|
# other libraries are system-supplied or supplied
|
|
|
|
# as part of X11, will be expected to be on the
|
|
|
|
# system on which the bundle will be installed,
|
|
|
|
# and should be referred to by their full pathnames.
|
|
|
|
#
|
2013-10-09 20:49:12 +00:00
|
|
|
libs="`\
|
|
|
|
otool -L $1 \
|
|
|
|
| fgrep compatibility \
|
|
|
|
| cut -d\( -f1 \
|
|
|
|
| egrep -v "$exclude_prefixes" \
|
|
|
|
| sort \
|
|
|
|
| uniq \
|
|
|
|
`"
|
|
|
|
|
2013-07-13 22:43:35 +00:00
|
|
|
for lib in $libs; do
|
|
|
|
#
|
|
|
|
# Get the file name of the library.
|
|
|
|
#
|
|
|
|
base=`echo $lib | awk -F/ '{print $NF}'`
|
|
|
|
#
|
|
|
|
# The library will end up in a directory in
|
|
|
|
# the rpath; this is what we should change its
|
|
|
|
# file name to.
|
|
|
|
#
|
|
|
|
to=@rpath/$base
|
|
|
|
#
|
|
|
|
# Change the reference to that library.
|
|
|
|
#
|
2013-09-30 15:37:11 +00:00
|
|
|
echo "Changing reference to $lib to $to in $1"
|
2013-07-13 22:43:35 +00:00
|
|
|
/usr/bin/install_name_tool -change $lib $to $1
|
|
|
|
done
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
rpathify_dir () {
|
|
|
|
#
|
|
|
|
# Make sure we *have* that directory
|
|
|
|
#
|
|
|
|
if [ -d "$1" ]; then
|
|
|
|
(cd "$1"
|
|
|
|
#
|
|
|
|
# Make sure we *have* files to fix
|
|
|
|
#
|
|
|
|
files=`ls $2 2>/dev/null`
|
|
|
|
if [ ! -z "$files" ]; then
|
|
|
|
for file in $files; do
|
|
|
|
rpathify_file "$file" "`pwd`"
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
)
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
rpathify_files () {
|
|
|
|
#
|
|
|
|
# Fix package deps
|
|
|
|
#
|
|
|
|
rpathify_dir "$pkglib" "*.dylib"
|
2013-09-30 10:20:43 +00:00
|
|
|
if [ "$ui_toolkit" = "gtk" ] ; then
|
|
|
|
rpathify_dir "$pkglib/gtk-2.0/$gtk_version/loaders" "*.so"
|
|
|
|
rpathify_dir "$pkglib/gtk-2.0/$gtk_version/engines" "*.so"
|
|
|
|
rpathify_dir "$pkglib/gtk-2.0/$gtk_version/immodules" "*.so"
|
|
|
|
rpathify_dir "$pkglib/gtk-2.0/$gtk_version/printbackends" "*.so"
|
|
|
|
rpathify_dir "$pkglib/gnome-vfs-2.0/modules" "*.so"
|
|
|
|
rpathify_dir "$pkglib/gdk-pixbuf-2.0/$gtk_version/loaders" "*.so"
|
|
|
|
rpathify_dir "$pkglib/pango/$pango_version/modules" "*.so"
|
|
|
|
fi
|
2013-07-13 22:43:35 +00:00
|
|
|
rpathify_dir "$pkgbin" "*"
|
|
|
|
}
|
|
|
|
|
2013-10-09 20:49:12 +00:00
|
|
|
if [ "$ui_toolkit" = "qt" ] ; then
|
|
|
|
macdeployqt "$package" -verbose=2
|
|
|
|
fi
|
|
|
|
|
2013-07-13 22:43:35 +00:00
|
|
|
PATHLENGTH=`echo $LIBPREFIX | wc -c`
|
|
|
|
if [ "$PATHLENGTH" -ge "6" ]; then
|
|
|
|
# If the LIBPREFIX path is long enough to allow
|
|
|
|
# path rewriting, then do this.
|
|
|
|
# 6 is the length of @rpath, which replaces LIBPREFIX.
|
|
|
|
rpathify_files
|
|
|
|
else
|
|
|
|
echo "Could not rewrite dylib paths for bundled libraries. This requires" >&2
|
|
|
|
echo "the support libraries to be installed in a PREFIX of at least 6 characters in length." >&2
|
|
|
|
echo "" >&2
|
|
|
|
echo "The package will still work if the following line is uncommented in" >&2
|
|
|
|
echo "Wireshark.app/Contents/Resources/bin/{various scripts}:" >&2
|
|
|
|
echo ' export DYLD_LIBRARY_PATH="$TOP/lib"' >&2
|
|
|
|
exit 1
|
|
|
|
|
|
|
|
fi
|
2008-03-15 18:31:52 +00:00
|
|
|
|
2013-10-15 23:03:48 +00:00
|
|
|
if [ -n "$CODE_SIGN_IDENTITY" ] ; then
|
|
|
|
echo -e "Signing $package"
|
|
|
|
codesign --sign "$CODE_SIGN_IDENTITY" --verbose "$package" || exit 1
|
|
|
|
codesign --verify --verbose "$package" || exit 1
|
|
|
|
fi
|
|
|
|
|
2008-03-15 18:31:52 +00:00
|
|
|
exit 0
|