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.
112 LIBGCRYPT_VERSION=1.5.0
113 GNUTLS_VERSION=2.12.19
114 # Use 5.2.3, not 5.3, for now; lua_bitop.c hasn't been ported to 5.3
115 # yet, and we need to check for compatibility issues (we'd want Lua
116 # scripts to work with 5.1, 5.2, and 5.3, as long as they only use Lua
117 # features present in all three versions)
119 PORTAUDIO_VERSION=pa_stable_v19_20111121
121 # XXX - they appear to have an unversioned gzipped tarball for the
122 # current version; should we just download that, with some other
123 # way of specifying whether to download the GeoIP API?
129 DARWIN_MAJOR_VERSION=`uname -r | sed 's/\([0-9]*\).*/\1/'`
132 # GNU autotools; they're provided with releases up to Snow Leopard, but
133 # not in later releases.
135 if [[ $DARWIN_MAJOR_VERSION -gt 10 ]]; then
136 AUTOCONF_VERSION=2.69
137 AUTOMAKE_VERSION=1.13.3
138 LIBTOOL_VERSION=2.4.2
142 if [ "$XZ_VERSION" -a ! -f xz-$XZ_VERSION-done ] ; then
143 echo "Downloading, building, and installing xz:"
144 [ -f xz-$XZ_VERSION.tar.bz2 ] || curl -O http://tukaani.org/xz/xz-$XZ_VERSION.tar.bz2 || exit 1
145 bzcat xz-$XZ_VERSION.tar.bz2 | tar xf - || exit 1
147 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0" ./configure || exit 1
148 make $MAKE_BUILD_OPTS || exit 1
149 $DO_MAKE_INSTALL || exit 1
151 touch xz-$XZ_VERSION-done
156 if [ ! -z "$installed_xz_version" ] ; then
157 echo "Uninstalling xz:"
158 cd xz-$installed_xz_version
159 $DO_MAKE_UNINSTALL || exit 1
160 make distclean || exit 1
162 rm xz-$installed_xz_version-done
164 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
166 # Get rid of the previously downloaded and unpacked version.
168 rm -rf xz-$installed_xz_version
169 rm -rf xz-$installed_xz_version.tar.bz2
172 installed_xz_version=""
177 if [ "$AUTOCONF_VERSION" -a ! -f autoconf-$AUTOCONF_VERSION-done ] ; then
178 echo "Downloading, building and installing GNU autoconf..."
179 [ -f autoconf-$AUTOCONF_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/autoconf/autoconf-$AUTOCONF_VERSION.tar.xz || exit 1
180 xzcat autoconf-$AUTOCONF_VERSION.tar.xz | tar xf - || exit 1
181 cd autoconf-$AUTOCONF_VERSION
182 ./configure || exit 1
183 make $MAKE_BUILD_OPTS || exit 1
184 $DO_MAKE_INSTALL || exit 1
186 touch autoconf-$AUTOCONF_VERSION-done
190 uninstall_autoconf() {
191 if [ ! -z "$installed_autoconf_version" ] ; then
193 # automake and libtool depend on this, so uninstall them.
198 echo "Uninstalling GNU autoconf:"
199 cd autoconf-$installed_autoconf_version
200 $DO_MAKE_UNINSTALL || exit 1
201 make distclean || exit 1
203 rm autoconf-$installed_autoconf_version-done
205 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
207 # Get rid of the previously downloaded and unpacked version.
209 rm -rf autoconf-$installed_autoconf_version
210 rm -rf autoconf-$installed_autoconf_version.tar.xz
213 installed_autoconf_version=""
218 if [ "$AUTOMAKE_VERSION" -a ! -f automake-$AUTOMAKE_VERSION-done ] ; then
219 echo "Downloading, building and installing GNU automake..."
220 [ -f automake-$AUTOMAKE_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/automake/automake-$AUTOMAKE_VERSION.tar.xz || exit 1
221 xzcat automake-$AUTOMAKE_VERSION.tar.xz | tar xf - || exit 1
222 cd automake-$AUTOMAKE_VERSION
223 ./configure || exit 1
224 make $MAKE_BUILD_OPTS || exit 1
225 $DO_MAKE_INSTALL || exit 1
227 touch automake-$AUTOMAKE_VERSION-done
231 uninstall_automake() {
232 if [ ! -z "$installed_automake_version" ] ; then
234 # libtool depends on this(?), so uninstall it.
236 uninstall_libtool "$@"
238 echo "Uninstalling GNU automake:"
239 cd automake-$installed_automake_version
240 $DO_MAKE_UNINSTALL || exit 1
241 make distclean || exit 1
243 rm automake-$installed_automake_version-done
245 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
247 # Get rid of the previously downloaded and unpacked version.
249 rm -rf automake-$installed_automake_version
250 rm -rf automake-$installed_automake_version.tar.xz
253 installed_automake_version=""
258 if [ "$LIBTOOL_VERSION" -a ! -f libtool-$LIBTOOL_VERSION-done ] ; then
259 echo "Downloading, building and installing GNU libtool..."
260 [ -f libtool-$LIBTOOL_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/libtool/libtool-$LIBTOOL_VERSION.tar.xz || exit 1
261 xzcat libtool-$LIBTOOL_VERSION.tar.xz | tar xf - || exit 1
262 cd libtool-$LIBTOOL_VERSION
263 ./configure || exit 1
264 make $MAKE_BUILD_OPTS || exit 1
265 $DO_MAKE_INSTALL || exit 1
266 $DO_MV /usr/local/bin/libtool /usr/local/bin/glibtool
267 $DO_MV /usr/local/bin/libtoolize /usr/local/bin/glibtoolize
269 touch libtool-$LIBTOOL_VERSION-done
273 uninstall_libtool() {
274 if [ ! -z "$installed_libtool_version" ] ; then
275 echo "Uninstalling GNU libtool:"
276 cd libtool-$installed_libtool_version
277 $DO_MV /usr/local/bin/glibtool /usr/local/bin/libtool
278 $DO_MV /usr/local/bin/glibtoolize /usr/local/bin/libtoolize
279 $DO_MAKE_UNINSTALL || exit 1
280 make distclean || exit 1
282 rm libtool-$installed_libtool_version-done
284 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
286 # Get rid of the previously downloaded and unpacked version.
288 rm -rf libtool-$installed_libtool_version
289 rm -rf libtool-$installed_libtool_version.tar.xz
292 installed_libtool_version=""
297 if [ -n "$CMAKE" -a ! -f cmake-$CMAKE_VERSION-done ]; then
298 echo "Downloading and installing CMake:"
299 cmake_dir=`expr $CMAKE_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
301 # NOTE: the "64" in "Darwin64" doesn't mean "64-bit-only"; the
302 # package in question supports both 32-bit and 64-bit x86.
304 [ -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
305 sudo hdiutil attach http://www.cmake.org/files/v2.8/cmake-$CMAKE_VERSION-Darwin64-universal.dmg || exit 1
306 sudo installer -target / -pkg /Volumes/cmake-$CMAKE_VERSION-Darwin64-universal/cmake-$CMAKE_VERSION-Darwin64-universal.pkg || exit 1
307 sudo hdiutil detach /Volumes/cmake-$CMAKE_VERSION-Darwin64-universal
308 touch cmake-$CMAKE_VERSION-done
313 if [ ! -z "$installed_cmake_version" ]; then
314 echo "Uninstalling CMake:"
315 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
316 sudo rm /usr/bin/ccmake
317 sudo rm /usr/bin/cmake
318 sudo rm /usr/bin/cmake-gui
319 sudo rm /usr/bin/cmakexbuild
320 sudo rm /usr/bin/cpack
321 sudo rm /usr/bin/ctest
322 sudo pkgutil --forget com.Kitware.CMake
323 rm cmake-$installed_cmake_version-done
325 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
327 # Get rid of the previously downloaded and unpacked version.
329 rm -f cmake-$installed_cmake_version-Darwin64-universal.dmg
332 installed_cmake_version=""
337 if [ ! -f gettext-$GETTEXT_VERSION-done ] ; then
338 echo "Downloading, building, and installing GNU gettext:"
339 [ -f gettext-$GETTEXT_VERSION.tar.gz ] || curl -O http://ftp.gnu.org/pub/gnu/gettext/gettext-$GETTEXT_VERSION.tar.gz || exit 1
340 gzcat gettext-$GETTEXT_VERSION.tar.gz | tar xf - || exit 1
341 cd gettext-$GETTEXT_VERSION
342 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0 $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
343 make $MAKE_BUILD_OPTS || exit 1
344 $DO_MAKE_INSTALL || exit 1
346 touch gettext-$GETTEXT_VERSION-done
350 uninstall_gettext() {
351 if [ ! -z "$installed_gettext_version" ] ; then
353 # GLib depends on this, so uninstall it.
357 echo "Uninstalling GNU gettext:"
358 cd gettext-$installed_gettext_version
359 $DO_MAKE_UNINSTALL || exit 1
360 make distclean || exit 1
362 rm gettext-$installed_gettext_version-done
364 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
366 # Get rid of the previously downloaded and unpacked version.
368 rm -rf gettext-$installed_gettext_version
369 rm -rf gettext-$installed_gettext_version.tar.gz
372 installed_gettext_version=""
376 install_pkg_config() {
377 if [ ! -f pkg-config-$PKG_CONFIG_VERSION-done ] ; then
378 echo "Downloading, building, and installing pkg-config:"
379 [ -f pkg-config-$PKG_CONFIG_VERSION.tar.gz ] || curl -O http://pkgconfig.freedesktop.org/releases/pkg-config-$PKG_CONFIG_VERSION.tar.gz || exit 1
380 gzcat pkg-config-$PKG_CONFIG_VERSION.tar.gz | tar xf - || exit 1
381 cd pkg-config-$PKG_CONFIG_VERSION
382 ./configure --with-internal-glib || exit 1
383 make $MAKE_BUILD_OPTS || exit 1
384 $DO_MAKE_INSTALL || exit 1
386 touch pkg-config-$PKG_CONFIG_VERSION-done
390 uninstall_pkg_config() {
391 if [ ! -z "$installed_pkg_config_version" ] ; then
392 echo "Uninstalling pkg-config:"
393 cd pkg-config-$installed_pkg_config_version
394 $DO_MAKE_UNINSTALL || exit 1
395 make distclean || exit 1
397 rm pkg-config-$installed_pkg_config_version-done
399 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
401 # Get rid of the previously downloaded and unpacked version.
403 rm -rf pkg-config-$installed_pkg_config_version
404 rm -rf pkg-config-$installed_pkg_config_version.tar.gz
407 installed_pkg_config_version=""
412 if [ ! -f glib-$GLIB_VERSION-done ] ; then
413 echo "Downloading, building, and installing GLib:"
414 glib_dir=`expr $GLIB_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
415 GLIB_MAJOR_VERSION="`expr $GLIB_VERSION : '\([0-9][0-9]*\).*'`"
416 GLIB_MINOR_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
417 GLIB_DOTDOT_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
418 if [[ $GLIB_MAJOR_VERSION -gt 2 ||
419 $GLIB_MINOR_VERSION -gt 28 ||
420 ($GLIB_MINOR_VERSION -eq 28 && $GLIB_DOTDOT_VERSION -ge 8) ]]
423 # Starting with GLib 2.28.8, xz-compressed tarballs are available.
425 [ -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
426 xzcat glib-$GLIB_VERSION.tar.xz | tar xf - || exit 1
428 [ -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
429 bzcat glib-$GLIB_VERSION.tar.bz2 | tar xf - || exit 1
431 cd glib-$GLIB_VERSION
433 # OS X ships with libffi, but doesn't provide its pkg-config file;
434 # explicitly specify LIBFFI_CFLAGS and LIBFFI_LIBS, so the configure
435 # script doesn't try to use pkg-config to get the appropriate
436 # C flags and loader flags.
438 # And, what's worse, at least with the version of Xcode that comes
439 # with Leopard, /usr/include/ffi/fficonfig.h doesn't define MACOSX,
440 # which causes the build of GLib to fail. If we don't find
441 # "#define.*MACOSX" in /usr/include/ffi/fficonfig.h, explicitly
444 # While we're at it, suppress -Wformat-nonliteral to avoid a case
445 # where clang's stricter rules on when not to complain about
446 # non-literal format arguments cause it to complain about code
447 # that's safe but it wasn't told that. See my comment #25 in
450 # https://bugzilla.gnome.org/show_bug.cgi?id=691608#c25
452 # First, determine where the system include files are. (It's not
453 # necessarily /usr/include.) There's a bit of a greasy hack here;
454 # pre-5.x versions of the developer tools don't support the
455 # --show-sdk-path option, and will produce no output, so includedir
456 # will be set to /usr/include (in those older versions of the
457 # developer tools, there is a /usr/include directory).
459 includedir=`xcrun --show-sdk-path 2>/dev/null`/usr/include
460 if grep -qs '#define.*MACOSX' $includedir/ffi/fficonfig.h
462 # It's defined, nothing to do
463 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
465 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
469 # Apply the fix to GNOME bug 529806:
471 # https://bugzilla.gnome.org/show_bug.cgi?id=529806
473 # if we have a version of GLib prior to 2.30.
475 if [[ $GLIB_MAJOR_VERSION -eq 2 && $GLIB_MINOR_VERSION -le 30 ]]
477 patch -p0 <../../macosx-support-lib-patches/glib-gconvert.c.patch || exit 1
479 make $MAKE_BUILD_OPTS || exit 1
480 $DO_MAKE_INSTALL || exit 1
482 touch glib-$GLIB_VERSION-done
487 if [ ! -z "$installed_glib_version" ] ; then
489 # ATK, Pango, and GTK depend on this, so uninstall them.
495 echo "Uninstalling GLib:"
496 cd glib-$installed_glib_version
497 $DO_MAKE_UNINSTALL || exit 1
498 make distclean || exit 1
500 rm glib-$installed_glib_version-done
502 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
504 # Get rid of the previously downloaded and unpacked version.
506 rm -rf glib-$installed_glib_version
507 rm -rf glib-$installed_glib_version.tar.xz glib-$installed_glib_version.tar.bz2
510 installed_glib_version=""
515 if [ "$QT_VERSION" -a ! -f qt-$QT_VERSION-done ]; then
516 echo "Downloading, building, and installing Qt:"
517 QT_MAJOR_VERSION="`expr $QT_VERSION : '\([0-9][0-9]*\).*'`"
518 QT_MINOR_VERSION="`expr $QT_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
519 QT_DOTDOT_VERSION="`expr $QT_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
520 QT_MAJOR_MINOR_VERSION=$QT_MAJOR_VERSION.$QT_MINOR_VERSION
522 # What you get for this URL might just be a 302 Found reply, so use
523 # -L so we get redirected.
525 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
527 # Qt 5.1.x sets QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
528 # in qtbase/mkspecs/$TARGET_PLATFORM/qmake.conf
529 # We may need to adjust this manually in the future.
531 # The -no-c++11 flag is needed to work around
532 # https://bugreports.qt-project.org/browse/QTBUG-30487
534 tar xf qt-everywhere-opensource-src-$QT_VERSION.tar.gz
535 cd qt-everywhere-opensource-src-$QT_VERSION
537 # We don't build Qt in its Full Shining Glory, as we don't need all
538 # of its components, and it takes *forever* to build in that form.
540 # Qt 5.2.0 beta1 fails to build on OS X without -no-xcb due to bug
543 # Qt 5.x fails to build on OS X with -no-opengl due to bug
546 ./configure -v $qt_sdk_arg -platform $TARGET_PLATFORM \
547 -opensource -confirm-license -no-c++11 -no-dbus \
548 -no-sql-sqlite -no-xcb -nomake examples \
549 -skip qtdoc -skip qtquickcontrols -skip qtwebkit \
550 -skip qtwebkit-examples -skip qtxmlpatterns
552 $DO_MAKE_INSTALL || exit 1
554 touch qt-$QT_VERSION-done
559 if [ ! -z "$installed_qt_version" ] ; then
560 echo "Uninstalling Qt:"
561 cd qt-everywhere-opensource-src-$installed_qt_version
562 $DO_MAKE_UNINSTALL || exit 1
564 # XXX - "make distclean" doesn't work. qmake sure does a
565 # good job of constructing Makefiles that work correctly....
567 #make distclean || exit 1
569 rm qt-$installed_qt_version-done
571 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
573 # Get rid of the previously downloaded and unpacked version.
575 rm -rf qt-everywhere-opensource-src-$installed_qt_version
576 rm -rf qt-everywhere-opensource-src-$installed_qt_version.tar.gz
579 installed_qt_version=""
584 if [ ! -f libpng-$PNG_VERSION-done ] ; then
585 echo "Downloading, building, and installing libpng:"
587 # The FTP site puts libpng x.y.* into a libpngxy directory.
589 subdir=`echo $PNG_VERSION | sed 's/\([1-9][0-9]*\)\.\([1-9][0-9]*\).*/libpng\1\2'/`
590 [ -f libpng-$PNG_VERSION.tar.xz ] || curl -O ftp://ftp.simplesystems.org/pub/libpng/png/src/$subdir/libpng-$PNG_VERSION.tar.xz
591 xzcat libpng-$PNG_VERSION.tar.xz | tar xf - || exit 1
592 cd libpng-$PNG_VERSION
593 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
594 make $MAKE_BUILD_OPTS || exit 1
595 $DO_MAKE_INSTALL || exit 1
597 touch libpng-$PNG_VERSION-done
602 if [ ! -z "$installed_libpng_version" ] ; then
604 # Cairo depends on this, so uninstall it.
608 echo "Uninstalling libpng:"
609 cd libpng-$installed_libpng_version
610 $DO_MAKE_UNINSTALL || exit 1
611 make distclean || exit 1
613 rm libpng-$installed_libpng_version-done
615 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
617 # Get rid of the previously downloaded and unpacked version.
619 rm -rf libpng-$installed_libpng_version
620 rm -rf libpng-$installed_libpng_version.tar.xz
623 installed_libpng_version=""
628 if [ ! -f pixman-$PIXMAN_VERSION-done ] ; then
629 echo "Downloading, building, and installing pixman:"
630 [ -f pixman-$PIXMAN_VERSION.tar.gz ] || curl -O http://www.cairographics.org/releases/pixman-$PIXMAN_VERSION.tar.gz
631 gzcat pixman-$PIXMAN_VERSION.tar.gz | tar xf - || exit 1
632 cd pixman-$PIXMAN_VERSION
633 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
634 make $MAKE_BUILD_OPTS || exit 1
635 $DO_MAKE_INSTALL || exit 1
637 touch pixman-$PIXMAN_VERSION-done
642 if [ ! -z "$installed_pixman_version" ] ; then
644 # Cairo depends on this, so uninstall it.
648 echo "Uninstalling pixman:"
649 cd pixman-$installed_pixman_version
650 $DO_MAKE_UNINSTALL || exit 1
651 make distclean || exit 1
653 rm pixman-$installed_pixman_version-done
655 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
657 # Get rid of the previously downloaded and unpacked version.
659 rm -rf pixman-$installed_pixman_version
660 rm -rf pixman-$installed_pixman_version.tar.gz
663 installed_pixman_version=""
668 if [ ! -f cairo-$CAIRO_VERSION-done ] ; then
669 echo "Downloading, building, and installing Cairo:"
670 CAIRO_MAJOR_VERSION="`expr $CAIRO_VERSION : '\([0-9][0-9]*\).*'`"
671 CAIRO_MINOR_VERSION="`expr $CAIRO_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
672 CAIRO_DOTDOT_VERSION="`expr $CAIRO_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
673 if [[ $CAIRO_MAJOR_VERSION -gt 1 ||
674 $CAIRO_MINOR_VERSION -gt 12 ||
675 ($CAIRO_MINOR_VERSION -eq 12 && $CAIRO_DOTDOT_VERSION -ge 2) ]]
678 # Starting with Cairo 1.12.2, the tarballs are compressed with
679 # xz rather than gzip.
681 [ -f cairo-$CAIRO_VERSION.tar.xz ] || curl -O http://cairographics.org/releases/cairo-$CAIRO_VERSION.tar.xz || exit 1
682 xzcat cairo-$CAIRO_VERSION.tar.xz | tar xf - || exit 1
684 [ -f cairo-$CAIRO_VERSION.tar.gz ] || curl -O http://cairographics.org/releases/cairo-$CAIRO_VERSION.tar.gz || exit 1
685 gzcat cairo-$CAIRO_VERSION.tar.gz | tar xf - || exit 1
687 cd cairo-$CAIRO_VERSION
688 # CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-quartz=no || exit 1
689 # Maybe follow http://cairographics.org/end_to_end_build_for_mac_os_x/
690 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-quartz=yes || exit 1
692 # We must avoid the version of libpng that comes with X11; the
693 # only way I've found to force that is to forcibly set INCLUDES
694 # when we do the build, so that this comes before CAIRO_CFLAGS,
695 # which has -I/usr/X11/include added to it before anything
696 # connected to libpng is.
698 INCLUDES="-I/usr/local/include/libpng15" make $MAKE_BUILD_OPTS || exit 1
699 $DO_MAKE_INSTALL || exit 1
701 touch cairo-$CAIRO_VERSION-done
706 if [ ! -z "$installed_cairo_version" ] ; then
708 # GTK+ depends on this, so uninstall it.
712 echo "Uninstalling Cairo:"
713 cd cairo-$installed_cairo_version
714 $DO_MAKE_UNINSTALL || exit 1
715 make distclean || exit 1
717 rm cairo-$installed_cairo_version-done
719 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
721 # Get rid of the previously downloaded and unpacked version.
723 rm -rf cairo-$installed_cairo_version
724 rm -rf cairo-$installed_cairo_version.tar.xz cairo-$installed_cairo_version.tar.gz
727 installed_cairo_version=""
732 if [ ! -f atk-$ATK_VERSION-done ] ; then
733 echo "Downloading, building, and installing ATK:"
734 atk_dir=`expr $ATK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
735 ATK_MAJOR_VERSION="`expr $ATK_VERSION : '\([0-9][0-9]*\).*'`"
736 ATK_MINOR_VERSION="`expr $ATK_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
737 ATK_DOTDOT_VERSION="`expr $ATK_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
738 if [[ $ATK_MAJOR_VERSION -gt 2 ||
739 ($ATK_MAJOR_VERSION -eq 2 && $ATK_MINOR_VERSION -gt 0) ||
740 ($ATK_MANOR_VERSION -eq 2 && $ATK_MINOR_VERSION -eq 0 && $ATK_DOTDOT_VERSION -ge 1) ]]
743 # Starting with ATK 2.0.1, xz-compressed tarballs are available.
745 [ -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
746 xzcat atk-$ATK_VERSION.tar.xz | tar xf - || exit 1
748 [ -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
749 bzcat atk-$ATK_VERSION.tar.bz2 | tar xf - || exit 1
752 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
753 make $MAKE_BUILD_OPTS || exit 1
754 $DO_MAKE_INSTALL || exit 1
756 touch atk-$ATK_VERSION-done
761 if [ ! -z "$installed_atk_version" ] ; then
763 # GTK+ depends on this, so uninstall it.
767 echo "Uninstalling ATK:"
768 cd atk-$installed_atk_version
769 $DO_MAKE_UNINSTALL || exit 1
770 make distclean || exit 1
772 rm atk-$installed_atk_version-done
774 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
776 # Get rid of the previously downloaded and unpacked version.
778 rm -rf atk-$installed_atk_version
779 rm -rf atk-$installed_atk_version.tar.xz atk-$installed_atk_version.tar.bz2
782 installed_atk_version=""
787 if [ ! -f pango-$PANGO_VERSION-done ] ; then
788 echo "Downloading, building, and installing Pango:"
789 pango_dir=`expr $PANGO_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
790 PANGO_MAJOR_VERSION="`expr $PANGO_VERSION : '\([0-9][0-9]*\).*'`"
791 PANGO_MINOR_VERSION="`expr $PANGO_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
792 if [[ $PANGO_MAJOR_VERSION -gt 1 ||
793 $PANGO_MINOR_VERSION -ge 29 ]]
796 # Starting with Pango 1.29, the tarballs are compressed with
797 # xz rather than bzip2.
799 [ -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
800 xzcat pango-$PANGO_VERSION.tar.xz | tar xf - || exit 1
802 [ -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
803 bzcat pango-$PANGO_VERSION.tar.bz2 | tar xf - || exit 1
805 cd pango-$PANGO_VERSION
806 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
807 make $MAKE_BUILD_OPTS || exit 1
808 $DO_MAKE_INSTALL || exit 1
810 touch pango-$PANGO_VERSION-done
815 if [ ! -z "$installed_pango_version" ] ; then
817 # GTK+ depends on this, so uninstall it.
821 echo "Uninstalling Pango:"
822 cd pango-$installed_pango_version
823 $DO_MAKE_UNINSTALL || exit 1
824 make distclean || exit 1
826 rm pango-$installed_pango_version-done
828 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
830 # Get rid of the previously downloaded and unpacked version.
832 rm -rf pango-$installed_pango_version
833 rm -rf pango-$installed_pango_version.tar.xz pango-$installed_pango_version.tar.bz2
836 installed_pango_version=""
840 install_gdk_pixbuf() {
841 if [ "$GDK_PIXBUF_VERSION" -a ! -f gdk-pixbuf-$GDK_PIXBUF_VERSION-done ] ; then
842 echo "Downloading, building, and installing gdk-pixbuf:"
843 gdk_pixbuf_dir=`expr $GDK_PIXBUF_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
844 [ -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
845 xzcat gdk-pixbuf-$GDK_PIXBUF_VERSION.tar.xz | tar xf - || exit 1
846 cd gdk-pixbuf-$GDK_PIXBUF_VERSION
848 # If we're building using the 10.6 SDK, force the use of libpng12.
850 # The OS's X11, and corresponding SDK, didn't introduce libpng15,
851 # or pkg-config files, until 10.7, so, for 10.6 have to explicitly
852 # set LIBPNG to override the configure script, and also force the
853 # CFLAGS to look for the header files for libpng12 (note that
854 # -isysroot doesn't affect the arguments to -I, so we need to
855 # include the SDK path explicitly).
857 if [[ "$sdk_target" = 10.6 ]]
859 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
861 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
863 make $MAKE_BUILD_OPTS || exit 1
864 $DO_MAKE_INSTALL || exit 1
866 touch gdk-pixbuf-$GDK_PIXBUF_VERSION-done
870 uninstall_gdk_pixbuf() {
871 if [ ! -z "$installed_gdk_pixbuf_version" ] ; then
873 # GTK+ depends on this, so uninstall it.
877 echo "Uninstalling gdk-pixbuf:"
878 cd gdk-pixbuf-$installed_gdk_pixbuf_version
879 $DO_MAKE_UNINSTALL || exit 1
880 make distclean || exit 1
882 rm gdk-pixbuf-$installed_gdk_pixbuf_version-done
884 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
886 # Get rid of the previously downloaded and unpacked version.
888 rm -rf gdk-pixbuf-$installed_gdk_pixbuf_version
889 rm -rf gdk-pixbuf-$installed_gdk_pixbuf_version.tar.xz
892 installed_gdk_pixbuf_version=""
897 if [ ! -f gtk+-$GTK_VERSION-done ] ; then
898 echo "Downloading, building, and installing GTK+:"
899 gtk_dir=`expr $GTK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
900 if [[ $GTK_MAJOR_VERSION -gt 2 ||
901 $GTK_MINOR_VERSION -gt 24 ||
902 ($GTK_MINOR_VERSION -eq 24 && $GTK_DOTDOT_VERSION -ge 5) ]]
905 # Starting with GTK+ 2.24.5, the tarballs are compressed with
906 # xz rather than gzip, in addition to bzip2; use xz, as we've
907 # built and installed it, and as xz compresses better than
908 # bzip2 so the tarballs take less time to download.
910 [ -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
911 xzcat gtk+-$GTK_VERSION.tar.xz | tar xf - || exit 1
913 [ -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
914 bzcat gtk+-$GTK_VERSION.tar.bz2 | tar xf - || exit 1
917 if [ $DARWIN_MAJOR_VERSION -ge "12" ]
920 # GTK+ 2.24.10, at least, doesn't build on Mountain Lion with the
921 # CUPS printing backend - either the CUPS API changed incompatibly
922 # or the backend was depending on non-API implementation details.
924 # Configure it out, on Mountain Lion and later, for now.
925 # (12 is the Darwin major version number in Mountain Lion.)
927 # Also, configure out libtiff and libjpeg; configure scripts
928 # just ignore unknown --enable/--disable and --with/--without
929 # options (at least they've always do so up to now).
931 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
933 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
935 make $MAKE_BUILD_OPTS || exit 1
936 $DO_MAKE_INSTALL || exit 1
938 touch gtk+-$GTK_VERSION-done
943 if [ ! -z "$installed_gtk_version" ] ; then
944 echo "Uninstalling GTK+:"
945 cd gtk+-$installed_gtk_version
946 $DO_MAKE_UNINSTALL || exit 1
947 make distclean || exit 1
949 rm gtk+-$installed_gtk_version-done
951 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
953 # Get rid of the previously downloaded and unpacked version.
955 rm -rf gtk+-$installed_gtk_version
956 rm -rf gtk+-$installed_gtk_version.tar.xz gtk+-$installed_gtk_version.tar.bz2
959 installed_gtk_version=""
964 if [ "$LIBSMI_VERSION" -a ! -f libsmi-$LIBSMI_VERSION-done ] ; then
965 echo "Downloading, building, and installing libsmi:"
966 [ -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
967 gzcat libsmi-$LIBSMI_VERSION.tar.gz | tar xf - || exit 1
968 cd libsmi-$LIBSMI_VERSION
969 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
970 make $MAKE_BUILD_OPTS || exit 1
971 $DO_MAKE_INSTALL || exit 1
973 touch libsmi-$LIBSMI_VERSION-done
978 if [ ! -z "$installed_libsmi_version" ] ; then
979 echo "Uninstalling libsmi:"
980 cd libsmi-$installed_libsmi_version
981 $DO_MAKE_UNINSTALL || exit 1
982 make distclean || exit 1
984 rm libsmi-$installed_libsmi_version-done
986 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
988 # Get rid of the previously downloaded and unpacked version.
990 rm -rf libsmi-$installed_libsmi_version
991 rm -rf libsmi-$installed_libsmi_version.tar.gz
994 installed_libsmi_version=""
998 install_libgpg_error() {
999 if [ "$LIBGPG_ERROR_VERSION" -a ! -f libgpg-error-$LIBGPG_ERROR_VERSION-done ] ; then
1000 echo "Downloading, building, and installing libgpg-error:"
1001 [ -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
1002 bzcat libgpg-error-$LIBGPG_ERROR_VERSION.tar.bz2 | tar xf - || exit 1
1003 cd libgpg-error-$LIBGPG_ERROR_VERSION
1004 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1005 make $MAKE_BUILD_OPTS || exit 1
1006 $DO_MAKE_INSTALL || exit 1
1008 touch libgpg-error-$LIBGPG_ERROR_VERSION-done
1012 uninstall_libgpg_error() {
1013 if [ ! -z "$installed_libgpg_error_version" ] ; then
1015 # libgcrypt depends on this, so uninstall it.
1017 uninstall_libgcrypt "$@"
1019 echo "Uninstalling libgpg-error:"
1020 cd libgpg-error-$installed_libgpg_error_version
1021 $DO_MAKE_UNINSTALL || exit 1
1022 make distclean || exit 1
1024 rm libgpg-error-$installed_libgpg_error_version-done
1026 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1028 # Get rid of the previously downloaded and unpacked version.
1030 rm -rf libgpg-error-$installed_libgpg_error_version
1031 rm -rf libgpg-error-$installed_libgpg_error_version.tar.bz2
1034 installed_libgpg_error_version=""
1038 install_libgcrypt() {
1039 if [ "$LIBGCRYPT_VERSION" -a ! -f libgcrypt-$LIBGCRYPT_VERSION-done ] ; then
1041 # libgpg-error is required for libgcrypt.
1043 if [ -z $LIBGPG_ERROR_VERSION ]
1045 echo "libgcrypt requires libgpg-error, but you didn't install libgpg-error." 1>&2
1049 echo "Downloading, building, and installing libgcrypt:"
1050 [ -f libgcrypt-$LIBGCRYPT_VERSION.tar.gz ] || curl -L -O ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-$LIBGCRYPT_VERSION.tar.gz || exit 1
1051 gzcat libgcrypt-$LIBGCRYPT_VERSION.tar.gz | tar xf - || exit 1
1052 cd libgcrypt-$LIBGCRYPT_VERSION
1054 # The assembler language code is not compatible with the OS X
1055 # x86 assembler (or is it an x86-64 vs. x86-32 issue?).
1057 # libgcrypt expects gnu89, not c99/gnu99, semantics for
1058 # "inline". See, for example:
1060 # http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2010-October/198809.html
1062 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
1063 make $MAKE_BUILD_OPTS || exit 1
1064 $DO_MAKE_INSTALL || exit 1
1066 touch libgcrypt-$LIBGCRYPT_VERSION-done
1070 uninstall_libgcrypt() {
1071 if [ ! -z "$installed_libgcrypt_version" ] ; then
1073 # GnuTLS depends on this, so uninstall it.
1075 uninstall_gnutls "$@"
1077 echo "Uninstalling libgcrypt:"
1078 cd libgcrypt-$installed_libgcrypt_version
1079 $DO_MAKE_UNINSTALL || exit 1
1080 make distclean || exit 1
1082 rm libgcrypt-$installed_libgcrypt_version-done
1084 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1086 # Get rid of the previously downloaded and unpacked version.
1088 rm -rf libgcrypt-$installed_libgcrypt_version
1089 rm -rf libgcrypt-$installed_libgcrypt_version.tar.gz
1092 installed_libgcrypt_version=""
1097 if [ "$GNUTLS_VERSION" -a ! -f gnutls-$GNUTLS_VERSION-done ] ; then
1099 # GnuTLS requires libgcrypt (or nettle, in newer versions).
1101 if [ -z $LIBGCRYPT_VERSION ]
1103 echo "GnuTLS requires libgcrypt, but you didn't install libgcrypt" 1>&2
1107 echo "Downloading, building, and installing GnuTLS:"
1108 [ -f gnutls-$GNUTLS_VERSION.tar.bz2 ] || curl -L -O http://ftp.gnu.org/gnu/gnutls/gnutls-$GNUTLS_VERSION.tar.bz2 || exit 1
1109 bzcat gnutls-$GNUTLS_VERSION.tar.bz2 | tar xf - || exit 1
1110 cd gnutls-$GNUTLS_VERSION
1112 # Use libgcrypt, not nettle.
1113 # XXX - is there some reason to prefer nettle? Or does
1114 # Wireshark directly use libgcrypt routines?
1116 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
1117 make $MAKE_BUILD_OPTS || exit 1
1119 # The pkgconfig file for GnuTLS says "requires zlib", but OS X,
1120 # while it supplies zlib, doesn't supply a pkgconfig file for
1123 # Patch the GnuTLS pkgconfig file not to require zlib.
1124 # (If the capabilities of GnuTLS that Wireshark uses don't
1125 # depend on building GnuTLS with zlib, an alternative would be
1126 # to configure it not to use zlib.)
1128 patch -p0 lib/gnutls.pc.in <../../macosx-support-lib-patches/gnutls-pkgconfig.patch || exit 1
1129 $DO_MAKE_INSTALL || exit 1
1131 touch gnutls-$GNUTLS_VERSION-done
1135 uninstall_gnutls() {
1136 if [ ! -z "$installed_gnutls_version" ] ; then
1137 echo "Uninstalling GnuTLS:"
1138 cd gnutls-$installed_gnutls_version
1139 $DO_MAKE_UNINSTALL || exit 1
1140 make distclean || exit 1
1142 rm gnutls-$installed_gnutls_version-done
1144 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1146 # Get rid of the previously downloaded and unpacked version.
1148 rm -rf gnutls-$installed_gnutls_version
1149 rm -rf gnutls-$installed_gnutls_version.tar.bz2
1152 installed_gnutls_version=""
1157 if [ "$LUA_VERSION" -a ! -f lua-$LUA_VERSION-done ] ; then
1158 echo "Downloading, building, and installing Lua:"
1159 [ -f lua-$LUA_VERSION.tar.gz ] || curl -L -O http://www.lua.org/ftp/lua-$LUA_VERSION.tar.gz || exit 1
1160 gzcat lua-$LUA_VERSION.tar.gz | tar xf - || exit 1
1162 make $MAKE_BUILD_OPTS macosx || exit 1
1163 $DO_MAKE_INSTALL || exit 1
1165 touch lua-$LUA_VERSION-done
1170 if [ ! -z "$installed_lua_version" ] ; then
1171 echo "Uninstalling Lua:"
1173 # Lua has no "make uninstall", so just remove stuff manually.
1174 # There's no configure script, so there's no need for
1175 # "make distclean", either; just do "make clean".
1177 (cd /usr/local/bin; $DO_RM -f lua luac)
1178 (cd /usr/local/include; $DO_RM -f lua.h luaconf.h lualib.h lauxlib.h lua.hpp)
1179 (cd /usr/local/lib; $DO_RM -f liblua.a)
1180 (cd /usr/local/man/man1; $DO_RM -f lua.1 luac.1)
1181 cd lua-$installed_lua_version
1182 make clean || exit 1
1184 rm lua-$installed_lua_version-done
1186 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1188 # Get rid of the previously downloaded and unpacked version.
1190 rm -rf lua-$installed_lua_version
1191 rm -rf lua-$installed_lua_version.tar.gz
1194 installed_lua_version=""
1198 install_portaudio() {
1200 # Check for both the old versionless portaudio-done and the new
1201 # versioned -done file.
1203 if [ "$PORTAUDIO_VERSION" -a ! -f portaudio-$PORTAUDIO_VERSION-done ] ; then
1204 echo "Downloading, building, and installing PortAudio:"
1205 [ -f $PORTAUDIO_VERSION.tgz ] || curl -L -O http://www.portaudio.com/archives/$PORTAUDIO_VERSION.tgz || exit 1
1206 gzcat $PORTAUDIO_VERSION.tgz | tar xf - || exit 1
1209 # Un-comment an include that's required on Lion.
1211 patch -p0 include/pa_mac_core.h <../../macosx-support-lib-patches/portaudio-pa_mac_core.h.patch
1213 # Fix a bug that showed up with clang (but is a bug with any
1216 patch -p0 src/hostapi/coreaudio/pa_mac_core.c <../../macosx-support-lib-patches/portaudio-pa_mac_core.c.patch
1218 # Disable fat builds - the configure script doesn't work right
1219 # with Xcode 4 if you leave them enabled, and we don't build
1220 # any other libraries fat (GLib, for example, would be very
1221 # hard to build fat), so there's no advantage to having PortAudio
1224 # Set the minimum OS X version to 10.4, to suppress some
1225 # deprecation warnings. (Good luck trying to make any of
1226 # this build on an OS+Xcode with a pre-10.4 SDK; we don't
1227 # worry about the user requesting that.)
1229 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
1230 make $MAKE_BUILD_OPTS || exit 1
1231 $DO_MAKE_INSTALL || exit 1
1233 touch portaudio-$PORTAUDIO_VERSION-done
1237 uninstall_portaudio() {
1238 if [ ! -z "$installed_portaudio_version" ] ; then
1239 echo "Uninstalling PortAudio:"
1241 $DO_MAKE_UNINSTALL || exit 1
1242 make distclean || exit 1
1244 rm portaudio-$installed_portaudio_version-done
1246 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1248 # Get rid of the previously downloaded and unpacked version.
1251 rm -rf $installed_portaudio_version.tgz
1254 installed_portaudio_version=""
1259 if [ "$GEOIP_VERSION" -a ! -f geoip-$GEOIP_VERSION-done ] ; then
1260 echo "Downloading, building, and installing GeoIP API:"
1261 [ -f GeoIP-$GEOIP_VERSION.tar.gz ] || curl -L -O http://geolite.maxmind.com/download/geoip/api/c/GeoIP-$GEOIP_VERSION.tar.gz || exit 1
1262 gzcat GeoIP-$GEOIP_VERSION.tar.gz | tar xf - || exit 1
1263 cd GeoIP-$GEOIP_VERSION
1264 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1266 # Grr. Their man pages "helpfully" have an ISO 8859-1
1267 # copyright symbol in the copyright notice, but OS X's
1268 # default character encoding is UTF-8. sed on Mountain
1269 # Lion barfs at the "illegal character sequence" represented
1270 # by an ISO 8859-1 copyright symbol, as it's not a valid
1273 # iconv the relevant man pages into UTF-8.
1275 for i in geoipupdate.1.in geoiplookup6.1.in geoiplookup.1.in
1277 iconv -f iso8859-1 -t utf-8 man/"$i" >man/"$i".tmp &&
1278 mv man/"$i".tmp man/"$i"
1280 make $MAKE_BUILD_OPTS || exit 1
1281 $DO_MAKE_INSTALL || exit 1
1283 touch geoip-$GEOIP_VERSION-done
1288 if [ ! -z "$installed_geoip_version" ] ; then
1289 echo "Uninstalling GeoIP API:"
1290 cd GeoIP-$installed_geoip_version
1291 $DO_MAKE_UNINSTALL || exit 1
1292 make distclean || exit 1
1294 rm geoip-$installed_geoip_version-done
1296 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1298 # Get rid of the previously downloaded and unpacked version.
1300 rm -rf GeoIP-$installed_geoip_version
1301 rm -rf GeoIP-$installed_geoip_version.tar.gz
1304 installed_geoip_version=""
1309 if [ "$CARES_VERSION" -a ! -f c-ares-$CARES_VERSION-done ] ; then
1310 echo "Downloading, building, and installing C-Ares API:"
1311 [ -f c-ares-$CARES_VERSION.tar.gz ] || curl -L -O http://c-ares.haxx.se/download/c-ares-$CARES_VERSION.tar.gz || exit 1
1312 gzcat c-ares-$CARES_VERSION.tar.gz | tar xf - || exit 1
1313 cd c-ares-$CARES_VERSION
1314 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1315 make $MAKE_BUILD_OPTS || exit 1
1316 $DO_MAKE_INSTALL || exit 1
1318 touch c-ares-$CARES_VERSION-done
1322 uninstall_c_ares() {
1323 if [ ! -z "$installed_cares_version" ] ; then
1324 echo "Uninstalling C-Ares API:"
1325 cd c-ares-$installed_cares_version
1326 $DO_MAKE_UNINSTALL || exit 1
1327 make distclean || exit 1
1329 rm c-ares-$installed_cares_version-done
1331 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1333 # Get rid of the previously downloaded and unpacked version.
1335 rm -rf c-ares-$installed_cares_version
1336 rm -rf c-ares-$installed_cares_version.tar.gz
1339 installed_cares_version=""
1345 # Check whether the versions we have installed are the versions
1346 # requested; if not, uninstall the installed versions.
1348 if [ ! -z "$installed_cares_version" -a \
1349 "$installed_cares_version" != "$CARES_VERSION" ] ; then
1350 echo "Installed C-Ares version is $installed_cares_version"
1351 if [ -z "$CARES_VERSION" ] ; then
1352 echo "C-Ares is not requested"
1354 echo "Requested C-Ares version is $CARES_VERSION"
1359 if [ ! -z "$installed_geoip_version" -a \
1360 "$installed_geoip_version" != "$GEOIP_VERSION" ] ; then
1361 echo "Installed GeoIP API version is $installed_geoip_version"
1362 if [ -z "$GEOIP_VERSION" ] ; then
1363 echo "GeoIP is not requested"
1365 echo "Requested GeoIP version is $GEOIP_VERSION"
1370 if [ ! -z "$installed_portaudio_version" -a \
1371 "$installed_portaudio_version" != "$PORTAUDIO_VERSION" ] ; then
1372 echo "Installed PortAudio version is $installed_portaudio_version"
1373 if [ -z "$PORTAUDIO_VERSION" ] ; then
1374 echo "PortAudio is not requested"
1376 echo "Requested PortAudio version is $PORTAUDIO_VERSION"
1378 uninstall_portaudio -r
1381 if [ ! -z "$installed_lua_version" -a \
1382 "$installed_lua_version" != "$LUA_VERSION" ] ; then
1383 echo "Installed Lua version is $installed_lua_version"
1384 if [ -z "$LUA_VERSION" ] ; then
1385 echo "Lua is not requested"
1387 echo "Requested Lua version is $LUA_VERSION"
1392 if [ ! -z "$installed_gnutls_version" -a \
1393 "$installed_gnutls_version" != "$GNUTLS_VERSION" ] ; then
1394 echo "Installed GnuTLS version is $installed_gnutls_version"
1395 if [ -z "$GNUTLS_VERSION" ] ; then
1396 echo "GnuTLS is not requested"
1398 echo "Requested GnuTLS version is $GNUTLS_VERSION"
1403 if [ ! -z "$installed_libgcrypt_version" -a \
1404 "$installed_libgcrypt_version" != "$LIBGCRYPT_VERSION" ] ; then
1405 echo "Installed libgcrypt version is $installed_libgcrypt_version"
1406 if [ -z "$LIBGCRYPT_VERSION" ] ; then
1407 echo "libgcrypt is not requested"
1409 echo "Requested libgcrypt version is $LIBGCRYPT_VERSION"
1411 uninstall_libgcrypt -r
1414 if [ ! -z "$installed_libgpg_error_version" -a \
1415 "$installed_libgpg_error_version" != "$LIBGPG_ERROR_VERSION" ] ; then
1416 echo "Installed libgpg-error version is $installed_libgpg_error_version"
1417 if [ -z "$LIBGPG_ERROR_VERSION" ] ; then
1418 echo "libgpg-error is not requested"
1420 echo "Requested libgpg-error version is $LIBGPG_ERROR_VERSION"
1422 uninstall_libgpg_error -r
1425 if [ ! -z "$installed_libsmi_version" -a \
1426 "$installed_libsmi_version" != "$LIBSMI_VERSION" ] ; then
1427 echo "Installed libsmi version is $installed_libsmi_version"
1428 if [ -z "$LIBSMI_VERSION" ] ; then
1429 echo "libsmi is not requested"
1431 echo "Requested libsmi version is $LIBSMI_VERSION"
1436 if [ ! -z "$installed_gtk_version" -a \
1437 "$installed_gtk_version" != "$GTK_VERSION" ] ; then
1438 echo "Installed GTK+ version is $installed_gtk_version"
1439 if [ -z "$GTK_VERSION" ] ; then
1440 echo "GTK+ is not requested"
1442 echo "Requested GTK+ version is $GTK_VERSION"
1447 if [ ! -z "$installed_gdk_pixbuf_version" -a \
1448 "$installed_gdk_pixbuf_version" != "$GDK_PIXBUF_VERSION" ] ; then
1449 echo "Installed gdk-pixbuf version is $installed_gdk_pixbuf_version"
1450 if [ -z "$GDK_PIXBUF_VERSION" ] ; then
1451 echo "gdk-pixbuf is not requested"
1453 echo "Requested gdk-pixbuf version is $GDK_PIXBUF_VERSION"
1455 uninstall_gdk_pixbuf -r
1458 if [ ! -z "$installed_pango_version" -a \
1459 "$installed_pango_version" != "$PANGO_VERSION" ] ; then
1460 echo "Installed Pango version is $installed_pango_version"
1461 if [ -z "$PANGO_VERSION" ] ; then
1462 echo "Pango is not requested"
1464 echo "Requested Pango version is $PANGO_VERSION"
1469 if [ ! -z "$installed_atk_version" -a \
1470 "$installed_atk_version" != "$ATK_VERSION" ] ; then
1471 echo "Installed ATK version is $installed_atk_version"
1472 if [ -z "$ATK_VERSION" ] ; then
1473 echo "ATK is not requested"
1475 echo "Requested ATK version is $ATK_VERSION"
1480 if [ ! -z "$installed_cairo_version" -a \
1481 "$installed_cairo_version" != "$CAIRO_VERSION" ] ; then
1482 echo "Installed Cairo version is $installed_cairo_version"
1483 if [ -z "$CAIRO_VERSION" ] ; then
1484 echo "Cairo is not requested"
1486 echo "Requested Cairo version is $CAIRO_VERSION"
1491 if [ ! -z "$installed_pixman_version" -a \
1492 "$installed_pixman_version" != "$PIXMAN_VERSION" ] ; then
1493 echo "Installed pixman version is $installed_pixman_version"
1494 if [ -z "$PIXMAN_VERSION" ] ; then
1495 echo "pixman is not requested"
1497 echo "Requested pixman version is $PIXMAN_VERSION"
1502 if [ ! -z "$installed_libpng_version" -a \
1503 "$installed_libpng_version" != "$PNG_VERSION" ] ; then
1504 echo "Installed libpng version is $installed_libpng_version"
1505 if [ -z "$PNG_VERSION" ] ; then
1506 echo "libpng is not requested"
1508 echo "Requested libpng version is $PNG_VERSION"
1513 if [ ! -z "$installed_qt_version" -a \
1514 "$installed_qt_version" != "$QT_VERSION" ] ; then
1515 echo "Installed Qt version is $installed_qt_version"
1516 if [ -z "$QT_VERSION" ] ; then
1517 echo "Qt is not requested"
1519 echo "Requested Qt version is $QT_VERSION"
1524 if [ ! -z "$installed_glib_version" -a \
1525 "$installed_glib_version" != "$GLIB_VERSION" ] ; then
1526 echo "Installed GLib version is $installed_glib_version"
1527 if [ -z "$GLIB_VERSION" ] ; then
1528 echo "GLib is not requested"
1530 echo "Requested GLib version is $GLIB_VERSION"
1535 if [ ! -z "$installed_pkg_config_version" -a \
1536 "$installed_pkg_config_version" != "$PKG_CONFIG_VERSION" ] ; then
1537 echo "Installed pkg-config version is $installed_pkg_config_version"
1538 if [ -z "$PKG_CONFIG_VERSION" ] ; then
1539 echo "pkg-config is not requested"
1541 echo "Requested pkg-config version is $PKG_CONFIG_VERSION"
1543 uninstall_pkg_config -r
1546 if [ ! -z "$installed_gettext_version" -a \
1547 "$installed_gettext_version" != "$GETTEXT_VERSION" ] ; then
1548 echo "Installed GNU gettext version is $installed_gettext_version"
1549 if [ -z "$GETTEXT_VERSION" ] ; then
1550 echo "GNU gettext is not requested"
1552 echo "Requested GNU gettext version is $GETTEXT_VERSION"
1554 uninstall_gettext -r
1557 if [ ! -z "$installed_cmake_version" -a \
1558 "$installed_cmake_version" != "$CMAKE_VERSION" ] ; then
1559 echo "Installed CMake version is $installed_cmake_version"
1560 if [ -z "$CMAKE_VERSION" ] ; then
1561 echo "CMake is not requested"
1563 echo "Requested CMake version is $CMAKE_VERSION"
1566 # XXX - really remove this?
1567 # Or should we remember it as installed only if this script
1573 if [ ! -z "$installed_libtool_version" -a \
1574 "$installed_libtool_version" != "$LIBTOOL_VERSION" ] ; then
1575 echo "Installed GNU libtool version is $installed_libtool_version"
1576 if [ -z "$LIBTOOL_VERSION" ] ; then
1577 echo "GNU libtool is not requested"
1579 echo "Requested GNU libtool version is $LIBTOOL_VERSION"
1581 uninstall_libtool -r
1584 if [ ! -z "$installed_automake_version" -a \
1585 "$installed_automake_version" != "$AUTOMAKE_VERSION" ] ; then
1586 echo "Installed GNU automake version is $installed_automake_version"
1587 if [ -z "$AUTOMAKE_VERSION" ] ; then
1588 echo "GNU automake is not requested"
1590 echo "Requested GNU automake version is $AUTOMAKE_VERSION"
1592 uninstall_automake -r
1595 if [ ! -z "$installed_autoconf_version" -a \
1596 "$installed_autoconf_version" != "$AUTOCONF_VERSION" ] ; then
1597 echo "Installed GNU autoconf version is $installed_autoconf_version"
1598 if [ -z "$AUTOCONF_VERSION" ] ; then
1599 echo "GNU autoconf is not requested"
1601 echo "Requested GNU autoconf version is $AUTOCONF_VERSION"
1603 uninstall_autoconf -r
1606 if [ ! -z "$installed_xz_version" -a \
1607 "$installed_xz_version" != "$XZ_VERSION" ] ; then
1608 echo "Installed xz version is $installed_xz_version"
1609 if [ -z "$XZ_VERSION" ] ; then
1610 echo "xz is not requested"
1612 echo "Requested xz version is $XZ_VERSION"
1618 # Start with xz: It is the sole download format of glib later than 2.31.2
1631 # Start with GNU gettext; GLib requires it, and OS X doesn't have it
1632 # or a BSD-licensed replacement.
1634 # At least on Lion with Xcode 4, _FORTIFY_SOURCE gets defined as 2
1635 # by default, which causes, for example, stpncpy to be defined as
1636 # a hairy macro that collides with the GNU gettext configure script's
1637 # attempts to workaround AIX's lack of a declaration for stpncpy,
1638 # with the result being a huge train wreck. Define _FORTIFY_SOURCE
1639 # as 0 in an attempt to keep the trains on separate tracks.
1644 # GLib depends on pkg-config.
1645 # By default, pkg-config depends on GLib; we break the dependency cycle
1646 # by configuring pkg-config to use its own internal version of GLib.
1653 # Now we have reached a point where we can build everything but
1654 # the GUI (Wireshark).
1658 if [ "$GTK_VERSION" ]; then
1660 # GTK+ 3 requires a newer Cairo build than the one that comes with
1661 # 10.6, so we build Cairo if we are using GTK+ 3.
1663 # In 10.6 and 10.7, it's an X11 library; if we build with "native" GTK+
1664 # rather than X11 GTK+, we might have to build and install Cairo.
1665 # In 10.8 and later, there is no X11, but it's included in Xquartz;
1666 # again, if we build with "native" GTK+, we'd have to build and install
1669 if [[ "$GTK_MAJOR_VERSION" -eq 3 || "$cairo_not_in_the_os" = yes ]]; then
1671 # Requirements for Cairo first
1673 # The libpng that comes with the X11 for Leopard has a bogus
1674 # pkg-config file that lies about where the header files are,
1675 # which causes other packages not to be able to find its
1678 # The libpng in later versions is not what the version of
1679 # libpixman we build below wants - it wants libpng15.
1684 # The libpixman versions that come with the X11s for Leopard,
1685 # Snow Leopard, and Lion is too old to support Cairo's image
1686 # surface backend feature (which requires pixman-1 >= 0.22.0).
1688 # XXX - what about the one that comes with the latest version
1694 # And now Cairo itself.
1695 # XXX - with the libxcb that comes with 10.6,
1696 # xcb_discard_reply() is missing, and the build fails.
1711 # Now we have reached a point where we can build everything including
1712 # the GUI (Wireshark), but not with any optional features such as
1713 # SNMP OID resolution, some forms of decryption, Lua scripting, playback
1714 # of audio, or GeoIP mapping of IP addresses.
1716 # We now conditionally download optional libraries to support them;
1717 # the default is to download them all.
1722 install_libgpg_error
1738 if [ -d macosx-support-libs ]
1740 cd macosx-support-libs
1743 # Uninstall items in the reverse order from the order in which they're
1744 # installed. Only uninstall if the download/build/install process
1745 # completed; uninstall the version that appears in the name of
1748 # We also do a "make distclean", so that we don't have leftovers from
1749 # old configurations.
1763 uninstall_libgpg_error
1769 uninstall_gdk_pixbuf
1785 uninstall_pkg_config
1790 # XXX - really remove this?
1791 # Or should we remember it as installed only if this script
1807 # Do we have permission to write in /usr/local?
1809 # If so, assume we have permission to write in its subdirectories.
1810 # (If that's not the case, this test needs to check the subdirectories
1813 # If not, do "make install", "make uninstall", the removes for Lua,
1814 # and the renames of [g]libtool* with sudo.
1816 if [ -w /usr/local ]
1818 DO_MAKE_INSTALL="make install"
1819 DO_MAKE_UNINSTALL="make uninstall"
1823 DO_MAKE_INSTALL="sudo make install"
1824 DO_MAKE_UNINSTALL="sudo make uninstall"
1830 # If we have SDKs available, the default target OS is the major version
1831 # of the one we're running; get that and strip off the third component
1834 for i in /Developer/SDKs \
1835 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
1836 /Library/Developer/CommandLineTools/SDKs
1840 min_osx_target=`sw_vers -productVersion | sed 's/\([0-9]*\)\.\([0-9]*\)\.[0-9]*/\1.\2/'`
1843 # That's also the OS whose SDK we'd be using.
1845 sdk_target=$min_osx_target
1851 # Parse command-line flags:
1854 # -t <target> - build libraries so that they'll work on the specified
1855 # version of OS X and later versions.
1856 # -u - do an uninstall.
1858 while getopts ht:u name
1865 min_osx_target="$OPTARG"
1868 echo "Usage: macosx-setup.sh [ -t <target> ] [ -u ]" 1>&1
1875 # Get the version numbers of installed packages, if any.
1877 if [ -d macosx-support-libs ]
1879 cd macosx-support-libs
1881 installed_xz_version=`ls xz-*-done 2>/dev/null | sed 's/xz-\(.*\)-done/\1/'`
1882 installed_autoconf_version=`ls autoconf-*-done 2>/dev/null | sed 's/autoconf-\(.*\)-done/\1/'`
1883 installed_automake_version=`ls automake-*-done 2>/dev/null | sed 's/automake-\(.*\)-done/\1/'`
1884 installed_libtool_version=`ls libtool-*-done 2>/dev/null | sed 's/libtool-\(.*\)-done/\1/'`
1885 installed_cmake_version=`ls cmake-*-done 2>/dev/null | sed 's/cmake-\(.*\)-done/\1/'`
1886 installed_gettext_version=`ls gettext-*-done 2>/dev/null | sed 's/gettext-\(.*\)-done/\1/'`
1887 installed_pkg_config_version=`ls pkg-config-*-done 2>/dev/null | sed 's/pkg-config-\(.*\)-done/\1/'`
1888 installed_glib_version=`ls glib-*-done 2>/dev/null | sed 's/glib-\(.*\)-done/\1/'`
1889 installed_qt_version=`ls qt-*-done 2>/dev/null | sed 's/qt-\(.*\)-done/\1/'`
1890 installed_libpng_version=`ls libpng-*-done 2>/dev/null | sed 's/libpng-\(.*\)-done/\1/'`
1891 installed_pixman_version=`ls pixman-*-done 2>/dev/null | sed 's/pixman-\(.*\)-done/\1/'`
1892 installed_cairo_version=`ls cairo-*-done 2>/dev/null | sed 's/cairo-\(.*\)-done/\1/'`
1893 installed_atk_version=`ls atk-*-done 2>/dev/null | sed 's/atk-\(.*\)-done/\1/'`
1894 installed_pango_version=`ls pango-*-done 2>/dev/null | sed 's/pango-\(.*\)-done/\1/'`
1895 installed_gdk_pixbuf_version=`ls gdk-pixbuf-*-done 2>/dev/null | sed 's/gdk-pixbuf-\(.*\)-done/\1/'`
1896 installed_gtk_version=`ls gtk+-*-done 2>/dev/null | sed 's/gtk+-\(.*\)-done/\1/'`
1897 installed_libsmi_version=`ls libsmi-*-done 2>/dev/null | sed 's/libsmi-\(.*\)-done/\1/'`
1898 installed_libgpg_error_version=`ls libgpg-error-*-done 2>/dev/null | sed 's/libgpg-error-\(.*\)-done/\1/'`
1899 installed_libgcrypt_version=`ls libgcrypt-*-done 2>/dev/null | sed 's/libgcrypt-\(.*\)-done/\1/'`
1900 installed_gnutls_version=`ls gnutls-*-done 2>/dev/null | sed 's/gnutls-\(.*\)-done/\1/'`
1901 installed_lua_version=`ls lua-*-done 2>/dev/null | sed 's/lua-\(.*\)-done/\1/'`
1902 installed_portaudio_version=`ls portaudio-*-done 2>/dev/null | sed 's/portaudio-\(.*\)-done/\1/'`
1903 installed_geoip_version=`ls geoip-*-done 2>/dev/null | sed 's/geoip-\(.*\)-done/\1/'`
1904 installed_cares_version=`ls c-ares-*-done 2>/dev/null | sed 's/c-ares-\(.*\)-done/\1/'`
1907 # If we don't have a versioned -done file for portaudio, but do have
1908 # an unversioned -done file for it, assume the installed version is the
1909 # requested version, and rename the -done file to include that version.
1911 if [ -z "$installed_portaudio_version" -a -f portaudio-done ] ; then
1912 mv portaudio-done portaudio-$PORTAUDIO_VERSION-done
1913 installed_portaudio_version=`ls portaudio-*-done 2>/dev/null | sed 's/portaudio-\(.*\)-done/\1/'`
1919 if [ "$do_uninstall" = "yes" ]
1926 # Configure scripts tend to set CFLAGS and CXXFLAGS to "-g -O2" if
1927 # invoked without CFLAGS or CXXFLAGS being set in the environment.
1929 # However, we *are* setting them in the environment, for our own
1930 # nefarious purposes, so start them out as "-g -O2".
1936 # To make this work on Leopard (rather than working *on* Snow Leopard
1937 # when building *for* Leopard) will take more work.
1939 # For one thing, Leopard's /usr/X11/lib/libXdamage.la claims, at least
1940 # with all software updates applied, that the Xdamage shared library
1941 # is libXdamage.1.0.0.dylib, but it is, in fact, libXdamage.1.1.0.dylib.
1942 # This causes problems when building GTK+, so the script would have to
1945 if [[ $DARWIN_MAJOR_VERSION -le 9 ]]; then
1946 echo "This script does not support any versions of OS X before Snow Leopard" 1>&2
1950 # if no make options are present, set default options
1951 if [ -z "$MAKE_BUILD_OPTS" ] ; then
1952 # by default use 1.5x number of cores for parallel build
1953 MAKE_BUILD_OPTS="-j $(( $(sysctl -n hw.logicalcpu) * 3 / 2))"
1957 # If we have a target release, look for the oldest SDK that's for an
1958 # OS equal to or later than that one, and build libraries against it
1959 # rather than against the headers and, more importantly, libraries
1960 # that come with the OS, so that we don't end up with support libraries
1961 # that only work on the OS version on which we built them, not earlier
1962 # versions of the same release, or earlier releases if the minimum is
1965 if [ ! -z "$min_osx_target" ]
1968 # Get the real version - strip off the "10.".
1969 # We'll worry about that if, as, and when there's ever
1972 deploy_real_version=`echo "$min_osx_target" | sed -n 's/10\.\(.*\)/\1/p'`
1975 # Search each directory that might contain SDKs.
1978 for sdksdir in /Developer/SDKs \
1979 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
1980 /Library/Developer/CommandLineTools/SDKs
1983 # Get a list of all the SDKs.
1985 if ! test -d "$sdksdir"
1988 # There is no directory with that name.
1989 # Move on to the next one in the list, if any.
1995 # Get a list of all the SDKs in that directory, if any.
1997 sdklist=`(cd "$sdksdir"; ls -d MacOSX10.[0-9]*.sdk 2>/dev/null)`
2002 # Get the real version for this SDK.
2004 sdk_real_version=`echo "$sdk" | sed -n 's/MacOSX10\.\(.*\)\.sdk/\1/p'`
2007 # Is it for the deployment target or some later release?
2009 if test "$sdk_real_version" -ge "$deploy_real_version"
2014 sdkpath="$sdksdir/$sdk"
2015 qt_sdk_arg="-sdk $sdk"
2021 if [ -z "$sdkpath" ]
2023 echo "macosx-setup.sh: Couldn't find an SDK for OS X $min_osx_target or later" 1>&2
2028 sdk_target=10.$sdk_real_version
2029 echo "Using the 10.$sdk_real_version SDK"
2032 # Make sure there are links to /usr/local/include and /usr/local/lib
2033 # in the SDK's usr/local.
2035 if [ ! -e $SDKPATH/usr/local/include ]
2037 if [ ! -d $SDKPATH/usr/local ]
2039 sudo mkdir $SDKPATH/usr/local
2041 sudo ln -s /usr/local/include $SDKPATH/usr/local/include
2043 if [ ! -e $SDKPATH/usr/local/lib ]
2045 if [ ! -d $SDKPATH/usr/local ]
2047 sudo mkdir $SDKPATH/usr/local
2049 sudo ln -s /usr/local/lib $SDKPATH/usr/local/lib
2053 # Set the minimum OS version for which to build to the specified
2054 # minimum target OS version, so we don't, for example, end up using
2055 # linker features supported by the OS verson on which we're building
2056 # but not by the target version.
2058 VERSION_MIN_FLAGS="-mmacosx-version-min=$min_osx_target"
2061 # Compile and link against the SDK.
2063 SDKFLAGS="-isysroot $SDKPATH"
2065 if [[ "$min_osx_target" == "10.5" ]]
2068 # Cairo is part of Mac OS X 10.6 and later.
2069 # The *headers* are supplied by 10.5, but the *libraries*
2070 # aren't, so we have to build it if we're building for 10.5.
2072 cairo_not_in_the_os=yes
2075 # Build with older versions of the support libraries, as
2076 # were used on the Wireshark Leopard buildbot at one
2077 # point. (Most of these versions come from the About page
2078 # from Wireshark 1.8.6, the last build done on that buildbot;
2079 # the ATK version isn't reported, so this is a guess.)
2081 # If you want to try building with newer versions of
2082 # the libraries, note that:
2084 # The version of fontconfig that comes with Leopard doesn't
2085 # support FC_WEIGHT_EXTRABLACK, so we can't use any version
2086 # of Pango newer than 1.22.4.
2088 # However, Pango 1.22.4 doesn't work with versions of GLib
2089 # after 2.29.6, because Pango 1.22.4 uses G_CONST_RETURN and
2090 # GLib 2.29.8 and later deprecate it (there doesn't appear to
2091 # be a GLib 2.29.7). That means we'd either have to patch
2092 # Pango not to use it (just use "const"; G_CONST_RETURN was
2093 # there to allow code to choose whether to use "const" or not),
2094 # or use GLib 2.29.6 or earlier.
2096 # GLib 2.29.6 includes an implementation of g_bit_lock() that,
2097 # on x86 (32-bit and 64-bit), uses asms in a fashion
2098 # ("asm volatile goto") that requires GCC 4.5 or later, which
2099 # is later than the compilers that come with Leopard and Snow
2100 # Leopard. Recent versions of GLib check for that, but 2.29.6
2101 # doesn't, so, if you want to build GLib 2.29.6 on Leopard or
2102 # Snow Leopard, you would have to patch glib/gbitlock.c to do
2103 # what the newer versions of GLib do:
2105 # define a USE_ASM_GOTO macro that indicates whether "asm goto"
2107 # #if (defined (i386) || defined (__amd64__))
2108 # #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
2109 # #define USE_ASM_GOTO 1
2113 # replace all occurrences of
2115 # #if defined (__GNUC__) && (defined (i386) || defined (__amd64__))
2119 # #ifdef USE_ASM_GOTO
2121 # Using GLib 2.29.6 or earlier, however, means that we can't
2122 # use a version of ATK later than 2.3.93, as those versions
2123 # don't work with GLib 2.29.6. The same applies to gdk-pixbuf;
2124 # versions of gdk-pixbuf after 2.24.1 won't work with GLib
2127 # Then you have to make sure that what you've build doesn't
2128 # cause the X server that comes with Leopard to crash; at
2129 # least one attempt at building for Leopard did.
2131 # At least if building on Leopard, you might also find
2132 # that, with various older versions of Cairo, including
2133 # 1.6.4 and at least some 1.8.x versions, when you try to
2134 # build it, the build fails because it can't find
2135 # png_set_longjmp_fn(). I vaguely remember dealing with that,
2136 # ages ago, but don't remember what I did.
2141 PANGO_VERSION=1.20.2
2145 # That version of GTK+ includes gdk-pixbuf.
2146 # XXX - base this on the version of GTK+ requested.
2151 # Libgcrypt 1.5.0 fails to compile due to some problem with an
2152 # asm in rijndael.c, at least with i686-apple-darwin10-gcc-4.2.1
2153 # (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) when building
2156 # We try libgcrypt 1.4.3 instead, as that's what shows up in
2157 # the version from the Leopard buildbot.
2158 LIBGCRYPT_VERSION=1.4.3
2161 # Build 32-bit while we're at it; Leopard has a bug that
2162 # causes some BPF functions not to work with 64-bit userland
2163 # code, so capturing won't work.
2165 CFLAGS="$CFLAGS -arch i386"
2166 CXXFLAGS="$CXXFLAGS -arch i386"
2167 export LDFLAGS="$LDFLAGS -arch i386"
2175 # You need Xcode or the command-line tools installed to get the compilers.
2177 if [ ! -x /usr/bin/xcodebuild ]; then
2178 echo "Please install Xcode first (should be available on DVD or from http://developer.apple.com/xcode/index.php)."
2182 if [ "$QT_VERSION" ]; then
2184 # We need Xcode, not just the command-line tools, installed to build
2187 if ! /usr/bin/xcrun -find xcrun >/dev/null 2>&1; then
2188 echo "Please install Xcode first (should be available on DVD or from http://developer.apple.com/xcode/index.php)."
2189 echo "The command-line build tools are not sufficient to build Qt."
2193 if [ "$GTK_VERSION" ]; then
2195 # If we're building with GTK+, you also need the X11 SDK; with at least
2196 # some versions of OS X and Xcode, that is, I think, an optional install.
2197 # (Or it might be installed with X11, but I think *that* is an optional
2198 # install on at least some versions of OS X.)
2200 if [ ! -d /usr/X11/include ]; then
2201 echo "Please install X11 and the X11 SDK first."
2202 echo " You can either use http://xquartz.macosforge.org/, e.g."
2203 echo " http://xquartz-dl.macosforge.org/SL/XQuartz-$XQUARTZ_VERSION.dmg"
2204 echo " or the native Apple packages if you are on Lion or below."
2209 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig
2212 # Do all the downloads and untarring in a subdirectory, so all that
2213 # stuff can be removed once we've installed the support libraries.
2215 if [ ! -d macosx-support-libs ]
2217 mkdir macosx-support-libs || exit 1
2219 cd macosx-support-libs
2225 echo "You are now prepared to build Wireshark. To do so do:"
2226 echo "export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig"
2228 if [ -n "$CMAKE" ]; then
2229 echo "mkdir build; cd build"
2236 echo "mkdir build; cd build"
2239 echo "make $MAKE_BUILD_OPTS"
2244 echo "Make sure you are allowed capture access to the network devices"
2245 echo "See: https://wiki.wireshark.org/CaptureSetup/CapturePrivileges"