2 # Setup development environment on Mac OS X (tested with 10.6.8 and Xcode 3.2.6)
6 # Copyright 2011 Michael Tuexen, Joerg Mayer, Guy Harris (see AUTHORS file)
8 # Wireshark - Network traffic analyzer
9 # By Gerald Combs <gerald@wireshark.org>
10 # Copyright 1998 Gerald Combs
12 # This program is free software; you can redistribute it and/or
13 # modify it under the terms of the GNU General Public License
14 # as published by the Free Software Foundation; either version 2
15 # of the License, or (at your option) any later version.
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write to the Free Software
24 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30 # To build all libraries as 32-bit libraries uncomment the following three lines.
32 # export CFLAGS="$CFLAGS -arch i386"
33 # export CXXFLAGS="$CXXFLAGS -arch i386"
34 # export LDFLAGS="$LDFLAGS -arch i386"
36 # and change "macx-clang" to "macx-clang-32" in the line below.
38 # Note: when building against the 10.6 SDK, clang fails, because there's
39 # a missing libstdc++.dylib in the SDK; this does not bother g++, however.
41 #TARGET_PLATFORM=macx-g++
42 TARGET_PLATFORM=macx-clang
45 # Versions of packages to download and install.
49 # Some packages need xz to unpack their current source.
50 # xz is not yet provided with OS X.
55 # In case we want to build with cmake.
57 CMAKE_VERSION=2.8.10.2
60 # The following libraries and tools are required even to build only TShark.
62 GETTEXT_VERSION=0.18.2
64 PKG_CONFIG_VERSION=0.28
67 # One or more of the following libraries are required to build Wireshark.
69 # If you don't want to build with Qt, comment out the QT_VERSION= line.
71 # If you want to build with GTK+ 2, comment out the GTK_VERSION=3.* line
72 # and un-comment the GTK_VERSION=2.* line.
74 # If you don't want to build with GTK+ at all, comment out both lines.
79 if [ "$GTK_VERSION" ]; then
81 # We'll be building GTK+, so we need some additional libraries.
83 GTK_MAJOR_VERSION="`expr $GTK_VERSION : '\([0-9][0-9]*\).*'`"
84 GTK_MINOR_VERSION="`expr $GTK_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
85 GTK_DOTDOT_VERSION="`expr $GTK_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
92 GDK_PIXBUF_VERSION=2.28.0
96 # The following libraries are optional.
97 # Comment them out if you don't want them, but note that some of
98 # the optional libraries are required by other optional libraries.
102 # libgpg-error is required for libgcrypt.
104 LIBGPG_ERROR_VERSION=1.10
106 # libgcrypt is required for GnuTLS.
107 # XXX - the link for "Libgcrypt source code" at
108 # http://www.gnupg.org/download/#libgcrypt is for 1.5.0, and is a bzip2
109 # file, but http://directory.fsf.org/project/libgcrypt/ lists only
112 LIBGCRYPT_VERSION=1.5.0
113 GNUTLS_VERSION=2.12.19
114 # Default to 5.2 now, unless user overrides it later
116 PORTAUDIO_VERSION=pa_stable_v19_20111121
118 # XXX - they appear to have an unversioned gzipped tarball for the
119 # current version; should we just download that, with some other
120 # way of specifying whether to download the GeoIP API?
126 DARWIN_MAJOR_VERSION=`uname -r | sed 's/\([0-9]*\).*/\1/'`
129 # GNU autotools; they're provided with releases up to Snow Leopard, but
130 # not in later releases.
132 if [[ $DARWIN_MAJOR_VERSION -gt 10 ]]; then
133 AUTOCONF_VERSION=2.69
134 AUTOMAKE_VERSION=1.13.3
135 LIBTOOL_VERSION=2.4.2
139 if [ -d macosx-support-libs ]
141 cd macosx-support-libs
144 # Uninstall items in the reverse order from the order in which they're
145 # installed. Only uninstall if the download/build/install process
146 # completed; uninstall the version that appears in the name of
149 # We also do a "make distclean", so that we don't have leftovers from
150 # old configurations.
153 installed_cares_version=`ls cares-*-done 2>/dev/null | sed 's/cares-\(.*\)-done/\1/'`
154 if [ ! -z "$installed_cares_version" ] ; then
155 echo "Uninstalling C-Ares API:"
156 cd cares-$installed_cares_version
157 $DO_MAKE_UNINSTALL || exit 1
158 make distclean || exit 1
160 rm cares-$installed_cares_version-done
163 installed_geoip_version=`ls geoip-*-done 2>/dev/null | sed 's/geoip-\(.*\)-done/\1/'`
164 if [ ! -z "$installed_geoip_version" ] ; then
165 echo "Uninstalling GeoIP API:"
166 cd GeoIP-$installed_geoip_version
167 $DO_MAKE_UNINSTALL || exit 1
168 make distclean || exit 1
170 rm geoip-$installed_geoip_version-done
173 if [ "$PORTAUDIO_VERSION" -a -f portaudio-done ] ; then
174 echo "Uninstalling PortAudio:"
176 $DO_MAKE_UNINSTALL || exit 1
177 make distclean || exit 1
182 installed_lua_version=`ls lua-*-done 2>/dev/null | sed 's/lua-\(.*\)-done/\1/'`
183 if [ ! -z "$installed_lua_version" ] ; then
184 echo "Uninstalling Lua:"
186 # Lua has no "make uninstall", so just remove stuff manually.
187 # There's no configure script, so there's no need for
188 # "make distclean", either; just do "make clean".
190 (cd /usr/local/bin; $DO_RM -f lua luac)
191 (cd /usr/local/include; $DO_RM -f lua.h luaconf.h lualib.h lauxlib.h lua.hpp)
192 (cd /usr/local/lib; $DO_RM -f liblua.a)
193 (cd /usr/local/man/man1; $DO_RM -f lua.1 luac.1)
194 cd lua-$installed_lua_version
197 rm lua-$installed_lua_version-done
200 installed_gnutls_version=`ls gnutls-*-done 2>/dev/null | sed 's/gnutls-\(.*\)-done/\1/'`
201 if [ ! -z "$installed_gnutls_version" ] ; then
202 echo "Uninstalling GnuTLS:"
203 cd gnutls-$installed_gnutls_version
204 $DO_MAKE_UNINSTALL || exit 1
205 make distclean || exit 1
207 rm gnutls-$installed_gnutls_version-done
210 installed_libgcrypt_version=`ls libgcrypt-*-done 2>/dev/null | sed 's/libgcrypt-\(.*\)-done/\1/'`
211 if [ ! -z "$installed_libgcrypt_version" ] ; then
212 echo "Uninstalling libgcrypt:"
213 cd libgcrypt-$installed_libgcrypt_version
214 $DO_MAKE_UNINSTALL || exit 1
215 make distclean || exit 1
217 rm libgcrypt-$installed_libgcrypt_version-done
220 installed_libgpg_error_version=`ls libgpg-error-*-done 2>/dev/null | sed 's/libgpg-error-\(.*\)-done/\1/'`
221 if [ ! -z "$installed_libgpg_error_version" ] ; then
222 echo "Uninstalling libgpg-error:"
223 cd libgpg-error-$installed_libgpg_error_version
224 $DO_MAKE_UNINSTALL || exit 1
225 make distclean || exit 1
227 rm libgpg-error-$installed_libgpg_error_version-done
230 installed_libsmi_version=`ls libsmi-*-done 2>/dev/null | sed 's/libsmi-\(.*\)-done/\1/'`
231 if [ ! -z "$installed_libsmi_version" ] ; then
232 echo "Uninstalling libsmi:"
233 cd libsmi-$installed_libsmi_version
234 $DO_MAKE_UNINSTALL || exit 1
235 make distclean || exit 1
237 rm libsmi-$installed_libsmi_version-done
240 installed_gtk_version=`ls gtk+-*-done 2>/dev/null | sed 's/gtk+-\(.*\)-done/\1/'`
241 if [ ! -z "$installed_gtk_version" ] ; then
242 echo "Uninstalling GTK+:"
243 cd gtk+-$installed_gtk_version
244 $DO_MAKE_UNINSTALL || exit 1
245 make distclean || exit 1
247 rm gtk+-$installed_gtk_version-done
250 installed_gdk_pixbuf_version=`ls gdk-pixbuf-*-done 2>/dev/null | sed 's/gdk-pixbuf-\(.*\)-done/\1/'`
251 if [ ! -z "$installed_gdk_pixbuf_version" ] ; then
252 echo "Uninstalling gdk-pixbuf:"
253 cd gdk-pixbuf-$installed_gdk_pixbuf_version
254 $DO_MAKE_UNINSTALL || exit 1
255 make distclean || exit 1
257 rm gdk-pixbuf-$installed_gdk_pixbuf_version-done
260 installed_pango_version=`ls pango-*-done 2>/dev/null | sed 's/pango-\(.*\)-done/\1/'`
261 if [ ! -z "$installed_pango_version" ] ; then
262 echo "Uninstalling Pango:"
263 cd pango-$installed_pango_version
264 $DO_MAKE_UNINSTALL || exit 1
265 make distclean || exit 1
267 rm pango-$installed_pango_version-done
270 installed_atk_version=`ls atk-*-done 2>/dev/null | sed 's/atk-\(.*\)-done/\1/'`
271 if [ ! -z "$installed_atk_version" ] ; then
272 echo "Uninstalling ATK:"
273 cd atk-$installed_atk_version
274 $DO_MAKE_UNINSTALL || exit 1
275 make distclean || exit 1
277 rm atk-$installed_atk_version-done
280 installed_cairo_version=`ls cairo-*-done 2>/dev/null | sed 's/cairo-\(.*\)-done/\1/'`
281 if [ ! -z "$installed_cairo_version" ] ; then
282 echo "Uninstalling Cairo:"
283 cd cairo-$installed_cairo_version
284 $DO_MAKE_UNINSTALL || exit 1
285 make distclean || exit 1
287 rm cairo-$installed_cairo_version-done
290 installed_pixman_version=`ls pixman-*-done 2>/dev/null | sed 's/pixman-\(.*\)-done/\1/'`
291 if [ ! -z "$installed_pixman_version" ] ; then
292 echo "Uninstalling pixman:"
293 cd pixman-$installed_pixman_version
294 $DO_MAKE_UNINSTALL || exit 1
295 make distclean || exit 1
297 rm pixman-$installed_pixman_version-done
300 installed_libpng_version=`ls libpng-*-done 2>/dev/null | sed 's/libpng-\(.*\)-done/\1/'`
301 if [ ! -z "$installed_libpng_version" ] ; then
302 echo "Uninstalling libpng:"
303 cd libpng-$installed_libpng_version
304 $DO_MAKE_UNINSTALL || exit 1
305 make distclean || exit 1
307 rm libpng-$installed_libpng_version-done
310 installed_qt_version=`ls qt-*-done 2>/dev/null | sed 's/qt-\(.*\)-done/\1/'`
311 if [ ! -z "$installed_qt_version" ] ; then
312 echo "Uninstalling Qt:"
313 cd qt-everywhere-opensource-src-$installed_qt_version
314 $DO_MAKE_UNINSTALL || exit 1
316 # XXX - "make distclean" doesn't work. qmake sure does a
317 # good job of constructing Makefiles that work correctly....
319 #make distclean || exit 1
321 rm qt-$installed_qt_version-done
324 installed_glib_version=`ls glib-*-done 2>/dev/null | sed 's/glib-\(.*\)-done/\1/'`
325 if [ ! -z "$installed_glib_version" ] ; then
326 echo "Uninstalling GLib:"
327 cd glib-$installed_glib_version
328 $DO_MAKE_UNINSTALL || exit 1
329 make distclean || exit 1
331 rm glib-$installed_glib_version-done
334 installed_pkg_config_version=`ls pkg-config-*-done 2>/dev/null | sed 's/pkg-config-\(.*\)-done/\1/'`
335 if [ ! -z "$installed_pkg_config_version" ] ; then
336 echo "Uninstalling pkg-config:"
337 cd pkg-config-$installed_pkg_config_version
338 $DO_MAKE_UNINSTALL || exit 1
339 make distclean || exit 1
341 rm pkg-config-$installed_pkg_config_version-done
344 installed_gettext_version=`ls gettext-*-done 2>/dev/null | sed 's/gettext-\(.*\)-done/\1/'`
345 if [ ! -z "$installed_gettext_version" ] ; then
346 echo "Uninstalling GNU gettext:"
347 cd gettext-$installed_gettext_version
348 $DO_MAKE_UNINSTALL || exit 1
349 make distclean || exit 1
351 rm gettext-$installed_gettext_version-done
354 installed_cmake_version=`ls cmake-*-done 2>/dev/null | sed 's/cmake-\(.*\)-done/\1/'`
355 if [ ! -z "$installed_cmake_version" ]; then
356 echo "Uninstalling CMake:"
357 cd cmake-$installed_cmake_version
358 $DO_MAKE_UNINSTALL || exit 1
359 make distclean || exit 1
361 rm cmake-$installed_cmake_version-done
364 installed_libtool_version=`ls libtool-*-done 2>/dev/null | sed 's/libtool-\(.*\)-done/\1/'`
365 if [ ! -z "$installed_libtool_version" ] ; then
366 echo "Uninstalling GNU libtool:"
367 cd libtool-$installed_libtool_version
368 mv /usr/local/bin/glibtool /usr/local/bin/libtool
369 mv /usr/local/bin/glibtoolize /usr/local/bin/libtoolize
370 $DO_MAKE_UNINSTALL || exit 1
371 make distclean || exit 1
373 rm libtool-$installed_libtool_version-done
376 installed_automake_version=`ls automake-*-done 2>/dev/null | sed 's/automake-\(.*\)-done/\1/'`
377 if [ ! -z "$installed_automake_version" ] ; then
378 echo "Uninstalling GNU automake:"
379 cd automake-$installed_automake_version
380 $DO_MAKE_UNINSTALL || exit 1
381 make distclean || exit 1
383 rm automake-$installed_automake_version-done
386 installed_autoconf_version=`ls autoconf-*-done 2>/dev/null | sed 's/autoconf-\(.*\)-done/\1/'`
387 if [ ! -z "$installed_autoconf_version" ] ; then
388 echo "Uninstalling GNU autoconf:"
389 cd autoconf-$installed_autoconf_version
390 $DO_MAKE_UNINSTALL || exit 1
391 make distclean || exit 1
393 rm autoconf-$installed_autoconf_version-done
396 installed_xz_version=`ls xz-*-done 2>/dev/null | sed 's/xz-\(.*\)-done/\1/'`
397 if [ ! -z "$installed_xz_version" ] ; then
398 echo "Uninstalling xz:"
399 cd xz-$installed_xz_version
400 $DO_MAKE_UNINSTALL || exit 1
401 make distclean || exit 1
403 rm xz-$installed_xz_version-done
409 # Do we have permission to write in /usr/local?
411 # If so, assume we have permission to write in its subdirectories.
412 # (If that's not the case, this test needs to check the subdirectories
415 # If not, do "make install", "make uninstall", and the removes for Lua
420 DO_MAKE_INSTALL="make install"
421 DO_MAKE_UNINSTALL="make uninstall"
424 DO_MAKE_INSTALL="sudo make install"
425 DO_MAKE_UNINSTALL="sudo make uninstall"
430 # If we have SDKs available, the default target OS is the major version
431 # of the one we're running; get that and strip off the third component.
433 for i in /Developer/SDKs \
434 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
435 /Library/Developer/CommandLineTools/SDKs
439 min_osx_target=`sw_vers -productVersion | sed 's/\([[0-9]]*\).\([[0-9]]*\).[[0-9]]*/\1.\2/'`
445 # Parse command-line flags:
448 # -t <target> - build libraries so that they'll work on the specified
449 # version of OS X and later versions.
450 # -u - do an uninstall.
452 while getopts ht:u name
459 min_osx_target="$OPTARG"
462 echo "Usage: macosx-setup.sh [ -t <target> ] [ -u ]" 1>&1
468 if [ "$do_uninstall" = "yes" ]
475 # Configure scripts tend to set CFLAGS and CXXFLAGS to "-g -O2" if
476 # invoked without CFLAGS or CXXFLAGS being set in the environment.
478 # However, we *are* setting them in the environment, for our own
479 # nefarious purposes, so start them out as "-g -O2".
485 # To make this work on Leopard (rather than working *on* Snow Leopard
486 # when building *for* Leopard) will take more work.
488 # For one thing, Leopard's /usr/X11/lib/libXdamage.la claims, at least
489 # with all software updates applied, that the Xdamage shared library
490 # is libXdamage.1.0.0.dylib, but it is, in fact, libXdamage.1.1.0.dylib.
491 # This causes problems when building GTK+, so the script would have to
494 if [[ $DARWIN_MAJOR_VERSION -le 9 ]]; then
495 echo "This script does not support any versions of OS X before Snow Leopard" 1>&2
499 # if no make options are present, set default options
500 if [ -z "$MAKE_BUILD_OPTS" ] ; then
501 # by default use 1.5x number of cores for parallel build
502 MAKE_BUILD_OPTS="-j $(( $(sysctl -n hw.logicalcpu) * 3 / 2))"
506 # If we have a target release, look for its SDK, and build libraries
507 # against it rather than against the headers and, more importantly,
508 # libraries that come with the OS, so that we don't end up with
509 # support libraries that only work on the OS version on which
510 # we built them, not earlier versions of the same release, or
511 # earlier releases if the minimum is earlier.
513 if [ ! -z "$min_osx_target" ]
515 for i in /Developer/SDKs \
516 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
517 /Library/Developer/CommandLineTools/SDKs
519 if [ -d "$i"/"MacOSX$min_osx_target.sdk" ]
521 SDKPATH="$i"/"MacOSX$min_osx_target.sdk"
528 echo "macosx-setup.sh: Couldn't find the SDK for OS X $min_osx_target" 1>&2
533 # Make sure there are links to /usr/local/include and /usr/local/lib
534 # in the SDK's usr/local.
536 if [ ! -e $SDKPATH/usr/local/include ]
538 if [ ! -d $SDKPATH/usr/local ]
540 sudo mkdir $SDKPATH/usr/local
542 sudo ln -s /usr/local/include $SDKPATH/usr/local/include
544 if [ ! -e $SDKPATH/usr/local/lib ]
546 if [ ! -d $SDKPATH/usr/local ]
548 sudo mkdir $SDKPATH/usr/local
550 sudo ln -s /usr/local/lib $SDKPATH/usr/local/lib
554 # Set the minimum OS version for which to build to the specified
555 # minimum target OS version, so we don't, for example, end up using
556 # linker features supported by the OS verson on which we're building
557 # but not by the target version.
559 VERSION_MIN_FLAGS="-mmacosx-version-min=$min_osx_target"
562 # Compile and link against the SDK.
564 SDKFLAGS="-isysroot $SDKPATH"
566 if [[ "$min_osx_target" == "10.5" ]]
569 # Cairo is part of Mac OS X 10.6 and later.
570 # The *headers* are supplied by 10.5, but the *libraries*
571 # aren't, so we have to build it if we're building for 10.5.
573 cairo_not_in_the_os=yes
576 # Build with older versions of the support libraries, as
577 # were used on the Wireshark Leopard buildbot at one
578 # point. (Most of these versions come from the About page
579 # from Wireshark 1.8.6, the last build done on that buildbot;
580 # the ATK version isn't reported, so this is a guess.)
582 # If you want to try building with newer versions of
583 # the libraries, note that:
585 # The version of fontconfig that comes with Leopard doesn't
586 # support FC_WEIGHT_EXTRABLACK, so we can't use any version
587 # of Pango newer than 1.22.4.
589 # However, Pango 1.22.4 doesn't work with versions of GLib
590 # after 2.29.6, because Pango 1.22.4 uses G_CONST_RETURN and
591 # GLib 2.29.8 and later deprecate it (there doesn't appear to
592 # be a GLib 2.29.7). That means we'd either have to patch
593 # Pango not to use it (just use "const"; G_CONST_RETURN was
594 # there to allow code to choose whether to use "const" or not),
595 # or use GLib 2.29.6 or earlier.
597 # GLib 2.29.6 includes an implementation of g_bit_lock() that,
598 # on x86 (32-bit and 64-bit), uses asms in a fashion
599 # ("asm volatile goto") that requires GCC 4.5 or later, which
600 # is later than the compilers that come with Leopard and Snow
601 # Leopard. Recent versions of GLib check for that, but 2.29.6
602 # doesn't, so, if you want to build GLib 2.29.6 on Leopard or
603 # Snow Leopard, you would have to patch glib/gbitlock.c to do
604 # what the newer versions of GLib do:
606 # define a USE_ASM_GOTO macro that indicates whether "asm goto"
608 # #if (defined (i386) || defined (__amd64__))
609 # #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
610 # #define USE_ASM_GOTO 1
614 # replace all occurrences of
616 # #if defined (__GNUC__) && (defined (i386) || defined (__amd64__))
620 # #ifdef USE_ASM_GOTO
622 # Using GLib 2.29.6 or earlier, however, means that we can't
623 # use a version of ATK later than 2.3.93, as those versions
624 # don't work with GLib 2.29.6. The same applies to gdk-pixbuf;
625 # versions of gdk-pixbuf after 2.24.1 won't work with GLib
628 # Then you have to make sure that what you've build doesn't
629 # cause the X server that comes with Leopard to crash; at
630 # least one attempt at building for Leopard did.
632 # At least if building on Leopard, you might also find
633 # that, with various older versions of Cairo, including
634 # 1.6.4 and at least some 1.8.x versions, when you try to
635 # build it, the build fails because it can't find
636 # png_set_longjmp_fn(). I vaguely remember dealing with that,
637 # ages ago, but don't remember what I did.
646 # That version of GTK+ includes gdk-pixbuf.
647 # XXX - base this on the version of GTK+ requested.
652 # Libgcrypt 1.5.0 fails to compile due to some problem with an
653 # asm in rijndael.c, at least with i686-apple-darwin10-gcc-4.2.1
654 # (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) when building
657 # We try libgcrypt 1.4.3 instead, as that's what shows up in
658 # the version from the Leopard buildbot.
659 LIBGCRYPT_VERSION=1.4.3
662 # Build 32-bit while we're at it; Leopard has a bug that
663 # causes some BPF functions not to work with 64-bit userland
664 # code, so capturing won't work.
666 CFLAGS="$CFLAGS -arch i386"
667 CXXFLAGS="$CXXFLAGS -arch i386"
668 export LDFLAGS="$LDFLAGS -arch i386"
676 # You need Xcode or the command-line tools installed to get the compilers.
678 if [ ! -x /usr/bin/xcodebuild ]; then
679 echo "Please install Xcode first (should be available on DVD or from http://developer.apple.com/xcode/index.php)."
683 if [ "$QT_VERSION" ]; then
685 # We need Xcode, not just the command-line tools, installed to build
688 if ! /usr/bin/xcrun -find xcrun >/dev/null 2>&1; then
689 echo "Please install Xcode first (should be available on DVD or from http://developer.apple.com/xcode/index.php)."
690 echo "The command-line build tools are not sufficient to build Qt."
694 if [ "$GTK_VERSION" ]; then
696 # If we're building with GTK+, you also need the X11 SDK; with at least
697 # some versions of OS X and Xcode, that is, I think, an optional install.
698 # (Or it might be installed with X11, but I think *that* is an optional
699 # install on at least some versions of OS X.)
701 if [ ! -d /usr/X11/include ]; then
702 echo "Please install X11 and the X11 SDK first."
707 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig
710 # Do all the downloads and untarring in a subdirectory, so all that
711 # stuff can be removed once we've installed the support libraries.
713 if [ ! -d macosx-support-libs ]
715 mkdir macosx-support-libs || exit 1
717 cd macosx-support-libs
719 # Start with xz: It is the sole download format of glib later than 2.31.2
721 if [ "$XZ_VERSION" -a ! -f xz-$XZ_VERSION-done ] ; then
722 echo "Downloading, building, and installing xz:"
723 [ -f xz-$XZ_VERSION.tar.bz2 ] || curl -O http://tukaani.org/xz/xz-$XZ_VERSION.tar.bz2 || exit 1
724 bzcat xz-$XZ_VERSION.tar.bz2 | tar xf - || exit 1
726 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0" ./configure || exit 1
727 make $MAKE_BUILD_OPTS || exit 1
728 $DO_MAKE_INSTALL || exit 1
730 touch xz-$XZ_VERSION-done
733 if [ "$AUTOCONF_VERSION" -a ! -f autoconf-$AUTOCONF_VERSION-done ] ; then
734 echo "Downloading, building and installing GNU autoconf..."
735 [ -f autoconf-$AUTOCONF_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/autoconf/autoconf-$AUTOCONF_VERSION.tar.xz || exit 1
736 xzcat autoconf-$AUTOCONF_VERSION.tar.xz | tar xf - || exit 1
737 cd autoconf-$AUTOCONF_VERSION
738 ./configure || exit 1
739 make $MAKE_BUILD_OPTS || exit 1
740 $DO_MAKE_INSTALL || exit 1
742 touch autoconf-$AUTOCONF_VERSION-done
745 if [ "$AUTOMAKE_VERSION" -a ! -f automake-$AUTOMAKE_VERSION-done ] ; then
746 echo "Downloading, building and installing GNU automake..."
747 [ -f automake-$AUTOMAKE_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/automake/automake-$AUTOMAKE_VERSION.tar.xz || exit 1
748 xzcat automake-$AUTOMAKE_VERSION.tar.xz | tar xf - || exit 1
749 cd automake-$AUTOMAKE_VERSION
750 ./configure || exit 1
751 make $MAKE_BUILD_OPTS || exit 1
752 $DO_MAKE_INSTALL || exit 1
754 touch automake-$AUTOMAKE_VERSION-done
757 if [ "$LIBTOOL_VERSION" -a ! -f libtool-$LIBTOOL_VERSION-done ] ; then
758 echo "Downloading, building and installing GNU libtool..."
759 [ -f libtool-$LIBTOOL_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/libtool/libtool-$LIBTOOL_VERSION.tar.xz || exit 1
760 xzcat libtool-$LIBTOOL_VERSION.tar.xz | tar xf - || exit 1
761 cd libtool-$LIBTOOL_VERSION
762 ./configure || exit 1
763 make $MAKE_BUILD_OPTS || exit 1
764 $DO_MAKE_INSTALL || exit 1
765 mv /usr/local/bin/libtool /usr/local/bin/glibtool
766 mv /usr/local/bin/libtoolize /usr/local/bin/glibtoolize
768 touch libtool-$LIBTOOL_VERSION-done
771 if [ -n "$CMAKE" -a ! -f cmake-$CMAKE_VERSION-done ]; then
772 echo "Downloading, building, and installing CMAKE:"
773 cmake_dir=`expr $CMAKE_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
774 [ -f cmake-$CMAKE_VERSION.tar.gz ] || curl -O http://www.cmake.org/files/v$cmake_dir/cmake-$CMAKE_VERSION.tar.gz || exit 1
775 gzcat cmake-$CMAKE_VERSION.tar.gz | tar xf - || exit 1
776 cd cmake-$CMAKE_VERSION
777 ./bootstrap || exit 1
778 make $MAKE_BUILD_OPTS || exit 1
779 $DO_MAKE_INSTALL || exit 1
781 touch cmake-$CMAKE_VERSION-done
785 # Start with GNU gettext; GLib requires it, and OS X doesn't have it
786 # or a BSD-licensed replacement.
788 # At least on Lion with Xcode 4, _FORTIFY_SOURCE gets defined as 2
789 # by default, which causes, for example, stpncpy to be defined as
790 # a hairy macro that collides with the GNU gettext configure script's
791 # attempts to workaround AIX's lack of a declaration for stpncpy,
792 # with the result being a huge train wreck. Define _FORTIFY_SOURCE
793 # as 0 in an attempt to keep the trains on separate tracks.
795 if [ ! -f gettext-$GETTEXT_VERSION-done ] ; then
796 echo "Downloading, building, and installing GNU gettext:"
797 [ -f gettext-$GETTEXT_VERSION.tar.gz ] || curl -O http://ftp.gnu.org/pub/gnu/gettext/gettext-$GETTEXT_VERSION.tar.gz || exit 1
798 gzcat gettext-$GETTEXT_VERSION.tar.gz | tar xf - || exit 1
799 cd gettext-$GETTEXT_VERSION
800 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0 $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
801 make $MAKE_BUILD_OPTS || exit 1
802 $DO_MAKE_INSTALL || exit 1
804 touch gettext-$GETTEXT_VERSION-done
808 # GLib depends on pkg-config.
809 # By default, pkg-config depends on GLib; we break the dependency cycle
810 # by configuring pkg-config to use its own internal version of GLib.
812 if [ ! -f pkg-config-$PKG_CONFIG_VERSION-done ] ; then
813 echo "Downloading, building, and installing pkg-config:"
814 [ -f pkg-config-$PKG_CONFIG_VERSION.tar.gz ] || curl -O http://pkgconfig.freedesktop.org/releases/pkg-config-$PKG_CONFIG_VERSION.tar.gz || exit 1
815 gzcat pkg-config-$PKG_CONFIG_VERSION.tar.gz | tar xf - || exit 1
816 cd pkg-config-$PKG_CONFIG_VERSION
817 ./configure --with-internal-glib || exit 1
818 make $MAKE_BUILD_OPTS || exit 1
819 $DO_MAKE_INSTALL || exit 1
821 touch pkg-config-$PKG_CONFIG_VERSION-done
824 if [ ! -f glib-$GLIB_VERSION-done ] ; then
825 echo "Downloading, building, and installing GLib:"
826 glib_dir=`expr $GLIB_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
827 GLIB_MAJOR_VERSION="`expr $GLIB_VERSION : '\([0-9][0-9]*\).*'`"
828 GLIB_MINOR_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
829 GLIB_DOTDOT_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
830 if [[ $GLIB_MAJOR_VERSION -gt 2 ||
831 $GLIB_MINOR_VERSION -gt 28 ||
832 ($GLIB_MINOR_VERSION -eq 28 && $GLIB_DOTDOT_VERSION -ge 8) ]]
835 # Starting with GLib 2.28.8, xz-compressed tarballs are available.
837 [ -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
838 xzcat glib-$GLIB_VERSION.tar.xz | tar xf - || exit 1
840 [ -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
841 bzcat glib-$GLIB_VERSION.tar.bz2 | tar xf - || exit 1
843 cd glib-$GLIB_VERSION
845 # OS X ships with libffi, but doesn't provide its pkg-config file;
846 # explicitly specify LIBFFI_CFLAGS and LIBFFI_LIBS, so the configure
847 # script doesn't try to use pkg-config to get the appropriate
848 # C flags and loader flags.
850 # And, what's worse, at least with the version of Xcode that comes
851 # with Leopard, /usr/include/ffi/fficonfig.h doesn't define MACOSX,
852 # which causes the build of GLib to fail. If we don't find
853 # "#define.*MACOSX" in /usr/include/ffi/fficonfig.h, explicitly
856 # While we're at it, suppress -Wformat-nonliteral to avoid a case
857 # where clang's stricter rules on when not to complain about
858 # non-literal format arguments cause it to complain about code
859 # that's safe but it wasn't told that. See my comment #25 in
862 # https://bugzilla.gnome.org/show_bug.cgi?id=691608#c25
864 # First, determine where the system include files are. (It's not
865 # necessarily /usr/include.) There's a bit of a greasy hack here;
866 # pre-5.x versions of the developer tools don't support the
867 # --show-sdk-path option, and will produce no output, so includedir
868 # will be set to /usr/include (in those older versions of the
869 # developer tools, there is a /usr/include directory).
871 includedir=`xcrun --show-sdk-path 2>/dev/null`/usr/include
872 if grep -qs '#define.*MACOSX' $includedir/ffi/fficonfig.h
874 # It's defined, nothing to do
875 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
877 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
881 # Apply the fix to GNOME bug 529806:
883 # https://bugzilla.gnome.org/show_bug.cgi?id=529806
885 # if we have a version of GLib prior to 2.30.
887 if [[ $GLIB_MAJOR_VERSION -eq 2 && $GLIB_MINOR_VERSION -le 30 ]]
889 patch -p0 <../../macosx-support-lib-patches/glib-gconvert.c.patch || exit 1
891 make $MAKE_BUILD_OPTS || exit 1
892 $DO_MAKE_INSTALL || exit 1
894 touch glib-$GLIB_VERSION-done
898 # Now we have reached a point where we can build everything but
899 # the GUI (Wireshark).
901 if [ "$QT_VERSION" -a ! -f qt-$QT_VERSION-done ]; then
902 echo "Downloading, building, and installing Qt:"
903 QT_MAJOR_VERSION="`expr $QT_VERSION : '\([0-9][0-9]*\).*'`"
904 QT_MINOR_VERSION="`expr $QT_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
905 QT_DOTDOT_VERSION="`expr $QT_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
906 QT_MAJOR_MINOR_VERSION=$QT_MAJOR_VERSION.$QT_MINOR_VERSION
908 # What you get for this URL might just be a 302 Found reply, so use
909 # -L so we get redirected.
911 curl -L -O http://download.qt-project.org/official_releases/qt/$QT_MAJOR_MINOR_VERSION/$QT_VERSION/single/qt-everywhere-opensource-src-$QT_VERSION.tar.gz
913 # Qt 5.1.x sets QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
914 # in qtbase/mkspecs/$TARGET_PLATFORM/qmake.conf
915 # We may need to adjust this manually in the future.
917 # The -no-c++11 flag is needed to work around
918 # https://bugreports.qt-project.org/browse/QTBUG-30487
920 tar xf qt-everywhere-opensource-src-$QT_VERSION.tar.gz
921 cd qt-everywhere-opensource-src-$QT_VERSION
923 # We don't build Qt in its Full Shining Glory, as we don't need all
924 # of its components, and it takes *forever* to build in that form.
926 # Qt 5.2.0 beta1 fails to build on OS X without -no-xcb due to bug
929 # Qt 5.x fails to build on OS X with -no-opengl due to bug
932 ./configure -v -sdk macosx$min_osx_target -platform $TARGET_PLATFORM \
933 -opensource -confirm-license -no-c++11 -no-dbus \
934 -no-sql-sqlite -no-xcb -nomake examples \
935 -skip qtdoc -skip qtquickcontrols -skip qtwebkit \
936 -skip qtwebkit-examples -skip qtxmlpatterns
938 $DO_MAKE_INSTALL || exit 1
940 touch qt-$QT_VERSION-done
943 if [ "$GTK_VERSION" ]; then
945 # GTK+ 3 requires a newer Cairo build than the one that comes with
946 # 10.6, so we build Cairo if we are using GTK+ 3.
948 # In 10.6 and 10.7, it's an X11 library; if we build with "native" GTK+
949 # rather than X11 GTK+, we might have to build and install Cairo.
950 # In 10.8 and later, there is no X11, but it's included in Xquartz;
951 # again, if we build with "native" GTK+, we'd have to build and install
954 if [[ "$GTK_MAJOR_VERSION" -eq 3 || "$cairo_not_in_the_os" = yes ]]; then
956 # Requirements for Cairo first
958 # The libpng that comes with the X11 for Leopard has a bogus
959 # pkg-config file that lies about where the header files are,
960 # which causes other packages not to be able to find its
963 # The libpng in later versions is not what the version of
964 # libpixman we build below wants - it wants libpng15.
966 if [ ! -f libpng-$PNG_VERSION-done ] ; then
967 echo "Downloading, building, and installing libpng:"
969 # The FTP site puts libpng x.y.* into a libpngxy directory.
971 subdir=`echo $PNG_VERSION | sed 's/\([1-9][0-9]*\)\.\([1-9][0-9]*\).*/libpng\1\2'/`
972 [ -f libpng-$PNG_VERSION.tar.xz ] || curl -O ftp://ftp.simplesystems.org/pub/libpng/png/src/$subdir/libpng-$PNG_VERSION.tar.xz
973 xzcat libpng-$PNG_VERSION.tar.xz | tar xf - || exit 1
974 cd libpng-$PNG_VERSION
975 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
976 make $MAKE_BUILD_OPTS || exit 1
977 $DO_MAKE_INSTALL || exit 1
979 touch libpng-$PNG_VERSION-done
983 # The libpixman versions that come with the X11s for Leopard,
984 # Snow Leopard, and Lion is too old to support Cairo's image
985 # surface backend feature (which requires pixman-1 >= 0.22.0).
987 # XXX - what about the one that comes with the latest version
990 if [ ! -f pixman-$PIXMAN_VERSION-done ] ; then
991 echo "Downloading, building, and installing pixman:"
992 [ -f pixman-$PIXMAN_VERSION.tar.gz ] || curl -O http://www.cairographics.org/releases/pixman-$PIXMAN_VERSION.tar.gz
993 gzcat pixman-$PIXMAN_VERSION.tar.gz | tar xf - || exit 1
994 cd pixman-$PIXMAN_VERSION
995 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
996 make V=1 $MAKE_BUILD_OPTS || exit 1
997 $DO_MAKE_INSTALL || exit 1
999 touch pixman-$PIXMAN_VERSION-done
1003 # And now Cairo itself.
1004 # XXX - with the libxcb that comes with 10.6,
1006 # xcb_discard_reply() is missing, and the build fails.
1008 if [ ! -f cairo-$CAIRO_VERSION-done ] ; then
1009 echo "Downloading, building, and installing Cairo:"
1010 CAIRO_MAJOR_VERSION="`expr $CAIRO_VERSION : '\([0-9][0-9]*\).*'`"
1011 CAIRO_MINOR_VERSION="`expr $CAIRO_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
1012 CAIRO_DOTDOT_VERSION="`expr $CAIRO_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
1013 if [[ $CAIRO_MAJOR_VERSION -gt 1 ||
1014 $CAIRO_MINOR_VERSION -gt 12 ||
1015 ($CAIRO_MINOR_VERSION -eq 12 && $CAIRO_DOTDOT_VERSION -ge 2) ]]
1018 # Starting with Cairo 1.12.2, the tarballs are compressed with
1019 # xz rather than gzip.
1021 [ -f cairo-$CAIRO_VERSION.tar.xz ] || curl -O http://cairographics.org/releases/cairo-$CAIRO_VERSION.tar.xz || exit 1
1022 xzcat cairo-$CAIRO_VERSION.tar.xz | tar xf - || exit 1
1024 [ -f cairo-$CAIRO_VERSION.tar.gz ] || curl -O http://cairographics.org/releases/cairo-$CAIRO_VERSION.tar.gz || exit 1
1025 gzcat cairo-$CAIRO_VERSION.tar.gz | tar xf - || exit 1
1027 cd cairo-$CAIRO_VERSION
1028 # CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-quartz=no || exit 1
1029 # Maybe follow http://cairographics.org/end_to_end_build_for_mac_os_x/
1030 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-quartz=yes || exit 1
1032 # We must avoid the version of libpng that comes with X11; the
1033 # only way I've found to force that is to forcibly set INCLUDES
1034 # when we do the build, so that this comes before CAIRO_CFLAGS,
1035 # which has -I/usr/X11/include added to it before anything
1036 # connected to libpng is.
1038 INCLUDES="-I/usr/local/include/libpng15" make $MAKE_BUILD_OPTS || exit 1
1039 $DO_MAKE_INSTALL || exit 1
1041 touch cairo-$CAIRO_VERSION-done
1045 if [ ! -f atk-$ATK_VERSION-done ] ; then
1046 echo "Downloading, building, and installing ATK:"
1047 atk_dir=`expr $ATK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
1048 ATK_MAJOR_VERSION="`expr $ATK_VERSION : '\([0-9][0-9]*\).*'`"
1049 ATK_MINOR_VERSION="`expr $ATK_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
1050 ATK_DOTDOT_VERSION="`expr $ATK_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
1051 if [[ $ATK_MAJOR_VERSION -gt 2 ||
1052 ($ATK_MAJOR_VERSION -eq 2 && $ATK_MINOR_VERSION -gt 0) ||
1053 ($ATK_MANOR_VERSION -eq 2 && $ATK_MINOR_VERSION -eq 0 && $ATK_DOTDOT_VERSION -ge 1) ]]
1056 # Starting with ATK 2.0.1, xz-compressed tarballs are available.
1058 [ -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
1059 xzcat atk-$ATK_VERSION.tar.xz | tar xf - || exit 1
1061 [ -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
1062 bzcat atk-$ATK_VERSION.tar.bz2 | tar xf - || exit 1
1065 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1066 make $MAKE_BUILD_OPTS || exit 1
1067 $DO_MAKE_INSTALL || exit 1
1069 touch atk-$ATK_VERSION-done
1072 if [ ! -f pango-$PANGO_VERSION-done ] ; then
1073 echo "Downloading, building, and installing Pango:"
1074 pango_dir=`expr $PANGO_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
1075 PANGO_MAJOR_VERSION="`expr $PANGO_VERSION : '\([0-9][0-9]*\).*'`"
1076 PANGO_MINOR_VERSION="`expr $PANGO_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
1077 if [[ $PANGO_MAJOR_VERSION -gt 1 ||
1078 $PANGO_MINOR_VERSION -ge 29 ]]
1081 # Starting with Pango 1.29, the tarballs are compressed with
1082 # xz rather than bzip2.
1084 [ -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
1085 xzcat pango-$PANGO_VERSION.tar.xz | tar xf - || exit 1
1087 [ -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
1088 bzcat pango-$PANGO_VERSION.tar.bz2 | tar xf - || exit 1
1090 cd pango-$PANGO_VERSION
1091 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1092 make $MAKE_BUILD_OPTS || exit 1
1093 $DO_MAKE_INSTALL || exit 1
1095 touch pango-$PANGO_VERSION-done
1098 if [ "$GDK_PIXBUF_VERSION" -a ! -f gdk-pixbuf-$GDK_PIXBUF_VERSION-done ] ; then
1099 echo "Downloading, building, and installing gdk-pixbuf:"
1100 gdk_pixbuf_dir=`expr $GDK_PIXBUF_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
1101 [ -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
1102 xzcat gdk-pixbuf-$GDK_PIXBUF_VERSION.tar.xz | tar xf - || exit 1
1103 cd gdk-pixbuf-$GDK_PIXBUF_VERSION
1105 # If we're building for 10.6, use libpng12; if you have 10.7.5, including
1106 # X11, and Xcode 4.3.3, the system has libpng15, complete with pkg-config
1107 # files, as part of X11, but 10.6's X11 has only libpng12, and the 10.6
1108 # SDK in Xcode 4.3.3 also has only libpng12, and has no pkg-config files
1109 # of its own, so we have to explicitly set LIBPNG to override the
1110 # configure script, and also force the CFLAGS to look for the header
1111 # files for libpng12 (note that -isysroot doesn't affect the arguments
1112 # to -I, so we need to include the SDK path explicitly).
1114 if [[ "$min_osx_target" = 10.6 ]]
1116 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
1118 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --without-libtiff --without-libjpeg || exit 1
1120 make $MAKE_BUILD_OPTS || exit 1
1121 $DO_MAKE_INSTALL || exit 1
1123 touch gdk-pixbuf-$GDK_PIXBUF_VERSION-done
1126 if [ ! -f gtk+-$GTK_VERSION-done ] ; then
1127 echo "Downloading, building, and installing GTK+:"
1128 gtk_dir=`expr $GTK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
1129 if [[ $GTK_MAJOR_VERSION -gt 2 ||
1130 $GTK_MINOR_VERSION -gt 24 ||
1131 ($GTK_MINOR_VERSION -eq 24 && $GTK_DOTDOT_VERSION -ge 5) ]]
1134 # Starting with GTK+ 2.24.5, the tarballs are compressed with
1135 # xz rather than gzip, in addition to bzip2; use xz, as we've
1136 # built and installed it, and as xz compresses better than
1137 # bzip2 so the tarballs take less time to download.
1139 [ -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
1140 xzcat gtk+-$GTK_VERSION.tar.xz | tar xf - || exit 1
1142 [ -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
1143 bzcat gtk+-$GTK_VERSION.tar.bz2 | tar xf - || exit 1
1145 cd gtk+-$GTK_VERSION
1146 if [ $DARWIN_MAJOR_VERSION -ge "12" ]
1149 # GTK+ 2.24.10, at least, doesn't build on Mountain Lion with the
1150 # CUPS printing backend - either the CUPS API changed incompatibly
1151 # or the backend was depending on non-API implementation details.
1153 # Configure it out, on Mountain Lion and later, for now.
1154 # (12 is the Darwin major version number in Mountain Lion.)
1156 # Also, configure out libtiff and libjpeg; configure scripts
1157 # just ignore unknown --enable/--disable and --with/--without
1158 # options (at least they've always do so up to now).
1160 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --disable-cups --without-libtiff --without-libjpeg || exit 1
1162 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --without-libtiff --without-libjpeg || exit 1
1164 make $MAKE_BUILD_OPTS || exit 1
1165 $DO_MAKE_INSTALL || exit 1
1167 touch gtk+-$GTK_VERSION-done
1172 # Now we have reached a point where we can build everything including
1173 # the GUI (Wireshark), but not with any optional features such as
1174 # SNMP OID resolution, some forms of decryption, Lua scripting, playback
1175 # of audio, or GeoIP mapping of IP addresses.
1177 # We now conditionally download optional libraries to support them;
1178 # the default is to download them all.
1181 if [ "$LIBSMI_VERSION" -a ! -f libsmi-$LIBSMI_VERSION-done ] ; then
1182 echo "Downloading, building, and installing libsmi:"
1183 [ -f libsmi-$LIBSMI_VERSION.tar.gz ] || curl -L -O https://www.ibr.cs.tu-bs.de/projects/libsmi/download/libsmi-$LIBSMI_VERSION.tar.gz || exit 1
1184 gzcat libsmi-$LIBSMI_VERSION.tar.gz | tar xf - || exit 1
1185 cd libsmi-$LIBSMI_VERSION
1186 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1187 make $MAKE_BUILD_OPTS || exit 1
1188 $DO_MAKE_INSTALL || exit 1
1190 touch libsmi-$LIBSMI_VERSION-done
1193 if [ "$LIBGPG_ERROR_VERSION" -a ! -f libgpg-error-$LIBGPG_ERROR_VERSION-done ] ; then
1194 echo "Downloading, building, and installing libgpg-error:"
1195 [ -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
1196 bzcat libgpg-error-$LIBGPG_ERROR_VERSION.tar.bz2 | tar xf - || exit 1
1197 cd libgpg-error-$LIBGPG_ERROR_VERSION
1198 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1199 make $MAKE_BUILD_OPTS || exit 1
1200 $DO_MAKE_INSTALL || exit 1
1202 touch libgpg-error-$LIBGPG_ERROR_VERSION-done
1205 if [ "$LIBGCRYPT_VERSION" -a ! -f libgcrypt-$LIBGCRYPT_VERSION-done ] ; then
1207 # libgpg-error is required for libgcrypt.
1209 if [ -z $LIBGPG_ERROR_VERSION ]
1211 echo "libgcrypt requires libgpg-error, but you didn't install libgpg-error." 1>&2
1215 echo "Downloading, building, and installing libgcrypt:"
1216 [ -f libgcrypt-$LIBGCRYPT_VERSION.tar.gz ] || curl -L -O ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-$LIBGCRYPT_VERSION.tar.gz || exit 1
1217 gzcat libgcrypt-$LIBGCRYPT_VERSION.tar.gz | tar xf - || exit 1
1218 cd libgcrypt-$LIBGCRYPT_VERSION
1220 # The assembler language code is not compatible with the OS X
1221 # x86 assembler (or is it an x86-64 vs. x86-32 issue?).
1223 # libgcrypt expects gnu89, not c99/gnu99, semantics for
1224 # "inline". See, for example:
1226 # http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2010-October/198809.html
1228 CFLAGS="$CFLAGS -std=gnu89 $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --disable-asm || exit 1
1229 make $MAKE_BUILD_OPTS || exit 1
1230 $DO_MAKE_INSTALL || exit 1
1232 touch libgcrypt-$LIBGCRYPT_VERSION-done
1235 if [ "$GNUTLS_VERSION" -a ! -f gnutls-$GNUTLS_VERSION-done ] ; then
1237 # GnuTLS requires libgcrypt (or nettle, in newer versions).
1239 if [ -z $LIBGCRYPT_VERSION ]
1241 echo "GnuTLS requires libgcrypt, but you didn't install libgcrypt" 1>&2
1245 echo "Downloading, building, and installing GnuTLS:"
1246 [ -f gnutls-$GNUTLS_VERSION.tar.bz2 ] || curl -L -O http://ftp.gnu.org/gnu/gnutls/gnutls-$GNUTLS_VERSION.tar.bz2 || exit 1
1247 bzcat gnutls-$GNUTLS_VERSION.tar.bz2 | tar xf - || exit 1
1248 cd gnutls-$GNUTLS_VERSION
1250 # Use libgcrypt, not nettle.
1251 # XXX - is there some reason to prefer nettle? Or does
1252 # Wireshark directly use libgcrypt routines?
1254 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --with-libgcrypt --without-p11-kit || exit 1
1255 make $MAKE_BUILD_OPTS || exit 1
1257 # The pkgconfig file for GnuTLS says "requires zlib", but OS X,
1258 # while it supplies zlib, doesn't supply a pkgconfig file for
1261 # Patch the GnuTLS pkgconfig file not to require zlib.
1262 # (If the capabilities of GnuTLS that Wireshark uses don't
1263 # depend on building GnuTLS with zlib, an alternative would be
1264 # to configure it not to use zlib.)
1266 patch -p0 lib/gnutls.pc.in <../../macosx-support-lib-patches/gnutls-pkgconfig.patch || exit 1
1267 $DO_MAKE_INSTALL || exit 1
1269 touch gnutls-$GNUTLS_VERSION-done
1272 if [ "$LUA_VERSION" -a ! -f lua-$LUA_VERSION-done ] ; then
1273 echo "Downloading, building, and installing Lua:"
1274 [ -f lua-$LUA_VERSION.tar.gz ] || curl -L -O http://www.lua.org/ftp/lua-$LUA_VERSION.tar.gz || exit 1
1275 gzcat lua-$LUA_VERSION.tar.gz | tar xf - || exit 1
1277 make $MAKE_BUILD_OPTS macosx || exit 1
1278 $DO_MAKE_INSTALL || exit 1
1280 touch lua-$LUA_VERSION-done
1283 if [ "$PORTAUDIO_VERSION" -a ! -f portaudio-done ] ; then
1284 echo "Downloading, building, and installing PortAudio:"
1285 [ -f $PORTAUDIO_VERSION.tgz ] || curl -L -O http://www.portaudio.com/archives/$PORTAUDIO_VERSION.tgz || exit 1
1286 gzcat $PORTAUDIO_VERSION.tgz | tar xf - || exit 1
1289 # Un-comment an include that's required on Lion.
1291 patch -p0 include/pa_mac_core.h <../../macosx-support-lib-patches/portaudio-pa_mac_core.h.patch
1293 # Fix a bug that showed up with clang (but is a bug with any
1296 patch -p0 src/hostapi/coreaudio/pa_mac_core.c <../../macosx-support-lib-patches/portaudio-pa_mac_core.c.patch
1298 # Disable fat builds - the configure script doesn't work right
1299 # with Xcode 4 if you leave them enabled, and we don't build
1300 # any other libraries fat (GLib, for example, would be very
1301 # hard to build fat), so there's no advantage to having PortAudio
1304 # Set the minimum OS X version to 10.4, to suppress some
1305 # deprecation warnings. (Good luck trying to make any of
1306 # this build on an OS+Xcode with a pre-10.4 SDK; we don't
1307 # worry about the user requesting that.)
1309 CFLAGS="$CFLAGS -mmacosx-version-min=10.4 $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --disable-mac-universal || exit 1
1310 make $MAKE_BUILD_OPTS || exit 1
1311 $DO_MAKE_INSTALL || exit 1
1313 touch portaudio-done
1316 if [ "$GEOIP_VERSION" -a ! -f geoip-$GEOIP_VERSION-done ]
1318 echo "Downloading, building, and installing GeoIP API:"
1319 [ -f GeoIP-$GEOIP_VERSION.tar.gz ] || curl -L -O http://geolite.maxmind.com/download/geoip/api/c/GeoIP-$GEOIP_VERSION.tar.gz || exit 1
1320 gzcat GeoIP-$GEOIP_VERSION.tar.gz | tar xf - || exit 1
1321 cd GeoIP-$GEOIP_VERSION
1322 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1324 # Grr. Their man pages "helpfully" have an ISO 8859-1
1325 # copyright symbol in the copyright notice, but OS X's
1326 # default character encoding is UTF-8. sed on Mountain
1327 # Lion barfs at the "illegal character sequence" represented
1328 # by an ISO 8859-1 copyright symbol, as it's not a valid
1331 # iconv the relevant man pages into UTF-8.
1333 for i in geoipupdate.1.in geoiplookup6.1.in geoiplookup.1.in
1335 iconv -f iso8859-1 -t utf-8 man/"$i" >man/"$i".tmp &&
1336 mv man/"$i".tmp man/"$i"
1338 make $MAKE_BUILD_OPTS || exit 1
1339 $DO_MAKE_INSTALL || exit 1
1341 touch geoip-$GEOIP_VERSION-done
1344 if [ "$CARES_VERSION" -a ! -f geoip-$CARES_VERSION-done ]
1346 echo "Downloading, building, and installing C-Ares API:"
1347 [ -f c-ares-$CARES_VERSION.tar.gz ] || curl -L -O http://c-ares.haxx.se/download/c-ares-$CARES_VERSION.tar.gz || exit 1
1348 gzcat c-ares-$CARES_VERSION.tar.gz | tar xf - || exit 1
1349 cd c-ares-$CARES_VERSION
1350 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1351 make $MAKE_BUILD_OPTS || exit 1
1352 $DO_MAKE_INSTALL || exit 1
1354 touch geoip-$CARES_VERSION-done
1359 echo "You are now prepared to build Wireshark. To do so do:"
1360 echo "export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig"
1362 if [ -n "$CMAKE" ]; then
1363 echo "mkdir build; cd build"
1370 echo "mkdir build; cd build"
1373 echo "make $MAKE_BUILD_OPTS"
1378 echo "Make sure you are allowed capture access to the network devices"
1379 echo "See: http://wiki.wireshark.org/CaptureSetup/CapturePrivileges"