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
11 DARWIN_MAJOR_VERSION=`uname -r | sed 's/\([0-9]*\).*/\1/'`
14 # Versions to download and install.
16 # The following libraries and tools are required.
18 GETTEXT_VERSION=0.18.2
20 PKG_CONFIG_VERSION=0.28
26 GDK_PIXBUF_VERSION=2.28.0
27 if [ -z "$GTK3" ]; then
34 # Some package need xz to unpack their current source.
35 # xz is not yet provided with OS X.
39 # In case we want to build with cmake
40 CMAKE_VERSION=2.8.10.2
43 # The following libraries are optional.
44 # Comment them out if you don't want them, but note that some of
45 # the optional libraries are required by other optional libraries.
49 # libgpg-error is required for libgcrypt.
51 LIBGPG_ERROR_VERSION=1.10
53 # libgcrypt is required for GnuTLS.
54 # XXX - the link for "Libgcrypt source code" at
55 # http://www.gnupg.org/download/#libgcrypt is for 1.5.0, and is a bzip2
56 # file, but http://directory.fsf.org/project/libgcrypt/ lists only
59 LIBGCRYPT_VERSION=1.5.0
60 GNUTLS_VERSION=2.12.19
61 # Stay with Lua 5.1 when updating until the code has been changed
64 PORTAUDIO_VERSION=pa_stable_v19_20111121
66 # XXX - they appear to have an unversioned gzipped tarball for the
67 # current version; should we just download that, with some other
68 # way of specifying whether to download the GeoIP API?
73 # GNU autotools; they're provided with releases up to Snow Leopard, but
74 # not in later releases.
76 if [[ $DARWIN_MAJOR_VERSION -gt 10 ]]; then
78 AUTOMAKE_VERSION=1.13.3
83 if [ -d macosx-support-libs ]
85 cd macosx-support-libs
88 # Uninstall items in the reverse order from the order in which they're
89 # installed. Only uninstall if the download/build/install process
90 # completed; uninstall the version that appears in the name of
93 # We also do a "make distclean", so that we don't have leftovers from
96 installed_geoip_version=`ls geoip-*-done 2>/dev/null | sed 's/geoip-\(.*\)-done/\1/'`
97 if [ ! -z "$installed_geoip_version" ] ; then
98 echo "Uninstalling GeoIP API:"
99 cd GeoIP-$installed_geoip_version
100 $DO_MAKE_UNINSTALL || exit 1
101 make distclean || exit 1
103 rm geoip-installed_geoip_version-done
106 if [ "$PORTAUDIO_VERSION" -a -f portaudio-done ] ; then
107 echo "Uninstalling PortAudio:"
109 $DO_MAKE_UNINSTALL || exit 1
110 make distclean || exit 1
115 if [ "$LUA_VERSION" -a -f lua-$LUA_VERSION-done ] ; then
116 echo "Uninstalling Lua:"
118 # Lua has no "make uninstall", so just remove stuff manually.
119 # There's no configure script, so there's no need for
120 # "make distclean", either; just do "make clean".
122 (cd /usr/local/bin; $DO_RM -f lua luac)
123 (cd /usr/local/include; $DO_RM -f lua.h luaconf.h lualib.h lauxlib.h lua.hpp)
124 (cd /usr/local/lib; $DO_RM -f liblua.a)
125 (cd /usr/local/man/man1; $DO_RM -f lua.1 luac.1)
129 rm lua-$LUA_VERSION-done
132 installed_gnutls_version=`ls gnutls-*-done 2>/dev/null | sed 's/gnutls-\(.*\)-done/\1/'`
133 if [ ! -z "$installed_gnutls_version" ] ; then
134 echo "Uninstalling GnuTLS:"
135 cd gnutls-$installed_gnutls_version
136 $DO_MAKE_UNINSTALL || exit 1
137 make distclean || exit 1
139 rm gnutls-$installed_gnutls_version-done
142 installed_libgcrypt_version=`ls libgcrypt-*-done 2>/dev/null | sed 's/libgcrypt-\(.*\)-done/\1/'`
143 if [ ! -z "$installed_libgcrypt_version" ] ; then
144 echo "Uninstalling libgcrypt:"
145 cd libgcrypt-$installed_libgcrypt_version
146 $DO_MAKE_UNINSTALL || exit 1
147 make distclean || exit 1
149 rm libgcrypt-$installed_libgcrypt_version-done
152 installed_libgpg_error_version=`ls libgpg-error-*-done 2>/dev/null | sed 's/libgpg-error-\(.*\)-done/\1/'`
153 if [ ! -z "$installed_libgpg_error_version" ] ; then
154 echo "Uninstalling libgpg-error:"
155 cd libgpg-error-$installed_libgpg_error_version
156 $DO_MAKE_UNINSTALL || exit 1
157 make distclean || exit 1
159 rm libgpg-error-$installed_libgpg_error_version-done
162 installed_libsmi_version=`ls libsmi-*-done 2>/dev/null | sed 's/libsmi-\(.*\)-done/\1/'`
163 if [ ! -z "$installed_libsmi_version" ] ; then
164 echo "Uninstalling libsmi:"
165 cd libsmi-$installed_libsmi_version
166 $DO_MAKE_UNINSTALL || exit 1
167 make distclean || exit 1
169 rm libsmi-$installed_libsmi_version-done
172 installed_gtk_version=`ls gtk+-*-done 2>/dev/null | sed 's/gtk+-\(.*\)-done/\1/'`
173 if [ ! -z "$installed_gtk_version" ] ; then
174 echo "Uninstalling GTK+:"
175 cd gtk+-$installed_gtk_version
176 $DO_MAKE_UNINSTALL || exit 1
177 make distclean || exit 1
179 rm gtk+-$installed_gtk_version-done
182 installed_gdk_pixbuf_version=`ls gdk-pixbuf-*-done 2>/dev/null | sed 's/gdk-pixbuf-\(.*\)-done/\1/'`
183 if [ ! -z "$installed_gdk_pixbuf_version" ] ; then
184 echo "Uninstalling gdk-pixbuf:"
185 cd gdk-pixbuf-$installed_gdk_pixbuf_version
186 $DO_MAKE_UNINSTALL || exit 1
187 make distclean || exit 1
189 rm gdk-pixbuf-$installed_gdk_pixbuf_version-done
192 installed_pango_version=`ls pango-*-done 2>/dev/null | sed 's/pango-\(.*\)-done/\1/'`
193 if [ ! -z "$installed_pango_version" ] ; then
194 echo "Uninstalling Pango:"
195 cd pango-$installed_pango_version
196 $DO_MAKE_UNINSTALL || exit 1
197 make distclean || exit 1
199 rm pango-$installed_pango_version-done
202 installed_atk_version=`ls atk-*-done 2>/dev/null | sed 's/atk-\(.*\)-done/\1/'`
203 if [ ! -z "$installed_atk_version" ] ; then
204 echo "Uninstalling ATK:"
205 cd atk-$installed_atk_version
206 $DO_MAKE_UNINSTALL || exit 1
207 make distclean || exit 1
209 rm atk-$installed_atk_version-done
212 installed_cairo_version=`ls cairo-*-done 2>/dev/null | sed 's/cairo-\(.*\)-done/\1/'`
213 if [ ! -z "$installed_cairo_version" ] ; then
214 echo "Uninstalling Cairo:"
215 cd cairo-$installed_cairo_version
216 $DO_MAKE_INSTALL || exit 1
217 make distclean || exit 1
219 rm cairo-$installed_cairo_version-done
222 installed_pixman_version=`ls pixman-*-done 2>/dev/null | sed 's/pixman-\(.*\)-done/\1/'`
223 if [ ! -z "$installed_pixman_version" ] ; then
224 echo "Uninstalling pixman:"
225 cd pixman-$installed_pixman_version
226 $DO_MAKE_UNINSTALL || exit 1
227 make distclean || exit 1
229 rm pixman-$installed_pixman_version-done
232 installed_libpng_version=`ls libpng-*-done 2>/dev/null | sed 's/libpng-\(.*\)-done/\1/'`
233 if [ ! -z "$installed_libpng_version" ] ; then
234 echo "Uninstalling libpng:"
235 cd libpng-$installed_libpng_version
236 $DO_MAKE_UNINSTALL || exit 1
237 make distclean || exit 1
239 rm libpng-$installed_libpng_version-done
242 installed_glib_version=`ls glib-*-done 2>/dev/null | sed 's/glib-\(.*\)-done/\1/'`
243 if [ ! -z "$installed_glib_version" ] ; then
244 echo "Uninstalling GLib:"
245 cd glib-$installed_glib_version
246 $DO_MAKE_UNINSTALL || exit 1
247 make distclean || exit 1
249 rm glib-$installed_glib_version-done
252 installed_pkg_config_version=`ls pkg-config-*-done 2>/dev/null | sed 's/pkg-config-\(.*\)-done/\1/'`
253 if [ ! -z "$installed_pkg_config_version" ] ; then
254 echo "Uninstalling pkg-config:"
255 cd pkg-config-$installed_pkg_config_version
256 $DO_MAKE_UNINSTALL || exit 1
257 make distclean || exit 1
259 rm pkg-config-$installed_pkg_config_version-done
262 installed_gettext_version=`ls gettext-*-done 2>/dev/null | sed 's/gettext-\(.*\)-done/\1/'`
263 if [ ! -z "$installed_gettext_version" ] ; then
264 echo "Uninstalling GNU gettext:"
265 cd gettext-$installed_gettext_version
266 $DO_MAKE_UNINSTALL || exit 1
267 make distclean || exit 1
269 rm gettext-$installed_gettext_version-done
272 installed_cmake_version=`ls cmake-*-done 2>/dev/null | sed 's/cmake-\(.*\)-done/\1/'`
273 if [ ! -z "$installed_cmake_version" ]; then
274 echo "Uninstalling CMake:"
275 cd cmake-$installed_cmake_version
276 $DO_MAKE_UNINSTALL || exit 1
277 make distclean || exit 1
279 rm cmake-$installed_cmake_version-done
282 installed_libtool_version=`ls libtool-*-done 2>/dev/null | sed 's/libtool-\(.*\)-done/\1/'`
283 if [ ! -z "$installed_libtool_version" ] ; then
284 echo "Uninstalling GNU libtool:"
285 cd libtool-$installed_libtool_version
286 mv /usr/local/bin/glibtool /usr/local/bin/libtool
287 mv /usr/local/bin/glibtoolize /usr/local/bin/libtoolize
288 $DO_MAKE_UNINSTALL || exit 1
289 make distclean || exit 1
291 rm libtool-$installed_libtool_version-done
294 installed_automake_version=`ls automake-*-done 2>/dev/null | sed 's/automake-\(.*\)-done/\1/'`
295 if [ ! -z "$installed_automake_version" ] ; then
296 echo "Uninstalling GNU automake:"
297 cd automake-$installed_automake_version
298 $DO_MAKE_UNINSTALL || exit 1
299 make distclean || exit 1
301 rm automake-$installed_automake_version-done
304 installed_autoconf_version=`ls autoconf-*-done 2>/dev/null | sed 's/autoconf-\(.*\)-done/\1/'`
305 if [ ! -z "$installed_autoconf_version" ] ; then
306 echo "Uninstalling GNU autoconf:"
307 cd autoconf-$installed_autoconf_version
308 $DO_MAKE_UNINSTALL || exit 1
309 make distclean || exit 1
311 rm autoconf-$installed_autoconf_version-done
314 installed_xz_version=`ls xz-*-done 2>/dev/null | sed 's/xz-\(.*\)-done/\1/'`
315 if [ ! -z "$installed_xz_version" ] ; then
316 echo "Uninstalling xz:"
317 cd xz-$installed_xz_version
318 $DO_MAKE_UNINSTALL || exit 1
319 make distclean || exit 1
321 rm xz-$installed_xz_version-done
327 # Do we have permission to write in /usr/local?
329 # If so, assume we have permission to write in its subdirectories.
330 # (If that's not the case, this test needs to check the subdirectories
333 # If not, do "make install", "make uninstall", and the removes for Lua
338 DO_MAKE_INSTALL="make install"
339 DO_MAKE_UNINSTALL="make uninstall"
342 DO_MAKE_INSTALL="sudo make install"
343 DO_MAKE_UNINSTALL="sudo make uninstall"
348 # Parse command-line flags:
351 # -t <target> - build libraries so that they'll work on the specified
352 # version of OS X and later versions.
353 # -u - do an uninstall.
355 while getopts ht:u name
362 min_osx_target="$OPTARG"
365 echo "Usage: macosx-setup.sh [ -t <target> ] [ -u ]" 1>&1
371 if [ "$do_uninstall" = "yes" ]
378 # To make this work on Leopard (rather than working *on* Snow Leopard
379 # when building *for* Leopard) will take more work.
381 # For one thing, Leopard's /usr/X11/lib/libXdamage.la claims, at least
382 # with all software updates applied, that the Xdamage shared library
383 # is libXdamage.1.0.0.dylib, but it is, in fact, libXdamage.1.1.0.dylib.
384 # This causes problems when building GTK+, so the script would have to
387 if [[ $DARWIN_MAJOR_VERSION -le 9 ]]; then
388 echo "This script does not support any versions of OS X before Snow Leopard" 1>&2
392 # To set up a GTK3 environment
397 # To build all libraries as 32-bit libraries uncomment the following three lines.
398 # export CFLAGS="$CFLAGS -arch i386"
399 # export CXXFLAGS="$CXXFLAGS -arch i386"
400 # export LDFLAGS="$LDFLAGS -arch i386"
403 # if no make options are present, set default options
404 if [ -z "$MAKE_BUILD_OPTS" ] ; then
405 # by default use 1.5x number of cores for parallel build
406 MAKE_BUILD_OPTS="-j $(( $(sysctl -n hw.logicalcpu) * 3 / 2))"
410 # Was a minimum target release specified?
412 if [ ! -z "$min_osx_target" ]
415 # Look for the SDK for that release, and build libraries against
416 # it rather than against the headers and, more importantly,
417 # libraries that come with the OS, so that we don't end up with
418 # support libraries that only work on the OS version on which
419 # we built them, not earlier versions of the same release, or
420 # earlier releases if the minimum is earlier.
422 for i in /Developer/SDKs \
423 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
424 /Library/Developer/CommandLineTools/SDKs
426 if [ -d "$i"/"MacOSX$min_osx_target.sdk" ]
428 SDKPATH="$i"/"MacOSX$min_osx_target.sdk"
435 echo "macosx-setup.sh: Couldn't find the SDK for OS X $min_osx_target" 1>&2
440 # Make sure there are links to /usr/local/include and /usr/local/lib
441 # in the SDK's usr/local.
443 if [ ! -e $SDKPATH/usr/local/include ]
445 if [ ! -d $SDKPATH/usr/local ]
447 sudo mkdir $SDKPATH/usr/local
449 sudo ln -s /usr/local/include $SDKPATH/usr/local/include
451 if [ ! -e $SDKPATH/usr/local/lib ]
453 if [ ! -d $SDKPATH/usr/local ]
455 sudo mkdir $SDKPATH/usr/local
457 sudo ln -s /usr/local/lib $SDKPATH/usr/local/lib
461 # Set the minimum OS version for which to build to the specified
462 # minimum target OS version, so we don't, for example, end up using
463 # linker features supported by the OS verson on which we're building
464 # but not by the target version.
466 VERSION_MIN_FLAGS="-mmacosx-version-min=$min_osx_target"
469 # Compile and link against the SDK.
471 SDKFLAGS="-isysroot $SDKPATH"
473 if [[ "$min_osx_target" == "10.5" ]]
476 # Cairo is part of Mac OS X 10.6 and later.
477 # The *headers* are supplied by 10.5, but the *libraries*
478 # aren't, so we have to build it if we're building for 10.5.
480 cairo_not_in_the_os=yes
483 # Build with older versions of the support libraries, as
484 # were used on the Wireshark Leopard buildbot at one
485 # point. (Most of these versions come from the About page
486 # from Wireshark 1.8.6, the last build done on that buildbot;
487 # the ATK version isn't reported, so this is a guess.)
489 # If you want to try building with newer versions of
490 # the libraries, note that:
492 # The version of fontconfig that comes with Leopard doesn't
493 # support FC_WEIGHT_EXTRABLACK, so we can't use any version
494 # of Pango newer than 1.22.4.
496 # However, Pango 1.22.4 doesn't work with versions of GLib
497 # after 2.29.6, because Pango 1.22.4 uses G_CONST_RETURN and
498 # GLib 2.29.8 and later deprecate it (there doesn't appear to
499 # be a GLib 2.29.7). That means we'd either have to patch
500 # Pango not to use it (just use "const"; G_CONST_RETURN was
501 # there to allow code to choose whether to use "const" or not),
502 # or use GLib 2.29.6 or earlier.
504 # GLib 2.29.6 includes an implementation of g_bit_lock() that,
505 # on x86 (32-bit and 64-bit), uses asms in a fashion
506 # ("asm volatile goto") that requires GCC 4.5 or later, which
507 # is later than the compilers that come with Leopard and Snow
508 # Leopard. Recent versions of GLib check for that, but 2.29.6
509 # doesn't, so, if you want to build GLib 2.29.6 on Leopard or
510 # Snow Leopard, you would have to patch glib/gbitlock.c to do
511 # what the newer versions of GLib do:
513 # define a USE_ASM_GOTO macro that indicates whether "asm goto"
515 # #if (defined (i386) || defined (__amd64__))
516 # #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
517 # #define USE_ASM_GOTO 1
521 # replace all occurrences of
523 # #if defined (__GNUC__) && (defined (i386) || defined (__amd64__))
527 # #ifdef USE_ASM_GOTO
529 # Using GLib 2.29.6 or earlier, however, means that we can't
530 # use a version of ATK later than 2.3.93, as those versions
531 # don't work with GLib 2.29.6. The same applies to gdk-pixbuf;
532 # versions of gdk-pixbuf after 2.24.1 won't work with GLib
535 # Then you have to make sure that what you've build doesn't
536 # cause the X server that comes with Leopard to crash; at
537 # least one attempt at building for Leopard did.
539 # At least if building on Leopard, you might also find
540 # that, with various older versions of Cairo, including
541 # 1.6.4 and at least some 1.8.x versions, when you try to
542 # build it, the build fails because it can't find
543 # png_set_longjmp_fn(). I vaguely remember dealing with that,
544 # ages ago, but don't remember what I did.
553 # That version of GTK+ includes gdk-pixbuf.
554 # XXX - base this on the version of GTK+ requested.
559 # Libgcrypt 1.5.0 fails to compile due to some problem with an
560 # asm in rijndael.c, at least with i686-apple-darwin10-gcc-4.2.1
561 # (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) when building
564 # We try libgcrypt 1.4.3 instead, as that's what shows up in
565 # the version from the Leopard buildbot.
566 LIBGCRYPT_VERSION=1.4.3
569 # Build 32-bit while we're at it; Leopard has a bug that
570 # causes some BPF functions not to work with 64-bit userland
571 # code, so capturing won't work.
573 export CFLAGS="$CFLAGS -arch i386"
574 export CXXFLAGS="$CXXFLAGS -arch i386"
575 export LDFLAGS="$LDFLAGS -arch i386"
580 # You need Xcode installed to get the compilers.
582 if [ ! -x /usr/bin/xcodebuild ]; then
583 echo "Please install Xcode first (should be available on DVD or from http://developer.apple.com/xcode/index.php)."
588 # You also need the X11 SDK; with at least some versions of OS X and
589 # Xcode, that is, I think, an optional install. (Or it might be
590 # installed with X11, but I think *that* is an optional install on
591 # at least some versions of OS X.)
593 if [ ! -d /usr/X11/include ]; then
594 echo "Please install X11 and the X11 SDK first."
598 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig
601 # Do all the downloads and untarring in a subdirectory, so all that
602 # stuff can be removed once we've installed the support libraries.
604 if [ ! -d macosx-support-libs ]
606 mkdir macosx-support-libs || exit 1
608 cd macosx-support-libs
610 # Start with xz: It is the sole download format of glib later than 2.31.2
612 if [ "$XZ_VERSION" -a ! -f xz-$XZ_VERSION-done ] ; then
613 echo "Downloading, building, and installing xz:"
614 [ -f xz-$XZ_VERSION.tar.bz2 ] || curl -O http://tukaani.org/xz/xz-$XZ_VERSION.tar.bz2 || exit 1
615 bzcat xz-$XZ_VERSION.tar.bz2 | tar xf - || exit 1
617 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0" ./configure || exit 1
618 make $MAKE_BUILD_OPTS || exit 1
619 $DO_MAKE_INSTALL || exit 1
621 touch xz-$XZ_VERSION-done
624 if [ "$AUTOCONF_VERSION" -a ! -f autoconf-$AUTOCONF_VERSION-done ] ; then
625 echo "Downloading, building and installing GNU autoconf..."
626 [ -f autoconf-$AUTOCONF_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/autoconf/autoconf-$AUTOCONF_VERSION.tar.xz || exit 1
627 xzcat autoconf-$AUTOCONF_VERSION.tar.xz | tar xf - || exit 1
628 cd autoconf-$AUTOCONF_VERSION
629 ./configure || exit 1
630 make $MAKE_BUILD_OPTS || exit 1
631 $DO_MAKE_INSTALL || exit 1
633 touch autoconf-$AUTOCONF_VERSION-done
636 if [ "$AUTOMAKE_VERSION" -a ! -f automake-$AUTOMAKE_VERSION-done ] ; then
637 echo "Downloading, building and installing GNU automake..."
638 [ -f automake-$AUTOMAKE_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/automake/automake-$AUTOMAKE_VERSION.tar.xz || exit 1
639 xzcat automake-$AUTOMAKE_VERSION.tar.xz | tar xf - || exit 1
640 cd automake-$AUTOMAKE_VERSION
641 ./configure || exit 1
642 make $MAKE_BUILD_OPTS || exit 1
643 $DO_MAKE_INSTALL || exit 1
645 touch automake-$AUTOMAKE_VERSION-done
648 if [ "$LIBTOOL_VERSION" -a ! -f libtool-$LIBTOOL_VERSION-done ] ; then
649 echo "Downloading, building and installing GNU libtool..."
650 [ -f libtool-$LIBTOOL_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/libtool/libtool-$LIBTOOL_VERSION.tar.xz || exit 1
651 xzcat libtool-$LIBTOOL_VERSION.tar.xz | tar xf - || exit 1
652 cd libtool-$LIBTOOL_VERSION
653 ./configure || exit 1
654 make $MAKE_BUILD_OPTS || exit 1
655 $DO_MAKE_INSTALL || exit 1
656 mv /usr/local/bin/libtool /usr/local/bin/glibtool
657 mv /usr/local/bin/libtoolize /usr/local/bin/glibtoolize
659 touch libtool-$LIBTOOL_VERSION-done
662 if [ -n "$CMAKE" -a ! -f cmake-$CMAKE_VERSION-done ]; then
663 echo "Downloading, building, and installing CMAKE:"
664 cmake_dir=`expr $CMAKE_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
665 [ -f cmake-$CMAKE_VERSION.tar.gz ] || curl -O http://www.cmake.org/files/v$cmake_dir/cmake-$CMAKE_VERSION.tar.gz || exit 1
666 gzcat cmake-$CMAKE_VERSION.tar.gz | tar xf - || exit 1
667 cd cmake-$CMAKE_VERSION
668 ./bootstrap || exit 1
669 make $MAKE_BUILD_OPTS || exit 1
670 $DO_MAKE_INSTALL || exit 1
672 touch cmake-$CMAKE_VERSION-done
676 # Start with GNU gettext; GLib requires it, and OS X doesn't have it
677 # or a BSD-licensed replacement.
679 # At least on Lion with Xcode 4, _FORTIFY_SOURCE gets defined as 2
680 # by default, which causes, for example, stpncpy to be defined as
681 # a hairy macro that collides with the GNU gettext configure script's
682 # attempts to workaround AIX's lack of a declaration for stpncpy,
683 # with the result being a huge train wreck. Define _FORTIFY_SOURCE
684 # as 0 in an attempt to keep the trains on separate tracks.
686 if [ ! -f gettext-$GETTEXT_VERSION-done ] ; then
687 echo "Downloading, building, and installing GNU gettext:"
688 [ -f gettext-$GETTEXT_VERSION.tar.gz ] || curl -O http://ftp.gnu.org/pub/gnu/gettext/gettext-$GETTEXT_VERSION.tar.gz || exit 1
689 gzcat gettext-$GETTEXT_VERSION.tar.gz | tar xf - || exit 1
690 cd gettext-$GETTEXT_VERSION
691 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0 $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
692 make $MAKE_BUILD_OPTS || exit 1
693 $DO_MAKE_INSTALL || exit 1
695 touch gettext-$GETTEXT_VERSION-done
699 # GLib depends on pkg-config.
700 # By default, pkg-config depends on GLib; we break the dependency cycle
701 # by configuring pkg-config to use its own internal version of GLib.
703 if [ ! -f pkg-config-$PKG_CONFIG_VERSION-done ] ; then
704 echo "Downloading, building, and installing pkg-config:"
705 [ -f pkg-config-$PKG_CONFIG_VERSION.tar.gz ] || curl -O http://pkgconfig.freedesktop.org/releases/pkg-config-$PKG_CONFIG_VERSION.tar.gz || exit 1
706 gzcat pkg-config-$PKG_CONFIG_VERSION.tar.gz | tar xf - || exit 1
707 cd pkg-config-$PKG_CONFIG_VERSION
708 ./configure --with-internal-glib || exit 1
709 make $MAKE_BUILD_OPTS || exit 1
710 $DO_MAKE_INSTALL || exit 1
712 touch pkg-config-$PKG_CONFIG_VERSION-done
715 if [ ! -f glib-$GLIB_VERSION-done ] ; then
716 echo "Downloading, building, and installing GLib:"
717 glib_dir=`expr $GLIB_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
718 GLIB_MAJOR_VERSION="`expr $GLIB_VERSION : '\([0-9][0-9]*\).*'`"
719 GLIB_MINOR_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
720 GLIB_DOTDOT_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
721 if [[ $GLIB_MAJOR_VERSION -gt 2 ||
722 $GLIB_MINOR_VERSION -gt 28 ||
723 ($GLIB_MINOR_VERSION -eq 28 && $GLIB_DOTDOT_VERSION -ge 8) ]]
726 # Starting with GLib 2.28.8, xz-compressed tarballs are available.
728 [ -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
729 xzcat glib-$GLIB_VERSION.tar.xz | tar xf - || exit 1
731 [ -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
732 bzcat glib-$GLIB_VERSION.tar.bz2 | tar xf - || exit 1
734 cd glib-$GLIB_VERSION
736 # OS X ships with libffi, but doesn't provide its pkg-config file;
737 # explicitly specify LIBFFI_CFLAGS and LIBFFI_LIBS, so the configure
738 # script doesn't try to use pkg-config to get the appropriate
739 # C flags and loader flags.
741 # And, what's worse, at least with the version of Xcode that comes
742 # with Leopard, /usr/include/ffi/fficonfig.h doesn't define MACOSX,
743 # which causes the build of GLib to fail. If we don't find
744 # "#define.*MACOSX" in /usr/include/ffi/fficonfig.h, explictly
747 # While we're at it, suppress -Wformat-nonliteral to avoid a case
748 # where clang's stricter rules on when not to complain about
749 # non-literal format arguments cause it to complain about code
750 # that's safe but it wasn't told that. See my comment #25 in
753 # https://bugzilla.gnome.org/show_bug.cgi?id=691608#c25
755 # First, determine where the system include files are. (It's not
756 # necessarily /usr/include.) There's a bit of a greasy hack here;
757 # pre-5.x versions of the developer tools don't support the
758 # --show-sdk-path option, and will produce no output, so includedir
759 # will be set to /usr/include (in those older versions of the
760 # developer tools, there is a /usr/include directory).
762 includedir=`xcrun --show-sdk-path 2>/dev/null`/usr/include
763 if grep -qs '#define.*MACOSX' $includedir/ffi/fficonfig.h
765 # It's defined, nothing to do
766 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
768 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
772 # Apply the fix to GNOME bug 529806:
774 # https://bugzilla.gnome.org/show_bug.cgi?id=529806
776 # if we have a version of GLib prior to 2.30.
778 if [[ $GLIB_MAJOR_VERSION -eq 2 && $GLIB_MINOR_VERSION -le 30 ]]
780 patch -p0 <../../macosx-support-lib-patches/glib-gconvert.c.patch || exit 1
782 make $MAKE_BUILD_OPTS || exit 1
783 $DO_MAKE_INSTALL || exit 1
785 touch glib-$GLIB_VERSION-done
789 # Now we have reached a point where we can build everything but
790 # the GUI (Wireshark).
792 # GTK+ 3 requires a newer Cairo build than the one that comes with
793 # 10.6, so we build Cairo if we are using GTK+ 3.
795 # In 10.6 and 10.7, it's an X11 library; if we build with "native" GTK+
796 # rather than X11 GTK+, we might have to build and install Cairo.
797 # In 10.8 and later, there is no X11, but it's included in Xquartz;
798 # again, if we build with "native" GTK+, we'd have to build and install
801 if [[ -n "$GTK3" || "$cairo_not_in_the_os" = yes ]]; then
803 # Requirements for Cairo first
805 # The libpng that comes with the X11 for leopard has a bogus
806 # pkg-config file that lies about where the header files are,
807 # which causes other packages not to be able to find its
810 # if [ ! -f libpng-$PNG_VERSION-done ] ; then
811 # echo "Downloading, building, and installing libpng:"
813 # # The FTP site puts libpng x.y.* into a libpngxy directory.
815 # subdir=`echo $PNG_VERSION | sed 's/\([1-9][0-9]*\)\.\([1-9][0-9]*\).*/libpng\1\2'/`
816 # [ -f libpng-$PNG_VERSION.tar.xz ] || curl -O ftp://ftp.simplesystems.org/pub/libpng/png/src/$subdir/libpng-$PNG_VERSION.tar.xz
817 # xzcat libpng-$PNG_VERSION.tar.xz | tar xf - || exit 1
818 # cd libpng-$PNG_VERSION
819 # CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
820 # make $MAKE_BUILD_OPTS || exit 1
821 # $DO_MAKE_INSTALL || exit 1
823 # touch libpng-$PNG_VERSION-done
827 # The libpixman that comes with the X11 for Leopard is too old
828 # to support Cairo's image surface backend feature (which requires
829 # pixman-1 >= 0.22.0).
831 # if [ ! -f pixman-$PIXMAN_VERSION-done ] ; then
832 # echo "Downloading, building, and installing pixman:"
833 # [ -f pixman-$PIXMAN_VERSION.tar.gz ] || curl -O http://www.cairographics.org/releases/pixman-$PIXMAN_VERSION.tar.gz
834 # gzcat pixman-$PIXMAN_VERSION.tar.gz | tar xf - || exit 1
835 # cd pixman-$PIXMAN_VERSION
836 # CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
837 # make $MAKE_BUILD_OPTS || exit 1
838 # $DO_MAKE_INSTALL || exit 1
840 # touch pixman-$PIXMAN_VERSION-done
844 # And now Cairo itself.
846 if [ ! -f cairo-$CAIRO_VERSION-done ] ; then
847 echo "Downloading, building, and installing Cairo:"
848 CAIRO_MAJOR_VERSION="`expr $CAIRO_VERSION : '\([0-9][0-9]*\).*'`"
849 CAIRO_MINOR_VERSION="`expr $CAIRO_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
850 CAIRO_DOTDOT_VERSION="`expr $CAIRO_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
851 if [[ $CAIRO_MAJOR_VERSION -gt 1 ||
852 $CAIRO_MINOR_VERSION -gt 12 ||
853 ($CAIRO_MINOR_VERSION -eq 12 && $CAIRO_DOTDOT_VERSION -ge 2) ]]
856 # Starting with Cairo 1.12.2, the tarballs are compressed with
857 # xz rather than gzip.
859 [ -f cairo-$CAIRO_VERSION.tar.xz ] || curl -O http://cairographics.org/releases/cairo-$CAIRO_VERSION.tar.xz || exit 1
860 xzcat cairo-$CAIRO_VERSION.tar.xz | tar xf - || exit 1
862 [ -f cairo-$CAIRO_VERSION.tar.gz ] || curl -O http://cairographics.org/releases/cairo-$CAIRO_VERSION.tar.gz || exit 1
863 gzcat cairo-$CAIRO_VERSION.tar.gz | tar xf - || exit 1
865 cd cairo-$CAIRO_VERSION
866 # CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-quartz=no || exit 1
867 # Maybe follow http://cairographics.org/end_to_end_build_for_mac_os_x/
868 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-quartz=yes || exit 1
870 # We must avoid the version of libpng that comes with X11; the
871 # only way I've found to force that is to forcibly set INCLUDES
872 # when we do the build, so that this comes before CAIRO_CFLAGS,
873 # which has -I/usr/X11/include added to it before anything
874 # connected to libpng is.
876 INCLUDES="-I/usr/local/include/libpng15" make $MAKE_BUILD_OPTS || exit 1
877 $DO_MAKE_INSTALL || exit 1
879 touch cairo-$CAIRO_VERSION-done
883 if [ ! -f atk-$ATK_VERSION-done ] ; then
884 echo "Downloading, building, and installing ATK:"
885 atk_dir=`expr $ATK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
886 ATK_MAJOR_VERSION="`expr $ATK_VERSION : '\([0-9][0-9]*\).*'`"
887 ATK_MINOR_VERSION="`expr $ATK_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
888 ATK_DOTDOT_VERSION="`expr $ATK_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
889 if [[ $ATK_MAJOR_VERSION -gt 2 ||
890 ($ATK_MAJOR_VERSION -eq 2 && $ATK_MINOR_VERSION -gt 0) ||
891 ($ATK_MANOR_VERSION -eq 2 && $ATK_MINOR_VERSION -eq 0 && $ATK_DOTDOT_VERSION -ge 1) ]]
894 # Starting with ATK 2.0.1, xz-compressed tarballs are available.
896 [ -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
897 xzcat atk-$ATK_VERSION.tar.xz | tar xf - || exit 1
899 [ -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
900 bzcat atk-$ATK_VERSION.tar.bz2 | tar xf - || exit 1
903 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
904 make $MAKE_BUILD_OPTS || exit 1
905 $DO_MAKE_INSTALL || exit 1
907 touch atk-$ATK_VERSION-done
910 if [ ! -f pango-$PANGO_VERSION-done ] ; then
911 echo "Downloading, building, and installing Pango:"
912 pango_dir=`expr $PANGO_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
913 PANGO_MAJOR_VERSION="`expr $PANGO_VERSION : '\([0-9][0-9]*\).*'`"
914 PANGO_MINOR_VERSION="`expr $PANGO_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
915 if [[ $PANGO_MAJOR_VERSION -gt 1 ||
916 $PANGO_MINOR_VERSION -ge 29 ]]
919 # Starting with Pango 1.29, the tarballs are compressed with
920 # xz rather than bzip2.
922 [ -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
923 xzcat pango-$PANGO_VERSION.tar.xz | tar xf - || exit 1
925 [ -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
926 bzcat pango-$PANGO_VERSION.tar.bz2 | tar xf - || exit 1
928 cd pango-$PANGO_VERSION
929 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
930 make $MAKE_BUILD_OPTS || exit 1
931 $DO_MAKE_INSTALL || exit 1
933 touch pango-$PANGO_VERSION-done
936 if [ "$GDK_PIXBUF_VERSION" -a ! -f gdk-pixbuf-$GDK_PIXBUF_VERSION-done ] ; then
937 echo "Downloading, building, and installing gdk-pixbuf:"
938 gdk_pixbuf_dir=`expr $GDK_PIXBUF_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
939 [ -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
940 xzcat gdk-pixbuf-$GDK_PIXBUF_VERSION.tar.xz | tar xf - || exit 1
941 cd gdk-pixbuf-$GDK_PIXBUF_VERSION
942 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --without-libtiff --without-libjpeg || exit 1
943 make $MAKE_BUILD_OPTS || exit 1
944 $DO_MAKE_INSTALL || exit 1
946 touch gdk-pixbuf-$GDK_PIXBUF_VERSION-done
949 if [ ! -f gtk+-$GTK_VERSION-done ] ; then
950 echo "Downloading, building, and installing GTK+:"
951 gtk_dir=`expr $GTK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
952 GTK_MAJOR_VERSION="`expr $GTK_VERSION : '\([0-9][0-9]*\).*'`"
953 GTK_MINOR_VERSION="`expr $GTK_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
954 GTK_DOTDOT_VERSION="`expr $GTK_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
955 if [[ $GTK_MAJOR_VERSION -gt 2 ||
956 $GTK_MINOR_VERSION -gt 24 ||
957 ($GTK_MINOR_VERSION -eq 24 && $GTK_DOTDOT_VERSION -ge 5) ]]
960 # Starting with GTK+ 2.24.5, the tarballs are compressed with
961 # xz rather than gzip, in addition to bzip2; use xz, as we've
962 # built and installed it, and as xz compresses better than
963 # bzip2 so the tarballs take less time to download.
965 [ -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
966 xzcat gtk+-$GTK_VERSION.tar.xz | tar xf - || exit 1
968 [ -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
969 bzcat gtk+-$GTK_VERSION.tar.bz2 | tar xf - || exit 1
972 if [ $DARWIN_MAJOR_VERSION -ge "12" ]
975 # GTK+ 2.24.10, at least, doesn't build on Mountain Lion with the
976 # CUPS printing backend - either the CUPS API changed incompatibly
977 # or the backend was depending on non-API implementation details.
979 # Configure it out, on Mountain Lion and later, for now.
980 # (12 is the Darwin major version number in Mountain Lion.)
982 # Also, configure out libtiff and libjpeg; configure scripts
983 # just ignore unknown --enable/--disable and --with/--without
984 # options (at least they've always do so up to now).
986 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --disable-cups--without-libtiff --without-libjpeg || exit 1
988 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --without-libtiff --without-libjpeg || exit 1
990 make $MAKE_BUILD_OPTS || exit 1
991 $DO_MAKE_INSTALL || exit 1
993 touch gtk+-$GTK_VERSION-done
997 # Now we have reached a point where we can build everything including
998 # the GUI (Wireshark), but not with any optional features such as
999 # SNMP OID resolution, some forms of decryption, Lua scripting, playback
1000 # of audio, or GeoIP mapping of IP addresses.
1002 # We now conditionally download optional libraries to support them;
1003 # the default is to download them all.
1006 if [ "$LIBSMI_VERSION" -a ! -f libsmi-$LIBSMI_VERSION-done ] ; then
1007 echo "Downloading, building, and installing libsmi:"
1008 [ -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
1009 gzcat libsmi-$LIBSMI_VERSION.tar.gz | tar xf - || exit 1
1010 cd libsmi-$LIBSMI_VERSION
1011 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1012 make $MAKE_BUILD_OPTS || exit 1
1013 $DO_MAKE_INSTALL || exit 1
1015 touch libsmi-$LIBSMI_VERSION-done
1018 if [ "$LIBGPG_ERROR_VERSION" -a ! -f libgpg-error-$LIBGPG_ERROR_VERSION-done ] ; then
1019 echo "Downloading, building, and installing libgpg-error:"
1020 [ -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
1021 bzcat libgpg-error-$LIBGPG_ERROR_VERSION.tar.bz2 | tar xf - || exit 1
1022 cd libgpg-error-$LIBGPG_ERROR_VERSION
1023 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1024 make $MAKE_BUILD_OPTS || exit 1
1025 $DO_MAKE_INSTALL || exit 1
1027 touch libgpg-error-$LIBGPG_ERROR_VERSION-done
1030 if [ "$LIBGCRYPT_VERSION" -a ! -f libgcrypt-$LIBGCRYPT_VERSION-done ] ; then
1032 # libgpg-error is required for libgcrypt.
1034 if [ -z $LIBGPG_ERROR_VERSION ]
1036 echo "libgcrypt requires libgpg-error, but you didn't install libgpg-error." 1>&2
1040 echo "Downloading, building, and installing libgcrypt:"
1041 [ -f libgcrypt-$LIBGCRYPT_VERSION.tar.gz ] || curl -L -O ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-$LIBGCRYPT_VERSION.tar.gz || exit 1
1042 gzcat libgcrypt-$LIBGCRYPT_VERSION.tar.gz | tar xf - || exit 1
1043 cd libgcrypt-$LIBGCRYPT_VERSION
1045 # The assembler language code is not compatible with the OS X
1046 # x86 assembler (or is it an x86-64 vs. x86-32 issue?).
1048 # libgcrypt expects gnu89, not c99/gnu99, semantics for
1049 # "inline". See, for example:
1051 # http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2010-October/198809.html
1053 CFLAGS="$CFLAGS -std=gnu89 $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --disable-asm || exit 1
1054 make $MAKE_BUILD_OPTS || exit 1
1055 $DO_MAKE_INSTALL || exit 1
1057 touch libgcrypt-$LIBGCRYPT_VERSION-done
1060 if [ "$GNUTLS_VERSION" -a ! -f gnutls-$GNUTLS_VERSION-done ] ; then
1062 # GnuTLS requires libgcrypt (or nettle, in newer versions).
1064 if [ -z $LIBGCRYPT_VERSION ]
1066 echo "GnuTLS requires libgcrypt, but you didn't install libgcrypt" 1>&2
1070 echo "Downloading, building, and installing GnuTLS:"
1071 [ -f gnutls-$GNUTLS_VERSION.tar.bz2 ] || curl -L -O http://ftp.gnu.org/gnu/gnutls/gnutls-$GNUTLS_VERSION.tar.bz2 || exit 1
1072 bzcat gnutls-$GNUTLS_VERSION.tar.bz2 | tar xf - || exit 1
1073 cd gnutls-$GNUTLS_VERSION
1075 # Use libgcrypt, not nettle.
1076 # XXX - is there some reason to prefer nettle? Or does
1077 # Wireshark directly use libgcrypt routines?
1079 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --with-libgcrypt --without-p11-kit || exit 1
1080 make $MAKE_BUILD_OPTS || exit 1
1082 # The pkgconfig file for GnuTLS says "requires zlib", but OS X,
1083 # while it supplies zlib, doesn't supply a pkgconfig file for
1086 # Patch the GnuTLS pkgconfig file not to require zlib.
1087 # (If the capabilities of GnuTLS that Wireshark uses don't
1088 # depend on building GnuTLS with zlib, an alternative would be
1089 # to configure it not to use zlib.)
1091 patch -p0 lib/gnutls.pc.in <../../macosx-support-lib-patches/gnutls-pkgconfig.patch || exit 1
1092 $DO_MAKE_INSTALL || exit 1
1094 touch gnutls-$GNUTLS_VERSION-done
1097 if [ "$LUA_VERSION" -a ! -f lua-$LUA_VERSION-done ] ; then
1098 echo "Downloading, building, and installing Lua:"
1099 [ -f lua-$LUA_VERSION.tar.gz ] || curl -L -O http://www.lua.org/ftp/lua-$LUA_VERSION.tar.gz || exit 1
1100 gzcat lua-$LUA_VERSION.tar.gz | tar xf - || exit 1
1102 make $MAKE_BUILD_OPTS macosx || exit 1
1103 $DO_MAKE_INSTALL || exit 1
1105 touch lua-$LUA_VERSION-done
1108 if [ "$PORTAUDIO_VERSION" -a ! -f portaudio-done ] ; then
1109 echo "Downloading, building, and installing PortAudio:"
1110 [ -f $PORTAUDIO_VERSION.tgz ] || curl -L -O http://www.portaudio.com/archives/$PORTAUDIO_VERSION.tgz || exit 1
1111 gzcat $PORTAUDIO_VERSION.tgz | tar xf - || exit 1
1114 # Un-comment an include that's required on Lion.
1116 patch -p0 include/pa_mac_core.h <../../macosx-support-lib-patches/portaudio-pa_mac_core.h.patch
1118 # Fix a bug that showed up with clang (but is a bug with any
1121 patch -p0 src/hostapi/coreaudio/pa_mac_core.c <../../macosx-support-lib-patches/portaudio-pa_mac_core.c.patch
1123 # Disable fat builds - the configure script doesn't work right
1124 # with Xcode 4 if you leave them enabled, and we don't build
1125 # any other libraries fat (GLib, for example, would be very
1126 # hard to build fat), so there's no advantage to having PortAudio
1129 # Set the minimum OS X version to 10.4, to suppress some
1130 # deprecation warnings. (Good luck trying to make any of
1131 # this build on an OS+Xcode with a pre-10.4 SDK; we don't
1132 # worry about the user requesting that.)
1134 CFLAGS="$CFLAGS -mmacosx-version-min=10.4 $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --disable-mac-universal || exit 1
1135 make $MAKE_BUILD_OPTS || exit 1
1136 $DO_MAKE_INSTALL || exit 1
1138 touch portaudio-done
1141 if [ "$GEOIP_VERSION" -a ! -f geoip-$GEOIP_VERSION-done ]
1143 echo "Downloading, building, and installing GeoIP API:"
1144 [ -f GeoIP-$GEOIP_VERSION.tar.gz ] || curl -L -O http://geolite.maxmind.com/download/geoip/api/c/GeoIP-$GEOIP_VERSION.tar.gz || exit 1
1145 gzcat GeoIP-$GEOIP_VERSION.tar.gz | tar xf - || exit 1
1146 cd GeoIP-$GEOIP_VERSION
1147 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1149 # Grr. Their man pages "helpfully" have an ISO 8859-1
1150 # copyright symbol in the copyright notice, but OS X's
1151 # default character encoding is UTF-8. sed on Mountain
1152 # Lion barfs at the "illegal character sequence" represented
1153 # by an ISO 8859-1 copyright symbol, as it's not a valid
1156 # iconv the relevant man pages into UTF-8.
1158 for i in geoipupdate.1.in geoiplookup6.1.in geoiplookup.1.in
1160 iconv -f iso8859-1 -t utf-8 man/"$i" >man/"$i".tmp &&
1161 mv man/"$i".tmp man/"$i"
1163 make $MAKE_BUILD_OPTS || exit 1
1164 $DO_MAKE_INSTALL || exit 1
1166 touch geoip-$GEOIP_VERSION-done
1171 echo "You are now prepared to build Wireshark. To do so do:"
1172 echo "export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig"
1174 if [ -n "$CMAKE" ]; then
1175 echo "mkdir build; cd build"
1182 echo "mkdir build; cd build"
1185 echo "make $MAKE_BUILD_OPTS"
1190 echo "Make sure you are allowed capture access to the network devices"
1191 echo "See: http://wiki.wireshark.org/CaptureSetup/CapturePrivileges"