Add Joerg Mayer's macos-setup.sh script, modified to add an "x" after

"macos", to fix some bugs, to use "sudo" if necessary when installing,
to make the library version numbers variables, and to download the
optional libraries, by default, as well.  Also add his patches to make
GLib build and work.

Update README.macos to reflect that.

svn path=/trunk/; revision=38053
This commit is contained in:
Guy Harris 2011-07-15 21:48:02 +00:00
parent 9adf6c20ca
commit b273aad66e
5 changed files with 374 additions and 14 deletions

View File

@ -793,6 +793,9 @@ EXTRA_DIST = \
image/wssplash-dev.xpm \
image/wssplash.xpm \
ipmap.html \
macosx-setup.sh \
macosx-support-lib-patches/glib-gconvert.patch \
macosx-support-lib-patches/glib-pkgconfig.patch \
make-version.pl \
manuf \
manuf.tmpl \

View File

@ -16,13 +16,15 @@ be able to build TShark. The X11 and X11 SDK that come with Mac OS X
releases starting with Panther can be used to build and run Wireshark.
You must also have GLib and, if you want to build Wireshark as well as
TShark, GTK+. See
TShark, GTK+. The macosx-setup.sh script can be used to download, patch
as necessary, build, and install those libraries and the libraries on
which they depend; it will, by default, also install other libraries
that can be used by Wireshark and TShark. The versions of libraries to
download are specified by variables set early in the script; you can
comment out the settings of optional libraries if you don't want them
downloaded and installed.
https://nplab.fh-muenster.de/groups/wiki/wiki/fb7a4/Building_Wireshark_on_SnowLeopard.html
for information on how to install GLib, GTK+'s dependencies, GTK+, and
some additional optional support libraries from source.
from source
After you have installed those libraries:
If you are building from a Subversion tree, rather than from a source
distribution tarball, run the autogen.sh script. This should not be
@ -59,7 +61,8 @@ to un-install them and rebuild them on Snow Leopard (10.6), to get 64-bit
versions.
Some required and optional libraries require special attention if you
install them by building from source code on Snow Leopard:
install them by building from source code on Snow Leopard; the
macosx-setup.sh script will handle that for you.
GLib - the GLib configuration script determines whether the system's
libiconv is GNU iconv or not by checking whether it has libiconv_open(),
@ -67,7 +70,8 @@ and the compile will fail if that test doesn't correctly indicate
whether libiconv is GNU iconv. In Mac OS X, libiconv is GNU iconv, but
the 64-bit version doesn't have libiconv_open(); a workaround for this
is to replace all occurrences of "libiconv_open" with "iconv_open" in
the configure script before running the script.
the configure script before running the script. The macosx-setup.sh
setup script will patch GLib to work around this.
libgcrypt - the libgcrypt configuration script attempts to determine
which flavor of assembler-language routines to use based on the platform
@ -77,7 +81,8 @@ determine the processor type; however, in Mac OS X, uname always reports
64-bit processors, so it will attempt to assemble the 32-bit x86
assembler-language routines, which will fail. The workaround for this
is to run the configure script with the --disable-asm argument, so that
the assembler-language routines are not used.
the assembler-language routines are not used. The macosx-setup.sh will
configure libgcrypt with that option.
PortAudio - when compiling on Mac OS X, the configure script for the
pa_stable_v19_20071207 version of PortAudio will cause certain
@ -85,8 +90,5 @@ platform-dependent build environment #defines to be set in the
Makefile rules, and to cause a universal build to be done; those
#defines will be incorrect for all but one of the architectures for
which the build is being done, and that will cause a compile-time error
on Snow Leopard. The current snapshot version of PortAudio still
defines those values in the Makefile, but it appears to use them in ways
that don't cause build problems; its configure script also has a
"--disable-mac-universal" flag that can cause the build not to be done
universal.
on Snow Leopard. Newer versions don't have this problem; the
macosx-setup.sh script downloads a newer version.

335
macosx-setup.sh Executable file
View File

@ -0,0 +1,335 @@
#!/bin/sh
# Setup development environment on Mac OS X (tested with 10.6.8 and Xcode 3.2.6)
#
# $Id$
#
# Trying to follow "Building Wireshark on SnowLeopard"
# given by Michael Tuexen at
# http://nplab.fh-muenster.de/groups/wiki/wiki/fb7a4/Building_Wireshark_on_SnowLeopard.html
#
#
# Versions to download and install.
#
# These are required.
#
GETTEXT_VERSION=0.18.1.1
GLIB_VERSION=2.29.8
#
# pkg-config 0.26 appears to have broken the "we have our own GLib"
# stuff, even if you explicitly set GLIB_CFLAGS and GLIB_LIBS.
# Life's too short to work around the circular dependency in a script,
# so we use 0.25 instead.
#
PKG_CONFIG_VERSION=0.26
ATK_VERSION=2.0.1
PANGO_VERSION=1.29.3
GDK_PIXBUF_VERSION=2.23.4
GTK_VERSION=2.24.5
#
# These are optional. Comment them out if you don't want them.
#
LIBSMI_VERSION=0.4.8
GEOIP_VERSION=1.4.5
#
# libgpg-error is required for libgcrypt.
#
LIBGPG_ERROR_VERSION=1.10
#
# libgcrypt is required for GnuTLS.
# XXX - the link for "Libgcrypt source code" at
# http://www.gnupg.org/download/#libgcrypt is for 1.5.0, and is a bzip2
# file, but http://directory.fsf.org/project/libgcrypt/ lists only
# 1.4.6.
#
LIBGCRYPT_VERSION=1.4.6
GNUTLS_VERSION=2.12.7
LUA_VERSION=5.1.4
PORTAUDIO_VERSION=pa_stable_v19_20110326
#
# XXX - they appear to have an unversioned gzipped tarball for the
# current version; should we just download that, with some other
# way of specifying whether to download the GeoIP API?
#
GEOIP_VERSION=1.4.8
#
# You need Xcode installed to get the compilers.
#
if [ ! -x /usr/bin/xcodebuild ]; then
echo "Please install Xcode first (should be available on DVD)."
exit 1
fi
#
# Do we have permission to write in /usr/local?
#
# If so, assume we have permission to write in its subdirectories.
# (If that's not the case, this test needs to check the subdirectories
# as well.)
#
# If not, do "make install" with sudo.
#
if [ -w /usr/local ]
then
DO_MAKE_INSTALL="make install"
else
DO_MAKE_INSTALL="sudo make install"
fi
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig
#
# Do all the downloads and untarring in a subdirectory, so all that
# stuff can be removed once we've installed the support libraries.
#
if [ ! -d macosx-support-libs ]
then
mkdir macosx-support-libs || exit 1
fi
cd macosx-support-libs
#
# Start with GNU gettext; GLib requires it, and OS X doesn't have it
# or a BSD-licensed replacement.
#
echo "Downloading, building, and installing GNU gettext:"
curl -O http://ftp.gnu.org/pub/gnu/gettext/gettext-$GETTEXT_VERSION.tar.gz || exit 1
tar xf gettext-$GETTEXT_VERSION.tar.gz || exit 1
cd gettext-$GETTEXT_VERSION
./configure || exit 1
make -j 3 || exit 1
$DO_MAKE_INSTALL || exit 1
cd ..
echo "Downloading, building, and installing GLib:"
glib_dir=`expr $GLIB_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
curl -L -O http://ftp.gnome.org/pub/gnome/sources/glib/$glib_dir/glib-$GLIB_VERSION.tar.bz2 || exit 1
bzcat glib-$GLIB_VERSION.tar.bz2 | tar xf - || exit 1
cd glib-$GLIB_VERSION
#
# OS X ships with libffi, but doesn't provide its pkg-config file;
# explicitly specify LIBFFI_CFLAGS and LIBFFI_LIBS, so the configure
# script doesn't try to use pkg-config to get the appropriate
# CFLAGS and LIBS.
#
LIBFFI_CFLAGS="-I/usr/include/ffi" LIBFFI_LIBS="-L/usr/lib" ./configure || exit 1
#
# Mac OS X on 64-bit platforms provides libiconv, but in a form that
# confuses GLib.
#
patch -p1 < ../../macosx-support-lib-patches/glib-gconvert.patch || exit 1
make -j 3 || exit 1
# Apply patch: we depend on libffi, but pkg-config doesn't get told.
patch -p0 <../../macosx-support-lib-patches/glib-pkgconfig.patch || exit 1
$DO_MAKE_INSTALL || exit 1
cd ..
echo "Downloading, building, and installing pkg-config:"
curl -O http://pkgconfig.freedesktop.org/releases/pkg-config-$PKG_CONFIG_VERSION.tar.gz || exit 1
tar xf pkg-config-$PKG_CONFIG_VERSION.tar.gz || exit 1
cd pkg-config-$PKG_CONFIG_VERSION
# Avoid another pkgconfig call
GLIB_CFLAGS="-I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include" GLIB_LIBS="-L/usr/local/lib -lglib-2.0 -lintl" ./configure || exit 1
# ./configure || exit 1
make -j 3 || exit 1
$DO_MAKE_INSTALL || exit 1
cd ..
#
# Now we have reached a point where we can build everything but
# the GUI (Wireshark).
#
#
# Cairo is part of Mac OS X 10.6 (and, I think, 10.5).
# However, it's an X11 library; if we build with "native" GTK+ rather
# than X11 GTK+, we might have to build and install Cairo.
#
# echo "Downloading, building, and installing Cairo:"
# curl -O http://cairographics.org/releases/cairo-1.10.2.tar.gz || exit 1
# tar xvfz cairo-1.10.2.tar.gz || exit 1
# cd cairo-1.10.2
# ./configure --enable-quartz=no || exit 1
# make -j 3 || exit 1
# $DO_MAKE_INSTALL || exit 1
# cd ..
echo "Downloading, building, and installing ATK:"
atk_dir=`expr $ATK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
curl -O http://ftp.gnome.org/pub/gnome/sources/atk/$atk_dir/atk-$ATK_VERSION.tar.bz2 || exit 1
bzcat atk-$ATK_VERSION.tar.bz2 | tar xf - || exit 1
cd atk-$ATK_VERSION
./configure || exit 1
make -j 3 || exit 1
$DO_MAKE_INSTALL || exit 1
cd ..
echo "Downloading, building, and installing Pango:"
pango_dir=`expr $PANGO_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
curl -L -O http://ftp.gnome.org/pub/gnome/sources/pango/$pango_dir/pango-$PANGO_VERSION.tar.bz2
bzcat pango-$PANGO_VERSION.tar.bz2 | tar xf - || exit 1
cd pango-$PANGO_VERSION
./configure || exit 1
make -j 3 || exit 1
$DO_MAKE_INSTALL || exit 1
cd ..
echo "Downloading, building, and installing gdk-pixbuf:"
gdk_pixbuf_dir=`expr $GDK_PIXBUF_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
curl -L -O http://ftp.gnome.org/pub/gnome/sources/gdk-pixbuf/$gdk_pixbuf_dir/gdk-pixbuf-$GDK_PIXBUF_VERSION.tar.bz2 || exit 1
bzcat gdk-pixbuf-$GDK_PIXBUF_VERSION.tar.bz2 | tar xf - || exit 1
cd gdk-pixbuf-$GDK_PIXBUF_VERSION
./configure --without-libtiff --without-libjpeg || exit 1
make -j 3 || exit 1
$DO_MAKE_INSTALL || exit 1
cd ..
echo "Downloading, building, and installing GTK+:"
gtk_dir=`expr $GTK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
curl -L -O http://ftp.gnome.org/pub/gnome/sources/gtk+/$gtk_dir/gtk+-$GTK_VERSION.tar.bz2
bzcat gtk+-$GTK_VERSION.tar.bz2 | tar xf - || exit 1
cd gtk+-$GTK_VERSION
./configure || exit 1
make -j 3 || exit 1
$DO_MAKE_INSTALL || exit 1
cd ..
#
# Now we have reached a point where we can build everything including
# the GUI (Wireshark), but not with any optional features such as
# SNMP OID resolution, some forms of decryption, Lua scripting, playback
# of audio, or GeoIP mapping of IP addresses.
#
# We now conditionally download optional libraries to support them;
# the default is to download them all.
#
if [ ! -z $LIBSMI_VERSION ]
then
echo "Downloading, building, and installing libsmi:"
curl -L -O ftp://ftp.ibr.cs.tu-bs.de/pub/local/libsmi/libsmi-$LIBSMI_VERSION.tar.gz || exit 1
tar xf libsmi-$LIBSMI_VERSION.tar.gz || exit 1
cd libsmi-$LIBSMI_VERSION
./configure || exit 1
make -j 3 || exit 1
$DO_MAKE_INSTALL || exit 1
cd ..
fi
if [ ! -z $LIBGPG_ERROR_VERSION ]
then
echo "Downloading, building, and installing libgpg-error:"
curl -L -O ftp://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-$LIBGPG_ERROR_VERSION.tar.bz2 || exit 1
bzcat libgpg-error-$LIBGPG_ERROR_VERSION.tar.bz2 | tar xf - || exit 1
cd libgpg-error-$LIBGPG_ERROR_VERSION
./configure || exit 1
make -j 3 || exit 1
$DO_MAKE_INSTALL || exit 1
cd ..
fi
if [ ! -z $LIBGCRYPT_VERSION ]
then
#
# libgpg-error is required for libgcrypt.
#
if [ -z $LIBGPG_ERROR_VERSION ]
then
echo "libgcrypt requires libgpg-error, but you didn't install libgpg-error." 1>&2
exit 1
fi
echo "Downloading, building, and installing libgcrypt:"
curl -L -O ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-$LIBGCRYPT_VERSION.tar.gz || exit 1
tar xf libgcrypt-$LIBGCRYPT_VERSION.tar.gz || exit 1
cd libgcrypt-$LIBGCRYPT_VERSION
#
# The assembler language code is not compatible with the OS X
# x86 assembler (or is it an x86-64 vs. x86-32 issue?).
#
./configure --disable-asm || exit 1
make -j 3 || exit 1
$DO_MAKE_INSTALL || exit 1
cd ..
fi
if [ ! -z $GNUTLS_VERSION ]
then
#
# GnuTLS requires libgcrypt (or nettle, in newer versions).
#
if [ -z $LIBGCRYPT_VERSION ]
then
echo "GnuTLS requires libgcrypt, but you didn't install libgcrypt" 1>&2
exit 1
fi
echo "Downloading, building, and installing GnuTLS:"
curl -L -O http://ftp.gnu.org/gnu/gnutls/gnutls-$GNUTLS_VERSION.tar.bz2 || exit 1
bzcat gnutls-$GNUTLS_VERSION.tar.bz2 | tar xf - || exit 1
cd gnutls-$GNUTLS_VERSION
#
# Use libgcrypt, not nettle.
# XXX - is there some reason to prefer nettle? Or does
# Wireshark directly use libgcrypt routines?
#
./configure --with-libgcrypt || exit 1
make -j 3 || exit 1
$DO_MAKE_INSTALL || exit 1
cd ..
fi
if [ ! -z $LUA_VERSION ]
then
echo "Downloading, building, and installing Lua:"
curl -L -O http://www.lua.org/ftp/lua-$LUA_VERSION.tar.gz || exit 1
tar xf lua-$LUA_VERSION.tar.gz || exit 1
cd lua-$LUA_VERSION
make -j 3 macosx || exit 1
$DO_MAKE_INSTALL || exit 1
cd ..
fi
if [ ! -z $PORTAUDIO_VERSION ]
then
echo "Downloading, building, and installing PortAudio:"
curl -L -O http://www.portaudio.com/archives/$PORTAUDIO_VERSION.tgz || exit 1
tar xf $PORTAUDIO_VERSION.tgz || exit 1
cd portaudio
./configure || exit 1
make -j 3 || exit 1
$DO_MAKE_INSTALL || exit 1
cd ..
fi
if [ ! -z $GEOIP_VERSION ]
then
echo "Downloading, building, and installing GeoIP API:"
curl -L -O http://geolite.maxmind.com/download/geoip/api/c/GeoIP-$GEOIP_VERSION.tar.gz || exit 1
tar xf GeoIP-$GEOIP_VERSION.tar.gz || exit 1
cd GeoIP-$GEOIP_VERSION
./configure || exit 1
make -j 3 || exit 1
$DO_MAKE_INSTALL || exit 1
cd ..
fi
echo ""
echo "You are now prepared to build Wireshark. To do so do:"
echo "Download Wireshark source"
echo "./autogen.sh"
echo "./configure"
echo "make -j 3"
echo "make install"
echo ""
echo "Make sure you are allowed capture access to the network devices"
echo "See: http://wiki.wireshark.org/CaptureSetup/CapturePrivileges"
echo ""
exit 0

View File

@ -0,0 +1,10 @@
--- glib-2.29.8/glib/gconvert.c.orig 2011-06-26 14:48:37.000000000 +0200
+++ glib-2.29.8/glib/gconvert.c 2011-06-26 14:49:58.000000000 +0200
@@ -61,7 +61,7 @@
#if defined(USE_LIBICONV_GNU) && !defined (_LIBICONV_H)
#error GNU libiconv in use but included iconv.h not from libiconv
#endif
-#if !defined(USE_LIBICONV_GNU) && defined (_LIBICONV_H)
+#if !(defined(__APPLE__) && defined(__LP64__)) && !defined(USE_LIBICONV_GNU) && defined (_LIBICONV_H)
#error GNU libiconv not in use but included iconv.h is from libiconv
#endif

View File

@ -0,0 +1,10 @@
--- gobject-2.0.pc.orig 2011-06-26 16:07:00.000000000 +0200
+++ gobject-2.0.pc 2011-06-26 16:07:11.000000000 +0200
@@ -7,6 +7,6 @@
Description: GLib Type, Object, Parameter and Signal Library
Requires: glib-2.0,gthread-2.0
Version: 2.29.8
-Libs: -L${libdir} -lgobject-2.0
+Libs: -L${libdir} -lgobject-2.0 -lffi
Libs.private: -L/usr/lib
Cflags: