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 c-ares-*-done 2>/dev/null | sed 's/c-ares-\(.*\)-done/\1/'`
158 if [ ! -z "$installed_cares_version" ] ; then
159 echo "Uninstalling C-Ares API:"
160 cd c-ares-$installed_cares_version
161 $DO_MAKE_UNINSTALL || exit 1
162 make distclean || exit 1
164 rm c-ares-$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 $DO_MV /usr/local/bin/glibtool /usr/local/bin/libtool
382 $DO_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", the removes for Lua,
429 # and the renames of [g]libtool* with sudo.
433 DO_MAKE_INSTALL="make install"
434 DO_MAKE_UNINSTALL="make uninstall"
438 DO_MAKE_INSTALL="sudo make install"
439 DO_MAKE_UNINSTALL="sudo make uninstall"
445 # If we have SDKs available, the default target OS is the major version
446 # of the one we're running; get that and strip off the third component.
448 for i in /Developer/SDKs \
449 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
450 /Library/Developer/CommandLineTools/SDKs
454 min_osx_target=`sw_vers -productVersion | sed 's/\([[0-9]]*\).\([[0-9]]*\).[[0-9]]*/\1.\2/'`
457 # That's also the OS whose SDK we'd be using.
459 sdk_target=$min_osx_target
465 # Parse command-line flags:
468 # -t <target> - build libraries so that they'll work on the specified
469 # version of OS X and later versions.
470 # -u - do an uninstall.
472 while getopts ht:u name
479 min_osx_target="$OPTARG"
482 echo "Usage: macosx-setup.sh [ -t <target> ] [ -u ]" 1>&1
488 if [ "$do_uninstall" = "yes" ]
495 # Configure scripts tend to set CFLAGS and CXXFLAGS to "-g -O2" if
496 # invoked without CFLAGS or CXXFLAGS being set in the environment.
498 # However, we *are* setting them in the environment, for our own
499 # nefarious purposes, so start them out as "-g -O2".
505 # To make this work on Leopard (rather than working *on* Snow Leopard
506 # when building *for* Leopard) will take more work.
508 # For one thing, Leopard's /usr/X11/lib/libXdamage.la claims, at least
509 # with all software updates applied, that the Xdamage shared library
510 # is libXdamage.1.0.0.dylib, but it is, in fact, libXdamage.1.1.0.dylib.
511 # This causes problems when building GTK+, so the script would have to
514 if [[ $DARWIN_MAJOR_VERSION -le 9 ]]; then
515 echo "This script does not support any versions of OS X before Snow Leopard" 1>&2
519 # if no make options are present, set default options
520 if [ -z "$MAKE_BUILD_OPTS" ] ; then
521 # by default use 1.5x number of cores for parallel build
522 MAKE_BUILD_OPTS="-j $(( $(sysctl -n hw.logicalcpu) * 3 / 2))"
526 # If we have a target release, look for the oldest SDK that's for an
527 # OS equal to or later than that one, and build libraries against it
528 # rather than against the headers and, more importantly, libraries
529 # that come with the OS, so that we don't end up with support libraries
530 # that only work on the OS version on which we built them, not earlier
531 # versions of the same release, or earlier releases if the minimum is
534 if [ ! -z "$min_osx_target" ]
537 # Get the real version - strip off the "10.".
538 # We'll worry about that if, as, and when there's ever
541 deploy_real_version=`echo "$min_osx_target" | sed -n 's/10\.\(.*\)/\1/p'`
544 # Search each directory that might contain SDKs.
547 for sdksdir in /Developer/SDKs \
548 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
549 /Library/Developer/CommandLineTools/SDKs
552 # Get a list of all the SDKs.
554 if ! test -d "$sdksdir"
557 # There is no directory with that name.
558 # Move on to the next one in the list, if any.
564 # Get a list of all the SDKs in that directory, if any.
566 sdklist=`(cd "$sdksdir"; ls -d MacOSX10.[0-9]*.sdk 2>/dev/null)`
571 # Get the real version for this SDK.
573 sdk_real_version=`echo "$sdk" | sed -n 's/MacOSX10\.\(.*\)\.sdk/\1/p'`
576 # Is it for the deployment target or some later release?
578 if test "$sdk_real_version" -ge "$deploy_real_version"
583 sdkpath="$sdksdir/$sdk"
584 qt_sdk_arg="-sdk $sdk"
592 echo "macosx-setup.sh: Couldn't find an SDK for OS X $min_osx_target or later" 1>&2
597 sdk_target=10.$sdk_real_version
598 echo "Using the 10.$sdk_real_version SDK"
601 # Make sure there are links to /usr/local/include and /usr/local/lib
602 # in the SDK's usr/local.
604 if [ ! -e $SDKPATH/usr/local/include ]
606 if [ ! -d $SDKPATH/usr/local ]
608 sudo mkdir $SDKPATH/usr/local
610 sudo ln -s /usr/local/include $SDKPATH/usr/local/include
612 if [ ! -e $SDKPATH/usr/local/lib ]
614 if [ ! -d $SDKPATH/usr/local ]
616 sudo mkdir $SDKPATH/usr/local
618 sudo ln -s /usr/local/lib $SDKPATH/usr/local/lib
622 # Set the minimum OS version for which to build to the specified
623 # minimum target OS version, so we don't, for example, end up using
624 # linker features supported by the OS verson on which we're building
625 # but not by the target version.
627 VERSION_MIN_FLAGS="-mmacosx-version-min=$min_osx_target"
630 # Compile and link against the SDK.
632 SDKFLAGS="-isysroot $SDKPATH"
634 if [[ "$min_osx_target" == "10.5" ]]
637 # Cairo is part of Mac OS X 10.6 and later.
638 # The *headers* are supplied by 10.5, but the *libraries*
639 # aren't, so we have to build it if we're building for 10.5.
641 cairo_not_in_the_os=yes
644 # Build with older versions of the support libraries, as
645 # were used on the Wireshark Leopard buildbot at one
646 # point. (Most of these versions come from the About page
647 # from Wireshark 1.8.6, the last build done on that buildbot;
648 # the ATK version isn't reported, so this is a guess.)
650 # If you want to try building with newer versions of
651 # the libraries, note that:
653 # The version of fontconfig that comes with Leopard doesn't
654 # support FC_WEIGHT_EXTRABLACK, so we can't use any version
655 # of Pango newer than 1.22.4.
657 # However, Pango 1.22.4 doesn't work with versions of GLib
658 # after 2.29.6, because Pango 1.22.4 uses G_CONST_RETURN and
659 # GLib 2.29.8 and later deprecate it (there doesn't appear to
660 # be a GLib 2.29.7). That means we'd either have to patch
661 # Pango not to use it (just use "const"; G_CONST_RETURN was
662 # there to allow code to choose whether to use "const" or not),
663 # or use GLib 2.29.6 or earlier.
665 # GLib 2.29.6 includes an implementation of g_bit_lock() that,
666 # on x86 (32-bit and 64-bit), uses asms in a fashion
667 # ("asm volatile goto") that requires GCC 4.5 or later, which
668 # is later than the compilers that come with Leopard and Snow
669 # Leopard. Recent versions of GLib check for that, but 2.29.6
670 # doesn't, so, if you want to build GLib 2.29.6 on Leopard or
671 # Snow Leopard, you would have to patch glib/gbitlock.c to do
672 # what the newer versions of GLib do:
674 # define a USE_ASM_GOTO macro that indicates whether "asm goto"
676 # #if (defined (i386) || defined (__amd64__))
677 # #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
678 # #define USE_ASM_GOTO 1
682 # replace all occurrences of
684 # #if defined (__GNUC__) && (defined (i386) || defined (__amd64__))
688 # #ifdef USE_ASM_GOTO
690 # Using GLib 2.29.6 or earlier, however, means that we can't
691 # use a version of ATK later than 2.3.93, as those versions
692 # don't work with GLib 2.29.6. The same applies to gdk-pixbuf;
693 # versions of gdk-pixbuf after 2.24.1 won't work with GLib
696 # Then you have to make sure that what you've build doesn't
697 # cause the X server that comes with Leopard to crash; at
698 # least one attempt at building for Leopard did.
700 # At least if building on Leopard, you might also find
701 # that, with various older versions of Cairo, including
702 # 1.6.4 and at least some 1.8.x versions, when you try to
703 # build it, the build fails because it can't find
704 # png_set_longjmp_fn(). I vaguely remember dealing with that,
705 # ages ago, but don't remember what I did.
714 # That version of GTK+ includes gdk-pixbuf.
715 # XXX - base this on the version of GTK+ requested.
720 # Libgcrypt 1.5.0 fails to compile due to some problem with an
721 # asm in rijndael.c, at least with i686-apple-darwin10-gcc-4.2.1
722 # (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) when building
725 # We try libgcrypt 1.4.3 instead, as that's what shows up in
726 # the version from the Leopard buildbot.
727 LIBGCRYPT_VERSION=1.4.3
730 # Build 32-bit while we're at it; Leopard has a bug that
731 # causes some BPF functions not to work with 64-bit userland
732 # code, so capturing won't work.
734 CFLAGS="$CFLAGS -arch i386"
735 CXXFLAGS="$CXXFLAGS -arch i386"
736 export LDFLAGS="$LDFLAGS -arch i386"
744 # You need Xcode or the command-line tools installed to get the compilers.
746 if [ ! -x /usr/bin/xcodebuild ]; then
747 echo "Please install Xcode first (should be available on DVD or from http://developer.apple.com/xcode/index.php)."
751 if [ "$QT_VERSION" ]; then
753 # We need Xcode, not just the command-line tools, installed to build
756 if ! /usr/bin/xcrun -find xcrun >/dev/null 2>&1; then
757 echo "Please install Xcode first (should be available on DVD or from http://developer.apple.com/xcode/index.php)."
758 echo "The command-line build tools are not sufficient to build Qt."
762 if [ "$GTK_VERSION" ]; then
764 # If we're building with GTK+, you also need the X11 SDK; with at least
765 # some versions of OS X and Xcode, that is, I think, an optional install.
766 # (Or it might be installed with X11, but I think *that* is an optional
767 # install on at least some versions of OS X.)
769 if [ ! -d /usr/X11/include ]; then
770 echo "Please install X11 and the X11 SDK first."
771 echo " You can either use http://xquartz.macosforge.org/, e.g."
772 echo " http://xquartz-dl.macosforge.org/SL/XQuartz-$XQUARTZ_VERSION.dmg"
773 echo " or the native Apple packages if you are on Lion or below."
778 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig
781 # Do all the downloads and untarring in a subdirectory, so all that
782 # stuff can be removed once we've installed the support libraries.
784 if [ ! -d macosx-support-libs ]
786 mkdir macosx-support-libs || exit 1
788 cd macosx-support-libs
790 # Start with xz: It is the sole download format of glib later than 2.31.2
792 if [ "$XZ_VERSION" -a ! -f xz-$XZ_VERSION-done ] ; then
793 echo "Downloading, building, and installing xz:"
794 [ -f xz-$XZ_VERSION.tar.bz2 ] || curl -O http://tukaani.org/xz/xz-$XZ_VERSION.tar.bz2 || exit 1
795 bzcat xz-$XZ_VERSION.tar.bz2 | tar xf - || exit 1
797 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0" ./configure || exit 1
798 make $MAKE_BUILD_OPTS || exit 1
799 $DO_MAKE_INSTALL || exit 1
801 touch xz-$XZ_VERSION-done
804 if [ "$AUTOCONF_VERSION" -a ! -f autoconf-$AUTOCONF_VERSION-done ] ; then
805 echo "Downloading, building and installing GNU autoconf..."
806 [ -f autoconf-$AUTOCONF_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/autoconf/autoconf-$AUTOCONF_VERSION.tar.xz || exit 1
807 xzcat autoconf-$AUTOCONF_VERSION.tar.xz | tar xf - || exit 1
808 cd autoconf-$AUTOCONF_VERSION
809 ./configure || exit 1
810 make $MAKE_BUILD_OPTS || exit 1
811 $DO_MAKE_INSTALL || exit 1
813 touch autoconf-$AUTOCONF_VERSION-done
816 if [ "$AUTOMAKE_VERSION" -a ! -f automake-$AUTOMAKE_VERSION-done ] ; then
817 echo "Downloading, building and installing GNU automake..."
818 [ -f automake-$AUTOMAKE_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/automake/automake-$AUTOMAKE_VERSION.tar.xz || exit 1
819 xzcat automake-$AUTOMAKE_VERSION.tar.xz | tar xf - || exit 1
820 cd automake-$AUTOMAKE_VERSION
821 ./configure || exit 1
822 make $MAKE_BUILD_OPTS || exit 1
823 $DO_MAKE_INSTALL || exit 1
825 touch automake-$AUTOMAKE_VERSION-done
828 if [ "$LIBTOOL_VERSION" -a ! -f libtool-$LIBTOOL_VERSION-done ] ; then
829 echo "Downloading, building and installing GNU libtool..."
830 [ -f libtool-$LIBTOOL_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/libtool/libtool-$LIBTOOL_VERSION.tar.xz || exit 1
831 xzcat libtool-$LIBTOOL_VERSION.tar.xz | tar xf - || exit 1
832 cd libtool-$LIBTOOL_VERSION
833 ./configure || exit 1
834 make $MAKE_BUILD_OPTS || exit 1
835 $DO_MAKE_INSTALL || exit 1
836 $DO_MV /usr/local/bin/libtool /usr/local/bin/glibtool
837 $DO_MV /usr/local/bin/libtoolize /usr/local/bin/glibtoolize
839 touch libtool-$LIBTOOL_VERSION-done
842 if [ -n "$CMAKE" -a ! -f cmake-$CMAKE_VERSION-done ]; then
843 echo "Downloading and installing CMake:"
844 cmake_dir=`expr $CMAKE_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
846 # NOTE: the "64" in "Darwin64" doesn't mean "64-bit-only"; the
847 # package in question supports both 32-bit and 64-bit x86.
849 [ -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
850 sudo hdiutil attach http://www.cmake.org/files/v2.8/cmake-$CMAKE_VERSION-Darwin64-universal.dmg || exit 1
851 sudo installer -target / -pkg /Volumes/cmake-$CMAKE_VERSION-Darwin64-universal/cmake-$CMAKE_VERSION-Darwin64-universal.pkg || exit 1
852 sudo hdiutil detach /Volumes/cmake-$CMAKE_VERSION-Darwin64-universal
853 touch cmake-$CMAKE_VERSION-done
857 # Start with GNU gettext; GLib requires it, and OS X doesn't have it
858 # or a BSD-licensed replacement.
860 # At least on Lion with Xcode 4, _FORTIFY_SOURCE gets defined as 2
861 # by default, which causes, for example, stpncpy to be defined as
862 # a hairy macro that collides with the GNU gettext configure script's
863 # attempts to workaround AIX's lack of a declaration for stpncpy,
864 # with the result being a huge train wreck. Define _FORTIFY_SOURCE
865 # as 0 in an attempt to keep the trains on separate tracks.
867 if [ ! -f gettext-$GETTEXT_VERSION-done ] ; then
868 echo "Downloading, building, and installing GNU gettext:"
869 [ -f gettext-$GETTEXT_VERSION.tar.gz ] || curl -O http://ftp.gnu.org/pub/gnu/gettext/gettext-$GETTEXT_VERSION.tar.gz || exit 1
870 gzcat gettext-$GETTEXT_VERSION.tar.gz | tar xf - || exit 1
871 cd gettext-$GETTEXT_VERSION
872 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0 $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
873 make $MAKE_BUILD_OPTS || exit 1
874 $DO_MAKE_INSTALL || exit 1
876 touch gettext-$GETTEXT_VERSION-done
880 # GLib depends on pkg-config.
881 # By default, pkg-config depends on GLib; we break the dependency cycle
882 # by configuring pkg-config to use its own internal version of GLib.
884 if [ ! -f pkg-config-$PKG_CONFIG_VERSION-done ] ; then
885 echo "Downloading, building, and installing pkg-config:"
886 [ -f pkg-config-$PKG_CONFIG_VERSION.tar.gz ] || curl -O http://pkgconfig.freedesktop.org/releases/pkg-config-$PKG_CONFIG_VERSION.tar.gz || exit 1
887 gzcat pkg-config-$PKG_CONFIG_VERSION.tar.gz | tar xf - || exit 1
888 cd pkg-config-$PKG_CONFIG_VERSION
889 ./configure --with-internal-glib || exit 1
890 make $MAKE_BUILD_OPTS || exit 1
891 $DO_MAKE_INSTALL || exit 1
893 touch pkg-config-$PKG_CONFIG_VERSION-done
896 if [ ! -f glib-$GLIB_VERSION-done ] ; then
897 echo "Downloading, building, and installing GLib:"
898 glib_dir=`expr $GLIB_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
899 GLIB_MAJOR_VERSION="`expr $GLIB_VERSION : '\([0-9][0-9]*\).*'`"
900 GLIB_MINOR_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
901 GLIB_DOTDOT_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
902 if [[ $GLIB_MAJOR_VERSION -gt 2 ||
903 $GLIB_MINOR_VERSION -gt 28 ||
904 ($GLIB_MINOR_VERSION -eq 28 && $GLIB_DOTDOT_VERSION -ge 8) ]]
907 # Starting with GLib 2.28.8, xz-compressed tarballs are available.
909 [ -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
910 xzcat glib-$GLIB_VERSION.tar.xz | tar xf - || exit 1
912 [ -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
913 bzcat glib-$GLIB_VERSION.tar.bz2 | tar xf - || exit 1
915 cd glib-$GLIB_VERSION
917 # OS X ships with libffi, but doesn't provide its pkg-config file;
918 # explicitly specify LIBFFI_CFLAGS and LIBFFI_LIBS, so the configure
919 # script doesn't try to use pkg-config to get the appropriate
920 # C flags and loader flags.
922 # And, what's worse, at least with the version of Xcode that comes
923 # with Leopard, /usr/include/ffi/fficonfig.h doesn't define MACOSX,
924 # which causes the build of GLib to fail. If we don't find
925 # "#define.*MACOSX" in /usr/include/ffi/fficonfig.h, explicitly
928 # While we're at it, suppress -Wformat-nonliteral to avoid a case
929 # where clang's stricter rules on when not to complain about
930 # non-literal format arguments cause it to complain about code
931 # that's safe but it wasn't told that. See my comment #25 in
934 # https://bugzilla.gnome.org/show_bug.cgi?id=691608#c25
936 # First, determine where the system include files are. (It's not
937 # necessarily /usr/include.) There's a bit of a greasy hack here;
938 # pre-5.x versions of the developer tools don't support the
939 # --show-sdk-path option, and will produce no output, so includedir
940 # will be set to /usr/include (in those older versions of the
941 # developer tools, there is a /usr/include directory).
943 includedir=`xcrun --show-sdk-path 2>/dev/null`/usr/include
944 if grep -qs '#define.*MACOSX' $includedir/ffi/fficonfig.h
946 # It's defined, nothing to do
947 LIBFFI_CFLAGS="-I $includedir/ffi" LIBFFI_LIBS="-lffi" CFLAGS="$CFLAGS -Wno-format-nonliteral $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS -Wno-format-nonliteral $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
949 LIBFFI_CFLAGS="-I $includedir/ffi" LIBFFI_LIBS="-lffi" CFLAGS="$CFLAGS -DMACOSX -Wno-format-nonliteral $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS -DMACOSX -Wno-format-nonliteral $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
953 # Apply the fix to GNOME bug 529806:
955 # https://bugzilla.gnome.org/show_bug.cgi?id=529806
957 # if we have a version of GLib prior to 2.30.
959 if [[ $GLIB_MAJOR_VERSION -eq 2 && $GLIB_MINOR_VERSION -le 30 ]]
961 patch -p0 <../../macosx-support-lib-patches/glib-gconvert.c.patch || exit 1
963 make $MAKE_BUILD_OPTS || exit 1
964 $DO_MAKE_INSTALL || exit 1
966 touch glib-$GLIB_VERSION-done
970 # Now we have reached a point where we can build everything but
971 # the GUI (Wireshark).
973 if [ "$QT_VERSION" -a ! -f qt-$QT_VERSION-done ]; then
974 echo "Downloading, building, and installing Qt:"
975 QT_MAJOR_VERSION="`expr $QT_VERSION : '\([0-9][0-9]*\).*'`"
976 QT_MINOR_VERSION="`expr $QT_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
977 QT_DOTDOT_VERSION="`expr $QT_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
978 QT_MAJOR_MINOR_VERSION=$QT_MAJOR_VERSION.$QT_MINOR_VERSION
980 # What you get for this URL might just be a 302 Found reply, so use
981 # -L so we get redirected.
983 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
985 # Qt 5.1.x sets QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
986 # in qtbase/mkspecs/$TARGET_PLATFORM/qmake.conf
987 # We may need to adjust this manually in the future.
989 # The -no-c++11 flag is needed to work around
990 # https://bugreports.qt-project.org/browse/QTBUG-30487
992 tar xf qt-everywhere-opensource-src-$QT_VERSION.tar.gz
993 cd qt-everywhere-opensource-src-$QT_VERSION
995 # We don't build Qt in its Full Shining Glory, as we don't need all
996 # of its components, and it takes *forever* to build in that form.
998 # Qt 5.2.0 beta1 fails to build on OS X without -no-xcb due to bug
1001 # Qt 5.x fails to build on OS X with -no-opengl due to bug
1004 ./configure -v $qt_sdk_arg -platform $TARGET_PLATFORM \
1005 -opensource -confirm-license -no-c++11 -no-dbus \
1006 -no-sql-sqlite -no-xcb -nomake examples \
1007 -skip qtdoc -skip qtquickcontrols -skip qtwebkit \
1008 -skip qtwebkit-examples -skip qtxmlpatterns
1010 $DO_MAKE_INSTALL || exit 1
1012 touch qt-$QT_VERSION-done
1015 if [ "$GTK_VERSION" ]; then
1017 # GTK+ 3 requires a newer Cairo build than the one that comes with
1018 # 10.6, so we build Cairo if we are using GTK+ 3.
1020 # In 10.6 and 10.7, it's an X11 library; if we build with "native" GTK+
1021 # rather than X11 GTK+, we might have to build and install Cairo.
1022 # In 10.8 and later, there is no X11, but it's included in Xquartz;
1023 # again, if we build with "native" GTK+, we'd have to build and install
1026 if [[ "$GTK_MAJOR_VERSION" -eq 3 || "$cairo_not_in_the_os" = yes ]]; then
1028 # Requirements for Cairo first
1030 # The libpng that comes with the X11 for Leopard has a bogus
1031 # pkg-config file that lies about where the header files are,
1032 # which causes other packages not to be able to find its
1035 # The libpng in later versions is not what the version of
1036 # libpixman we build below wants - it wants libpng15.
1038 if [ ! -f libpng-$PNG_VERSION-done ] ; then
1039 echo "Downloading, building, and installing libpng:"
1041 # The FTP site puts libpng x.y.* into a libpngxy directory.
1043 subdir=`echo $PNG_VERSION | sed 's/\([1-9][0-9]*\)\.\([1-9][0-9]*\).*/libpng\1\2'/`
1044 [ -f libpng-$PNG_VERSION.tar.xz ] || curl -O ftp://ftp.simplesystems.org/pub/libpng/png/src/$subdir/libpng-$PNG_VERSION.tar.xz
1045 xzcat libpng-$PNG_VERSION.tar.xz | tar xf - || exit 1
1046 cd libpng-$PNG_VERSION
1047 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1048 make $MAKE_BUILD_OPTS || exit 1
1049 $DO_MAKE_INSTALL || exit 1
1051 touch libpng-$PNG_VERSION-done
1055 # The libpixman versions that come with the X11s for Leopard,
1056 # Snow Leopard, and Lion is too old to support Cairo's image
1057 # surface backend feature (which requires pixman-1 >= 0.22.0).
1059 # XXX - what about the one that comes with the latest version
1062 if [ ! -f pixman-$PIXMAN_VERSION-done ] ; then
1063 echo "Downloading, building, and installing pixman:"
1064 [ -f pixman-$PIXMAN_VERSION.tar.gz ] || curl -O http://www.cairographics.org/releases/pixman-$PIXMAN_VERSION.tar.gz
1065 gzcat pixman-$PIXMAN_VERSION.tar.gz | tar xf - || exit 1
1066 cd pixman-$PIXMAN_VERSION
1067 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1068 make $MAKE_BUILD_OPTS || exit 1
1069 $DO_MAKE_INSTALL || exit 1
1071 touch pixman-$PIXMAN_VERSION-done
1075 # And now Cairo itself.
1076 # XXX - with the libxcb that comes with 10.6,
1078 # xcb_discard_reply() is missing, and the build fails.
1080 if [ ! -f cairo-$CAIRO_VERSION-done ] ; then
1081 echo "Downloading, building, and installing Cairo:"
1082 CAIRO_MAJOR_VERSION="`expr $CAIRO_VERSION : '\([0-9][0-9]*\).*'`"
1083 CAIRO_MINOR_VERSION="`expr $CAIRO_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
1084 CAIRO_DOTDOT_VERSION="`expr $CAIRO_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
1085 if [[ $CAIRO_MAJOR_VERSION -gt 1 ||
1086 $CAIRO_MINOR_VERSION -gt 12 ||
1087 ($CAIRO_MINOR_VERSION -eq 12 && $CAIRO_DOTDOT_VERSION -ge 2) ]]
1090 # Starting with Cairo 1.12.2, the tarballs are compressed with
1091 # xz rather than gzip.
1093 [ -f cairo-$CAIRO_VERSION.tar.xz ] || curl -O http://cairographics.org/releases/cairo-$CAIRO_VERSION.tar.xz || exit 1
1094 xzcat cairo-$CAIRO_VERSION.tar.xz | tar xf - || exit 1
1096 [ -f cairo-$CAIRO_VERSION.tar.gz ] || curl -O http://cairographics.org/releases/cairo-$CAIRO_VERSION.tar.gz || exit 1
1097 gzcat cairo-$CAIRO_VERSION.tar.gz | tar xf - || exit 1
1099 cd cairo-$CAIRO_VERSION
1100 # CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-quartz=no || exit 1
1101 # Maybe follow http://cairographics.org/end_to_end_build_for_mac_os_x/
1102 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-quartz=yes || exit 1
1104 # We must avoid the version of libpng that comes with X11; the
1105 # only way I've found to force that is to forcibly set INCLUDES
1106 # when we do the build, so that this comes before CAIRO_CFLAGS,
1107 # which has -I/usr/X11/include added to it before anything
1108 # connected to libpng is.
1110 INCLUDES="-I/usr/local/include/libpng15" make $MAKE_BUILD_OPTS || exit 1
1111 $DO_MAKE_INSTALL || exit 1
1113 touch cairo-$CAIRO_VERSION-done
1117 if [ ! -f atk-$ATK_VERSION-done ] ; then
1118 echo "Downloading, building, and installing ATK:"
1119 atk_dir=`expr $ATK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
1120 ATK_MAJOR_VERSION="`expr $ATK_VERSION : '\([0-9][0-9]*\).*'`"
1121 ATK_MINOR_VERSION="`expr $ATK_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
1122 ATK_DOTDOT_VERSION="`expr $ATK_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
1123 if [[ $ATK_MAJOR_VERSION -gt 2 ||
1124 ($ATK_MAJOR_VERSION -eq 2 && $ATK_MINOR_VERSION -gt 0) ||
1125 ($ATK_MANOR_VERSION -eq 2 && $ATK_MINOR_VERSION -eq 0 && $ATK_DOTDOT_VERSION -ge 1) ]]
1128 # Starting with ATK 2.0.1, xz-compressed tarballs are available.
1130 [ -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
1131 xzcat atk-$ATK_VERSION.tar.xz | tar xf - || exit 1
1133 [ -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
1134 bzcat atk-$ATK_VERSION.tar.bz2 | tar xf - || exit 1
1137 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1138 make $MAKE_BUILD_OPTS || exit 1
1139 $DO_MAKE_INSTALL || exit 1
1141 touch atk-$ATK_VERSION-done
1144 if [ ! -f pango-$PANGO_VERSION-done ] ; then
1145 echo "Downloading, building, and installing Pango:"
1146 pango_dir=`expr $PANGO_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
1147 PANGO_MAJOR_VERSION="`expr $PANGO_VERSION : '\([0-9][0-9]*\).*'`"
1148 PANGO_MINOR_VERSION="`expr $PANGO_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
1149 if [[ $PANGO_MAJOR_VERSION -gt 1 ||
1150 $PANGO_MINOR_VERSION -ge 29 ]]
1153 # Starting with Pango 1.29, the tarballs are compressed with
1154 # xz rather than bzip2.
1156 [ -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
1157 xzcat pango-$PANGO_VERSION.tar.xz | tar xf - || exit 1
1159 [ -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
1160 bzcat pango-$PANGO_VERSION.tar.bz2 | tar xf - || exit 1
1162 cd pango-$PANGO_VERSION
1163 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1164 make $MAKE_BUILD_OPTS || exit 1
1165 $DO_MAKE_INSTALL || exit 1
1167 touch pango-$PANGO_VERSION-done
1170 if [ "$GDK_PIXBUF_VERSION" -a ! -f gdk-pixbuf-$GDK_PIXBUF_VERSION-done ] ; then
1171 echo "Downloading, building, and installing gdk-pixbuf:"
1172 gdk_pixbuf_dir=`expr $GDK_PIXBUF_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
1173 [ -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
1174 xzcat gdk-pixbuf-$GDK_PIXBUF_VERSION.tar.xz | tar xf - || exit 1
1175 cd gdk-pixbuf-$GDK_PIXBUF_VERSION
1177 # If we're building using the 10.6 SDK, force the use of libpng12.
1179 # The OS's X11, and corresponding SDK, didn't introduce libpng15,
1180 # or pkg-config files, until 10.7, so, for 10.6 have to explicitly
1181 # set LIBPNG to override the configure script, and also force the
1182 # CFLAGS to look for the header files for libpng12 (note that
1183 # -isysroot doesn't affect the arguments to -I, so we need to
1184 # include the SDK path explicitly).
1186 if [[ "$sdk_target" = 10.6 ]]
1188 LIBPNG="-L/usr/X11/lib -lpng12" CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS -I$SDKPATH/usr/X11/include/libpng12" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS -I$SDKPATH/usr/X11/include/libpng12" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --without-libtiff --without-libjpeg || exit 1
1190 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --without-libtiff --without-libjpeg || exit 1
1192 make $MAKE_BUILD_OPTS || exit 1
1193 $DO_MAKE_INSTALL || exit 1
1195 touch gdk-pixbuf-$GDK_PIXBUF_VERSION-done
1198 if [ ! -f gtk+-$GTK_VERSION-done ] ; then
1199 echo "Downloading, building, and installing GTK+:"
1200 gtk_dir=`expr $GTK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
1201 if [[ $GTK_MAJOR_VERSION -gt 2 ||
1202 $GTK_MINOR_VERSION -gt 24 ||
1203 ($GTK_MINOR_VERSION -eq 24 && $GTK_DOTDOT_VERSION -ge 5) ]]
1206 # Starting with GTK+ 2.24.5, the tarballs are compressed with
1207 # xz rather than gzip, in addition to bzip2; use xz, as we've
1208 # built and installed it, and as xz compresses better than
1209 # bzip2 so the tarballs take less time to download.
1211 [ -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
1212 xzcat gtk+-$GTK_VERSION.tar.xz | tar xf - || exit 1
1214 [ -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
1215 bzcat gtk+-$GTK_VERSION.tar.bz2 | tar xf - || exit 1
1217 cd gtk+-$GTK_VERSION
1218 if [ $DARWIN_MAJOR_VERSION -ge "12" ]
1221 # GTK+ 2.24.10, at least, doesn't build on Mountain Lion with the
1222 # CUPS printing backend - either the CUPS API changed incompatibly
1223 # or the backend was depending on non-API implementation details.
1225 # Configure it out, on Mountain Lion and later, for now.
1226 # (12 is the Darwin major version number in Mountain Lion.)
1228 # Also, configure out libtiff and libjpeg; configure scripts
1229 # just ignore unknown --enable/--disable and --with/--without
1230 # options (at least they've always do so up to now).
1232 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --disable-cups --without-libtiff --without-libjpeg || exit 1
1234 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --without-libtiff --without-libjpeg || exit 1
1236 make $MAKE_BUILD_OPTS || exit 1
1237 $DO_MAKE_INSTALL || exit 1
1239 touch gtk+-$GTK_VERSION-done
1244 # Now we have reached a point where we can build everything including
1245 # the GUI (Wireshark), but not with any optional features such as
1246 # SNMP OID resolution, some forms of decryption, Lua scripting, playback
1247 # of audio, or GeoIP mapping of IP addresses.
1249 # We now conditionally download optional libraries to support them;
1250 # the default is to download them all.
1253 if [ "$LIBSMI_VERSION" -a ! -f libsmi-$LIBSMI_VERSION-done ] ; then
1254 echo "Downloading, building, and installing libsmi:"
1255 [ -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
1256 gzcat libsmi-$LIBSMI_VERSION.tar.gz | tar xf - || exit 1
1257 cd libsmi-$LIBSMI_VERSION
1258 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1259 make $MAKE_BUILD_OPTS || exit 1
1260 $DO_MAKE_INSTALL || exit 1
1262 touch libsmi-$LIBSMI_VERSION-done
1265 if [ "$LIBGPG_ERROR_VERSION" -a ! -f libgpg-error-$LIBGPG_ERROR_VERSION-done ] ; then
1266 echo "Downloading, building, and installing libgpg-error:"
1267 [ -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
1268 bzcat libgpg-error-$LIBGPG_ERROR_VERSION.tar.bz2 | tar xf - || exit 1
1269 cd libgpg-error-$LIBGPG_ERROR_VERSION
1270 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1271 make $MAKE_BUILD_OPTS || exit 1
1272 $DO_MAKE_INSTALL || exit 1
1274 touch libgpg-error-$LIBGPG_ERROR_VERSION-done
1277 if [ "$LIBGCRYPT_VERSION" -a ! -f libgcrypt-$LIBGCRYPT_VERSION-done ] ; then
1279 # libgpg-error is required for libgcrypt.
1281 if [ -z $LIBGPG_ERROR_VERSION ]
1283 echo "libgcrypt requires libgpg-error, but you didn't install libgpg-error." 1>&2
1287 echo "Downloading, building, and installing libgcrypt:"
1288 [ -f libgcrypt-$LIBGCRYPT_VERSION.tar.gz ] || curl -L -O ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-$LIBGCRYPT_VERSION.tar.gz || exit 1
1289 gzcat libgcrypt-$LIBGCRYPT_VERSION.tar.gz | tar xf - || exit 1
1290 cd libgcrypt-$LIBGCRYPT_VERSION
1292 # The assembler language code is not compatible with the OS X
1293 # x86 assembler (or is it an x86-64 vs. x86-32 issue?).
1295 # libgcrypt expects gnu89, not c99/gnu99, semantics for
1296 # "inline". See, for example:
1298 # http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2010-October/198809.html
1300 CFLAGS="$CFLAGS -std=gnu89 $VERSION_MIN_FLAGS $SDKFLAGS" CFLAGS="$CFLAGS -std=gnu89 $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --disable-asm || exit 1
1301 make $MAKE_BUILD_OPTS || exit 1
1302 $DO_MAKE_INSTALL || exit 1
1304 touch libgcrypt-$LIBGCRYPT_VERSION-done
1307 if [ "$GNUTLS_VERSION" -a ! -f gnutls-$GNUTLS_VERSION-done ] ; then
1309 # GnuTLS requires libgcrypt (or nettle, in newer versions).
1311 if [ -z $LIBGCRYPT_VERSION ]
1313 echo "GnuTLS requires libgcrypt, but you didn't install libgcrypt" 1>&2
1317 echo "Downloading, building, and installing GnuTLS:"
1318 [ -f gnutls-$GNUTLS_VERSION.tar.bz2 ] || curl -L -O http://ftp.gnu.org/gnu/gnutls/gnutls-$GNUTLS_VERSION.tar.bz2 || exit 1
1319 bzcat gnutls-$GNUTLS_VERSION.tar.bz2 | tar xf - || exit 1
1320 cd gnutls-$GNUTLS_VERSION
1322 # Use libgcrypt, not nettle.
1323 # XXX - is there some reason to prefer nettle? Or does
1324 # Wireshark directly use libgcrypt routines?
1326 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --with-libgcrypt --without-p11-kit || exit 1
1327 make $MAKE_BUILD_OPTS || exit 1
1329 # The pkgconfig file for GnuTLS says "requires zlib", but OS X,
1330 # while it supplies zlib, doesn't supply a pkgconfig file for
1333 # Patch the GnuTLS pkgconfig file not to require zlib.
1334 # (If the capabilities of GnuTLS that Wireshark uses don't
1335 # depend on building GnuTLS with zlib, an alternative would be
1336 # to configure it not to use zlib.)
1338 patch -p0 lib/gnutls.pc.in <../../macosx-support-lib-patches/gnutls-pkgconfig.patch || exit 1
1339 $DO_MAKE_INSTALL || exit 1
1341 touch gnutls-$GNUTLS_VERSION-done
1344 if [ "$LUA_VERSION" -a ! -f lua-$LUA_VERSION-done ] ; then
1345 echo "Downloading, building, and installing Lua:"
1346 [ -f lua-$LUA_VERSION.tar.gz ] || curl -L -O http://www.lua.org/ftp/lua-$LUA_VERSION.tar.gz || exit 1
1347 gzcat lua-$LUA_VERSION.tar.gz | tar xf - || exit 1
1349 make $MAKE_BUILD_OPTS macosx || exit 1
1350 $DO_MAKE_INSTALL || exit 1
1352 touch lua-$LUA_VERSION-done
1355 if [ "$PORTAUDIO_VERSION" -a ! -f portaudio-done ] ; then
1356 echo "Downloading, building, and installing PortAudio:"
1357 [ -f $PORTAUDIO_VERSION.tgz ] || curl -L -O http://www.portaudio.com/archives/$PORTAUDIO_VERSION.tgz || exit 1
1358 gzcat $PORTAUDIO_VERSION.tgz | tar xf - || exit 1
1361 # Un-comment an include that's required on Lion.
1363 patch -p0 include/pa_mac_core.h <../../macosx-support-lib-patches/portaudio-pa_mac_core.h.patch
1365 # Fix a bug that showed up with clang (but is a bug with any
1368 patch -p0 src/hostapi/coreaudio/pa_mac_core.c <../../macosx-support-lib-patches/portaudio-pa_mac_core.c.patch
1370 # Disable fat builds - the configure script doesn't work right
1371 # with Xcode 4 if you leave them enabled, and we don't build
1372 # any other libraries fat (GLib, for example, would be very
1373 # hard to build fat), so there's no advantage to having PortAudio
1376 # Set the minimum OS X version to 10.4, to suppress some
1377 # deprecation warnings. (Good luck trying to make any of
1378 # this build on an OS+Xcode with a pre-10.4 SDK; we don't
1379 # worry about the user requesting that.)
1381 CFLAGS="$CFLAGS -mmacosx-version-min=10.4 $SDKFLAGS" CXXFLAGS="$CXXFLAGS -mmacosx-version-min=10.4 $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --disable-mac-universal || exit 1
1382 make $MAKE_BUILD_OPTS || exit 1
1383 $DO_MAKE_INSTALL || exit 1
1385 touch portaudio-done
1388 if [ "$GEOIP_VERSION" -a ! -f geoip-$GEOIP_VERSION-done ]
1390 echo "Downloading, building, and installing GeoIP API:"
1391 [ -f GeoIP-$GEOIP_VERSION.tar.gz ] || curl -L -O http://geolite.maxmind.com/download/geoip/api/c/GeoIP-$GEOIP_VERSION.tar.gz || exit 1
1392 gzcat GeoIP-$GEOIP_VERSION.tar.gz | tar xf - || exit 1
1393 cd GeoIP-$GEOIP_VERSION
1394 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1396 # Grr. Their man pages "helpfully" have an ISO 8859-1
1397 # copyright symbol in the copyright notice, but OS X's
1398 # default character encoding is UTF-8. sed on Mountain
1399 # Lion barfs at the "illegal character sequence" represented
1400 # by an ISO 8859-1 copyright symbol, as it's not a valid
1403 # iconv the relevant man pages into UTF-8.
1405 for i in geoipupdate.1.in geoiplookup6.1.in geoiplookup.1.in
1407 iconv -f iso8859-1 -t utf-8 man/"$i" >man/"$i".tmp &&
1408 mv man/"$i".tmp man/"$i"
1410 make $MAKE_BUILD_OPTS || exit 1
1411 $DO_MAKE_INSTALL || exit 1
1413 touch geoip-$GEOIP_VERSION-done
1416 if [ "$CARES_VERSION" -a ! -f c-ares-$CARES_VERSION-done ]
1418 echo "Downloading, building, and installing C-Ares API:"
1419 [ -f c-ares-$CARES_VERSION.tar.gz ] || curl -L -O http://c-ares.haxx.se/download/c-ares-$CARES_VERSION.tar.gz || exit 1
1420 gzcat c-ares-$CARES_VERSION.tar.gz | tar xf - || exit 1
1421 cd c-ares-$CARES_VERSION
1422 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1423 make $MAKE_BUILD_OPTS || exit 1
1424 $DO_MAKE_INSTALL || exit 1
1426 touch c-ares-$CARES_VERSION-done
1431 echo "You are now prepared to build Wireshark. To do so do:"
1432 echo "export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig"
1434 if [ -n "$CMAKE" ]; then
1435 echo "mkdir build; cd build"
1442 echo "mkdir build; cd build"
1445 echo "make $MAKE_BUILD_OPTS"
1450 echo "Make sure you are allowed capture access to the network devices"
1451 echo "See: http://wiki.wireshark.org/CaptureSetup/CapturePrivileges"