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 # To set up a GTK3 environment
17 # To build all libraries as 32-bit libraries uncomment the following three lines.
18 # export CFLAGS="$CFLAGS -arch i386"
19 # export CXXFLAGS="$CXXFLAGS -arch i386"
20 # export LDFLAGS="$LDFLAGS -arch i386"
24 # Versions to download and install.
26 # The following libraries and tools are required.
28 GETTEXT_VERSION=0.18.2
30 PKG_CONFIG_VERSION=0.28
36 GDK_PIXBUF_VERSION=2.28.0
37 if [ -z "$GTK3" ]; then
44 # Some package need xz to unpack their current source.
45 # xz is not yet provided with OS X.
49 # In case we want to build with cmake
50 CMAKE_VERSION=2.8.10.2
53 # The following libraries are optional.
54 # Comment them out if you don't want them, but note that some of
55 # the optional libraries are required by other optional libraries.
59 # libgpg-error is required for libgcrypt.
61 LIBGPG_ERROR_VERSION=1.10
63 # libgcrypt is required for GnuTLS.
64 # XXX - the link for "Libgcrypt source code" at
65 # http://www.gnupg.org/download/#libgcrypt is for 1.5.0, and is a bzip2
66 # file, but http://directory.fsf.org/project/libgcrypt/ lists only
69 LIBGCRYPT_VERSION=1.5.0
70 GNUTLS_VERSION=2.12.19
71 # Stay with Lua 5.1 when updating until the code has been changed
74 PORTAUDIO_VERSION=pa_stable_v19_20111121
76 # XXX - they appear to have an unversioned gzipped tarball for the
77 # current version; should we just download that, with some other
78 # way of specifying whether to download the GeoIP API?
82 DARWIN_MAJOR_VERSION=`uname -r | sed 's/\([0-9]*\).*/\1/'`
85 # GNU autotools; they're provided with releases up to Snow Leopard, but
86 # not in later releases.
88 if [[ $DARWIN_MAJOR_VERSION -gt 10 ]]; then
90 AUTOMAKE_VERSION=1.13.3
95 if [ -d macosx-support-libs ]
97 cd macosx-support-libs
100 # Uninstall items in the reverse order from the order in which they're
101 # installed. Only uninstall if the download/build/install process
102 # completed; uninstall the version that appears in the name of
105 # We also do a "make distclean", so that we don't have leftovers from
106 # old configurations.
108 installed_geoip_version=`ls geoip-*-done 2>/dev/null | sed 's/geoip-\(.*\)-done/\1/'`
109 if [ ! -z "$installed_geoip_version" ] ; then
110 echo "Uninstalling GeoIP API:"
111 cd GeoIP-$installed_geoip_version
112 $DO_MAKE_UNINSTALL || exit 1
113 make distclean || exit 1
115 rm geoip-$installed_geoip_version-done
118 if [ "$PORTAUDIO_VERSION" -a -f portaudio-done ] ; then
119 echo "Uninstalling PortAudio:"
121 $DO_MAKE_UNINSTALL || exit 1
122 make distclean || exit 1
127 installed_lua_version=`ls lua-*-done 2>/dev/null | sed 's/lua-\(.*\)-done/\1/'`
128 if [ ! -z "$installed_lua_version" ] ; then
129 echo "Uninstalling Lua:"
131 # Lua has no "make uninstall", so just remove stuff manually.
132 # There's no configure script, so there's no need for
133 # "make distclean", either; just do "make clean".
135 (cd /usr/local/bin; $DO_RM -f lua luac)
136 (cd /usr/local/include; $DO_RM -f lua.h luaconf.h lualib.h lauxlib.h lua.hpp)
137 (cd /usr/local/lib; $DO_RM -f liblua.a)
138 (cd /usr/local/man/man1; $DO_RM -f lua.1 luac.1)
139 cd lua-$installed_lua_version
142 rm lua-$installed_lua_version-done
145 installed_gnutls_version=`ls gnutls-*-done 2>/dev/null | sed 's/gnutls-\(.*\)-done/\1/'`
146 if [ ! -z "$installed_gnutls_version" ] ; then
147 echo "Uninstalling GnuTLS:"
148 cd gnutls-$installed_gnutls_version
149 $DO_MAKE_UNINSTALL || exit 1
150 make distclean || exit 1
152 rm gnutls-$installed_gnutls_version-done
155 installed_libgcrypt_version=`ls libgcrypt-*-done 2>/dev/null | sed 's/libgcrypt-\(.*\)-done/\1/'`
156 if [ ! -z "$installed_libgcrypt_version" ] ; then
157 echo "Uninstalling libgcrypt:"
158 cd libgcrypt-$installed_libgcrypt_version
159 $DO_MAKE_UNINSTALL || exit 1
160 make distclean || exit 1
162 rm libgcrypt-$installed_libgcrypt_version-done
165 installed_libgpg_error_version=`ls libgpg-error-*-done 2>/dev/null | sed 's/libgpg-error-\(.*\)-done/\1/'`
166 if [ ! -z "$installed_libgpg_error_version" ] ; then
167 echo "Uninstalling libgpg-error:"
168 cd libgpg-error-$installed_libgpg_error_version
169 $DO_MAKE_UNINSTALL || exit 1
170 make distclean || exit 1
172 rm libgpg-error-$installed_libgpg_error_version-done
175 installed_libsmi_version=`ls libsmi-*-done 2>/dev/null | sed 's/libsmi-\(.*\)-done/\1/'`
176 if [ ! -z "$installed_libsmi_version" ] ; then
177 echo "Uninstalling libsmi:"
178 cd libsmi-$installed_libsmi_version
179 $DO_MAKE_UNINSTALL || exit 1
180 make distclean || exit 1
182 rm libsmi-$installed_libsmi_version-done
185 installed_gtk_version=`ls gtk+-*-done 2>/dev/null | sed 's/gtk+-\(.*\)-done/\1/'`
186 if [ ! -z "$installed_gtk_version" ] ; then
187 echo "Uninstalling GTK+:"
188 cd gtk+-$installed_gtk_version
189 $DO_MAKE_UNINSTALL || exit 1
190 make distclean || exit 1
192 rm gtk+-$installed_gtk_version-done
195 installed_gdk_pixbuf_version=`ls gdk-pixbuf-*-done 2>/dev/null | sed 's/gdk-pixbuf-\(.*\)-done/\1/'`
196 if [ ! -z "$installed_gdk_pixbuf_version" ] ; then
197 echo "Uninstalling gdk-pixbuf:"
198 cd gdk-pixbuf-$installed_gdk_pixbuf_version
199 $DO_MAKE_UNINSTALL || exit 1
200 make distclean || exit 1
202 rm gdk-pixbuf-$installed_gdk_pixbuf_version-done
205 installed_pango_version=`ls pango-*-done 2>/dev/null | sed 's/pango-\(.*\)-done/\1/'`
206 if [ ! -z "$installed_pango_version" ] ; then
207 echo "Uninstalling Pango:"
208 cd pango-$installed_pango_version
209 $DO_MAKE_UNINSTALL || exit 1
210 make distclean || exit 1
212 rm pango-$installed_pango_version-done
215 installed_atk_version=`ls atk-*-done 2>/dev/null | sed 's/atk-\(.*\)-done/\1/'`
216 if [ ! -z "$installed_atk_version" ] ; then
217 echo "Uninstalling ATK:"
218 cd atk-$installed_atk_version
219 $DO_MAKE_UNINSTALL || exit 1
220 make distclean || exit 1
222 rm atk-$installed_atk_version-done
225 installed_cairo_version=`ls cairo-*-done 2>/dev/null | sed 's/cairo-\(.*\)-done/\1/'`
226 if [ ! -z "$installed_cairo_version" ] ; then
227 echo "Uninstalling Cairo:"
228 cd cairo-$installed_cairo_version
229 $DO_MAKE_UNINSTALL || exit 1
230 make distclean || exit 1
232 rm cairo-$installed_cairo_version-done
235 installed_pixman_version=`ls pixman-*-done 2>/dev/null | sed 's/pixman-\(.*\)-done/\1/'`
236 if [ ! -z "$installed_pixman_version" ] ; then
237 echo "Uninstalling pixman:"
238 cd pixman-$installed_pixman_version
239 $DO_MAKE_UNINSTALL || exit 1
240 make distclean || exit 1
242 rm pixman-$installed_pixman_version-done
245 installed_libpng_version=`ls libpng-*-done 2>/dev/null | sed 's/libpng-\(.*\)-done/\1/'`
246 if [ ! -z "$installed_libpng_version" ] ; then
247 echo "Uninstalling libpng:"
248 cd libpng-$installed_libpng_version
249 $DO_MAKE_UNINSTALL || exit 1
250 make distclean || exit 1
252 rm libpng-$installed_libpng_version-done
255 installed_glib_version=`ls glib-*-done 2>/dev/null | sed 's/glib-\(.*\)-done/\1/'`
256 if [ ! -z "$installed_glib_version" ] ; then
257 echo "Uninstalling GLib:"
258 cd glib-$installed_glib_version
259 $DO_MAKE_UNINSTALL || exit 1
260 make distclean || exit 1
262 rm glib-$installed_glib_version-done
265 installed_pkg_config_version=`ls pkg-config-*-done 2>/dev/null | sed 's/pkg-config-\(.*\)-done/\1/'`
266 if [ ! -z "$installed_pkg_config_version" ] ; then
267 echo "Uninstalling pkg-config:"
268 cd pkg-config-$installed_pkg_config_version
269 $DO_MAKE_UNINSTALL || exit 1
270 make distclean || exit 1
272 rm pkg-config-$installed_pkg_config_version-done
275 installed_gettext_version=`ls gettext-*-done 2>/dev/null | sed 's/gettext-\(.*\)-done/\1/'`
276 if [ ! -z "$installed_gettext_version" ] ; then
277 echo "Uninstalling GNU gettext:"
278 cd gettext-$installed_gettext_version
279 $DO_MAKE_UNINSTALL || exit 1
280 make distclean || exit 1
282 rm gettext-$installed_gettext_version-done
285 installed_cmake_version=`ls cmake-*-done 2>/dev/null | sed 's/cmake-\(.*\)-done/\1/'`
286 if [ ! -z "$installed_cmake_version" ]; then
287 echo "Uninstalling CMake:"
288 cd cmake-$installed_cmake_version
289 $DO_MAKE_UNINSTALL || exit 1
290 make distclean || exit 1
292 rm cmake-$installed_cmake_version-done
295 installed_libtool_version=`ls libtool-*-done 2>/dev/null | sed 's/libtool-\(.*\)-done/\1/'`
296 if [ ! -z "$installed_libtool_version" ] ; then
297 echo "Uninstalling GNU libtool:"
298 cd libtool-$installed_libtool_version
299 mv /usr/local/bin/glibtool /usr/local/bin/libtool
300 mv /usr/local/bin/glibtoolize /usr/local/bin/libtoolize
301 $DO_MAKE_UNINSTALL || exit 1
302 make distclean || exit 1
304 rm libtool-$installed_libtool_version-done
307 installed_automake_version=`ls automake-*-done 2>/dev/null | sed 's/automake-\(.*\)-done/\1/'`
308 if [ ! -z "$installed_automake_version" ] ; then
309 echo "Uninstalling GNU automake:"
310 cd automake-$installed_automake_version
311 $DO_MAKE_UNINSTALL || exit 1
312 make distclean || exit 1
314 rm automake-$installed_automake_version-done
317 installed_autoconf_version=`ls autoconf-*-done 2>/dev/null | sed 's/autoconf-\(.*\)-done/\1/'`
318 if [ ! -z "$installed_autoconf_version" ] ; then
319 echo "Uninstalling GNU autoconf:"
320 cd autoconf-$installed_autoconf_version
321 $DO_MAKE_UNINSTALL || exit 1
322 make distclean || exit 1
324 rm autoconf-$installed_autoconf_version-done
327 installed_xz_version=`ls xz-*-done 2>/dev/null | sed 's/xz-\(.*\)-done/\1/'`
328 if [ ! -z "$installed_xz_version" ] ; then
329 echo "Uninstalling xz:"
330 cd xz-$installed_xz_version
331 $DO_MAKE_UNINSTALL || exit 1
332 make distclean || exit 1
334 rm xz-$installed_xz_version-done
340 # Do we have permission to write in /usr/local?
342 # If so, assume we have permission to write in its subdirectories.
343 # (If that's not the case, this test needs to check the subdirectories
346 # If not, do "make install", "make uninstall", and the removes for Lua
351 DO_MAKE_INSTALL="make install"
352 DO_MAKE_UNINSTALL="make uninstall"
355 DO_MAKE_INSTALL="sudo make install"
356 DO_MAKE_UNINSTALL="sudo make uninstall"
361 # The default target OS is the major version of the one we're running;
362 # get that and strip off the third component.
364 min_osx_target=`sw_vers -productVersion | sed 's/\([[0-9]]*\).\([[0-9]]*\).[[0-9]]*/\1.\2/'`
367 # Parse command-line flags:
370 # -t <target> - build libraries so that they'll work on the specified
371 # version of OS X and later versions.
372 # -u - do an uninstall.
374 while getopts ht:u name
381 min_osx_target="$OPTARG"
384 echo "Usage: macosx-setup.sh [ -t <target> ] [ -u ]" 1>&1
390 if [ "$do_uninstall" = "yes" ]
397 # To make this work on Leopard (rather than working *on* Snow Leopard
398 # when building *for* Leopard) will take more work.
400 # For one thing, Leopard's /usr/X11/lib/libXdamage.la claims, at least
401 # with all software updates applied, that the Xdamage shared library
402 # is libXdamage.1.0.0.dylib, but it is, in fact, libXdamage.1.1.0.dylib.
403 # This causes problems when building GTK+, so the script would have to
406 if [[ $DARWIN_MAJOR_VERSION -le 9 ]]; then
407 echo "This script does not support any versions of OS X before Snow Leopard" 1>&2
411 # if no make options are present, set default options
412 if [ -z "$MAKE_BUILD_OPTS" ] ; then
413 # by default use 1.5x number of cores for parallel build
414 MAKE_BUILD_OPTS="-j $(( $(sysctl -n hw.logicalcpu) * 3 / 2))"
418 # Look for the SDK for the target release, and build libraries against
419 # it rather than against the headers and, more importantly,
420 # libraries that come with the OS, so that we don't end up with
421 # support libraries that only work on the OS version on which
422 # we built them, not earlier versions of the same release, or
423 # earlier releases if the minimum is earlier.
425 for i in /Developer/SDKs \
426 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
427 /Library/Developer/CommandLineTools/SDKs
429 if [ -d "$i"/"MacOSX$min_osx_target.sdk" ]
431 SDKPATH="$i"/"MacOSX$min_osx_target.sdk"
438 echo "macosx-setup.sh: Couldn't find the SDK for OS X $min_osx_target" 1>&2
443 # Make sure there are links to /usr/local/include and /usr/local/lib
444 # in the SDK's usr/local.
446 if [ ! -e $SDKPATH/usr/local/include ]
448 if [ ! -d $SDKPATH/usr/local ]
450 sudo mkdir $SDKPATH/usr/local
452 sudo ln -s /usr/local/include $SDKPATH/usr/local/include
454 if [ ! -e $SDKPATH/usr/local/lib ]
456 if [ ! -d $SDKPATH/usr/local ]
458 sudo mkdir $SDKPATH/usr/local
460 sudo ln -s /usr/local/lib $SDKPATH/usr/local/lib
464 # Set the minimum OS version for which to build to the specified
465 # minimum target OS version, so we don't, for example, end up using
466 # linker features supported by the OS verson on which we're building
467 # but not by the target version.
469 VERSION_MIN_FLAGS="-mmacosx-version-min=$min_osx_target"
472 # Compile and link against the SDK.
474 SDKFLAGS="-isysroot $SDKPATH"
476 if [[ "$min_osx_target" == "10.5" ]]
479 # Cairo is part of Mac OS X 10.6 and later.
480 # The *headers* are supplied by 10.5, but the *libraries*
481 # aren't, so we have to build it if we're building for 10.5.
483 cairo_not_in_the_os=yes
486 # Build with older versions of the support libraries, as
487 # were used on the Wireshark Leopard buildbot at one
488 # point. (Most of these versions come from the About page
489 # from Wireshark 1.8.6, the last build done on that buildbot;
490 # the ATK version isn't reported, so this is a guess.)
492 # If you want to try building with newer versions of
493 # the libraries, note that:
495 # The version of fontconfig that comes with Leopard doesn't
496 # support FC_WEIGHT_EXTRABLACK, so we can't use any version
497 # of Pango newer than 1.22.4.
499 # However, Pango 1.22.4 doesn't work with versions of GLib
500 # after 2.29.6, because Pango 1.22.4 uses G_CONST_RETURN and
501 # GLib 2.29.8 and later deprecate it (there doesn't appear to
502 # be a GLib 2.29.7). That means we'd either have to patch
503 # Pango not to use it (just use "const"; G_CONST_RETURN was
504 # there to allow code to choose whether to use "const" or not),
505 # or use GLib 2.29.6 or earlier.
507 # GLib 2.29.6 includes an implementation of g_bit_lock() that,
508 # on x86 (32-bit and 64-bit), uses asms in a fashion
509 # ("asm volatile goto") that requires GCC 4.5 or later, which
510 # is later than the compilers that come with Leopard and Snow
511 # Leopard. Recent versions of GLib check for that, but 2.29.6
512 # doesn't, so, if you want to build GLib 2.29.6 on Leopard or
513 # Snow Leopard, you would have to patch glib/gbitlock.c to do
514 # what the newer versions of GLib do:
516 # define a USE_ASM_GOTO macro that indicates whether "asm goto"
518 # #if (defined (i386) || defined (__amd64__))
519 # #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
520 # #define USE_ASM_GOTO 1
524 # replace all occurrences of
526 # #if defined (__GNUC__) && (defined (i386) || defined (__amd64__))
530 # #ifdef USE_ASM_GOTO
532 # Using GLib 2.29.6 or earlier, however, means that we can't
533 # use a version of ATK later than 2.3.93, as those versions
534 # don't work with GLib 2.29.6. The same applies to gdk-pixbuf;
535 # versions of gdk-pixbuf after 2.24.1 won't work with GLib
538 # Then you have to make sure that what you've build doesn't
539 # cause the X server that comes with Leopard to crash; at
540 # least one attempt at building for Leopard did.
542 # At least if building on Leopard, you might also find
543 # that, with various older versions of Cairo, including
544 # 1.6.4 and at least some 1.8.x versions, when you try to
545 # build it, the build fails because it can't find
546 # png_set_longjmp_fn(). I vaguely remember dealing with that,
547 # ages ago, but don't remember what I did.
556 # That version of GTK+ includes gdk-pixbuf.
557 # XXX - base this on the version of GTK+ requested.
562 # Libgcrypt 1.5.0 fails to compile due to some problem with an
563 # asm in rijndael.c, at least with i686-apple-darwin10-gcc-4.2.1
564 # (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) when building
567 # We try libgcrypt 1.4.3 instead, as that's what shows up in
568 # the version from the Leopard buildbot.
569 LIBGCRYPT_VERSION=1.4.3
572 # Build 32-bit while we're at it; Leopard has a bug that
573 # causes some BPF functions not to work with 64-bit userland
574 # code, so capturing won't work.
576 export CFLAGS="$CFLAGS -arch i386"
577 export CXXFLAGS="$CXXFLAGS -arch i386"
578 export LDFLAGS="$LDFLAGS -arch i386"
582 # You need Xcode installed to get the compilers.
584 if [ ! -x /usr/bin/xcodebuild ]; then
585 echo "Please install Xcode first (should be available on DVD or from http://developer.apple.com/xcode/index.php)."
590 # You also need the X11 SDK; with at least some versions of OS X and
591 # Xcode, that is, I think, an optional install. (Or it might be
592 # installed with X11, but I think *that* is an optional install on
593 # at least some versions of OS X.)
595 if [ ! -d /usr/X11/include ]; then
596 echo "Please install X11 and the X11 SDK first."
600 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig
603 # Do all the downloads and untarring in a subdirectory, so all that
604 # stuff can be removed once we've installed the support libraries.
606 if [ ! -d macosx-support-libs ]
608 mkdir macosx-support-libs || exit 1
610 cd macosx-support-libs
612 # Start with xz: It is the sole download format of glib later than 2.31.2
614 if [ "$XZ_VERSION" -a ! -f xz-$XZ_VERSION-done ] ; then
615 echo "Downloading, building, and installing xz:"
616 [ -f xz-$XZ_VERSION.tar.bz2 ] || curl -O http://tukaani.org/xz/xz-$XZ_VERSION.tar.bz2 || exit 1
617 bzcat xz-$XZ_VERSION.tar.bz2 | tar xf - || exit 1
619 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0" ./configure || exit 1
620 make $MAKE_BUILD_OPTS || exit 1
621 $DO_MAKE_INSTALL || exit 1
623 touch xz-$XZ_VERSION-done
626 if [ "$AUTOCONF_VERSION" -a ! -f autoconf-$AUTOCONF_VERSION-done ] ; then
627 echo "Downloading, building and installing GNU autoconf..."
628 [ -f autoconf-$AUTOCONF_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/autoconf/autoconf-$AUTOCONF_VERSION.tar.xz || exit 1
629 xzcat autoconf-$AUTOCONF_VERSION.tar.xz | tar xf - || exit 1
630 cd autoconf-$AUTOCONF_VERSION
631 ./configure || exit 1
632 make $MAKE_BUILD_OPTS || exit 1
633 $DO_MAKE_INSTALL || exit 1
635 touch autoconf-$AUTOCONF_VERSION-done
638 if [ "$AUTOMAKE_VERSION" -a ! -f automake-$AUTOMAKE_VERSION-done ] ; then
639 echo "Downloading, building and installing GNU automake..."
640 [ -f automake-$AUTOMAKE_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/automake/automake-$AUTOMAKE_VERSION.tar.xz || exit 1
641 xzcat automake-$AUTOMAKE_VERSION.tar.xz | tar xf - || exit 1
642 cd automake-$AUTOMAKE_VERSION
643 ./configure || exit 1
644 make $MAKE_BUILD_OPTS || exit 1
645 $DO_MAKE_INSTALL || exit 1
647 touch automake-$AUTOMAKE_VERSION-done
650 if [ "$LIBTOOL_VERSION" -a ! -f libtool-$LIBTOOL_VERSION-done ] ; then
651 echo "Downloading, building and installing GNU libtool..."
652 [ -f libtool-$LIBTOOL_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/libtool/libtool-$LIBTOOL_VERSION.tar.xz || exit 1
653 xzcat libtool-$LIBTOOL_VERSION.tar.xz | tar xf - || exit 1
654 cd libtool-$LIBTOOL_VERSION
655 ./configure || exit 1
656 make $MAKE_BUILD_OPTS || exit 1
657 $DO_MAKE_INSTALL || exit 1
658 mv /usr/local/bin/libtool /usr/local/bin/glibtool
659 mv /usr/local/bin/libtoolize /usr/local/bin/glibtoolize
661 touch libtool-$LIBTOOL_VERSION-done
664 if [ -n "$CMAKE" -a ! -f cmake-$CMAKE_VERSION-done ]; then
665 echo "Downloading, building, and installing CMAKE:"
666 cmake_dir=`expr $CMAKE_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
667 [ -f cmake-$CMAKE_VERSION.tar.gz ] || curl -O http://www.cmake.org/files/v$cmake_dir/cmake-$CMAKE_VERSION.tar.gz || exit 1
668 gzcat cmake-$CMAKE_VERSION.tar.gz | tar xf - || exit 1
669 cd cmake-$CMAKE_VERSION
670 ./bootstrap || exit 1
671 make $MAKE_BUILD_OPTS || exit 1
672 $DO_MAKE_INSTALL || exit 1
674 touch cmake-$CMAKE_VERSION-done
678 # Start with GNU gettext; GLib requires it, and OS X doesn't have it
679 # or a BSD-licensed replacement.
681 # At least on Lion with Xcode 4, _FORTIFY_SOURCE gets defined as 2
682 # by default, which causes, for example, stpncpy to be defined as
683 # a hairy macro that collides with the GNU gettext configure script's
684 # attempts to workaround AIX's lack of a declaration for stpncpy,
685 # with the result being a huge train wreck. Define _FORTIFY_SOURCE
686 # as 0 in an attempt to keep the trains on separate tracks.
688 if [ ! -f gettext-$GETTEXT_VERSION-done ] ; then
689 echo "Downloading, building, and installing GNU gettext:"
690 [ -f gettext-$GETTEXT_VERSION.tar.gz ] || curl -O http://ftp.gnu.org/pub/gnu/gettext/gettext-$GETTEXT_VERSION.tar.gz || exit 1
691 gzcat gettext-$GETTEXT_VERSION.tar.gz | tar xf - || exit 1
692 cd gettext-$GETTEXT_VERSION
693 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0 $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
694 make $MAKE_BUILD_OPTS || exit 1
695 $DO_MAKE_INSTALL || exit 1
697 touch gettext-$GETTEXT_VERSION-done
701 # GLib depends on pkg-config.
702 # By default, pkg-config depends on GLib; we break the dependency cycle
703 # by configuring pkg-config to use its own internal version of GLib.
705 if [ ! -f pkg-config-$PKG_CONFIG_VERSION-done ] ; then
706 echo "Downloading, building, and installing pkg-config:"
707 [ -f pkg-config-$PKG_CONFIG_VERSION.tar.gz ] || curl -O http://pkgconfig.freedesktop.org/releases/pkg-config-$PKG_CONFIG_VERSION.tar.gz || exit 1
708 gzcat pkg-config-$PKG_CONFIG_VERSION.tar.gz | tar xf - || exit 1
709 cd pkg-config-$PKG_CONFIG_VERSION
710 ./configure --with-internal-glib || exit 1
711 make $MAKE_BUILD_OPTS || exit 1
712 $DO_MAKE_INSTALL || exit 1
714 touch pkg-config-$PKG_CONFIG_VERSION-done
717 if [ ! -f glib-$GLIB_VERSION-done ] ; then
718 echo "Downloading, building, and installing GLib:"
719 glib_dir=`expr $GLIB_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
720 GLIB_MAJOR_VERSION="`expr $GLIB_VERSION : '\([0-9][0-9]*\).*'`"
721 GLIB_MINOR_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
722 GLIB_DOTDOT_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
723 if [[ $GLIB_MAJOR_VERSION -gt 2 ||
724 $GLIB_MINOR_VERSION -gt 28 ||
725 ($GLIB_MINOR_VERSION -eq 28 && $GLIB_DOTDOT_VERSION -ge 8) ]]
728 # Starting with GLib 2.28.8, xz-compressed tarballs are available.
730 [ -f glib-$GLIB_VERSION.tar.xz ] || curl -L -O http://ftp.gnome.org/pub/gnome/sources/glib/$glib_dir/glib-$GLIB_VERSION.tar.xz || exit 1
731 xzcat glib-$GLIB_VERSION.tar.xz | tar xf - || exit 1
733 [ -f glib-$GLIB_VERSION.tar.bz2 ] || curl -L -O http://ftp.gnome.org/pub/gnome/sources/glib/$glib_dir/glib-$GLIB_VERSION.tar.bz2 || exit 1
734 bzcat glib-$GLIB_VERSION.tar.bz2 | tar xf - || exit 1
736 cd glib-$GLIB_VERSION
738 # OS X ships with libffi, but doesn't provide its pkg-config file;
739 # explicitly specify LIBFFI_CFLAGS and LIBFFI_LIBS, so the configure
740 # script doesn't try to use pkg-config to get the appropriate
741 # C flags and loader flags.
743 # And, what's worse, at least with the version of Xcode that comes
744 # with Leopard, /usr/include/ffi/fficonfig.h doesn't define MACOSX,
745 # which causes the build of GLib to fail. If we don't find
746 # "#define.*MACOSX" in /usr/include/ffi/fficonfig.h, explictly
749 # While we're at it, suppress -Wformat-nonliteral to avoid a case
750 # where clang's stricter rules on when not to complain about
751 # non-literal format arguments cause it to complain about code
752 # that's safe but it wasn't told that. See my comment #25 in
755 # https://bugzilla.gnome.org/show_bug.cgi?id=691608#c25
757 # First, determine where the system include files are. (It's not
758 # necessarily /usr/include.) There's a bit of a greasy hack here;
759 # pre-5.x versions of the developer tools don't support the
760 # --show-sdk-path option, and will produce no output, so includedir
761 # will be set to /usr/include (in those older versions of the
762 # developer tools, there is a /usr/include directory).
764 includedir=`xcrun --show-sdk-path 2>/dev/null`/usr/include
765 if grep -qs '#define.*MACOSX' $includedir/ffi/fficonfig.h
767 # It's defined, nothing to do
768 LIBFFI_CFLAGS="-I $includedir/ffi" LIBFFI_LIBS="-lffi" CFLAGS="$CFLAGS -Wno-format-nonliteral $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
770 LIBFFI_CFLAGS="-I $includedir/ffi" LIBFFI_LIBS="-lffi" CFLAGS="$CFLAGS -DMACOSX -Wno-format-nonliteral $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
774 # Apply the fix to GNOME bug 529806:
776 # https://bugzilla.gnome.org/show_bug.cgi?id=529806
778 # if we have a version of GLib prior to 2.30.
780 if [[ $GLIB_MAJOR_VERSION -eq 2 && $GLIB_MINOR_VERSION -le 30 ]]
782 patch -p0 <../../macosx-support-lib-patches/glib-gconvert.c.patch || exit 1
784 make $MAKE_BUILD_OPTS || exit 1
785 $DO_MAKE_INSTALL || exit 1
787 touch glib-$GLIB_VERSION-done
791 # Now we have reached a point where we can build everything but
792 # the GUI (Wireshark).
794 # GTK+ 3 requires a newer Cairo build than the one that comes with
795 # 10.6, so we build Cairo if we are using GTK+ 3.
797 # In 10.6 and 10.7, it's an X11 library; if we build with "native" GTK+
798 # rather than X11 GTK+, we might have to build and install Cairo.
799 # In 10.8 and later, there is no X11, but it's included in Xquartz;
800 # again, if we build with "native" GTK+, we'd have to build and install
803 if [[ -n "$GTK3" || "$cairo_not_in_the_os" = yes ]]; then
805 # Requirements for Cairo first
807 # The libpng that comes with the X11 for leopard has a bogus
808 # pkg-config file that lies about where the header files are,
809 # which causes other packages not to be able to find its
812 # if [ ! -f libpng-$PNG_VERSION-done ] ; then
813 # echo "Downloading, building, and installing libpng:"
815 # # The FTP site puts libpng x.y.* into a libpngxy directory.
817 # subdir=`echo $PNG_VERSION | sed 's/\([1-9][0-9]*\)\.\([1-9][0-9]*\).*/libpng\1\2'/`
818 # [ -f libpng-$PNG_VERSION.tar.xz ] || curl -O ftp://ftp.simplesystems.org/pub/libpng/png/src/$subdir/libpng-$PNG_VERSION.tar.xz
819 # xzcat libpng-$PNG_VERSION.tar.xz | tar xf - || exit 1
820 # cd libpng-$PNG_VERSION
821 # CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
822 # make $MAKE_BUILD_OPTS || exit 1
823 # $DO_MAKE_INSTALL || exit 1
825 # touch libpng-$PNG_VERSION-done
829 # The libpixman that comes with the X11 for Leopard is too old
830 # to support Cairo's image surface backend feature (which requires
831 # pixman-1 >= 0.22.0).
833 # if [ ! -f pixman-$PIXMAN_VERSION-done ] ; then
834 # echo "Downloading, building, and installing pixman:"
835 # [ -f pixman-$PIXMAN_VERSION.tar.gz ] || curl -O http://www.cairographics.org/releases/pixman-$PIXMAN_VERSION.tar.gz
836 # gzcat pixman-$PIXMAN_VERSION.tar.gz | tar xf - || exit 1
837 # cd pixman-$PIXMAN_VERSION
838 # CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
839 # make $MAKE_BUILD_OPTS || exit 1
840 # $DO_MAKE_INSTALL || exit 1
842 # touch pixman-$PIXMAN_VERSION-done
846 # And now Cairo itself.
848 if [ ! -f cairo-$CAIRO_VERSION-done ] ; then
849 echo "Downloading, building, and installing Cairo:"
850 CAIRO_MAJOR_VERSION="`expr $CAIRO_VERSION : '\([0-9][0-9]*\).*'`"
851 CAIRO_MINOR_VERSION="`expr $CAIRO_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
852 CAIRO_DOTDOT_VERSION="`expr $CAIRO_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
853 if [[ $CAIRO_MAJOR_VERSION -gt 1 ||
854 $CAIRO_MINOR_VERSION -gt 12 ||
855 ($CAIRO_MINOR_VERSION -eq 12 && $CAIRO_DOTDOT_VERSION -ge 2) ]]
858 # Starting with Cairo 1.12.2, the tarballs are compressed with
859 # xz rather than gzip.
861 [ -f cairo-$CAIRO_VERSION.tar.xz ] || curl -O http://cairographics.org/releases/cairo-$CAIRO_VERSION.tar.xz || exit 1
862 xzcat cairo-$CAIRO_VERSION.tar.xz | tar xf - || exit 1
864 [ -f cairo-$CAIRO_VERSION.tar.gz ] || curl -O http://cairographics.org/releases/cairo-$CAIRO_VERSION.tar.gz || exit 1
865 gzcat cairo-$CAIRO_VERSION.tar.gz | tar xf - || exit 1
867 cd cairo-$CAIRO_VERSION
868 # CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-quartz=no || exit 1
869 # Maybe follow http://cairographics.org/end_to_end_build_for_mac_os_x/
870 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-quartz=yes || exit 1
872 # We must avoid the version of libpng that comes with X11; the
873 # only way I've found to force that is to forcibly set INCLUDES
874 # when we do the build, so that this comes before CAIRO_CFLAGS,
875 # which has -I/usr/X11/include added to it before anything
876 # connected to libpng is.
878 INCLUDES="-I/usr/local/include/libpng15" make $MAKE_BUILD_OPTS || exit 1
879 $DO_MAKE_INSTALL || exit 1
881 touch cairo-$CAIRO_VERSION-done
885 if [ ! -f atk-$ATK_VERSION-done ] ; then
886 echo "Downloading, building, and installing ATK:"
887 atk_dir=`expr $ATK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
888 ATK_MAJOR_VERSION="`expr $ATK_VERSION : '\([0-9][0-9]*\).*'`"
889 ATK_MINOR_VERSION="`expr $ATK_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
890 ATK_DOTDOT_VERSION="`expr $ATK_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
891 if [[ $ATK_MAJOR_VERSION -gt 2 ||
892 ($ATK_MAJOR_VERSION -eq 2 && $ATK_MINOR_VERSION -gt 0) ||
893 ($ATK_MANOR_VERSION -eq 2 && $ATK_MINOR_VERSION -eq 0 && $ATK_DOTDOT_VERSION -ge 1) ]]
896 # Starting with ATK 2.0.1, xz-compressed tarballs are available.
898 [ -f atk-$ATK_VERSION.tar.xz ] || curl -O http://ftp.gnome.org/pub/gnome/sources/atk/$atk_dir/atk-$ATK_VERSION.tar.xz || exit 1
899 xzcat atk-$ATK_VERSION.tar.xz | tar xf - || exit 1
901 [ -f atk-$ATK_VERSION.tar.bz2 ] || curl -O http://ftp.gnome.org/pub/gnome/sources/atk/$atk_dir/atk-$ATK_VERSION.tar.bz2 || exit 1
902 bzcat atk-$ATK_VERSION.tar.bz2 | tar xf - || exit 1
905 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
906 make $MAKE_BUILD_OPTS || exit 1
907 $DO_MAKE_INSTALL || exit 1
909 touch atk-$ATK_VERSION-done
912 if [ ! -f pango-$PANGO_VERSION-done ] ; then
913 echo "Downloading, building, and installing Pango:"
914 pango_dir=`expr $PANGO_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
915 PANGO_MAJOR_VERSION="`expr $PANGO_VERSION : '\([0-9][0-9]*\).*'`"
916 PANGO_MINOR_VERSION="`expr $PANGO_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
917 if [[ $PANGO_MAJOR_VERSION -gt 1 ||
918 $PANGO_MINOR_VERSION -ge 29 ]]
921 # Starting with Pango 1.29, the tarballs are compressed with
922 # xz rather than bzip2.
924 [ -f pango-$PANGO_VERSION.tar.xz ] || curl -L -O http://ftp.gnome.org/pub/gnome/sources/pango/$pango_dir/pango-$PANGO_VERSION.tar.xz || exit 1
925 xzcat pango-$PANGO_VERSION.tar.xz | tar xf - || exit 1
927 [ -f pango-$PANGO_VERSION.tar.bz2 ] || curl -L -O http://ftp.gnome.org/pub/gnome/sources/pango/$pango_dir/pango-$PANGO_VERSION.tar.bz2 || exit 1
928 bzcat pango-$PANGO_VERSION.tar.bz2 | tar xf - || exit 1
930 cd pango-$PANGO_VERSION
931 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
932 make $MAKE_BUILD_OPTS || exit 1
933 $DO_MAKE_INSTALL || exit 1
935 touch pango-$PANGO_VERSION-done
938 if [ "$GDK_PIXBUF_VERSION" -a ! -f gdk-pixbuf-$GDK_PIXBUF_VERSION-done ] ; then
939 echo "Downloading, building, and installing gdk-pixbuf:"
940 gdk_pixbuf_dir=`expr $GDK_PIXBUF_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
941 [ -f gdk-pixbuf-$GDK_PIXBUF_VERSION.tar.xz ] || curl -L -O http://ftp.gnome.org/pub/gnome/sources/gdk-pixbuf/$gdk_pixbuf_dir/gdk-pixbuf-$GDK_PIXBUF_VERSION.tar.xz || exit 1
942 xzcat gdk-pixbuf-$GDK_PIXBUF_VERSION.tar.xz | tar xf - || exit 1
943 cd gdk-pixbuf-$GDK_PIXBUF_VERSION
945 # If we're building for 10.6, use libpng12; if you have 10.7.5, including
946 # X11, and Xcode 4.3.3, the system has libpng15, complete with pkg-config
947 # files, as part of X11, but 10.6's X11 has only libpng12, and the 10.6
948 # SDK in Xcode 4.3.3 also has only libpng12, and has no pkg-config files
949 # of its own, so we have to explicitly set LIBPNG to override the
950 # configure script, and also force the CFLAGS to look for the header
951 # files for libpng12 (note that -isysroot doesn't affect the arguments
952 # to -I, so we need to include the SDK path explicitly).
954 if [[ "$min_osx_target" = 10.6 ]]
956 LIBPNG="-L/usr/X11/lib -lpng12" CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS -I$SDKPATH/usr/X11/include/libpng12" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --without-libtiff --without-libjpeg || exit 1
958 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --without-libtiff --without-libjpeg || exit 1
960 make $MAKE_BUILD_OPTS || exit 1
961 $DO_MAKE_INSTALL || exit 1
963 touch gdk-pixbuf-$GDK_PIXBUF_VERSION-done
966 if [ ! -f gtk+-$GTK_VERSION-done ] ; then
967 echo "Downloading, building, and installing GTK+:"
968 gtk_dir=`expr $GTK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
969 GTK_MAJOR_VERSION="`expr $GTK_VERSION : '\([0-9][0-9]*\).*'`"
970 GTK_MINOR_VERSION="`expr $GTK_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
971 GTK_DOTDOT_VERSION="`expr $GTK_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
972 if [[ $GTK_MAJOR_VERSION -gt 2 ||
973 $GTK_MINOR_VERSION -gt 24 ||
974 ($GTK_MINOR_VERSION -eq 24 && $GTK_DOTDOT_VERSION -ge 5) ]]
977 # Starting with GTK+ 2.24.5, the tarballs are compressed with
978 # xz rather than gzip, in addition to bzip2; use xz, as we've
979 # built and installed it, and as xz compresses better than
980 # bzip2 so the tarballs take less time to download.
982 [ -f gtk+-$GTK_VERSION.tar.xz ] || curl -L -O http://ftp.gnome.org/pub/gnome/sources/gtk+/$gtk_dir/gtk+-$GTK_VERSION.tar.xz || exit 1
983 xzcat gtk+-$GTK_VERSION.tar.xz | tar xf - || exit 1
985 [ -f gtk+-$GTK_VERSION.tar.bz2 ] || curl -L -O http://ftp.gnome.org/pub/gnome/sources/gtk+/$gtk_dir/gtk+-$GTK_VERSION.tar.bz2 || exit 1
986 bzcat gtk+-$GTK_VERSION.tar.bz2 | tar xf - || exit 1
989 if [ $DARWIN_MAJOR_VERSION -ge "12" ]
992 # GTK+ 2.24.10, at least, doesn't build on Mountain Lion with the
993 # CUPS printing backend - either the CUPS API changed incompatibly
994 # or the backend was depending on non-API implementation details.
996 # Configure it out, on Mountain Lion and later, for now.
997 # (12 is the Darwin major version number in Mountain Lion.)
999 # Also, configure out libtiff and libjpeg; configure scripts
1000 # just ignore unknown --enable/--disable and --with/--without
1001 # options (at least they've always do so up to now).
1003 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --disable-cups --without-libtiff --without-libjpeg || exit 1
1005 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --without-libtiff --without-libjpeg || exit 1
1007 make $MAKE_BUILD_OPTS || exit 1
1008 $DO_MAKE_INSTALL || exit 1
1010 touch gtk+-$GTK_VERSION-done
1014 # Now we have reached a point where we can build everything including
1015 # the GUI (Wireshark), but not with any optional features such as
1016 # SNMP OID resolution, some forms of decryption, Lua scripting, playback
1017 # of audio, or GeoIP mapping of IP addresses.
1019 # We now conditionally download optional libraries to support them;
1020 # the default is to download them all.
1023 if [ "$LIBSMI_VERSION" -a ! -f libsmi-$LIBSMI_VERSION-done ] ; then
1024 echo "Downloading, building, and installing libsmi:"
1025 [ -f libsmi-$LIBSMI_VERSION.tar.gz ] || curl -L -O ftp://ftp.ibr.cs.tu-bs.de/pub/local/libsmi/libsmi-$LIBSMI_VERSION.tar.gz || exit 1
1026 gzcat libsmi-$LIBSMI_VERSION.tar.gz | tar xf - || exit 1
1027 cd libsmi-$LIBSMI_VERSION
1028 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1029 make $MAKE_BUILD_OPTS || exit 1
1030 $DO_MAKE_INSTALL || exit 1
1032 touch libsmi-$LIBSMI_VERSION-done
1035 if [ "$LIBGPG_ERROR_VERSION" -a ! -f libgpg-error-$LIBGPG_ERROR_VERSION-done ] ; then
1036 echo "Downloading, building, and installing libgpg-error:"
1037 [ -f libgpg-error-$LIBGPG_ERROR_VERSION.tar.bz2 ] || curl -L -O ftp://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-$LIBGPG_ERROR_VERSION.tar.bz2 || exit 1
1038 bzcat libgpg-error-$LIBGPG_ERROR_VERSION.tar.bz2 | tar xf - || exit 1
1039 cd libgpg-error-$LIBGPG_ERROR_VERSION
1040 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1041 make $MAKE_BUILD_OPTS || exit 1
1042 $DO_MAKE_INSTALL || exit 1
1044 touch libgpg-error-$LIBGPG_ERROR_VERSION-done
1047 if [ "$LIBGCRYPT_VERSION" -a ! -f libgcrypt-$LIBGCRYPT_VERSION-done ] ; then
1049 # libgpg-error is required for libgcrypt.
1051 if [ -z $LIBGPG_ERROR_VERSION ]
1053 echo "libgcrypt requires libgpg-error, but you didn't install libgpg-error." 1>&2
1057 echo "Downloading, building, and installing libgcrypt:"
1058 [ -f libgcrypt-$LIBGCRYPT_VERSION.tar.gz ] || curl -L -O ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-$LIBGCRYPT_VERSION.tar.gz || exit 1
1059 gzcat libgcrypt-$LIBGCRYPT_VERSION.tar.gz | tar xf - || exit 1
1060 cd libgcrypt-$LIBGCRYPT_VERSION
1062 # The assembler language code is not compatible with the OS X
1063 # x86 assembler (or is it an x86-64 vs. x86-32 issue?).
1065 # libgcrypt expects gnu89, not c99/gnu99, semantics for
1066 # "inline". See, for example:
1068 # http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2010-October/198809.html
1070 CFLAGS="$CFLAGS -std=gnu89 $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --disable-asm || exit 1
1071 make $MAKE_BUILD_OPTS || exit 1
1072 $DO_MAKE_INSTALL || exit 1
1074 touch libgcrypt-$LIBGCRYPT_VERSION-done
1077 if [ "$GNUTLS_VERSION" -a ! -f gnutls-$GNUTLS_VERSION-done ] ; then
1079 # GnuTLS requires libgcrypt (or nettle, in newer versions).
1081 if [ -z $LIBGCRYPT_VERSION ]
1083 echo "GnuTLS requires libgcrypt, but you didn't install libgcrypt" 1>&2
1087 echo "Downloading, building, and installing GnuTLS:"
1088 [ -f gnutls-$GNUTLS_VERSION.tar.bz2 ] || curl -L -O http://ftp.gnu.org/gnu/gnutls/gnutls-$GNUTLS_VERSION.tar.bz2 || exit 1
1089 bzcat gnutls-$GNUTLS_VERSION.tar.bz2 | tar xf - || exit 1
1090 cd gnutls-$GNUTLS_VERSION
1092 # Use libgcrypt, not nettle.
1093 # XXX - is there some reason to prefer nettle? Or does
1094 # Wireshark directly use libgcrypt routines?
1096 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --with-libgcrypt --without-p11-kit || exit 1
1097 make $MAKE_BUILD_OPTS || exit 1
1099 # The pkgconfig file for GnuTLS says "requires zlib", but OS X,
1100 # while it supplies zlib, doesn't supply a pkgconfig file for
1103 # Patch the GnuTLS pkgconfig file not to require zlib.
1104 # (If the capabilities of GnuTLS that Wireshark uses don't
1105 # depend on building GnuTLS with zlib, an alternative would be
1106 # to configure it not to use zlib.)
1108 patch -p0 lib/gnutls.pc.in <../../macosx-support-lib-patches/gnutls-pkgconfig.patch || exit 1
1109 $DO_MAKE_INSTALL || exit 1
1111 touch gnutls-$GNUTLS_VERSION-done
1114 if [ "$LUA_VERSION" -a ! -f lua-$LUA_VERSION-done ] ; then
1115 echo "Downloading, building, and installing Lua:"
1116 [ -f lua-$LUA_VERSION.tar.gz ] || curl -L -O http://www.lua.org/ftp/lua-$LUA_VERSION.tar.gz || exit 1
1117 gzcat lua-$LUA_VERSION.tar.gz | tar xf - || exit 1
1119 make $MAKE_BUILD_OPTS macosx || exit 1
1120 $DO_MAKE_INSTALL || exit 1
1122 touch lua-$LUA_VERSION-done
1125 if [ "$PORTAUDIO_VERSION" -a ! -f portaudio-done ] ; then
1126 echo "Downloading, building, and installing PortAudio:"
1127 [ -f $PORTAUDIO_VERSION.tgz ] || curl -L -O http://www.portaudio.com/archives/$PORTAUDIO_VERSION.tgz || exit 1
1128 gzcat $PORTAUDIO_VERSION.tgz | tar xf - || exit 1
1131 # Un-comment an include that's required on Lion.
1133 patch -p0 include/pa_mac_core.h <../../macosx-support-lib-patches/portaudio-pa_mac_core.h.patch
1135 # Fix a bug that showed up with clang (but is a bug with any
1138 patch -p0 src/hostapi/coreaudio/pa_mac_core.c <../../macosx-support-lib-patches/portaudio-pa_mac_core.c.patch
1140 # Disable fat builds - the configure script doesn't work right
1141 # with Xcode 4 if you leave them enabled, and we don't build
1142 # any other libraries fat (GLib, for example, would be very
1143 # hard to build fat), so there's no advantage to having PortAudio
1146 # Set the minimum OS X version to 10.4, to suppress some
1147 # deprecation warnings. (Good luck trying to make any of
1148 # this build on an OS+Xcode with a pre-10.4 SDK; we don't
1149 # worry about the user requesting that.)
1151 CFLAGS="$CFLAGS -mmacosx-version-min=10.4 $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --disable-mac-universal || exit 1
1152 make $MAKE_BUILD_OPTS || exit 1
1153 $DO_MAKE_INSTALL || exit 1
1155 touch portaudio-done
1158 if [ "$GEOIP_VERSION" -a ! -f geoip-$GEOIP_VERSION-done ]
1160 echo "Downloading, building, and installing GeoIP API:"
1161 [ -f GeoIP-$GEOIP_VERSION.tar.gz ] || curl -L -O http://geolite.maxmind.com/download/geoip/api/c/GeoIP-$GEOIP_VERSION.tar.gz || exit 1
1162 gzcat GeoIP-$GEOIP_VERSION.tar.gz | tar xf - || exit 1
1163 cd GeoIP-$GEOIP_VERSION
1164 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1166 # Grr. Their man pages "helpfully" have an ISO 8859-1
1167 # copyright symbol in the copyright notice, but OS X's
1168 # default character encoding is UTF-8. sed on Mountain
1169 # Lion barfs at the "illegal character sequence" represented
1170 # by an ISO 8859-1 copyright symbol, as it's not a valid
1173 # iconv the relevant man pages into UTF-8.
1175 for i in geoipupdate.1.in geoiplookup6.1.in geoiplookup.1.in
1177 iconv -f iso8859-1 -t utf-8 man/"$i" >man/"$i".tmp &&
1178 mv man/"$i".tmp man/"$i"
1180 make $MAKE_BUILD_OPTS || exit 1
1181 $DO_MAKE_INSTALL || exit 1
1183 touch geoip-$GEOIP_VERSION-done
1188 echo "You are now prepared to build Wireshark. To do so do:"
1189 echo "export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig"
1191 if [ -n "$CMAKE" ]; then
1192 echo "mkdir build; cd build"
1199 echo "mkdir build; cd build"
1202 echo "make $MAKE_BUILD_OPTS"
1207 echo "Make sure you are allowed capture access to the network devices"
1208 echo "See: http://wiki.wireshark.org/CaptureSetup/CapturePrivileges"