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 install autotools
33 # To build all libraries as 32-bit libraries uncomment the following three lines.
35 # export CFLAGS="$CFLAGS -arch i386"
36 # export CXXFLAGS="$CXXFLAGS -arch i386"
37 # export LDFLAGS="$LDFLAGS -arch i386"
39 # and change "macx-clang" to "macx-clang-32" in the line below.
41 # Note: when building against the 10.6 SDK, clang fails, because there's
42 # a missing libstdc++.dylib in the SDK; this does not bother g++, however.
44 #TARGET_PLATFORM=macx-g++
45 TARGET_PLATFORM=macx-clang
48 # Versions of packages to download and install.
52 # Some packages need xz to unpack their current source.
53 # xz is not yet provided with OS X.
58 # In case we want to build with cmake.
60 CMAKE_VERSION=${CMAKE_VERSION-2.8.12.2}
63 # The following libraries and tools are required even to build only TShark.
65 GETTEXT_VERSION=0.18.2
67 PKG_CONFIG_VERSION=0.28
70 # One or more of the following libraries are required to build Wireshark.
72 # To override the versions of Qt and GTK call the script with some of the
73 # variables set to the new values. Setting a variable to empty will disable
74 # building the toolkit and will un-install any version previously installed
75 # by the script, e.g. "GTK_VERSION=3.5.2 QT_VERSION= ./macos-setup.sh"
76 # will build and install with GTK+ 3.5.2 and will not install Qt (and,
77 # if the script installed Qt earlier, will un-install that version of Qt).
79 # Note that Qt 5, prior to 5.5.0, mishandles context menus in ways that,
80 # for example, cause them not to work reliably in the packet detail or
81 # packet data pane; see, for example, Qt bugs QTBUG-31937, QTBUG-41017,
82 # and QTBUG-43464, all of which seem to be the same bug.
84 QT_VERSION=${QT_VERSION-5.5.0}
85 GTK_VERSION=${GTK_VERSION-2.24.17}
86 if [ "$GTK_VERSION" ]; then
88 # We'll be building GTK+, so we need some additional libraries.
90 GTK_MAJOR_VERSION="`expr $GTK_VERSION : '\([0-9][0-9]*\).*'`"
91 GTK_MINOR_VERSION="`expr $GTK_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
92 GTK_DOTDOT_VERSION="`expr $GTK_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
99 GDK_PIXBUF_VERSION=2.28.0
101 if [ "$QT_VERSION" ]; then
102 QT_MAJOR_VERSION="`expr $QT_VERSION : '\([0-9][0-9]*\).*'`"
103 QT_MINOR_VERSION="`expr $QT_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
104 QT_DOTDOT_VERSION="`expr $QT_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
105 QT_MAJOR_MINOR_VERSION=$QT_MAJOR_VERSION.$QT_MINOR_VERSION
106 QT_MAJOR_MINOR_DOTDOT_VERSION=$QT_MAJOR_VERSION.$QT_MINOR_VERSION.$QT_DOTDOT_VERSION
109 # In case we want to build GTK *and* we don't have Apple's X11 SDK installed
110 # we may want to install XQuartz. The version will only be used in the printing
111 # of a URL, the package will not be installed.
113 XQUARTZ_VERSION=2.7.5
115 # The following libraries are optional.
116 # Comment them out if you don't want them, but note that some of
117 # the optional libraries are required by other optional libraries.
121 # libgpg-error is required for libgcrypt.
123 LIBGPG_ERROR_VERSION=1.10
125 # libgcrypt is required for GnuTLS.
127 LIBGCRYPT_VERSION=1.5.0
128 GNUTLS_VERSION=2.12.19
129 # Use 5.2.3, not 5.3, for now; lua_bitop.c hasn't been ported to 5.3
130 # yet, and we need to check for compatibility issues (we'd want Lua
131 # scripts to work with 5.1, 5.2, and 5.3, as long as they only use Lua
132 # features present in all three versions)
134 PORTAUDIO_VERSION=pa_stable_v19_20111121
136 # XXX - they appear to have an unversioned gzipped tarball for the
137 # current version; should we just download that, with some other
138 # way of specifying whether to download the GeoIP API?
146 DARWIN_MAJOR_VERSION=`uname -r | sed 's/\([0-9]*\).*/\1/'`
149 # GNU autotools; they're provided with releases up to Snow Leopard, but
150 # not in later releases.
152 if [ -n "$AUTOTOOLS" -a $DARWIN_MAJOR_VERSION -gt 10 ]; then
153 AUTOCONF_VERSION=2.69
154 AUTOMAKE_VERSION=1.13.3
155 LIBTOOL_VERSION=2.4.2
159 if [ "$XZ_VERSION" -a ! -f xz-$XZ_VERSION-done ] ; then
160 echo "Downloading, building, and installing xz:"
161 [ -f xz-$XZ_VERSION.tar.bz2 ] || curl -O http://tukaani.org/xz/xz-$XZ_VERSION.tar.bz2 || exit 1
162 bzcat xz-$XZ_VERSION.tar.bz2 | tar xf - || exit 1
164 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0" ./configure || exit 1
165 make $MAKE_BUILD_OPTS || exit 1
166 $DO_MAKE_INSTALL || exit 1
168 touch xz-$XZ_VERSION-done
173 if [ ! -z "$installed_xz_version" ] ; then
174 echo "Uninstalling xz:"
175 cd xz-$installed_xz_version
176 $DO_MAKE_UNINSTALL || exit 1
177 make distclean || exit 1
179 rm xz-$installed_xz_version-done
181 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
183 # Get rid of the previously downloaded and unpacked version.
185 rm -rf xz-$installed_xz_version
186 rm -rf xz-$installed_xz_version.tar.bz2
189 installed_xz_version=""
194 if [ "$AUTOCONF_VERSION" -a ! -f autoconf-$AUTOCONF_VERSION-done ] ; then
195 echo "Downloading, building and installing GNU autoconf..."
196 [ -f autoconf-$AUTOCONF_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/autoconf/autoconf-$AUTOCONF_VERSION.tar.xz || exit 1
197 xzcat autoconf-$AUTOCONF_VERSION.tar.xz | tar xf - || exit 1
198 cd autoconf-$AUTOCONF_VERSION
199 ./configure || exit 1
200 make $MAKE_BUILD_OPTS || exit 1
201 $DO_MAKE_INSTALL || exit 1
203 touch autoconf-$AUTOCONF_VERSION-done
207 uninstall_autoconf() {
208 if [ ! -z "$installed_autoconf_version" ] ; then
210 # automake and libtool depend on this, so uninstall them.
215 echo "Uninstalling GNU autoconf:"
216 cd autoconf-$installed_autoconf_version
217 $DO_MAKE_UNINSTALL || exit 1
218 make distclean || exit 1
220 rm autoconf-$installed_autoconf_version-done
222 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
224 # Get rid of the previously downloaded and unpacked version.
226 rm -rf autoconf-$installed_autoconf_version
227 rm -rf autoconf-$installed_autoconf_version.tar.xz
230 installed_autoconf_version=""
235 if [ "$AUTOMAKE_VERSION" -a ! -f automake-$AUTOMAKE_VERSION-done ] ; then
236 echo "Downloading, building and installing GNU automake..."
237 [ -f automake-$AUTOMAKE_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/automake/automake-$AUTOMAKE_VERSION.tar.xz || exit 1
238 xzcat automake-$AUTOMAKE_VERSION.tar.xz | tar xf - || exit 1
239 cd automake-$AUTOMAKE_VERSION
240 ./configure || exit 1
241 make $MAKE_BUILD_OPTS || exit 1
242 $DO_MAKE_INSTALL || exit 1
244 touch automake-$AUTOMAKE_VERSION-done
248 uninstall_automake() {
249 if [ ! -z "$installed_automake_version" ] ; then
251 # libtool depends on this(?), so uninstall it.
253 uninstall_libtool "$@"
255 echo "Uninstalling GNU automake:"
256 cd automake-$installed_automake_version
257 $DO_MAKE_UNINSTALL || exit 1
258 make distclean || exit 1
260 rm automake-$installed_automake_version-done
262 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
264 # Get rid of the previously downloaded and unpacked version.
266 rm -rf automake-$installed_automake_version
267 rm -rf automake-$installed_automake_version.tar.xz
270 installed_automake_version=""
275 if [ "$LIBTOOL_VERSION" -a ! -f libtool-$LIBTOOL_VERSION-done ] ; then
276 echo "Downloading, building and installing GNU libtool..."
277 [ -f libtool-$LIBTOOL_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/libtool/libtool-$LIBTOOL_VERSION.tar.xz || exit 1
278 xzcat libtool-$LIBTOOL_VERSION.tar.xz | tar xf - || exit 1
279 cd libtool-$LIBTOOL_VERSION
280 ./configure || exit 1
281 make $MAKE_BUILD_OPTS || exit 1
282 $DO_MAKE_INSTALL || exit 1
283 $DO_MV /usr/local/bin/libtool /usr/local/bin/glibtool
284 $DO_MV /usr/local/bin/libtoolize /usr/local/bin/glibtoolize
286 touch libtool-$LIBTOOL_VERSION-done
290 uninstall_libtool() {
291 if [ ! -z "$installed_libtool_version" ] ; then
292 echo "Uninstalling GNU libtool:"
293 cd libtool-$installed_libtool_version
294 $DO_MV /usr/local/bin/glibtool /usr/local/bin/libtool
295 $DO_MV /usr/local/bin/glibtoolize /usr/local/bin/libtoolize
296 $DO_MAKE_UNINSTALL || exit 1
297 make distclean || exit 1
299 rm libtool-$installed_libtool_version-done
301 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
303 # Get rid of the previously downloaded and unpacked version.
305 rm -rf libtool-$installed_libtool_version
306 rm -rf libtool-$installed_libtool_version.tar.xz
309 installed_libtool_version=""
314 if [ -n "$CMAKE" -a ! -f cmake-$CMAKE_VERSION-done ]; then
315 echo "Downloading and installing CMake:"
316 CMAKE_MAJOR_VERSION="`expr $CMAKE_VERSION : '\([0-9][0-9]*\).*'`"
317 CMAKE_MINOR_VERSION="`expr $CMAKE_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
318 CMAKE_DOTDOT_VERSION="`expr $CMAKE_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
319 CMAKE_MAJOR_MINOR_VERSION=$CMAKE_MAJOR_VERSION.$CMAKE_MINOR_VERSION
322 # NOTE: the "64" in "Darwin64" doesn't mean "64-bit-only"; the
323 # package in question supports both 32-bit and 64-bit x86.
325 case "$CMAKE_MAJOR_VERSION" in
328 echo "CMake $CMAKE_VERSION" is too old 1>&2
333 # Download the DMG, run the installer.
335 [ -f cmake-$CMAKE_VERSION-Darwin64-universal.dmg ] || curl -O https://cmake.org/files/v$CMAKE_MAJOR_MINOR_VERSION/cmake-$CMAKE_VERSION-Darwin64-universal.dmg || exit 1
336 sudo hdiutil attach cmake-$CMAKE_VERSION-Darwin64-universal.dmg || exit 1
337 sudo installer -target / -pkg /Volumes/cmake-$CMAKE_VERSION-Darwin64-universal/cmake-$CMAKE_VERSION-Darwin64-universal.pkg || exit 1
338 sudo hdiutil detach /Volumes/cmake-$CMAKE_VERSION-Darwin64-universal
343 # Download the DMG and do a drag install, where "drag" means
346 # 3.0.* and 3.1.0 have a Darwin64-universal DMG.
347 # 3.1.1 and later have a Darwin-x86_64 DMG.
348 # Probably not many people are still developing on 32-bit
349 # Macs, so we don't worry about them.
351 if [ "$CMAKE_MINOR_VERSION" = 0 -o \
352 "$CMAKE_VERSION" = 3.1.0 ]; then
353 type="Darwin64-universal"
357 [ -f cmake-$CMAKE_VERSION-$type.dmg ] || curl -O https://cmake.org/files/v$CMAKE_MAJOR_MINOR_VERSION/cmake-$CMAKE_VERSION-$type.dmg || exit 1
358 sudo hdiutil attach cmake-$CMAKE_VERSION-$type.dmg || exit 1
359 sudo ditto /Volumes/cmake-$CMAKE_VERSION-$type/CMake.app /Applications/CMake.app || exit 1
362 # Plant the appropriate symbolic links in /usr/local/bin.
363 # It's a drag-install, so there's no installer to make them,
364 # and the CMake code to put them in place is lame, as
366 # 1) it defaults to /usr/bin, not /usr/local/bin;
367 # 2) it doesn't request the necessary root privileges;
368 # 3) it can't be run from the command line;
370 # so we do it ourselves.
372 for i in ccmake cmake cmake-gui cmakexbuild cpack ctest
374 sudo ln -s /Applications/CMake.app/Contents/bin/$i /usr/local/bin/$i
376 sudo hdiutil detach /Volumes/cmake-$CMAKE_VERSION-$type
382 touch cmake-$CMAKE_VERSION-done
387 if [ ! -z "$installed_cmake_version" ]; then
388 echo "Uninstalling CMake:"
389 installed_cmake_major_version="`expr $installed_cmake_version : '\([0-9][0-9]*\).*'`"
390 case "$installed_cmake_major_version" in
393 echo "CMake $installed_cmake_version" is too old 1>&2
397 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
398 for i in ccmake cmake cmake-gui cmakexbuild cpack ctest
400 sudo rm -f /usr/bin/$i /usr/local/bin/$i
402 sudo pkgutil --forget com.Kitware.CMake
403 rm cmake-$installed_cmake_version-done
407 sudo rm -rf /Applications/CMake.app
408 for i in ccmake cmake cmake-gui cmakexbuild cpack ctest
410 sudo rm -f /usr/local/bin/$i
412 rm cmake-$installed_cmake_version-done
416 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
418 # Get rid of the previously downloaded and unpacked version,
419 # whatever it might happen to be called.
421 rm -f cmake-$installed_cmake_version-Darwin64-universal.dmg
422 rm -f cmake-$installed_cmake_version-Darwin-x86_64.dmg
425 installed_cmake_version=""
430 if [ ! -f gettext-$GETTEXT_VERSION-done ] ; then
431 echo "Downloading, building, and installing GNU gettext:"
432 [ -f gettext-$GETTEXT_VERSION.tar.gz ] || curl -O http://ftp.gnu.org/pub/gnu/gettext/gettext-$GETTEXT_VERSION.tar.gz || exit 1
433 gzcat gettext-$GETTEXT_VERSION.tar.gz | tar xf - || exit 1
434 cd gettext-$GETTEXT_VERSION
435 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0 $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
436 make $MAKE_BUILD_OPTS || exit 1
437 $DO_MAKE_INSTALL || exit 1
439 touch gettext-$GETTEXT_VERSION-done
443 uninstall_gettext() {
444 if [ ! -z "$installed_gettext_version" ] ; then
446 # GLib depends on this, so uninstall it.
450 echo "Uninstalling GNU gettext:"
451 cd gettext-$installed_gettext_version
452 $DO_MAKE_UNINSTALL || exit 1
453 make distclean || exit 1
455 rm gettext-$installed_gettext_version-done
457 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
459 # Get rid of the previously downloaded and unpacked version.
461 rm -rf gettext-$installed_gettext_version
462 rm -rf gettext-$installed_gettext_version.tar.gz
465 installed_gettext_version=""
469 install_pkg_config() {
470 if [ ! -f pkg-config-$PKG_CONFIG_VERSION-done ] ; then
471 echo "Downloading, building, and installing pkg-config:"
472 [ -f pkg-config-$PKG_CONFIG_VERSION.tar.gz ] || curl -O https://pkgconfig.freedesktop.org/releases/pkg-config-$PKG_CONFIG_VERSION.tar.gz || exit 1
473 gzcat pkg-config-$PKG_CONFIG_VERSION.tar.gz | tar xf - || exit 1
474 cd pkg-config-$PKG_CONFIG_VERSION
475 ./configure --with-internal-glib || exit 1
476 make $MAKE_BUILD_OPTS || exit 1
477 $DO_MAKE_INSTALL || exit 1
479 touch pkg-config-$PKG_CONFIG_VERSION-done
483 uninstall_pkg_config() {
484 if [ ! -z "$installed_pkg_config_version" ] ; then
485 echo "Uninstalling pkg-config:"
486 cd pkg-config-$installed_pkg_config_version
487 $DO_MAKE_UNINSTALL || exit 1
488 make distclean || exit 1
490 rm pkg-config-$installed_pkg_config_version-done
492 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
494 # Get rid of the previously downloaded and unpacked version.
496 rm -rf pkg-config-$installed_pkg_config_version
497 rm -rf pkg-config-$installed_pkg_config_version.tar.gz
500 installed_pkg_config_version=""
505 if [ ! -f glib-$GLIB_VERSION-done ] ; then
506 echo "Downloading, building, and installing GLib:"
507 glib_dir=`expr $GLIB_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
508 GLIB_MAJOR_VERSION="`expr $GLIB_VERSION : '\([0-9][0-9]*\).*'`"
509 GLIB_MINOR_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
510 GLIB_DOTDOT_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
511 if [[ $GLIB_MAJOR_VERSION -gt 2 ||
512 $GLIB_MINOR_VERSION -gt 28 ||
513 ($GLIB_MINOR_VERSION -eq 28 && $GLIB_DOTDOT_VERSION -ge 8) ]]
516 # Starting with GLib 2.28.8, xz-compressed tarballs are available.
518 [ -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
519 xzcat glib-$GLIB_VERSION.tar.xz | tar xf - || exit 1
521 [ -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
522 bzcat glib-$GLIB_VERSION.tar.bz2 | tar xf - || exit 1
524 cd glib-$GLIB_VERSION
526 # OS X ships with libffi, but doesn't provide its pkg-config file;
527 # explicitly specify LIBFFI_CFLAGS and LIBFFI_LIBS, so the configure
528 # script doesn't try to use pkg-config to get the appropriate
529 # C flags and loader flags.
531 # And, what's worse, at least with the version of Xcode that comes
532 # with Leopard, /usr/include/ffi/fficonfig.h doesn't define MACOSX,
533 # which causes the build of GLib to fail. If we don't find
534 # "#define.*MACOSX" in /usr/include/ffi/fficonfig.h, explicitly
537 # While we're at it, suppress -Wformat-nonliteral to avoid a case
538 # where clang's stricter rules on when not to complain about
539 # non-literal format arguments cause it to complain about code
540 # that's safe but it wasn't told that. See my comment #25 in
543 # https://bugzilla.gnome.org/show_bug.cgi?id=691608#c25
545 # First, determine where the system include files are. (It's not
546 # necessarily /usr/include.) There's a bit of a greasy hack here;
547 # pre-5.x versions of the developer tools don't support the
548 # --show-sdk-path option, and will produce no output, so includedir
549 # will be set to /usr/include (in those older versions of the
550 # developer tools, there is a /usr/include directory).
552 includedir=`xcrun --show-sdk-path 2>/dev/null`/usr/include
553 if grep -qs '#define.*MACOSX' $includedir/ffi/fficonfig.h
555 # It's defined, nothing to do
556 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
558 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
562 # Apply the fix to GNOME bug 529806:
564 # https://bugzilla.gnome.org/show_bug.cgi?id=529806
566 # if we have a version of GLib prior to 2.30.
568 if [[ $GLIB_MAJOR_VERSION -eq 2 && $GLIB_MINOR_VERSION -le 30 ]]
570 patch -p0 <../../macosx-support-lib-patches/glib-gconvert.c.patch || exit 1
572 make $MAKE_BUILD_OPTS || exit 1
573 $DO_MAKE_INSTALL || exit 1
575 touch glib-$GLIB_VERSION-done
580 if [ ! -z "$installed_glib_version" ] ; then
582 # ATK, Pango, and GTK depend on this, so uninstall them.
588 echo "Uninstalling GLib:"
589 cd glib-$installed_glib_version
590 $DO_MAKE_UNINSTALL || exit 1
591 make distclean || exit 1
593 rm glib-$installed_glib_version-done
595 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
597 # Get rid of the previously downloaded and unpacked version.
599 rm -rf glib-$installed_glib_version
600 rm -rf glib-$installed_glib_version.tar.xz glib-$installed_glib_version.tar.bz2
603 installed_glib_version=""
608 if [ "$QT_VERSION" -a ! -f qt-$QT_VERSION-done ]; then
609 echo "Downloading, building, and installing Qt:"
611 # What you get for this URL might just be a 302 Found reply, so use
612 # -L so we get redirected.
614 if [ "$QT_MAJOR_VERSION" -ge 5 ]
616 QT_VOLUME=qt-opensource-mac-x64-clang-$QT_VERSION
618 QT_VOLUME=qt-opensource-mac-$QT_VERSION
620 [ -f $QT_VOLUME.dmg ] || curl -L -O http://download.qt.io/archive/qt/$QT_MAJOR_MINOR_VERSION/$QT_MAJOR_MINOR_DOTDOT_VERSION/$QT_VOLUME.dmg || exit 1
621 sudo hdiutil attach $QT_VOLUME.dmg || exit 1
623 if [ "$QT_MAJOR_VERSION" -ge 5 ]
626 # Run the installer executable directly, so that we wait for
627 # it to finish. Then unmount the volume.
629 /Volumes/$QT_VOLUME/$QT_VOLUME.app/Contents/MacOS/$QT_VOLUME
630 sudo hdiutil detach /Volumes/$QT_VOLUME
633 # Open the installer package; use -W, so that we wait for
634 # the installer to finish. Then unmount the volume.
636 open -W "/Volumes/Qt $QT_MAJOR_MINOR_DOTDOT_VERSION/Qt.mpkg"
637 sudo hdiutil detach "/Volumes/Qt $QT_MAJOR_MINOR_DOTDOT_VERSION"
641 # Versions 5.3.x through 5.5.0, at least, have bogus .pc files.
642 # See bugs QTBUG-35256 and QTBUG-47162.
646 for i in $HOME/Qt$QT_VERSION/$QT_MAJOR_MINOR_VERSION/clang_64/lib/pkgconfig/*.pc
650 g/Cflags: /s;;Cflags: -F\${libdir} ;
651 g/Cflags: /s;-I\${includedir}/Qt\([a-zA-Z0-9_]*\);-I\${libdir}/Qt\1.framework/Versions/5/Headers;
657 touch qt-$QT_VERSION-done
662 if [ ! -z "$installed_qt_version" ] ; then
663 echo "Uninstalling Qt:"
664 rm -rf $HOME/Qt$installed_qt_version
665 rm qt-$installed_qt_version-done
667 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
669 # Get rid of the previously downloaded version.
671 rm -rf qt-opensource-mac-x64-clang-$installed_qt_version.dmg
674 installed_qt_version=""
679 if [ ! -f libpng-$PNG_VERSION-done ] ; then
680 echo "Downloading, building, and installing libpng:"
682 # The FTP site puts libpng x.y.* into a libpngxy directory.
684 subdir=`echo $PNG_VERSION | sed 's/\([1-9][0-9]*\)\.\([1-9][0-9]*\).*/libpng\1\2'/`
685 [ -f libpng-$PNG_VERSION.tar.xz ] || curl -O ftp://ftp.simplesystems.org/pub/libpng/png/src/$subdir/libpng-$PNG_VERSION.tar.xz
686 xzcat libpng-$PNG_VERSION.tar.xz | tar xf - || exit 1
687 cd libpng-$PNG_VERSION
688 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
689 make $MAKE_BUILD_OPTS || exit 1
690 $DO_MAKE_INSTALL || exit 1
692 touch libpng-$PNG_VERSION-done
697 if [ ! -z "$installed_libpng_version" ] ; then
699 # Cairo depends on this, so uninstall it.
703 echo "Uninstalling libpng:"
704 cd libpng-$installed_libpng_version
705 $DO_MAKE_UNINSTALL || exit 1
706 make distclean || exit 1
708 rm libpng-$installed_libpng_version-done
710 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
712 # Get rid of the previously downloaded and unpacked version.
714 rm -rf libpng-$installed_libpng_version
715 rm -rf libpng-$installed_libpng_version.tar.xz
718 installed_libpng_version=""
723 if [ ! -f pixman-$PIXMAN_VERSION-done ] ; then
724 echo "Downloading, building, and installing pixman:"
725 [ -f pixman-$PIXMAN_VERSION.tar.gz ] || curl -O http://www.cairographics.org/releases/pixman-$PIXMAN_VERSION.tar.gz
726 gzcat pixman-$PIXMAN_VERSION.tar.gz | tar xf - || exit 1
727 cd pixman-$PIXMAN_VERSION
728 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
729 make $MAKE_BUILD_OPTS || exit 1
730 $DO_MAKE_INSTALL || exit 1
732 touch pixman-$PIXMAN_VERSION-done
737 if [ ! -z "$installed_pixman_version" ] ; then
739 # Cairo depends on this, so uninstall it.
743 echo "Uninstalling pixman:"
744 cd pixman-$installed_pixman_version
745 $DO_MAKE_UNINSTALL || exit 1
746 make distclean || exit 1
748 rm pixman-$installed_pixman_version-done
750 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
752 # Get rid of the previously downloaded and unpacked version.
754 rm -rf pixman-$installed_pixman_version
755 rm -rf pixman-$installed_pixman_version.tar.gz
758 installed_pixman_version=""
763 if [ ! -f cairo-$CAIRO_VERSION-done ] ; then
764 echo "Downloading, building, and installing Cairo:"
765 CAIRO_MAJOR_VERSION="`expr $CAIRO_VERSION : '\([0-9][0-9]*\).*'`"
766 CAIRO_MINOR_VERSION="`expr $CAIRO_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
767 CAIRO_DOTDOT_VERSION="`expr $CAIRO_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
768 if [[ $CAIRO_MAJOR_VERSION -gt 1 ||
769 $CAIRO_MINOR_VERSION -gt 12 ||
770 ($CAIRO_MINOR_VERSION -eq 12 && $CAIRO_DOTDOT_VERSION -ge 2) ]]
773 # Starting with Cairo 1.12.2, the tarballs are compressed with
774 # xz rather than gzip.
776 [ -f cairo-$CAIRO_VERSION.tar.xz ] || curl -O http://cairographics.org/releases/cairo-$CAIRO_VERSION.tar.xz || exit 1
777 xzcat cairo-$CAIRO_VERSION.tar.xz | tar xf - || exit 1
779 [ -f cairo-$CAIRO_VERSION.tar.gz ] || curl -O http://cairographics.org/releases/cairo-$CAIRO_VERSION.tar.gz || exit 1
780 gzcat cairo-$CAIRO_VERSION.tar.gz | tar xf - || exit 1
782 cd cairo-$CAIRO_VERSION
783 # CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-quartz=no || exit 1
784 # Maybe follow http://cairographics.org/end_to_end_build_for_mac_os_x/
785 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-quartz=yes || exit 1
787 # We must avoid the version of libpng that comes with X11; the
788 # only way I've found to force that is to forcibly set INCLUDES
789 # when we do the build, so that this comes before CAIRO_CFLAGS,
790 # which has -I/usr/X11/include added to it before anything
791 # connected to libpng is.
793 INCLUDES="-I/usr/local/include/libpng15" make $MAKE_BUILD_OPTS || exit 1
794 $DO_MAKE_INSTALL || exit 1
796 touch cairo-$CAIRO_VERSION-done
801 if [ ! -z "$installed_cairo_version" ] ; then
803 # GTK+ depends on this, so uninstall it.
807 echo "Uninstalling Cairo:"
808 cd cairo-$installed_cairo_version
809 $DO_MAKE_UNINSTALL || exit 1
810 make distclean || exit 1
812 rm cairo-$installed_cairo_version-done
814 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
816 # Get rid of the previously downloaded and unpacked version.
818 rm -rf cairo-$installed_cairo_version
819 rm -rf cairo-$installed_cairo_version.tar.xz cairo-$installed_cairo_version.tar.gz
822 installed_cairo_version=""
827 if [ ! -f atk-$ATK_VERSION-done ] ; then
828 echo "Downloading, building, and installing ATK:"
829 atk_dir=`expr $ATK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
830 ATK_MAJOR_VERSION="`expr $ATK_VERSION : '\([0-9][0-9]*\).*'`"
831 ATK_MINOR_VERSION="`expr $ATK_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
832 ATK_DOTDOT_VERSION="`expr $ATK_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
833 if [[ $ATK_MAJOR_VERSION -gt 2 ||
834 ($ATK_MAJOR_VERSION -eq 2 && $ATK_MINOR_VERSION -gt 0) ||
835 ($ATK_MANOR_VERSION -eq 2 && $ATK_MINOR_VERSION -eq 0 && $ATK_DOTDOT_VERSION -ge 1) ]]
838 # Starting with ATK 2.0.1, xz-compressed tarballs are available.
840 [ -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
841 xzcat atk-$ATK_VERSION.tar.xz | tar xf - || exit 1
843 [ -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
844 bzcat atk-$ATK_VERSION.tar.bz2 | tar xf - || exit 1
847 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
848 make $MAKE_BUILD_OPTS || exit 1
849 $DO_MAKE_INSTALL || exit 1
851 touch atk-$ATK_VERSION-done
856 if [ ! -z "$installed_atk_version" ] ; then
858 # GTK+ depends on this, so uninstall it.
862 echo "Uninstalling ATK:"
863 cd atk-$installed_atk_version
864 $DO_MAKE_UNINSTALL || exit 1
865 make distclean || exit 1
867 rm atk-$installed_atk_version-done
869 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
871 # Get rid of the previously downloaded and unpacked version.
873 rm -rf atk-$installed_atk_version
874 rm -rf atk-$installed_atk_version.tar.xz atk-$installed_atk_version.tar.bz2
877 installed_atk_version=""
882 if [ ! -f pango-$PANGO_VERSION-done ] ; then
883 echo "Downloading, building, and installing Pango:"
884 pango_dir=`expr $PANGO_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
885 PANGO_MAJOR_VERSION="`expr $PANGO_VERSION : '\([0-9][0-9]*\).*'`"
886 PANGO_MINOR_VERSION="`expr $PANGO_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
887 if [[ $PANGO_MAJOR_VERSION -gt 1 ||
888 $PANGO_MINOR_VERSION -ge 29 ]]
891 # Starting with Pango 1.29, the tarballs are compressed with
892 # xz rather than bzip2.
894 [ -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
895 xzcat pango-$PANGO_VERSION.tar.xz | tar xf - || exit 1
897 [ -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
898 bzcat pango-$PANGO_VERSION.tar.bz2 | tar xf - || exit 1
900 cd pango-$PANGO_VERSION
901 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
902 make $MAKE_BUILD_OPTS || exit 1
903 $DO_MAKE_INSTALL || exit 1
905 touch pango-$PANGO_VERSION-done
910 if [ ! -z "$installed_pango_version" ] ; then
912 # GTK+ depends on this, so uninstall it.
916 echo "Uninstalling Pango:"
917 cd pango-$installed_pango_version
918 $DO_MAKE_UNINSTALL || exit 1
919 make distclean || exit 1
921 rm pango-$installed_pango_version-done
923 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
925 # Get rid of the previously downloaded and unpacked version.
927 rm -rf pango-$installed_pango_version
928 rm -rf pango-$installed_pango_version.tar.xz pango-$installed_pango_version.tar.bz2
931 installed_pango_version=""
935 install_gdk_pixbuf() {
936 if [ "$GDK_PIXBUF_VERSION" -a ! -f gdk-pixbuf-$GDK_PIXBUF_VERSION-done ] ; then
937 echo "Downloading, building, and installing gdk-pixbuf:"
938 gdk_pixbuf_dir=`expr $GDK_PIXBUF_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
939 [ -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
940 xzcat gdk-pixbuf-$GDK_PIXBUF_VERSION.tar.xz | tar xf - || exit 1
941 cd gdk-pixbuf-$GDK_PIXBUF_VERSION
943 # If we're building using the 10.6 SDK, force the use of libpng12.
945 # The OS's X11, and corresponding SDK, didn't introduce libpng15,
946 # or pkg-config files, until 10.7, so, for 10.6 have to explicitly
947 # set LIBPNG to override the configure script, and also force the
948 # CFLAGS to look for the header files for libpng12 (note that
949 # -isysroot doesn't affect the arguments to -I, so we need to
950 # include the SDK path explicitly).
952 if [[ "$sdk_target" = 10.6 ]]
954 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
956 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
958 make $MAKE_BUILD_OPTS || exit 1
959 $DO_MAKE_INSTALL || exit 1
961 touch gdk-pixbuf-$GDK_PIXBUF_VERSION-done
965 uninstall_gdk_pixbuf() {
966 if [ ! -z "$installed_gdk_pixbuf_version" ] ; then
968 # GTK+ depends on this, so uninstall it.
972 echo "Uninstalling gdk-pixbuf:"
973 cd gdk-pixbuf-$installed_gdk_pixbuf_version
974 $DO_MAKE_UNINSTALL || exit 1
975 make distclean || exit 1
977 rm gdk-pixbuf-$installed_gdk_pixbuf_version-done
979 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
981 # Get rid of the previously downloaded and unpacked version.
983 rm -rf gdk-pixbuf-$installed_gdk_pixbuf_version
984 rm -rf gdk-pixbuf-$installed_gdk_pixbuf_version.tar.xz
987 installed_gdk_pixbuf_version=""
992 if [ ! -f gtk+-$GTK_VERSION-done ] ; then
993 echo "Downloading, building, and installing GTK+:"
994 gtk_dir=`expr $GTK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
995 if [[ $GTK_MAJOR_VERSION -gt 2 ||
996 $GTK_MINOR_VERSION -gt 24 ||
997 ($GTK_MINOR_VERSION -eq 24 && $GTK_DOTDOT_VERSION -ge 5) ]]
1000 # Starting with GTK+ 2.24.5, the tarballs are compressed with
1001 # xz rather than gzip, in addition to bzip2; use xz, as we've
1002 # built and installed it, and as xz compresses better than
1003 # bzip2 so the tarballs take less time to download.
1005 [ -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
1006 xzcat gtk+-$GTK_VERSION.tar.xz | tar xf - || exit 1
1008 [ -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
1009 bzcat gtk+-$GTK_VERSION.tar.bz2 | tar xf - || exit 1
1011 cd gtk+-$GTK_VERSION
1012 if [ $DARWIN_MAJOR_VERSION -ge "12" ]
1015 # GTK+ 2.24.10, at least, doesn't build on Mountain Lion with the
1016 # CUPS printing backend - either the CUPS API changed incompatibly
1017 # or the backend was depending on non-API implementation details.
1019 # Configure it out, on Mountain Lion and later, for now.
1020 # (12 is the Darwin major version number in Mountain Lion.)
1022 # Also, configure out libtiff and libjpeg; configure scripts
1023 # just ignore unknown --enable/--disable and --with/--without
1024 # options (at least they've always do so up to now).
1026 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
1028 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
1030 make $MAKE_BUILD_OPTS || exit 1
1031 $DO_MAKE_INSTALL || exit 1
1033 touch gtk+-$GTK_VERSION-done
1038 if [ ! -z "$installed_gtk_version" ] ; then
1039 echo "Uninstalling GTK+:"
1040 cd gtk+-$installed_gtk_version
1041 $DO_MAKE_UNINSTALL || exit 1
1042 make distclean || exit 1
1044 rm gtk+-$installed_gtk_version-done
1046 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1048 # Get rid of the previously downloaded and unpacked version.
1050 rm -rf gtk+-$installed_gtk_version
1051 rm -rf gtk+-$installed_gtk_version.tar.xz gtk+-$installed_gtk_version.tar.bz2
1054 installed_gtk_version=""
1059 if [ "$LIBSMI_VERSION" -a ! -f libsmi-$LIBSMI_VERSION-done ] ; then
1060 echo "Downloading, building, and installing libsmi:"
1061 [ -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
1062 gzcat libsmi-$LIBSMI_VERSION.tar.gz | tar xf - || exit 1
1063 cd libsmi-$LIBSMI_VERSION
1064 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1065 make $MAKE_BUILD_OPTS || exit 1
1066 $DO_MAKE_INSTALL || exit 1
1068 touch libsmi-$LIBSMI_VERSION-done
1072 uninstall_libsmi() {
1073 if [ ! -z "$installed_libsmi_version" ] ; then
1074 echo "Uninstalling libsmi:"
1075 cd libsmi-$installed_libsmi_version
1076 $DO_MAKE_UNINSTALL || exit 1
1077 make distclean || exit 1
1079 rm libsmi-$installed_libsmi_version-done
1081 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1083 # Get rid of the previously downloaded and unpacked version.
1085 rm -rf libsmi-$installed_libsmi_version
1086 rm -rf libsmi-$installed_libsmi_version.tar.gz
1089 installed_libsmi_version=""
1093 install_libgpg_error() {
1094 if [ "$LIBGPG_ERROR_VERSION" -a ! -f libgpg-error-$LIBGPG_ERROR_VERSION-done ] ; then
1095 echo "Downloading, building, and installing libgpg-error:"
1096 [ -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
1097 bzcat libgpg-error-$LIBGPG_ERROR_VERSION.tar.bz2 | tar xf - || exit 1
1098 cd libgpg-error-$LIBGPG_ERROR_VERSION
1099 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1100 make $MAKE_BUILD_OPTS || exit 1
1101 $DO_MAKE_INSTALL || exit 1
1103 touch libgpg-error-$LIBGPG_ERROR_VERSION-done
1107 uninstall_libgpg_error() {
1108 if [ ! -z "$installed_libgpg_error_version" ] ; then
1110 # libgcrypt depends on this, so uninstall it.
1112 uninstall_libgcrypt "$@"
1114 echo "Uninstalling libgpg-error:"
1115 cd libgpg-error-$installed_libgpg_error_version
1116 $DO_MAKE_UNINSTALL || exit 1
1117 make distclean || exit 1
1119 rm libgpg-error-$installed_libgpg_error_version-done
1121 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1123 # Get rid of the previously downloaded and unpacked version.
1125 rm -rf libgpg-error-$installed_libgpg_error_version
1126 rm -rf libgpg-error-$installed_libgpg_error_version.tar.bz2
1129 installed_libgpg_error_version=""
1133 install_libgcrypt() {
1134 if [ "$LIBGCRYPT_VERSION" -a ! -f libgcrypt-$LIBGCRYPT_VERSION-done ] ; then
1136 # libgpg-error is required for libgcrypt.
1138 if [ -z $LIBGPG_ERROR_VERSION ]
1140 echo "libgcrypt requires libgpg-error, but you didn't install libgpg-error." 1>&2
1144 echo "Downloading, building, and installing libgcrypt:"
1145 [ -f libgcrypt-$LIBGCRYPT_VERSION.tar.gz ] || curl -L -O ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-$LIBGCRYPT_VERSION.tar.gz || exit 1
1146 gzcat libgcrypt-$LIBGCRYPT_VERSION.tar.gz | tar xf - || exit 1
1147 cd libgcrypt-$LIBGCRYPT_VERSION
1149 # The assembler language code is not compatible with the OS X
1150 # x86 assembler (or is it an x86-64 vs. x86-32 issue?).
1152 # libgcrypt expects gnu89, not c99/gnu99, semantics for
1153 # "inline". See, for example:
1155 # http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2010-October/198809.html
1157 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
1158 make $MAKE_BUILD_OPTS || exit 1
1159 $DO_MAKE_INSTALL || exit 1
1161 touch libgcrypt-$LIBGCRYPT_VERSION-done
1165 uninstall_libgcrypt() {
1166 if [ ! -z "$installed_libgcrypt_version" ] ; then
1168 # GnuTLS depends on this, so uninstall it.
1170 uninstall_gnutls "$@"
1172 echo "Uninstalling libgcrypt:"
1173 cd libgcrypt-$installed_libgcrypt_version
1174 $DO_MAKE_UNINSTALL || exit 1
1175 make distclean || exit 1
1177 rm libgcrypt-$installed_libgcrypt_version-done
1179 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1181 # Get rid of the previously downloaded and unpacked version.
1183 rm -rf libgcrypt-$installed_libgcrypt_version
1184 rm -rf libgcrypt-$installed_libgcrypt_version.tar.gz
1187 installed_libgcrypt_version=""
1192 if [ "$GNUTLS_VERSION" -a ! -f gnutls-$GNUTLS_VERSION-done ] ; then
1194 # GnuTLS requires libgcrypt (or nettle, in newer versions).
1196 if [ -z $LIBGCRYPT_VERSION ]
1198 echo "GnuTLS requires libgcrypt, but you didn't install libgcrypt" 1>&2
1202 echo "Downloading, building, and installing GnuTLS:"
1203 [ -f gnutls-$GNUTLS_VERSION.tar.bz2 ] || curl -L -O http://ftp.gnu.org/gnu/gnutls/gnutls-$GNUTLS_VERSION.tar.bz2 || exit 1
1204 bzcat gnutls-$GNUTLS_VERSION.tar.bz2 | tar xf - || exit 1
1205 cd gnutls-$GNUTLS_VERSION
1207 # Use libgcrypt, not nettle.
1208 # XXX - is there some reason to prefer nettle? Or does
1209 # Wireshark directly use libgcrypt routines?
1211 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
1212 make $MAKE_BUILD_OPTS || exit 1
1214 # The pkgconfig file for GnuTLS says "requires zlib", but OS X,
1215 # while it supplies zlib, doesn't supply a pkgconfig file for
1218 # Patch the GnuTLS pkgconfig file not to require zlib.
1219 # (If the capabilities of GnuTLS that Wireshark uses don't
1220 # depend on building GnuTLS with zlib, an alternative would be
1221 # to configure it not to use zlib.)
1223 patch -p0 lib/gnutls.pc.in <../../macosx-support-lib-patches/gnutls-pkgconfig.patch || exit 1
1224 $DO_MAKE_INSTALL || exit 1
1226 touch gnutls-$GNUTLS_VERSION-done
1230 uninstall_gnutls() {
1231 if [ ! -z "$installed_gnutls_version" ] ; then
1232 echo "Uninstalling GnuTLS:"
1233 cd gnutls-$installed_gnutls_version
1234 $DO_MAKE_UNINSTALL || exit 1
1235 make distclean || exit 1
1237 rm gnutls-$installed_gnutls_version-done
1239 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1241 # Get rid of the previously downloaded and unpacked version.
1243 rm -rf gnutls-$installed_gnutls_version
1244 rm -rf gnutls-$installed_gnutls_version.tar.bz2
1247 installed_gnutls_version=""
1252 if [ "$LUA_VERSION" -a ! -f lua-$LUA_VERSION-done ] ; then
1253 echo "Downloading, building, and installing Lua:"
1254 [ -f lua-$LUA_VERSION.tar.gz ] || curl -L -O http://www.lua.org/ftp/lua-$LUA_VERSION.tar.gz || exit 1
1255 gzcat lua-$LUA_VERSION.tar.gz | tar xf - || exit 1
1257 make MYCFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" MYLDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" $MAKE_BUILD_OPTS macosx || exit 1
1258 $DO_MAKE_INSTALL || exit 1
1260 touch lua-$LUA_VERSION-done
1265 if [ ! -z "$installed_lua_version" ] ; then
1266 echo "Uninstalling Lua:"
1268 # Lua has no "make uninstall", so just remove stuff manually.
1269 # There's no configure script, so there's no need for
1270 # "make distclean", either; just do "make clean".
1272 (cd /usr/local/bin; $DO_RM -f lua luac)
1273 (cd /usr/local/include; $DO_RM -f lua.h luaconf.h lualib.h lauxlib.h lua.hpp)
1274 (cd /usr/local/lib; $DO_RM -f liblua.a)
1275 (cd /usr/local/man/man1; $DO_RM -f lua.1 luac.1)
1276 cd lua-$installed_lua_version
1277 make clean || exit 1
1279 rm lua-$installed_lua_version-done
1281 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1283 # Get rid of the previously downloaded and unpacked version.
1285 rm -rf lua-$installed_lua_version
1286 rm -rf lua-$installed_lua_version.tar.gz
1289 installed_lua_version=""
1293 install_portaudio() {
1295 # Check for both the old versionless portaudio-done and the new
1296 # versioned -done file.
1298 if [ "$PORTAUDIO_VERSION" -a ! -f portaudio-$PORTAUDIO_VERSION-done ] ; then
1299 echo "Downloading, building, and installing PortAudio:"
1300 [ -f $PORTAUDIO_VERSION.tgz ] || curl -L -O http://www.portaudio.com/archives/$PORTAUDIO_VERSION.tgz || exit 1
1301 gzcat $PORTAUDIO_VERSION.tgz | tar xf - || exit 1
1304 # Un-comment an include that's required on Lion.
1306 patch -p0 include/pa_mac_core.h <../../macosx-support-lib-patches/portaudio-pa_mac_core.h.patch
1308 # Fix a bug that showed up with clang (but is a bug with any
1311 patch -p0 src/hostapi/coreaudio/pa_mac_core.c <../../macosx-support-lib-patches/portaudio-pa_mac_core.c.patch
1313 # Disable fat builds - the configure script doesn't work right
1314 # with Xcode 4 if you leave them enabled, and we don't build
1315 # any other libraries fat (GLib, for example, would be very
1316 # hard to build fat), so there's no advantage to having PortAudio
1319 # Set the minimum OS X version to 10.4, to suppress some
1320 # deprecation warnings. (Good luck trying to make any of
1321 # this build on an OS+Xcode with a pre-10.4 SDK; we don't
1322 # worry about the user requesting that.)
1324 # Explicitly disable deprecation, so the damn thing will build
1325 # on El Capitan with Xcode 7.
1327 CFLAGS="$CFLAGS -Wno-deprecated-declarations -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
1328 make $MAKE_BUILD_OPTS || exit 1
1329 $DO_MAKE_INSTALL || exit 1
1331 touch portaudio-$PORTAUDIO_VERSION-done
1335 uninstall_portaudio() {
1336 if [ ! -z "$installed_portaudio_version" ] ; then
1337 echo "Uninstalling PortAudio:"
1339 $DO_MAKE_UNINSTALL || exit 1
1340 make distclean || exit 1
1342 rm portaudio-$installed_portaudio_version-done
1344 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1346 # Get rid of the previously downloaded and unpacked version.
1349 rm -rf $installed_portaudio_version.tgz
1352 installed_portaudio_version=""
1357 if [ "$GEOIP_VERSION" -a ! -f geoip-$GEOIP_VERSION-done ] ; then
1358 echo "Downloading, building, and installing GeoIP API:"
1359 [ -f GeoIP-$GEOIP_VERSION.tar.gz ] || curl -L -O http://geolite.maxmind.com/download/geoip/api/c/GeoIP-$GEOIP_VERSION.tar.gz || exit 1
1360 gzcat GeoIP-$GEOIP_VERSION.tar.gz | tar xf - || exit 1
1361 cd GeoIP-$GEOIP_VERSION
1362 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1364 # Grr. Their man pages "helpfully" have an ISO 8859-1
1365 # copyright symbol in the copyright notice, but OS X's
1366 # default character encoding is UTF-8. sed on Mountain
1367 # Lion barfs at the "illegal character sequence" represented
1368 # by an ISO 8859-1 copyright symbol, as it's not a valid
1371 # iconv the relevant man pages into UTF-8.
1373 for i in geoipupdate.1.in geoiplookup6.1.in geoiplookup.1.in
1375 iconv -f iso8859-1 -t utf-8 man/"$i" >man/"$i".tmp &&
1376 mv man/"$i".tmp man/"$i"
1378 make $MAKE_BUILD_OPTS || exit 1
1379 $DO_MAKE_INSTALL || exit 1
1381 touch geoip-$GEOIP_VERSION-done
1386 if [ ! -z "$installed_geoip_version" ] ; then
1387 echo "Uninstalling GeoIP API:"
1388 cd GeoIP-$installed_geoip_version
1389 $DO_MAKE_UNINSTALL || exit 1
1390 make distclean || exit 1
1392 rm geoip-$installed_geoip_version-done
1394 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1396 # Get rid of the previously downloaded and unpacked version.
1398 rm -rf GeoIP-$installed_geoip_version
1399 rm -rf GeoIP-$installed_geoip_version.tar.gz
1402 installed_geoip_version=""
1407 if [ "$CARES_VERSION" -a ! -f c-ares-$CARES_VERSION-done ] ; then
1408 echo "Downloading, building, and installing C-Ares API:"
1409 [ -f c-ares-$CARES_VERSION.tar.gz ] || curl -L -O http://c-ares.haxx.se/download/c-ares-$CARES_VERSION.tar.gz || exit 1
1410 gzcat c-ares-$CARES_VERSION.tar.gz | tar xf - || exit 1
1411 cd c-ares-$CARES_VERSION
1412 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1413 make $MAKE_BUILD_OPTS || exit 1
1414 $DO_MAKE_INSTALL || exit 1
1416 touch c-ares-$CARES_VERSION-done
1420 uninstall_c_ares() {
1421 if [ ! -z "$installed_cares_version" ] ; then
1422 echo "Uninstalling C-Ares API:"
1423 cd c-ares-$installed_cares_version
1424 $DO_MAKE_UNINSTALL || exit 1
1425 make distclean || exit 1
1427 rm c-ares-$installed_cares_version-done
1429 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1431 # Get rid of the previously downloaded and unpacked version.
1433 rm -rf c-ares-$installed_cares_version
1434 rm -rf c-ares-$installed_cares_version.tar.gz
1437 installed_cares_version=""
1442 if [ "$LIBSSH_VERSION" -a ! -f libssh-$LIBSSH_VERSION-done ] ; then
1443 echo "Downloading, building, and installing libssh:"
1444 [ -f libssh-$LIBSSH_VERSION.tar.xz ] || curl -L -O https://red.libssh.org/attachments/download/177/libssh-$LIBSSH_VERSION.tar.xz || exit 1
1445 xzcat libssh-$LIBSSH_VERSION.tar.xz | tar xf - || exit 1
1446 cd libssh-$LIBSSH_VERSION
1449 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" cmake -DWITH_GCRYPT=1 ../ || exit 1
1450 make $MAKE_BUILD_OPTS || exit 1
1451 $DO_MAKE_INSTALL || exit 1
1453 touch libssh-$LIBSSH_VERSION-done
1457 uninstall_libssh() {
1458 if [ ! -z "$installed_libssh_version" ] ; then
1459 echo "Uninstalling libssh:"
1460 cd libssh-$installed_libssh_version
1461 $DO_MAKE_UNINSTALL || exit 1
1462 make distclean || exit 1
1464 rm libssh-$installed_libssh_version-done
1466 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1468 # Get rid of the previously downloaded and unpacked version.
1470 rm -rf libssh-$installed_libssh_version
1471 rm -rf libssh-$installed_libssh_version.tar.xz
1474 installed_libssh_version=""
1480 # Check whether the versions we have installed are the versions
1481 # requested; if not, uninstall the installed versions.
1483 if [ ! -z "$installed_libssh_version" -a \
1484 "$installed_libssh_version" != "$LIBSSH_VERSION" ] ; then
1485 echo "Installed libssh version is $installed_libssh_version"
1486 if [ -z "$LIBSSH_VERSION" ] ; then
1487 echo "libssh is not requested"
1489 echo "Requested libssh version is $LIBSSH_VERSION"
1494 if [ ! -z "$installed_cares_version" -a \
1495 "$installed_cares_version" != "$CARES_VERSION" ] ; then
1496 echo "Installed C-Ares version is $installed_cares_version"
1497 if [ -z "$CARES_VERSION" ] ; then
1498 echo "C-Ares is not requested"
1500 echo "Requested C-Ares version is $CARES_VERSION"
1505 if [ ! -z "$installed_geoip_version" -a \
1506 "$installed_geoip_version" != "$GEOIP_VERSION" ] ; then
1507 echo "Installed GeoIP API version is $installed_geoip_version"
1508 if [ -z "$GEOIP_VERSION" ] ; then
1509 echo "GeoIP is not requested"
1511 echo "Requested GeoIP version is $GEOIP_VERSION"
1516 if [ ! -z "$installed_portaudio_version" -a \
1517 "$installed_portaudio_version" != "$PORTAUDIO_VERSION" ] ; then
1518 echo "Installed PortAudio version is $installed_portaudio_version"
1519 if [ -z "$PORTAUDIO_VERSION" ] ; then
1520 echo "PortAudio is not requested"
1522 echo "Requested PortAudio version is $PORTAUDIO_VERSION"
1524 uninstall_portaudio -r
1527 if [ ! -z "$installed_lua_version" -a \
1528 "$installed_lua_version" != "$LUA_VERSION" ] ; then
1529 echo "Installed Lua version is $installed_lua_version"
1530 if [ -z "$LUA_VERSION" ] ; then
1531 echo "Lua is not requested"
1533 echo "Requested Lua version is $LUA_VERSION"
1538 if [ ! -z "$installed_gnutls_version" -a \
1539 "$installed_gnutls_version" != "$GNUTLS_VERSION" ] ; then
1540 echo "Installed GnuTLS version is $installed_gnutls_version"
1541 if [ -z "$GNUTLS_VERSION" ] ; then
1542 echo "GnuTLS is not requested"
1544 echo "Requested GnuTLS version is $GNUTLS_VERSION"
1549 if [ ! -z "$installed_libgcrypt_version" -a \
1550 "$installed_libgcrypt_version" != "$LIBGCRYPT_VERSION" ] ; then
1551 echo "Installed libgcrypt version is $installed_libgcrypt_version"
1552 if [ -z "$LIBGCRYPT_VERSION" ] ; then
1553 echo "libgcrypt is not requested"
1555 echo "Requested libgcrypt version is $LIBGCRYPT_VERSION"
1557 uninstall_libgcrypt -r
1560 if [ ! -z "$installed_libgpg_error_version" -a \
1561 "$installed_libgpg_error_version" != "$LIBGPG_ERROR_VERSION" ] ; then
1562 echo "Installed libgpg-error version is $installed_libgpg_error_version"
1563 if [ -z "$LIBGPG_ERROR_VERSION" ] ; then
1564 echo "libgpg-error is not requested"
1566 echo "Requested libgpg-error version is $LIBGPG_ERROR_VERSION"
1568 uninstall_libgpg_error -r
1571 if [ ! -z "$installed_libsmi_version" -a \
1572 "$installed_libsmi_version" != "$LIBSMI_VERSION" ] ; then
1573 echo "Installed libsmi version is $installed_libsmi_version"
1574 if [ -z "$LIBSMI_VERSION" ] ; then
1575 echo "libsmi is not requested"
1577 echo "Requested libsmi version is $LIBSMI_VERSION"
1582 if [ ! -z "$installed_gtk_version" -a \
1583 "$installed_gtk_version" != "$GTK_VERSION" ] ; then
1584 echo "Installed GTK+ version is $installed_gtk_version"
1585 if [ -z "$GTK_VERSION" ] ; then
1586 echo "GTK+ is not requested"
1588 echo "Requested GTK+ version is $GTK_VERSION"
1593 if [ ! -z "$installed_gdk_pixbuf_version" -a \
1594 "$installed_gdk_pixbuf_version" != "$GDK_PIXBUF_VERSION" ] ; then
1595 echo "Installed gdk-pixbuf version is $installed_gdk_pixbuf_version"
1596 if [ -z "$GDK_PIXBUF_VERSION" ] ; then
1597 echo "gdk-pixbuf is not requested"
1599 echo "Requested gdk-pixbuf version is $GDK_PIXBUF_VERSION"
1601 uninstall_gdk_pixbuf -r
1604 if [ ! -z "$installed_pango_version" -a \
1605 "$installed_pango_version" != "$PANGO_VERSION" ] ; then
1606 echo "Installed Pango version is $installed_pango_version"
1607 if [ -z "$PANGO_VERSION" ] ; then
1608 echo "Pango is not requested"
1610 echo "Requested Pango version is $PANGO_VERSION"
1615 if [ ! -z "$installed_atk_version" -a \
1616 "$installed_atk_version" != "$ATK_VERSION" ] ; then
1617 echo "Installed ATK version is $installed_atk_version"
1618 if [ -z "$ATK_VERSION" ] ; then
1619 echo "ATK is not requested"
1621 echo "Requested ATK version is $ATK_VERSION"
1626 if [ ! -z "$installed_cairo_version" -a \
1627 "$installed_cairo_version" != "$CAIRO_VERSION" ] ; then
1628 echo "Installed Cairo version is $installed_cairo_version"
1629 if [ -z "$CAIRO_VERSION" ] ; then
1630 echo "Cairo is not requested"
1632 echo "Requested Cairo version is $CAIRO_VERSION"
1637 if [ ! -z "$installed_pixman_version" -a \
1638 "$installed_pixman_version" != "$PIXMAN_VERSION" ] ; then
1639 echo "Installed pixman version is $installed_pixman_version"
1640 if [ -z "$PIXMAN_VERSION" ] ; then
1641 echo "pixman is not requested"
1643 echo "Requested pixman version is $PIXMAN_VERSION"
1648 if [ ! -z "$installed_libpng_version" -a \
1649 "$installed_libpng_version" != "$PNG_VERSION" ] ; then
1650 echo "Installed libpng version is $installed_libpng_version"
1651 if [ -z "$PNG_VERSION" ] ; then
1652 echo "libpng is not requested"
1654 echo "Requested libpng version is $PNG_VERSION"
1659 if [ ! -z "$installed_qt_version" -a \
1660 "$installed_qt_version" != "$QT_VERSION" ] ; then
1661 echo "Installed Qt version is $installed_qt_version"
1662 if [ -z "$QT_VERSION" ] ; then
1663 echo "Qt is not requested"
1665 echo "Requested Qt version is $QT_VERSION"
1670 if [ ! -z "$installed_glib_version" -a \
1671 "$installed_glib_version" != "$GLIB_VERSION" ] ; then
1672 echo "Installed GLib version is $installed_glib_version"
1673 if [ -z "$GLIB_VERSION" ] ; then
1674 echo "GLib is not requested"
1676 echo "Requested GLib version is $GLIB_VERSION"
1681 if [ ! -z "$installed_pkg_config_version" -a \
1682 "$installed_pkg_config_version" != "$PKG_CONFIG_VERSION" ] ; then
1683 echo "Installed pkg-config version is $installed_pkg_config_version"
1684 if [ -z "$PKG_CONFIG_VERSION" ] ; then
1685 echo "pkg-config is not requested"
1687 echo "Requested pkg-config version is $PKG_CONFIG_VERSION"
1689 uninstall_pkg_config -r
1692 if [ ! -z "$installed_gettext_version" -a \
1693 "$installed_gettext_version" != "$GETTEXT_VERSION" ] ; then
1694 echo "Installed GNU gettext version is $installed_gettext_version"
1695 if [ -z "$GETTEXT_VERSION" ] ; then
1696 echo "GNU gettext is not requested"
1698 echo "Requested GNU gettext version is $GETTEXT_VERSION"
1700 uninstall_gettext -r
1703 if [ ! -z "$installed_cmake_version" -a \
1704 "$installed_cmake_version" != "$CMAKE_VERSION" ] ; then
1705 echo "Installed CMake version is $installed_cmake_version"
1706 if [ -z "$CMAKE_VERSION" ] ; then
1707 echo "CMake is not requested"
1709 echo "Requested CMake version is $CMAKE_VERSION"
1712 # XXX - really remove this?
1713 # Or should we remember it as installed only if this script
1719 if [ ! -z "$installed_libtool_version" -a \
1720 "$installed_libtool_version" != "$LIBTOOL_VERSION" ] ; then
1721 echo "Installed GNU libtool version is $installed_libtool_version"
1722 if [ -z "$LIBTOOL_VERSION" ] ; then
1723 echo "GNU libtool is not requested"
1725 echo "Requested GNU libtool version is $LIBTOOL_VERSION"
1727 uninstall_libtool -r
1730 if [ ! -z "$installed_automake_version" -a \
1731 "$installed_automake_version" != "$AUTOMAKE_VERSION" ] ; then
1732 echo "Installed GNU automake version is $installed_automake_version"
1733 if [ -z "$AUTOMAKE_VERSION" ] ; then
1734 echo "GNU automake is not requested"
1736 echo "Requested GNU automake version is $AUTOMAKE_VERSION"
1738 uninstall_automake -r
1741 if [ ! -z "$installed_autoconf_version" -a \
1742 "$installed_autoconf_version" != "$AUTOCONF_VERSION" ] ; then
1743 echo "Installed GNU autoconf version is $installed_autoconf_version"
1744 if [ -z "$AUTOCONF_VERSION" ] ; then
1745 echo "GNU autoconf is not requested"
1747 echo "Requested GNU autoconf version is $AUTOCONF_VERSION"
1749 uninstall_autoconf -r
1752 if [ ! -z "$installed_xz_version" -a \
1753 "$installed_xz_version" != "$XZ_VERSION" ] ; then
1754 echo "Installed xz version is $installed_xz_version"
1755 if [ -z "$XZ_VERSION" ] ; then
1756 echo "xz is not requested"
1758 echo "Requested xz version is $XZ_VERSION"
1764 # Start with xz: It is the sole download format of glib later than 2.31.2
1777 # Start with GNU gettext; GLib requires it, and OS X doesn't have it
1778 # or a BSD-licensed replacement.
1780 # At least on Lion with Xcode 4, _FORTIFY_SOURCE gets defined as 2
1781 # by default, which causes, for example, stpncpy to be defined as
1782 # a hairy macro that collides with the GNU gettext configure script's
1783 # attempts to workaround AIX's lack of a declaration for stpncpy,
1784 # with the result being a huge train wreck. Define _FORTIFY_SOURCE
1785 # as 0 in an attempt to keep the trains on separate tracks.
1790 # GLib depends on pkg-config.
1791 # By default, pkg-config depends on GLib; we break the dependency cycle
1792 # by configuring pkg-config to use its own internal version of GLib.
1799 # Now we have reached a point where we can build everything but
1800 # the GUI (Wireshark).
1804 if [ "$GTK_VERSION" ]; then
1806 # GTK+ 3 requires a newer Cairo build than the one that comes with
1807 # 10.6, so we build Cairo if we are using GTK+ 3.
1809 # In 10.6 and 10.7, it's an X11 library; if we build with "native" GTK+
1810 # rather than X11 GTK+, we might have to build and install Cairo.
1811 # In 10.8 and later, there is no X11, but it's included in Xquartz;
1812 # again, if we build with "native" GTK+, we'd have to build and install
1815 if [[ "$GTK_MAJOR_VERSION" -eq 3 || "$cairo_not_in_the_os" = yes ]]; then
1817 # Requirements for Cairo first
1819 # The libpng that comes with the X11 for Leopard has a bogus
1820 # pkg-config file that lies about where the header files are,
1821 # which causes other packages not to be able to find its
1824 # The libpng in later versions is not what the version of
1825 # libpixman we build below wants - it wants libpng15.
1830 # The libpixman versions that come with the X11s for Leopard,
1831 # Snow Leopard, and Lion is too old to support Cairo's image
1832 # surface backend feature (which requires pixman-1 >= 0.22.0).
1834 # XXX - what about the one that comes with the latest version
1840 # And now Cairo itself.
1841 # XXX - with the libxcb that comes with 10.6,
1842 # xcb_discard_reply() is missing, and the build fails.
1857 # Now we have reached a point where we can build everything including
1858 # the GUI (Wireshark), but not with any optional features such as
1859 # SNMP OID resolution, some forms of decryption, Lua scripting, playback
1860 # of audio, or GeoIP mapping of IP addresses.
1862 # We now conditionally download optional libraries to support them;
1863 # the default is to download them all.
1868 install_libgpg_error
1886 if [ -d macosx-support-libs ]
1888 cd macosx-support-libs
1891 # Uninstall items in the reverse order from the order in which they're
1892 # installed. Only uninstall if the download/build/install process
1893 # completed; uninstall the version that appears in the name of
1896 # We also do a "make distclean", so that we don't have leftovers from
1897 # old configurations.
1913 uninstall_libgpg_error
1919 uninstall_gdk_pixbuf
1935 uninstall_pkg_config
1940 # XXX - really remove this?
1941 # Or should we remember it as installed only if this script
1957 # Do we have permission to write in /usr/local?
1959 # If so, assume we have permission to write in its subdirectories.
1960 # (If that's not the case, this test needs to check the subdirectories
1963 # If not, do "make install", "make uninstall", the removes for Lua,
1964 # and the renames of [g]libtool* with sudo.
1966 if [ -w /usr/local ]
1968 DO_MAKE_INSTALL="make install"
1969 DO_MAKE_UNINSTALL="make uninstall"
1973 DO_MAKE_INSTALL="sudo make install"
1974 DO_MAKE_UNINSTALL="sudo make uninstall"
1980 # If we have SDKs available, the default target OS is the major version
1981 # of the one we're running; get that and strip off the third component
1984 for i in /Developer/SDKs \
1985 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
1986 /Library/Developer/CommandLineTools/SDKs
1990 min_osx_target=`sw_vers -productVersion | sed 's/\([0-9]*\)\.\([0-9]*\)\.[0-9]*/\1.\2/'`
1993 # That's also the OS whose SDK we'd be using.
1995 sdk_target=$min_osx_target
2001 # Parse command-line flags:
2004 # -t <target> - build libraries so that they'll work on the specified
2005 # version of OS X and later versions.
2006 # -u - do an uninstall.
2008 while getopts ht:u name
2015 min_osx_target="$OPTARG"
2018 echo "Usage: macosx-setup.sh [ -t <target> ] [ -u ]" 1>&1
2025 # Get the version numbers of installed packages, if any.
2027 if [ -d macosx-support-libs ]
2029 cd macosx-support-libs
2031 installed_xz_version=`ls xz-*-done 2>/dev/null | sed 's/xz-\(.*\)-done/\1/'`
2032 installed_autoconf_version=`ls autoconf-*-done 2>/dev/null | sed 's/autoconf-\(.*\)-done/\1/'`
2033 installed_automake_version=`ls automake-*-done 2>/dev/null | sed 's/automake-\(.*\)-done/\1/'`
2034 installed_libtool_version=`ls libtool-*-done 2>/dev/null | sed 's/libtool-\(.*\)-done/\1/'`
2035 installed_cmake_version=`ls cmake-*-done 2>/dev/null | sed 's/cmake-\(.*\)-done/\1/'`
2036 installed_gettext_version=`ls gettext-*-done 2>/dev/null | sed 's/gettext-\(.*\)-done/\1/'`
2037 installed_pkg_config_version=`ls pkg-config-*-done 2>/dev/null | sed 's/pkg-config-\(.*\)-done/\1/'`
2038 installed_glib_version=`ls glib-*-done 2>/dev/null | sed 's/glib-\(.*\)-done/\1/'`
2039 installed_qt_version=`ls qt-*-done 2>/dev/null | sed 's/qt-\(.*\)-done/\1/'`
2040 installed_libpng_version=`ls libpng-*-done 2>/dev/null | sed 's/libpng-\(.*\)-done/\1/'`
2041 installed_pixman_version=`ls pixman-*-done 2>/dev/null | sed 's/pixman-\(.*\)-done/\1/'`
2042 installed_cairo_version=`ls cairo-*-done 2>/dev/null | sed 's/cairo-\(.*\)-done/\1/'`
2043 installed_atk_version=`ls atk-*-done 2>/dev/null | sed 's/atk-\(.*\)-done/\1/'`
2044 installed_pango_version=`ls pango-*-done 2>/dev/null | sed 's/pango-\(.*\)-done/\1/'`
2045 installed_gdk_pixbuf_version=`ls gdk-pixbuf-*-done 2>/dev/null | sed 's/gdk-pixbuf-\(.*\)-done/\1/'`
2046 installed_gtk_version=`ls gtk+-*-done 2>/dev/null | sed 's/gtk+-\(.*\)-done/\1/'`
2047 installed_libsmi_version=`ls libsmi-*-done 2>/dev/null | sed 's/libsmi-\(.*\)-done/\1/'`
2048 installed_libgpg_error_version=`ls libgpg-error-*-done 2>/dev/null | sed 's/libgpg-error-\(.*\)-done/\1/'`
2049 installed_libgcrypt_version=`ls libgcrypt-*-done 2>/dev/null | sed 's/libgcrypt-\(.*\)-done/\1/'`
2050 installed_gnutls_version=`ls gnutls-*-done 2>/dev/null | sed 's/gnutls-\(.*\)-done/\1/'`
2051 installed_lua_version=`ls lua-*-done 2>/dev/null | sed 's/lua-\(.*\)-done/\1/'`
2052 installed_portaudio_version=`ls portaudio-*-done 2>/dev/null | sed 's/portaudio-\(.*\)-done/\1/'`
2053 installed_geoip_version=`ls geoip-*-done 2>/dev/null | sed 's/geoip-\(.*\)-done/\1/'`
2054 installed_cares_version=`ls c-ares-*-done 2>/dev/null | sed 's/c-ares-\(.*\)-done/\1/'`
2055 installed_libssh_version=`ls libssh-*-done 2>/dev/null | sed 's/libssh-\(.*\)-done/\1/'`
2058 # If we don't have a versioned -done file for portaudio, but do have
2059 # an unversioned -done file for it, assume the installed version is the
2060 # requested version, and rename the -done file to include that version.
2062 if [ -z "$installed_portaudio_version" -a -f portaudio-done ] ; then
2063 mv portaudio-done portaudio-$PORTAUDIO_VERSION-done
2064 installed_portaudio_version=`ls portaudio-*-done 2>/dev/null | sed 's/portaudio-\(.*\)-done/\1/'`
2070 if [ "$do_uninstall" = "yes" ]
2077 # Configure scripts tend to set CFLAGS and CXXFLAGS to "-g -O2" if
2078 # invoked without CFLAGS or CXXFLAGS being set in the environment.
2080 # However, we *are* setting them in the environment, for our own
2081 # nefarious purposes, so start them out as "-g -O2".
2087 # To make this work on Leopard (rather than working *on* Snow Leopard
2088 # when building *for* Leopard) will take more work.
2090 # For one thing, Leopard's /usr/X11/lib/libXdamage.la claims, at least
2091 # with all software updates applied, that the Xdamage shared library
2092 # is libXdamage.1.0.0.dylib, but it is, in fact, libXdamage.1.1.0.dylib.
2093 # This causes problems when building GTK+, so the script would have to
2096 if [[ $DARWIN_MAJOR_VERSION -le 9 ]]; then
2097 echo "This script does not support any versions of OS X before Snow Leopard" 1>&2
2101 # if no make options are present, set default options
2102 if [ -z "$MAKE_BUILD_OPTS" ] ; then
2103 # by default use 1.5x number of cores for parallel build
2104 MAKE_BUILD_OPTS="-j $(( $(sysctl -n hw.logicalcpu) * 3 / 2))"
2108 # If we have a target release, look for the oldest SDK that's for an
2109 # OS equal to or later than that one, and build libraries against it
2110 # rather than against the headers and, more importantly, libraries
2111 # that come with the OS, so that we don't end up with support libraries
2112 # that only work on the OS version on which we built them, not earlier
2113 # versions of the same release, or earlier releases if the minimum is
2116 if [ ! -z "$min_osx_target" ]
2119 # Get the real version - strip off the "10.".
2120 # We'll worry about that if, as, and when there's ever
2123 deploy_real_version=`echo "$min_osx_target" | sed -n 's/10\.\(.*\)/\1/p'`
2126 # Search each directory that might contain SDKs.
2129 for sdksdir in /Developer/SDKs \
2130 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
2131 /Library/Developer/CommandLineTools/SDKs
2134 # Get a list of all the SDKs.
2136 if ! test -d "$sdksdir"
2139 # There is no directory with that name.
2140 # Move on to the next one in the list, if any.
2146 # Get a list of all the SDKs in that directory, if any.
2148 sdklist=`(cd "$sdksdir"; ls -d MacOSX10.[0-9]*.sdk 2>/dev/null)`
2153 # Get the real version for this SDK.
2155 sdk_real_version=`echo "$sdk" | sed -n 's/MacOSX10\.\(.*\)\.sdk/\1/p'`
2158 # Is it for the deployment target or some later release?
2160 if test "$sdk_real_version" -ge "$deploy_real_version"
2165 sdkpath="$sdksdir/$sdk"
2166 qt_sdk_arg="-sdk $sdk"
2172 if [ -z "$sdkpath" ]
2174 echo "macosx-setup.sh: Couldn't find an SDK for OS X $min_osx_target or later" 1>&2
2179 sdk_target=10.$sdk_real_version
2180 echo "Using the 10.$sdk_real_version SDK"
2183 # Make sure there are links to /usr/local/include and /usr/local/lib
2184 # in the SDK's usr/local.
2186 if [ ! -e $SDKPATH/usr/local/include ]
2188 if [ ! -d $SDKPATH/usr/local ]
2190 sudo mkdir $SDKPATH/usr/local
2192 sudo ln -s /usr/local/include $SDKPATH/usr/local/include
2194 if [ ! -e $SDKPATH/usr/local/lib ]
2196 if [ ! -d $SDKPATH/usr/local ]
2198 sudo mkdir $SDKPATH/usr/local
2200 sudo ln -s /usr/local/lib $SDKPATH/usr/local/lib
2204 # Set the minimum OS version for which to build to the specified
2205 # minimum target OS version, so we don't, for example, end up using
2206 # linker features supported by the OS verson on which we're building
2207 # but not by the target version.
2209 VERSION_MIN_FLAGS="-mmacosx-version-min=$min_osx_target"
2212 # Compile and link against the SDK.
2214 SDKFLAGS="-isysroot $SDKPATH"
2216 if [[ "$min_osx_target" == "10.5" ]]
2219 # Cairo is part of Mac OS X 10.6 and later.
2220 # The *headers* are supplied by 10.5, but the *libraries*
2221 # aren't, so we have to build it if we're building for 10.5.
2223 cairo_not_in_the_os=yes
2226 # Build with older versions of the support libraries, as
2227 # were used on the Wireshark Leopard buildbot at one
2228 # point. (Most of these versions come from the About page
2229 # from Wireshark 1.8.6, the last build done on that buildbot;
2230 # the ATK version isn't reported, so this is a guess.)
2232 # If you want to try building with newer versions of
2233 # the libraries, note that:
2235 # The version of fontconfig that comes with Leopard doesn't
2236 # support FC_WEIGHT_EXTRABLACK, so we can't use any version
2237 # of Pango newer than 1.22.4.
2239 # However, Pango 1.22.4 doesn't work with versions of GLib
2240 # after 2.29.6, because Pango 1.22.4 uses G_CONST_RETURN and
2241 # GLib 2.29.8 and later deprecate it (there doesn't appear to
2242 # be a GLib 2.29.7). That means we'd either have to patch
2243 # Pango not to use it (just use "const"; G_CONST_RETURN was
2244 # there to allow code to choose whether to use "const" or not),
2245 # or use GLib 2.29.6 or earlier.
2247 # GLib 2.29.6 includes an implementation of g_bit_lock() that,
2248 # on x86 (32-bit and 64-bit), uses asms in a fashion
2249 # ("asm volatile goto") that requires GCC 4.5 or later, which
2250 # is later than the compilers that come with Leopard and Snow
2251 # Leopard. Recent versions of GLib check for that, but 2.29.6
2252 # doesn't, so, if you want to build GLib 2.29.6 on Leopard or
2253 # Snow Leopard, you would have to patch glib/gbitlock.c to do
2254 # what the newer versions of GLib do:
2256 # define a USE_ASM_GOTO macro that indicates whether "asm goto"
2258 # #if (defined (i386) || defined (__amd64__))
2259 # #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
2260 # #define USE_ASM_GOTO 1
2264 # replace all occurrences of
2266 # #if defined (__GNUC__) && (defined (i386) || defined (__amd64__))
2270 # #ifdef USE_ASM_GOTO
2272 # Using GLib 2.29.6 or earlier, however, means that we can't
2273 # use a version of ATK later than 2.3.93, as those versions
2274 # don't work with GLib 2.29.6. The same applies to gdk-pixbuf;
2275 # versions of gdk-pixbuf after 2.24.1 won't work with GLib
2278 # Then you have to make sure that what you've build doesn't
2279 # cause the X server that comes with Leopard to crash; at
2280 # least one attempt at building for Leopard did.
2282 # At least if building on Leopard, you might also find
2283 # that, with various older versions of Cairo, including
2284 # 1.6.4 and at least some 1.8.x versions, when you try to
2285 # build it, the build fails because it can't find
2286 # png_set_longjmp_fn(). I vaguely remember dealing with that,
2287 # ages ago, but don't remember what I did.
2290 if [ "$CAIRO_VERSION" ]
2294 if [ "$ATK_VERSION" ]
2298 if [ "$PANGO_VERSION" ]
2300 PANGO_VERSION=1.20.2
2302 if [ "$GTK_VERSION" ]
2308 # That version of GTK+ includes gdk-pixbuf.
2309 # XXX - base this on the version of GTK+ requested.
2314 # Libgcrypt 1.5.0 fails to compile due to some problem with an
2315 # asm in rijndael.c, at least with i686-apple-darwin10-gcc-4.2.1
2316 # (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) when building
2319 # We try libgcrypt 1.4.3 instead, as that's what shows up in
2320 # the version from the Leopard buildbot.
2321 LIBGCRYPT_VERSION=1.4.3
2324 # Build 32-bit while we're at it; Leopard has a bug that
2325 # causes some BPF functions not to work with 64-bit userland
2326 # code, so capturing won't work.
2328 CFLAGS="$CFLAGS -arch i386"
2329 CXXFLAGS="$CXXFLAGS -arch i386"
2330 export LDFLAGS="$LDFLAGS -arch i386"
2338 # You need Xcode or the command-line tools installed to get the compilers.
2340 if [ ! -x /usr/bin/xcodebuild ]; then
2341 echo "Please install Xcode first (should be available on DVD or from http://developer.apple.com/xcode/index.php)."
2345 if [ "$QT_VERSION" ]; then
2347 # We need Xcode, not just the command-line tools, installed to build
2350 if ! /usr/bin/xcrun -find xcrun >/dev/null 2>&1; then
2351 echo "Please install Xcode first (should be available on DVD or from http://developer.apple.com/xcode/index.php)."
2352 echo "The command-line build tools are not sufficient to build Qt."
2356 if [ "$GTK_VERSION" ]; then
2358 # If we're building with GTK+, you also need the X11 SDK; with at least
2359 # some versions of OS X and Xcode, that is, I think, an optional install.
2360 # (Or it might be installed with X11, but I think *that* is an optional
2361 # install on at least some versions of OS X.)
2363 if [ ! -d /usr/X11/include ]; then
2364 echo "Please install X11 and the X11 SDK first."
2365 echo " You can either use http://xquartz.macosforge.org/, e.g."
2366 echo " http://xquartz-dl.macosforge.org/SL/XQuartz-$XQUARTZ_VERSION.dmg"
2367 echo " or the native Apple packages if you are on Lion or below."
2372 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig
2375 # Do all the downloads and untarring in a subdirectory, so all that
2376 # stuff can be removed once we've installed the support libraries.
2378 if [ ! -d macosx-support-libs ]
2380 mkdir macosx-support-libs || exit 1
2382 cd macosx-support-libs
2389 # Indicate what paths to use for pkg-config and cmake.
2391 pkg_config_path=/usr/local/lib/pkgconfig
2392 if [ "$QT_VERSION" ]; then
2393 qt_base_path=$HOME/Qt$QT_VERSION/$QT_MAJOR_MINOR_VERSION/clang_64
2394 pkg_config_path="$pkg_config_path":"$qt_base_path/lib/pkgconfig"
2395 CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH":"$qt_base_path/lib/cmake"
2397 pkg_config_path="$pkg_config_path":/usr/X11/lib/pkgconfig
2399 echo "You are now prepared to build Wireshark."
2401 if [[ $CMAKE ]]; then
2402 echo "To build with CMAKE:"
2404 echo "export PKG_CONFIG_PATH=$pkg_config_path"
2405 echo "export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH"
2406 echo "export PATH=$PATH:$qt_base_path/bin"
2408 echo "mkdir build; cd build"
2410 echo "make $MAKE_BUILD_OPTS app_bundle"
2411 echo "make install/strip"
2414 if [[ $AUTOTOOLS ]]; then
2415 echo "To build with AUTOTOOLS:"
2417 echo "export PKG_CONFIG_PATH=$pkg_config_path"
2420 echo "mkdir build; cd build"
2422 echo "make $MAKE_BUILD_OPTS"
2426 echo "Make sure you are allowed capture access to the network devices"
2427 echo "See: https://wiki.wireshark.org/CaptureSetup/CapturePrivileges"