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
110 # The following libraries are optional.
111 # Comment them out if you don't want them, but note that some of
112 # the optional libraries are required by other optional libraries.
116 # libgpg-error is required for libgcrypt.
118 LIBGPG_ERROR_VERSION=1.10
120 # libgcrypt is required for GnuTLS.
122 LIBGCRYPT_VERSION=1.5.0
123 GNUTLS_VERSION=2.12.19
124 # Use 5.2.4, not 5.3, for now; lua_bitop.c hasn't been ported to 5.3
125 # yet, and we need to check for compatibility issues (we'd want Lua
126 # scripts to work with 5.1, 5.2, and 5.3, as long as they only use Lua
127 # features present in all three versions)
129 PORTAUDIO_VERSION=pa_stable_v19_20111121
131 # XXX - they appear to have an unversioned gzipped tarball for the
132 # current version; should we just download that, with some other
133 # way of specifying whether to download the GeoIP API?
141 DARWIN_MAJOR_VERSION=`uname -r | sed 's/\([0-9]*\).*/\1/'`
144 # GNU autotools; they're provided with releases up to Snow Leopard, but
145 # not in later releases, and the Snow Leopard version is too old for
146 # current Wireshark, so we install them unconditionally.
148 AUTOCONF_VERSION=2.69
149 AUTOMAKE_VERSION=1.13.3
150 LIBTOOL_VERSION=2.4.6
153 if [ "$XZ_VERSION" -a ! -f xz-$XZ_VERSION-done ] ; then
154 echo "Downloading, building, and installing xz:"
155 [ -f xz-$XZ_VERSION.tar.bz2 ] || curl -O http://tukaani.org/xz/xz-$XZ_VERSION.tar.bz2 || exit 1
156 bzcat xz-$XZ_VERSION.tar.bz2 | tar xf - || exit 1
158 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0" ./configure || exit 1
159 make $MAKE_BUILD_OPTS || exit 1
160 $DO_MAKE_INSTALL || exit 1
162 touch xz-$XZ_VERSION-done
167 if [ ! -z "$installed_xz_version" ] ; then
168 echo "Uninstalling xz:"
169 cd xz-$installed_xz_version
170 $DO_MAKE_UNINSTALL || exit 1
171 make distclean || exit 1
173 rm xz-$installed_xz_version-done
175 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
177 # Get rid of the previously downloaded and unpacked version.
179 rm -rf xz-$installed_xz_version
180 rm -rf xz-$installed_xz_version.tar.bz2
183 installed_xz_version=""
188 if [ "$AUTOCONF_VERSION" -a ! -f autoconf-$AUTOCONF_VERSION-done ] ; then
189 echo "Downloading, building and installing GNU autoconf..."
190 [ -f autoconf-$AUTOCONF_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/autoconf/autoconf-$AUTOCONF_VERSION.tar.xz || exit 1
191 xzcat autoconf-$AUTOCONF_VERSION.tar.xz | tar xf - || exit 1
192 cd autoconf-$AUTOCONF_VERSION
193 ./configure || exit 1
194 make $MAKE_BUILD_OPTS || exit 1
195 $DO_MAKE_INSTALL || exit 1
197 touch autoconf-$AUTOCONF_VERSION-done
201 uninstall_autoconf() {
202 if [ ! -z "$installed_autoconf_version" ] ; then
204 # automake and libtool depend on this, so uninstall them.
209 echo "Uninstalling GNU autoconf:"
210 cd autoconf-$installed_autoconf_version
211 $DO_MAKE_UNINSTALL || exit 1
212 make distclean || exit 1
214 rm autoconf-$installed_autoconf_version-done
216 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
218 # Get rid of the previously downloaded and unpacked version.
220 rm -rf autoconf-$installed_autoconf_version
221 rm -rf autoconf-$installed_autoconf_version.tar.xz
224 installed_autoconf_version=""
229 if [ "$AUTOMAKE_VERSION" -a ! -f automake-$AUTOMAKE_VERSION-done ] ; then
230 echo "Downloading, building and installing GNU automake..."
231 [ -f automake-$AUTOMAKE_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/automake/automake-$AUTOMAKE_VERSION.tar.xz || exit 1
232 xzcat automake-$AUTOMAKE_VERSION.tar.xz | tar xf - || exit 1
233 cd automake-$AUTOMAKE_VERSION
234 ./configure || exit 1
235 make $MAKE_BUILD_OPTS || exit 1
236 $DO_MAKE_INSTALL || exit 1
238 touch automake-$AUTOMAKE_VERSION-done
242 uninstall_automake() {
243 if [ ! -z "$installed_automake_version" ] ; then
245 # libtool depends on this(?), so uninstall it.
247 uninstall_libtool "$@"
249 echo "Uninstalling GNU automake:"
250 cd automake-$installed_automake_version
251 $DO_MAKE_UNINSTALL || exit 1
252 make distclean || exit 1
254 rm automake-$installed_automake_version-done
256 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
258 # Get rid of the previously downloaded and unpacked version.
260 rm -rf automake-$installed_automake_version
261 rm -rf automake-$installed_automake_version.tar.xz
264 installed_automake_version=""
269 if [ "$LIBTOOL_VERSION" -a ! -f libtool-$LIBTOOL_VERSION-done ] ; then
270 echo "Downloading, building and installing GNU libtool..."
271 [ -f libtool-$LIBTOOL_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/libtool/libtool-$LIBTOOL_VERSION.tar.xz || exit 1
272 xzcat libtool-$LIBTOOL_VERSION.tar.xz | tar xf - || exit 1
273 cd libtool-$LIBTOOL_VERSION
274 ./configure || exit 1
275 make $MAKE_BUILD_OPTS || exit 1
276 $DO_MAKE_INSTALL || exit 1
277 $DO_MV /usr/local/bin/libtool /usr/local/bin/glibtool
278 $DO_MV /usr/local/bin/libtoolize /usr/local/bin/glibtoolize
280 touch libtool-$LIBTOOL_VERSION-done
284 uninstall_libtool() {
285 if [ ! -z "$installed_libtool_version" ] ; then
286 echo "Uninstalling GNU libtool:"
287 cd libtool-$installed_libtool_version
288 $DO_MV /usr/local/bin/glibtool /usr/local/bin/libtool
289 $DO_MV /usr/local/bin/glibtoolize /usr/local/bin/libtoolize
290 $DO_MAKE_UNINSTALL || exit 1
291 make distclean || exit 1
293 rm libtool-$installed_libtool_version-done
295 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
297 # Get rid of the previously downloaded and unpacked version.
299 rm -rf libtool-$installed_libtool_version
300 rm -rf libtool-$installed_libtool_version.tar.xz
303 installed_libtool_version=""
308 if [ -n "$CMAKE" -a ! -f cmake-$CMAKE_VERSION-done ]; then
309 echo "Downloading and installing CMake:"
310 CMAKE_MAJOR_VERSION="`expr $CMAKE_VERSION : '\([0-9][0-9]*\).*'`"
311 CMAKE_MINOR_VERSION="`expr $CMAKE_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
312 CMAKE_DOTDOT_VERSION="`expr $CMAKE_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
313 CMAKE_MAJOR_MINOR_VERSION=$CMAKE_MAJOR_VERSION.$CMAKE_MINOR_VERSION
316 # NOTE: the "64" in "Darwin64" doesn't mean "64-bit-only"; the
317 # package in question supports both 32-bit and 64-bit x86.
319 case "$CMAKE_MAJOR_VERSION" in
322 echo "CMake $CMAKE_VERSION" is too old 1>&2
327 # Download the DMG, run the installer.
329 [ -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
330 sudo hdiutil attach cmake-$CMAKE_VERSION-Darwin64-universal.dmg || exit 1
331 sudo installer -target / -pkg /Volumes/cmake-$CMAKE_VERSION-Darwin64-universal/cmake-$CMAKE_VERSION-Darwin64-universal.pkg || exit 1
332 sudo hdiutil detach /Volumes/cmake-$CMAKE_VERSION-Darwin64-universal
337 # Download the DMG and do a drag install, where "drag" means
340 # 3.0.* and 3.1.0 have a Darwin64-universal DMG.
341 # 3.1.1 and later have a Darwin-x86_64 DMG.
342 # Probably not many people are still developing on 32-bit
343 # Macs, so we don't worry about them.
345 if [ "$CMAKE_MINOR_VERSION" = 0 -o \
346 "$CMAKE_VERSION" = 3.1.0 ]; then
347 type="Darwin64-universal"
351 [ -f cmake-$CMAKE_VERSION-$type.dmg ] || curl -O https://cmake.org/files/v$CMAKE_MAJOR_MINOR_VERSION/cmake-$CMAKE_VERSION-$type.dmg || exit 1
352 sudo hdiutil attach cmake-$CMAKE_VERSION-$type.dmg || exit 1
353 sudo ditto /Volumes/cmake-$CMAKE_VERSION-$type/CMake.app /Applications/CMake.app || exit 1
356 # Plant the appropriate symbolic links in /usr/local/bin.
357 # It's a drag-install, so there's no installer to make them,
358 # and the CMake code to put them in place is lame, as
360 # 1) it defaults to /usr/bin, not /usr/local/bin;
361 # 2) it doesn't request the necessary root privileges;
362 # 3) it can't be run from the command line;
364 # so we do it ourselves.
366 for i in ccmake cmake cmake-gui cmakexbuild cpack ctest
368 sudo ln -s /Applications/CMake.app/Contents/bin/$i /usr/local/bin/$i
370 sudo hdiutil detach /Volumes/cmake-$CMAKE_VERSION-$type
376 touch cmake-$CMAKE_VERSION-done
381 if [ ! -z "$installed_cmake_version" ]; then
382 echo "Uninstalling CMake:"
383 installed_cmake_major_version="`expr $installed_cmake_version : '\([0-9][0-9]*\).*'`"
384 case "$installed_cmake_major_version" in
387 echo "CMake $installed_cmake_version" is too old 1>&2
391 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
392 for i in ccmake cmake cmake-gui cmakexbuild cpack ctest
394 sudo rm -f /usr/bin/$i /usr/local/bin/$i
396 sudo pkgutil --forget com.Kitware.CMake
397 rm cmake-$installed_cmake_version-done
401 sudo rm -rf /Applications/CMake.app
402 for i in ccmake cmake cmake-gui cmakexbuild cpack ctest
404 sudo rm -f /usr/local/bin/$i
406 rm cmake-$installed_cmake_version-done
410 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
412 # Get rid of the previously downloaded and unpacked version,
413 # whatever it might happen to be called.
415 rm -f cmake-$installed_cmake_version-Darwin64-universal.dmg
416 rm -f cmake-$installed_cmake_version-Darwin-x86_64.dmg
419 installed_cmake_version=""
424 if [ ! -f gettext-$GETTEXT_VERSION-done ] ; then
425 echo "Downloading, building, and installing GNU gettext:"
426 [ -f gettext-$GETTEXT_VERSION.tar.gz ] || curl -O http://ftp.gnu.org/pub/gnu/gettext/gettext-$GETTEXT_VERSION.tar.gz || exit 1
427 gzcat gettext-$GETTEXT_VERSION.tar.gz | tar xf - || exit 1
428 cd gettext-$GETTEXT_VERSION
429 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0 $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
430 make $MAKE_BUILD_OPTS || exit 1
431 $DO_MAKE_INSTALL || exit 1
433 touch gettext-$GETTEXT_VERSION-done
437 uninstall_gettext() {
438 if [ ! -z "$installed_gettext_version" ] ; then
440 # GLib depends on this, so uninstall it.
444 echo "Uninstalling GNU gettext:"
445 cd gettext-$installed_gettext_version
446 $DO_MAKE_UNINSTALL || exit 1
447 make distclean || exit 1
449 rm gettext-$installed_gettext_version-done
451 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
453 # Get rid of the previously downloaded and unpacked version.
455 rm -rf gettext-$installed_gettext_version
456 rm -rf gettext-$installed_gettext_version.tar.gz
459 installed_gettext_version=""
463 install_pkg_config() {
464 if [ ! -f pkg-config-$PKG_CONFIG_VERSION-done ] ; then
465 echo "Downloading, building, and installing pkg-config:"
466 [ -f pkg-config-$PKG_CONFIG_VERSION.tar.gz ] || curl -O https://pkgconfig.freedesktop.org/releases/pkg-config-$PKG_CONFIG_VERSION.tar.gz || exit 1
467 gzcat pkg-config-$PKG_CONFIG_VERSION.tar.gz | tar xf - || exit 1
468 cd pkg-config-$PKG_CONFIG_VERSION
469 ./configure --with-internal-glib || exit 1
470 make $MAKE_BUILD_OPTS || exit 1
471 $DO_MAKE_INSTALL || exit 1
473 touch pkg-config-$PKG_CONFIG_VERSION-done
477 uninstall_pkg_config() {
478 if [ ! -z "$installed_pkg_config_version" ] ; then
479 echo "Uninstalling pkg-config:"
480 cd pkg-config-$installed_pkg_config_version
481 $DO_MAKE_UNINSTALL || exit 1
482 make distclean || exit 1
484 rm pkg-config-$installed_pkg_config_version-done
486 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
488 # Get rid of the previously downloaded and unpacked version.
490 rm -rf pkg-config-$installed_pkg_config_version
491 rm -rf pkg-config-$installed_pkg_config_version.tar.gz
494 installed_pkg_config_version=""
499 if [ ! -f glib-$GLIB_VERSION-done ] ; then
500 echo "Downloading, building, and installing GLib:"
501 glib_dir=`expr $GLIB_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
502 GLIB_MAJOR_VERSION="`expr $GLIB_VERSION : '\([0-9][0-9]*\).*'`"
503 GLIB_MINOR_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
504 GLIB_DOTDOT_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
505 if [[ $GLIB_MAJOR_VERSION -gt 2 ||
506 $GLIB_MINOR_VERSION -gt 28 ||
507 ($GLIB_MINOR_VERSION -eq 28 && $GLIB_DOTDOT_VERSION -ge 8) ]]
510 # Starting with GLib 2.28.8, xz-compressed tarballs are available.
512 [ -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
513 xzcat glib-$GLIB_VERSION.tar.xz | tar xf - || exit 1
515 [ -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
516 bzcat glib-$GLIB_VERSION.tar.bz2 | tar xf - || exit 1
518 cd glib-$GLIB_VERSION
520 # OS X ships with libffi, but doesn't provide its pkg-config file;
521 # explicitly specify LIBFFI_CFLAGS and LIBFFI_LIBS, so the configure
522 # script doesn't try to use pkg-config to get the appropriate
523 # C flags and loader flags.
525 # And, what's worse, at least with the version of Xcode that comes
526 # with Leopard, /usr/include/ffi/fficonfig.h doesn't define MACOSX,
527 # which causes the build of GLib to fail. If we don't find
528 # "#define.*MACOSX" in /usr/include/ffi/fficonfig.h, explicitly
531 # While we're at it, suppress -Wformat-nonliteral to avoid a case
532 # where clang's stricter rules on when not to complain about
533 # non-literal format arguments cause it to complain about code
534 # that's safe but it wasn't told that. See my comment #25 in
537 # https://bugzilla.gnome.org/show_bug.cgi?id=691608#c25
539 # First, determine where the system include files are. (It's not
540 # necessarily /usr/include.) There's a bit of a greasy hack here;
541 # pre-5.x versions of the developer tools don't support the
542 # --show-sdk-path option, and will produce no output, so includedir
543 # will be set to /usr/include (in those older versions of the
544 # developer tools, there is a /usr/include directory).
546 includedir=`xcrun --show-sdk-path 2>/dev/null`/usr/include
547 if grep -qs '#define.*MACOSX' $includedir/ffi/fficonfig.h
549 # It's defined, nothing to do
550 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
552 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
556 # Apply the fix to GNOME bug 529806:
558 # https://bugzilla.gnome.org/show_bug.cgi?id=529806
560 # if we have a version of GLib prior to 2.30.
562 if [[ $GLIB_MAJOR_VERSION -eq 2 && $GLIB_MINOR_VERSION -le 30 ]]
564 patch -p0 <../../macosx-support-lib-patches/glib-gconvert.c.patch || exit 1
566 make $MAKE_BUILD_OPTS || exit 1
567 $DO_MAKE_INSTALL || exit 1
569 touch glib-$GLIB_VERSION-done
574 if [ ! -z "$installed_glib_version" ] ; then
576 # ATK, Pango, and GTK depend on this, so uninstall them.
582 echo "Uninstalling GLib:"
583 cd glib-$installed_glib_version
584 $DO_MAKE_UNINSTALL || exit 1
585 make distclean || exit 1
587 rm glib-$installed_glib_version-done
589 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
591 # Get rid of the previously downloaded and unpacked version.
593 rm -rf glib-$installed_glib_version
594 rm -rf glib-$installed_glib_version.tar.xz glib-$installed_glib_version.tar.bz2
597 installed_glib_version=""
602 if [ "$QT_VERSION" -a ! -f qt-$QT_VERSION-done ]; then
603 echo "Downloading, building, and installing Qt:"
605 # What you get for this URL might just be a 302 Found reply, so use
606 # -L so we get redirected.
608 if [ "$QT_MAJOR_VERSION" -ge 5 ]
610 QT_VOLUME=qt-opensource-mac-x64-clang-$QT_VERSION
612 QT_VOLUME=qt-opensource-mac-$QT_VERSION
614 [ -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
615 sudo hdiutil attach $QT_VOLUME.dmg || exit 1
617 if [ "$QT_MAJOR_VERSION" -ge 5 ]
620 # Run the installer executable directly, so that we wait for
621 # it to finish. Then unmount the volume.
623 /Volumes/$QT_VOLUME/$QT_VOLUME.app/Contents/MacOS/$QT_VOLUME
624 sudo hdiutil detach /Volumes/$QT_VOLUME
627 # Open the installer package; use -W, so that we wait for
628 # the installer to finish. Then unmount the volume.
630 open -W "/Volumes/Qt $QT_MAJOR_MINOR_DOTDOT_VERSION/Qt.mpkg"
631 sudo hdiutil detach "/Volumes/Qt $QT_MAJOR_MINOR_DOTDOT_VERSION"
635 # Versions 5.3.x through 5.5.0, at least, have bogus .pc files.
636 # See bugs QTBUG-35256 and QTBUG-47162.
640 for i in $HOME/Qt$QT_VERSION/$QT_MAJOR_MINOR_VERSION/clang_64/lib/pkgconfig/*.pc
644 g/Cflags: /s;;Cflags: -F\${libdir} ;
645 g/Cflags: /s;-I\${includedir}/Qt\([a-zA-Z0-9_]*\);-I\${libdir}/Qt\1.framework/Versions/5/Headers;
651 touch qt-$QT_VERSION-done
656 if [ ! -z "$installed_qt_version" ] ; then
657 echo "Uninstalling Qt:"
658 rm -rf $HOME/Qt$installed_qt_version
659 rm qt-$installed_qt_version-done
661 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
663 # Get rid of the previously downloaded version.
665 rm -rf qt-opensource-mac-x64-clang-$installed_qt_version.dmg
668 installed_qt_version=""
673 if [ ! -f libpng-$PNG_VERSION-done ] ; then
674 echo "Downloading, building, and installing libpng:"
676 # The FTP site puts libpng x.y.* into a libpngxy directory.
678 subdir=`echo $PNG_VERSION | sed 's/\([1-9][0-9]*\)\.\([1-9][0-9]*\).*/libpng\1\2'/`
679 [ -f libpng-$PNG_VERSION.tar.xz ] || curl -O ftp://ftp.simplesystems.org/pub/libpng/png/src/$subdir/libpng-$PNG_VERSION.tar.xz
680 xzcat libpng-$PNG_VERSION.tar.xz | tar xf - || exit 1
681 cd libpng-$PNG_VERSION
682 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
683 make $MAKE_BUILD_OPTS || exit 1
684 $DO_MAKE_INSTALL || exit 1
686 touch libpng-$PNG_VERSION-done
691 if [ ! -z "$installed_libpng_version" ] ; then
693 # Cairo depends on this, so uninstall it.
697 echo "Uninstalling libpng:"
698 cd libpng-$installed_libpng_version
699 $DO_MAKE_UNINSTALL || exit 1
700 make distclean || exit 1
702 rm libpng-$installed_libpng_version-done
704 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
706 # Get rid of the previously downloaded and unpacked version.
708 rm -rf libpng-$installed_libpng_version
709 rm -rf libpng-$installed_libpng_version.tar.xz
712 installed_libpng_version=""
717 if [ ! -f pixman-$PIXMAN_VERSION-done ] ; then
718 echo "Downloading, building, and installing pixman:"
719 [ -f pixman-$PIXMAN_VERSION.tar.gz ] || curl -O http://www.cairographics.org/releases/pixman-$PIXMAN_VERSION.tar.gz
720 gzcat pixman-$PIXMAN_VERSION.tar.gz | tar xf - || exit 1
721 cd pixman-$PIXMAN_VERSION
722 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
723 make $MAKE_BUILD_OPTS || exit 1
724 $DO_MAKE_INSTALL || exit 1
726 touch pixman-$PIXMAN_VERSION-done
731 if [ ! -z "$installed_pixman_version" ] ; then
733 # Cairo depends on this, so uninstall it.
737 echo "Uninstalling pixman:"
738 cd pixman-$installed_pixman_version
739 $DO_MAKE_UNINSTALL || exit 1
740 make distclean || exit 1
742 rm pixman-$installed_pixman_version-done
744 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
746 # Get rid of the previously downloaded and unpacked version.
748 rm -rf pixman-$installed_pixman_version
749 rm -rf pixman-$installed_pixman_version.tar.gz
752 installed_pixman_version=""
757 if [ ! -f cairo-$CAIRO_VERSION-done ] ; then
758 echo "Downloading, building, and installing Cairo:"
759 CAIRO_MAJOR_VERSION="`expr $CAIRO_VERSION : '\([0-9][0-9]*\).*'`"
760 CAIRO_MINOR_VERSION="`expr $CAIRO_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
761 CAIRO_DOTDOT_VERSION="`expr $CAIRO_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
762 if [[ $CAIRO_MAJOR_VERSION -gt 1 ||
763 $CAIRO_MINOR_VERSION -gt 12 ||
764 ($CAIRO_MINOR_VERSION -eq 12 && $CAIRO_DOTDOT_VERSION -ge 2) ]]
767 # Starting with Cairo 1.12.2, the tarballs are compressed with
768 # xz rather than gzip.
770 [ -f cairo-$CAIRO_VERSION.tar.xz ] || curl -O http://cairographics.org/releases/cairo-$CAIRO_VERSION.tar.xz || exit 1
771 xzcat cairo-$CAIRO_VERSION.tar.xz | tar xf - || exit 1
773 [ -f cairo-$CAIRO_VERSION.tar.gz ] || curl -O http://cairographics.org/releases/cairo-$CAIRO_VERSION.tar.gz || exit 1
774 gzcat cairo-$CAIRO_VERSION.tar.gz | tar xf - || exit 1
776 cd cairo-$CAIRO_VERSION
777 # CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-quartz=no || exit 1
778 # Maybe follow http://cairographics.org/end_to_end_build_for_mac_os_x/
779 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-quartz=yes || exit 1
781 # We must avoid the version of libpng that comes with X11; the
782 # only way I've found to force that is to forcibly set INCLUDES
783 # when we do the build, so that this comes before CAIRO_CFLAGS,
784 # which has -I/usr/X11/include added to it before anything
785 # connected to libpng is.
787 INCLUDES="-I/usr/local/include/libpng15" make $MAKE_BUILD_OPTS || exit 1
788 $DO_MAKE_INSTALL || exit 1
790 touch cairo-$CAIRO_VERSION-done
795 if [ ! -z "$installed_cairo_version" ] ; then
797 # GTK+ depends on this, so uninstall it.
801 echo "Uninstalling Cairo:"
802 cd cairo-$installed_cairo_version
803 $DO_MAKE_UNINSTALL || exit 1
804 make distclean || exit 1
806 rm cairo-$installed_cairo_version-done
808 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
810 # Get rid of the previously downloaded and unpacked version.
812 rm -rf cairo-$installed_cairo_version
813 rm -rf cairo-$installed_cairo_version.tar.xz cairo-$installed_cairo_version.tar.gz
816 installed_cairo_version=""
821 if [ ! -f atk-$ATK_VERSION-done ] ; then
822 echo "Downloading, building, and installing ATK:"
823 atk_dir=`expr $ATK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
824 ATK_MAJOR_VERSION="`expr $ATK_VERSION : '\([0-9][0-9]*\).*'`"
825 ATK_MINOR_VERSION="`expr $ATK_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
826 ATK_DOTDOT_VERSION="`expr $ATK_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
827 if [[ $ATK_MAJOR_VERSION -gt 2 ||
828 ($ATK_MAJOR_VERSION -eq 2 && $ATK_MINOR_VERSION -gt 0) ||
829 ($ATK_MANOR_VERSION -eq 2 && $ATK_MINOR_VERSION -eq 0 && $ATK_DOTDOT_VERSION -ge 1) ]]
832 # Starting with ATK 2.0.1, xz-compressed tarballs are available.
834 [ -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
835 xzcat atk-$ATK_VERSION.tar.xz | tar xf - || exit 1
837 [ -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
838 bzcat atk-$ATK_VERSION.tar.bz2 | tar xf - || exit 1
841 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
842 make $MAKE_BUILD_OPTS || exit 1
843 $DO_MAKE_INSTALL || exit 1
845 touch atk-$ATK_VERSION-done
850 if [ ! -z "$installed_atk_version" ] ; then
852 # GTK+ depends on this, so uninstall it.
856 echo "Uninstalling ATK:"
857 cd atk-$installed_atk_version
858 $DO_MAKE_UNINSTALL || exit 1
859 make distclean || exit 1
861 rm atk-$installed_atk_version-done
863 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
865 # Get rid of the previously downloaded and unpacked version.
867 rm -rf atk-$installed_atk_version
868 rm -rf atk-$installed_atk_version.tar.xz atk-$installed_atk_version.tar.bz2
871 installed_atk_version=""
876 if [ ! -f pango-$PANGO_VERSION-done ] ; then
877 echo "Downloading, building, and installing Pango:"
878 pango_dir=`expr $PANGO_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
879 PANGO_MAJOR_VERSION="`expr $PANGO_VERSION : '\([0-9][0-9]*\).*'`"
880 PANGO_MINOR_VERSION="`expr $PANGO_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
881 if [[ $PANGO_MAJOR_VERSION -gt 1 ||
882 $PANGO_MINOR_VERSION -ge 29 ]]
885 # Starting with Pango 1.29, the tarballs are compressed with
886 # xz rather than bzip2.
888 [ -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
889 xzcat pango-$PANGO_VERSION.tar.xz | tar xf - || exit 1
891 [ -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
892 bzcat pango-$PANGO_VERSION.tar.bz2 | tar xf - || exit 1
894 cd pango-$PANGO_VERSION
895 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
896 make $MAKE_BUILD_OPTS || exit 1
897 $DO_MAKE_INSTALL || exit 1
899 touch pango-$PANGO_VERSION-done
904 if [ ! -z "$installed_pango_version" ] ; then
906 # GTK+ depends on this, so uninstall it.
910 echo "Uninstalling Pango:"
911 cd pango-$installed_pango_version
912 $DO_MAKE_UNINSTALL || exit 1
913 make distclean || exit 1
915 rm pango-$installed_pango_version-done
917 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
919 # Get rid of the previously downloaded and unpacked version.
921 rm -rf pango-$installed_pango_version
922 rm -rf pango-$installed_pango_version.tar.xz pango-$installed_pango_version.tar.bz2
925 installed_pango_version=""
929 install_gdk_pixbuf() {
930 if [ "$GDK_PIXBUF_VERSION" -a ! -f gdk-pixbuf-$GDK_PIXBUF_VERSION-done ] ; then
931 echo "Downloading, building, and installing gdk-pixbuf:"
932 gdk_pixbuf_dir=`expr $GDK_PIXBUF_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
933 [ -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
934 xzcat gdk-pixbuf-$GDK_PIXBUF_VERSION.tar.xz | tar xf - || exit 1
935 cd gdk-pixbuf-$GDK_PIXBUF_VERSION
937 # If we're building using the 10.6 SDK, force the use of libpng12.
939 # The OS's X11, and corresponding SDK, didn't introduce libpng15,
940 # or pkg-config files, until 10.7, so, for 10.6 have to explicitly
941 # set LIBPNG to override the configure script, and also force the
942 # CFLAGS to look for the header files for libpng12 (note that
943 # -isysroot doesn't affect the arguments to -I, so we need to
944 # include the SDK path explicitly).
946 if [[ "$sdk_target" = 10.6 ]]
948 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
950 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
952 make $MAKE_BUILD_OPTS || exit 1
953 $DO_MAKE_INSTALL || exit 1
955 touch gdk-pixbuf-$GDK_PIXBUF_VERSION-done
959 uninstall_gdk_pixbuf() {
960 if [ ! -z "$installed_gdk_pixbuf_version" ] ; then
962 # GTK+ depends on this, so uninstall it.
966 echo "Uninstalling gdk-pixbuf:"
967 cd gdk-pixbuf-$installed_gdk_pixbuf_version
968 $DO_MAKE_UNINSTALL || exit 1
969 make distclean || exit 1
971 rm gdk-pixbuf-$installed_gdk_pixbuf_version-done
973 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
975 # Get rid of the previously downloaded and unpacked version.
977 rm -rf gdk-pixbuf-$installed_gdk_pixbuf_version
978 rm -rf gdk-pixbuf-$installed_gdk_pixbuf_version.tar.xz
981 installed_gdk_pixbuf_version=""
986 if [ ! -f gtk+-$GTK_VERSION-done ] ; then
987 echo "Downloading, building, and installing GTK+:"
988 gtk_dir=`expr $GTK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
989 if [[ $GTK_MAJOR_VERSION -gt 2 ||
990 $GTK_MINOR_VERSION -gt 24 ||
991 ($GTK_MINOR_VERSION -eq 24 && $GTK_DOTDOT_VERSION -ge 5) ]]
994 # Starting with GTK+ 2.24.5, the tarballs are compressed with
995 # xz rather than gzip, in addition to bzip2; use xz, as we've
996 # built and installed it, and as xz compresses better than
997 # bzip2 so the tarballs take less time to download.
999 [ -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
1000 xzcat gtk+-$GTK_VERSION.tar.xz | tar xf - || exit 1
1002 [ -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
1003 bzcat gtk+-$GTK_VERSION.tar.bz2 | tar xf - || exit 1
1005 cd gtk+-$GTK_VERSION
1006 if [ $DARWIN_MAJOR_VERSION -ge "12" ]
1009 # GTK+ 2.24.10, at least, doesn't build on Mountain Lion with the
1010 # CUPS printing backend - either the CUPS API changed incompatibly
1011 # or the backend was depending on non-API implementation details.
1013 # Configure it out, on Mountain Lion and later, for now.
1014 # (12 is the Darwin major version number in Mountain Lion.)
1016 # Also, configure out libtiff and libjpeg; configure scripts
1017 # just ignore unknown --enable/--disable and --with/--without
1018 # options (at least they've always do so up to now).
1020 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
1022 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
1024 make $MAKE_BUILD_OPTS || exit 1
1025 $DO_MAKE_INSTALL || exit 1
1027 touch gtk+-$GTK_VERSION-done
1032 if [ ! -z "$installed_gtk_version" ] ; then
1033 echo "Uninstalling GTK+:"
1034 cd gtk+-$installed_gtk_version
1035 $DO_MAKE_UNINSTALL || exit 1
1036 make distclean || exit 1
1038 rm gtk+-$installed_gtk_version-done
1040 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1042 # Get rid of the previously downloaded and unpacked version.
1044 rm -rf gtk+-$installed_gtk_version
1045 rm -rf gtk+-$installed_gtk_version.tar.xz gtk+-$installed_gtk_version.tar.bz2
1048 installed_gtk_version=""
1053 if [ "$LIBSMI_VERSION" -a ! -f libsmi-$LIBSMI_VERSION-done ] ; then
1054 echo "Downloading, building, and installing libsmi:"
1055 [ -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
1056 gzcat libsmi-$LIBSMI_VERSION.tar.gz | tar xf - || exit 1
1057 cd libsmi-$LIBSMI_VERSION
1058 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1059 make $MAKE_BUILD_OPTS || exit 1
1060 $DO_MAKE_INSTALL || exit 1
1062 touch libsmi-$LIBSMI_VERSION-done
1066 uninstall_libsmi() {
1067 if [ ! -z "$installed_libsmi_version" ] ; then
1068 echo "Uninstalling libsmi:"
1069 cd libsmi-$installed_libsmi_version
1070 $DO_MAKE_UNINSTALL || exit 1
1071 make distclean || exit 1
1073 rm libsmi-$installed_libsmi_version-done
1075 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1077 # Get rid of the previously downloaded and unpacked version.
1079 rm -rf libsmi-$installed_libsmi_version
1080 rm -rf libsmi-$installed_libsmi_version.tar.gz
1083 installed_libsmi_version=""
1087 install_libgpg_error() {
1088 if [ "$LIBGPG_ERROR_VERSION" -a ! -f libgpg-error-$LIBGPG_ERROR_VERSION-done ] ; then
1089 echo "Downloading, building, and installing libgpg-error:"
1090 [ -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
1091 bzcat libgpg-error-$LIBGPG_ERROR_VERSION.tar.bz2 | tar xf - || exit 1
1092 cd libgpg-error-$LIBGPG_ERROR_VERSION
1093 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1094 make $MAKE_BUILD_OPTS || exit 1
1095 $DO_MAKE_INSTALL || exit 1
1097 touch libgpg-error-$LIBGPG_ERROR_VERSION-done
1101 uninstall_libgpg_error() {
1102 if [ ! -z "$installed_libgpg_error_version" ] ; then
1104 # libgcrypt depends on this, so uninstall it.
1106 uninstall_libgcrypt "$@"
1108 echo "Uninstalling libgpg-error:"
1109 cd libgpg-error-$installed_libgpg_error_version
1110 $DO_MAKE_UNINSTALL || exit 1
1111 make distclean || exit 1
1113 rm libgpg-error-$installed_libgpg_error_version-done
1115 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1117 # Get rid of the previously downloaded and unpacked version.
1119 rm -rf libgpg-error-$installed_libgpg_error_version
1120 rm -rf libgpg-error-$installed_libgpg_error_version.tar.bz2
1123 installed_libgpg_error_version=""
1127 install_libgcrypt() {
1128 if [ "$LIBGCRYPT_VERSION" -a ! -f libgcrypt-$LIBGCRYPT_VERSION-done ] ; then
1130 # libgpg-error is required for libgcrypt.
1132 if [ -z $LIBGPG_ERROR_VERSION ]
1134 echo "libgcrypt requires libgpg-error, but you didn't install libgpg-error." 1>&2
1138 echo "Downloading, building, and installing libgcrypt:"
1139 [ -f libgcrypt-$LIBGCRYPT_VERSION.tar.gz ] || curl -L -O ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-$LIBGCRYPT_VERSION.tar.gz || exit 1
1140 gzcat libgcrypt-$LIBGCRYPT_VERSION.tar.gz | tar xf - || exit 1
1141 cd libgcrypt-$LIBGCRYPT_VERSION
1143 # The assembler language code is not compatible with the OS X
1144 # x86 assembler (or is it an x86-64 vs. x86-32 issue?).
1146 # libgcrypt expects gnu89, not c99/gnu99, semantics for
1147 # "inline". See, for example:
1149 # http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2010-October/198809.html
1151 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
1152 make $MAKE_BUILD_OPTS || exit 1
1153 $DO_MAKE_INSTALL || exit 1
1155 touch libgcrypt-$LIBGCRYPT_VERSION-done
1159 uninstall_libgcrypt() {
1160 if [ ! -z "$installed_libgcrypt_version" ] ; then
1162 # GnuTLS depends on this, so uninstall it.
1164 uninstall_gnutls "$@"
1166 echo "Uninstalling libgcrypt:"
1167 cd libgcrypt-$installed_libgcrypt_version
1168 $DO_MAKE_UNINSTALL || exit 1
1169 make distclean || exit 1
1171 rm libgcrypt-$installed_libgcrypt_version-done
1173 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1175 # Get rid of the previously downloaded and unpacked version.
1177 rm -rf libgcrypt-$installed_libgcrypt_version
1178 rm -rf libgcrypt-$installed_libgcrypt_version.tar.gz
1181 installed_libgcrypt_version=""
1186 if [ "$GNUTLS_VERSION" -a ! -f gnutls-$GNUTLS_VERSION-done ] ; then
1188 # GnuTLS requires libgcrypt (or nettle, in newer versions).
1190 if [ -z $LIBGCRYPT_VERSION ]
1192 echo "GnuTLS requires libgcrypt, but you didn't install libgcrypt" 1>&2
1196 echo "Downloading, building, and installing GnuTLS:"
1197 [ -f gnutls-$GNUTLS_VERSION.tar.bz2 ] || curl -L -O http://ftp.gnu.org/gnu/gnutls/gnutls-$GNUTLS_VERSION.tar.bz2 || exit 1
1198 bzcat gnutls-$GNUTLS_VERSION.tar.bz2 | tar xf - || exit 1
1199 cd gnutls-$GNUTLS_VERSION
1201 # Use libgcrypt, not nettle.
1202 # XXX - is there some reason to prefer nettle? Or does
1203 # Wireshark directly use libgcrypt routines?
1205 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
1206 make $MAKE_BUILD_OPTS || exit 1
1208 # The pkgconfig file for GnuTLS says "requires zlib", but OS X,
1209 # while it supplies zlib, doesn't supply a pkgconfig file for
1212 # Patch the GnuTLS pkgconfig file not to require zlib.
1213 # (If the capabilities of GnuTLS that Wireshark uses don't
1214 # depend on building GnuTLS with zlib, an alternative would be
1215 # to configure it not to use zlib.)
1217 patch -p0 lib/gnutls.pc.in <../../macosx-support-lib-patches/gnutls-pkgconfig.patch || exit 1
1218 $DO_MAKE_INSTALL || exit 1
1220 touch gnutls-$GNUTLS_VERSION-done
1224 uninstall_gnutls() {
1225 if [ ! -z "$installed_gnutls_version" ] ; then
1226 echo "Uninstalling GnuTLS:"
1227 cd gnutls-$installed_gnutls_version
1228 $DO_MAKE_UNINSTALL || exit 1
1229 make distclean || exit 1
1231 rm gnutls-$installed_gnutls_version-done
1233 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1235 # Get rid of the previously downloaded and unpacked version.
1237 rm -rf gnutls-$installed_gnutls_version
1238 rm -rf gnutls-$installed_gnutls_version.tar.bz2
1241 installed_gnutls_version=""
1246 if [ "$LUA_VERSION" -a ! -f lua-$LUA_VERSION-done ] ; then
1247 echo "Downloading, building, and installing Lua:"
1248 [ -f lua-$LUA_VERSION.tar.gz ] || curl -L -O http://www.lua.org/ftp/lua-$LUA_VERSION.tar.gz || exit 1
1249 gzcat lua-$LUA_VERSION.tar.gz | tar xf - || exit 1
1251 make MYCFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" MYLDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" $MAKE_BUILD_OPTS macosx || exit 1
1252 $DO_MAKE_INSTALL || exit 1
1254 touch lua-$LUA_VERSION-done
1259 if [ ! -z "$installed_lua_version" ] ; then
1260 echo "Uninstalling Lua:"
1262 # Lua has no "make uninstall", so just remove stuff manually.
1263 # There's no configure script, so there's no need for
1264 # "make distclean", either; just do "make clean".
1266 (cd /usr/local/bin; $DO_RM -f lua luac)
1267 (cd /usr/local/include; $DO_RM -f lua.h luaconf.h lualib.h lauxlib.h lua.hpp)
1268 (cd /usr/local/lib; $DO_RM -f liblua.a)
1269 (cd /usr/local/man/man1; $DO_RM -f lua.1 luac.1)
1270 cd lua-$installed_lua_version
1271 make clean || exit 1
1273 rm lua-$installed_lua_version-done
1275 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1277 # Get rid of the previously downloaded and unpacked version.
1279 rm -rf lua-$installed_lua_version
1280 rm -rf lua-$installed_lua_version.tar.gz
1283 installed_lua_version=""
1287 install_portaudio() {
1289 # Check for both the old versionless portaudio-done and the new
1290 # versioned -done file.
1292 if [ "$PORTAUDIO_VERSION" -a ! -f portaudio-$PORTAUDIO_VERSION-done ] ; then
1293 echo "Downloading, building, and installing PortAudio:"
1294 [ -f $PORTAUDIO_VERSION.tgz ] || curl -L -O http://www.portaudio.com/archives/$PORTAUDIO_VERSION.tgz || exit 1
1295 gzcat $PORTAUDIO_VERSION.tgz | tar xf - || exit 1
1298 # Un-comment an include that's required on Lion.
1300 patch -p0 include/pa_mac_core.h <../../macosx-support-lib-patches/portaudio-pa_mac_core.h.patch
1302 # Fix a bug that showed up with clang (but is a bug with any
1305 patch -p0 src/hostapi/coreaudio/pa_mac_core.c <../../macosx-support-lib-patches/portaudio-pa_mac_core.c.patch
1307 # Disable fat builds - the configure script doesn't work right
1308 # with Xcode 4 if you leave them enabled, and we don't build
1309 # any other libraries fat (GLib, for example, would be very
1310 # hard to build fat), so there's no advantage to having PortAudio
1313 # Set the minimum OS X version to 10.4, to suppress some
1314 # deprecation warnings. (Good luck trying to make any of
1315 # this build on an OS+Xcode with a pre-10.4 SDK; we don't
1316 # worry about the user requesting that.)
1318 # Explicitly disable deprecation, so the damn thing will build
1319 # on El Capitan with Xcode 7.
1321 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
1322 make $MAKE_BUILD_OPTS || exit 1
1323 $DO_MAKE_INSTALL || exit 1
1325 touch portaudio-$PORTAUDIO_VERSION-done
1329 uninstall_portaudio() {
1330 if [ ! -z "$installed_portaudio_version" ] ; then
1331 echo "Uninstalling PortAudio:"
1333 $DO_MAKE_UNINSTALL || exit 1
1334 make distclean || exit 1
1336 rm portaudio-$installed_portaudio_version-done
1338 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1340 # Get rid of the previously downloaded and unpacked version.
1343 rm -rf $installed_portaudio_version.tgz
1346 installed_portaudio_version=""
1351 if [ "$GEOIP_VERSION" -a ! -f geoip-$GEOIP_VERSION-done ] ; then
1352 echo "Downloading, building, and installing GeoIP API:"
1353 [ -f GeoIP-$GEOIP_VERSION.tar.gz ] || curl -L -O http://geolite.maxmind.com/download/geoip/api/c/GeoIP-$GEOIP_VERSION.tar.gz || exit 1
1354 gzcat GeoIP-$GEOIP_VERSION.tar.gz | tar xf - || exit 1
1355 cd GeoIP-$GEOIP_VERSION
1356 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1358 # Grr. Their man pages "helpfully" have an ISO 8859-1
1359 # copyright symbol in the copyright notice, but OS X's
1360 # default character encoding is UTF-8. sed on Mountain
1361 # Lion barfs at the "illegal character sequence" represented
1362 # by an ISO 8859-1 copyright symbol, as it's not a valid
1365 # iconv the relevant man pages into UTF-8.
1367 for i in geoipupdate.1.in geoiplookup6.1.in geoiplookup.1.in
1369 iconv -f iso8859-1 -t utf-8 man/"$i" >man/"$i".tmp &&
1370 mv man/"$i".tmp man/"$i"
1372 make $MAKE_BUILD_OPTS || exit 1
1373 $DO_MAKE_INSTALL || exit 1
1375 touch geoip-$GEOIP_VERSION-done
1380 if [ ! -z "$installed_geoip_version" ] ; then
1381 echo "Uninstalling GeoIP API:"
1382 cd GeoIP-$installed_geoip_version
1383 $DO_MAKE_UNINSTALL || exit 1
1384 make distclean || exit 1
1386 rm geoip-$installed_geoip_version-done
1388 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1390 # Get rid of the previously downloaded and unpacked version.
1392 rm -rf GeoIP-$installed_geoip_version
1393 rm -rf GeoIP-$installed_geoip_version.tar.gz
1396 installed_geoip_version=""
1401 if [ "$CARES_VERSION" -a ! -f c-ares-$CARES_VERSION-done ] ; then
1402 echo "Downloading, building, and installing C-Ares API:"
1403 [ -f c-ares-$CARES_VERSION.tar.gz ] || curl -L -O http://c-ares.haxx.se/download/c-ares-$CARES_VERSION.tar.gz || exit 1
1404 gzcat c-ares-$CARES_VERSION.tar.gz | tar xf - || exit 1
1405 cd c-ares-$CARES_VERSION
1406 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1407 make $MAKE_BUILD_OPTS || exit 1
1408 $DO_MAKE_INSTALL || exit 1
1410 touch c-ares-$CARES_VERSION-done
1414 uninstall_c_ares() {
1415 if [ ! -z "$installed_cares_version" ] ; then
1416 echo "Uninstalling C-Ares API:"
1417 cd c-ares-$installed_cares_version
1418 $DO_MAKE_UNINSTALL || exit 1
1419 make distclean || exit 1
1421 rm c-ares-$installed_cares_version-done
1423 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1425 # Get rid of the previously downloaded and unpacked version.
1427 rm -rf c-ares-$installed_cares_version
1428 rm -rf c-ares-$installed_cares_version.tar.gz
1431 installed_cares_version=""
1436 if [ "$LIBSSH_VERSION" -a ! -f libssh-$LIBSSH_VERSION-done ] ; then
1437 echo "Downloading, building, and installing libssh:"
1438 [ -f libssh-$LIBSSH_VERSION.tar.xz ] || curl -L -O https://red.libssh.org/attachments/download/177/libssh-$LIBSSH_VERSION.tar.xz || exit 1
1439 xzcat libssh-$LIBSSH_VERSION.tar.xz | tar xf - || exit 1
1440 cd libssh-$LIBSSH_VERSION
1443 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" cmake -DWITH_GCRYPT=1 ../ || exit 1
1444 make $MAKE_BUILD_OPTS || exit 1
1445 $DO_MAKE_INSTALL || exit 1
1447 touch libssh-$LIBSSH_VERSION-done
1451 uninstall_libssh() {
1452 if [ ! -z "$installed_libssh_version" ] ; then
1453 echo "Uninstalling libssh:"
1454 cd libssh-$installed_libssh_version
1455 $DO_MAKE_UNINSTALL || exit 1
1456 make distclean || exit 1
1458 rm libssh-$installed_libssh_version-done
1460 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1462 # Get rid of the previously downloaded and unpacked version.
1464 rm -rf libssh-$installed_libssh_version
1465 rm -rf libssh-$installed_libssh_version.tar.xz
1468 installed_libssh_version=""
1474 # Check whether the versions we have installed are the versions
1475 # requested; if not, uninstall the installed versions.
1477 if [ ! -z "$installed_libssh_version" -a \
1478 "$installed_libssh_version" != "$LIBSSH_VERSION" ] ; then
1479 echo "Installed libssh version is $installed_libssh_version"
1480 if [ -z "$LIBSSH_VERSION" ] ; then
1481 echo "libssh is not requested"
1483 echo "Requested libssh version is $LIBSSH_VERSION"
1488 if [ ! -z "$installed_cares_version" -a \
1489 "$installed_cares_version" != "$CARES_VERSION" ] ; then
1490 echo "Installed C-Ares version is $installed_cares_version"
1491 if [ -z "$CARES_VERSION" ] ; then
1492 echo "C-Ares is not requested"
1494 echo "Requested C-Ares version is $CARES_VERSION"
1499 if [ ! -z "$installed_geoip_version" -a \
1500 "$installed_geoip_version" != "$GEOIP_VERSION" ] ; then
1501 echo "Installed GeoIP API version is $installed_geoip_version"
1502 if [ -z "$GEOIP_VERSION" ] ; then
1503 echo "GeoIP is not requested"
1505 echo "Requested GeoIP version is $GEOIP_VERSION"
1510 if [ ! -z "$installed_portaudio_version" -a \
1511 "$installed_portaudio_version" != "$PORTAUDIO_VERSION" ] ; then
1512 echo "Installed PortAudio version is $installed_portaudio_version"
1513 if [ -z "$PORTAUDIO_VERSION" ] ; then
1514 echo "PortAudio is not requested"
1516 echo "Requested PortAudio version is $PORTAUDIO_VERSION"
1518 uninstall_portaudio -r
1521 if [ ! -z "$installed_lua_version" -a \
1522 "$installed_lua_version" != "$LUA_VERSION" ] ; then
1523 echo "Installed Lua version is $installed_lua_version"
1524 if [ -z "$LUA_VERSION" ] ; then
1525 echo "Lua is not requested"
1527 echo "Requested Lua version is $LUA_VERSION"
1532 if [ ! -z "$installed_gnutls_version" -a \
1533 "$installed_gnutls_version" != "$GNUTLS_VERSION" ] ; then
1534 echo "Installed GnuTLS version is $installed_gnutls_version"
1535 if [ -z "$GNUTLS_VERSION" ] ; then
1536 echo "GnuTLS is not requested"
1538 echo "Requested GnuTLS version is $GNUTLS_VERSION"
1543 if [ ! -z "$installed_libgcrypt_version" -a \
1544 "$installed_libgcrypt_version" != "$LIBGCRYPT_VERSION" ] ; then
1545 echo "Installed libgcrypt version is $installed_libgcrypt_version"
1546 if [ -z "$LIBGCRYPT_VERSION" ] ; then
1547 echo "libgcrypt is not requested"
1549 echo "Requested libgcrypt version is $LIBGCRYPT_VERSION"
1551 uninstall_libgcrypt -r
1554 if [ ! -z "$installed_libgpg_error_version" -a \
1555 "$installed_libgpg_error_version" != "$LIBGPG_ERROR_VERSION" ] ; then
1556 echo "Installed libgpg-error version is $installed_libgpg_error_version"
1557 if [ -z "$LIBGPG_ERROR_VERSION" ] ; then
1558 echo "libgpg-error is not requested"
1560 echo "Requested libgpg-error version is $LIBGPG_ERROR_VERSION"
1562 uninstall_libgpg_error -r
1565 if [ ! -z "$installed_libsmi_version" -a \
1566 "$installed_libsmi_version" != "$LIBSMI_VERSION" ] ; then
1567 echo "Installed libsmi version is $installed_libsmi_version"
1568 if [ -z "$LIBSMI_VERSION" ] ; then
1569 echo "libsmi is not requested"
1571 echo "Requested libsmi version is $LIBSMI_VERSION"
1576 if [ ! -z "$installed_gtk_version" -a \
1577 "$installed_gtk_version" != "$GTK_VERSION" ] ; then
1578 echo "Installed GTK+ version is $installed_gtk_version"
1579 if [ -z "$GTK_VERSION" ] ; then
1580 echo "GTK+ is not requested"
1582 echo "Requested GTK+ version is $GTK_VERSION"
1587 if [ ! -z "$installed_gdk_pixbuf_version" -a \
1588 "$installed_gdk_pixbuf_version" != "$GDK_PIXBUF_VERSION" ] ; then
1589 echo "Installed gdk-pixbuf version is $installed_gdk_pixbuf_version"
1590 if [ -z "$GDK_PIXBUF_VERSION" ] ; then
1591 echo "gdk-pixbuf is not requested"
1593 echo "Requested gdk-pixbuf version is $GDK_PIXBUF_VERSION"
1595 uninstall_gdk_pixbuf -r
1598 if [ ! -z "$installed_pango_version" -a \
1599 "$installed_pango_version" != "$PANGO_VERSION" ] ; then
1600 echo "Installed Pango version is $installed_pango_version"
1601 if [ -z "$PANGO_VERSION" ] ; then
1602 echo "Pango is not requested"
1604 echo "Requested Pango version is $PANGO_VERSION"
1609 if [ ! -z "$installed_atk_version" -a \
1610 "$installed_atk_version" != "$ATK_VERSION" ] ; then
1611 echo "Installed ATK version is $installed_atk_version"
1612 if [ -z "$ATK_VERSION" ] ; then
1613 echo "ATK is not requested"
1615 echo "Requested ATK version is $ATK_VERSION"
1620 if [ ! -z "$installed_cairo_version" -a \
1621 "$installed_cairo_version" != "$CAIRO_VERSION" ] ; then
1622 echo "Installed Cairo version is $installed_cairo_version"
1623 if [ -z "$CAIRO_VERSION" ] ; then
1624 echo "Cairo is not requested"
1626 echo "Requested Cairo version is $CAIRO_VERSION"
1631 if [ ! -z "$installed_pixman_version" -a \
1632 "$installed_pixman_version" != "$PIXMAN_VERSION" ] ; then
1633 echo "Installed pixman version is $installed_pixman_version"
1634 if [ -z "$PIXMAN_VERSION" ] ; then
1635 echo "pixman is not requested"
1637 echo "Requested pixman version is $PIXMAN_VERSION"
1642 if [ ! -z "$installed_libpng_version" -a \
1643 "$installed_libpng_version" != "$PNG_VERSION" ] ; then
1644 echo "Installed libpng version is $installed_libpng_version"
1645 if [ -z "$PNG_VERSION" ] ; then
1646 echo "libpng is not requested"
1648 echo "Requested libpng version is $PNG_VERSION"
1653 if [ ! -z "$installed_qt_version" -a \
1654 "$installed_qt_version" != "$QT_VERSION" ] ; then
1655 echo "Installed Qt version is $installed_qt_version"
1656 if [ -z "$QT_VERSION" ] ; then
1657 echo "Qt is not requested"
1659 echo "Requested Qt version is $QT_VERSION"
1664 if [ ! -z "$installed_glib_version" -a \
1665 "$installed_glib_version" != "$GLIB_VERSION" ] ; then
1666 echo "Installed GLib version is $installed_glib_version"
1667 if [ -z "$GLIB_VERSION" ] ; then
1668 echo "GLib is not requested"
1670 echo "Requested GLib version is $GLIB_VERSION"
1675 if [ ! -z "$installed_pkg_config_version" -a \
1676 "$installed_pkg_config_version" != "$PKG_CONFIG_VERSION" ] ; then
1677 echo "Installed pkg-config version is $installed_pkg_config_version"
1678 if [ -z "$PKG_CONFIG_VERSION" ] ; then
1679 echo "pkg-config is not requested"
1681 echo "Requested pkg-config version is $PKG_CONFIG_VERSION"
1683 uninstall_pkg_config -r
1686 if [ ! -z "$installed_gettext_version" -a \
1687 "$installed_gettext_version" != "$GETTEXT_VERSION" ] ; then
1688 echo "Installed GNU gettext version is $installed_gettext_version"
1689 if [ -z "$GETTEXT_VERSION" ] ; then
1690 echo "GNU gettext is not requested"
1692 echo "Requested GNU gettext version is $GETTEXT_VERSION"
1694 uninstall_gettext -r
1697 if [ ! -z "$installed_cmake_version" -a \
1698 "$installed_cmake_version" != "$CMAKE_VERSION" ] ; then
1699 echo "Installed CMake version is $installed_cmake_version"
1700 if [ -z "$CMAKE_VERSION" ] ; then
1701 echo "CMake is not requested"
1703 echo "Requested CMake version is $CMAKE_VERSION"
1706 # XXX - really remove this?
1707 # Or should we remember it as installed only if this script
1713 if [ ! -z "$installed_libtool_version" -a \
1714 "$installed_libtool_version" != "$LIBTOOL_VERSION" ] ; then
1715 echo "Installed GNU libtool version is $installed_libtool_version"
1716 if [ -z "$LIBTOOL_VERSION" ] ; then
1717 echo "GNU libtool is not requested"
1719 echo "Requested GNU libtool version is $LIBTOOL_VERSION"
1721 uninstall_libtool -r
1724 if [ ! -z "$installed_automake_version" -a \
1725 "$installed_automake_version" != "$AUTOMAKE_VERSION" ] ; then
1726 echo "Installed GNU automake version is $installed_automake_version"
1727 if [ -z "$AUTOMAKE_VERSION" ] ; then
1728 echo "GNU automake is not requested"
1730 echo "Requested GNU automake version is $AUTOMAKE_VERSION"
1732 uninstall_automake -r
1735 if [ ! -z "$installed_autoconf_version" -a \
1736 "$installed_autoconf_version" != "$AUTOCONF_VERSION" ] ; then
1737 echo "Installed GNU autoconf version is $installed_autoconf_version"
1738 if [ -z "$AUTOCONF_VERSION" ] ; then
1739 echo "GNU autoconf is not requested"
1741 echo "Requested GNU autoconf version is $AUTOCONF_VERSION"
1743 uninstall_autoconf -r
1746 if [ ! -z "$installed_xz_version" -a \
1747 "$installed_xz_version" != "$XZ_VERSION" ] ; then
1748 echo "Installed xz version is $installed_xz_version"
1749 if [ -z "$XZ_VERSION" ] ; then
1750 echo "xz is not requested"
1752 echo "Requested xz version is $XZ_VERSION"
1758 # Start with xz: It is the sole download format of glib later than 2.31.2
1771 # Start with GNU gettext; GLib requires it, and OS X doesn't have it
1772 # or a BSD-licensed replacement.
1774 # At least on Lion with Xcode 4, _FORTIFY_SOURCE gets defined as 2
1775 # by default, which causes, for example, stpncpy to be defined as
1776 # a hairy macro that collides with the GNU gettext configure script's
1777 # attempts to workaround AIX's lack of a declaration for stpncpy,
1778 # with the result being a huge train wreck. Define _FORTIFY_SOURCE
1779 # as 0 in an attempt to keep the trains on separate tracks.
1784 # GLib depends on pkg-config.
1785 # By default, pkg-config depends on GLib; we break the dependency cycle
1786 # by configuring pkg-config to use its own internal version of GLib.
1793 # Now we have reached a point where we can build everything but
1794 # the GUI (Wireshark).
1798 if [ "$GTK_VERSION" ]; then
1800 # GTK+ 3 requires a newer Cairo build than the one that comes with
1801 # 10.6, so we build Cairo if we are using GTK+ 3.
1803 # In 10.6 and 10.7, it's an X11 library; if we build with "native" GTK+
1804 # rather than X11 GTK+, we might have to build and install Cairo.
1805 # In 10.8 and later, there is no X11, but it's included in Xquartz;
1806 # again, if we build with "native" GTK+, we'd have to build and install
1809 if [[ "$GTK_MAJOR_VERSION" -eq 3 || "$cairo_not_in_the_os" = yes ]]; then
1811 # Requirements for Cairo first
1813 # The libpng that comes with the X11 for Leopard has a bogus
1814 # pkg-config file that lies about where the header files are,
1815 # which causes other packages not to be able to find its
1818 # The libpng in later versions is not what the version of
1819 # libpixman we build below wants - it wants libpng15.
1824 # The libpixman versions that come with the X11s for Leopard,
1825 # Snow Leopard, and Lion is too old to support Cairo's image
1826 # surface backend feature (which requires pixman-1 >= 0.22.0).
1828 # XXX - what about the one that comes with the latest version
1834 # And now Cairo itself.
1835 # XXX - with the libxcb that comes with 10.6,
1836 # xcb_discard_reply() is missing, and the build fails.
1851 # Now we have reached a point where we can build everything including
1852 # the GUI (Wireshark), but not with any optional features such as
1853 # SNMP OID resolution, some forms of decryption, Lua scripting, playback
1854 # of audio, or GeoIP mapping of IP addresses.
1856 # We now conditionally download optional libraries to support them;
1857 # the default is to download them all.
1862 install_libgpg_error
1880 if [ -d macosx-support-libs ]
1882 cd macosx-support-libs
1885 # Uninstall items in the reverse order from the order in which they're
1886 # installed. Only uninstall if the download/build/install process
1887 # completed; uninstall the version that appears in the name of
1890 # We also do a "make distclean", so that we don't have leftovers from
1891 # old configurations.
1907 uninstall_libgpg_error
1913 uninstall_gdk_pixbuf
1929 uninstall_pkg_config
1934 # XXX - really remove this?
1935 # Or should we remember it as installed only if this script
1951 # Do we have permission to write in /usr/local?
1953 # If so, assume we have permission to write in its subdirectories.
1954 # (If that's not the case, this test needs to check the subdirectories
1957 # If not, do "make install", "make uninstall", the removes for Lua,
1958 # and the renames of [g]libtool* with sudo.
1960 if [ -w /usr/local ]
1962 DO_MAKE_INSTALL="make install"
1963 DO_MAKE_UNINSTALL="make uninstall"
1967 DO_MAKE_INSTALL="sudo make install"
1968 DO_MAKE_UNINSTALL="sudo make uninstall"
1974 # If we have SDKs available, the default target OS is the major version
1975 # of the one we're running; get that and strip off the third component
1978 for i in /Developer/SDKs \
1979 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
1980 /Library/Developer/CommandLineTools/SDKs
1984 min_osx_target=`sw_vers -productVersion | sed 's/\([0-9]*\)\.\([0-9]*\)\.[0-9]*/\1.\2/'`
1987 # That's also the OS whose SDK we'd be using.
1989 sdk_target=$min_osx_target
1995 # Parse command-line flags:
1998 # -t <target> - build libraries so that they'll work on the specified
1999 # version of OS X and later versions.
2000 # -u - do an uninstall.
2002 while getopts ht:u name
2009 min_osx_target="$OPTARG"
2012 echo "Usage: macosx-setup.sh [ -t <target> ] [ -u ]" 1>&1
2019 # Get the version numbers of installed packages, if any.
2021 if [ -d macosx-support-libs ]
2023 cd macosx-support-libs
2025 installed_xz_version=`ls xz-*-done 2>/dev/null | sed 's/xz-\(.*\)-done/\1/'`
2026 installed_autoconf_version=`ls autoconf-*-done 2>/dev/null | sed 's/autoconf-\(.*\)-done/\1/'`
2027 installed_automake_version=`ls automake-*-done 2>/dev/null | sed 's/automake-\(.*\)-done/\1/'`
2028 installed_libtool_version=`ls libtool-*-done 2>/dev/null | sed 's/libtool-\(.*\)-done/\1/'`
2029 installed_cmake_version=`ls cmake-*-done 2>/dev/null | sed 's/cmake-\(.*\)-done/\1/'`
2030 installed_gettext_version=`ls gettext-*-done 2>/dev/null | sed 's/gettext-\(.*\)-done/\1/'`
2031 installed_pkg_config_version=`ls pkg-config-*-done 2>/dev/null | sed 's/pkg-config-\(.*\)-done/\1/'`
2032 installed_glib_version=`ls glib-*-done 2>/dev/null | sed 's/glib-\(.*\)-done/\1/'`
2033 installed_qt_version=`ls qt-*-done 2>/dev/null | sed 's/qt-\(.*\)-done/\1/'`
2034 installed_libpng_version=`ls libpng-*-done 2>/dev/null | sed 's/libpng-\(.*\)-done/\1/'`
2035 installed_pixman_version=`ls pixman-*-done 2>/dev/null | sed 's/pixman-\(.*\)-done/\1/'`
2036 installed_cairo_version=`ls cairo-*-done 2>/dev/null | sed 's/cairo-\(.*\)-done/\1/'`
2037 installed_atk_version=`ls atk-*-done 2>/dev/null | sed 's/atk-\(.*\)-done/\1/'`
2038 installed_pango_version=`ls pango-*-done 2>/dev/null | sed 's/pango-\(.*\)-done/\1/'`
2039 installed_gdk_pixbuf_version=`ls gdk-pixbuf-*-done 2>/dev/null | sed 's/gdk-pixbuf-\(.*\)-done/\1/'`
2040 installed_gtk_version=`ls gtk+-*-done 2>/dev/null | sed 's/gtk+-\(.*\)-done/\1/'`
2041 installed_libsmi_version=`ls libsmi-*-done 2>/dev/null | sed 's/libsmi-\(.*\)-done/\1/'`
2042 installed_libgpg_error_version=`ls libgpg-error-*-done 2>/dev/null | sed 's/libgpg-error-\(.*\)-done/\1/'`
2043 installed_libgcrypt_version=`ls libgcrypt-*-done 2>/dev/null | sed 's/libgcrypt-\(.*\)-done/\1/'`
2044 installed_gnutls_version=`ls gnutls-*-done 2>/dev/null | sed 's/gnutls-\(.*\)-done/\1/'`
2045 installed_lua_version=`ls lua-*-done 2>/dev/null | sed 's/lua-\(.*\)-done/\1/'`
2046 installed_portaudio_version=`ls portaudio-*-done 2>/dev/null | sed 's/portaudio-\(.*\)-done/\1/'`
2047 installed_geoip_version=`ls geoip-*-done 2>/dev/null | sed 's/geoip-\(.*\)-done/\1/'`
2048 installed_cares_version=`ls c-ares-*-done 2>/dev/null | sed 's/c-ares-\(.*\)-done/\1/'`
2049 installed_libssh_version=`ls libssh-*-done 2>/dev/null | sed 's/libssh-\(.*\)-done/\1/'`
2052 # If we don't have a versioned -done file for portaudio, but do have
2053 # an unversioned -done file for it, assume the installed version is the
2054 # requested version, and rename the -done file to include that version.
2056 if [ -z "$installed_portaudio_version" -a -f portaudio-done ] ; then
2057 mv portaudio-done portaudio-$PORTAUDIO_VERSION-done
2058 installed_portaudio_version=`ls portaudio-*-done 2>/dev/null | sed 's/portaudio-\(.*\)-done/\1/'`
2064 if [ "$do_uninstall" = "yes" ]
2071 # Configure scripts tend to set CFLAGS and CXXFLAGS to "-g -O2" if
2072 # invoked without CFLAGS or CXXFLAGS being set in the environment.
2074 # However, we *are* setting them in the environment, for our own
2075 # nefarious purposes, so start them out as "-g -O2".
2081 # To make this work on Leopard (rather than working *on* Snow Leopard
2082 # when building *for* Leopard) will take more work.
2084 # For one thing, Leopard's /usr/X11/lib/libXdamage.la claims, at least
2085 # with all software updates applied, that the Xdamage shared library
2086 # is libXdamage.1.0.0.dylib, but it is, in fact, libXdamage.1.1.0.dylib.
2087 # This causes problems when building GTK+, so the script would have to
2090 if [[ $DARWIN_MAJOR_VERSION -le 9 ]]; then
2091 echo "This script does not support any versions of OS X before Snow Leopard" 1>&2
2095 # if no make options are present, set default options
2096 if [ -z "$MAKE_BUILD_OPTS" ] ; then
2097 # by default use 1.5x number of cores for parallel build
2098 MAKE_BUILD_OPTS="-j $(( $(sysctl -n hw.logicalcpu) * 3 / 2))"
2102 # If we have a target release, look for the oldest SDK that's for an
2103 # OS equal to or later than that one, and build libraries against it
2104 # rather than against the headers and, more importantly, libraries
2105 # that come with the OS, so that we don't end up with support libraries
2106 # that only work on the OS version on which we built them, not earlier
2107 # versions of the same release, or earlier releases if the minimum is
2110 if [ ! -z "$min_osx_target" ]
2113 # Get the real version - strip off the "10.".
2114 # We'll worry about that if, as, and when there's ever
2117 deploy_real_version=`echo "$min_osx_target" | sed -n 's/10\.\(.*\)/\1/p'`
2120 # Search each directory that might contain SDKs.
2123 for sdksdir in /Developer/SDKs \
2124 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
2125 /Library/Developer/CommandLineTools/SDKs
2128 # Get a list of all the SDKs.
2130 if ! test -d "$sdksdir"
2133 # There is no directory with that name.
2134 # Move on to the next one in the list, if any.
2140 # Get a list of all the SDKs in that directory, if any.
2142 sdklist=`(cd "$sdksdir"; ls -d MacOSX10.[0-9]*.sdk 2>/dev/null)`
2147 # Get the real version for this SDK.
2149 sdk_real_version=`echo "$sdk" | sed -n 's/MacOSX10\.\(.*\)\.sdk/\1/p'`
2152 # Is it for the deployment target or some later release?
2154 if test "$sdk_real_version" -ge "$deploy_real_version"
2159 sdkpath="$sdksdir/$sdk"
2160 qt_sdk_arg="-sdk $sdk"
2166 if [ -z "$sdkpath" ]
2168 echo "macosx-setup.sh: Couldn't find an SDK for OS X $min_osx_target or later" 1>&2
2173 sdk_target=10.$sdk_real_version
2174 echo "Using the 10.$sdk_real_version SDK"
2177 # Make sure there are links to /usr/local/include and /usr/local/lib
2178 # in the SDK's usr/local.
2180 if [ ! -e $SDKPATH/usr/local/include ]
2182 if [ ! -d $SDKPATH/usr/local ]
2184 sudo mkdir $SDKPATH/usr/local
2186 sudo ln -s /usr/local/include $SDKPATH/usr/local/include
2188 if [ ! -e $SDKPATH/usr/local/lib ]
2190 if [ ! -d $SDKPATH/usr/local ]
2192 sudo mkdir $SDKPATH/usr/local
2194 sudo ln -s /usr/local/lib $SDKPATH/usr/local/lib
2198 # Set the minimum OS version for which to build to the specified
2199 # minimum target OS version, so we don't, for example, end up using
2200 # linker features supported by the OS verson on which we're building
2201 # but not by the target version.
2203 VERSION_MIN_FLAGS="-mmacosx-version-min=$min_osx_target"
2206 # Compile and link against the SDK.
2208 SDKFLAGS="-isysroot $SDKPATH"
2210 if [[ "$min_osx_target" == "10.5" ]]
2213 # Cairo is part of Mac OS X 10.6 and later.
2214 # The *headers* are supplied by 10.5, but the *libraries*
2215 # aren't, so we have to build it if we're building for 10.5.
2217 cairo_not_in_the_os=yes
2220 # Build with older versions of the support libraries, as
2221 # were used on the Wireshark Leopard buildbot at one
2222 # point. (Most of these versions come from the About page
2223 # from Wireshark 1.8.6, the last build done on that buildbot;
2224 # the ATK version isn't reported, so this is a guess.)
2226 # If you want to try building with newer versions of
2227 # the libraries, note that:
2229 # The version of fontconfig that comes with Leopard doesn't
2230 # support FC_WEIGHT_EXTRABLACK, so we can't use any version
2231 # of Pango newer than 1.22.4.
2233 # However, Pango 1.22.4 doesn't work with versions of GLib
2234 # after 2.29.6, because Pango 1.22.4 uses G_CONST_RETURN and
2235 # GLib 2.29.8 and later deprecate it (there doesn't appear to
2236 # be a GLib 2.29.7). That means we'd either have to patch
2237 # Pango not to use it (just use "const"; G_CONST_RETURN was
2238 # there to allow code to choose whether to use "const" or not),
2239 # or use GLib 2.29.6 or earlier.
2241 # GLib 2.29.6 includes an implementation of g_bit_lock() that,
2242 # on x86 (32-bit and 64-bit), uses asms in a fashion
2243 # ("asm volatile goto") that requires GCC 4.5 or later, which
2244 # is later than the compilers that come with Leopard and Snow
2245 # Leopard. Recent versions of GLib check for that, but 2.29.6
2246 # doesn't, so, if you want to build GLib 2.29.6 on Leopard or
2247 # Snow Leopard, you would have to patch glib/gbitlock.c to do
2248 # what the newer versions of GLib do:
2250 # define a USE_ASM_GOTO macro that indicates whether "asm goto"
2252 # #if (defined (i386) || defined (__amd64__))
2253 # #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
2254 # #define USE_ASM_GOTO 1
2258 # replace all occurrences of
2260 # #if defined (__GNUC__) && (defined (i386) || defined (__amd64__))
2264 # #ifdef USE_ASM_GOTO
2266 # Using GLib 2.29.6 or earlier, however, means that we can't
2267 # use a version of ATK later than 2.3.93, as those versions
2268 # don't work with GLib 2.29.6. The same applies to gdk-pixbuf;
2269 # versions of gdk-pixbuf after 2.24.1 won't work with GLib
2272 # Then you have to make sure that what you've build doesn't
2273 # cause the X server that comes with Leopard to crash; at
2274 # least one attempt at building for Leopard did.
2276 # At least if building on Leopard, you might also find
2277 # that, with various older versions of Cairo, including
2278 # 1.6.4 and at least some 1.8.x versions, when you try to
2279 # build it, the build fails because it can't find
2280 # png_set_longjmp_fn(). I vaguely remember dealing with that,
2281 # ages ago, but don't remember what I did.
2284 if [ "$CAIRO_VERSION" ]
2288 if [ "$ATK_VERSION" ]
2292 if [ "$PANGO_VERSION" ]
2294 PANGO_VERSION=1.20.2
2296 if [ "$GTK_VERSION" ]
2302 # That version of GTK+ includes gdk-pixbuf.
2303 # XXX - base this on the version of GTK+ requested.
2308 # Libgcrypt 1.5.0 fails to compile due to some problem with an
2309 # asm in rijndael.c, at least with i686-apple-darwin10-gcc-4.2.1
2310 # (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) when building
2313 # We try libgcrypt 1.4.3 instead, as that's what shows up in
2314 # the version from the Leopard buildbot.
2315 LIBGCRYPT_VERSION=1.4.3
2318 # Build 32-bit while we're at it; Leopard has a bug that
2319 # causes some BPF functions not to work with 64-bit userland
2320 # code, so capturing won't work.
2322 CFLAGS="$CFLAGS -arch i386"
2323 CXXFLAGS="$CXXFLAGS -arch i386"
2324 export LDFLAGS="$LDFLAGS -arch i386"
2332 # You need Xcode or the command-line tools installed to get the compilers.
2334 if [ ! -x /usr/bin/xcodebuild ]; then
2335 echo "Please install Xcode first (should be available on DVD or from the Mac App Store)."
2339 if [ "$QT_VERSION" ]; then
2341 # We need Xcode, not just the command-line tools, installed to build
2344 # At least with Xcode 8, /usr/bin/xcodebuild --help fails if only
2345 # the command-line tools are installed and succeeds if Xcode is
2346 # installed. Unfortunately, it fails *with* Xcode 3, but
2347 # /usr/bin/xcodebuild -version works with that and with Xcode 8.
2348 # Hopefully it fails with only the command-line tools installed.
2350 if /usr/bin/xcodebuild -version >/dev/null 2>&1; then
2353 echo "Please install Xcode first (should be available on DVD or from the Mac App Store)."
2354 echo "The command-line build tools are not sufficient to build Qt."
2358 if [ "$GTK_VERSION" ]; then
2360 # If we're building with GTK+, you also need the X11 SDK; with at least
2361 # some versions of OS X and Xcode, that is, I think, an optional install.
2362 # (Or it might be installed with X11, but I think *that* is an optional
2363 # install on at least some versions of OS X.)
2365 if [ ! -d /usr/X11/include ]; then
2366 echo "Please install X11 and the X11 SDK first."
2367 echo " You can either download the latest package from"
2368 echo " http://www.xquartz.org/ and install it or install"
2369 echo " the native Apple package if you are on Lion or below."
2374 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig
2377 # Do all the downloads and untarring in a subdirectory, so all that
2378 # stuff can be removed once we've installed the support libraries.
2380 if [ ! -d macosx-support-libs ]
2382 mkdir macosx-support-libs || exit 1
2384 cd macosx-support-libs
2391 # Indicate what paths to use for pkg-config and cmake.
2393 pkg_config_path=/usr/local/lib/pkgconfig
2394 if [ "$QT_VERSION" ]; then
2395 qt_base_path=$HOME/Qt$QT_VERSION/$QT_MAJOR_MINOR_VERSION/clang_64
2396 pkg_config_path="$pkg_config_path":"$qt_base_path/lib/pkgconfig"
2397 CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH":"$qt_base_path/lib/cmake"
2399 pkg_config_path="$pkg_config_path":/usr/X11/lib/pkgconfig
2401 echo "You are now prepared to build Wireshark."
2403 if [[ $CMAKE ]]; then
2404 echo "To build with CMAKE:"
2406 echo "export PKG_CONFIG_PATH=$pkg_config_path"
2407 echo "export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH"
2408 echo "export PATH=$PATH:$qt_base_path/bin"
2410 echo "mkdir build; cd build"
2412 echo "make $MAKE_BUILD_OPTS app_bundle"
2413 echo "make install/strip"
2416 if [[ $AUTOTOOLS ]]; then
2417 echo "To build with AUTOTOOLS:"
2419 echo "export PKG_CONFIG_PATH=$pkg_config_path"
2422 echo "mkdir build; cd build"
2424 echo "make $MAKE_BUILD_OPTS"
2428 echo "Make sure you are allowed capture access to the network devices"
2429 echo "See: https://wiki.wireshark.org/CaptureSetup/CapturePrivileges"