HACK: pinfo->private_data points to smb_info again
[wireshark-wip.git] / macosx-setup.sh
blobe7f7db36a25cdb0b1f1ab2e02007b93499beca6c
1 #!/bin/sh
2 # Setup development environment on Mac OS X (tested with 10.6.8 and Xcode 3.2.6)
4 # $Id$
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 build cmake
28 # CMAKE=1
30 # To build all libraries as 32-bit libraries uncomment the following three lines.
32 # export CFLAGS="$CFLAGS -arch i386"
33 # export CXXFLAGS="$CXXFLAGS -arch i386"
34 # export LDFLAGS="$LDFLAGS -arch i386"
36 # and change "macx-clang" to "macx-clang-32" in the line below.
38 # Note: when building against the 10.6 SDK, clang fails, because there's
39 # a missing libstdc++.dylib in the SDK; this does not bother g++, however.
41 #TARGET_PLATFORM=macx-g++
42 TARGET_PLATFORM=macx-clang
45 # Versions of packages to download and install.
49 # Some packages need xz to unpack their current source.
50 # xz is not yet provided with OS X.
52 XZ_VERSION=5.0.4
55 # In case we want to build with cmake.
57 CMAKE_VERSION=2.8.10.2
60 # The following libraries and tools are required even to build only TShark.
62 GETTEXT_VERSION=0.18.2
63 GLIB_VERSION=2.36.0
64 PKG_CONFIG_VERSION=0.28
67 # One or more of the following libraries are required to build Wireshark.
69 # If you don't want to build with Qt, comment out the QT_VERSION= line.
71 # If you want to build with GTK+ 2, comment out the GTK_VERSION=3.* line
72 # and un-comment the GTK_VERSION=2.* line.
74 # If you don't want to build with GTK+ at all, comment out both lines.
76 #QT_VERSION=5.1.1
77 QT_VERSION=5.2.0
78 GTK_VERSION=2.24.17
79 #GTK_VERSION=3.5.2
80 if [ "$GTK_VERSION" ]; then
82 # We'll be building GTK+, so we need some additional libraries.
84 GTK_MAJOR_VERSION="`expr $GTK_VERSION : '\([0-9][0-9]*\).*'`"
85 GTK_MINOR_VERSION="`expr $GTK_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
86 GTK_DOTDOT_VERSION="`expr $GTK_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
88 ATK_VERSION=2.8.0
89 PANGO_VERSION=1.30.1
90 PNG_VERSION=1.5.17
91 PIXMAN_VERSION=0.26.0
92 CAIRO_VERSION=1.12.2
93 GDK_PIXBUF_VERSION=2.28.0
97 # The following libraries are optional.
98 # Comment them out if you don't want them, but note that some of
99 # the optional libraries are required by other optional libraries.
101 LIBSMI_VERSION=0.4.8
103 # libgpg-error is required for libgcrypt.
105 LIBGPG_ERROR_VERSION=1.10
107 # libgcrypt is required for GnuTLS.
108 # XXX - the link for "Libgcrypt source code" at
109 # http://www.gnupg.org/download/#libgcrypt is for 1.5.0, and is a bzip2
110 # file, but http://directory.fsf.org/project/libgcrypt/ lists only
111 # 1.4.6.
113 LIBGCRYPT_VERSION=1.5.0
114 GNUTLS_VERSION=2.12.19
115 # Stay with Lua 5.1 when updating until the code has been changed
116 # to support 5.2
117 LUA_VERSION=5.1.5
118 PORTAUDIO_VERSION=pa_stable_v19_20111121
120 # XXX - they appear to have an unversioned gzipped tarball for the
121 # current version; should we just download that, with some other
122 # way of specifying whether to download the GeoIP API?
124 GEOIP_VERSION=1.4.8
126 CARES_VERSION=1.10.0
128 DARWIN_MAJOR_VERSION=`uname -r | sed 's/\([0-9]*\).*/\1/'`
131 # GNU autotools; they're provided with releases up to Snow Leopard, but
132 # not in later releases.
134 if [[ $DARWIN_MAJOR_VERSION -gt 10 ]]; then
135 AUTOCONF_VERSION=2.69
136 AUTOMAKE_VERSION=1.13.3
137 LIBTOOL_VERSION=2.4.2
140 uninstall() {
141 if [ -d macosx-support-libs ]
142 then
143 cd macosx-support-libs
146 # Uninstall items in the reverse order from the order in which they're
147 # installed. Only uninstall if the download/build/install process
148 # completed; uninstall the version that appears in the name of
149 # the -done file.
151 # We also do a "make distclean", so that we don't have leftovers from
152 # old configurations.
155 installed_cares_version=`ls cares-*-done 2>/dev/null | sed 's/cares-\(.*\)-done/\1/'`
156 if [ ! -z "$installed_cares_version" ] ; then
157 echo "Uninstalling C-Ares API:"
158 cd cares-$installed_cares_version
159 $DO_MAKE_UNINSTALL || exit 1
160 make distclean || exit 1
161 cd ..
162 rm cares-$installed_cares_version-done
165 installed_geoip_version=`ls geoip-*-done 2>/dev/null | sed 's/geoip-\(.*\)-done/\1/'`
166 if [ ! -z "$installed_geoip_version" ] ; then
167 echo "Uninstalling GeoIP API:"
168 cd GeoIP-$installed_geoip_version
169 $DO_MAKE_UNINSTALL || exit 1
170 make distclean || exit 1
171 cd ..
172 rm geoip-$installed_geoip_version-done
175 if [ "$PORTAUDIO_VERSION" -a -f portaudio-done ] ; then
176 echo "Uninstalling PortAudio:"
177 cd portaudio
178 $DO_MAKE_UNINSTALL || exit 1
179 make distclean || exit 1
180 cd ..
181 rm portaudio-done
184 installed_lua_version=`ls lua-*-done 2>/dev/null | sed 's/lua-\(.*\)-done/\1/'`
185 if [ ! -z "$installed_lua_version" ] ; then
186 echo "Uninstalling Lua:"
188 # Lua has no "make uninstall", so just remove stuff manually.
189 # There's no configure script, so there's no need for
190 # "make distclean", either; just do "make clean".
192 (cd /usr/local/bin; $DO_RM -f lua luac)
193 (cd /usr/local/include; $DO_RM -f lua.h luaconf.h lualib.h lauxlib.h lua.hpp)
194 (cd /usr/local/lib; $DO_RM -f liblua.a)
195 (cd /usr/local/man/man1; $DO_RM -f lua.1 luac.1)
196 cd lua-$installed_lua_version
197 make clean || exit 1
198 cd ..
199 rm lua-$installed_lua_version-done
202 installed_gnutls_version=`ls gnutls-*-done 2>/dev/null | sed 's/gnutls-\(.*\)-done/\1/'`
203 if [ ! -z "$installed_gnutls_version" ] ; then
204 echo "Uninstalling GnuTLS:"
205 cd gnutls-$installed_gnutls_version
206 $DO_MAKE_UNINSTALL || exit 1
207 make distclean || exit 1
208 cd ..
209 rm gnutls-$installed_gnutls_version-done
212 installed_libgcrypt_version=`ls libgcrypt-*-done 2>/dev/null | sed 's/libgcrypt-\(.*\)-done/\1/'`
213 if [ ! -z "$installed_libgcrypt_version" ] ; then
214 echo "Uninstalling libgcrypt:"
215 cd libgcrypt-$installed_libgcrypt_version
216 $DO_MAKE_UNINSTALL || exit 1
217 make distclean || exit 1
218 cd ..
219 rm libgcrypt-$installed_libgcrypt_version-done
222 installed_libgpg_error_version=`ls libgpg-error-*-done 2>/dev/null | sed 's/libgpg-error-\(.*\)-done/\1/'`
223 if [ ! -z "$installed_libgpg_error_version" ] ; then
224 echo "Uninstalling libgpg-error:"
225 cd libgpg-error-$installed_libgpg_error_version
226 $DO_MAKE_UNINSTALL || exit 1
227 make distclean || exit 1
228 cd ..
229 rm libgpg-error-$installed_libgpg_error_version-done
232 installed_libsmi_version=`ls libsmi-*-done 2>/dev/null | sed 's/libsmi-\(.*\)-done/\1/'`
233 if [ ! -z "$installed_libsmi_version" ] ; then
234 echo "Uninstalling libsmi:"
235 cd libsmi-$installed_libsmi_version
236 $DO_MAKE_UNINSTALL || exit 1
237 make distclean || exit 1
238 cd ..
239 rm libsmi-$installed_libsmi_version-done
242 installed_gtk_version=`ls gtk+-*-done 2>/dev/null | sed 's/gtk+-\(.*\)-done/\1/'`
243 if [ ! -z "$installed_gtk_version" ] ; then
244 echo "Uninstalling GTK+:"
245 cd gtk+-$installed_gtk_version
246 $DO_MAKE_UNINSTALL || exit 1
247 make distclean || exit 1
248 cd ..
249 rm gtk+-$installed_gtk_version-done
252 installed_gdk_pixbuf_version=`ls gdk-pixbuf-*-done 2>/dev/null | sed 's/gdk-pixbuf-\(.*\)-done/\1/'`
253 if [ ! -z "$installed_gdk_pixbuf_version" ] ; then
254 echo "Uninstalling gdk-pixbuf:"
255 cd gdk-pixbuf-$installed_gdk_pixbuf_version
256 $DO_MAKE_UNINSTALL || exit 1
257 make distclean || exit 1
258 cd ..
259 rm gdk-pixbuf-$installed_gdk_pixbuf_version-done
262 installed_pango_version=`ls pango-*-done 2>/dev/null | sed 's/pango-\(.*\)-done/\1/'`
263 if [ ! -z "$installed_pango_version" ] ; then
264 echo "Uninstalling Pango:"
265 cd pango-$installed_pango_version
266 $DO_MAKE_UNINSTALL || exit 1
267 make distclean || exit 1
268 cd ..
269 rm pango-$installed_pango_version-done
272 installed_atk_version=`ls atk-*-done 2>/dev/null | sed 's/atk-\(.*\)-done/\1/'`
273 if [ ! -z "$installed_atk_version" ] ; then
274 echo "Uninstalling ATK:"
275 cd atk-$installed_atk_version
276 $DO_MAKE_UNINSTALL || exit 1
277 make distclean || exit 1
278 cd ..
279 rm atk-$installed_atk_version-done
282 installed_cairo_version=`ls cairo-*-done 2>/dev/null | sed 's/cairo-\(.*\)-done/\1/'`
283 if [ ! -z "$installed_cairo_version" ] ; then
284 echo "Uninstalling Cairo:"
285 cd cairo-$installed_cairo_version
286 $DO_MAKE_UNINSTALL || exit 1
287 make distclean || exit 1
288 cd ..
289 rm cairo-$installed_cairo_version-done
292 installed_pixman_version=`ls pixman-*-done 2>/dev/null | sed 's/pixman-\(.*\)-done/\1/'`
293 if [ ! -z "$installed_pixman_version" ] ; then
294 echo "Uninstalling pixman:"
295 cd pixman-$installed_pixman_version
296 $DO_MAKE_UNINSTALL || exit 1
297 make distclean || exit 1
298 cd ..
299 rm pixman-$installed_pixman_version-done
302 installed_libpng_version=`ls libpng-*-done 2>/dev/null | sed 's/libpng-\(.*\)-done/\1/'`
303 if [ ! -z "$installed_libpng_version" ] ; then
304 echo "Uninstalling libpng:"
305 cd libpng-$installed_libpng_version
306 $DO_MAKE_UNINSTALL || exit 1
307 make distclean || exit 1
308 cd ..
309 rm libpng-$installed_libpng_version-done
312 installed_qt_version=`ls qt-*-done 2>/dev/null | sed 's/qt-\(.*\)-done/\1/'`
313 if [ ! -z "$installed_qt_version" ] ; then
314 echo "Uninstalling Qt:"
315 cd qt-everywhere-opensource-src-$installed_qt_version
316 $DO_MAKE_UNINSTALL || exit 1
318 # XXX - "make distclean" doesn't work. qmake sure does a
319 # good job of constructing Makefiles that work correctly....
321 #make distclean || exit 1
322 cd ..
323 rm qt-$installed_qt_version-done
326 installed_glib_version=`ls glib-*-done 2>/dev/null | sed 's/glib-\(.*\)-done/\1/'`
327 if [ ! -z "$installed_glib_version" ] ; then
328 echo "Uninstalling GLib:"
329 cd glib-$installed_glib_version
330 $DO_MAKE_UNINSTALL || exit 1
331 make distclean || exit 1
332 cd ..
333 rm glib-$installed_glib_version-done
336 installed_pkg_config_version=`ls pkg-config-*-done 2>/dev/null | sed 's/pkg-config-\(.*\)-done/\1/'`
337 if [ ! -z "$installed_pkg_config_version" ] ; then
338 echo "Uninstalling pkg-config:"
339 cd pkg-config-$installed_pkg_config_version
340 $DO_MAKE_UNINSTALL || exit 1
341 make distclean || exit 1
342 cd ..
343 rm pkg-config-$installed_pkg_config_version-done
346 installed_gettext_version=`ls gettext-*-done 2>/dev/null | sed 's/gettext-\(.*\)-done/\1/'`
347 if [ ! -z "$installed_gettext_version" ] ; then
348 echo "Uninstalling GNU gettext:"
349 cd gettext-$installed_gettext_version
350 $DO_MAKE_UNINSTALL || exit 1
351 make distclean || exit 1
352 cd ..
353 rm gettext-$installed_gettext_version-done
356 installed_cmake_version=`ls cmake-*-done 2>/dev/null | sed 's/cmake-\(.*\)-done/\1/'`
357 if [ ! -z "$installed_cmake_version" ]; then
358 echo "Uninstalling CMake:"
359 cd cmake-$installed_cmake_version
360 $DO_MAKE_UNINSTALL || exit 1
361 make distclean || exit 1
362 cd ..
363 rm cmake-$installed_cmake_version-done
366 installed_libtool_version=`ls libtool-*-done 2>/dev/null | sed 's/libtool-\(.*\)-done/\1/'`
367 if [ ! -z "$installed_libtool_version" ] ; then
368 echo "Uninstalling GNU libtool:"
369 cd libtool-$installed_libtool_version
370 mv /usr/local/bin/glibtool /usr/local/bin/libtool
371 mv /usr/local/bin/glibtoolize /usr/local/bin/libtoolize
372 $DO_MAKE_UNINSTALL || exit 1
373 make distclean || exit 1
374 cd ..
375 rm libtool-$installed_libtool_version-done
378 installed_automake_version=`ls automake-*-done 2>/dev/null | sed 's/automake-\(.*\)-done/\1/'`
379 if [ ! -z "$installed_automake_version" ] ; then
380 echo "Uninstalling GNU automake:"
381 cd automake-$installed_automake_version
382 $DO_MAKE_UNINSTALL || exit 1
383 make distclean || exit 1
384 cd ..
385 rm automake-$installed_automake_version-done
388 installed_autoconf_version=`ls autoconf-*-done 2>/dev/null | sed 's/autoconf-\(.*\)-done/\1/'`
389 if [ ! -z "$installed_autoconf_version" ] ; then
390 echo "Uninstalling GNU autoconf:"
391 cd autoconf-$installed_autoconf_version
392 $DO_MAKE_UNINSTALL || exit 1
393 make distclean || exit 1
394 cd ..
395 rm autoconf-$installed_autoconf_version-done
398 installed_xz_version=`ls xz-*-done 2>/dev/null | sed 's/xz-\(.*\)-done/\1/'`
399 if [ ! -z "$installed_xz_version" ] ; then
400 echo "Uninstalling xz:"
401 cd xz-$installed_xz_version
402 $DO_MAKE_UNINSTALL || exit 1
403 make distclean || exit 1
404 cd ..
405 rm xz-$installed_xz_version-done
411 # Do we have permission to write in /usr/local?
413 # If so, assume we have permission to write in its subdirectories.
414 # (If that's not the case, this test needs to check the subdirectories
415 # as well.)
417 # If not, do "make install", "make uninstall", and the removes for Lua
418 # with sudo.
420 if [ -w /usr/local ]
421 then
422 DO_MAKE_INSTALL="make install"
423 DO_MAKE_UNINSTALL="make uninstall"
424 DO_RM="rm"
425 else
426 DO_MAKE_INSTALL="sudo make install"
427 DO_MAKE_UNINSTALL="sudo make uninstall"
428 DO_RM="sudo rm"
432 # If we have SDKs available, the default target OS is the major version
433 # of the one we're running; get that and strip off the third component.
435 for i in /Developer/SDKs \
436 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
437 /Library/Developer/CommandLineTools/SDKs
439 if [ -d "$i" ]
440 then
441 min_osx_target=`sw_vers -productVersion | sed 's/\([[0-9]]*\).\([[0-9]]*\).[[0-9]]*/\1.\2/'`
442 break
444 done
447 # Parse command-line flags:
449 # -h - print help.
450 # -t <target> - build libraries so that they'll work on the specified
451 # version of OS X and later versions.
452 # -u - do an uninstall.
454 while getopts ht:u name
456 case $name in
458 do_uninstall=yes
461 min_osx_target="$OPTARG"
463 h|?)
464 echo "Usage: macosx-setup.sh [ -t <target> ] [ -u ]" 1>&1
465 exit 0
467 esac
468 done
470 if [ "$do_uninstall" = "yes" ]
471 then
472 uninstall
473 exit 0
477 # Configure scripts tend to set CFLAGS and CXXFLAGS to "-g -O2" if
478 # invoked without CFLAGS or CXXFLAGS being set in the environment.
480 # However, we *are* setting them in the environment, for our own
481 # nefarious purposes, so start them out as "-g -O2".
483 CFLAGS="-g -O2"
484 CXXFLAGS="-g -O2"
487 # To make this work on Leopard (rather than working *on* Snow Leopard
488 # when building *for* Leopard) will take more work.
490 # For one thing, Leopard's /usr/X11/lib/libXdamage.la claims, at least
491 # with all software updates applied, that the Xdamage shared library
492 # is libXdamage.1.0.0.dylib, but it is, in fact, libXdamage.1.1.0.dylib.
493 # This causes problems when building GTK+, so the script would have to
494 # fix that file.
496 if [[ $DARWIN_MAJOR_VERSION -le 9 ]]; then
497 echo "This script does not support any versions of OS X before Snow Leopard" 1>&2
498 exit 1
501 # if no make options are present, set default options
502 if [ -z "$MAKE_BUILD_OPTS" ] ; then
503 # by default use 1.5x number of cores for parallel build
504 MAKE_BUILD_OPTS="-j $(( $(sysctl -n hw.logicalcpu) * 3 / 2))"
508 # If we have a target release, look for its SDK, and build libraries
509 # against it rather than against the headers and, more importantly,
510 # libraries that come with the OS, so that we don't end up with
511 # support libraries that only work on the OS version on which
512 # we built them, not earlier versions of the same release, or
513 # earlier releases if the minimum is earlier.
515 if [ ! -z "$min_osx_target" ]
516 then
517 for i in /Developer/SDKs \
518 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
519 /Library/Developer/CommandLineTools/SDKs
521 if [ -d "$i"/"MacOSX$min_osx_target.sdk" ]
522 then
523 SDKPATH="$i"/"MacOSX$min_osx_target.sdk"
524 break
526 done
528 if [ -z "$SDKPATH" ]
529 then
530 echo "macosx-setup.sh: Couldn't find the SDK for OS X $min_osx_target" 1>&2
531 exit 1
535 # Make sure there are links to /usr/local/include and /usr/local/lib
536 # in the SDK's usr/local.
538 if [ ! -e $SDKPATH/usr/local/include ]
539 then
540 if [ ! -d $SDKPATH/usr/local ]
541 then
542 sudo mkdir $SDKPATH/usr/local
544 sudo ln -s /usr/local/include $SDKPATH/usr/local/include
546 if [ ! -e $SDKPATH/usr/local/lib ]
547 then
548 if [ ! -d $SDKPATH/usr/local ]
549 then
550 sudo mkdir $SDKPATH/usr/local
552 sudo ln -s /usr/local/lib $SDKPATH/usr/local/lib
556 # Set the minimum OS version for which to build to the specified
557 # minimum target OS version, so we don't, for example, end up using
558 # linker features supported by the OS verson on which we're building
559 # but not by the target version.
561 VERSION_MIN_FLAGS="-mmacosx-version-min=$min_osx_target"
564 # Compile and link against the SDK.
566 SDKFLAGS="-isysroot $SDKPATH"
568 if [[ "$min_osx_target" == "10.5" ]]
569 then
571 # Cairo is part of Mac OS X 10.6 and later.
572 # The *headers* are supplied by 10.5, but the *libraries*
573 # aren't, so we have to build it if we're building for 10.5.
575 cairo_not_in_the_os=yes
578 # Build with older versions of the support libraries, as
579 # were used on the Wireshark Leopard buildbot at one
580 # point. (Most of these versions come from the About page
581 # from Wireshark 1.8.6, the last build done on that buildbot;
582 # the ATK version isn't reported, so this is a guess.)
584 # If you want to try building with newer versions of
585 # the libraries, note that:
587 # The version of fontconfig that comes with Leopard doesn't
588 # support FC_WEIGHT_EXTRABLACK, so we can't use any version
589 # of Pango newer than 1.22.4.
591 # However, Pango 1.22.4 doesn't work with versions of GLib
592 # after 2.29.6, because Pango 1.22.4 uses G_CONST_RETURN and
593 # GLib 2.29.8 and later deprecate it (there doesn't appear to
594 # be a GLib 2.29.7). That means we'd either have to patch
595 # Pango not to use it (just use "const"; G_CONST_RETURN was
596 # there to allow code to choose whether to use "const" or not),
597 # or use GLib 2.29.6 or earlier.
599 # GLib 2.29.6 includes an implementation of g_bit_lock() that,
600 # on x86 (32-bit and 64-bit), uses asms in a fashion
601 # ("asm volatile goto") that requires GCC 4.5 or later, which
602 # is later than the compilers that come with Leopard and Snow
603 # Leopard. Recent versions of GLib check for that, but 2.29.6
604 # doesn't, so, if you want to build GLib 2.29.6 on Leopard or
605 # Snow Leopard, you would have to patch glib/gbitlock.c to do
606 # what the newer versions of GLib do:
608 # define a USE_ASM_GOTO macro that indicates whether "asm goto"
609 # can be used:
610 # #if (defined (i386) || defined (__amd64__))
611 # #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
612 # #define USE_ASM_GOTO 1
613 # #endif
614 # #endif
616 # replace all occurrences of
618 # #if defined (__GNUC__) && (defined (i386) || defined (__amd64__))
620 # with
622 # #ifdef USE_ASM_GOTO
624 # Using GLib 2.29.6 or earlier, however, means that we can't
625 # use a version of ATK later than 2.3.93, as those versions
626 # don't work with GLib 2.29.6. The same applies to gdk-pixbuf;
627 # versions of gdk-pixbuf after 2.24.1 won't work with GLib
628 # 2.29.6.
630 # Then you have to make sure that what you've build doesn't
631 # cause the X server that comes with Leopard to crash; at
632 # least one attempt at building for Leopard did.
634 # At least if building on Leopard, you might also find
635 # that, with various older versions of Cairo, including
636 # 1.6.4 and at least some 1.8.x versions, when you try to
637 # build it, the build fails because it can't find
638 # png_set_longjmp_fn(). I vaguely remember dealing with that,
639 # ages ago, but don't remember what I did.
641 GLIB_VERSION=2.16.3
642 CAIRO_VERSION=1.6.4
643 ATK_VERSION=1.24.0
644 PANGO_VERSION=1.20.2
645 GTK_VERSION=2.12.9
648 # That version of GTK+ includes gdk-pixbuf.
649 # XXX - base this on the version of GTK+ requested.
651 GDK_PIXBUF_VERSION=
654 # Libgcrypt 1.5.0 fails to compile due to some problem with an
655 # asm in rijndael.c, at least with i686-apple-darwin10-gcc-4.2.1
656 # (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) when building
657 # 32-bit.
659 # We try libgcrypt 1.4.3 instead, as that's what shows up in
660 # the version from the Leopard buildbot.
661 LIBGCRYPT_VERSION=1.4.3
664 # Build 32-bit while we're at it; Leopard has a bug that
665 # causes some BPF functions not to work with 64-bit userland
666 # code, so capturing won't work.
668 CFLAGS="$CFLAGS -arch i386"
669 CXXFLAGS="$CXXFLAGS -arch i386"
670 export LDFLAGS="$LDFLAGS -arch i386"
674 export CFLAGS
675 export CXXFLAGS
678 # You need Xcode or the command-line tools installed to get the compilers.
680 if [ ! -x /usr/bin/xcodebuild ]; then
681 echo "Please install Xcode first (should be available on DVD or from http://developer.apple.com/xcode/index.php)."
682 exit 1
685 if [ "$QT_VERSION" ]; then
687 # We need Xcode, not just the command-line tools, installed to build
688 # Qt.
690 if ! /usr/bin/xcrun -find xcrun >/dev/null 2>&1; then
691 echo "Please install Xcode first (should be available on DVD or from http://developer.apple.com/xcode/index.php)."
692 echo "The command-line build tools are not sufficient to build Qt."
693 exit 1
696 if [ "$GTK_VERSION" ]; then
698 # If we're building with GTK+, you also need the X11 SDK; with at least
699 # some versions of OS X and Xcode, that is, I think, an optional install.
700 # (Or it might be installed with X11, but I think *that* is an optional
701 # install on at least some versions of OS X.)
703 if [ ! -d /usr/X11/include ]; then
704 echo "Please install X11 and the X11 SDK first."
705 exit 1
709 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig
712 # Do all the downloads and untarring in a subdirectory, so all that
713 # stuff can be removed once we've installed the support libraries.
715 if [ ! -d macosx-support-libs ]
716 then
717 mkdir macosx-support-libs || exit 1
719 cd macosx-support-libs
721 # Start with xz: It is the sole download format of glib later than 2.31.2
723 if [ "$XZ_VERSION" -a ! -f xz-$XZ_VERSION-done ] ; then
724 echo "Downloading, building, and installing xz:"
725 [ -f xz-$XZ_VERSION.tar.bz2 ] || curl -O http://tukaani.org/xz/xz-$XZ_VERSION.tar.bz2 || exit 1
726 bzcat xz-$XZ_VERSION.tar.bz2 | tar xf - || exit 1
727 cd xz-$XZ_VERSION
728 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0" ./configure || exit 1
729 make $MAKE_BUILD_OPTS || exit 1
730 $DO_MAKE_INSTALL || exit 1
731 cd ..
732 touch xz-$XZ_VERSION-done
735 if [ "$AUTOCONF_VERSION" -a ! -f autoconf-$AUTOCONF_VERSION-done ] ; then
736 echo "Downloading, building and installing GNU autoconf..."
737 [ -f autoconf-$AUTOCONF_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/autoconf/autoconf-$AUTOCONF_VERSION.tar.xz || exit 1
738 xzcat autoconf-$AUTOCONF_VERSION.tar.xz | tar xf - || exit 1
739 cd autoconf-$AUTOCONF_VERSION
740 ./configure || exit 1
741 make $MAKE_BUILD_OPTS || exit 1
742 $DO_MAKE_INSTALL || exit 1
743 cd ..
744 touch autoconf-$AUTOCONF_VERSION-done
747 if [ "$AUTOMAKE_VERSION" -a ! -f automake-$AUTOMAKE_VERSION-done ] ; then
748 echo "Downloading, building and installing GNU automake..."
749 [ -f automake-$AUTOMAKE_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/automake/automake-$AUTOMAKE_VERSION.tar.xz || exit 1
750 xzcat automake-$AUTOMAKE_VERSION.tar.xz | tar xf - || exit 1
751 cd automake-$AUTOMAKE_VERSION
752 ./configure || exit 1
753 make $MAKE_BUILD_OPTS || exit 1
754 $DO_MAKE_INSTALL || exit 1
755 cd ..
756 touch automake-$AUTOMAKE_VERSION-done
759 if [ "$LIBTOOL_VERSION" -a ! -f libtool-$LIBTOOL_VERSION-done ] ; then
760 echo "Downloading, building and installing GNU libtool..."
761 [ -f libtool-$LIBTOOL_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/libtool/libtool-$LIBTOOL_VERSION.tar.xz || exit 1
762 xzcat libtool-$LIBTOOL_VERSION.tar.xz | tar xf - || exit 1
763 cd libtool-$LIBTOOL_VERSION
764 ./configure || exit 1
765 make $MAKE_BUILD_OPTS || exit 1
766 $DO_MAKE_INSTALL || exit 1
767 mv /usr/local/bin/libtool /usr/local/bin/glibtool
768 mv /usr/local/bin/libtoolize /usr/local/bin/glibtoolize
769 cd ..
770 touch libtool-$LIBTOOL_VERSION-done
773 if [ -n "$CMAKE" -a ! -f cmake-$CMAKE_VERSION-done ]; then
774 echo "Downloading, building, and installing CMAKE:"
775 cmake_dir=`expr $CMAKE_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
776 [ -f cmake-$CMAKE_VERSION.tar.gz ] || curl -O http://www.cmake.org/files/v$cmake_dir/cmake-$CMAKE_VERSION.tar.gz || exit 1
777 gzcat cmake-$CMAKE_VERSION.tar.gz | tar xf - || exit 1
778 cd cmake-$CMAKE_VERSION
779 ./bootstrap || exit 1
780 make $MAKE_BUILD_OPTS || exit 1
781 $DO_MAKE_INSTALL || exit 1
782 cd ..
783 touch cmake-$CMAKE_VERSION-done
787 # Start with GNU gettext; GLib requires it, and OS X doesn't have it
788 # or a BSD-licensed replacement.
790 # At least on Lion with Xcode 4, _FORTIFY_SOURCE gets defined as 2
791 # by default, which causes, for example, stpncpy to be defined as
792 # a hairy macro that collides with the GNU gettext configure script's
793 # attempts to workaround AIX's lack of a declaration for stpncpy,
794 # with the result being a huge train wreck. Define _FORTIFY_SOURCE
795 # as 0 in an attempt to keep the trains on separate tracks.
797 if [ ! -f gettext-$GETTEXT_VERSION-done ] ; then
798 echo "Downloading, building, and installing GNU gettext:"
799 [ -f gettext-$GETTEXT_VERSION.tar.gz ] || curl -O http://ftp.gnu.org/pub/gnu/gettext/gettext-$GETTEXT_VERSION.tar.gz || exit 1
800 gzcat gettext-$GETTEXT_VERSION.tar.gz | tar xf - || exit 1
801 cd gettext-$GETTEXT_VERSION
802 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0 $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
803 make $MAKE_BUILD_OPTS || exit 1
804 $DO_MAKE_INSTALL || exit 1
805 cd ..
806 touch gettext-$GETTEXT_VERSION-done
810 # GLib depends on pkg-config.
811 # By default, pkg-config depends on GLib; we break the dependency cycle
812 # by configuring pkg-config to use its own internal version of GLib.
814 if [ ! -f pkg-config-$PKG_CONFIG_VERSION-done ] ; then
815 echo "Downloading, building, and installing pkg-config:"
816 [ -f pkg-config-$PKG_CONFIG_VERSION.tar.gz ] || curl -O http://pkgconfig.freedesktop.org/releases/pkg-config-$PKG_CONFIG_VERSION.tar.gz || exit 1
817 gzcat pkg-config-$PKG_CONFIG_VERSION.tar.gz | tar xf - || exit 1
818 cd pkg-config-$PKG_CONFIG_VERSION
819 ./configure --with-internal-glib || exit 1
820 make $MAKE_BUILD_OPTS || exit 1
821 $DO_MAKE_INSTALL || exit 1
822 cd ..
823 touch pkg-config-$PKG_CONFIG_VERSION-done
826 if [ ! -f glib-$GLIB_VERSION-done ] ; then
827 echo "Downloading, building, and installing GLib:"
828 glib_dir=`expr $GLIB_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
829 GLIB_MAJOR_VERSION="`expr $GLIB_VERSION : '\([0-9][0-9]*\).*'`"
830 GLIB_MINOR_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
831 GLIB_DOTDOT_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
832 if [[ $GLIB_MAJOR_VERSION -gt 2 ||
833 $GLIB_MINOR_VERSION -gt 28 ||
834 ($GLIB_MINOR_VERSION -eq 28 && $GLIB_DOTDOT_VERSION -ge 8) ]]
835 then
837 # Starting with GLib 2.28.8, xz-compressed tarballs are available.
839 [ -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
840 xzcat glib-$GLIB_VERSION.tar.xz | tar xf - || exit 1
841 else
842 [ -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
843 bzcat glib-$GLIB_VERSION.tar.bz2 | tar xf - || exit 1
845 cd glib-$GLIB_VERSION
847 # OS X ships with libffi, but doesn't provide its pkg-config file;
848 # explicitly specify LIBFFI_CFLAGS and LIBFFI_LIBS, so the configure
849 # script doesn't try to use pkg-config to get the appropriate
850 # C flags and loader flags.
852 # And, what's worse, at least with the version of Xcode that comes
853 # with Leopard, /usr/include/ffi/fficonfig.h doesn't define MACOSX,
854 # which causes the build of GLib to fail. If we don't find
855 # "#define.*MACOSX" in /usr/include/ffi/fficonfig.h, explictly
856 # define it.
858 # While we're at it, suppress -Wformat-nonliteral to avoid a case
859 # where clang's stricter rules on when not to complain about
860 # non-literal format arguments cause it to complain about code
861 # that's safe but it wasn't told that. See my comment #25 in
862 # GNOME bug 691608:
864 # https://bugzilla.gnome.org/show_bug.cgi?id=691608#c25
866 # First, determine where the system include files are. (It's not
867 # necessarily /usr/include.) There's a bit of a greasy hack here;
868 # pre-5.x versions of the developer tools don't support the
869 # --show-sdk-path option, and will produce no output, so includedir
870 # will be set to /usr/include (in those older versions of the
871 # developer tools, there is a /usr/include directory).
873 includedir=`xcrun --show-sdk-path 2>/dev/null`/usr/include
874 if grep -qs '#define.*MACOSX' $includedir/ffi/fficonfig.h
875 then
876 # It's defined, nothing to do
877 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
878 else
879 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
883 # Apply the fix to GNOME bug 529806:
885 # https://bugzilla.gnome.org/show_bug.cgi?id=529806
887 # if we have a version of GLib prior to 2.30.
889 if [[ $GLIB_MAJOR_VERSION -eq 2 && $GLIB_MINOR_VERSION -le 30 ]]
890 then
891 patch -p0 <../../macosx-support-lib-patches/glib-gconvert.c.patch || exit 1
893 make $MAKE_BUILD_OPTS || exit 1
894 $DO_MAKE_INSTALL || exit 1
895 cd ..
896 touch glib-$GLIB_VERSION-done
900 # Now we have reached a point where we can build everything but
901 # the GUI (Wireshark).
903 if [ "$QT_VERSION" -a ! -f qt-$QT_VERSION-done ]; then
904 echo "Downloading, building, and installing Qt:"
905 QT_MAJOR_VERSION="`expr $QT_VERSION : '\([0-9][0-9]*\).*'`"
906 QT_MINOR_VERSION="`expr $QT_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
907 QT_DOTDOT_VERSION="`expr $QT_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
908 QT_MAJOR_MINOR_VERSION=$QT_MAJOR_VERSION.$QT_MINOR_VERSION
910 # What you get for this URL might just be a 302 Found reply, so use
911 # -L so we get redirected.
913 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
915 # Qt 5.1.x sets QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
916 # in qtbase/mkspecs/$TARGET_PLATFORM/qmake.conf
917 # We may need to adjust this manually in the future.
919 # The -no-c++11 flag is needed to work around
920 # https://bugreports.qt-project.org/browse/QTBUG-30487
922 tar xf qt-everywhere-opensource-src-$QT_VERSION.tar.gz
923 cd qt-everywhere-opensource-src-$QT_VERSION
925 # We don't build Qt in its Full Shining Glory, as we don't need all
926 # of its components, and it takes *forever* to build in that form.
928 # Qt 5.2.0 beta1 fails to build on OS X without -no-xcb due to bug
929 # QTBUG-34382.
931 # Qt 5.x fails to build on OS X with -no-opengl due to bug
932 # QTBUG-31151.
934 ./configure -v -sdk macosx$min_osx_target -platform $TARGET_PLATFORM \
935 -opensource -confirm-license -no-c++11 -no-dbus \
936 -no-sql-sqlite -no-xcb -nomake examples \
937 -skip qtdoc -skip qtquickcontrols -skip qtwebkit \
938 -skip qtwebkit-examples -skip qtxmlpatterns
939 make || exit 1
940 $DO_MAKE_INSTALL || exit 1
941 cd ..
942 touch qt-$QT_VERSION-done
945 if [ "$GTK_VERSION" ]; then
947 # GTK+ 3 requires a newer Cairo build than the one that comes with
948 # 10.6, so we build Cairo if we are using GTK+ 3.
950 # In 10.6 and 10.7, it's an X11 library; if we build with "native" GTK+
951 # rather than X11 GTK+, we might have to build and install Cairo.
952 # In 10.8 and later, there is no X11, but it's included in Xquartz;
953 # again, if we build with "native" GTK+, we'd have to build and install
954 # it.
956 if [[ "$GTK_MAJOR_VERSION" -eq 3 || "$cairo_not_in_the_os" = yes ]]; then
958 # Requirements for Cairo first
960 # The libpng that comes with the X11 for Leopard has a bogus
961 # pkg-config file that lies about where the header files are,
962 # which causes other packages not to be able to find its
963 # headers.
965 # The libpng in later versions is not what the version of
966 # libpixman we build below wants - it wants libpng15.
968 if [ ! -f libpng-$PNG_VERSION-done ] ; then
969 echo "Downloading, building, and installing libpng:"
971 # The FTP site puts libpng x.y.* into a libpngxy directory.
973 subdir=`echo $PNG_VERSION | sed 's/\([1-9][0-9]*\)\.\([1-9][0-9]*\).*/libpng\1\2'/`
974 [ -f libpng-$PNG_VERSION.tar.xz ] || curl -O ftp://ftp.simplesystems.org/pub/libpng/png/src/$subdir/libpng-$PNG_VERSION.tar.xz
975 xzcat libpng-$PNG_VERSION.tar.xz | tar xf - || exit 1
976 cd libpng-$PNG_VERSION
977 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
978 make $MAKE_BUILD_OPTS || exit 1
979 $DO_MAKE_INSTALL || exit 1
980 cd ..
981 touch libpng-$PNG_VERSION-done
985 # The libpixman versions that come with the X11s for Leopard,
986 # Snow Leopard, and Lion is too old to support Cairo's image
987 # surface backend feature (which requires pixman-1 >= 0.22.0).
989 # XXX - what about the one that comes with the latest version
990 # of Xquartz?
992 if [ ! -f pixman-$PIXMAN_VERSION-done ] ; then
993 echo "Downloading, building, and installing pixman:"
994 [ -f pixman-$PIXMAN_VERSION.tar.gz ] || curl -O http://www.cairographics.org/releases/pixman-$PIXMAN_VERSION.tar.gz
995 gzcat pixman-$PIXMAN_VERSION.tar.gz | tar xf - || exit 1
996 cd pixman-$PIXMAN_VERSION
997 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
998 make V=1 $MAKE_BUILD_OPTS || exit 1
999 $DO_MAKE_INSTALL || exit 1
1000 cd ..
1001 touch pixman-$PIXMAN_VERSION-done
1005 # And now Cairo itself.
1006 # XXX - with the libxcb that comes with 10.6,
1008 # xcb_discard_reply() is missing, and the build fails.
1010 if [ ! -f cairo-$CAIRO_VERSION-done ] ; then
1011 echo "Downloading, building, and installing Cairo:"
1012 CAIRO_MAJOR_VERSION="`expr $CAIRO_VERSION : '\([0-9][0-9]*\).*'`"
1013 CAIRO_MINOR_VERSION="`expr $CAIRO_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
1014 CAIRO_DOTDOT_VERSION="`expr $CAIRO_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
1015 if [[ $CAIRO_MAJOR_VERSION -gt 1 ||
1016 $CAIRO_MINOR_VERSION -gt 12 ||
1017 ($CAIRO_MINOR_VERSION -eq 12 && $CAIRO_DOTDOT_VERSION -ge 2) ]]
1018 then
1020 # Starting with Cairo 1.12.2, the tarballs are compressed with
1021 # xz rather than gzip.
1023 [ -f cairo-$CAIRO_VERSION.tar.xz ] || curl -O http://cairographics.org/releases/cairo-$CAIRO_VERSION.tar.xz || exit 1
1024 xzcat cairo-$CAIRO_VERSION.tar.xz | tar xf - || exit 1
1025 else
1026 [ -f cairo-$CAIRO_VERSION.tar.gz ] || curl -O http://cairographics.org/releases/cairo-$CAIRO_VERSION.tar.gz || exit 1
1027 gzcat cairo-$CAIRO_VERSION.tar.gz | tar xf - || exit 1
1029 cd cairo-$CAIRO_VERSION
1030 # CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-quartz=no || exit 1
1031 # Maybe follow http://cairographics.org/end_to_end_build_for_mac_os_x/
1032 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-quartz=yes || exit 1
1034 # We must avoid the version of libpng that comes with X11; the
1035 # only way I've found to force that is to forcibly set INCLUDES
1036 # when we do the build, so that this comes before CAIRO_CFLAGS,
1037 # which has -I/usr/X11/include added to it before anything
1038 # connected to libpng is.
1040 INCLUDES="-I/usr/local/include/libpng15" make $MAKE_BUILD_OPTS || exit 1
1041 $DO_MAKE_INSTALL || exit 1
1042 cd ..
1043 touch cairo-$CAIRO_VERSION-done
1047 if [ ! -f atk-$ATK_VERSION-done ] ; then
1048 echo "Downloading, building, and installing ATK:"
1049 atk_dir=`expr $ATK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
1050 ATK_MAJOR_VERSION="`expr $ATK_VERSION : '\([0-9][0-9]*\).*'`"
1051 ATK_MINOR_VERSION="`expr $ATK_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
1052 ATK_DOTDOT_VERSION="`expr $ATK_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
1053 if [[ $ATK_MAJOR_VERSION -gt 2 ||
1054 ($ATK_MAJOR_VERSION -eq 2 && $ATK_MINOR_VERSION -gt 0) ||
1055 ($ATK_MANOR_VERSION -eq 2 && $ATK_MINOR_VERSION -eq 0 && $ATK_DOTDOT_VERSION -ge 1) ]]
1056 then
1058 # Starting with ATK 2.0.1, xz-compressed tarballs are available.
1060 [ -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
1061 xzcat atk-$ATK_VERSION.tar.xz | tar xf - || exit 1
1062 else
1063 [ -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
1064 bzcat atk-$ATK_VERSION.tar.bz2 | tar xf - || exit 1
1066 cd atk-$ATK_VERSION
1067 CFLAGS="$CFLAGS $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
1070 cd ..
1071 touch atk-$ATK_VERSION-done
1074 if [ ! -f pango-$PANGO_VERSION-done ] ; then
1075 echo "Downloading, building, and installing Pango:"
1076 pango_dir=`expr $PANGO_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
1077 PANGO_MAJOR_VERSION="`expr $PANGO_VERSION : '\([0-9][0-9]*\).*'`"
1078 PANGO_MINOR_VERSION="`expr $PANGO_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
1079 if [[ $PANGO_MAJOR_VERSION -gt 1 ||
1080 $PANGO_MINOR_VERSION -ge 29 ]]
1081 then
1083 # Starting with Pango 1.29, the tarballs are compressed with
1084 # xz rather than bzip2.
1086 [ -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
1087 xzcat pango-$PANGO_VERSION.tar.xz | tar xf - || exit 1
1088 else
1089 [ -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
1090 bzcat pango-$PANGO_VERSION.tar.bz2 | tar xf - || exit 1
1092 cd pango-$PANGO_VERSION
1093 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1094 make $MAKE_BUILD_OPTS || exit 1
1095 $DO_MAKE_INSTALL || exit 1
1096 cd ..
1097 touch pango-$PANGO_VERSION-done
1100 if [ "$GDK_PIXBUF_VERSION" -a ! -f gdk-pixbuf-$GDK_PIXBUF_VERSION-done ] ; then
1101 echo "Downloading, building, and installing gdk-pixbuf:"
1102 gdk_pixbuf_dir=`expr $GDK_PIXBUF_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
1103 [ -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
1104 xzcat gdk-pixbuf-$GDK_PIXBUF_VERSION.tar.xz | tar xf - || exit 1
1105 cd gdk-pixbuf-$GDK_PIXBUF_VERSION
1107 # If we're building for 10.6, use libpng12; if you have 10.7.5, including
1108 # X11, and Xcode 4.3.3, the system has libpng15, complete with pkg-config
1109 # files, as part of X11, but 10.6's X11 has only libpng12, and the 10.6
1110 # SDK in Xcode 4.3.3 also has only libpng12, and has no pkg-config files
1111 # of its own, so we have to explicitly set LIBPNG to override the
1112 # configure script, and also force the CFLAGS to look for the header
1113 # files for libpng12 (note that -isysroot doesn't affect the arguments
1114 # to -I, so we need to include the SDK path explicitly).
1116 if [[ "$min_osx_target" = 10.6 ]]
1117 then
1118 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
1119 else
1120 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --without-libtiff --without-libjpeg || exit 1
1122 make $MAKE_BUILD_OPTS || exit 1
1123 $DO_MAKE_INSTALL || exit 1
1124 cd ..
1125 touch gdk-pixbuf-$GDK_PIXBUF_VERSION-done
1128 if [ ! -f gtk+-$GTK_VERSION-done ] ; then
1129 echo "Downloading, building, and installing GTK+:"
1130 gtk_dir=`expr $GTK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
1131 if [[ $GTK_MAJOR_VERSION -gt 2 ||
1132 $GTK_MINOR_VERSION -gt 24 ||
1133 ($GTK_MINOR_VERSION -eq 24 && $GTK_DOTDOT_VERSION -ge 5) ]]
1134 then
1136 # Starting with GTK+ 2.24.5, the tarballs are compressed with
1137 # xz rather than gzip, in addition to bzip2; use xz, as we've
1138 # built and installed it, and as xz compresses better than
1139 # bzip2 so the tarballs take less time to download.
1141 [ -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
1142 xzcat gtk+-$GTK_VERSION.tar.xz | tar xf - || exit 1
1143 else
1144 [ -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
1145 bzcat gtk+-$GTK_VERSION.tar.bz2 | tar xf - || exit 1
1147 cd gtk+-$GTK_VERSION
1148 if [ $DARWIN_MAJOR_VERSION -ge "12" ]
1149 then
1151 # GTK+ 2.24.10, at least, doesn't build on Mountain Lion with the
1152 # CUPS printing backend - either the CUPS API changed incompatibly
1153 # or the backend was depending on non-API implementation details.
1155 # Configure it out, on Mountain Lion and later, for now.
1156 # (12 is the Darwin major version number in Mountain Lion.)
1158 # Also, configure out libtiff and libjpeg; configure scripts
1159 # just ignore unknown --enable/--disable and --with/--without
1160 # options (at least they've always do so up to now).
1162 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --disable-cups --without-libtiff --without-libjpeg || exit 1
1163 else
1164 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --without-libtiff --without-libjpeg || exit 1
1166 make $MAKE_BUILD_OPTS || exit 1
1167 $DO_MAKE_INSTALL || exit 1
1168 cd ..
1169 touch gtk+-$GTK_VERSION-done
1174 # Now we have reached a point where we can build everything including
1175 # the GUI (Wireshark), but not with any optional features such as
1176 # SNMP OID resolution, some forms of decryption, Lua scripting, playback
1177 # of audio, or GeoIP mapping of IP addresses.
1179 # We now conditionally download optional libraries to support them;
1180 # the default is to download them all.
1183 if [ "$LIBSMI_VERSION" -a ! -f libsmi-$LIBSMI_VERSION-done ] ; then
1184 echo "Downloading, building, and installing libsmi:"
1185 [ -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
1186 gzcat libsmi-$LIBSMI_VERSION.tar.gz | tar xf - || exit 1
1187 cd libsmi-$LIBSMI_VERSION
1188 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1189 make $MAKE_BUILD_OPTS || exit 1
1190 $DO_MAKE_INSTALL || exit 1
1191 cd ..
1192 touch libsmi-$LIBSMI_VERSION-done
1195 if [ "$LIBGPG_ERROR_VERSION" -a ! -f libgpg-error-$LIBGPG_ERROR_VERSION-done ] ; then
1196 echo "Downloading, building, and installing libgpg-error:"
1197 [ -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
1198 bzcat libgpg-error-$LIBGPG_ERROR_VERSION.tar.bz2 | tar xf - || exit 1
1199 cd libgpg-error-$LIBGPG_ERROR_VERSION
1200 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1201 make $MAKE_BUILD_OPTS || exit 1
1202 $DO_MAKE_INSTALL || exit 1
1203 cd ..
1204 touch libgpg-error-$LIBGPG_ERROR_VERSION-done
1207 if [ "$LIBGCRYPT_VERSION" -a ! -f libgcrypt-$LIBGCRYPT_VERSION-done ] ; then
1209 # libgpg-error is required for libgcrypt.
1211 if [ -z $LIBGPG_ERROR_VERSION ]
1212 then
1213 echo "libgcrypt requires libgpg-error, but you didn't install libgpg-error." 1>&2
1214 exit 1
1217 echo "Downloading, building, and installing libgcrypt:"
1218 [ -f libgcrypt-$LIBGCRYPT_VERSION.tar.gz ] || curl -L -O ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-$LIBGCRYPT_VERSION.tar.gz || exit 1
1219 gzcat libgcrypt-$LIBGCRYPT_VERSION.tar.gz | tar xf - || exit 1
1220 cd libgcrypt-$LIBGCRYPT_VERSION
1222 # The assembler language code is not compatible with the OS X
1223 # x86 assembler (or is it an x86-64 vs. x86-32 issue?).
1225 # libgcrypt expects gnu89, not c99/gnu99, semantics for
1226 # "inline". See, for example:
1228 # http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2010-October/198809.html
1230 CFLAGS="$CFLAGS -std=gnu89 $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --disable-asm || exit 1
1231 make $MAKE_BUILD_OPTS || exit 1
1232 $DO_MAKE_INSTALL || exit 1
1233 cd ..
1234 touch libgcrypt-$LIBGCRYPT_VERSION-done
1237 if [ "$GNUTLS_VERSION" -a ! -f gnutls-$GNUTLS_VERSION-done ] ; then
1239 # GnuTLS requires libgcrypt (or nettle, in newer versions).
1241 if [ -z $LIBGCRYPT_VERSION ]
1242 then
1243 echo "GnuTLS requires libgcrypt, but you didn't install libgcrypt" 1>&2
1244 exit 1
1247 echo "Downloading, building, and installing GnuTLS:"
1248 [ -f gnutls-$GNUTLS_VERSION.tar.bz2 ] || curl -L -O http://ftp.gnu.org/gnu/gnutls/gnutls-$GNUTLS_VERSION.tar.bz2 || exit 1
1249 bzcat gnutls-$GNUTLS_VERSION.tar.bz2 | tar xf - || exit 1
1250 cd gnutls-$GNUTLS_VERSION
1252 # Use libgcrypt, not nettle.
1253 # XXX - is there some reason to prefer nettle? Or does
1254 # Wireshark directly use libgcrypt routines?
1256 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --with-libgcrypt --without-p11-kit || exit 1
1257 make $MAKE_BUILD_OPTS || exit 1
1259 # The pkgconfig file for GnuTLS says "requires zlib", but OS X,
1260 # while it supplies zlib, doesn't supply a pkgconfig file for
1261 # it.
1263 # Patch the GnuTLS pkgconfig file not to require zlib.
1264 # (If the capabilities of GnuTLS that Wireshark uses don't
1265 # depend on building GnuTLS with zlib, an alternative would be
1266 # to configure it not to use zlib.)
1268 patch -p0 lib/gnutls.pc.in <../../macosx-support-lib-patches/gnutls-pkgconfig.patch || exit 1
1269 $DO_MAKE_INSTALL || exit 1
1270 cd ..
1271 touch gnutls-$GNUTLS_VERSION-done
1274 if [ "$LUA_VERSION" -a ! -f lua-$LUA_VERSION-done ] ; then
1275 echo "Downloading, building, and installing Lua:"
1276 [ -f lua-$LUA_VERSION.tar.gz ] || curl -L -O http://www.lua.org/ftp/lua-$LUA_VERSION.tar.gz || exit 1
1277 gzcat lua-$LUA_VERSION.tar.gz | tar xf - || exit 1
1278 cd lua-$LUA_VERSION
1279 make $MAKE_BUILD_OPTS macosx || exit 1
1280 $DO_MAKE_INSTALL || exit 1
1281 cd ..
1282 touch lua-$LUA_VERSION-done
1285 if [ "$PORTAUDIO_VERSION" -a ! -f portaudio-done ] ; then
1286 echo "Downloading, building, and installing PortAudio:"
1287 [ -f $PORTAUDIO_VERSION.tgz ] || curl -L -O http://www.portaudio.com/archives/$PORTAUDIO_VERSION.tgz || exit 1
1288 gzcat $PORTAUDIO_VERSION.tgz | tar xf - || exit 1
1289 cd portaudio
1291 # Un-comment an include that's required on Lion.
1293 patch -p0 include/pa_mac_core.h <../../macosx-support-lib-patches/portaudio-pa_mac_core.h.patch
1295 # Fix a bug that showed up with clang (but is a bug with any
1296 # compiler).
1298 patch -p0 src/hostapi/coreaudio/pa_mac_core.c <../../macosx-support-lib-patches/portaudio-pa_mac_core.c.patch
1300 # Disable fat builds - the configure script doesn't work right
1301 # with Xcode 4 if you leave them enabled, and we don't build
1302 # any other libraries fat (GLib, for example, would be very
1303 # hard to build fat), so there's no advantage to having PortAudio
1304 # built fat.
1306 # Set the minimum OS X version to 10.4, to suppress some
1307 # deprecation warnings. (Good luck trying to make any of
1308 # this build on an OS+Xcode with a pre-10.4 SDK; we don't
1309 # worry about the user requesting that.)
1311 CFLAGS="$CFLAGS -mmacosx-version-min=10.4 $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --disable-mac-universal || exit 1
1312 make $MAKE_BUILD_OPTS || exit 1
1313 $DO_MAKE_INSTALL || exit 1
1314 cd ..
1315 touch portaudio-done
1318 if [ "$GEOIP_VERSION" -a ! -f geoip-$GEOIP_VERSION-done ]
1319 then
1320 echo "Downloading, building, and installing GeoIP API:"
1321 [ -f GeoIP-$GEOIP_VERSION.tar.gz ] || curl -L -O http://geolite.maxmind.com/download/geoip/api/c/GeoIP-$GEOIP_VERSION.tar.gz || exit 1
1322 gzcat GeoIP-$GEOIP_VERSION.tar.gz | tar xf - || exit 1
1323 cd GeoIP-$GEOIP_VERSION
1324 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1326 # Grr. Their man pages "helpfully" have an ISO 8859-1
1327 # copyright symbol in the copyright notice, but OS X's
1328 # default character encoding is UTF-8. sed on Mountain
1329 # Lion barfs at the "illegal character sequence" represented
1330 # by an ISO 8859-1 copyright symbol, as it's not a valid
1331 # UTF-8 sequence.
1333 # iconv the relevant man pages into UTF-8.
1335 for i in geoipupdate.1.in geoiplookup6.1.in geoiplookup.1.in
1337 iconv -f iso8859-1 -t utf-8 man/"$i" >man/"$i".tmp &&
1338 mv man/"$i".tmp man/"$i"
1339 done
1340 make $MAKE_BUILD_OPTS || exit 1
1341 $DO_MAKE_INSTALL || exit 1
1342 cd ..
1343 touch geoip-$GEOIP_VERSION-done
1346 if [ "$CARES_VERSION" -a ! -f geoip-$CARES_VERSION-done ]
1347 then
1348 echo "Downloading, building, and installing C-Ares API:"
1349 [ -f c-ares-$CARES_VERSION.tar.gz ] || curl -L -O http://c-ares.haxx.se/download/c-ares-$CARES_VERSION.tar.gz || exit 1
1350 gzcat c-ares-$CARES_VERSION.tar.gz | tar xf - || exit 1
1351 cd c-ares-$CARES_VERSION
1352 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1353 make $MAKE_BUILD_OPTS || exit 1
1354 $DO_MAKE_INSTALL || exit 1
1355 cd ..
1356 touch geoip-$CARES_VERSION-done
1359 echo ""
1361 echo "You are now prepared to build Wireshark. To do so do:"
1362 echo "export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig"
1363 echo ""
1364 if [ -n "$CMAKE" ]; then
1365 echo "mkdir build; cd build"
1366 echo "cmake .."
1367 echo
1368 echo "or"
1369 echo
1371 echo "./autogen.sh"
1372 echo "mkdir build; cd build"
1373 echo "../configure"
1374 echo ""
1375 echo "make $MAKE_BUILD_OPTS"
1376 echo "make install"
1378 echo ""
1380 echo "Make sure you are allowed capture access to the network devices"
1381 echo "See: http://wiki.wireshark.org/CaptureSetup/CapturePrivileges"
1383 echo ""
1385 exit 0