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
134 # XXX - they appear to have an unversioned gzipped tarball for the
135 # current version; should we just download that, with some other
136 # way of specifying whether to download the GeoIP API?
144 NGHTTP2_VERSION=1.14.0
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, and the Snow Leopard version is too old for
151 # current Wireshark, so we install them unconditionally.
153 AUTOCONF_VERSION=2.69
154 AUTOMAKE_VERSION=1.13.3
155 LIBTOOL_VERSION=2.4.6
158 if [ "$XZ_VERSION" -a ! -f xz-$XZ_VERSION-done ] ; then
159 echo "Downloading, building, and installing xz:"
160 [ -f xz-$XZ_VERSION.tar.bz2 ] || curl -O http://tukaani.org/xz/xz-$XZ_VERSION.tar.bz2 || exit 1
161 bzcat xz-$XZ_VERSION.tar.bz2 | tar xf - || exit 1
163 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0" ./configure || exit 1
164 make $MAKE_BUILD_OPTS || exit 1
165 $DO_MAKE_INSTALL || exit 1
167 touch xz-$XZ_VERSION-done
172 if [ ! -z "$installed_xz_version" ] ; then
173 echo "Uninstalling xz:"
174 cd xz-$installed_xz_version
175 $DO_MAKE_UNINSTALL || exit 1
176 make distclean || exit 1
178 rm xz-$installed_xz_version-done
180 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
182 # Get rid of the previously downloaded and unpacked version.
184 rm -rf xz-$installed_xz_version
185 rm -rf xz-$installed_xz_version.tar.bz2
188 installed_xz_version=""
193 if [ "$SNAPPY_VERSION" -a ! -f snappy-$SNAPPY_VERSION-done ] ; then
194 echo "Downloading, building, and installing snappy:"
195 [ -f snappy-$SNAPPY_VERSION.tar.gz ] || curl -L -O https://github.com/google/snappy/releases/download/$SNAPPY_VERSION/snappy-$SNAPPY_VERSION.tar.gz || exit 1
196 gzcat snappy-$SNAPPY_VERSION.tar.gz | tar xf - || exit 1
197 cd snappy-$SNAPPY_VERSION
198 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0" ./configure || exit 1
199 make $MAKE_BUILD_OPTS || exit 1
200 $DO_MAKE_INSTALL || exit 1
202 touch snappy-$SNAPPY_VERSION-done
207 if [ ! -z "$installed_snappy_version" ] ; then
208 echo "Uninstalling snappy:"
209 cd snappy-$installed_snappy_version
210 $DO_MAKE_UNINSTALL || exit 1
211 make distclean || exit 1
213 rm snappy-$installed_snappy_version-done
215 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
217 # Get rid of the previously downloaded and unpacked version.
219 rm -rf snappy-$installed_snappy_version
220 rm -rf snappy-$installed_snappy_version.tar.gz
223 installed_snappy_version=""
228 if [ "$LZ4_VERSION" -a ! -f lz4-$LZ4_VERSION-done ] ; then
229 echo "Downloading, building, and installing lz4:"
230 [ -f lz4-$LZ4_VERSION.tar.gz ] || curl -L -o lz4-$LZ4_VERSION.tar.gz https://github.com/lz4/lz4/archive/$LZ4_VERSION.tar.gz || exit 1
231 gzcat lz4-$LZ4_VERSION.tar.gz | tar xf - || exit 1
233 # CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0" ./configure || exit 1
234 make $MAKE_BUILD_OPTS || exit 1
235 $DO_MAKE_INSTALL || exit 1
237 touch lz4-$LZ4_VERSION-done
242 if [ ! -z "$installed_lz4_version" ] ; then
243 echo "Uninstalling lz4:"
244 cd lz4-$installed_lz4_version
245 $DO_MAKE_UNINSTALL || exit 1
246 make distclean || exit 1
248 rm lz4-$installed_lz4_version-done
250 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
252 # Get rid of the previously downloaded and unpacked version.
254 rm -rf lz4-$installed_lz4_version
255 rm -rf lz4-$installed_lz4_version.tar.gz
258 installed_lz4_version=""
263 if [ "$SBC_VERSION" -a ! -f sbc-$SBC_VERSION-done ] ; then
264 echo "Downloading, building, and installing sbc:"
265 [ -f sbc-$SBC_VERSION.tar.gz ] || curl -O https://www.kernel.org/pub/linux/bluetooth/sbc-$SBC_VERSION.tar.gz || exit 1
266 gzcat sbc-$SBC_VERSION.tar.gz | tar xf - || exit 1
268 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0" ./configure --disable-tools --disable-tester --disable-shared || exit 1
269 make $MAKE_BUILD_OPTS || exit 1
270 $DO_MAKE_INSTALL || exit 1
272 touch sbc-$SBC_VERSION-done
277 if [ ! -z "$installed_sbc_version" ] ; then
278 echo "Uninstalling sbc:"
279 cd sbc-$installed_sbc_version
280 $DO_MAKE_UNINSTALL || exit 1
281 make distclean || exit 1
283 rm sbc-$installed_sbc_version-done
285 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
287 # Get rid of the previously downloaded and unpacked version.
289 rm -rf sbc-$installed_sbc_version
290 rm -rf sbc-$installed_sbc_version.tar.gz
293 installed_sbc_version=""
298 if [ "$AUTOCONF_VERSION" -a ! -f autoconf-$AUTOCONF_VERSION-done ] ; then
299 echo "Downloading, building and installing GNU autoconf..."
300 [ -f autoconf-$AUTOCONF_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/autoconf/autoconf-$AUTOCONF_VERSION.tar.xz || exit 1
301 xzcat autoconf-$AUTOCONF_VERSION.tar.xz | tar xf - || exit 1
302 cd autoconf-$AUTOCONF_VERSION
303 ./configure || exit 1
304 make $MAKE_BUILD_OPTS || exit 1
305 $DO_MAKE_INSTALL || exit 1
307 touch autoconf-$AUTOCONF_VERSION-done
311 uninstall_autoconf() {
312 if [ ! -z "$installed_autoconf_version" ] ; then
314 # automake and libtool depend on this, so uninstall them.
319 echo "Uninstalling GNU autoconf:"
320 cd autoconf-$installed_autoconf_version
321 $DO_MAKE_UNINSTALL || exit 1
322 make distclean || exit 1
324 rm autoconf-$installed_autoconf_version-done
326 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
328 # Get rid of the previously downloaded and unpacked version.
330 rm -rf autoconf-$installed_autoconf_version
331 rm -rf autoconf-$installed_autoconf_version.tar.xz
334 installed_autoconf_version=""
339 if [ "$AUTOMAKE_VERSION" -a ! -f automake-$AUTOMAKE_VERSION-done ] ; then
340 echo "Downloading, building and installing GNU automake..."
341 [ -f automake-$AUTOMAKE_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/automake/automake-$AUTOMAKE_VERSION.tar.xz || exit 1
342 xzcat automake-$AUTOMAKE_VERSION.tar.xz | tar xf - || exit 1
343 cd automake-$AUTOMAKE_VERSION
344 ./configure || exit 1
345 make $MAKE_BUILD_OPTS || exit 1
346 $DO_MAKE_INSTALL || exit 1
348 touch automake-$AUTOMAKE_VERSION-done
352 uninstall_automake() {
353 if [ ! -z "$installed_automake_version" ] ; then
355 # libtool depends on this(?), so uninstall it.
357 uninstall_libtool "$@"
359 echo "Uninstalling GNU automake:"
360 cd automake-$installed_automake_version
361 $DO_MAKE_UNINSTALL || exit 1
362 make distclean || exit 1
364 rm automake-$installed_automake_version-done
366 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
368 # Get rid of the previously downloaded and unpacked version.
370 rm -rf automake-$installed_automake_version
371 rm -rf automake-$installed_automake_version.tar.xz
374 installed_automake_version=""
379 if [ "$LIBTOOL_VERSION" -a ! -f libtool-$LIBTOOL_VERSION-done ] ; then
380 echo "Downloading, building and installing GNU libtool..."
381 [ -f libtool-$LIBTOOL_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/libtool/libtool-$LIBTOOL_VERSION.tar.xz || exit 1
382 xzcat libtool-$LIBTOOL_VERSION.tar.xz | tar xf - || exit 1
383 cd libtool-$LIBTOOL_VERSION
384 ./configure || exit 1
385 make $MAKE_BUILD_OPTS || exit 1
386 $DO_MAKE_INSTALL || exit 1
387 $DO_MV /usr/local/bin/libtool /usr/local/bin/glibtool
388 $DO_MV /usr/local/bin/libtoolize /usr/local/bin/glibtoolize
390 touch libtool-$LIBTOOL_VERSION-done
394 uninstall_libtool() {
395 if [ ! -z "$installed_libtool_version" ] ; then
396 echo "Uninstalling GNU libtool:"
397 cd libtool-$installed_libtool_version
398 $DO_MV /usr/local/bin/glibtool /usr/local/bin/libtool
399 $DO_MV /usr/local/bin/glibtoolize /usr/local/bin/libtoolize
400 $DO_MAKE_UNINSTALL || exit 1
401 make distclean || exit 1
403 rm libtool-$installed_libtool_version-done
405 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
407 # Get rid of the previously downloaded and unpacked version.
409 rm -rf libtool-$installed_libtool_version
410 rm -rf libtool-$installed_libtool_version.tar.xz
413 installed_libtool_version=""
418 if [ -n "$CMAKE" -a ! -f cmake-$CMAKE_VERSION-done ]; then
419 echo "Downloading and installing CMake:"
420 CMAKE_MAJOR_VERSION="`expr $CMAKE_VERSION : '\([0-9][0-9]*\).*'`"
421 CMAKE_MINOR_VERSION="`expr $CMAKE_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
422 CMAKE_DOTDOT_VERSION="`expr $CMAKE_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
423 CMAKE_MAJOR_MINOR_VERSION=$CMAKE_MAJOR_VERSION.$CMAKE_MINOR_VERSION
426 # NOTE: the "64" in "Darwin64" doesn't mean "64-bit-only"; the
427 # package in question supports both 32-bit and 64-bit x86.
429 case "$CMAKE_MAJOR_VERSION" in
432 echo "CMake $CMAKE_VERSION" is too old 1>&2
437 # Download the DMG, run the installer.
439 [ -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
440 sudo hdiutil attach cmake-$CMAKE_VERSION-Darwin64-universal.dmg || exit 1
441 sudo installer -target / -pkg /Volumes/cmake-$CMAKE_VERSION-Darwin64-universal/cmake-$CMAKE_VERSION-Darwin64-universal.pkg || exit 1
442 sudo hdiutil detach /Volumes/cmake-$CMAKE_VERSION-Darwin64-universal
447 # Download the DMG and do a drag install, where "drag" means
450 # 3.0.* and 3.1.0 have a Darwin64-universal DMG.
451 # 3.1.1 and later have a Darwin-x86_64 DMG.
452 # Probably not many people are still developing on 32-bit
453 # Macs, so we don't worry about them.
455 if [ "$CMAKE_MINOR_VERSION" = 0 -o \
456 "$CMAKE_VERSION" = 3.1.0 ]; then
457 type="Darwin64-universal"
461 [ -f cmake-$CMAKE_VERSION-$type.dmg ] || curl -O https://cmake.org/files/v$CMAKE_MAJOR_MINOR_VERSION/cmake-$CMAKE_VERSION-$type.dmg || exit 1
462 sudo hdiutil attach cmake-$CMAKE_VERSION-$type.dmg || exit 1
463 sudo ditto /Volumes/cmake-$CMAKE_VERSION-$type/CMake.app /Applications/CMake.app || exit 1
466 # Plant the appropriate symbolic links in /usr/local/bin.
467 # It's a drag-install, so there's no installer to make them,
468 # and the CMake code to put them in place is lame, as
470 # 1) it defaults to /usr/bin, not /usr/local/bin;
471 # 2) it doesn't request the necessary root privileges;
472 # 3) it can't be run from the command line;
474 # so we do it ourselves.
476 for i in ccmake cmake cmake-gui cmakexbuild cpack ctest
478 sudo ln -s /Applications/CMake.app/Contents/bin/$i /usr/local/bin/$i
480 sudo hdiutil detach /Volumes/cmake-$CMAKE_VERSION-$type
486 touch cmake-$CMAKE_VERSION-done
491 if [ ! -z "$installed_cmake_version" ]; then
492 echo "Uninstalling CMake:"
493 installed_cmake_major_version="`expr $installed_cmake_version : '\([0-9][0-9]*\).*'`"
494 case "$installed_cmake_major_version" in
497 echo "CMake $installed_cmake_version" is too old 1>&2
501 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
502 for i in ccmake cmake cmake-gui cmakexbuild cpack ctest
504 sudo rm -f /usr/bin/$i /usr/local/bin/$i
506 sudo pkgutil --forget com.Kitware.CMake
507 rm cmake-$installed_cmake_version-done
511 sudo rm -rf /Applications/CMake.app
512 for i in ccmake cmake cmake-gui cmakexbuild cpack ctest
514 sudo rm -f /usr/local/bin/$i
516 rm cmake-$installed_cmake_version-done
520 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
522 # Get rid of the previously downloaded and unpacked version,
523 # whatever it might happen to be called.
525 rm -f cmake-$installed_cmake_version-Darwin64-universal.dmg
526 rm -f cmake-$installed_cmake_version-Darwin-x86_64.dmg
529 installed_cmake_version=""
534 if [ ! -f gettext-$GETTEXT_VERSION-done ] ; then
535 echo "Downloading, building, and installing GNU gettext:"
536 [ -f gettext-$GETTEXT_VERSION.tar.gz ] || curl -O http://ftp.gnu.org/pub/gnu/gettext/gettext-$GETTEXT_VERSION.tar.gz || exit 1
537 gzcat gettext-$GETTEXT_VERSION.tar.gz | tar xf - || exit 1
538 cd gettext-$GETTEXT_VERSION
539 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0 $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
540 make $MAKE_BUILD_OPTS || exit 1
541 $DO_MAKE_INSTALL || exit 1
543 touch gettext-$GETTEXT_VERSION-done
547 uninstall_gettext() {
548 if [ ! -z "$installed_gettext_version" ] ; then
550 # GLib depends on this, so uninstall it.
554 echo "Uninstalling GNU gettext:"
555 cd gettext-$installed_gettext_version
556 $DO_MAKE_UNINSTALL || exit 1
557 make distclean || exit 1
559 rm gettext-$installed_gettext_version-done
561 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
563 # Get rid of the previously downloaded and unpacked version.
565 rm -rf gettext-$installed_gettext_version
566 rm -rf gettext-$installed_gettext_version.tar.gz
569 installed_gettext_version=""
573 install_pkg_config() {
574 if [ ! -f pkg-config-$PKG_CONFIG_VERSION-done ] ; then
575 echo "Downloading, building, and installing pkg-config:"
576 [ -f pkg-config-$PKG_CONFIG_VERSION.tar.gz ] || curl -O https://pkgconfig.freedesktop.org/releases/pkg-config-$PKG_CONFIG_VERSION.tar.gz || exit 1
577 gzcat pkg-config-$PKG_CONFIG_VERSION.tar.gz | tar xf - || exit 1
578 cd pkg-config-$PKG_CONFIG_VERSION
579 ./configure --with-internal-glib || exit 1
580 make $MAKE_BUILD_OPTS || exit 1
581 $DO_MAKE_INSTALL || exit 1
583 touch pkg-config-$PKG_CONFIG_VERSION-done
587 uninstall_pkg_config() {
588 if [ ! -z "$installed_pkg_config_version" ] ; then
589 echo "Uninstalling pkg-config:"
590 cd pkg-config-$installed_pkg_config_version
591 $DO_MAKE_UNINSTALL || exit 1
592 make distclean || exit 1
594 rm pkg-config-$installed_pkg_config_version-done
596 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
598 # Get rid of the previously downloaded and unpacked version.
600 rm -rf pkg-config-$installed_pkg_config_version
601 rm -rf pkg-config-$installed_pkg_config_version.tar.gz
604 installed_pkg_config_version=""
609 if [ ! -f glib-$GLIB_VERSION-done ] ; then
610 echo "Downloading, building, and installing GLib:"
611 glib_dir=`expr $GLIB_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
612 GLIB_MAJOR_VERSION="`expr $GLIB_VERSION : '\([0-9][0-9]*\).*'`"
613 GLIB_MINOR_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
614 GLIB_DOTDOT_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
615 if [[ $GLIB_MAJOR_VERSION -gt 2 ||
616 $GLIB_MINOR_VERSION -gt 28 ||
617 ($GLIB_MINOR_VERSION -eq 28 && $GLIB_DOTDOT_VERSION -ge 8) ]]
620 # Starting with GLib 2.28.8, xz-compressed tarballs are available.
622 [ -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
623 xzcat glib-$GLIB_VERSION.tar.xz | tar xf - || exit 1
625 [ -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
626 bzcat glib-$GLIB_VERSION.tar.bz2 | tar xf - || exit 1
628 cd glib-$GLIB_VERSION
630 # OS X ships with libffi, but doesn't provide its pkg-config file;
631 # explicitly specify LIBFFI_CFLAGS and LIBFFI_LIBS, so the configure
632 # script doesn't try to use pkg-config to get the appropriate
633 # C flags and loader flags.
635 # And, what's worse, at least with the version of Xcode that comes
636 # with Leopard, /usr/include/ffi/fficonfig.h doesn't define MACOSX,
637 # which causes the build of GLib to fail. If we don't find
638 # "#define.*MACOSX" in /usr/include/ffi/fficonfig.h, explicitly
641 # While we're at it, suppress -Wformat-nonliteral to avoid a case
642 # where clang's stricter rules on when not to complain about
643 # non-literal format arguments cause it to complain about code
644 # that's safe but it wasn't told that. See my comment #25 in
647 # https://bugzilla.gnome.org/show_bug.cgi?id=691608#c25
649 # First, determine where the system include files are. (It's not
650 # necessarily /usr/include.) There's a bit of a greasy hack here;
651 # pre-5.x versions of the developer tools don't support the
652 # --show-sdk-path option, and will produce no output, so includedir
653 # will be set to /usr/include (in those older versions of the
654 # developer tools, there is a /usr/include directory).
656 includedir=`xcrun --show-sdk-path 2>/dev/null`/usr/include
657 if grep -qs '#define.*MACOSX' $includedir/ffi/fficonfig.h
659 # It's defined, nothing to do
660 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
662 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
666 # Apply the fix to GNOME bug 529806:
668 # https://bugzilla.gnome.org/show_bug.cgi?id=529806
670 # if we have a version of GLib prior to 2.30.
672 if [[ $GLIB_MAJOR_VERSION -eq 2 && $GLIB_MINOR_VERSION -le 30 ]]
674 patch -p0 <../../macosx-support-lib-patches/glib-gconvert.c.patch || exit 1
676 make $MAKE_BUILD_OPTS || exit 1
677 $DO_MAKE_INSTALL || exit 1
679 touch glib-$GLIB_VERSION-done
684 if [ ! -z "$installed_glib_version" ] ; then
686 # ATK, Pango, and GTK depend on this, so uninstall them.
692 echo "Uninstalling GLib:"
693 cd glib-$installed_glib_version
694 $DO_MAKE_UNINSTALL || exit 1
695 make distclean || exit 1
697 rm glib-$installed_glib_version-done
699 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
701 # Get rid of the previously downloaded and unpacked version.
703 rm -rf glib-$installed_glib_version
704 rm -rf glib-$installed_glib_version.tar.xz glib-$installed_glib_version.tar.bz2
707 installed_glib_version=""
712 if [ "$QT_VERSION" -a ! -f qt-$QT_VERSION-done ]; then
713 echo "Downloading, building, and installing Qt:"
715 # What you get for this URL might just be a 302 Found reply, so use
716 # -L so we get redirected.
718 if [ "$QT_MAJOR_VERSION" -ge 5 ]
720 QT_VOLUME=qt-opensource-mac-x64-clang-$QT_VERSION
722 QT_VOLUME=qt-opensource-mac-$QT_VERSION
724 [ -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
725 sudo hdiutil attach $QT_VOLUME.dmg || exit 1
727 if [ "$QT_MAJOR_VERSION" -ge 5 ]
730 # Run the installer executable directly, so that we wait for
731 # it to finish. Then unmount the volume.
733 /Volumes/$QT_VOLUME/$QT_VOLUME.app/Contents/MacOS/$QT_VOLUME
734 sudo hdiutil detach /Volumes/$QT_VOLUME
737 # Open the installer package; use -W, so that we wait for
738 # the installer to finish. Then unmount the volume.
740 open -W "/Volumes/Qt $QT_MAJOR_MINOR_DOTDOT_VERSION/Qt.mpkg"
741 sudo hdiutil detach "/Volumes/Qt $QT_MAJOR_MINOR_DOTDOT_VERSION"
745 # Versions 5.3.x through 5.5.0, at least, have bogus .pc files.
746 # See bugs QTBUG-35256 and QTBUG-47162.
750 for i in $HOME/Qt$QT_VERSION/$QT_MAJOR_MINOR_VERSION/clang_64/lib/pkgconfig/*.pc
754 g/Cflags: /s;;Cflags: -F\${libdir} ;
755 g/Cflags: /s;-I\${includedir}/Qt\([a-zA-Z0-9_]*\);-I\${libdir}/Qt\1.framework/Versions/5/Headers;
761 touch qt-$QT_VERSION-done
766 if [ ! -z "$installed_qt_version" ] ; then
767 echo "Uninstalling Qt:"
768 rm -rf $HOME/Qt$installed_qt_version
769 rm qt-$installed_qt_version-done
771 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
773 # Get rid of the previously downloaded version.
775 rm -rf qt-opensource-mac-x64-clang-$installed_qt_version.dmg
778 installed_qt_version=""
783 if [ ! -f libpng-$PNG_VERSION-done ] ; then
784 echo "Downloading, building, and installing libpng:"
786 # The FTP site puts libpng x.y.* into a libpngxy directory.
788 subdir=`echo $PNG_VERSION | sed 's/\([1-9][0-9]*\)\.\([1-9][0-9]*\).*/libpng\1\2'/`
789 [ -f libpng-$PNG_VERSION.tar.xz ] || curl -O ftp://ftp.simplesystems.org/pub/libpng/png/src/$subdir/libpng-$PNG_VERSION.tar.xz
790 xzcat libpng-$PNG_VERSION.tar.xz | tar xf - || exit 1
791 cd libpng-$PNG_VERSION
792 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
793 make $MAKE_BUILD_OPTS || exit 1
794 $DO_MAKE_INSTALL || exit 1
796 touch libpng-$PNG_VERSION-done
801 if [ ! -z "$installed_libpng_version" ] ; then
803 # Cairo depends on this, so uninstall it.
807 echo "Uninstalling libpng:"
808 cd libpng-$installed_libpng_version
809 $DO_MAKE_UNINSTALL || exit 1
810 make distclean || exit 1
812 rm libpng-$installed_libpng_version-done
814 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
816 # Get rid of the previously downloaded and unpacked version.
818 rm -rf libpng-$installed_libpng_version
819 rm -rf libpng-$installed_libpng_version.tar.xz
822 installed_libpng_version=""
827 if [ ! -f pixman-$PIXMAN_VERSION-done ] ; then
828 echo "Downloading, building, and installing pixman:"
829 [ -f pixman-$PIXMAN_VERSION.tar.gz ] || curl -O http://www.cairographics.org/releases/pixman-$PIXMAN_VERSION.tar.gz
830 gzcat pixman-$PIXMAN_VERSION.tar.gz | tar xf - || exit 1
831 cd pixman-$PIXMAN_VERSION
832 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
833 make $MAKE_BUILD_OPTS || exit 1
834 $DO_MAKE_INSTALL || exit 1
836 touch pixman-$PIXMAN_VERSION-done
841 if [ ! -z "$installed_pixman_version" ] ; then
843 # Cairo depends on this, so uninstall it.
847 echo "Uninstalling pixman:"
848 cd pixman-$installed_pixman_version
849 $DO_MAKE_UNINSTALL || exit 1
850 make distclean || exit 1
852 rm pixman-$installed_pixman_version-done
854 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
856 # Get rid of the previously downloaded and unpacked version.
858 rm -rf pixman-$installed_pixman_version
859 rm -rf pixman-$installed_pixman_version.tar.gz
862 installed_pixman_version=""
867 if [ ! -f cairo-$CAIRO_VERSION-done ] ; then
868 echo "Downloading, building, and installing Cairo:"
869 CAIRO_MAJOR_VERSION="`expr $CAIRO_VERSION : '\([0-9][0-9]*\).*'`"
870 CAIRO_MINOR_VERSION="`expr $CAIRO_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
871 CAIRO_DOTDOT_VERSION="`expr $CAIRO_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
872 if [[ $CAIRO_MAJOR_VERSION -gt 1 ||
873 $CAIRO_MINOR_VERSION -gt 12 ||
874 ($CAIRO_MINOR_VERSION -eq 12 && $CAIRO_DOTDOT_VERSION -ge 2) ]]
877 # Starting with Cairo 1.12.2, the tarballs are compressed with
878 # xz rather than gzip.
880 [ -f cairo-$CAIRO_VERSION.tar.xz ] || curl -O http://cairographics.org/releases/cairo-$CAIRO_VERSION.tar.xz || exit 1
881 xzcat cairo-$CAIRO_VERSION.tar.xz | tar xf - || exit 1
883 [ -f cairo-$CAIRO_VERSION.tar.gz ] || curl -O http://cairographics.org/releases/cairo-$CAIRO_VERSION.tar.gz || exit 1
884 gzcat cairo-$CAIRO_VERSION.tar.gz | tar xf - || exit 1
886 cd cairo-$CAIRO_VERSION
887 # CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-quartz=no || exit 1
888 # Maybe follow http://cairographics.org/end_to_end_build_for_mac_os_x/
889 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-quartz=yes || exit 1
891 # We must avoid the version of libpng that comes with X11; the
892 # only way I've found to force that is to forcibly set INCLUDES
893 # when we do the build, so that this comes before CAIRO_CFLAGS,
894 # which has -I/usr/X11/include added to it before anything
895 # connected to libpng is.
897 INCLUDES="-I/usr/local/include/libpng15" make $MAKE_BUILD_OPTS || exit 1
898 $DO_MAKE_INSTALL || exit 1
900 touch cairo-$CAIRO_VERSION-done
905 if [ ! -z "$installed_cairo_version" ] ; then
907 # GTK+ depends on this, so uninstall it.
911 echo "Uninstalling Cairo:"
912 cd cairo-$installed_cairo_version
913 $DO_MAKE_UNINSTALL || exit 1
914 make distclean || exit 1
916 rm cairo-$installed_cairo_version-done
918 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
920 # Get rid of the previously downloaded and unpacked version.
922 rm -rf cairo-$installed_cairo_version
923 rm -rf cairo-$installed_cairo_version.tar.xz cairo-$installed_cairo_version.tar.gz
926 installed_cairo_version=""
931 if [ ! -f atk-$ATK_VERSION-done ] ; then
932 echo "Downloading, building, and installing ATK:"
933 atk_dir=`expr $ATK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
934 ATK_MAJOR_VERSION="`expr $ATK_VERSION : '\([0-9][0-9]*\).*'`"
935 ATK_MINOR_VERSION="`expr $ATK_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
936 ATK_DOTDOT_VERSION="`expr $ATK_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
937 if [[ $ATK_MAJOR_VERSION -gt 2 ||
938 ($ATK_MAJOR_VERSION -eq 2 && $ATK_MINOR_VERSION -gt 0) ||
939 ($ATK_MANOR_VERSION -eq 2 && $ATK_MINOR_VERSION -eq 0 && $ATK_DOTDOT_VERSION -ge 1) ]]
942 # Starting with ATK 2.0.1, xz-compressed tarballs are available.
944 [ -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
945 xzcat atk-$ATK_VERSION.tar.xz | tar xf - || exit 1
947 [ -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
948 bzcat atk-$ATK_VERSION.tar.bz2 | tar xf - || exit 1
951 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
952 make $MAKE_BUILD_OPTS || exit 1
953 $DO_MAKE_INSTALL || exit 1
955 touch atk-$ATK_VERSION-done
960 if [ ! -z "$installed_atk_version" ] ; then
962 # GTK+ depends on this, so uninstall it.
966 echo "Uninstalling ATK:"
967 cd atk-$installed_atk_version
968 $DO_MAKE_UNINSTALL || exit 1
969 make distclean || exit 1
971 rm atk-$installed_atk_version-done
973 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
975 # Get rid of the previously downloaded and unpacked version.
977 rm -rf atk-$installed_atk_version
978 rm -rf atk-$installed_atk_version.tar.xz atk-$installed_atk_version.tar.bz2
981 installed_atk_version=""
986 if [ ! -f pango-$PANGO_VERSION-done ] ; then
987 echo "Downloading, building, and installing Pango:"
988 pango_dir=`expr $PANGO_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
989 PANGO_MAJOR_VERSION="`expr $PANGO_VERSION : '\([0-9][0-9]*\).*'`"
990 PANGO_MINOR_VERSION="`expr $PANGO_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
991 if [[ $PANGO_MAJOR_VERSION -gt 1 ||
992 $PANGO_MINOR_VERSION -ge 29 ]]
995 # Starting with Pango 1.29, the tarballs are compressed with
996 # xz rather than bzip2.
998 [ -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
999 xzcat pango-$PANGO_VERSION.tar.xz | tar xf - || exit 1
1001 [ -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
1002 bzcat pango-$PANGO_VERSION.tar.bz2 | tar xf - || exit 1
1004 cd pango-$PANGO_VERSION
1005 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1006 make $MAKE_BUILD_OPTS || exit 1
1007 $DO_MAKE_INSTALL || exit 1
1009 touch pango-$PANGO_VERSION-done
1014 if [ ! -z "$installed_pango_version" ] ; then
1016 # GTK+ depends on this, so uninstall it.
1020 echo "Uninstalling Pango:"
1021 cd pango-$installed_pango_version
1022 $DO_MAKE_UNINSTALL || exit 1
1023 make distclean || exit 1
1025 rm pango-$installed_pango_version-done
1027 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1029 # Get rid of the previously downloaded and unpacked version.
1031 rm -rf pango-$installed_pango_version
1032 rm -rf pango-$installed_pango_version.tar.xz pango-$installed_pango_version.tar.bz2
1035 installed_pango_version=""
1039 install_gdk_pixbuf() {
1040 if [ "$GDK_PIXBUF_VERSION" -a ! -f gdk-pixbuf-$GDK_PIXBUF_VERSION-done ] ; then
1041 echo "Downloading, building, and installing gdk-pixbuf:"
1042 gdk_pixbuf_dir=`expr $GDK_PIXBUF_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
1043 [ -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
1044 xzcat gdk-pixbuf-$GDK_PIXBUF_VERSION.tar.xz | tar xf - || exit 1
1045 cd gdk-pixbuf-$GDK_PIXBUF_VERSION
1047 # If we're building using the 10.6 SDK, force the use of libpng12.
1049 # The OS's X11, and corresponding SDK, didn't introduce libpng15,
1050 # or pkg-config files, until 10.7, so, for 10.6 have to explicitly
1051 # set LIBPNG to override the configure script, and also force the
1052 # CFLAGS to look for the header files for libpng12 (note that
1053 # -isysroot doesn't affect the arguments to -I, so we need to
1054 # include the SDK path explicitly).
1056 if [[ "$sdk_target" = 10.6 ]]
1058 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
1060 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
1062 make $MAKE_BUILD_OPTS || exit 1
1063 $DO_MAKE_INSTALL || exit 1
1065 touch gdk-pixbuf-$GDK_PIXBUF_VERSION-done
1069 uninstall_gdk_pixbuf() {
1070 if [ ! -z "$installed_gdk_pixbuf_version" ] ; then
1072 # GTK+ depends on this, so uninstall it.
1076 echo "Uninstalling gdk-pixbuf:"
1077 cd gdk-pixbuf-$installed_gdk_pixbuf_version
1078 $DO_MAKE_UNINSTALL || exit 1
1079 make distclean || exit 1
1081 rm gdk-pixbuf-$installed_gdk_pixbuf_version-done
1083 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1085 # Get rid of the previously downloaded and unpacked version.
1087 rm -rf gdk-pixbuf-$installed_gdk_pixbuf_version
1088 rm -rf gdk-pixbuf-$installed_gdk_pixbuf_version.tar.xz
1091 installed_gdk_pixbuf_version=""
1096 if [ ! -f gtk+-$GTK_VERSION-done ] ; then
1097 echo "Downloading, building, and installing GTK+:"
1098 gtk_dir=`expr $GTK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
1099 if [[ $GTK_MAJOR_VERSION -gt 2 ||
1100 $GTK_MINOR_VERSION -gt 24 ||
1101 ($GTK_MINOR_VERSION -eq 24 && $GTK_DOTDOT_VERSION -ge 5) ]]
1104 # Starting with GTK+ 2.24.5, the tarballs are compressed with
1105 # xz rather than gzip, in addition to bzip2; use xz, as we've
1106 # built and installed it, and as xz compresses better than
1107 # bzip2 so the tarballs take less time to download.
1109 [ -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
1110 xzcat gtk+-$GTK_VERSION.tar.xz | tar xf - || exit 1
1112 [ -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
1113 bzcat gtk+-$GTK_VERSION.tar.bz2 | tar xf - || exit 1
1115 cd gtk+-$GTK_VERSION
1116 if [ $DARWIN_MAJOR_VERSION -ge "12" ]
1119 # GTK+ 2.24.10, at least, doesn't build on Mountain Lion with the
1120 # CUPS printing backend - either the CUPS API changed incompatibly
1121 # or the backend was depending on non-API implementation details.
1123 # Configure it out, on Mountain Lion and later, for now.
1124 # (12 is the Darwin major version number in Mountain Lion.)
1126 # Also, configure out libtiff and libjpeg; configure scripts
1127 # just ignore unknown --enable/--disable and --with/--without
1128 # options (at least they've always do so up to now).
1130 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
1132 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
1134 make $MAKE_BUILD_OPTS || exit 1
1135 $DO_MAKE_INSTALL || exit 1
1137 touch gtk+-$GTK_VERSION-done
1142 if [ ! -z "$installed_gtk_version" ] ; then
1143 echo "Uninstalling GTK+:"
1144 cd gtk+-$installed_gtk_version
1145 $DO_MAKE_UNINSTALL || exit 1
1146 make distclean || exit 1
1148 rm gtk+-$installed_gtk_version-done
1150 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1152 # Get rid of the previously downloaded and unpacked version.
1154 rm -rf gtk+-$installed_gtk_version
1155 rm -rf gtk+-$installed_gtk_version.tar.xz gtk+-$installed_gtk_version.tar.bz2
1158 installed_gtk_version=""
1163 if [ "$LIBSMI_VERSION" -a ! -f libsmi-$LIBSMI_VERSION-done ] ; then
1164 echo "Downloading, building, and installing libsmi:"
1165 [ -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
1166 gzcat libsmi-$LIBSMI_VERSION.tar.gz | tar xf - || exit 1
1167 cd libsmi-$LIBSMI_VERSION
1168 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1169 make $MAKE_BUILD_OPTS || exit 1
1170 $DO_MAKE_INSTALL || exit 1
1172 touch libsmi-$LIBSMI_VERSION-done
1176 uninstall_libsmi() {
1177 if [ ! -z "$installed_libsmi_version" ] ; then
1178 echo "Uninstalling libsmi:"
1179 cd libsmi-$installed_libsmi_version
1180 $DO_MAKE_UNINSTALL || exit 1
1181 make distclean || exit 1
1183 rm libsmi-$installed_libsmi_version-done
1185 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1187 # Get rid of the previously downloaded and unpacked version.
1189 rm -rf libsmi-$installed_libsmi_version
1190 rm -rf libsmi-$installed_libsmi_version.tar.gz
1193 installed_libsmi_version=""
1197 install_libgpg_error() {
1198 if [ "$LIBGPG_ERROR_VERSION" -a ! -f libgpg-error-$LIBGPG_ERROR_VERSION-done ] ; then
1199 echo "Downloading, building, and installing libgpg-error:"
1200 [ -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
1201 bzcat libgpg-error-$LIBGPG_ERROR_VERSION.tar.bz2 | tar xf - || exit 1
1202 cd libgpg-error-$LIBGPG_ERROR_VERSION
1203 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1204 make $MAKE_BUILD_OPTS || exit 1
1205 $DO_MAKE_INSTALL || exit 1
1207 touch libgpg-error-$LIBGPG_ERROR_VERSION-done
1211 uninstall_libgpg_error() {
1212 if [ ! -z "$installed_libgpg_error_version" ] ; then
1214 # libgcrypt depends on this, so uninstall it.
1216 uninstall_libgcrypt "$@"
1218 echo "Uninstalling libgpg-error:"
1219 cd libgpg-error-$installed_libgpg_error_version
1220 $DO_MAKE_UNINSTALL || exit 1
1221 make distclean || exit 1
1223 rm libgpg-error-$installed_libgpg_error_version-done
1225 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1227 # Get rid of the previously downloaded and unpacked version.
1229 rm -rf libgpg-error-$installed_libgpg_error_version
1230 rm -rf libgpg-error-$installed_libgpg_error_version.tar.bz2
1233 installed_libgpg_error_version=""
1237 install_libgcrypt() {
1238 if [ "$LIBGCRYPT_VERSION" -a ! -f libgcrypt-$LIBGCRYPT_VERSION-done ] ; then
1240 # libgpg-error is required for libgcrypt.
1242 if [ -z $LIBGPG_ERROR_VERSION ]
1244 echo "libgcrypt requires libgpg-error, but you didn't install libgpg-error." 1>&2
1248 echo "Downloading, building, and installing libgcrypt:"
1249 [ -f libgcrypt-$LIBGCRYPT_VERSION.tar.gz ] || curl -L -O ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-$LIBGCRYPT_VERSION.tar.gz || exit 1
1250 gzcat libgcrypt-$LIBGCRYPT_VERSION.tar.gz | tar xf - || exit 1
1251 cd libgcrypt-$LIBGCRYPT_VERSION
1253 # The assembler language code is not compatible with the OS X
1254 # x86 assembler (or is it an x86-64 vs. x86-32 issue?).
1256 # libgcrypt expects gnu89, not c99/gnu99, semantics for
1257 # "inline". See, for example:
1259 # http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2010-October/198809.html
1261 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
1262 make $MAKE_BUILD_OPTS || exit 1
1263 $DO_MAKE_INSTALL || exit 1
1265 touch libgcrypt-$LIBGCRYPT_VERSION-done
1269 uninstall_libgcrypt() {
1270 if [ ! -z "$installed_libgcrypt_version" ] ; then
1272 # GnuTLS depends on this, so uninstall it.
1274 uninstall_gnutls "$@"
1276 echo "Uninstalling libgcrypt:"
1277 cd libgcrypt-$installed_libgcrypt_version
1278 $DO_MAKE_UNINSTALL || exit 1
1279 make distclean || exit 1
1281 rm libgcrypt-$installed_libgcrypt_version-done
1283 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1285 # Get rid of the previously downloaded and unpacked version.
1287 rm -rf libgcrypt-$installed_libgcrypt_version
1288 rm -rf libgcrypt-$installed_libgcrypt_version.tar.gz
1291 installed_libgcrypt_version=""
1296 if [ "$GNUTLS_VERSION" -a ! -f gnutls-$GNUTLS_VERSION-done ] ; then
1298 # GnuTLS requires libgcrypt (or nettle, in newer versions).
1300 if [ -z $LIBGCRYPT_VERSION ]
1302 echo "GnuTLS requires libgcrypt, but you didn't install libgcrypt" 1>&2
1306 echo "Downloading, building, and installing GnuTLS:"
1307 [ -f gnutls-$GNUTLS_VERSION.tar.bz2 ] || curl -L -O http://ftp.gnu.org/gnu/gnutls/gnutls-$GNUTLS_VERSION.tar.bz2 || exit 1
1308 bzcat gnutls-$GNUTLS_VERSION.tar.bz2 | tar xf - || exit 1
1309 cd gnutls-$GNUTLS_VERSION
1311 # Use libgcrypt, not nettle.
1312 # XXX - is there some reason to prefer nettle? Or does
1313 # Wireshark directly use libgcrypt routines?
1315 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
1316 make $MAKE_BUILD_OPTS || exit 1
1318 # The pkgconfig file for GnuTLS says "requires zlib", but OS X,
1319 # while it supplies zlib, doesn't supply a pkgconfig file for
1322 # Patch the GnuTLS pkgconfig file not to require zlib.
1323 # (If the capabilities of GnuTLS that Wireshark uses don't
1324 # depend on building GnuTLS with zlib, an alternative would be
1325 # to configure it not to use zlib.)
1327 patch -p0 lib/gnutls.pc.in <../../macosx-support-lib-patches/gnutls-pkgconfig.patch || exit 1
1328 $DO_MAKE_INSTALL || exit 1
1330 touch gnutls-$GNUTLS_VERSION-done
1334 uninstall_gnutls() {
1335 if [ ! -z "$installed_gnutls_version" ] ; then
1336 echo "Uninstalling GnuTLS:"
1337 cd gnutls-$installed_gnutls_version
1338 $DO_MAKE_UNINSTALL || exit 1
1339 make distclean || exit 1
1341 rm gnutls-$installed_gnutls_version-done
1343 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1345 # Get rid of the previously downloaded and unpacked version.
1347 rm -rf gnutls-$installed_gnutls_version
1348 rm -rf gnutls-$installed_gnutls_version.tar.bz2
1351 installed_gnutls_version=""
1356 if [ "$LUA_VERSION" -a ! -f lua-$LUA_VERSION-done ] ; then
1357 echo "Downloading, building, and installing Lua:"
1358 [ -f lua-$LUA_VERSION.tar.gz ] || curl -L -O http://www.lua.org/ftp/lua-$LUA_VERSION.tar.gz || exit 1
1359 gzcat lua-$LUA_VERSION.tar.gz | tar xf - || exit 1
1361 make MYCFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" MYLDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" $MAKE_BUILD_OPTS macosx || exit 1
1362 $DO_MAKE_INSTALL || exit 1
1364 touch lua-$LUA_VERSION-done
1369 if [ ! -z "$installed_lua_version" ] ; then
1370 echo "Uninstalling Lua:"
1372 # Lua has no "make uninstall", so just remove stuff manually.
1373 # There's no configure script, so there's no need for
1374 # "make distclean", either; just do "make clean".
1376 (cd /usr/local/bin; $DO_RM -f lua luac)
1377 (cd /usr/local/include; $DO_RM -f lua.h luaconf.h lualib.h lauxlib.h lua.hpp)
1378 (cd /usr/local/lib; $DO_RM -f liblua.a)
1379 (cd /usr/local/man/man1; $DO_RM -f lua.1 luac.1)
1380 cd lua-$installed_lua_version
1381 make clean || exit 1
1383 rm lua-$installed_lua_version-done
1385 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1387 # Get rid of the previously downloaded and unpacked version.
1389 rm -rf lua-$installed_lua_version
1390 rm -rf lua-$installed_lua_version.tar.gz
1393 installed_lua_version=""
1397 install_portaudio() {
1399 # Check for both the old versionless portaudio-done and the new
1400 # versioned -done file.
1402 if [ "$PORTAUDIO_VERSION" -a ! -f portaudio-$PORTAUDIO_VERSION-done ] ; then
1403 echo "Downloading, building, and installing PortAudio:"
1404 [ -f $PORTAUDIO_VERSION.tgz ] || curl -L -O http://www.portaudio.com/archives/$PORTAUDIO_VERSION.tgz || exit 1
1405 gzcat $PORTAUDIO_VERSION.tgz | tar xf - || exit 1
1408 # Un-comment an include that's required on Lion.
1410 patch -p0 include/pa_mac_core.h <../../macosx-support-lib-patches/portaudio-pa_mac_core.h.patch
1412 # Fix a bug that showed up with clang (but is a bug with any
1415 patch -p0 src/hostapi/coreaudio/pa_mac_core.c <../../macosx-support-lib-patches/portaudio-pa_mac_core.c.patch
1417 # Disable fat builds - the configure script doesn't work right
1418 # with Xcode 4 if you leave them enabled, and we don't build
1419 # any other libraries fat (GLib, for example, would be very
1420 # hard to build fat), so there's no advantage to having PortAudio
1423 # Set the minimum OS X version to 10.4, to suppress some
1424 # deprecation warnings. (Good luck trying to make any of
1425 # this build on an OS+Xcode with a pre-10.4 SDK; we don't
1426 # worry about the user requesting that.)
1428 # Explicitly disable deprecation, so the damn thing will build
1429 # on El Capitan with Xcode 7.
1431 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
1432 make $MAKE_BUILD_OPTS || exit 1
1433 $DO_MAKE_INSTALL || exit 1
1435 touch portaudio-$PORTAUDIO_VERSION-done
1439 uninstall_portaudio() {
1440 if [ ! -z "$installed_portaudio_version" ] ; then
1441 echo "Uninstalling PortAudio:"
1443 $DO_MAKE_UNINSTALL || exit 1
1444 make distclean || exit 1
1446 rm portaudio-$installed_portaudio_version-done
1448 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1450 # Get rid of the previously downloaded and unpacked version.
1453 rm -rf $installed_portaudio_version.tgz
1456 installed_portaudio_version=""
1461 if [ "$GEOIP_VERSION" -a ! -f geoip-$GEOIP_VERSION-done ] ; then
1462 echo "Downloading, building, and installing GeoIP API:"
1463 [ -f GeoIP-$GEOIP_VERSION.tar.gz ] || curl -L -O http://geolite.maxmind.com/download/geoip/api/c/GeoIP-$GEOIP_VERSION.tar.gz || exit 1
1464 gzcat GeoIP-$GEOIP_VERSION.tar.gz | tar xf - || exit 1
1465 cd GeoIP-$GEOIP_VERSION
1466 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1468 # Grr. Their man pages "helpfully" have an ISO 8859-1
1469 # copyright symbol in the copyright notice, but OS X's
1470 # default character encoding is UTF-8. sed on Mountain
1471 # Lion barfs at the "illegal character sequence" represented
1472 # by an ISO 8859-1 copyright symbol, as it's not a valid
1475 # iconv the relevant man pages into UTF-8.
1477 for i in geoipupdate.1.in geoiplookup6.1.in geoiplookup.1.in
1479 iconv -f iso8859-1 -t utf-8 man/"$i" >man/"$i".tmp &&
1480 mv man/"$i".tmp man/"$i"
1482 make $MAKE_BUILD_OPTS || exit 1
1483 $DO_MAKE_INSTALL || exit 1
1485 touch geoip-$GEOIP_VERSION-done
1490 if [ ! -z "$installed_geoip_version" ] ; then
1491 echo "Uninstalling GeoIP API:"
1492 cd GeoIP-$installed_geoip_version
1493 $DO_MAKE_UNINSTALL || exit 1
1494 make distclean || exit 1
1496 rm geoip-$installed_geoip_version-done
1498 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1500 # Get rid of the previously downloaded and unpacked version.
1502 rm -rf GeoIP-$installed_geoip_version
1503 rm -rf GeoIP-$installed_geoip_version.tar.gz
1506 installed_geoip_version=""
1511 if [ "$CARES_VERSION" -a ! -f c-ares-$CARES_VERSION-done ] ; then
1512 echo "Downloading, building, and installing C-Ares API:"
1513 [ -f c-ares-$CARES_VERSION.tar.gz ] || curl -L -O https://c-ares.haxx.se/download/c-ares-$CARES_VERSION.tar.gz || exit 1
1514 gzcat c-ares-$CARES_VERSION.tar.gz | tar xf - || exit 1
1515 cd c-ares-$CARES_VERSION
1516 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1517 make $MAKE_BUILD_OPTS || exit 1
1518 $DO_MAKE_INSTALL || exit 1
1520 touch c-ares-$CARES_VERSION-done
1524 uninstall_c_ares() {
1525 if [ ! -z "$installed_cares_version" ] ; then
1526 echo "Uninstalling C-Ares API:"
1527 cd c-ares-$installed_cares_version
1528 $DO_MAKE_UNINSTALL || exit 1
1529 make distclean || exit 1
1531 rm c-ares-$installed_cares_version-done
1533 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1535 # Get rid of the previously downloaded and unpacked version.
1537 rm -rf c-ares-$installed_cares_version
1538 rm -rf c-ares-$installed_cares_version.tar.gz
1541 installed_cares_version=""
1546 if [ "$LIBSSH_VERSION" -a ! -f libssh-$LIBSSH_VERSION-done ] ; then
1547 echo "Downloading, building, and installing libssh:"
1548 [ -f libssh-$LIBSSH_VERSION.tar.xz ] || curl -L -O https://red.libssh.org/attachments/download/195/libssh-$LIBSSH_VERSION.tar.xz || exit 1
1549 xzcat libssh-$LIBSSH_VERSION.tar.xz | tar xf - || exit 1
1550 cd libssh-$LIBSSH_VERSION
1553 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" cmake -DWITH_GCRYPT=1 ../ || exit 1
1554 make $MAKE_BUILD_OPTS || exit 1
1555 $DO_MAKE_INSTALL || exit 1
1557 touch libssh-$LIBSSH_VERSION-done
1561 uninstall_libssh() {
1562 if [ ! -z "$installed_libssh_version" ] ; then
1563 echo "Sadly, libssh uses cmake, and doesn't support uninstall."
1568 if [ "$NGHTTP2_VERSION" -a ! -f nghttp2-$NGHTTP2_VERSION-done ] ; then
1569 echo "Downloading, building, and installing nghttp2:"
1570 [ -f nghttp2-$NGHTTP2_VERSION.tar.xz ] || curl -L -O https://github.com/nghttp2/nghttp2/releases/download/v$NGHTTP2_VERSION/nghttp2-$NGHTTP2_VERSION.tar.xz || exit 1
1571 xzcat nghttp2-$NGHTTP2_VERSION.tar.xz | tar xf - || exit 1
1572 cd nghttp2-$NGHTTP2_VERSION
1573 ./configure || exit 1
1574 make $MAKE_BUILD_OPTS || exit 1
1575 $DO_MAKE_INSTALL || exit 1
1577 touch nghttp2-$NGHTTP2_VERSION-done
1581 uninstall_nghttp2() {
1582 if [ ! -z "$installed_nghttp2_version" ] ; then
1583 echo "Uninstalling nghttp2:"
1584 cd nghttp2-$installed_nghttp2_version
1585 $DO_MAKE_UNINSTALL || exit 1
1586 make distclean || exit 1
1588 rm nghttp2-$installed_nghttp2_version-done
1590 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1592 # Get rid of the previously downloaded and unpacked version.
1594 rm -rf nghttp2-$installed_nghttp2_version
1595 rm -rf nghttp2-$installed_nghttp2_version.tar.xz
1598 installed_nghttp2_version=""
1604 # Check whether the versions we have installed are the versions
1605 # requested; if not, uninstall the installed versions.
1607 if [ ! -z "$installed_nghttp2_version" -a \
1608 "$installed_nghttp2_version" != "$NGHTTP2_VERSION" ] ; then
1609 echo "Installed nghttp2 version is $installed_nghttp2_version"
1610 if [ -z "$NGHTTP2_VERSION" ] ; then
1611 echo "nghttp2 is not requested"
1613 echo "Requested nghttp2 version is $NGHTTP2_VERSION"
1615 uninstall_nghttp2 -r
1618 if [ ! -z "$installed_libssh_version" -a \
1619 "$installed_libssh_version" != "$LIBSSH_VERSION" ] ; then
1620 echo "Installed libssh version is $installed_libssh_version"
1621 if [ -z "$LIBSSH_VERSION" ] ; then
1622 echo "libssh is not requested"
1624 echo "Requested libssh version is $LIBSSH_VERSION"
1629 if [ ! -z "$installed_cares_version" -a \
1630 "$installed_cares_version" != "$CARES_VERSION" ] ; then
1631 echo "Installed C-Ares version is $installed_cares_version"
1632 if [ -z "$CARES_VERSION" ] ; then
1633 echo "C-Ares is not requested"
1635 echo "Requested C-Ares version is $CARES_VERSION"
1640 if [ ! -z "$installed_geoip_version" -a \
1641 "$installed_geoip_version" != "$GEOIP_VERSION" ] ; then
1642 echo "Installed GeoIP API version is $installed_geoip_version"
1643 if [ -z "$GEOIP_VERSION" ] ; then
1644 echo "GeoIP is not requested"
1646 echo "Requested GeoIP version is $GEOIP_VERSION"
1651 if [ ! -z "$installed_lz4_version" -a \
1652 "$installed_lz4_version" != "$LZ4_VERSION" ] ; then
1653 echo "Installed LZ4 version is $installed_lz4_version"
1654 if [ -z "$LZ4_VERSION" ] ; then
1655 echo "LZ4 is not requested"
1657 echo "Requested LZ4 version is $LZ4_VERSION"
1662 if [ ! -z "$installed_snappy_version" -a \
1663 "$installed_snappy_version" != "$SNAPPY_VERSION" ] ; then
1664 echo "Installed SNAPPY version is $installed_snappy_version"
1665 if [ -z "$SNAPPY_VERSION" ] ; then
1666 echo "SNAPPY is not requested"
1668 echo "Requested SNAPPY version is $SNAPPY_VERSION"
1673 if [ ! -z "$installed_sbc_version" -a \
1674 "$installed_sbc_version" != "$SBC_VERSION" ] ; then
1675 echo "Installed SBC version is $installed_sbc_version"
1676 if [ -z "$SBC_VERSION" ] ; then
1677 echo "SBC is not requested"
1679 echo "Requested SBC version is $SBC_VERSION"
1684 if [ ! -z "$installed_portaudio_version" -a \
1685 "$installed_portaudio_version" != "$PORTAUDIO_VERSION" ] ; then
1686 echo "Installed PortAudio version is $installed_portaudio_version"
1687 if [ -z "$PORTAUDIO_VERSION" ] ; then
1688 echo "PortAudio is not requested"
1690 echo "Requested PortAudio version is $PORTAUDIO_VERSION"
1692 uninstall_portaudio -r
1695 if [ ! -z "$installed_lua_version" -a \
1696 "$installed_lua_version" != "$LUA_VERSION" ] ; then
1697 echo "Installed Lua version is $installed_lua_version"
1698 if [ -z "$LUA_VERSION" ] ; then
1699 echo "Lua is not requested"
1701 echo "Requested Lua version is $LUA_VERSION"
1706 if [ ! -z "$installed_gnutls_version" -a \
1707 "$installed_gnutls_version" != "$GNUTLS_VERSION" ] ; then
1708 echo "Installed GnuTLS version is $installed_gnutls_version"
1709 if [ -z "$GNUTLS_VERSION" ] ; then
1710 echo "GnuTLS is not requested"
1712 echo "Requested GnuTLS version is $GNUTLS_VERSION"
1717 if [ ! -z "$installed_libgcrypt_version" -a \
1718 "$installed_libgcrypt_version" != "$LIBGCRYPT_VERSION" ] ; then
1719 echo "Installed libgcrypt version is $installed_libgcrypt_version"
1720 if [ -z "$LIBGCRYPT_VERSION" ] ; then
1721 echo "libgcrypt is not requested"
1723 echo "Requested libgcrypt version is $LIBGCRYPT_VERSION"
1725 uninstall_libgcrypt -r
1728 if [ ! -z "$installed_libgpg_error_version" -a \
1729 "$installed_libgpg_error_version" != "$LIBGPG_ERROR_VERSION" ] ; then
1730 echo "Installed libgpg-error version is $installed_libgpg_error_version"
1731 if [ -z "$LIBGPG_ERROR_VERSION" ] ; then
1732 echo "libgpg-error is not requested"
1734 echo "Requested libgpg-error version is $LIBGPG_ERROR_VERSION"
1736 uninstall_libgpg_error -r
1739 if [ ! -z "$installed_libsmi_version" -a \
1740 "$installed_libsmi_version" != "$LIBSMI_VERSION" ] ; then
1741 echo "Installed libsmi version is $installed_libsmi_version"
1742 if [ -z "$LIBSMI_VERSION" ] ; then
1743 echo "libsmi is not requested"
1745 echo "Requested libsmi version is $LIBSMI_VERSION"
1750 if [ ! -z "$installed_gtk_version" -a \
1751 "$installed_gtk_version" != "$GTK_VERSION" ] ; then
1752 echo "Installed GTK+ version is $installed_gtk_version"
1753 if [ -z "$GTK_VERSION" ] ; then
1754 echo "GTK+ is not requested"
1756 echo "Requested GTK+ version is $GTK_VERSION"
1761 if [ ! -z "$installed_gdk_pixbuf_version" -a \
1762 "$installed_gdk_pixbuf_version" != "$GDK_PIXBUF_VERSION" ] ; then
1763 echo "Installed gdk-pixbuf version is $installed_gdk_pixbuf_version"
1764 if [ -z "$GDK_PIXBUF_VERSION" ] ; then
1765 echo "gdk-pixbuf is not requested"
1767 echo "Requested gdk-pixbuf version is $GDK_PIXBUF_VERSION"
1769 uninstall_gdk_pixbuf -r
1772 if [ ! -z "$installed_pango_version" -a \
1773 "$installed_pango_version" != "$PANGO_VERSION" ] ; then
1774 echo "Installed Pango version is $installed_pango_version"
1775 if [ -z "$PANGO_VERSION" ] ; then
1776 echo "Pango is not requested"
1778 echo "Requested Pango version is $PANGO_VERSION"
1783 if [ ! -z "$installed_atk_version" -a \
1784 "$installed_atk_version" != "$ATK_VERSION" ] ; then
1785 echo "Installed ATK version is $installed_atk_version"
1786 if [ -z "$ATK_VERSION" ] ; then
1787 echo "ATK is not requested"
1789 echo "Requested ATK version is $ATK_VERSION"
1794 if [ ! -z "$installed_cairo_version" -a \
1795 "$installed_cairo_version" != "$CAIRO_VERSION" ] ; then
1796 echo "Installed Cairo version is $installed_cairo_version"
1797 if [ -z "$CAIRO_VERSION" ] ; then
1798 echo "Cairo is not requested"
1800 echo "Requested Cairo version is $CAIRO_VERSION"
1805 if [ ! -z "$installed_pixman_version" -a \
1806 "$installed_pixman_version" != "$PIXMAN_VERSION" ] ; then
1807 echo "Installed pixman version is $installed_pixman_version"
1808 if [ -z "$PIXMAN_VERSION" ] ; then
1809 echo "pixman is not requested"
1811 echo "Requested pixman version is $PIXMAN_VERSION"
1816 if [ ! -z "$installed_libpng_version" -a \
1817 "$installed_libpng_version" != "$PNG_VERSION" ] ; then
1818 echo "Installed libpng version is $installed_libpng_version"
1819 if [ -z "$PNG_VERSION" ] ; then
1820 echo "libpng is not requested"
1822 echo "Requested libpng version is $PNG_VERSION"
1827 if [ ! -z "$installed_qt_version" -a \
1828 "$installed_qt_version" != "$QT_VERSION" ] ; then
1829 echo "Installed Qt version is $installed_qt_version"
1830 if [ -z "$QT_VERSION" ] ; then
1831 echo "Qt is not requested"
1833 echo "Requested Qt version is $QT_VERSION"
1838 if [ ! -z "$installed_glib_version" -a \
1839 "$installed_glib_version" != "$GLIB_VERSION" ] ; then
1840 echo "Installed GLib version is $installed_glib_version"
1841 if [ -z "$GLIB_VERSION" ] ; then
1842 echo "GLib is not requested"
1844 echo "Requested GLib version is $GLIB_VERSION"
1849 if [ ! -z "$installed_pkg_config_version" -a \
1850 "$installed_pkg_config_version" != "$PKG_CONFIG_VERSION" ] ; then
1851 echo "Installed pkg-config version is $installed_pkg_config_version"
1852 if [ -z "$PKG_CONFIG_VERSION" ] ; then
1853 echo "pkg-config is not requested"
1855 echo "Requested pkg-config version is $PKG_CONFIG_VERSION"
1857 uninstall_pkg_config -r
1860 if [ ! -z "$installed_gettext_version" -a \
1861 "$installed_gettext_version" != "$GETTEXT_VERSION" ] ; then
1862 echo "Installed GNU gettext version is $installed_gettext_version"
1863 if [ -z "$GETTEXT_VERSION" ] ; then
1864 echo "GNU gettext is not requested"
1866 echo "Requested GNU gettext version is $GETTEXT_VERSION"
1868 uninstall_gettext -r
1871 if [ ! -z "$installed_cmake_version" -a \
1872 "$installed_cmake_version" != "$CMAKE_VERSION" ] ; then
1873 echo "Installed CMake version is $installed_cmake_version"
1874 if [ -z "$CMAKE_VERSION" ] ; then
1875 echo "CMake is not requested"
1877 echo "Requested CMake version is $CMAKE_VERSION"
1880 # XXX - really remove this?
1881 # Or should we remember it as installed only if this script
1887 if [ ! -z "$installed_libtool_version" -a \
1888 "$installed_libtool_version" != "$LIBTOOL_VERSION" ] ; then
1889 echo "Installed GNU libtool version is $installed_libtool_version"
1890 if [ -z "$LIBTOOL_VERSION" ] ; then
1891 echo "GNU libtool is not requested"
1893 echo "Requested GNU libtool version is $LIBTOOL_VERSION"
1895 uninstall_libtool -r
1898 if [ ! -z "$installed_automake_version" -a \
1899 "$installed_automake_version" != "$AUTOMAKE_VERSION" ] ; then
1900 echo "Installed GNU automake version is $installed_automake_version"
1901 if [ -z "$AUTOMAKE_VERSION" ] ; then
1902 echo "GNU automake is not requested"
1904 echo "Requested GNU automake version is $AUTOMAKE_VERSION"
1906 uninstall_automake -r
1909 if [ ! -z "$installed_autoconf_version" -a \
1910 "$installed_autoconf_version" != "$AUTOCONF_VERSION" ] ; then
1911 echo "Installed GNU autoconf version is $installed_autoconf_version"
1912 if [ -z "$AUTOCONF_VERSION" ] ; then
1913 echo "GNU autoconf is not requested"
1915 echo "Requested GNU autoconf version is $AUTOCONF_VERSION"
1917 uninstall_autoconf -r
1920 if [ ! -z "$installed_xz_version" -a \
1921 "$installed_xz_version" != "$XZ_VERSION" ] ; then
1922 echo "Installed xz version is $installed_xz_version"
1923 if [ -z "$XZ_VERSION" ] ; then
1924 echo "xz is not requested"
1926 echo "Requested xz version is $XZ_VERSION"
1932 # Start with xz: It is the sole download format of glib later than 2.31.2
1945 # Start with GNU gettext; GLib requires it, and OS X doesn't have it
1946 # or a BSD-licensed replacement.
1948 # At least on Lion with Xcode 4, _FORTIFY_SOURCE gets defined as 2
1949 # by default, which causes, for example, stpncpy to be defined as
1950 # a hairy macro that collides with the GNU gettext configure script's
1951 # attempts to workaround AIX's lack of a declaration for stpncpy,
1952 # with the result being a huge train wreck. Define _FORTIFY_SOURCE
1953 # as 0 in an attempt to keep the trains on separate tracks.
1958 # GLib depends on pkg-config.
1959 # By default, pkg-config depends on GLib; we break the dependency cycle
1960 # by configuring pkg-config to use its own internal version of GLib.
1967 # Now we have reached a point where we can build everything but
1968 # the GUI (Wireshark).
1972 if [ "$GTK_VERSION" ]; then
1974 # GTK+ 3 requires a newer Cairo build than the one that comes with
1975 # 10.6, so we build Cairo if we are using GTK+ 3.
1977 # In 10.6 and 10.7, it's an X11 library; if we build with "native" GTK+
1978 # rather than X11 GTK+, we might have to build and install Cairo.
1979 # In 10.8 and later, there is no X11, but it's included in Xquartz;
1980 # again, if we build with "native" GTK+, we'd have to build and install
1983 if [[ "$GTK_MAJOR_VERSION" -eq 3 || "$cairo_not_in_the_os" = yes ]]; then
1985 # Requirements for Cairo first
1987 # The libpng that comes with the X11 for Leopard has a bogus
1988 # pkg-config file that lies about where the header files are,
1989 # which causes other packages not to be able to find its
1992 # The libpng in later versions is not what the version of
1993 # libpixman we build below wants - it wants libpng15.
1998 # The libpixman versions that come with the X11s for Leopard,
1999 # Snow Leopard, and Lion is too old to support Cairo's image
2000 # surface backend feature (which requires pixman-1 >= 0.22.0).
2002 # XXX - what about the one that comes with the latest version
2008 # And now Cairo itself.
2009 # XXX - with the libxcb that comes with 10.6,
2010 # xcb_discard_reply() is missing, and the build fails.
2025 # Now we have reached a point where we can build everything including
2026 # the GUI (Wireshark), but not with any optional features such as
2027 # SNMP OID resolution, some forms of decryption, Lua scripting, playback
2028 # of audio, or GeoIP mapping of IP addresses.
2030 # We now conditionally download optional libraries to support them;
2031 # the default is to download them all.
2036 install_libgpg_error
2062 if [ -d macosx-support-libs ]
2064 cd macosx-support-libs
2067 # Uninstall items in the reverse order from the order in which they're
2068 # installed. Only uninstall if the download/build/install process
2069 # completed; uninstall the version that appears in the name of
2072 # We also do a "make distclean", so that we don't have leftovers from
2073 # old configurations.
2097 uninstall_libgpg_error
2103 uninstall_gdk_pixbuf
2119 uninstall_pkg_config
2124 # XXX - really remove this?
2125 # Or should we remember it as installed only if this script
2141 # Do we have permission to write in /usr/local?
2143 # If so, assume we have permission to write in its subdirectories.
2144 # (If that's not the case, this test needs to check the subdirectories
2147 # If not, do "make install", "make uninstall", the removes for Lua,
2148 # and the renames of [g]libtool* with sudo.
2150 if [ -w /usr/local ]
2152 DO_MAKE_INSTALL="make install"
2153 DO_MAKE_UNINSTALL="make uninstall"
2157 DO_MAKE_INSTALL="sudo make install"
2158 DO_MAKE_UNINSTALL="sudo make uninstall"
2164 # If we have SDKs available, the default target OS is the major version
2165 # of the one we're running; get that and strip off the third component
2168 for i in /Developer/SDKs \
2169 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
2170 /Library/Developer/CommandLineTools/SDKs
2174 min_osx_target=`sw_vers -productVersion | sed 's/\([0-9]*\)\.\([0-9]*\)\.[0-9]*/\1.\2/'`
2177 # That's also the OS whose SDK we'd be using.
2179 sdk_target=$min_osx_target
2185 # Parse command-line flags:
2188 # -t <target> - build libraries so that they'll work on the specified
2189 # version of OS X and later versions.
2190 # -u - do an uninstall.
2192 while getopts ht:u name
2199 min_osx_target="$OPTARG"
2202 echo "Usage: macosx-setup.sh [ -t <target> ] [ -u ]" 1>&1
2209 # Get the version numbers of installed packages, if any.
2211 if [ -d macosx-support-libs ]
2213 cd macosx-support-libs
2215 installed_xz_version=`ls xz-*-done 2>/dev/null | sed 's/xz-\(.*\)-done/\1/'`
2216 installed_autoconf_version=`ls autoconf-*-done 2>/dev/null | sed 's/autoconf-\(.*\)-done/\1/'`
2217 installed_automake_version=`ls automake-*-done 2>/dev/null | sed 's/automake-\(.*\)-done/\1/'`
2218 installed_libtool_version=`ls libtool-*-done 2>/dev/null | sed 's/libtool-\(.*\)-done/\1/'`
2219 installed_cmake_version=`ls cmake-*-done 2>/dev/null | sed 's/cmake-\(.*\)-done/\1/'`
2220 installed_gettext_version=`ls gettext-*-done 2>/dev/null | sed 's/gettext-\(.*\)-done/\1/'`
2221 installed_pkg_config_version=`ls pkg-config-*-done 2>/dev/null | sed 's/pkg-config-\(.*\)-done/\1/'`
2222 installed_glib_version=`ls glib-*-done 2>/dev/null | sed 's/glib-\(.*\)-done/\1/'`
2223 installed_qt_version=`ls qt-*-done 2>/dev/null | sed 's/qt-\(.*\)-done/\1/'`
2224 installed_libpng_version=`ls libpng-*-done 2>/dev/null | sed 's/libpng-\(.*\)-done/\1/'`
2225 installed_pixman_version=`ls pixman-*-done 2>/dev/null | sed 's/pixman-\(.*\)-done/\1/'`
2226 installed_cairo_version=`ls cairo-*-done 2>/dev/null | sed 's/cairo-\(.*\)-done/\1/'`
2227 installed_atk_version=`ls atk-*-done 2>/dev/null | sed 's/atk-\(.*\)-done/\1/'`
2228 installed_pango_version=`ls pango-*-done 2>/dev/null | sed 's/pango-\(.*\)-done/\1/'`
2229 installed_gdk_pixbuf_version=`ls gdk-pixbuf-*-done 2>/dev/null | sed 's/gdk-pixbuf-\(.*\)-done/\1/'`
2230 installed_gtk_version=`ls gtk+-*-done 2>/dev/null | sed 's/gtk+-\(.*\)-done/\1/'`
2231 installed_libsmi_version=`ls libsmi-*-done 2>/dev/null | sed 's/libsmi-\(.*\)-done/\1/'`
2232 installed_libgpg_error_version=`ls libgpg-error-*-done 2>/dev/null | sed 's/libgpg-error-\(.*\)-done/\1/'`
2233 installed_libgcrypt_version=`ls libgcrypt-*-done 2>/dev/null | sed 's/libgcrypt-\(.*\)-done/\1/'`
2234 installed_gnutls_version=`ls gnutls-*-done 2>/dev/null | sed 's/gnutls-\(.*\)-done/\1/'`
2235 installed_lua_version=`ls lua-*-done 2>/dev/null | sed 's/lua-\(.*\)-done/\1/'`
2236 installed_portaudio_version=`ls portaudio-*-done 2>/dev/null | sed 's/portaudio-\(.*\)-done/\1/'`
2237 installed_snappy_version=`ls snappy-*-done 2>/dev/null | sed 's/snappy-\(.*\)-done/\1/'`
2238 installed_lz4_version=`ls lz4-*-done 2>/dev/null | sed 's/lz4-\(.*\)-done/\1/'`
2239 installed_sbc_version=`ls sbc-*-done 2>/dev/null | sed 's/sbc-\(.*\)-done/\1/'`
2240 installed_geoip_version=`ls geoip-*-done 2>/dev/null | sed 's/geoip-\(.*\)-done/\1/'`
2241 installed_cares_version=`ls c-ares-*-done 2>/dev/null | sed 's/c-ares-\(.*\)-done/\1/'`
2242 installed_libssh_version=`ls libssh-*-done 2>/dev/null | sed 's/libssh-\(.*\)-done/\1/'`
2243 installed_nghttp2_version=`ls nghttp2-*-done 2>/dev/null | sed 's/nghttp2-\(.*\)-done/\1/'`
2246 # If we don't have a versioned -done file for portaudio, but do have
2247 # an unversioned -done file for it, assume the installed version is the
2248 # requested version, and rename the -done file to include that version.
2250 if [ -z "$installed_portaudio_version" -a -f portaudio-done ] ; then
2251 mv portaudio-done portaudio-$PORTAUDIO_VERSION-done
2252 installed_portaudio_version=`ls portaudio-*-done 2>/dev/null | sed 's/portaudio-\(.*\)-done/\1/'`
2258 if [ "$do_uninstall" = "yes" ]
2265 # Configure scripts tend to set CFLAGS and CXXFLAGS to "-g -O2" if
2266 # invoked without CFLAGS or CXXFLAGS being set in the environment.
2268 # However, we *are* setting them in the environment, for our own
2269 # nefarious purposes, so start them out as "-g -O2".
2275 # To make this work on Leopard (rather than working *on* Snow Leopard
2276 # when building *for* Leopard) will take more work.
2278 # For one thing, Leopard's /usr/X11/lib/libXdamage.la claims, at least
2279 # with all software updates applied, that the Xdamage shared library
2280 # is libXdamage.1.0.0.dylib, but it is, in fact, libXdamage.1.1.0.dylib.
2281 # This causes problems when building GTK+, so the script would have to
2284 if [[ $DARWIN_MAJOR_VERSION -le 9 ]]; then
2285 echo "This script does not support any versions of OS X before Snow Leopard" 1>&2
2289 # if no make options are present, set default options
2290 if [ -z "$MAKE_BUILD_OPTS" ] ; then
2291 # by default use 1.5x number of cores for parallel build
2292 MAKE_BUILD_OPTS="-j $(( $(sysctl -n hw.logicalcpu) * 3 / 2))"
2296 # If we have a target release, look for the oldest SDK that's for an
2297 # OS equal to or later than that one, and build libraries against it
2298 # rather than against the headers and, more importantly, libraries
2299 # that come with the OS, so that we don't end up with support libraries
2300 # that only work on the OS version on which we built them, not earlier
2301 # versions of the same release, or earlier releases if the minimum is
2304 if [ ! -z "$min_osx_target" ]
2307 # Get the real version - strip off the "10.".
2308 # We'll worry about that if, as, and when there's ever
2311 deploy_real_version=`echo "$min_osx_target" | sed -n 's/10\.\(.*\)/\1/p'`
2314 # Search each directory that might contain SDKs.
2317 for sdksdir in /Developer/SDKs \
2318 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
2319 /Library/Developer/CommandLineTools/SDKs
2322 # Get a list of all the SDKs.
2324 if ! test -d "$sdksdir"
2327 # There is no directory with that name.
2328 # Move on to the next one in the list, if any.
2334 # Get a list of all the SDKs in that directory, if any.
2336 sdklist=`(cd "$sdksdir"; ls -d MacOSX10.[0-9]*.sdk 2>/dev/null)`
2341 # Get the real version for this SDK.
2343 sdk_real_version=`echo "$sdk" | sed -n 's/MacOSX10\.\(.*\)\.sdk/\1/p'`
2346 # Is it for the deployment target or some later release?
2348 if test "$sdk_real_version" -ge "$deploy_real_version"
2353 sdkpath="$sdksdir/$sdk"
2354 qt_sdk_arg="-sdk $sdk"
2360 if [ -z "$sdkpath" ]
2362 echo "macosx-setup.sh: Couldn't find an SDK for OS X $min_osx_target or later" 1>&2
2367 sdk_target=10.$sdk_real_version
2368 echo "Using the 10.$sdk_real_version SDK"
2371 # Make sure there are links to /usr/local/include and /usr/local/lib
2372 # in the SDK's usr/local.
2374 if [ ! -e $SDKPATH/usr/local/include ]
2376 if [ ! -d $SDKPATH/usr/local ]
2378 sudo mkdir $SDKPATH/usr/local
2380 sudo ln -s /usr/local/include $SDKPATH/usr/local/include
2382 if [ ! -e $SDKPATH/usr/local/lib ]
2384 if [ ! -d $SDKPATH/usr/local ]
2386 sudo mkdir $SDKPATH/usr/local
2388 sudo ln -s /usr/local/lib $SDKPATH/usr/local/lib
2392 # Set the minimum OS version for which to build to the specified
2393 # minimum target OS version, so we don't, for example, end up using
2394 # linker features supported by the OS verson on which we're building
2395 # but not by the target version.
2397 VERSION_MIN_FLAGS="-mmacosx-version-min=$min_osx_target"
2400 # Compile and link against the SDK.
2402 SDKFLAGS="-isysroot $SDKPATH"
2404 if [[ "$min_osx_target" == "10.5" ]]
2407 # Cairo is part of Mac OS X 10.6 and later.
2408 # The *headers* are supplied by 10.5, but the *libraries*
2409 # aren't, so we have to build it if we're building for 10.5.
2411 cairo_not_in_the_os=yes
2414 # Build with older versions of the support libraries, as
2415 # were used on the Wireshark Leopard buildbot at one
2416 # point. (Most of these versions come from the About page
2417 # from Wireshark 1.8.6, the last build done on that buildbot;
2418 # the ATK version isn't reported, so this is a guess.)
2420 # If you want to try building with newer versions of
2421 # the libraries, note that:
2423 # The version of fontconfig that comes with Leopard doesn't
2424 # support FC_WEIGHT_EXTRABLACK, so we can't use any version
2425 # of Pango newer than 1.22.4.
2427 # However, Pango 1.22.4 doesn't work with versions of GLib
2428 # after 2.29.6, because Pango 1.22.4 uses G_CONST_RETURN and
2429 # GLib 2.29.8 and later deprecate it (there doesn't appear to
2430 # be a GLib 2.29.7). That means we'd either have to patch
2431 # Pango not to use it (just use "const"; G_CONST_RETURN was
2432 # there to allow code to choose whether to use "const" or not),
2433 # or use GLib 2.29.6 or earlier.
2435 # GLib 2.29.6 includes an implementation of g_bit_lock() that,
2436 # on x86 (32-bit and 64-bit), uses asms in a fashion
2437 # ("asm volatile goto") that requires GCC 4.5 or later, which
2438 # is later than the compilers that come with Leopard and Snow
2439 # Leopard. Recent versions of GLib check for that, but 2.29.6
2440 # doesn't, so, if you want to build GLib 2.29.6 on Leopard or
2441 # Snow Leopard, you would have to patch glib/gbitlock.c to do
2442 # what the newer versions of GLib do:
2444 # define a USE_ASM_GOTO macro that indicates whether "asm goto"
2446 # #if (defined (i386) || defined (__amd64__))
2447 # #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
2448 # #define USE_ASM_GOTO 1
2452 # replace all occurrences of
2454 # #if defined (__GNUC__) && (defined (i386) || defined (__amd64__))
2458 # #ifdef USE_ASM_GOTO
2460 # Using GLib 2.29.6 or earlier, however, means that we can't
2461 # use a version of ATK later than 2.3.93, as those versions
2462 # don't work with GLib 2.29.6. The same applies to gdk-pixbuf;
2463 # versions of gdk-pixbuf after 2.24.1 won't work with GLib
2466 # Then you have to make sure that what you've build doesn't
2467 # cause the X server that comes with Leopard to crash; at
2468 # least one attempt at building for Leopard did.
2470 # At least if building on Leopard, you might also find
2471 # that, with various older versions of Cairo, including
2472 # 1.6.4 and at least some 1.8.x versions, when you try to
2473 # build it, the build fails because it can't find
2474 # png_set_longjmp_fn(). I vaguely remember dealing with that,
2475 # ages ago, but don't remember what I did.
2478 if [ "$CAIRO_VERSION" ]
2482 if [ "$ATK_VERSION" ]
2486 if [ "$PANGO_VERSION" ]
2488 PANGO_VERSION=1.20.2
2490 if [ "$GTK_VERSION" ]
2496 # That version of GTK+ includes gdk-pixbuf.
2497 # XXX - base this on the version of GTK+ requested.
2502 # Libgcrypt 1.5.0 fails to compile due to some problem with an
2503 # asm in rijndael.c, at least with i686-apple-darwin10-gcc-4.2.1
2504 # (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) when building
2507 # We try libgcrypt 1.4.3 instead, as that's what shows up in
2508 # the version from the Leopard buildbot.
2509 LIBGCRYPT_VERSION=1.4.3
2512 # Build 32-bit while we're at it; Leopard has a bug that
2513 # causes some BPF functions not to work with 64-bit userland
2514 # code, so capturing won't work.
2516 CFLAGS="$CFLAGS -arch i386"
2517 CXXFLAGS="$CXXFLAGS -arch i386"
2518 export LDFLAGS="$LDFLAGS -arch i386"
2526 # You need Xcode or the command-line tools installed to get the compilers.
2528 if [ ! -x /usr/bin/xcodebuild ]; then
2529 echo "Please install Xcode first (should be available on DVD or from the Mac App Store)."
2533 if [ "$QT_VERSION" ]; then
2535 # We need Xcode, not just the command-line tools, installed to build
2538 # At least with Xcode 8, /usr/bin/xcodebuild --help fails if only
2539 # the command-line tools are installed and succeeds if Xcode is
2540 # installed. Unfortunately, it fails *with* Xcode 3, but
2541 # /usr/bin/xcodebuild -version works with that and with Xcode 8.
2542 # Hopefully it fails with only the command-line tools installed.
2544 if /usr/bin/xcodebuild -version >/dev/null 2>&1; then
2547 echo "Please install Xcode first (should be available on DVD or from the Mac App Store)."
2548 echo "The command-line build tools are not sufficient to build Qt."
2552 if [ "$GTK_VERSION" ]; then
2554 # If we're building with GTK+, you also need the X11 SDK; with at least
2555 # some versions of OS X and Xcode, that is, I think, an optional install.
2556 # (Or it might be installed with X11, but I think *that* is an optional
2557 # install on at least some versions of OS X.)
2559 if [ ! -d /usr/X11/include ]; then
2560 echo "Please install X11 and the X11 SDK first."
2561 echo " You can either download the latest package from"
2562 echo " http://www.xquartz.org/ and install it or install"
2563 echo " the native Apple package if you are on Lion or below."
2568 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig
2571 # Do all the downloads and untarring in a subdirectory, so all that
2572 # stuff can be removed once we've installed the support libraries.
2574 if [ ! -d macosx-support-libs ]
2576 mkdir macosx-support-libs || exit 1
2578 cd macosx-support-libs
2585 # Indicate what paths to use for pkg-config and cmake.
2587 pkg_config_path=/usr/local/lib/pkgconfig
2588 if [ "$QT_VERSION" ]; then
2589 qt_base_path=$HOME/Qt$QT_VERSION/$QT_MAJOR_MINOR_VERSION/clang_64
2590 pkg_config_path="$pkg_config_path":"$qt_base_path/lib/pkgconfig"
2591 CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH":"$qt_base_path/lib/cmake"
2593 pkg_config_path="$pkg_config_path":/usr/X11/lib/pkgconfig
2595 echo "You are now prepared to build Wireshark."
2597 if [[ $CMAKE ]]; then
2598 echo "To build with CMAKE:"
2600 echo "export PKG_CONFIG_PATH=$pkg_config_path"
2601 echo "export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH"
2602 echo "export PATH=$PATH:$qt_base_path/bin"
2604 echo "mkdir build; cd build"
2606 echo "make $MAKE_BUILD_OPTS app_bundle"
2607 echo "make install/strip"
2610 if [[ $AUTOTOOLS ]]; then
2611 echo "To build with AUTOTOOLS:"
2613 echo "export PKG_CONFIG_PATH=$pkg_config_path"
2616 echo "mkdir build; cd build"
2618 echo "make $MAKE_BUILD_OPTS"
2622 echo "Make sure you are allowed capture access to the network devices"
2623 echo "See: https://wiki.wireshark.org/CaptureSetup/CapturePrivileges"