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.
27 # To set up Qt, set TOOLKIT to qt
28 # To set up GTK+ 3, set TOOLKIT to gtk3
29 # To set up GTK+ 2, set TOOLKIT to gtk2
37 # To build all libraries as 32-bit libraries uncomment the following three lines.
39 # export CFLAGS="$CFLAGS -arch i386"
40 # export CXXFLAGS="$CXXFLAGS -arch i386"
41 # export LDFLAGS="$LDFLAGS -arch i386"
43 # and change "macx-clang" to "macx-clang-32" in the line below.
45 TARGET_PLATFORM=macx-clang
48 # Versions to download and install.
50 # The following libraries and tools are required.
52 GETTEXT_VERSION=0.18.2
54 PKG_CONFIG_VERSION=0.28
66 GDK_PIXBUF_VERSION=2.28.0
67 if [ "$TOOLKIT" = gtk2 ]; then
76 # Some package need xz to unpack their current source.
77 # xz is not yet provided with OS X.
81 # In case we want to build with cmake
82 CMAKE_VERSION=2.8.10.2
85 # The following libraries are optional.
86 # Comment them out if you don't want them, but note that some of
87 # the optional libraries are required by other optional libraries.
91 # libgpg-error is required for libgcrypt.
93 LIBGPG_ERROR_VERSION=1.10
95 # libgcrypt is required for GnuTLS.
96 # XXX - the link for "Libgcrypt source code" at
97 # http://www.gnupg.org/download/#libgcrypt is for 1.5.0, and is a bzip2
98 # file, but http://directory.fsf.org/project/libgcrypt/ lists only
101 LIBGCRYPT_VERSION=1.5.0
102 GNUTLS_VERSION=2.12.19
103 # Stay with Lua 5.1 when updating until the code has been changed
106 PORTAUDIO_VERSION=pa_stable_v19_20111121
108 # XXX - they appear to have an unversioned gzipped tarball for the
109 # current version; should we just download that, with some other
110 # way of specifying whether to download the GeoIP API?
114 DARWIN_MAJOR_VERSION=`uname -r | sed 's/\([0-9]*\).*/\1/'`
117 # GNU autotools; they're provided with releases up to Snow Leopard, but
118 # not in later releases.
120 if [[ $DARWIN_MAJOR_VERSION -gt 10 ]]; then
121 AUTOCONF_VERSION=2.69
122 AUTOMAKE_VERSION=1.13.3
123 LIBTOOL_VERSION=2.4.2
127 if [ -d macosx-support-libs ]
129 cd macosx-support-libs
132 # Uninstall items in the reverse order from the order in which they're
133 # installed. Only uninstall if the download/build/install process
134 # completed; uninstall the version that appears in the name of
137 # We also do a "make distclean", so that we don't have leftovers from
138 # old configurations.
140 installed_geoip_version=`ls geoip-*-done 2>/dev/null | sed 's/geoip-\(.*\)-done/\1/'`
141 if [ ! -z "$installed_geoip_version" ] ; then
142 echo "Uninstalling GeoIP API:"
143 cd GeoIP-$installed_geoip_version
144 $DO_MAKE_UNINSTALL || exit 1
145 make distclean || exit 1
147 rm geoip-$installed_geoip_version-done
150 if [ "$PORTAUDIO_VERSION" -a -f portaudio-done ] ; then
151 echo "Uninstalling PortAudio:"
153 $DO_MAKE_UNINSTALL || exit 1
154 make distclean || exit 1
159 installed_lua_version=`ls lua-*-done 2>/dev/null | sed 's/lua-\(.*\)-done/\1/'`
160 if [ ! -z "$installed_lua_version" ] ; then
161 echo "Uninstalling Lua:"
163 # Lua has no "make uninstall", so just remove stuff manually.
164 # There's no configure script, so there's no need for
165 # "make distclean", either; just do "make clean".
167 (cd /usr/local/bin; $DO_RM -f lua luac)
168 (cd /usr/local/include; $DO_RM -f lua.h luaconf.h lualib.h lauxlib.h lua.hpp)
169 (cd /usr/local/lib; $DO_RM -f liblua.a)
170 (cd /usr/local/man/man1; $DO_RM -f lua.1 luac.1)
171 cd lua-$installed_lua_version
174 rm lua-$installed_lua_version-done
177 installed_gnutls_version=`ls gnutls-*-done 2>/dev/null | sed 's/gnutls-\(.*\)-done/\1/'`
178 if [ ! -z "$installed_gnutls_version" ] ; then
179 echo "Uninstalling GnuTLS:"
180 cd gnutls-$installed_gnutls_version
181 $DO_MAKE_UNINSTALL || exit 1
182 make distclean || exit 1
184 rm gnutls-$installed_gnutls_version-done
187 installed_libgcrypt_version=`ls libgcrypt-*-done 2>/dev/null | sed 's/libgcrypt-\(.*\)-done/\1/'`
188 if [ ! -z "$installed_libgcrypt_version" ] ; then
189 echo "Uninstalling libgcrypt:"
190 cd libgcrypt-$installed_libgcrypt_version
191 $DO_MAKE_UNINSTALL || exit 1
192 make distclean || exit 1
194 rm libgcrypt-$installed_libgcrypt_version-done
197 installed_libgpg_error_version=`ls libgpg-error-*-done 2>/dev/null | sed 's/libgpg-error-\(.*\)-done/\1/'`
198 if [ ! -z "$installed_libgpg_error_version" ] ; then
199 echo "Uninstalling libgpg-error:"
200 cd libgpg-error-$installed_libgpg_error_version
201 $DO_MAKE_UNINSTALL || exit 1
202 make distclean || exit 1
204 rm libgpg-error-$installed_libgpg_error_version-done
207 installed_libsmi_version=`ls libsmi-*-done 2>/dev/null | sed 's/libsmi-\(.*\)-done/\1/'`
208 if [ ! -z "$installed_libsmi_version" ] ; then
209 echo "Uninstalling libsmi:"
210 cd libsmi-$installed_libsmi_version
211 $DO_MAKE_UNINSTALL || exit 1
212 make distclean || exit 1
214 rm libsmi-$installed_libsmi_version-done
217 installed_gtk_version=`ls gtk+-*-done 2>/dev/null | sed 's/gtk+-\(.*\)-done/\1/'`
218 if [ ! -z "$installed_gtk_version" ] ; then
219 echo "Uninstalling GTK+:"
220 cd gtk+-$installed_gtk_version
221 $DO_MAKE_UNINSTALL || exit 1
222 make distclean || exit 1
224 rm gtk+-$installed_gtk_version-done
227 installed_gdk_pixbuf_version=`ls gdk-pixbuf-*-done 2>/dev/null | sed 's/gdk-pixbuf-\(.*\)-done/\1/'`
228 if [ ! -z "$installed_gdk_pixbuf_version" ] ; then
229 echo "Uninstalling gdk-pixbuf:"
230 cd gdk-pixbuf-$installed_gdk_pixbuf_version
231 $DO_MAKE_UNINSTALL || exit 1
232 make distclean || exit 1
234 rm gdk-pixbuf-$installed_gdk_pixbuf_version-done
237 installed_pango_version=`ls pango-*-done 2>/dev/null | sed 's/pango-\(.*\)-done/\1/'`
238 if [ ! -z "$installed_pango_version" ] ; then
239 echo "Uninstalling Pango:"
240 cd pango-$installed_pango_version
241 $DO_MAKE_UNINSTALL || exit 1
242 make distclean || exit 1
244 rm pango-$installed_pango_version-done
247 installed_atk_version=`ls atk-*-done 2>/dev/null | sed 's/atk-\(.*\)-done/\1/'`
248 if [ ! -z "$installed_atk_version" ] ; then
249 echo "Uninstalling ATK:"
250 cd atk-$installed_atk_version
251 $DO_MAKE_UNINSTALL || exit 1
252 make distclean || exit 1
254 rm atk-$installed_atk_version-done
257 installed_cairo_version=`ls cairo-*-done 2>/dev/null | sed 's/cairo-\(.*\)-done/\1/'`
258 if [ ! -z "$installed_cairo_version" ] ; then
259 echo "Uninstalling Cairo:"
260 cd cairo-$installed_cairo_version
261 $DO_MAKE_UNINSTALL || exit 1
262 make distclean || exit 1
264 rm cairo-$installed_cairo_version-done
267 installed_pixman_version=`ls pixman-*-done 2>/dev/null | sed 's/pixman-\(.*\)-done/\1/'`
268 if [ ! -z "$installed_pixman_version" ] ; then
269 echo "Uninstalling pixman:"
270 cd pixman-$installed_pixman_version
271 $DO_MAKE_UNINSTALL || exit 1
272 make distclean || exit 1
274 rm pixman-$installed_pixman_version-done
277 installed_libpng_version=`ls libpng-*-done 2>/dev/null | sed 's/libpng-\(.*\)-done/\1/'`
278 if [ ! -z "$installed_libpng_version" ] ; then
279 echo "Uninstalling libpng:"
280 cd libpng-$installed_libpng_version
281 $DO_MAKE_UNINSTALL || exit 1
282 make distclean || exit 1
284 rm libpng-$installed_libpng_version-done
287 installed_glib_version=`ls glib-*-done 2>/dev/null | sed 's/glib-\(.*\)-done/\1/'`
288 if [ ! -z "$installed_glib_version" ] ; then
289 echo "Uninstalling GLib:"
290 cd glib-$installed_glib_version
291 $DO_MAKE_UNINSTALL || exit 1
292 make distclean || exit 1
294 rm glib-$installed_glib_version-done
297 installed_pkg_config_version=`ls pkg-config-*-done 2>/dev/null | sed 's/pkg-config-\(.*\)-done/\1/'`
298 if [ ! -z "$installed_pkg_config_version" ] ; then
299 echo "Uninstalling pkg-config:"
300 cd pkg-config-$installed_pkg_config_version
301 $DO_MAKE_UNINSTALL || exit 1
302 make distclean || exit 1
304 rm pkg-config-$installed_pkg_config_version-done
307 installed_gettext_version=`ls gettext-*-done 2>/dev/null | sed 's/gettext-\(.*\)-done/\1/'`
308 if [ ! -z "$installed_gettext_version" ] ; then
309 echo "Uninstalling GNU gettext:"
310 cd gettext-$installed_gettext_version
311 $DO_MAKE_UNINSTALL || exit 1
312 make distclean || exit 1
314 rm gettext-$installed_gettext_version-done
317 installed_cmake_version=`ls cmake-*-done 2>/dev/null | sed 's/cmake-\(.*\)-done/\1/'`
318 if [ ! -z "$installed_cmake_version" ]; then
319 echo "Uninstalling CMake:"
320 cd cmake-$installed_cmake_version
321 $DO_MAKE_UNINSTALL || exit 1
322 make distclean || exit 1
324 rm cmake-$installed_cmake_version-done
327 installed_libtool_version=`ls libtool-*-done 2>/dev/null | sed 's/libtool-\(.*\)-done/\1/'`
328 if [ ! -z "$installed_libtool_version" ] ; then
329 echo "Uninstalling GNU libtool:"
330 cd libtool-$installed_libtool_version
331 mv /usr/local/bin/glibtool /usr/local/bin/libtool
332 mv /usr/local/bin/glibtoolize /usr/local/bin/libtoolize
333 $DO_MAKE_UNINSTALL || exit 1
334 make distclean || exit 1
336 rm libtool-$installed_libtool_version-done
339 installed_automake_version=`ls automake-*-done 2>/dev/null | sed 's/automake-\(.*\)-done/\1/'`
340 if [ ! -z "$installed_automake_version" ] ; then
341 echo "Uninstalling GNU automake:"
342 cd automake-$installed_automake_version
343 $DO_MAKE_UNINSTALL || exit 1
344 make distclean || exit 1
346 rm automake-$installed_automake_version-done
349 installed_autoconf_version=`ls autoconf-*-done 2>/dev/null | sed 's/autoconf-\(.*\)-done/\1/'`
350 if [ ! -z "$installed_autoconf_version" ] ; then
351 echo "Uninstalling GNU autoconf:"
352 cd autoconf-$installed_autoconf_version
353 $DO_MAKE_UNINSTALL || exit 1
354 make distclean || exit 1
356 rm autoconf-$installed_autoconf_version-done
359 installed_xz_version=`ls xz-*-done 2>/dev/null | sed 's/xz-\(.*\)-done/\1/'`
360 if [ ! -z "$installed_xz_version" ] ; then
361 echo "Uninstalling xz:"
362 cd xz-$installed_xz_version
363 $DO_MAKE_UNINSTALL || exit 1
364 make distclean || exit 1
366 rm xz-$installed_xz_version-done
372 # Do we have permission to write in /usr/local?
374 # If so, assume we have permission to write in its subdirectories.
375 # (If that's not the case, this test needs to check the subdirectories
378 # If not, do "make install", "make uninstall", and the removes for Lua
383 DO_MAKE_INSTALL="make install"
384 DO_MAKE_UNINSTALL="make uninstall"
387 DO_MAKE_INSTALL="sudo make install"
388 DO_MAKE_UNINSTALL="sudo make uninstall"
393 # If we have SDKs available, the default target OS is the major version
394 # of the one we're running; get that and strip off the third component.
396 for i in /Developer/SDKs \
397 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
398 /Library/Developer/CommandLineTools/SDKs
402 min_osx_target=`sw_vers -productVersion | sed 's/\([[0-9]]*\).\([[0-9]]*\).[[0-9]]*/\1.\2/'`
408 # Parse command-line flags:
411 # -t <target> - build libraries so that they'll work on the specified
412 # version of OS X and later versions.
413 # -u - do an uninstall.
415 while getopts ht:u name
422 min_osx_target="$OPTARG"
425 echo "Usage: macosx-setup.sh [ -t <target> ] [ -u ]" 1>&1
431 if [ "$do_uninstall" = "yes" ]
438 # To make this work on Leopard (rather than working *on* Snow Leopard
439 # when building *for* Leopard) will take more work.
441 # For one thing, Leopard's /usr/X11/lib/libXdamage.la claims, at least
442 # with all software updates applied, that the Xdamage shared library
443 # is libXdamage.1.0.0.dylib, but it is, in fact, libXdamage.1.1.0.dylib.
444 # This causes problems when building GTK+, so the script would have to
447 if [[ $DARWIN_MAJOR_VERSION -le 9 ]]; then
448 echo "This script does not support any versions of OS X before Snow Leopard" 1>&2
452 # if no make options are present, set default options
453 if [ -z "$MAKE_BUILD_OPTS" ] ; then
454 # by default use 1.5x number of cores for parallel build
455 MAKE_BUILD_OPTS="-j $(( $(sysctl -n hw.logicalcpu) * 3 / 2))"
459 # If we have a target release, look for its SDK, and build libraries
460 # against it rather than against the headers and, more importantly,
461 # libraries that come with the OS, so that we don't end up with
462 # support libraries that only work on the OS version on which
463 # we built them, not earlier versions of the same release, or
464 # earlier releases if the minimum is earlier.
466 if [ ! -z "$min_osx_target" ]
468 for i in /Developer/SDKs \
469 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
470 /Library/Developer/CommandLineTools/SDKs
472 if [ -d "$i"/"MacOSX$min_osx_target.sdk" ]
474 SDKPATH="$i"/"MacOSX$min_osx_target.sdk"
481 echo "macosx-setup.sh: Couldn't find the SDK for OS X $min_osx_target" 1>&2
486 # Make sure there are links to /usr/local/include and /usr/local/lib
487 # in the SDK's usr/local.
489 if [ ! -e $SDKPATH/usr/local/include ]
491 if [ ! -d $SDKPATH/usr/local ]
493 sudo mkdir $SDKPATH/usr/local
495 sudo ln -s /usr/local/include $SDKPATH/usr/local/include
497 if [ ! -e $SDKPATH/usr/local/lib ]
499 if [ ! -d $SDKPATH/usr/local ]
501 sudo mkdir $SDKPATH/usr/local
503 sudo ln -s /usr/local/lib $SDKPATH/usr/local/lib
507 # Set the minimum OS version for which to build to the specified
508 # minimum target OS version, so we don't, for example, end up using
509 # linker features supported by the OS verson on which we're building
510 # but not by the target version.
512 VERSION_MIN_FLAGS="-mmacosx-version-min=$min_osx_target"
515 # Compile and link against the SDK.
517 SDKFLAGS="-isysroot $SDKPATH"
519 if [[ "$min_osx_target" == "10.5" ]]
522 # Cairo is part of Mac OS X 10.6 and later.
523 # The *headers* are supplied by 10.5, but the *libraries*
524 # aren't, so we have to build it if we're building for 10.5.
526 cairo_not_in_the_os=yes
529 # Build with older versions of the support libraries, as
530 # were used on the Wireshark Leopard buildbot at one
531 # point. (Most of these versions come from the About page
532 # from Wireshark 1.8.6, the last build done on that buildbot;
533 # the ATK version isn't reported, so this is a guess.)
535 # If you want to try building with newer versions of
536 # the libraries, note that:
538 # The version of fontconfig that comes with Leopard doesn't
539 # support FC_WEIGHT_EXTRABLACK, so we can't use any version
540 # of Pango newer than 1.22.4.
542 # However, Pango 1.22.4 doesn't work with versions of GLib
543 # after 2.29.6, because Pango 1.22.4 uses G_CONST_RETURN and
544 # GLib 2.29.8 and later deprecate it (there doesn't appear to
545 # be a GLib 2.29.7). That means we'd either have to patch
546 # Pango not to use it (just use "const"; G_CONST_RETURN was
547 # there to allow code to choose whether to use "const" or not),
548 # or use GLib 2.29.6 or earlier.
550 # GLib 2.29.6 includes an implementation of g_bit_lock() that,
551 # on x86 (32-bit and 64-bit), uses asms in a fashion
552 # ("asm volatile goto") that requires GCC 4.5 or later, which
553 # is later than the compilers that come with Leopard and Snow
554 # Leopard. Recent versions of GLib check for that, but 2.29.6
555 # doesn't, so, if you want to build GLib 2.29.6 on Leopard or
556 # Snow Leopard, you would have to patch glib/gbitlock.c to do
557 # what the newer versions of GLib do:
559 # define a USE_ASM_GOTO macro that indicates whether "asm goto"
561 # #if (defined (i386) || defined (__amd64__))
562 # #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
563 # #define USE_ASM_GOTO 1
567 # replace all occurrences of
569 # #if defined (__GNUC__) && (defined (i386) || defined (__amd64__))
573 # #ifdef USE_ASM_GOTO
575 # Using GLib 2.29.6 or earlier, however, means that we can't
576 # use a version of ATK later than 2.3.93, as those versions
577 # don't work with GLib 2.29.6. The same applies to gdk-pixbuf;
578 # versions of gdk-pixbuf after 2.24.1 won't work with GLib
581 # Then you have to make sure that what you've build doesn't
582 # cause the X server that comes with Leopard to crash; at
583 # least one attempt at building for Leopard did.
585 # At least if building on Leopard, you might also find
586 # that, with various older versions of Cairo, including
587 # 1.6.4 and at least some 1.8.x versions, when you try to
588 # build it, the build fails because it can't find
589 # png_set_longjmp_fn(). I vaguely remember dealing with that,
590 # ages ago, but don't remember what I did.
599 # That version of GTK+ includes gdk-pixbuf.
600 # XXX - base this on the version of GTK+ requested.
605 # Libgcrypt 1.5.0 fails to compile due to some problem with an
606 # asm in rijndael.c, at least with i686-apple-darwin10-gcc-4.2.1
607 # (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) when building
610 # We try libgcrypt 1.4.3 instead, as that's what shows up in
611 # the version from the Leopard buildbot.
612 LIBGCRYPT_VERSION=1.4.3
615 # Build 32-bit while we're at it; Leopard has a bug that
616 # causes some BPF functions not to work with 64-bit userland
617 # code, so capturing won't work.
619 export CFLAGS="$CFLAGS -arch i386"
620 export CXXFLAGS="$CXXFLAGS -arch i386"
621 export LDFLAGS="$LDFLAGS -arch i386"
626 # You need Xcode or the command-line tools installed to get the compilers.
628 if [ ! -x /usr/bin/xcodebuild ]; then
629 echo "Please install Xcode first (should be available on DVD or from http://developer.apple.com/xcode/index.php)."
633 if [[ $TOOLKIT = qt ]]; then
635 # We need Xcode, not just the command-line tools, installed to build
638 if ! /usr/bin/xcrun -find xcrun >/dev/null 2>&1; then
639 echo "Please install Xcode first (should be available on DVD or from http://developer.apple.com/xcode/index.php)."
640 echo "The command-line build tools are not sufficient to build Qt."
645 # If we're building with GTK+, you also need the X11 SDK; with at least
646 # some versions of OS X and Xcode, that is, I think, an optional install.
647 # (Or it might be installed with X11, but I think *that* is an optional
648 # install on at least some versions of OS X.)
650 if [ ! -d /usr/X11/include ]; then
651 echo "Please install X11 and the X11 SDK first."
656 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig
659 # Do all the downloads and untarring in a subdirectory, so all that
660 # stuff can be removed once we've installed the support libraries.
662 if [ ! -d macosx-support-libs ]
664 mkdir macosx-support-libs || exit 1
666 cd macosx-support-libs
668 # Start with xz: It is the sole download format of glib later than 2.31.2
670 if [ "$XZ_VERSION" -a ! -f xz-$XZ_VERSION-done ] ; then
671 echo "Downloading, building, and installing xz:"
672 [ -f xz-$XZ_VERSION.tar.bz2 ] || curl -O http://tukaani.org/xz/xz-$XZ_VERSION.tar.bz2 || exit 1
673 bzcat xz-$XZ_VERSION.tar.bz2 | tar xf - || exit 1
675 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0" ./configure || exit 1
676 make $MAKE_BUILD_OPTS || exit 1
677 $DO_MAKE_INSTALL || exit 1
679 touch xz-$XZ_VERSION-done
682 if [ "$AUTOCONF_VERSION" -a ! -f autoconf-$AUTOCONF_VERSION-done ] ; then
683 echo "Downloading, building and installing GNU autoconf..."
684 [ -f autoconf-$AUTOCONF_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/autoconf/autoconf-$AUTOCONF_VERSION.tar.xz || exit 1
685 xzcat autoconf-$AUTOCONF_VERSION.tar.xz | tar xf - || exit 1
686 cd autoconf-$AUTOCONF_VERSION
687 ./configure || exit 1
688 make $MAKE_BUILD_OPTS || exit 1
689 $DO_MAKE_INSTALL || exit 1
691 touch autoconf-$AUTOCONF_VERSION-done
694 if [ "$AUTOMAKE_VERSION" -a ! -f automake-$AUTOMAKE_VERSION-done ] ; then
695 echo "Downloading, building and installing GNU automake..."
696 [ -f automake-$AUTOMAKE_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/automake/automake-$AUTOMAKE_VERSION.tar.xz || exit 1
697 xzcat automake-$AUTOMAKE_VERSION.tar.xz | tar xf - || exit 1
698 cd automake-$AUTOMAKE_VERSION
699 ./configure || exit 1
700 make $MAKE_BUILD_OPTS || exit 1
701 $DO_MAKE_INSTALL || exit 1
703 touch automake-$AUTOMAKE_VERSION-done
706 if [ "$LIBTOOL_VERSION" -a ! -f libtool-$LIBTOOL_VERSION-done ] ; then
707 echo "Downloading, building and installing GNU libtool..."
708 [ -f libtool-$LIBTOOL_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/libtool/libtool-$LIBTOOL_VERSION.tar.xz || exit 1
709 xzcat libtool-$LIBTOOL_VERSION.tar.xz | tar xf - || exit 1
710 cd libtool-$LIBTOOL_VERSION
711 ./configure || exit 1
712 make $MAKE_BUILD_OPTS || exit 1
713 $DO_MAKE_INSTALL || exit 1
714 mv /usr/local/bin/libtool /usr/local/bin/glibtool
715 mv /usr/local/bin/libtoolize /usr/local/bin/glibtoolize
717 touch libtool-$LIBTOOL_VERSION-done
720 if [ -n "$CMAKE" -a ! -f cmake-$CMAKE_VERSION-done ]; then
721 echo "Downloading, building, and installing CMAKE:"
722 cmake_dir=`expr $CMAKE_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
723 [ -f cmake-$CMAKE_VERSION.tar.gz ] || curl -O http://www.cmake.org/files/v$cmake_dir/cmake-$CMAKE_VERSION.tar.gz || exit 1
724 gzcat cmake-$CMAKE_VERSION.tar.gz | tar xf - || exit 1
725 cd cmake-$CMAKE_VERSION
726 ./bootstrap || exit 1
727 make $MAKE_BUILD_OPTS || exit 1
728 $DO_MAKE_INSTALL || exit 1
730 touch cmake-$CMAKE_VERSION-done
734 # Start with GNU gettext; GLib requires it, and OS X doesn't have it
735 # or a BSD-licensed replacement.
737 # At least on Lion with Xcode 4, _FORTIFY_SOURCE gets defined as 2
738 # by default, which causes, for example, stpncpy to be defined as
739 # a hairy macro that collides with the GNU gettext configure script's
740 # attempts to workaround AIX's lack of a declaration for stpncpy,
741 # with the result being a huge train wreck. Define _FORTIFY_SOURCE
742 # as 0 in an attempt to keep the trains on separate tracks.
744 if [ ! -f gettext-$GETTEXT_VERSION-done ] ; then
745 echo "Downloading, building, and installing GNU gettext:"
746 [ -f gettext-$GETTEXT_VERSION.tar.gz ] || curl -O http://ftp.gnu.org/pub/gnu/gettext/gettext-$GETTEXT_VERSION.tar.gz || exit 1
747 gzcat gettext-$GETTEXT_VERSION.tar.gz | tar xf - || exit 1
748 cd gettext-$GETTEXT_VERSION
749 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0 $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
750 make $MAKE_BUILD_OPTS || exit 1
751 $DO_MAKE_INSTALL || exit 1
753 touch gettext-$GETTEXT_VERSION-done
757 # GLib depends on pkg-config.
758 # By default, pkg-config depends on GLib; we break the dependency cycle
759 # by configuring pkg-config to use its own internal version of GLib.
761 if [ ! -f pkg-config-$PKG_CONFIG_VERSION-done ] ; then
762 echo "Downloading, building, and installing pkg-config:"
763 [ -f pkg-config-$PKG_CONFIG_VERSION.tar.gz ] || curl -O http://pkgconfig.freedesktop.org/releases/pkg-config-$PKG_CONFIG_VERSION.tar.gz || exit 1
764 gzcat pkg-config-$PKG_CONFIG_VERSION.tar.gz | tar xf - || exit 1
765 cd pkg-config-$PKG_CONFIG_VERSION
766 ./configure --with-internal-glib || exit 1
767 make $MAKE_BUILD_OPTS || exit 1
768 $DO_MAKE_INSTALL || exit 1
770 touch pkg-config-$PKG_CONFIG_VERSION-done
773 if [ ! -f glib-$GLIB_VERSION-done ] ; then
774 echo "Downloading, building, and installing GLib:"
775 glib_dir=`expr $GLIB_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
776 GLIB_MAJOR_VERSION="`expr $GLIB_VERSION : '\([0-9][0-9]*\).*'`"
777 GLIB_MINOR_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
778 GLIB_DOTDOT_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
779 if [[ $GLIB_MAJOR_VERSION -gt 2 ||
780 $GLIB_MINOR_VERSION -gt 28 ||
781 ($GLIB_MINOR_VERSION -eq 28 && $GLIB_DOTDOT_VERSION -ge 8) ]]
784 # Starting with GLib 2.28.8, xz-compressed tarballs are available.
786 [ -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
787 xzcat glib-$GLIB_VERSION.tar.xz | tar xf - || exit 1
789 [ -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
790 bzcat glib-$GLIB_VERSION.tar.bz2 | tar xf - || exit 1
792 cd glib-$GLIB_VERSION
794 # OS X ships with libffi, but doesn't provide its pkg-config file;
795 # explicitly specify LIBFFI_CFLAGS and LIBFFI_LIBS, so the configure
796 # script doesn't try to use pkg-config to get the appropriate
797 # C flags and loader flags.
799 # And, what's worse, at least with the version of Xcode that comes
800 # with Leopard, /usr/include/ffi/fficonfig.h doesn't define MACOSX,
801 # which causes the build of GLib to fail. If we don't find
802 # "#define.*MACOSX" in /usr/include/ffi/fficonfig.h, explictly
805 # While we're at it, suppress -Wformat-nonliteral to avoid a case
806 # where clang's stricter rules on when not to complain about
807 # non-literal format arguments cause it to complain about code
808 # that's safe but it wasn't told that. See my comment #25 in
811 # https://bugzilla.gnome.org/show_bug.cgi?id=691608#c25
813 # First, determine where the system include files are. (It's not
814 # necessarily /usr/include.) There's a bit of a greasy hack here;
815 # pre-5.x versions of the developer tools don't support the
816 # --show-sdk-path option, and will produce no output, so includedir
817 # will be set to /usr/include (in those older versions of the
818 # developer tools, there is a /usr/include directory).
820 includedir=`xcrun --show-sdk-path 2>/dev/null`/usr/include
821 if grep -qs '#define.*MACOSX' $includedir/ffi/fficonfig.h
823 # It's defined, nothing to do
824 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
826 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
830 # Apply the fix to GNOME bug 529806:
832 # https://bugzilla.gnome.org/show_bug.cgi?id=529806
834 # if we have a version of GLib prior to 2.30.
836 if [[ $GLIB_MAJOR_VERSION -eq 2 && $GLIB_MINOR_VERSION -le 30 ]]
838 patch -p0 <../../macosx-support-lib-patches/glib-gconvert.c.patch || exit 1
840 make $MAKE_BUILD_OPTS || exit 1
841 $DO_MAKE_INSTALL || exit 1
843 touch glib-$GLIB_VERSION-done
847 # Now we have reached a point where we can build everything but
848 # the GUI (Wireshark).
852 if [ ! -f qt-$QT_VERSION-done ] ; then
853 echo "Downloading, building, and installing Qt:"
854 QT_MAJOR_VERSION="`expr $QT_VERSION : '\([0-9][0-9]*\).*'`"
855 QT_MINOR_VERSION="`expr $QT_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
856 QT_DOTDOT_VERSION="`expr $QT_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
857 QT_MAJOR_MINOR_VERSION=$QT_MAJOR_VERSION.$QT_MINOR_VERSION
859 # What you get for this URL might just be a 302 Found reply, so use
860 # -L so we get redirected.
862 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
864 # Qt 5.1.x sets QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
865 # in qtbase/mkspecs/$TARGET_PLATFORM/qmake.conf
866 # We may need to adjust this manually in the future.
868 # The -no-c++11 flag is needed to work around
869 # https://bugreports.qt-project.org/browse/QTBUG-30487
871 tar xf qt-everywhere-opensource-src-$QT_VERSION.tar.gz
872 cd qt-everywhere-opensource-src-$QT_VERSION
873 ./configure -sdk macosx$min_osx_target -platform $TARGET_PLATFORM -opensource -confirm-license -no-c++11
875 $DO_MAKE_INSTALL || exit 1
877 touch qt-$QT_VERSION-done
883 # GTK+ 3 requires a newer Cairo build than the one that comes with
884 # 10.6, so we build Cairo if we are using GTK+ 3.
886 # In 10.6 and 10.7, it's an X11 library; if we build with "native" GTK+
887 # rather than X11 GTK+, we might have to build and install Cairo.
888 # In 10.8 and later, there is no X11, but it's included in Xquartz;
889 # again, if we build with "native" GTK+, we'd have to build and install
892 if [[ "$TOOLKIT" = gtk3 || "$cairo_not_in_the_os" = yes ]]; then
894 # Requirements for Cairo first
896 # The libpng that comes with the X11 for leopard has a bogus
897 # pkg-config file that lies about where the header files are,
898 # which causes other packages not to be able to find its
901 # if [ ! -f libpng-$PNG_VERSION-done ] ; then
902 # echo "Downloading, building, and installing libpng:"
904 # # The FTP site puts libpng x.y.* into a libpngxy directory.
906 # subdir=`echo $PNG_VERSION | sed 's/\([1-9][0-9]*\)\.\([1-9][0-9]*\).*/libpng\1\2'/`
907 # [ -f libpng-$PNG_VERSION.tar.xz ] || curl -O ftp://ftp.simplesystems.org/pub/libpng/png/src/$subdir/libpng-$PNG_VERSION.tar.xz
908 # xzcat libpng-$PNG_VERSION.tar.xz | tar xf - || exit 1
909 # cd libpng-$PNG_VERSION
910 # CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
911 # make $MAKE_BUILD_OPTS || exit 1
912 # $DO_MAKE_INSTALL || exit 1
914 # touch libpng-$PNG_VERSION-done
918 # The libpixman that comes with the X11 for Leopard is too old
919 # to support Cairo's image surface backend feature (which requires
920 # pixman-1 >= 0.22.0).
922 # if [ ! -f pixman-$PIXMAN_VERSION-done ] ; then
923 # echo "Downloading, building, and installing pixman:"
924 # [ -f pixman-$PIXMAN_VERSION.tar.gz ] || curl -O http://www.cairographics.org/releases/pixman-$PIXMAN_VERSION.tar.gz
925 # gzcat pixman-$PIXMAN_VERSION.tar.gz | tar xf - || exit 1
926 # cd pixman-$PIXMAN_VERSION
927 # CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
928 # make $MAKE_BUILD_OPTS || exit 1
929 # $DO_MAKE_INSTALL || exit 1
931 # touch pixman-$PIXMAN_VERSION-done
935 # And now Cairo itself.
937 if [ ! -f cairo-$CAIRO_VERSION-done ] ; then
938 echo "Downloading, building, and installing Cairo:"
939 CAIRO_MAJOR_VERSION="`expr $CAIRO_VERSION : '\([0-9][0-9]*\).*'`"
940 CAIRO_MINOR_VERSION="`expr $CAIRO_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
941 CAIRO_DOTDOT_VERSION="`expr $CAIRO_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
942 if [[ $CAIRO_MAJOR_VERSION -gt 1 ||
943 $CAIRO_MINOR_VERSION -gt 12 ||
944 ($CAIRO_MINOR_VERSION -eq 12 && $CAIRO_DOTDOT_VERSION -ge 2) ]]
947 # Starting with Cairo 1.12.2, the tarballs are compressed with
948 # xz rather than gzip.
950 [ -f cairo-$CAIRO_VERSION.tar.xz ] || curl -O http://cairographics.org/releases/cairo-$CAIRO_VERSION.tar.xz || exit 1
951 xzcat cairo-$CAIRO_VERSION.tar.xz | tar xf - || exit 1
953 [ -f cairo-$CAIRO_VERSION.tar.gz ] || curl -O http://cairographics.org/releases/cairo-$CAIRO_VERSION.tar.gz || exit 1
954 gzcat cairo-$CAIRO_VERSION.tar.gz | tar xf - || exit 1
956 cd cairo-$CAIRO_VERSION
957 # CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-quartz=no || exit 1
958 # Maybe follow http://cairographics.org/end_to_end_build_for_mac_os_x/
959 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-quartz=yes || exit 1
961 # We must avoid the version of libpng that comes with X11; the
962 # only way I've found to force that is to forcibly set INCLUDES
963 # when we do the build, so that this comes before CAIRO_CFLAGS,
964 # which has -I/usr/X11/include added to it before anything
965 # connected to libpng is.
967 INCLUDES="-I/usr/local/include/libpng15" make $MAKE_BUILD_OPTS || exit 1
968 $DO_MAKE_INSTALL || exit 1
970 touch cairo-$CAIRO_VERSION-done
974 if [ ! -f atk-$ATK_VERSION-done ] ; then
975 echo "Downloading, building, and installing ATK:"
976 atk_dir=`expr $ATK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
977 ATK_MAJOR_VERSION="`expr $ATK_VERSION : '\([0-9][0-9]*\).*'`"
978 ATK_MINOR_VERSION="`expr $ATK_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
979 ATK_DOTDOT_VERSION="`expr $ATK_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
980 if [[ $ATK_MAJOR_VERSION -gt 2 ||
981 ($ATK_MAJOR_VERSION -eq 2 && $ATK_MINOR_VERSION -gt 0) ||
982 ($ATK_MANOR_VERSION -eq 2 && $ATK_MINOR_VERSION -eq 0 && $ATK_DOTDOT_VERSION -ge 1) ]]
985 # Starting with ATK 2.0.1, xz-compressed tarballs are available.
987 [ -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
988 xzcat atk-$ATK_VERSION.tar.xz | tar xf - || exit 1
990 [ -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
991 bzcat atk-$ATK_VERSION.tar.bz2 | tar xf - || exit 1
994 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
995 make $MAKE_BUILD_OPTS || exit 1
996 $DO_MAKE_INSTALL || exit 1
998 touch atk-$ATK_VERSION-done
1001 if [ ! -f pango-$PANGO_VERSION-done ] ; then
1002 echo "Downloading, building, and installing Pango:"
1003 pango_dir=`expr $PANGO_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
1004 PANGO_MAJOR_VERSION="`expr $PANGO_VERSION : '\([0-9][0-9]*\).*'`"
1005 PANGO_MINOR_VERSION="`expr $PANGO_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
1006 if [[ $PANGO_MAJOR_VERSION -gt 1 ||
1007 $PANGO_MINOR_VERSION -ge 29 ]]
1010 # Starting with Pango 1.29, the tarballs are compressed with
1011 # xz rather than bzip2.
1013 [ -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
1014 xzcat pango-$PANGO_VERSION.tar.xz | tar xf - || exit 1
1016 [ -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
1017 bzcat pango-$PANGO_VERSION.tar.bz2 | tar xf - || exit 1
1019 cd pango-$PANGO_VERSION
1020 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1021 make $MAKE_BUILD_OPTS || exit 1
1022 $DO_MAKE_INSTALL || exit 1
1024 touch pango-$PANGO_VERSION-done
1027 if [ "$GDK_PIXBUF_VERSION" -a ! -f gdk-pixbuf-$GDK_PIXBUF_VERSION-done ] ; then
1028 echo "Downloading, building, and installing gdk-pixbuf:"
1029 gdk_pixbuf_dir=`expr $GDK_PIXBUF_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
1030 [ -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
1031 xzcat gdk-pixbuf-$GDK_PIXBUF_VERSION.tar.xz | tar xf - || exit 1
1032 cd gdk-pixbuf-$GDK_PIXBUF_VERSION
1034 # If we're building for 10.6, use libpng12; if you have 10.7.5, including
1035 # X11, and Xcode 4.3.3, the system has libpng15, complete with pkg-config
1036 # files, as part of X11, but 10.6's X11 has only libpng12, and the 10.6
1037 # SDK in Xcode 4.3.3 also has only libpng12, and has no pkg-config files
1038 # of its own, so we have to explicitly set LIBPNG to override the
1039 # configure script, and also force the CFLAGS to look for the header
1040 # files for libpng12 (note that -isysroot doesn't affect the arguments
1041 # to -I, so we need to include the SDK path explicitly).
1043 if [[ "$min_osx_target" = 10.6 ]]
1045 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
1047 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --without-libtiff --without-libjpeg || exit 1
1049 make $MAKE_BUILD_OPTS || exit 1
1050 $DO_MAKE_INSTALL || exit 1
1052 touch gdk-pixbuf-$GDK_PIXBUF_VERSION-done
1055 if [ ! -f gtk+-$GTK_VERSION-done ] ; then
1056 echo "Downloading, building, and installing GTK+:"
1057 gtk_dir=`expr $GTK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
1058 GTK_MAJOR_VERSION="`expr $GTK_VERSION : '\([0-9][0-9]*\).*'`"
1059 GTK_MINOR_VERSION="`expr $GTK_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
1060 GTK_DOTDOT_VERSION="`expr $GTK_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
1061 if [[ $GTK_MAJOR_VERSION -gt 2 ||
1062 $GTK_MINOR_VERSION -gt 24 ||
1063 ($GTK_MINOR_VERSION -eq 24 && $GTK_DOTDOT_VERSION -ge 5) ]]
1066 # Starting with GTK+ 2.24.5, the tarballs are compressed with
1067 # xz rather than gzip, in addition to bzip2; use xz, as we've
1068 # built and installed it, and as xz compresses better than
1069 # bzip2 so the tarballs take less time to download.
1071 [ -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
1072 xzcat gtk+-$GTK_VERSION.tar.xz | tar xf - || exit 1
1074 [ -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
1075 bzcat gtk+-$GTK_VERSION.tar.bz2 | tar xf - || exit 1
1077 cd gtk+-$GTK_VERSION
1078 if [ $DARWIN_MAJOR_VERSION -ge "12" ]
1081 # GTK+ 2.24.10, at least, doesn't build on Mountain Lion with the
1082 # CUPS printing backend - either the CUPS API changed incompatibly
1083 # or the backend was depending on non-API implementation details.
1085 # Configure it out, on Mountain Lion and later, for now.
1086 # (12 is the Darwin major version number in Mountain Lion.)
1088 # Also, configure out libtiff and libjpeg; configure scripts
1089 # just ignore unknown --enable/--disable and --with/--without
1090 # options (at least they've always do so up to now).
1092 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --disable-cups --without-libtiff --without-libjpeg || exit 1
1094 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --without-libtiff --without-libjpeg || exit 1
1096 make $MAKE_BUILD_OPTS || exit 1
1097 $DO_MAKE_INSTALL || exit 1
1099 touch gtk+-$GTK_VERSION-done
1105 # Now we have reached a point where we can build everything including
1106 # the GUI (Wireshark), but not with any optional features such as
1107 # SNMP OID resolution, some forms of decryption, Lua scripting, playback
1108 # of audio, or GeoIP mapping of IP addresses.
1110 # We now conditionally download optional libraries to support them;
1111 # the default is to download them all.
1114 if [ "$LIBSMI_VERSION" -a ! -f libsmi-$LIBSMI_VERSION-done ] ; then
1115 echo "Downloading, building, and installing libsmi:"
1116 [ -f libsmi-$LIBSMI_VERSION.tar.gz ] || curl -L -O ftp://ftp.ibr.cs.tu-bs.de/pub/local/libsmi/libsmi-$LIBSMI_VERSION.tar.gz || exit 1
1117 gzcat libsmi-$LIBSMI_VERSION.tar.gz | tar xf - || exit 1
1118 cd libsmi-$LIBSMI_VERSION
1119 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1120 make $MAKE_BUILD_OPTS || exit 1
1121 $DO_MAKE_INSTALL || exit 1
1123 touch libsmi-$LIBSMI_VERSION-done
1126 if [ "$LIBGPG_ERROR_VERSION" -a ! -f libgpg-error-$LIBGPG_ERROR_VERSION-done ] ; then
1127 echo "Downloading, building, and installing libgpg-error:"
1128 [ -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
1129 bzcat libgpg-error-$LIBGPG_ERROR_VERSION.tar.bz2 | tar xf - || exit 1
1130 cd libgpg-error-$LIBGPG_ERROR_VERSION
1131 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1132 make $MAKE_BUILD_OPTS || exit 1
1133 $DO_MAKE_INSTALL || exit 1
1135 touch libgpg-error-$LIBGPG_ERROR_VERSION-done
1138 if [ "$LIBGCRYPT_VERSION" -a ! -f libgcrypt-$LIBGCRYPT_VERSION-done ] ; then
1140 # libgpg-error is required for libgcrypt.
1142 if [ -z $LIBGPG_ERROR_VERSION ]
1144 echo "libgcrypt requires libgpg-error, but you didn't install libgpg-error." 1>&2
1148 echo "Downloading, building, and installing libgcrypt:"
1149 [ -f libgcrypt-$LIBGCRYPT_VERSION.tar.gz ] || curl -L -O ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-$LIBGCRYPT_VERSION.tar.gz || exit 1
1150 gzcat libgcrypt-$LIBGCRYPT_VERSION.tar.gz | tar xf - || exit 1
1151 cd libgcrypt-$LIBGCRYPT_VERSION
1153 # The assembler language code is not compatible with the OS X
1154 # x86 assembler (or is it an x86-64 vs. x86-32 issue?).
1156 # libgcrypt expects gnu89, not c99/gnu99, semantics for
1157 # "inline". See, for example:
1159 # http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2010-October/198809.html
1161 CFLAGS="$CFLAGS -std=gnu89 $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --disable-asm || exit 1
1162 make $MAKE_BUILD_OPTS || exit 1
1163 $DO_MAKE_INSTALL || exit 1
1165 touch libgcrypt-$LIBGCRYPT_VERSION-done
1168 if [ "$GNUTLS_VERSION" -a ! -f gnutls-$GNUTLS_VERSION-done ] ; then
1170 # GnuTLS requires libgcrypt (or nettle, in newer versions).
1172 if [ -z $LIBGCRYPT_VERSION ]
1174 echo "GnuTLS requires libgcrypt, but you didn't install libgcrypt" 1>&2
1178 echo "Downloading, building, and installing GnuTLS:"
1179 [ -f gnutls-$GNUTLS_VERSION.tar.bz2 ] || curl -L -O http://ftp.gnu.org/gnu/gnutls/gnutls-$GNUTLS_VERSION.tar.bz2 || exit 1
1180 bzcat gnutls-$GNUTLS_VERSION.tar.bz2 | tar xf - || exit 1
1181 cd gnutls-$GNUTLS_VERSION
1183 # Use libgcrypt, not nettle.
1184 # XXX - is there some reason to prefer nettle? Or does
1185 # Wireshark directly use libgcrypt routines?
1187 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --with-libgcrypt --without-p11-kit || exit 1
1188 make $MAKE_BUILD_OPTS || exit 1
1190 # The pkgconfig file for GnuTLS says "requires zlib", but OS X,
1191 # while it supplies zlib, doesn't supply a pkgconfig file for
1194 # Patch the GnuTLS pkgconfig file not to require zlib.
1195 # (If the capabilities of GnuTLS that Wireshark uses don't
1196 # depend on building GnuTLS with zlib, an alternative would be
1197 # to configure it not to use zlib.)
1199 patch -p0 lib/gnutls.pc.in <../../macosx-support-lib-patches/gnutls-pkgconfig.patch || exit 1
1200 $DO_MAKE_INSTALL || exit 1
1202 touch gnutls-$GNUTLS_VERSION-done
1205 if [ "$LUA_VERSION" -a ! -f lua-$LUA_VERSION-done ] ; then
1206 echo "Downloading, building, and installing Lua:"
1207 [ -f lua-$LUA_VERSION.tar.gz ] || curl -L -O http://www.lua.org/ftp/lua-$LUA_VERSION.tar.gz || exit 1
1208 gzcat lua-$LUA_VERSION.tar.gz | tar xf - || exit 1
1210 make $MAKE_BUILD_OPTS macosx || exit 1
1211 $DO_MAKE_INSTALL || exit 1
1213 touch lua-$LUA_VERSION-done
1216 if [ "$PORTAUDIO_VERSION" -a ! -f portaudio-done ] ; then
1217 echo "Downloading, building, and installing PortAudio:"
1218 [ -f $PORTAUDIO_VERSION.tgz ] || curl -L -O http://www.portaudio.com/archives/$PORTAUDIO_VERSION.tgz || exit 1
1219 gzcat $PORTAUDIO_VERSION.tgz | tar xf - || exit 1
1222 # Un-comment an include that's required on Lion.
1224 patch -p0 include/pa_mac_core.h <../../macosx-support-lib-patches/portaudio-pa_mac_core.h.patch
1226 # Fix a bug that showed up with clang (but is a bug with any
1229 patch -p0 src/hostapi/coreaudio/pa_mac_core.c <../../macosx-support-lib-patches/portaudio-pa_mac_core.c.patch
1231 # Disable fat builds - the configure script doesn't work right
1232 # with Xcode 4 if you leave them enabled, and we don't build
1233 # any other libraries fat (GLib, for example, would be very
1234 # hard to build fat), so there's no advantage to having PortAudio
1237 # Set the minimum OS X version to 10.4, to suppress some
1238 # deprecation warnings. (Good luck trying to make any of
1239 # this build on an OS+Xcode with a pre-10.4 SDK; we don't
1240 # worry about the user requesting that.)
1242 CFLAGS="$CFLAGS -mmacosx-version-min=10.4 $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --disable-mac-universal || exit 1
1243 make $MAKE_BUILD_OPTS || exit 1
1244 $DO_MAKE_INSTALL || exit 1
1246 touch portaudio-done
1249 if [ "$GEOIP_VERSION" -a ! -f geoip-$GEOIP_VERSION-done ]
1251 echo "Downloading, building, and installing GeoIP API:"
1252 [ -f GeoIP-$GEOIP_VERSION.tar.gz ] || curl -L -O http://geolite.maxmind.com/download/geoip/api/c/GeoIP-$GEOIP_VERSION.tar.gz || exit 1
1253 gzcat GeoIP-$GEOIP_VERSION.tar.gz | tar xf - || exit 1
1254 cd GeoIP-$GEOIP_VERSION
1255 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1257 # Grr. Their man pages "helpfully" have an ISO 8859-1
1258 # copyright symbol in the copyright notice, but OS X's
1259 # default character encoding is UTF-8. sed on Mountain
1260 # Lion barfs at the "illegal character sequence" represented
1261 # by an ISO 8859-1 copyright symbol, as it's not a valid
1264 # iconv the relevant man pages into UTF-8.
1266 for i in geoipupdate.1.in geoiplookup6.1.in geoiplookup.1.in
1268 iconv -f iso8859-1 -t utf-8 man/"$i" >man/"$i".tmp &&
1269 mv man/"$i".tmp man/"$i"
1271 make $MAKE_BUILD_OPTS || exit 1
1272 $DO_MAKE_INSTALL || exit 1
1274 touch geoip-$GEOIP_VERSION-done
1279 echo "You are now prepared to build Wireshark. To do so do:"
1280 echo "export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig"
1282 if [ -n "$CMAKE" ]; then
1283 echo "mkdir build; cd build"
1290 echo "mkdir build; cd build"
1293 echo "make $MAKE_BUILD_OPTS"
1298 echo "Make sure you are allowed capture access to the network devices"
1299 echo "See: http://wiki.wireshark.org/CaptureSetup/CapturePrivileges"