2 # Setup development environment on Mac OS X (tested with 10.6.8 and Xcode 3.2.6)
6 # Trying to follow "Building Wireshark on SnowLeopard"
7 # given by Michael Tuexen at
8 # http://nplab.fh-muenster.de/groups/wiki/wiki/fb7a4/Building_Wireshark_on_SnowLeopard.html
12 # Versions to download and install.
16 GETTEXT_VERSION=0.18.1.1
19 # pkg-config 0.26 appears to have broken the "we have our own GLib"
20 # stuff, even if you explicitly set GLIB_CFLAGS and GLIB_LIBS.
21 # Life's too short to work around the circular dependency in a script,
22 # so we use 0.25 instead.
24 PKG_CONFIG_VERSION=0.26
27 GDK_PIXBUF_VERSION=2.23.4
31 # These are optional. Comment them out if you don't want them.
36 # libgpg-error is required for libgcrypt.
38 LIBGPG_ERROR_VERSION=1.10
40 # libgcrypt is required for GnuTLS.
41 # XXX - the link for "Libgcrypt source code" at
42 # http://www.gnupg.org/download/#libgcrypt is for 1.5.0, and is a bzip2
43 # file, but http://directory.fsf.org/project/libgcrypt/ lists only
46 LIBGCRYPT_VERSION=1.4.6
49 PORTAUDIO_VERSION=pa_stable_v19_20110326
51 # XXX - they appear to have an unversioned gzipped tarball for the
52 # current version; should we just download that, with some other
53 # way of specifying whether to download the GeoIP API?
58 # You need Xcode installed to get the compilers.
60 if [ ! -x /usr/bin/xcodebuild ]; then
61 echo "Please install Xcode first (should be available on DVD)."
66 # Do we have permission to write in /usr/local?
68 # If so, assume we have permission to write in its subdirectories.
69 # (If that's not the case, this test needs to check the subdirectories
72 # If not, do "make install" with sudo.
76 DO_MAKE_INSTALL="make install"
78 DO_MAKE_INSTALL="sudo make install"
81 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig
84 # Do all the downloads and untarring in a subdirectory, so all that
85 # stuff can be removed once we've installed the support libraries.
87 if [ ! -d macosx-support-libs ]
89 mkdir macosx-support-libs || exit 1
91 cd macosx-support-libs
94 # Start with GNU gettext; GLib requires it, and OS X doesn't have it
95 # or a BSD-licensed replacement.
97 # At least on Lion with Xcode 4, _FORTIFY_SOURCE gets defined as 2
98 # by default, which causes, for example, stpncpy to be defined as
99 # a hairy macro that collides with the GNU gettext configure script's
100 # attempts to workaround AIX's lack of a declaration for stpncpy,
101 # with the result being a huge train wreck. Define _FORTIFY_SOURCE
102 # as 0 in an attempt to keep the trains on separate tracks.
104 echo "Downloading, building, and installing GNU gettext:"
105 curl -O http://ftp.gnu.org/pub/gnu/gettext/gettext-$GETTEXT_VERSION.tar.gz || exit 1
106 tar xf gettext-$GETTEXT_VERSION.tar.gz || exit 1
107 cd gettext-$GETTEXT_VERSION
108 CFLAGS="-D_FORTIFY_SOURCE=0" ./configure || exit 1
110 $DO_MAKE_INSTALL || exit 1
113 echo "Downloading, building, and installing GLib:"
114 glib_dir=`expr $GLIB_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
115 curl -L -O http://ftp.gnome.org/pub/gnome/sources/glib/$glib_dir/glib-$GLIB_VERSION.tar.bz2 || exit 1
116 bzcat glib-$GLIB_VERSION.tar.bz2 | tar xf - || exit 1
117 cd glib-$GLIB_VERSION
119 # OS X ships with libffi, but doesn't provide its pkg-config file;
120 # explicitly specify LIBFFI_CFLAGS and LIBFFI_LIBS, so the configure
121 # script doesn't try to use pkg-config to get the appropriate
124 LIBFFI_CFLAGS="-I/usr/include/ffi" LIBFFI_LIBS="-L/usr/lib" ./configure || exit 1
126 # Mac OS X on 64-bit platforms provides libiconv, but in a form that
129 patch -p1 < ../../macosx-support-lib-patches/glib-gconvert.patch || exit 1
131 # Apply patch: we depend on libffi, but pkg-config doesn't get told.
132 patch -p0 <../../macosx-support-lib-patches/glib-pkgconfig.patch || exit 1
133 $DO_MAKE_INSTALL || exit 1
136 echo "Downloading, building, and installing pkg-config:"
137 curl -O http://pkgconfig.freedesktop.org/releases/pkg-config-$PKG_CONFIG_VERSION.tar.gz || exit 1
138 tar xf pkg-config-$PKG_CONFIG_VERSION.tar.gz || exit 1
139 cd pkg-config-$PKG_CONFIG_VERSION
140 # Avoid another pkgconfig call
141 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
142 # ./configure || exit 1
144 $DO_MAKE_INSTALL || exit 1
148 # Now we have reached a point where we can build everything but
149 # the GUI (Wireshark).
153 # Cairo is part of Mac OS X 10.6 (and, I think, 10.5).
154 # However, it's an X11 library; if we build with "native" GTK+ rather
155 # than X11 GTK+, we might have to build and install Cairo.
157 # echo "Downloading, building, and installing Cairo:"
158 # curl -O http://cairographics.org/releases/cairo-1.10.2.tar.gz || exit 1
159 # tar xvfz cairo-1.10.2.tar.gz || exit 1
161 # ./configure --enable-quartz=no || exit 1
162 # make -j 3 || exit 1
163 # $DO_MAKE_INSTALL || exit 1
166 echo "Downloading, building, and installing ATK:"
167 atk_dir=`expr $ATK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
168 curl -O http://ftp.gnome.org/pub/gnome/sources/atk/$atk_dir/atk-$ATK_VERSION.tar.bz2 || exit 1
169 bzcat atk-$ATK_VERSION.tar.bz2 | tar xf - || exit 1
171 ./configure || exit 1
173 $DO_MAKE_INSTALL || exit 1
176 echo "Downloading, building, and installing Pango:"
177 pango_dir=`expr $PANGO_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
178 curl -L -O http://ftp.gnome.org/pub/gnome/sources/pango/$pango_dir/pango-$PANGO_VERSION.tar.bz2
179 bzcat pango-$PANGO_VERSION.tar.bz2 | tar xf - || exit 1
180 cd pango-$PANGO_VERSION
181 ./configure || exit 1
183 $DO_MAKE_INSTALL || exit 1
186 echo "Downloading, building, and installing gdk-pixbuf:"
187 gdk_pixbuf_dir=`expr $GDK_PIXBUF_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
188 curl -L -O http://ftp.gnome.org/pub/gnome/sources/gdk-pixbuf/$gdk_pixbuf_dir/gdk-pixbuf-$GDK_PIXBUF_VERSION.tar.bz2 || exit 1
189 bzcat gdk-pixbuf-$GDK_PIXBUF_VERSION.tar.bz2 | tar xf - || exit 1
190 cd gdk-pixbuf-$GDK_PIXBUF_VERSION
191 ./configure --without-libtiff --without-libjpeg || exit 1
193 $DO_MAKE_INSTALL || exit 1
196 echo "Downloading, building, and installing GTK+:"
197 gtk_dir=`expr $GTK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
198 curl -L -O http://ftp.gnome.org/pub/gnome/sources/gtk+/$gtk_dir/gtk+-$GTK_VERSION.tar.bz2
199 bzcat gtk+-$GTK_VERSION.tar.bz2 | tar xf - || exit 1
201 ./configure || exit 1
203 $DO_MAKE_INSTALL || exit 1
207 # Now we have reached a point where we can build everything including
208 # the GUI (Wireshark), but not with any optional features such as
209 # SNMP OID resolution, some forms of decryption, Lua scripting, playback
210 # of audio, or GeoIP mapping of IP addresses.
212 # We now conditionally download optional libraries to support them;
213 # the default is to download them all.
216 if [ ! -z $LIBSMI_VERSION ]
218 echo "Downloading, building, and installing libsmi:"
219 curl -L -O ftp://ftp.ibr.cs.tu-bs.de/pub/local/libsmi/libsmi-$LIBSMI_VERSION.tar.gz || exit 1
220 tar xf libsmi-$LIBSMI_VERSION.tar.gz || exit 1
221 cd libsmi-$LIBSMI_VERSION
222 ./configure || exit 1
224 $DO_MAKE_INSTALL || exit 1
228 if [ ! -z $LIBGPG_ERROR_VERSION ]
230 echo "Downloading, building, and installing libgpg-error:"
231 curl -L -O ftp://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-$LIBGPG_ERROR_VERSION.tar.bz2 || exit 1
232 bzcat libgpg-error-$LIBGPG_ERROR_VERSION.tar.bz2 | tar xf - || exit 1
233 cd libgpg-error-$LIBGPG_ERROR_VERSION
234 ./configure || exit 1
236 $DO_MAKE_INSTALL || exit 1
240 if [ ! -z $LIBGCRYPT_VERSION ]
243 # libgpg-error is required for libgcrypt.
245 if [ -z $LIBGPG_ERROR_VERSION ]
247 echo "libgcrypt requires libgpg-error, but you didn't install libgpg-error." 1>&2
251 echo "Downloading, building, and installing libgcrypt:"
252 curl -L -O ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-$LIBGCRYPT_VERSION.tar.gz || exit 1
253 tar xf libgcrypt-$LIBGCRYPT_VERSION.tar.gz || exit 1
254 cd libgcrypt-$LIBGCRYPT_VERSION
256 # The assembler language code is not compatible with the OS X
257 # x86 assembler (or is it an x86-64 vs. x86-32 issue?).
259 ./configure --disable-asm || exit 1
261 $DO_MAKE_INSTALL || exit 1
265 if [ ! -z $GNUTLS_VERSION ]
268 # GnuTLS requires libgcrypt (or nettle, in newer versions).
270 if [ -z $LIBGCRYPT_VERSION ]
272 echo "GnuTLS requires libgcrypt, but you didn't install libgcrypt" 1>&2
276 echo "Downloading, building, and installing GnuTLS:"
277 curl -L -O http://ftp.gnu.org/gnu/gnutls/gnutls-$GNUTLS_VERSION.tar.bz2 || exit 1
278 bzcat gnutls-$GNUTLS_VERSION.tar.bz2 | tar xf - || exit 1
279 cd gnutls-$GNUTLS_VERSION
281 # Use libgcrypt, not nettle.
282 # XXX - is there some reason to prefer nettle? Or does
283 # Wireshark directly use libgcrypt routines?
285 ./configure --with-libgcrypt || exit 1
288 # The pkgconfig file for GnuTLS says "requires zlib", but OS X,
289 # while it supplies zlib, doesn't supply a pkgconfig file for
292 # Patch the GnuTLS pkgconfig file not to require zlib.
294 patch -p0 lib/gnutls.pc <../../macosx-support-lib-patches/gnutls-pkgconfig.patch || exit 1
295 $DO_MAKE_INSTALL || exit 1
299 if [ ! -z $LUA_VERSION ]
301 echo "Downloading, building, and installing Lua:"
302 curl -L -O http://www.lua.org/ftp/lua-$LUA_VERSION.tar.gz || exit 1
303 tar xf lua-$LUA_VERSION.tar.gz || exit 1
305 make -j 3 macosx || exit 1
306 $DO_MAKE_INSTALL || exit 1
310 if [ ! -z $PORTAUDIO_VERSION ]
312 echo "Downloading, building, and installing PortAudio:"
313 curl -L -O http://www.portaudio.com/archives/$PORTAUDIO_VERSION.tgz || exit 1
314 tar xf $PORTAUDIO_VERSION.tgz || exit 1
316 ./configure || exit 1
318 $DO_MAKE_INSTALL || exit 1
322 if [ ! -z $GEOIP_VERSION ]
324 echo "Downloading, building, and installing GeoIP API:"
325 curl -L -O http://geolite.maxmind.com/download/geoip/api/c/GeoIP-$GEOIP_VERSION.tar.gz || exit 1
326 tar xf GeoIP-$GEOIP_VERSION.tar.gz || exit 1
327 cd GeoIP-$GEOIP_VERSION
328 ./configure || exit 1
330 $DO_MAKE_INSTALL || exit 1
336 echo "You are now prepared to build Wireshark. To do so do:"
344 echo "Make sure you are allowed capture access to the network devices"
345 echo "See: http://wiki.wireshark.org/CaptureSetup/CapturePrivileges"