2 # Setup development environment on Mac OS X (tested with 10.6.8 and Xcode 3.2.6)
4 # Copyright 2011 Michael Tuexen, Joerg Mayer, Guy Harris (see AUTHORS file)
6 # Wireshark - Network traffic analyzer
7 # By Gerald Combs <gerald@wireshark.org>
8 # Copyright 1998 Gerald Combs
10 # This program is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU General Public License
12 # as published by the Free Software Foundation; either version 2
13 # of the License, or (at your option) any later version.
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write to the Free Software
22 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29 # To build all libraries as 32-bit libraries uncomment the following three lines.
31 # export CFLAGS="$CFLAGS -arch i386"
32 # export CXXFLAGS="$CXXFLAGS -arch i386"
33 # export LDFLAGS="$LDFLAGS -arch i386"
35 # and change "macx-clang" to "macx-clang-32" in the line below.
37 # Note: when building against the 10.6 SDK, clang fails, because there's
38 # a missing libstdc++.dylib in the SDK; this does not bother g++, however.
40 #TARGET_PLATFORM=macx-g++
41 TARGET_PLATFORM=macx-clang
44 # Versions of packages to download and install.
48 # Some packages need xz to unpack their current source.
49 # xz is not yet provided with OS X.
54 # In case we want to build with cmake.
56 CMAKE_VERSION=2.8.12.2
59 # The following libraries and tools are required even to build only TShark.
61 GETTEXT_VERSION=0.18.2
63 PKG_CONFIG_VERSION=0.28
66 # One or more of the following libraries are required to build Wireshark.
68 # If you don't want to build with Qt, comment out the QT_VERSION= line.
70 # If you want to build with GTK+ 2, comment out the GTK_VERSION=3.* line
71 # and un-comment the GTK_VERSION=2.* line.
73 # If you don't want to build with GTK+ at all, comment out both lines.
78 if [ "$GTK_VERSION" ]; then
80 # We'll be building GTK+, so we need some additional libraries.
82 GTK_MAJOR_VERSION="`expr $GTK_VERSION : '\([0-9][0-9]*\).*'`"
83 GTK_MINOR_VERSION="`expr $GTK_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
84 GTK_DOTDOT_VERSION="`expr $GTK_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
91 GDK_PIXBUF_VERSION=2.28.0
94 # In case we want to build GTK *and* we don't have Apple's X11 SDK installed
95 # we may want to install XQuartz. The version will only be used in the printing
96 # of a URL, the package will not be installed.
100 # The following libraries are optional.
101 # Comment them out if you don't want them, but note that some of
102 # the optional libraries are required by other optional libraries.
106 # libgpg-error is required for libgcrypt.
108 LIBGPG_ERROR_VERSION=1.10
110 # libgcrypt is required for GnuTLS.
111 # XXX - the link for "Libgcrypt source code" at
112 # http://www.gnupg.org/download/#libgcrypt is for 1.5.0, and is a bzip2
113 # file, but http://directory.fsf.org/project/libgcrypt/ lists only
116 LIBGCRYPT_VERSION=1.5.0
117 GNUTLS_VERSION=2.12.19
118 # Default to 5.2 now, unless user overrides it later
120 PORTAUDIO_VERSION=pa_stable_v19_20111121
122 # XXX - they appear to have an unversioned gzipped tarball for the
123 # current version; should we just download that, with some other
124 # way of specifying whether to download the GeoIP API?
130 DARWIN_MAJOR_VERSION=`uname -r | sed 's/\([0-9]*\).*/\1/'`
133 # GNU autotools; they're provided with releases up to Snow Leopard, but
134 # not in later releases.
136 if [[ $DARWIN_MAJOR_VERSION -gt 10 ]]; then
137 AUTOCONF_VERSION=2.69
138 AUTOMAKE_VERSION=1.13.3
139 LIBTOOL_VERSION=2.4.2
143 if [ -d macosx-support-libs ]
145 cd macosx-support-libs
148 # Uninstall items in the reverse order from the order in which they're
149 # installed. Only uninstall if the download/build/install process
150 # completed; uninstall the version that appears in the name of
153 # We also do a "make distclean", so that we don't have leftovers from
154 # old configurations.
157 installed_cares_version=`ls cares-*-done 2>/dev/null | sed 's/cares-\(.*\)-done/\1/'`
158 if [ ! -z "$installed_cares_version" ] ; then
159 echo "Uninstalling C-Ares API:"
160 cd cares-$installed_cares_version
161 $DO_MAKE_UNINSTALL || exit 1
162 make distclean || exit 1
164 rm cares-$installed_cares_version-done
167 installed_geoip_version=`ls geoip-*-done 2>/dev/null | sed 's/geoip-\(.*\)-done/\1/'`
168 if [ ! -z "$installed_geoip_version" ] ; then
169 echo "Uninstalling GeoIP API:"
170 cd GeoIP-$installed_geoip_version
171 $DO_MAKE_UNINSTALL || exit 1
172 make distclean || exit 1
174 rm geoip-$installed_geoip_version-done
177 if [ "$PORTAUDIO_VERSION" -a -f portaudio-done ] ; then
178 echo "Uninstalling PortAudio:"
180 $DO_MAKE_UNINSTALL || exit 1
181 make distclean || exit 1
186 installed_lua_version=`ls lua-*-done 2>/dev/null | sed 's/lua-\(.*\)-done/\1/'`
187 if [ ! -z "$installed_lua_version" ] ; then
188 echo "Uninstalling Lua:"
190 # Lua has no "make uninstall", so just remove stuff manually.
191 # There's no configure script, so there's no need for
192 # "make distclean", either; just do "make clean".
194 (cd /usr/local/bin; $DO_RM -f lua luac)
195 (cd /usr/local/include; $DO_RM -f lua.h luaconf.h lualib.h lauxlib.h lua.hpp)
196 (cd /usr/local/lib; $DO_RM -f liblua.a)
197 (cd /usr/local/man/man1; $DO_RM -f lua.1 luac.1)
198 cd lua-$installed_lua_version
201 rm lua-$installed_lua_version-done
204 installed_gnutls_version=`ls gnutls-*-done 2>/dev/null | sed 's/gnutls-\(.*\)-done/\1/'`
205 if [ ! -z "$installed_gnutls_version" ] ; then
206 echo "Uninstalling GnuTLS:"
207 cd gnutls-$installed_gnutls_version
208 $DO_MAKE_UNINSTALL || exit 1
209 make distclean || exit 1
211 rm gnutls-$installed_gnutls_version-done
214 installed_libgcrypt_version=`ls libgcrypt-*-done 2>/dev/null | sed 's/libgcrypt-\(.*\)-done/\1/'`
215 if [ ! -z "$installed_libgcrypt_version" ] ; then
216 echo "Uninstalling libgcrypt:"
217 cd libgcrypt-$installed_libgcrypt_version
218 $DO_MAKE_UNINSTALL || exit 1
219 make distclean || exit 1
221 rm libgcrypt-$installed_libgcrypt_version-done
224 installed_libgpg_error_version=`ls libgpg-error-*-done 2>/dev/null | sed 's/libgpg-error-\(.*\)-done/\1/'`
225 if [ ! -z "$installed_libgpg_error_version" ] ; then
226 echo "Uninstalling libgpg-error:"
227 cd libgpg-error-$installed_libgpg_error_version
228 $DO_MAKE_UNINSTALL || exit 1
229 make distclean || exit 1
231 rm libgpg-error-$installed_libgpg_error_version-done
234 installed_libsmi_version=`ls libsmi-*-done 2>/dev/null | sed 's/libsmi-\(.*\)-done/\1/'`
235 if [ ! -z "$installed_libsmi_version" ] ; then
236 echo "Uninstalling libsmi:"
237 cd libsmi-$installed_libsmi_version
238 $DO_MAKE_UNINSTALL || exit 1
239 make distclean || exit 1
241 rm libsmi-$installed_libsmi_version-done
244 installed_gtk_version=`ls gtk+-*-done 2>/dev/null | sed 's/gtk+-\(.*\)-done/\1/'`
245 if [ ! -z "$installed_gtk_version" ] ; then
246 echo "Uninstalling GTK+:"
247 cd gtk+-$installed_gtk_version
248 $DO_MAKE_UNINSTALL || exit 1
249 make distclean || exit 1
251 rm gtk+-$installed_gtk_version-done
254 installed_gdk_pixbuf_version=`ls gdk-pixbuf-*-done 2>/dev/null | sed 's/gdk-pixbuf-\(.*\)-done/\1/'`
255 if [ ! -z "$installed_gdk_pixbuf_version" ] ; then
256 echo "Uninstalling gdk-pixbuf:"
257 cd gdk-pixbuf-$installed_gdk_pixbuf_version
258 $DO_MAKE_UNINSTALL || exit 1
259 make distclean || exit 1
261 rm gdk-pixbuf-$installed_gdk_pixbuf_version-done
264 installed_pango_version=`ls pango-*-done 2>/dev/null | sed 's/pango-\(.*\)-done/\1/'`
265 if [ ! -z "$installed_pango_version" ] ; then
266 echo "Uninstalling Pango:"
267 cd pango-$installed_pango_version
268 $DO_MAKE_UNINSTALL || exit 1
269 make distclean || exit 1
271 rm pango-$installed_pango_version-done
274 installed_atk_version=`ls atk-*-done 2>/dev/null | sed 's/atk-\(.*\)-done/\1/'`
275 if [ ! -z "$installed_atk_version" ] ; then
276 echo "Uninstalling ATK:"
277 cd atk-$installed_atk_version
278 $DO_MAKE_UNINSTALL || exit 1
279 make distclean || exit 1
281 rm atk-$installed_atk_version-done
284 installed_cairo_version=`ls cairo-*-done 2>/dev/null | sed 's/cairo-\(.*\)-done/\1/'`
285 if [ ! -z "$installed_cairo_version" ] ; then
286 echo "Uninstalling Cairo:"
287 cd cairo-$installed_cairo_version
288 $DO_MAKE_UNINSTALL || exit 1
289 make distclean || exit 1
291 rm cairo-$installed_cairo_version-done
294 installed_pixman_version=`ls pixman-*-done 2>/dev/null | sed 's/pixman-\(.*\)-done/\1/'`
295 if [ ! -z "$installed_pixman_version" ] ; then
296 echo "Uninstalling pixman:"
297 cd pixman-$installed_pixman_version
298 $DO_MAKE_UNINSTALL || exit 1
299 make distclean || exit 1
301 rm pixman-$installed_pixman_version-done
304 installed_libpng_version=`ls libpng-*-done 2>/dev/null | sed 's/libpng-\(.*\)-done/\1/'`
305 if [ ! -z "$installed_libpng_version" ] ; then
306 echo "Uninstalling libpng:"
307 cd libpng-$installed_libpng_version
308 $DO_MAKE_UNINSTALL || exit 1
309 make distclean || exit 1
311 rm libpng-$installed_libpng_version-done
314 installed_qt_version=`ls qt-*-done 2>/dev/null | sed 's/qt-\(.*\)-done/\1/'`
315 if [ ! -z "$installed_qt_version" ] ; then
316 echo "Uninstalling Qt:"
317 cd qt-everywhere-opensource-src-$installed_qt_version
318 $DO_MAKE_UNINSTALL || exit 1
320 # XXX - "make distclean" doesn't work. qmake sure does a
321 # good job of constructing Makefiles that work correctly....
323 #make distclean || exit 1
325 rm qt-$installed_qt_version-done
328 installed_glib_version=`ls glib-*-done 2>/dev/null | sed 's/glib-\(.*\)-done/\1/'`
329 if [ ! -z "$installed_glib_version" ] ; then
330 echo "Uninstalling GLib:"
331 cd glib-$installed_glib_version
332 $DO_MAKE_UNINSTALL || exit 1
333 make distclean || exit 1
335 rm glib-$installed_glib_version-done
338 installed_pkg_config_version=`ls pkg-config-*-done 2>/dev/null | sed 's/pkg-config-\(.*\)-done/\1/'`
339 if [ ! -z "$installed_pkg_config_version" ] ; then
340 echo "Uninstalling pkg-config:"
341 cd pkg-config-$installed_pkg_config_version
342 $DO_MAKE_UNINSTALL || exit 1
343 make distclean || exit 1
345 rm pkg-config-$installed_pkg_config_version-done
348 installed_gettext_version=`ls gettext-*-done 2>/dev/null | sed 's/gettext-\(.*\)-done/\1/'`
349 if [ ! -z "$installed_gettext_version" ] ; then
350 echo "Uninstalling GNU gettext:"
351 cd gettext-$installed_gettext_version
352 $DO_MAKE_UNINSTALL || exit 1
353 make distclean || exit 1
355 rm gettext-$installed_gettext_version-done
359 # XXX - really remove this?
360 # Or should we remember it as installed only if this script
363 installed_cmake_version=`ls cmake-*-done 2>/dev/null | sed 's/cmake-\(.*\)-done/\1/'`
364 if [ ! -z "$installed_cmake_version" ]; then
365 echo "Uninstalling CMake:"
366 sudo rm -rf "/Applications/CMake "`echo "$installed_cmake_version" | sed 's/\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\1.\2-\3/'`.app
367 sudo rm /usr/bin/ccmake
368 sudo rm /usr/bin/cmake
369 sudo rm /usr/bin/cmake-gui
370 sudo rm /usr/bin/cmakexbuild
371 sudo rm /usr/bin/cpack
372 sudo rm /usr/bin/ctest
373 sudo pkgutil --forget com.Kitware.CMake
374 rm cmake-$installed_cmake_version-done
377 installed_libtool_version=`ls libtool-*-done 2>/dev/null | sed 's/libtool-\(.*\)-done/\1/'`
378 if [ ! -z "$installed_libtool_version" ] ; then
379 echo "Uninstalling GNU libtool:"
380 cd libtool-$installed_libtool_version
381 mv /usr/local/bin/glibtool /usr/local/bin/libtool
382 mv /usr/local/bin/glibtoolize /usr/local/bin/libtoolize
383 $DO_MAKE_UNINSTALL || exit 1
384 make distclean || exit 1
386 rm libtool-$installed_libtool_version-done
389 installed_automake_version=`ls automake-*-done 2>/dev/null | sed 's/automake-\(.*\)-done/\1/'`
390 if [ ! -z "$installed_automake_version" ] ; then
391 echo "Uninstalling GNU automake:"
392 cd automake-$installed_automake_version
393 $DO_MAKE_UNINSTALL || exit 1
394 make distclean || exit 1
396 rm automake-$installed_automake_version-done
399 installed_autoconf_version=`ls autoconf-*-done 2>/dev/null | sed 's/autoconf-\(.*\)-done/\1/'`
400 if [ ! -z "$installed_autoconf_version" ] ; then
401 echo "Uninstalling GNU autoconf:"
402 cd autoconf-$installed_autoconf_version
403 $DO_MAKE_UNINSTALL || exit 1
404 make distclean || exit 1
406 rm autoconf-$installed_autoconf_version-done
409 installed_xz_version=`ls xz-*-done 2>/dev/null | sed 's/xz-\(.*\)-done/\1/'`
410 if [ ! -z "$installed_xz_version" ] ; then
411 echo "Uninstalling xz:"
412 cd xz-$installed_xz_version
413 $DO_MAKE_UNINSTALL || exit 1
414 make distclean || exit 1
416 rm xz-$installed_xz_version-done
422 # Do we have permission to write in /usr/local?
424 # If so, assume we have permission to write in its subdirectories.
425 # (If that's not the case, this test needs to check the subdirectories
428 # If not, do "make install", "make uninstall", and the removes for Lua
433 DO_MAKE_INSTALL="make install"
434 DO_MAKE_UNINSTALL="make uninstall"
437 DO_MAKE_INSTALL="sudo make install"
438 DO_MAKE_UNINSTALL="sudo make uninstall"
443 # If we have SDKs available, the default target OS is the major version
444 # of the one we're running; get that and strip off the third component.
446 for i in /Developer/SDKs \
447 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
448 /Library/Developer/CommandLineTools/SDKs
452 min_osx_target=`sw_vers -productVersion | sed 's/\([[0-9]]*\).\([[0-9]]*\).[[0-9]]*/\1.\2/'`
458 # Parse command-line flags:
461 # -t <target> - build libraries so that they'll work on the specified
462 # version of OS X and later versions.
463 # -u - do an uninstall.
465 while getopts ht:u name
472 min_osx_target="$OPTARG"
475 echo "Usage: macosx-setup.sh [ -t <target> ] [ -u ]" 1>&1
481 if [ "$do_uninstall" = "yes" ]
488 # Configure scripts tend to set CFLAGS and CXXFLAGS to "-g -O2" if
489 # invoked without CFLAGS or CXXFLAGS being set in the environment.
491 # However, we *are* setting them in the environment, for our own
492 # nefarious purposes, so start them out as "-g -O2".
498 # To make this work on Leopard (rather than working *on* Snow Leopard
499 # when building *for* Leopard) will take more work.
501 # For one thing, Leopard's /usr/X11/lib/libXdamage.la claims, at least
502 # with all software updates applied, that the Xdamage shared library
503 # is libXdamage.1.0.0.dylib, but it is, in fact, libXdamage.1.1.0.dylib.
504 # This causes problems when building GTK+, so the script would have to
507 if [[ $DARWIN_MAJOR_VERSION -le 9 ]]; then
508 echo "This script does not support any versions of OS X before Snow Leopard" 1>&2
512 # if no make options are present, set default options
513 if [ -z "$MAKE_BUILD_OPTS" ] ; then
514 # by default use 1.5x number of cores for parallel build
515 MAKE_BUILD_OPTS="-j $(( $(sysctl -n hw.logicalcpu) * 3 / 2))"
519 # If we have a target release, look for its SDK, and build libraries
520 # against it rather than against the headers and, more importantly,
521 # libraries that come with the OS, so that we don't end up with
522 # support libraries that only work on the OS version on which
523 # we built them, not earlier versions of the same release, or
524 # earlier releases if the minimum is earlier.
526 if [ ! -z "$min_osx_target" ]
528 for i in /Developer/SDKs \
529 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
530 /Library/Developer/CommandLineTools/SDKs
532 if [ -d "$i"/"MacOSX$min_osx_target.sdk" ]
534 SDKPATH="$i"/"MacOSX$min_osx_target.sdk"
541 echo "macosx-setup.sh: Couldn't find the SDK for OS X $min_osx_target" 1>&2
546 # Make sure there are links to /usr/local/include and /usr/local/lib
547 # in the SDK's usr/local.
549 if [ ! -e $SDKPATH/usr/local/include ]
551 if [ ! -d $SDKPATH/usr/local ]
553 sudo mkdir $SDKPATH/usr/local
555 sudo ln -s /usr/local/include $SDKPATH/usr/local/include
557 if [ ! -e $SDKPATH/usr/local/lib ]
559 if [ ! -d $SDKPATH/usr/local ]
561 sudo mkdir $SDKPATH/usr/local
563 sudo ln -s /usr/local/lib $SDKPATH/usr/local/lib
567 # Set the minimum OS version for which to build to the specified
568 # minimum target OS version, so we don't, for example, end up using
569 # linker features supported by the OS verson on which we're building
570 # but not by the target version.
572 VERSION_MIN_FLAGS="-mmacosx-version-min=$min_osx_target"
575 # Compile and link against the SDK.
577 SDKFLAGS="-isysroot $SDKPATH"
579 if [[ "$min_osx_target" == "10.5" ]]
582 # Cairo is part of Mac OS X 10.6 and later.
583 # The *headers* are supplied by 10.5, but the *libraries*
584 # aren't, so we have to build it if we're building for 10.5.
586 cairo_not_in_the_os=yes
589 # Build with older versions of the support libraries, as
590 # were used on the Wireshark Leopard buildbot at one
591 # point. (Most of these versions come from the About page
592 # from Wireshark 1.8.6, the last build done on that buildbot;
593 # the ATK version isn't reported, so this is a guess.)
595 # If you want to try building with newer versions of
596 # the libraries, note that:
598 # The version of fontconfig that comes with Leopard doesn't
599 # support FC_WEIGHT_EXTRABLACK, so we can't use any version
600 # of Pango newer than 1.22.4.
602 # However, Pango 1.22.4 doesn't work with versions of GLib
603 # after 2.29.6, because Pango 1.22.4 uses G_CONST_RETURN and
604 # GLib 2.29.8 and later deprecate it (there doesn't appear to
605 # be a GLib 2.29.7). That means we'd either have to patch
606 # Pango not to use it (just use "const"; G_CONST_RETURN was
607 # there to allow code to choose whether to use "const" or not),
608 # or use GLib 2.29.6 or earlier.
610 # GLib 2.29.6 includes an implementation of g_bit_lock() that,
611 # on x86 (32-bit and 64-bit), uses asms in a fashion
612 # ("asm volatile goto") that requires GCC 4.5 or later, which
613 # is later than the compilers that come with Leopard and Snow
614 # Leopard. Recent versions of GLib check for that, but 2.29.6
615 # doesn't, so, if you want to build GLib 2.29.6 on Leopard or
616 # Snow Leopard, you would have to patch glib/gbitlock.c to do
617 # what the newer versions of GLib do:
619 # define a USE_ASM_GOTO macro that indicates whether "asm goto"
621 # #if (defined (i386) || defined (__amd64__))
622 # #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
623 # #define USE_ASM_GOTO 1
627 # replace all occurrences of
629 # #if defined (__GNUC__) && (defined (i386) || defined (__amd64__))
633 # #ifdef USE_ASM_GOTO
635 # Using GLib 2.29.6 or earlier, however, means that we can't
636 # use a version of ATK later than 2.3.93, as those versions
637 # don't work with GLib 2.29.6. The same applies to gdk-pixbuf;
638 # versions of gdk-pixbuf after 2.24.1 won't work with GLib
641 # Then you have to make sure that what you've build doesn't
642 # cause the X server that comes with Leopard to crash; at
643 # least one attempt at building for Leopard did.
645 # At least if building on Leopard, you might also find
646 # that, with various older versions of Cairo, including
647 # 1.6.4 and at least some 1.8.x versions, when you try to
648 # build it, the build fails because it can't find
649 # png_set_longjmp_fn(). I vaguely remember dealing with that,
650 # ages ago, but don't remember what I did.
659 # That version of GTK+ includes gdk-pixbuf.
660 # XXX - base this on the version of GTK+ requested.
665 # Libgcrypt 1.5.0 fails to compile due to some problem with an
666 # asm in rijndael.c, at least with i686-apple-darwin10-gcc-4.2.1
667 # (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) when building
670 # We try libgcrypt 1.4.3 instead, as that's what shows up in
671 # the version from the Leopard buildbot.
672 LIBGCRYPT_VERSION=1.4.3
675 # Build 32-bit while we're at it; Leopard has a bug that
676 # causes some BPF functions not to work with 64-bit userland
677 # code, so capturing won't work.
679 CFLAGS="$CFLAGS -arch i386"
680 CXXFLAGS="$CXXFLAGS -arch i386"
681 export LDFLAGS="$LDFLAGS -arch i386"
689 # You need Xcode or the command-line tools installed to get the compilers.
691 if [ ! -x /usr/bin/xcodebuild ]; then
692 echo "Please install Xcode first (should be available on DVD or from http://developer.apple.com/xcode/index.php)."
696 if [ "$QT_VERSION" ]; then
698 # We need Xcode, not just the command-line tools, installed to build
701 if ! /usr/bin/xcrun -find xcrun >/dev/null 2>&1; then
702 echo "Please install Xcode first (should be available on DVD or from http://developer.apple.com/xcode/index.php)."
703 echo "The command-line build tools are not sufficient to build Qt."
707 if [ "$GTK_VERSION" ]; then
709 # If we're building with GTK+, you also need the X11 SDK; with at least
710 # some versions of OS X and Xcode, that is, I think, an optional install.
711 # (Or it might be installed with X11, but I think *that* is an optional
712 # install on at least some versions of OS X.)
714 if [ ! -d /usr/X11/include ]; then
715 echo "Please install X11 and the X11 SDK first."
716 echo " You can either use http://xquartz.macosforge.org/, e.g."
717 echo " http://xquartz-dl.macosforge.org/SL/XQuartz-$XQUARTZ_VERSION.dmg"
718 echo " or the native Apple packages if you are on Lion or below."
723 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig
726 # Do all the downloads and untarring in a subdirectory, so all that
727 # stuff can be removed once we've installed the support libraries.
729 if [ ! -d macosx-support-libs ]
731 mkdir macosx-support-libs || exit 1
733 cd macosx-support-libs
735 # Start with xz: It is the sole download format of glib later than 2.31.2
737 if [ "$XZ_VERSION" -a ! -f xz-$XZ_VERSION-done ] ; then
738 echo "Downloading, building, and installing xz:"
739 [ -f xz-$XZ_VERSION.tar.bz2 ] || curl -O http://tukaani.org/xz/xz-$XZ_VERSION.tar.bz2 || exit 1
740 bzcat xz-$XZ_VERSION.tar.bz2 | tar xf - || exit 1
742 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0" ./configure || exit 1
743 make $MAKE_BUILD_OPTS || exit 1
744 $DO_MAKE_INSTALL || exit 1
746 touch xz-$XZ_VERSION-done
749 if [ "$AUTOCONF_VERSION" -a ! -f autoconf-$AUTOCONF_VERSION-done ] ; then
750 echo "Downloading, building and installing GNU autoconf..."
751 [ -f autoconf-$AUTOCONF_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/autoconf/autoconf-$AUTOCONF_VERSION.tar.xz || exit 1
752 xzcat autoconf-$AUTOCONF_VERSION.tar.xz | tar xf - || exit 1
753 cd autoconf-$AUTOCONF_VERSION
754 ./configure || exit 1
755 make $MAKE_BUILD_OPTS || exit 1
756 $DO_MAKE_INSTALL || exit 1
758 touch autoconf-$AUTOCONF_VERSION-done
761 if [ "$AUTOMAKE_VERSION" -a ! -f automake-$AUTOMAKE_VERSION-done ] ; then
762 echo "Downloading, building and installing GNU automake..."
763 [ -f automake-$AUTOMAKE_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/automake/automake-$AUTOMAKE_VERSION.tar.xz || exit 1
764 xzcat automake-$AUTOMAKE_VERSION.tar.xz | tar xf - || exit 1
765 cd automake-$AUTOMAKE_VERSION
766 ./configure || exit 1
767 make $MAKE_BUILD_OPTS || exit 1
768 $DO_MAKE_INSTALL || exit 1
770 touch automake-$AUTOMAKE_VERSION-done
773 if [ "$LIBTOOL_VERSION" -a ! -f libtool-$LIBTOOL_VERSION-done ] ; then
774 echo "Downloading, building and installing GNU libtool..."
775 [ -f libtool-$LIBTOOL_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/libtool/libtool-$LIBTOOL_VERSION.tar.xz || exit 1
776 xzcat libtool-$LIBTOOL_VERSION.tar.xz | tar xf - || exit 1
777 cd libtool-$LIBTOOL_VERSION
778 ./configure || exit 1
779 make $MAKE_BUILD_OPTS || exit 1
780 $DO_MAKE_INSTALL || exit 1
781 mv /usr/local/bin/libtool /usr/local/bin/glibtool
782 mv /usr/local/bin/libtoolize /usr/local/bin/glibtoolize
784 touch libtool-$LIBTOOL_VERSION-done
787 if [ -n "$CMAKE" -a ! -f cmake-$CMAKE_VERSION-done ]; then
788 echo "Downloading and installing CMake:"
789 cmake_dir=`expr $CMAKE_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
791 # NOTE: the "64" in "Darwin64" doesn't mean "64-bit-only"; the
792 # package in question supports both 32-bit and 64-bit x86.
794 [ -f cmake-$CMAKE_VERSION-Darwin64-universal.dmg ] || curl -O http://www.cmake.org/files/v$cmake_dir/cmake-$CMAKE_VERSION-Darwin64-universal.dmg || exit 1
795 sudo hdiutil attach http://www.cmake.org/files/v2.8/cmake-$CMAKE_VERSION-Darwin64-universal.dmg || exit 1
796 sudo installer -target / -pkg /Volumes/cmake-$CMAKE_VERSION-Darwin64-universal/cmake-$CMAKE_VERSION-Darwin64-universal.pkg || exit 1
797 sudo hdiutil detach /Volumes/cmake-$CMAKE_VERSION-Darwin64-universal
798 touch cmake-$CMAKE_VERSION-done
802 # Start with GNU gettext; GLib requires it, and OS X doesn't have it
803 # or a BSD-licensed replacement.
805 # At least on Lion with Xcode 4, _FORTIFY_SOURCE gets defined as 2
806 # by default, which causes, for example, stpncpy to be defined as
807 # a hairy macro that collides with the GNU gettext configure script's
808 # attempts to workaround AIX's lack of a declaration for stpncpy,
809 # with the result being a huge train wreck. Define _FORTIFY_SOURCE
810 # as 0 in an attempt to keep the trains on separate tracks.
812 if [ ! -f gettext-$GETTEXT_VERSION-done ] ; then
813 echo "Downloading, building, and installing GNU gettext:"
814 [ -f gettext-$GETTEXT_VERSION.tar.gz ] || curl -O http://ftp.gnu.org/pub/gnu/gettext/gettext-$GETTEXT_VERSION.tar.gz || exit 1
815 gzcat gettext-$GETTEXT_VERSION.tar.gz | tar xf - || exit 1
816 cd gettext-$GETTEXT_VERSION
817 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0 $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
818 make $MAKE_BUILD_OPTS || exit 1
819 $DO_MAKE_INSTALL || exit 1
821 touch gettext-$GETTEXT_VERSION-done
825 # GLib depends on pkg-config.
826 # By default, pkg-config depends on GLib; we break the dependency cycle
827 # by configuring pkg-config to use its own internal version of GLib.
829 if [ ! -f pkg-config-$PKG_CONFIG_VERSION-done ] ; then
830 echo "Downloading, building, and installing pkg-config:"
831 [ -f pkg-config-$PKG_CONFIG_VERSION.tar.gz ] || curl -O http://pkgconfig.freedesktop.org/releases/pkg-config-$PKG_CONFIG_VERSION.tar.gz || exit 1
832 gzcat pkg-config-$PKG_CONFIG_VERSION.tar.gz | tar xf - || exit 1
833 cd pkg-config-$PKG_CONFIG_VERSION
834 ./configure --with-internal-glib || exit 1
835 make $MAKE_BUILD_OPTS || exit 1
836 $DO_MAKE_INSTALL || exit 1
838 touch pkg-config-$PKG_CONFIG_VERSION-done
841 if [ ! -f glib-$GLIB_VERSION-done ] ; then
842 echo "Downloading, building, and installing GLib:"
843 glib_dir=`expr $GLIB_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
844 GLIB_MAJOR_VERSION="`expr $GLIB_VERSION : '\([0-9][0-9]*\).*'`"
845 GLIB_MINOR_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
846 GLIB_DOTDOT_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
847 if [[ $GLIB_MAJOR_VERSION -gt 2 ||
848 $GLIB_MINOR_VERSION -gt 28 ||
849 ($GLIB_MINOR_VERSION -eq 28 && $GLIB_DOTDOT_VERSION -ge 8) ]]
852 # Starting with GLib 2.28.8, xz-compressed tarballs are available.
854 [ -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
855 xzcat glib-$GLIB_VERSION.tar.xz | tar xf - || exit 1
857 [ -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
858 bzcat glib-$GLIB_VERSION.tar.bz2 | tar xf - || exit 1
860 cd glib-$GLIB_VERSION
862 # OS X ships with libffi, but doesn't provide its pkg-config file;
863 # explicitly specify LIBFFI_CFLAGS and LIBFFI_LIBS, so the configure
864 # script doesn't try to use pkg-config to get the appropriate
865 # C flags and loader flags.
867 # And, what's worse, at least with the version of Xcode that comes
868 # with Leopard, /usr/include/ffi/fficonfig.h doesn't define MACOSX,
869 # which causes the build of GLib to fail. If we don't find
870 # "#define.*MACOSX" in /usr/include/ffi/fficonfig.h, explicitly
873 # While we're at it, suppress -Wformat-nonliteral to avoid a case
874 # where clang's stricter rules on when not to complain about
875 # non-literal format arguments cause it to complain about code
876 # that's safe but it wasn't told that. See my comment #25 in
879 # https://bugzilla.gnome.org/show_bug.cgi?id=691608#c25
881 # First, determine where the system include files are. (It's not
882 # necessarily /usr/include.) There's a bit of a greasy hack here;
883 # pre-5.x versions of the developer tools don't support the
884 # --show-sdk-path option, and will produce no output, so includedir
885 # will be set to /usr/include (in those older versions of the
886 # developer tools, there is a /usr/include directory).
888 includedir=`xcrun --show-sdk-path 2>/dev/null`/usr/include
889 if grep -qs '#define.*MACOSX' $includedir/ffi/fficonfig.h
891 # It's defined, nothing to do
892 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
894 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
898 # Apply the fix to GNOME bug 529806:
900 # https://bugzilla.gnome.org/show_bug.cgi?id=529806
902 # if we have a version of GLib prior to 2.30.
904 if [[ $GLIB_MAJOR_VERSION -eq 2 && $GLIB_MINOR_VERSION -le 30 ]]
906 patch -p0 <../../macosx-support-lib-patches/glib-gconvert.c.patch || exit 1
908 make $MAKE_BUILD_OPTS || exit 1
909 $DO_MAKE_INSTALL || exit 1
911 touch glib-$GLIB_VERSION-done
915 # Now we have reached a point where we can build everything but
916 # the GUI (Wireshark).
918 if [ "$QT_VERSION" -a ! -f qt-$QT_VERSION-done ]; then
919 echo "Downloading, building, and installing Qt:"
920 QT_MAJOR_VERSION="`expr $QT_VERSION : '\([0-9][0-9]*\).*'`"
921 QT_MINOR_VERSION="`expr $QT_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
922 QT_DOTDOT_VERSION="`expr $QT_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
923 QT_MAJOR_MINOR_VERSION=$QT_MAJOR_VERSION.$QT_MINOR_VERSION
925 # What you get for this URL might just be a 302 Found reply, so use
926 # -L so we get redirected.
928 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
930 # Qt 5.1.x sets QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
931 # in qtbase/mkspecs/$TARGET_PLATFORM/qmake.conf
932 # We may need to adjust this manually in the future.
934 # The -no-c++11 flag is needed to work around
935 # https://bugreports.qt-project.org/browse/QTBUG-30487
937 tar xf qt-everywhere-opensource-src-$QT_VERSION.tar.gz
938 cd qt-everywhere-opensource-src-$QT_VERSION
940 # We don't build Qt in its Full Shining Glory, as we don't need all
941 # of its components, and it takes *forever* to build in that form.
943 # Qt 5.2.0 beta1 fails to build on OS X without -no-xcb due to bug
946 # Qt 5.x fails to build on OS X with -no-opengl due to bug
949 ./configure -v -sdk macosx$min_osx_target -platform $TARGET_PLATFORM \
950 -opensource -confirm-license -no-c++11 -no-dbus \
951 -no-sql-sqlite -no-xcb -nomake examples \
952 -skip qtdoc -skip qtquickcontrols -skip qtwebkit \
953 -skip qtwebkit-examples -skip qtxmlpatterns
955 $DO_MAKE_INSTALL || exit 1
957 touch qt-$QT_VERSION-done
960 if [ "$GTK_VERSION" ]; then
962 # GTK+ 3 requires a newer Cairo build than the one that comes with
963 # 10.6, so we build Cairo if we are using GTK+ 3.
965 # In 10.6 and 10.7, it's an X11 library; if we build with "native" GTK+
966 # rather than X11 GTK+, we might have to build and install Cairo.
967 # In 10.8 and later, there is no X11, but it's included in Xquartz;
968 # again, if we build with "native" GTK+, we'd have to build and install
971 if [[ "$GTK_MAJOR_VERSION" -eq 3 || "$cairo_not_in_the_os" = yes ]]; then
973 # Requirements for Cairo first
975 # The libpng that comes with the X11 for Leopard has a bogus
976 # pkg-config file that lies about where the header files are,
977 # which causes other packages not to be able to find its
980 # The libpng in later versions is not what the version of
981 # libpixman we build below wants - it wants libpng15.
983 if [ ! -f libpng-$PNG_VERSION-done ] ; then
984 echo "Downloading, building, and installing libpng:"
986 # The FTP site puts libpng x.y.* into a libpngxy directory.
988 subdir=`echo $PNG_VERSION | sed 's/\([1-9][0-9]*\)\.\([1-9][0-9]*\).*/libpng\1\2'/`
989 [ -f libpng-$PNG_VERSION.tar.xz ] || curl -O ftp://ftp.simplesystems.org/pub/libpng/png/src/$subdir/libpng-$PNG_VERSION.tar.xz
990 xzcat libpng-$PNG_VERSION.tar.xz | tar xf - || exit 1
991 cd libpng-$PNG_VERSION
992 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
993 make $MAKE_BUILD_OPTS || exit 1
994 $DO_MAKE_INSTALL || exit 1
996 touch libpng-$PNG_VERSION-done
1000 # The libpixman versions that come with the X11s for Leopard,
1001 # Snow Leopard, and Lion is too old to support Cairo's image
1002 # surface backend feature (which requires pixman-1 >= 0.22.0).
1004 # XXX - what about the one that comes with the latest version
1007 if [ ! -f pixman-$PIXMAN_VERSION-done ] ; then
1008 echo "Downloading, building, and installing pixman:"
1009 [ -f pixman-$PIXMAN_VERSION.tar.gz ] || curl -O http://www.cairographics.org/releases/pixman-$PIXMAN_VERSION.tar.gz
1010 gzcat pixman-$PIXMAN_VERSION.tar.gz | tar xf - || exit 1
1011 cd pixman-$PIXMAN_VERSION
1012 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1013 make V=1 $MAKE_BUILD_OPTS || exit 1
1014 $DO_MAKE_INSTALL || exit 1
1016 touch pixman-$PIXMAN_VERSION-done
1020 # And now Cairo itself.
1021 # XXX - with the libxcb that comes with 10.6,
1023 # xcb_discard_reply() is missing, and the build fails.
1025 if [ ! -f cairo-$CAIRO_VERSION-done ] ; then
1026 echo "Downloading, building, and installing Cairo:"
1027 CAIRO_MAJOR_VERSION="`expr $CAIRO_VERSION : '\([0-9][0-9]*\).*'`"
1028 CAIRO_MINOR_VERSION="`expr $CAIRO_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
1029 CAIRO_DOTDOT_VERSION="`expr $CAIRO_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
1030 if [[ $CAIRO_MAJOR_VERSION -gt 1 ||
1031 $CAIRO_MINOR_VERSION -gt 12 ||
1032 ($CAIRO_MINOR_VERSION -eq 12 && $CAIRO_DOTDOT_VERSION -ge 2) ]]
1035 # Starting with Cairo 1.12.2, the tarballs are compressed with
1036 # xz rather than gzip.
1038 [ -f cairo-$CAIRO_VERSION.tar.xz ] || curl -O http://cairographics.org/releases/cairo-$CAIRO_VERSION.tar.xz || exit 1
1039 xzcat cairo-$CAIRO_VERSION.tar.xz | tar xf - || exit 1
1041 [ -f cairo-$CAIRO_VERSION.tar.gz ] || curl -O http://cairographics.org/releases/cairo-$CAIRO_VERSION.tar.gz || exit 1
1042 gzcat cairo-$CAIRO_VERSION.tar.gz | tar xf - || exit 1
1044 cd cairo-$CAIRO_VERSION
1045 # CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-quartz=no || exit 1
1046 # Maybe follow http://cairographics.org/end_to_end_build_for_mac_os_x/
1047 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-quartz=yes || exit 1
1049 # We must avoid the version of libpng that comes with X11; the
1050 # only way I've found to force that is to forcibly set INCLUDES
1051 # when we do the build, so that this comes before CAIRO_CFLAGS,
1052 # which has -I/usr/X11/include added to it before anything
1053 # connected to libpng is.
1055 INCLUDES="-I/usr/local/include/libpng15" make $MAKE_BUILD_OPTS || exit 1
1056 $DO_MAKE_INSTALL || exit 1
1058 touch cairo-$CAIRO_VERSION-done
1062 if [ ! -f atk-$ATK_VERSION-done ] ; then
1063 echo "Downloading, building, and installing ATK:"
1064 atk_dir=`expr $ATK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
1065 ATK_MAJOR_VERSION="`expr $ATK_VERSION : '\([0-9][0-9]*\).*'`"
1066 ATK_MINOR_VERSION="`expr $ATK_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
1067 ATK_DOTDOT_VERSION="`expr $ATK_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
1068 if [[ $ATK_MAJOR_VERSION -gt 2 ||
1069 ($ATK_MAJOR_VERSION -eq 2 && $ATK_MINOR_VERSION -gt 0) ||
1070 ($ATK_MANOR_VERSION -eq 2 && $ATK_MINOR_VERSION -eq 0 && $ATK_DOTDOT_VERSION -ge 1) ]]
1073 # Starting with ATK 2.0.1, xz-compressed tarballs are available.
1075 [ -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
1076 xzcat atk-$ATK_VERSION.tar.xz | tar xf - || exit 1
1078 [ -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
1079 bzcat atk-$ATK_VERSION.tar.bz2 | tar xf - || exit 1
1082 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1083 make $MAKE_BUILD_OPTS || exit 1
1084 $DO_MAKE_INSTALL || exit 1
1086 touch atk-$ATK_VERSION-done
1089 if [ ! -f pango-$PANGO_VERSION-done ] ; then
1090 echo "Downloading, building, and installing Pango:"
1091 pango_dir=`expr $PANGO_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
1092 PANGO_MAJOR_VERSION="`expr $PANGO_VERSION : '\([0-9][0-9]*\).*'`"
1093 PANGO_MINOR_VERSION="`expr $PANGO_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
1094 if [[ $PANGO_MAJOR_VERSION -gt 1 ||
1095 $PANGO_MINOR_VERSION -ge 29 ]]
1098 # Starting with Pango 1.29, the tarballs are compressed with
1099 # xz rather than bzip2.
1101 [ -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
1102 xzcat pango-$PANGO_VERSION.tar.xz | tar xf - || exit 1
1104 [ -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
1105 bzcat pango-$PANGO_VERSION.tar.bz2 | tar xf - || exit 1
1107 cd pango-$PANGO_VERSION
1108 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1109 make $MAKE_BUILD_OPTS || exit 1
1110 $DO_MAKE_INSTALL || exit 1
1112 touch pango-$PANGO_VERSION-done
1115 if [ "$GDK_PIXBUF_VERSION" -a ! -f gdk-pixbuf-$GDK_PIXBUF_VERSION-done ] ; then
1116 echo "Downloading, building, and installing gdk-pixbuf:"
1117 gdk_pixbuf_dir=`expr $GDK_PIXBUF_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
1118 [ -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
1119 xzcat gdk-pixbuf-$GDK_PIXBUF_VERSION.tar.xz | tar xf - || exit 1
1120 cd gdk-pixbuf-$GDK_PIXBUF_VERSION
1122 # If we're building for 10.6, use libpng12; if you have 10.7.5, including
1123 # X11, and Xcode 4.3.3, the system has libpng15, complete with pkg-config
1124 # files, as part of X11, but 10.6's X11 has only libpng12, and the 10.6
1125 # SDK in Xcode 4.3.3 also has only libpng12, and has no pkg-config files
1126 # of its own, so we have to explicitly set LIBPNG to override the
1127 # configure script, and also force the CFLAGS to look for the header
1128 # files for libpng12 (note that -isysroot doesn't affect the arguments
1129 # to -I, so we need to include the SDK path explicitly).
1131 if [[ "$min_osx_target" = 10.6 ]]
1133 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
1135 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --without-libtiff --without-libjpeg || exit 1
1137 make $MAKE_BUILD_OPTS || exit 1
1138 $DO_MAKE_INSTALL || exit 1
1140 touch gdk-pixbuf-$GDK_PIXBUF_VERSION-done
1143 if [ ! -f gtk+-$GTK_VERSION-done ] ; then
1144 echo "Downloading, building, and installing GTK+:"
1145 gtk_dir=`expr $GTK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
1146 if [[ $GTK_MAJOR_VERSION -gt 2 ||
1147 $GTK_MINOR_VERSION -gt 24 ||
1148 ($GTK_MINOR_VERSION -eq 24 && $GTK_DOTDOT_VERSION -ge 5) ]]
1151 # Starting with GTK+ 2.24.5, the tarballs are compressed with
1152 # xz rather than gzip, in addition to bzip2; use xz, as we've
1153 # built and installed it, and as xz compresses better than
1154 # bzip2 so the tarballs take less time to download.
1156 [ -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
1157 xzcat gtk+-$GTK_VERSION.tar.xz | tar xf - || exit 1
1159 [ -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
1160 bzcat gtk+-$GTK_VERSION.tar.bz2 | tar xf - || exit 1
1162 cd gtk+-$GTK_VERSION
1163 if [ $DARWIN_MAJOR_VERSION -ge "12" ]
1166 # GTK+ 2.24.10, at least, doesn't build on Mountain Lion with the
1167 # CUPS printing backend - either the CUPS API changed incompatibly
1168 # or the backend was depending on non-API implementation details.
1170 # Configure it out, on Mountain Lion and later, for now.
1171 # (12 is the Darwin major version number in Mountain Lion.)
1173 # Also, configure out libtiff and libjpeg; configure scripts
1174 # just ignore unknown --enable/--disable and --with/--without
1175 # options (at least they've always do so up to now).
1177 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --disable-cups --without-libtiff --without-libjpeg || exit 1
1179 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --without-libtiff --without-libjpeg || exit 1
1181 make $MAKE_BUILD_OPTS || exit 1
1182 $DO_MAKE_INSTALL || exit 1
1184 touch gtk+-$GTK_VERSION-done
1189 # Now we have reached a point where we can build everything including
1190 # the GUI (Wireshark), but not with any optional features such as
1191 # SNMP OID resolution, some forms of decryption, Lua scripting, playback
1192 # of audio, or GeoIP mapping of IP addresses.
1194 # We now conditionally download optional libraries to support them;
1195 # the default is to download them all.
1198 if [ "$LIBSMI_VERSION" -a ! -f libsmi-$LIBSMI_VERSION-done ] ; then
1199 echo "Downloading, building, and installing libsmi:"
1200 [ -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
1201 gzcat libsmi-$LIBSMI_VERSION.tar.gz | tar xf - || exit 1
1202 cd libsmi-$LIBSMI_VERSION
1203 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1204 make $MAKE_BUILD_OPTS || exit 1
1205 $DO_MAKE_INSTALL || exit 1
1207 touch libsmi-$LIBSMI_VERSION-done
1210 if [ "$LIBGPG_ERROR_VERSION" -a ! -f libgpg-error-$LIBGPG_ERROR_VERSION-done ] ; then
1211 echo "Downloading, building, and installing libgpg-error:"
1212 [ -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
1213 bzcat libgpg-error-$LIBGPG_ERROR_VERSION.tar.bz2 | tar xf - || exit 1
1214 cd libgpg-error-$LIBGPG_ERROR_VERSION
1215 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1216 make $MAKE_BUILD_OPTS || exit 1
1217 $DO_MAKE_INSTALL || exit 1
1219 touch libgpg-error-$LIBGPG_ERROR_VERSION-done
1222 if [ "$LIBGCRYPT_VERSION" -a ! -f libgcrypt-$LIBGCRYPT_VERSION-done ] ; then
1224 # libgpg-error is required for libgcrypt.
1226 if [ -z $LIBGPG_ERROR_VERSION ]
1228 echo "libgcrypt requires libgpg-error, but you didn't install libgpg-error." 1>&2
1232 echo "Downloading, building, and installing libgcrypt:"
1233 [ -f libgcrypt-$LIBGCRYPT_VERSION.tar.gz ] || curl -L -O ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-$LIBGCRYPT_VERSION.tar.gz || exit 1
1234 gzcat libgcrypt-$LIBGCRYPT_VERSION.tar.gz | tar xf - || exit 1
1235 cd libgcrypt-$LIBGCRYPT_VERSION
1237 # The assembler language code is not compatible with the OS X
1238 # x86 assembler (or is it an x86-64 vs. x86-32 issue?).
1240 # libgcrypt expects gnu89, not c99/gnu99, semantics for
1241 # "inline". See, for example:
1243 # http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2010-October/198809.html
1245 CFLAGS="$CFLAGS -std=gnu89 $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --disable-asm || exit 1
1246 make $MAKE_BUILD_OPTS || exit 1
1247 $DO_MAKE_INSTALL || exit 1
1249 touch libgcrypt-$LIBGCRYPT_VERSION-done
1252 if [ "$GNUTLS_VERSION" -a ! -f gnutls-$GNUTLS_VERSION-done ] ; then
1254 # GnuTLS requires libgcrypt (or nettle, in newer versions).
1256 if [ -z $LIBGCRYPT_VERSION ]
1258 echo "GnuTLS requires libgcrypt, but you didn't install libgcrypt" 1>&2
1262 echo "Downloading, building, and installing GnuTLS:"
1263 [ -f gnutls-$GNUTLS_VERSION.tar.bz2 ] || curl -L -O http://ftp.gnu.org/gnu/gnutls/gnutls-$GNUTLS_VERSION.tar.bz2 || exit 1
1264 bzcat gnutls-$GNUTLS_VERSION.tar.bz2 | tar xf - || exit 1
1265 cd gnutls-$GNUTLS_VERSION
1267 # Use libgcrypt, not nettle.
1268 # XXX - is there some reason to prefer nettle? Or does
1269 # Wireshark directly use libgcrypt routines?
1271 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --with-libgcrypt --without-p11-kit || exit 1
1272 make $MAKE_BUILD_OPTS || exit 1
1274 # The pkgconfig file for GnuTLS says "requires zlib", but OS X,
1275 # while it supplies zlib, doesn't supply a pkgconfig file for
1278 # Patch the GnuTLS pkgconfig file not to require zlib.
1279 # (If the capabilities of GnuTLS that Wireshark uses don't
1280 # depend on building GnuTLS with zlib, an alternative would be
1281 # to configure it not to use zlib.)
1283 patch -p0 lib/gnutls.pc.in <../../macosx-support-lib-patches/gnutls-pkgconfig.patch || exit 1
1284 $DO_MAKE_INSTALL || exit 1
1286 touch gnutls-$GNUTLS_VERSION-done
1289 if [ "$LUA_VERSION" -a ! -f lua-$LUA_VERSION-done ] ; then
1290 echo "Downloading, building, and installing Lua:"
1291 [ -f lua-$LUA_VERSION.tar.gz ] || curl -L -O http://www.lua.org/ftp/lua-$LUA_VERSION.tar.gz || exit 1
1292 gzcat lua-$LUA_VERSION.tar.gz | tar xf - || exit 1
1294 make $MAKE_BUILD_OPTS macosx || exit 1
1295 $DO_MAKE_INSTALL || exit 1
1297 touch lua-$LUA_VERSION-done
1300 if [ "$PORTAUDIO_VERSION" -a ! -f portaudio-done ] ; then
1301 echo "Downloading, building, and installing PortAudio:"
1302 [ -f $PORTAUDIO_VERSION.tgz ] || curl -L -O http://www.portaudio.com/archives/$PORTAUDIO_VERSION.tgz || exit 1
1303 gzcat $PORTAUDIO_VERSION.tgz | tar xf - || exit 1
1306 # Un-comment an include that's required on Lion.
1308 patch -p0 include/pa_mac_core.h <../../macosx-support-lib-patches/portaudio-pa_mac_core.h.patch
1310 # Fix a bug that showed up with clang (but is a bug with any
1313 patch -p0 src/hostapi/coreaudio/pa_mac_core.c <../../macosx-support-lib-patches/portaudio-pa_mac_core.c.patch
1315 # Disable fat builds - the configure script doesn't work right
1316 # with Xcode 4 if you leave them enabled, and we don't build
1317 # any other libraries fat (GLib, for example, would be very
1318 # hard to build fat), so there's no advantage to having PortAudio
1321 # Set the minimum OS X version to 10.4, to suppress some
1322 # deprecation warnings. (Good luck trying to make any of
1323 # this build on an OS+Xcode with a pre-10.4 SDK; we don't
1324 # worry about the user requesting that.)
1326 CFLAGS="$CFLAGS -mmacosx-version-min=10.4 $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --disable-mac-universal || exit 1
1327 make $MAKE_BUILD_OPTS || exit 1
1328 $DO_MAKE_INSTALL || exit 1
1330 touch portaudio-done
1333 if [ "$GEOIP_VERSION" -a ! -f geoip-$GEOIP_VERSION-done ]
1335 echo "Downloading, building, and installing GeoIP API:"
1336 [ -f GeoIP-$GEOIP_VERSION.tar.gz ] || curl -L -O http://geolite.maxmind.com/download/geoip/api/c/GeoIP-$GEOIP_VERSION.tar.gz || exit 1
1337 gzcat GeoIP-$GEOIP_VERSION.tar.gz | tar xf - || exit 1
1338 cd GeoIP-$GEOIP_VERSION
1339 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1341 # Grr. Their man pages "helpfully" have an ISO 8859-1
1342 # copyright symbol in the copyright notice, but OS X's
1343 # default character encoding is UTF-8. sed on Mountain
1344 # Lion barfs at the "illegal character sequence" represented
1345 # by an ISO 8859-1 copyright symbol, as it's not a valid
1348 # iconv the relevant man pages into UTF-8.
1350 for i in geoipupdate.1.in geoiplookup6.1.in geoiplookup.1.in
1352 iconv -f iso8859-1 -t utf-8 man/"$i" >man/"$i".tmp &&
1353 mv man/"$i".tmp man/"$i"
1355 make $MAKE_BUILD_OPTS || exit 1
1356 $DO_MAKE_INSTALL || exit 1
1358 touch geoip-$GEOIP_VERSION-done
1361 if [ "$CARES_VERSION" -a ! -f geoip-$CARES_VERSION-done ]
1363 echo "Downloading, building, and installing C-Ares API:"
1364 [ -f c-ares-$CARES_VERSION.tar.gz ] || curl -L -O http://c-ares.haxx.se/download/c-ares-$CARES_VERSION.tar.gz || exit 1
1365 gzcat c-ares-$CARES_VERSION.tar.gz | tar xf - || exit 1
1366 cd c-ares-$CARES_VERSION
1367 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1368 make $MAKE_BUILD_OPTS || exit 1
1369 $DO_MAKE_INSTALL || exit 1
1371 touch geoip-$CARES_VERSION-done
1376 echo "You are now prepared to build Wireshark. To do so do:"
1377 echo "export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig"
1379 if [ -n "$CMAKE" ]; then
1380 echo "mkdir build; cd build"
1387 echo "mkdir build; cd build"
1390 echo "make $MAKE_BUILD_OPTS"
1395 echo "Make sure you are allowed capture access to the network devices"
1396 echo "See: http://wiki.wireshark.org/CaptureSetup/CapturePrivileges"