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 version of Qt or build the deprecated GTK interface call
73 # the script with some of the variables set to the new values. Setting a
74 # variable to empty will disable building the toolkit and will uninstall
75 # any version previously installed by the script, e.g.
76 # "GTK_VERSION=3.5.2 QT_VERSION= ./macos-setup.sh"
77 # will build and install with GTK+ 3.5.2 and will not install Qt (and,
78 # if the script installed Qt earlier, will un-install that version of Qt).
80 # Note that Qt 5, prior to 5.5.0, mishandles context menus in ways that,
81 # for example, cause them not to work reliably in the packet detail or
82 # packet data pane; see, for example, Qt bugs QTBUG-31937, QTBUG-41017,
83 # and QTBUG-43464, all of which seem to be the same bug.
85 QT_VERSION=${QT_VERSION-5.8.0}
86 #GTK_VERSION=${GTK_VERSION-2.24.17}
87 if [ "$GTK_VERSION" ]; then
89 # We'll be building GTK+, so we need some additional libraries.
91 GTK_MAJOR_VERSION="`expr $GTK_VERSION : '\([0-9][0-9]*\).*'`"
92 GTK_MINOR_VERSION="`expr $GTK_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
93 GTK_DOTDOT_VERSION="`expr $GTK_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
100 GDK_PIXBUF_VERSION=2.28.0
102 if [ "$QT_VERSION" ]; then
103 QT_MAJOR_VERSION="`expr $QT_VERSION : '\([0-9][0-9]*\).*'`"
104 QT_MINOR_VERSION="`expr $QT_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
105 QT_DOTDOT_VERSION="`expr $QT_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
106 QT_MAJOR_MINOR_VERSION=$QT_MAJOR_VERSION.$QT_MINOR_VERSION
107 QT_MAJOR_MINOR_DOTDOT_VERSION=$QT_MAJOR_VERSION.$QT_MINOR_VERSION.$QT_DOTDOT_VERSION
111 # The following libraries are optional.
112 # Comment them out if you don't want them, but note that some of
113 # the optional libraries are required by other optional libraries.
117 # libgpg-error is required for libgcrypt.
119 LIBGPG_ERROR_VERSION=1.10
121 # libgcrypt is required.
123 LIBGCRYPT_VERSION=1.5.0
125 # GnuTLS is optional.
126 # Note that since GnuTLS 3.0.8, Libgcrypt can no longer be used and nettle is
127 # needed (which is not yet installed by this script).
129 GNUTLS_VERSION=2.12.19
130 # Use 5.2.4, not 5.3, for now; lua_bitop.c hasn't been ported to 5.3
131 # yet, and we need to check for compatibility issues (we'd want Lua
132 # scripts to work with 5.1, 5.2, and 5.3, as long as they only use Lua
133 # features present in all three versions)
135 PORTAUDIO_VERSION=pa_stable_v19_20111121
140 # XXX - they appear to have an unversioned gzipped tarball for the
141 # current version; should we just download that, with some other
142 # way of specifying whether to download the GeoIP API?
150 NGHTTP2_VERSION=1.14.0
152 DARWIN_MAJOR_VERSION=`uname -r | sed 's/\([0-9]*\).*/\1/'`
155 # GNU autotools; they're provided with releases up to Snow Leopard, but
156 # not in later releases, and the Snow Leopard version is too old for
157 # current Wireshark, so we install them unconditionally.
159 AUTOCONF_VERSION=2.69
160 AUTOMAKE_VERSION=1.13.3
161 LIBTOOL_VERSION=2.4.6
164 if [ "$XZ_VERSION" -a ! -f xz-$XZ_VERSION-done ] ; then
165 echo "Downloading, building, and installing xz:"
166 [ -f xz-$XZ_VERSION.tar.bz2 ] || curl -O http://tukaani.org/xz/xz-$XZ_VERSION.tar.bz2 || exit 1
167 bzcat xz-$XZ_VERSION.tar.bz2 | tar xf - || exit 1
169 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0" ./configure || exit 1
170 make $MAKE_BUILD_OPTS || exit 1
171 $DO_MAKE_INSTALL || exit 1
173 touch xz-$XZ_VERSION-done
178 if [ ! -z "$installed_xz_version" ] ; then
179 echo "Uninstalling xz:"
180 cd xz-$installed_xz_version
181 $DO_MAKE_UNINSTALL || exit 1
182 make distclean || exit 1
184 rm xz-$installed_xz_version-done
186 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
188 # Get rid of the previously downloaded and unpacked version.
190 rm -rf xz-$installed_xz_version
191 rm -rf xz-$installed_xz_version.tar.bz2
194 installed_xz_version=""
199 if [ "$SNAPPY_VERSION" -a ! -f snappy-$SNAPPY_VERSION-done ] ; then
200 echo "Downloading, building, and installing snappy:"
201 [ -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
202 gzcat snappy-$SNAPPY_VERSION.tar.gz | tar xf - || exit 1
203 cd snappy-$SNAPPY_VERSION
204 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0" ./configure || exit 1
205 make $MAKE_BUILD_OPTS || exit 1
206 $DO_MAKE_INSTALL || exit 1
208 touch snappy-$SNAPPY_VERSION-done
213 if [ ! -z "$installed_snappy_version" ] ; then
214 echo "Uninstalling snappy:"
215 cd snappy-$installed_snappy_version
216 $DO_MAKE_UNINSTALL || exit 1
217 make distclean || exit 1
219 rm snappy-$installed_snappy_version-done
221 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
223 # Get rid of the previously downloaded and unpacked version.
225 rm -rf snappy-$installed_snappy_version
226 rm -rf snappy-$installed_snappy_version.tar.gz
229 installed_snappy_version=""
234 if [ "$LZ4_VERSION" -a ! -f lz4-$LZ4_VERSION-done ] ; then
235 echo "Downloading, building, and installing lz4:"
236 [ -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
237 gzcat lz4-$LZ4_VERSION.tar.gz | tar xf - || exit 1
239 # CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0" ./configure || exit 1
240 make $MAKE_BUILD_OPTS || exit 1
241 $DO_MAKE_INSTALL || exit 1
243 touch lz4-$LZ4_VERSION-done
248 if [ ! -z "$installed_lz4_version" ] ; then
249 echo "Uninstalling lz4:"
250 cd lz4-$installed_lz4_version
251 $DO_MAKE_UNINSTALL || exit 1
252 make distclean || exit 1
254 rm lz4-$installed_lz4_version-done
256 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
258 # Get rid of the previously downloaded and unpacked version.
260 rm -rf lz4-$installed_lz4_version
261 rm -rf lz4-$installed_lz4_version.tar.gz
264 installed_lz4_version=""
269 if [ "$SBC_VERSION" -a ! -f sbc-$SBC_VERSION-done ] ; then
270 echo "Downloading, building, and installing sbc:"
271 [ -f sbc-$SBC_VERSION.tar.gz ] || curl -O https://www.kernel.org/pub/linux/bluetooth/sbc-$SBC_VERSION.tar.gz || exit 1
272 gzcat sbc-$SBC_VERSION.tar.gz | tar xf - || exit 1
274 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0" ./configure --disable-tools --disable-tester --disable-shared || exit 1
275 make $MAKE_BUILD_OPTS || exit 1
276 $DO_MAKE_INSTALL || exit 1
278 touch sbc-$SBC_VERSION-done
283 if [ ! -z "$installed_sbc_version" ] ; then
284 echo "Uninstalling sbc:"
285 cd sbc-$installed_sbc_version
286 $DO_MAKE_UNINSTALL || exit 1
287 make distclean || exit 1
289 rm sbc-$installed_sbc_version-done
291 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
293 # Get rid of the previously downloaded and unpacked version.
295 rm -rf sbc-$installed_sbc_version
296 rm -rf sbc-$installed_sbc_version.tar.gz
299 installed_sbc_version=""
304 if [ "$AUTOCONF_VERSION" -a ! -f autoconf-$AUTOCONF_VERSION-done ] ; then
305 echo "Downloading, building and installing GNU autoconf..."
306 [ -f autoconf-$AUTOCONF_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/autoconf/autoconf-$AUTOCONF_VERSION.tar.xz || exit 1
307 xzcat autoconf-$AUTOCONF_VERSION.tar.xz | tar xf - || exit 1
308 cd autoconf-$AUTOCONF_VERSION
309 ./configure || exit 1
310 make $MAKE_BUILD_OPTS || exit 1
311 $DO_MAKE_INSTALL || exit 1
313 touch autoconf-$AUTOCONF_VERSION-done
317 uninstall_autoconf() {
318 if [ ! -z "$installed_autoconf_version" ] ; then
320 # automake and libtool depend on this, so uninstall them.
325 echo "Uninstalling GNU autoconf:"
326 cd autoconf-$installed_autoconf_version
327 $DO_MAKE_UNINSTALL || exit 1
328 make distclean || exit 1
330 rm autoconf-$installed_autoconf_version-done
332 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
334 # Get rid of the previously downloaded and unpacked version.
336 rm -rf autoconf-$installed_autoconf_version
337 rm -rf autoconf-$installed_autoconf_version.tar.xz
340 installed_autoconf_version=""
345 if [ "$AUTOMAKE_VERSION" -a ! -f automake-$AUTOMAKE_VERSION-done ] ; then
346 echo "Downloading, building and installing GNU automake..."
347 [ -f automake-$AUTOMAKE_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/automake/automake-$AUTOMAKE_VERSION.tar.xz || exit 1
348 xzcat automake-$AUTOMAKE_VERSION.tar.xz | tar xf - || exit 1
349 cd automake-$AUTOMAKE_VERSION
350 ./configure || exit 1
351 make $MAKE_BUILD_OPTS || exit 1
352 $DO_MAKE_INSTALL || exit 1
354 touch automake-$AUTOMAKE_VERSION-done
358 uninstall_automake() {
359 if [ ! -z "$installed_automake_version" ] ; then
361 # libtool depends on this(?), so uninstall it.
363 uninstall_libtool "$@"
365 echo "Uninstalling GNU automake:"
366 cd automake-$installed_automake_version
367 $DO_MAKE_UNINSTALL || exit 1
368 make distclean || exit 1
370 rm automake-$installed_automake_version-done
372 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
374 # Get rid of the previously downloaded and unpacked version.
376 rm -rf automake-$installed_automake_version
377 rm -rf automake-$installed_automake_version.tar.xz
380 installed_automake_version=""
385 if [ "$LIBTOOL_VERSION" -a ! -f libtool-$LIBTOOL_VERSION-done ] ; then
386 echo "Downloading, building and installing GNU libtool..."
387 [ -f libtool-$LIBTOOL_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/libtool/libtool-$LIBTOOL_VERSION.tar.xz || exit 1
388 xzcat libtool-$LIBTOOL_VERSION.tar.xz | tar xf - || exit 1
389 cd libtool-$LIBTOOL_VERSION
390 ./configure || exit 1
391 make $MAKE_BUILD_OPTS || exit 1
392 $DO_MAKE_INSTALL || exit 1
393 $DO_MV /usr/local/bin/libtool /usr/local/bin/glibtool
394 $DO_MV /usr/local/bin/libtoolize /usr/local/bin/glibtoolize
396 touch libtool-$LIBTOOL_VERSION-done
400 uninstall_libtool() {
401 if [ ! -z "$installed_libtool_version" ] ; then
402 echo "Uninstalling GNU libtool:"
403 cd libtool-$installed_libtool_version
404 $DO_MV /usr/local/bin/glibtool /usr/local/bin/libtool
405 $DO_MV /usr/local/bin/glibtoolize /usr/local/bin/libtoolize
406 $DO_MAKE_UNINSTALL || exit 1
407 make distclean || exit 1
409 rm libtool-$installed_libtool_version-done
411 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
413 # Get rid of the previously downloaded and unpacked version.
415 rm -rf libtool-$installed_libtool_version
416 rm -rf libtool-$installed_libtool_version.tar.xz
419 installed_libtool_version=""
424 if [ -n "$CMAKE" -a ! -f cmake-$CMAKE_VERSION-done ]; then
425 echo "Downloading and installing CMake:"
426 CMAKE_MAJOR_VERSION="`expr $CMAKE_VERSION : '\([0-9][0-9]*\).*'`"
427 CMAKE_MINOR_VERSION="`expr $CMAKE_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
428 CMAKE_DOTDOT_VERSION="`expr $CMAKE_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
429 CMAKE_MAJOR_MINOR_VERSION=$CMAKE_MAJOR_VERSION.$CMAKE_MINOR_VERSION
432 # NOTE: the "64" in "Darwin64" doesn't mean "64-bit-only"; the
433 # package in question supports both 32-bit and 64-bit x86.
435 case "$CMAKE_MAJOR_VERSION" in
438 echo "CMake $CMAKE_VERSION" is too old 1>&2
443 # Download the DMG, run the installer.
445 [ -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
446 sudo hdiutil attach cmake-$CMAKE_VERSION-Darwin64-universal.dmg || exit 1
447 sudo installer -target / -pkg /Volumes/cmake-$CMAKE_VERSION-Darwin64-universal/cmake-$CMAKE_VERSION-Darwin64-universal.pkg || exit 1
448 sudo hdiutil detach /Volumes/cmake-$CMAKE_VERSION-Darwin64-universal
453 # Download the DMG and do a drag install, where "drag" means
456 # 3.0.* and 3.1.0 have a Darwin64-universal DMG.
457 # 3.1.1 and later have a Darwin-x86_64 DMG.
458 # Probably not many people are still developing on 32-bit
459 # Macs, so we don't worry about them.
461 if [ "$CMAKE_MINOR_VERSION" = 0 -o \
462 "$CMAKE_VERSION" = 3.1.0 ]; then
463 type="Darwin64-universal"
467 [ -f cmake-$CMAKE_VERSION-$type.dmg ] || curl -O https://cmake.org/files/v$CMAKE_MAJOR_MINOR_VERSION/cmake-$CMAKE_VERSION-$type.dmg || exit 1
468 sudo hdiutil attach cmake-$CMAKE_VERSION-$type.dmg || exit 1
469 sudo ditto /Volumes/cmake-$CMAKE_VERSION-$type/CMake.app /Applications/CMake.app || exit 1
472 # Plant the appropriate symbolic links in /usr/local/bin.
473 # It's a drag-install, so there's no installer to make them,
474 # and the CMake code to put them in place is lame, as
476 # 1) it defaults to /usr/bin, not /usr/local/bin;
477 # 2) it doesn't request the necessary root privileges;
478 # 3) it can't be run from the command line;
480 # so we do it ourselves.
482 for i in ccmake cmake cmake-gui cmakexbuild cpack ctest
484 sudo ln -s /Applications/CMake.app/Contents/bin/$i /usr/local/bin/$i
486 sudo hdiutil detach /Volumes/cmake-$CMAKE_VERSION-$type
492 touch cmake-$CMAKE_VERSION-done
497 if [ ! -z "$installed_cmake_version" ]; then
498 echo "Uninstalling CMake:"
499 installed_cmake_major_version="`expr $installed_cmake_version : '\([0-9][0-9]*\).*'`"
500 case "$installed_cmake_major_version" in
503 echo "CMake $installed_cmake_version" is too old 1>&2
507 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
508 for i in ccmake cmake cmake-gui cmakexbuild cpack ctest
510 sudo rm -f /usr/bin/$i /usr/local/bin/$i
512 sudo pkgutil --forget com.Kitware.CMake
513 rm cmake-$installed_cmake_version-done
517 sudo rm -rf /Applications/CMake.app
518 for i in ccmake cmake cmake-gui cmakexbuild cpack ctest
520 sudo rm -f /usr/local/bin/$i
522 rm cmake-$installed_cmake_version-done
526 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
528 # Get rid of the previously downloaded and unpacked version,
529 # whatever it might happen to be called.
531 rm -f cmake-$installed_cmake_version-Darwin64-universal.dmg
532 rm -f cmake-$installed_cmake_version-Darwin-x86_64.dmg
535 installed_cmake_version=""
540 if [ ! -f gettext-$GETTEXT_VERSION-done ] ; then
541 echo "Downloading, building, and installing GNU gettext:"
542 [ -f gettext-$GETTEXT_VERSION.tar.gz ] || curl -O http://ftp.gnu.org/pub/gnu/gettext/gettext-$GETTEXT_VERSION.tar.gz || exit 1
543 gzcat gettext-$GETTEXT_VERSION.tar.gz | tar xf - || exit 1
544 cd gettext-$GETTEXT_VERSION
545 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0 $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
546 make $MAKE_BUILD_OPTS || exit 1
547 $DO_MAKE_INSTALL || exit 1
549 touch gettext-$GETTEXT_VERSION-done
553 uninstall_gettext() {
554 if [ ! -z "$installed_gettext_version" ] ; then
556 # GLib depends on this, so uninstall it.
560 echo "Uninstalling GNU gettext:"
561 cd gettext-$installed_gettext_version
562 $DO_MAKE_UNINSTALL || exit 1
563 make distclean || exit 1
565 rm gettext-$installed_gettext_version-done
567 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
569 # Get rid of the previously downloaded and unpacked version.
571 rm -rf gettext-$installed_gettext_version
572 rm -rf gettext-$installed_gettext_version.tar.gz
575 installed_gettext_version=""
579 install_pkg_config() {
580 if [ ! -f pkg-config-$PKG_CONFIG_VERSION-done ] ; then
581 echo "Downloading, building, and installing pkg-config:"
582 [ -f pkg-config-$PKG_CONFIG_VERSION.tar.gz ] || curl -O https://pkgconfig.freedesktop.org/releases/pkg-config-$PKG_CONFIG_VERSION.tar.gz || exit 1
583 gzcat pkg-config-$PKG_CONFIG_VERSION.tar.gz | tar xf - || exit 1
584 cd pkg-config-$PKG_CONFIG_VERSION
585 ./configure --with-internal-glib || exit 1
586 make $MAKE_BUILD_OPTS || exit 1
587 $DO_MAKE_INSTALL || exit 1
589 touch pkg-config-$PKG_CONFIG_VERSION-done
593 uninstall_pkg_config() {
594 if [ ! -z "$installed_pkg_config_version" ] ; then
595 echo "Uninstalling pkg-config:"
596 cd pkg-config-$installed_pkg_config_version
597 $DO_MAKE_UNINSTALL || exit 1
598 make distclean || exit 1
600 rm pkg-config-$installed_pkg_config_version-done
602 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
604 # Get rid of the previously downloaded and unpacked version.
606 rm -rf pkg-config-$installed_pkg_config_version
607 rm -rf pkg-config-$installed_pkg_config_version.tar.gz
610 installed_pkg_config_version=""
615 if [ ! -f glib-$GLIB_VERSION-done ] ; then
616 echo "Downloading, building, and installing GLib:"
617 glib_dir=`expr $GLIB_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
618 GLIB_MAJOR_VERSION="`expr $GLIB_VERSION : '\([0-9][0-9]*\).*'`"
619 GLIB_MINOR_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
620 GLIB_DOTDOT_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
621 if [[ $GLIB_MAJOR_VERSION -gt 2 ||
622 $GLIB_MINOR_VERSION -gt 28 ||
623 ($GLIB_MINOR_VERSION -eq 28 && $GLIB_DOTDOT_VERSION -ge 8) ]]
626 # Starting with GLib 2.28.8, xz-compressed tarballs are available.
628 [ -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
629 xzcat glib-$GLIB_VERSION.tar.xz | tar xf - || exit 1
631 [ -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
632 bzcat glib-$GLIB_VERSION.tar.bz2 | tar xf - || exit 1
634 cd glib-$GLIB_VERSION
636 # OS X ships with libffi, but doesn't provide its pkg-config file;
637 # explicitly specify LIBFFI_CFLAGS and LIBFFI_LIBS, so the configure
638 # script doesn't try to use pkg-config to get the appropriate
639 # C flags and loader flags.
641 # And, what's worse, at least with the version of Xcode that comes
642 # with Leopard, /usr/include/ffi/fficonfig.h doesn't define MACOSX,
643 # which causes the build of GLib to fail. If we don't find
644 # "#define.*MACOSX" in /usr/include/ffi/fficonfig.h, explicitly
647 # While we're at it, suppress -Wformat-nonliteral to avoid a case
648 # where clang's stricter rules on when not to complain about
649 # non-literal format arguments cause it to complain about code
650 # that's safe but it wasn't told that. See my comment #25 in
653 # https://bugzilla.gnome.org/show_bug.cgi?id=691608#c25
655 # First, determine where the system include files are. (It's not
656 # necessarily /usr/include.) There's a bit of a greasy hack here;
657 # pre-5.x versions of the developer tools don't support the
658 # --show-sdk-path option, and will produce no output, so includedir
659 # will be set to /usr/include (in those older versions of the
660 # developer tools, there is a /usr/include directory).
662 includedir=`xcrun --show-sdk-path 2>/dev/null`/usr/include
663 if grep -qs '#define.*MACOSX' $includedir/ffi/fficonfig.h
665 # It's defined, nothing to do
666 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
668 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
672 # Apply the fix to GNOME bug 529806:
674 # https://bugzilla.gnome.org/show_bug.cgi?id=529806
676 # if we have a version of GLib prior to 2.30.
678 if [[ $GLIB_MAJOR_VERSION -eq 2 && $GLIB_MINOR_VERSION -le 30 ]]
680 patch -p0 <../../macosx-support-lib-patches/glib-gconvert.c.patch || exit 1
682 make $MAKE_BUILD_OPTS || exit 1
683 $DO_MAKE_INSTALL || exit 1
685 touch glib-$GLIB_VERSION-done
690 if [ ! -z "$installed_glib_version" ] ; then
692 # ATK, Pango, and GTK depend on this, so uninstall them.
698 echo "Uninstalling GLib:"
699 cd glib-$installed_glib_version
700 $DO_MAKE_UNINSTALL || exit 1
701 make distclean || exit 1
703 rm glib-$installed_glib_version-done
705 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
707 # Get rid of the previously downloaded and unpacked version.
709 rm -rf glib-$installed_glib_version
710 rm -rf glib-$installed_glib_version.tar.xz glib-$installed_glib_version.tar.bz2
713 installed_glib_version=""
718 if [ "$QT_VERSION" -a ! -f qt-$QT_VERSION-done ]; then
719 echo "Downloading, building, and installing Qt:"
721 # What you get for this URL might just be a 302 Found reply, so use
722 # -L so we get redirected.
724 if [ "$QT_MAJOR_VERSION" -ge 5 ]
726 QT_VOLUME=qt-opensource-mac-x64-clang-$QT_VERSION
728 QT_VOLUME=qt-opensource-mac-$QT_VERSION
730 [ -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
731 sudo hdiutil attach $QT_VOLUME.dmg || exit 1
733 if [ "$QT_MAJOR_VERSION" -ge 5 ]
736 # Run the installer executable directly, so that we wait for
737 # it to finish. Then unmount the volume.
739 /Volumes/$QT_VOLUME/$QT_VOLUME.app/Contents/MacOS/$QT_VOLUME
740 sudo hdiutil detach /Volumes/$QT_VOLUME
743 # Open the installer package; use -W, so that we wait for
744 # the installer to finish. Then unmount the volume.
746 open -W "/Volumes/Qt $QT_MAJOR_MINOR_DOTDOT_VERSION/Qt.mpkg"
747 sudo hdiutil detach "/Volumes/Qt $QT_MAJOR_MINOR_DOTDOT_VERSION"
751 # Versions 5.3.x through 5.5.0, at least, have bogus .pc files.
752 # See bugs QTBUG-35256 and QTBUG-47162.
756 for i in $HOME/Qt$QT_VERSION/$QT_MAJOR_MINOR_VERSION/clang_64/lib/pkgconfig/*.pc
760 g/Cflags: /s;;Cflags: -F\${libdir} ;
761 g/Cflags: /s;-I\${includedir}/Qt\([a-zA-Z0-9_]*\);-I\${libdir}/Qt\1.framework/Versions/5/Headers;
767 touch qt-$QT_VERSION-done
772 if [ ! -z "$installed_qt_version" ] ; then
773 echo "Uninstalling Qt:"
774 rm -rf $HOME/Qt$installed_qt_version
775 rm qt-$installed_qt_version-done
777 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
779 # Get rid of the previously downloaded version.
781 rm -rf qt-opensource-mac-x64-clang-$installed_qt_version.dmg
784 installed_qt_version=""
789 if [ ! -f libpng-$PNG_VERSION-done ] ; then
790 echo "Downloading, building, and installing libpng:"
792 # The FTP site puts libpng x.y.* into a libpngxy directory.
794 subdir=`echo $PNG_VERSION | sed 's/\([1-9][0-9]*\)\.\([1-9][0-9]*\).*/libpng\1\2'/`
795 [ -f libpng-$PNG_VERSION.tar.xz ] || curl -O ftp://ftp.simplesystems.org/pub/libpng/png/src/$subdir/libpng-$PNG_VERSION.tar.xz
796 xzcat libpng-$PNG_VERSION.tar.xz | tar xf - || exit 1
797 cd libpng-$PNG_VERSION
798 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
799 make $MAKE_BUILD_OPTS || exit 1
800 $DO_MAKE_INSTALL || exit 1
802 touch libpng-$PNG_VERSION-done
807 if [ ! -z "$installed_libpng_version" ] ; then
809 # Cairo depends on this, so uninstall it.
813 echo "Uninstalling libpng:"
814 cd libpng-$installed_libpng_version
815 $DO_MAKE_UNINSTALL || exit 1
816 make distclean || exit 1
818 rm libpng-$installed_libpng_version-done
820 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
822 # Get rid of the previously downloaded and unpacked version.
824 rm -rf libpng-$installed_libpng_version
825 rm -rf libpng-$installed_libpng_version.tar.xz
828 installed_libpng_version=""
833 if [ ! -f pixman-$PIXMAN_VERSION-done ] ; then
834 echo "Downloading, building, and installing pixman:"
835 [ -f pixman-$PIXMAN_VERSION.tar.gz ] || curl -O http://www.cairographics.org/releases/pixman-$PIXMAN_VERSION.tar.gz
836 gzcat pixman-$PIXMAN_VERSION.tar.gz | tar xf - || exit 1
837 cd pixman-$PIXMAN_VERSION
838 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
839 make $MAKE_BUILD_OPTS || exit 1
840 $DO_MAKE_INSTALL || exit 1
842 touch pixman-$PIXMAN_VERSION-done
847 if [ ! -z "$installed_pixman_version" ] ; then
849 # Cairo depends on this, so uninstall it.
853 echo "Uninstalling pixman:"
854 cd pixman-$installed_pixman_version
855 $DO_MAKE_UNINSTALL || exit 1
856 make distclean || exit 1
858 rm pixman-$installed_pixman_version-done
860 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
862 # Get rid of the previously downloaded and unpacked version.
864 rm -rf pixman-$installed_pixman_version
865 rm -rf pixman-$installed_pixman_version.tar.gz
868 installed_pixman_version=""
873 if [ ! -f cairo-$CAIRO_VERSION-done ] ; then
874 echo "Downloading, building, and installing Cairo:"
875 CAIRO_MAJOR_VERSION="`expr $CAIRO_VERSION : '\([0-9][0-9]*\).*'`"
876 CAIRO_MINOR_VERSION="`expr $CAIRO_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
877 CAIRO_DOTDOT_VERSION="`expr $CAIRO_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
878 if [[ $CAIRO_MAJOR_VERSION -gt 1 ||
879 $CAIRO_MINOR_VERSION -gt 12 ||
880 ($CAIRO_MINOR_VERSION -eq 12 && $CAIRO_DOTDOT_VERSION -ge 2) ]]
883 # Starting with Cairo 1.12.2, the tarballs are compressed with
884 # xz rather than gzip.
886 [ -f cairo-$CAIRO_VERSION.tar.xz ] || curl -O http://cairographics.org/releases/cairo-$CAIRO_VERSION.tar.xz || exit 1
887 xzcat cairo-$CAIRO_VERSION.tar.xz | tar xf - || exit 1
889 [ -f cairo-$CAIRO_VERSION.tar.gz ] || curl -O http://cairographics.org/releases/cairo-$CAIRO_VERSION.tar.gz || exit 1
890 gzcat cairo-$CAIRO_VERSION.tar.gz | tar xf - || exit 1
892 cd cairo-$CAIRO_VERSION
893 # CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-quartz=no || exit 1
894 # Maybe follow http://cairographics.org/end_to_end_build_for_mac_os_x/
895 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-quartz=yes || exit 1
897 # We must avoid the version of libpng that comes with X11; the
898 # only way I've found to force that is to forcibly set INCLUDES
899 # when we do the build, so that this comes before CAIRO_CFLAGS,
900 # which has -I/usr/X11/include added to it before anything
901 # connected to libpng is.
903 INCLUDES="-I/usr/local/include/libpng15" make $MAKE_BUILD_OPTS || exit 1
904 $DO_MAKE_INSTALL || exit 1
906 touch cairo-$CAIRO_VERSION-done
911 if [ ! -z "$installed_cairo_version" ] ; then
913 # GTK+ depends on this, so uninstall it.
917 echo "Uninstalling Cairo:"
918 cd cairo-$installed_cairo_version
919 $DO_MAKE_UNINSTALL || exit 1
920 make distclean || exit 1
922 rm cairo-$installed_cairo_version-done
924 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
926 # Get rid of the previously downloaded and unpacked version.
928 rm -rf cairo-$installed_cairo_version
929 rm -rf cairo-$installed_cairo_version.tar.xz cairo-$installed_cairo_version.tar.gz
932 installed_cairo_version=""
937 if [ ! -f atk-$ATK_VERSION-done ] ; then
938 echo "Downloading, building, and installing ATK:"
939 atk_dir=`expr $ATK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
940 ATK_MAJOR_VERSION="`expr $ATK_VERSION : '\([0-9][0-9]*\).*'`"
941 ATK_MINOR_VERSION="`expr $ATK_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
942 ATK_DOTDOT_VERSION="`expr $ATK_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
943 if [[ $ATK_MAJOR_VERSION -gt 2 ||
944 ($ATK_MAJOR_VERSION -eq 2 && $ATK_MINOR_VERSION -gt 0) ||
945 ($ATK_MANOR_VERSION -eq 2 && $ATK_MINOR_VERSION -eq 0 && $ATK_DOTDOT_VERSION -ge 1) ]]
948 # Starting with ATK 2.0.1, xz-compressed tarballs are available.
950 [ -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
951 xzcat atk-$ATK_VERSION.tar.xz | tar xf - || exit 1
953 [ -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
954 bzcat atk-$ATK_VERSION.tar.bz2 | tar xf - || exit 1
957 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
958 make $MAKE_BUILD_OPTS || exit 1
959 $DO_MAKE_INSTALL || exit 1
961 touch atk-$ATK_VERSION-done
966 if [ ! -z "$installed_atk_version" ] ; then
968 # GTK+ depends on this, so uninstall it.
972 echo "Uninstalling ATK:"
973 cd atk-$installed_atk_version
974 $DO_MAKE_UNINSTALL || exit 1
975 make distclean || exit 1
977 rm atk-$installed_atk_version-done
979 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
981 # Get rid of the previously downloaded and unpacked version.
983 rm -rf atk-$installed_atk_version
984 rm -rf atk-$installed_atk_version.tar.xz atk-$installed_atk_version.tar.bz2
987 installed_atk_version=""
992 if [ ! -f pango-$PANGO_VERSION-done ] ; then
993 echo "Downloading, building, and installing Pango:"
994 pango_dir=`expr $PANGO_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
995 PANGO_MAJOR_VERSION="`expr $PANGO_VERSION : '\([0-9][0-9]*\).*'`"
996 PANGO_MINOR_VERSION="`expr $PANGO_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
997 if [[ $PANGO_MAJOR_VERSION -gt 1 ||
998 $PANGO_MINOR_VERSION -ge 29 ]]
1001 # Starting with Pango 1.29, the tarballs are compressed with
1002 # xz rather than bzip2.
1004 [ -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
1005 xzcat pango-$PANGO_VERSION.tar.xz | tar xf - || exit 1
1007 [ -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
1008 bzcat pango-$PANGO_VERSION.tar.bz2 | tar xf - || exit 1
1010 cd pango-$PANGO_VERSION
1011 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1012 make $MAKE_BUILD_OPTS || exit 1
1013 $DO_MAKE_INSTALL || exit 1
1015 touch pango-$PANGO_VERSION-done
1020 if [ ! -z "$installed_pango_version" ] ; then
1022 # GTK+ depends on this, so uninstall it.
1026 echo "Uninstalling Pango:"
1027 cd pango-$installed_pango_version
1028 $DO_MAKE_UNINSTALL || exit 1
1029 make distclean || exit 1
1031 rm pango-$installed_pango_version-done
1033 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1035 # Get rid of the previously downloaded and unpacked version.
1037 rm -rf pango-$installed_pango_version
1038 rm -rf pango-$installed_pango_version.tar.xz pango-$installed_pango_version.tar.bz2
1041 installed_pango_version=""
1045 install_gdk_pixbuf() {
1046 if [ "$GDK_PIXBUF_VERSION" -a ! -f gdk-pixbuf-$GDK_PIXBUF_VERSION-done ] ; then
1047 echo "Downloading, building, and installing gdk-pixbuf:"
1048 gdk_pixbuf_dir=`expr $GDK_PIXBUF_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
1049 [ -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
1050 xzcat gdk-pixbuf-$GDK_PIXBUF_VERSION.tar.xz | tar xf - || exit 1
1051 cd gdk-pixbuf-$GDK_PIXBUF_VERSION
1053 # If we're building using the 10.6 SDK, force the use of libpng12.
1055 # The OS's X11, and corresponding SDK, didn't introduce libpng15,
1056 # or pkg-config files, until 10.7, so, for 10.6 have to explicitly
1057 # set LIBPNG to override the configure script, and also force the
1058 # CFLAGS to look for the header files for libpng12 (note that
1059 # -isysroot doesn't affect the arguments to -I, so we need to
1060 # include the SDK path explicitly).
1062 if [[ "$sdk_target" = 10.6 ]]
1064 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
1066 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
1068 make $MAKE_BUILD_OPTS || exit 1
1069 $DO_MAKE_INSTALL || exit 1
1071 touch gdk-pixbuf-$GDK_PIXBUF_VERSION-done
1075 uninstall_gdk_pixbuf() {
1076 if [ ! -z "$installed_gdk_pixbuf_version" ] ; then
1078 # GTK+ depends on this, so uninstall it.
1082 echo "Uninstalling gdk-pixbuf:"
1083 cd gdk-pixbuf-$installed_gdk_pixbuf_version
1084 $DO_MAKE_UNINSTALL || exit 1
1085 make distclean || exit 1
1087 rm gdk-pixbuf-$installed_gdk_pixbuf_version-done
1089 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1091 # Get rid of the previously downloaded and unpacked version.
1093 rm -rf gdk-pixbuf-$installed_gdk_pixbuf_version
1094 rm -rf gdk-pixbuf-$installed_gdk_pixbuf_version.tar.xz
1097 installed_gdk_pixbuf_version=""
1102 if [ ! -f gtk+-$GTK_VERSION-done ] ; then
1103 echo "Downloading, building, and installing GTK+:"
1104 gtk_dir=`expr $GTK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
1105 if [[ $GTK_MAJOR_VERSION -gt 2 ||
1106 $GTK_MINOR_VERSION -gt 24 ||
1107 ($GTK_MINOR_VERSION -eq 24 && $GTK_DOTDOT_VERSION -ge 5) ]]
1110 # Starting with GTK+ 2.24.5, the tarballs are compressed with
1111 # xz rather than gzip, in addition to bzip2; use xz, as we've
1112 # built and installed it, and as xz compresses better than
1113 # bzip2 so the tarballs take less time to download.
1115 [ -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
1116 xzcat gtk+-$GTK_VERSION.tar.xz | tar xf - || exit 1
1118 [ -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
1119 bzcat gtk+-$GTK_VERSION.tar.bz2 | tar xf - || exit 1
1121 cd gtk+-$GTK_VERSION
1122 if [ $DARWIN_MAJOR_VERSION -ge "12" ]
1125 # GTK+ 2.24.10, at least, doesn't build on Mountain Lion with the
1126 # CUPS printing backend - either the CUPS API changed incompatibly
1127 # or the backend was depending on non-API implementation details.
1129 # Configure it out, on Mountain Lion and later, for now.
1130 # (12 is the Darwin major version number in Mountain Lion.)
1132 # Also, configure out libtiff and libjpeg; configure scripts
1133 # just ignore unknown --enable/--disable and --with/--without
1134 # options (at least they've always do so up to now).
1136 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
1138 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
1140 make $MAKE_BUILD_OPTS || exit 1
1141 $DO_MAKE_INSTALL || exit 1
1143 touch gtk+-$GTK_VERSION-done
1148 if [ ! -z "$installed_gtk_version" ] ; then
1149 echo "Uninstalling GTK+:"
1150 cd gtk+-$installed_gtk_version
1151 $DO_MAKE_UNINSTALL || exit 1
1152 make distclean || exit 1
1154 rm gtk+-$installed_gtk_version-done
1156 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1158 # Get rid of the previously downloaded and unpacked version.
1160 rm -rf gtk+-$installed_gtk_version
1161 rm -rf gtk+-$installed_gtk_version.tar.xz gtk+-$installed_gtk_version.tar.bz2
1164 installed_gtk_version=""
1169 if [ "$LIBSMI_VERSION" -a ! -f libsmi-$LIBSMI_VERSION-done ] ; then
1170 echo "Downloading, building, and installing libsmi:"
1171 [ -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
1172 gzcat libsmi-$LIBSMI_VERSION.tar.gz | tar xf - || exit 1
1173 cd libsmi-$LIBSMI_VERSION
1174 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1175 make $MAKE_BUILD_OPTS || exit 1
1176 $DO_MAKE_INSTALL || exit 1
1178 touch libsmi-$LIBSMI_VERSION-done
1182 uninstall_libsmi() {
1183 if [ ! -z "$installed_libsmi_version" ] ; then
1184 echo "Uninstalling libsmi:"
1185 cd libsmi-$installed_libsmi_version
1186 $DO_MAKE_UNINSTALL || exit 1
1187 make distclean || exit 1
1189 rm libsmi-$installed_libsmi_version-done
1191 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1193 # Get rid of the previously downloaded and unpacked version.
1195 rm -rf libsmi-$installed_libsmi_version
1196 rm -rf libsmi-$installed_libsmi_version.tar.gz
1199 installed_libsmi_version=""
1203 install_libgpg_error() {
1204 if [ "$LIBGPG_ERROR_VERSION" -a ! -f libgpg-error-$LIBGPG_ERROR_VERSION-done ] ; then
1205 echo "Downloading, building, and installing libgpg-error:"
1206 [ -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
1207 bzcat libgpg-error-$LIBGPG_ERROR_VERSION.tar.bz2 | tar xf - || exit 1
1208 cd libgpg-error-$LIBGPG_ERROR_VERSION
1209 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1210 make $MAKE_BUILD_OPTS || exit 1
1211 $DO_MAKE_INSTALL || exit 1
1213 touch libgpg-error-$LIBGPG_ERROR_VERSION-done
1217 uninstall_libgpg_error() {
1218 if [ ! -z "$installed_libgpg_error_version" ] ; then
1220 # libgcrypt depends on this, so uninstall it.
1222 uninstall_libgcrypt "$@"
1224 echo "Uninstalling libgpg-error:"
1225 cd libgpg-error-$installed_libgpg_error_version
1226 $DO_MAKE_UNINSTALL || exit 1
1227 make distclean || exit 1
1229 rm libgpg-error-$installed_libgpg_error_version-done
1231 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1233 # Get rid of the previously downloaded and unpacked version.
1235 rm -rf libgpg-error-$installed_libgpg_error_version
1236 rm -rf libgpg-error-$installed_libgpg_error_version.tar.bz2
1239 installed_libgpg_error_version=""
1243 install_libgcrypt() {
1244 if [ "$LIBGCRYPT_VERSION" -a ! -f libgcrypt-$LIBGCRYPT_VERSION-done ] ; then
1246 # libgpg-error is required for libgcrypt.
1248 if [ -z $LIBGPG_ERROR_VERSION ]
1250 echo "libgcrypt requires libgpg-error, but you didn't install libgpg-error." 1>&2
1254 echo "Downloading, building, and installing libgcrypt:"
1255 [ -f libgcrypt-$LIBGCRYPT_VERSION.tar.gz ] || curl -L -O ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-$LIBGCRYPT_VERSION.tar.gz || exit 1
1256 gzcat libgcrypt-$LIBGCRYPT_VERSION.tar.gz | tar xf - || exit 1
1257 cd libgcrypt-$LIBGCRYPT_VERSION
1259 # The assembler language code is not compatible with the OS X
1260 # x86 assembler (or is it an x86-64 vs. x86-32 issue?).
1262 # libgcrypt expects gnu89, not c99/gnu99, semantics for
1263 # "inline". See, for example:
1265 # http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2010-October/198809.html
1267 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
1268 make $MAKE_BUILD_OPTS || exit 1
1269 $DO_MAKE_INSTALL || exit 1
1271 touch libgcrypt-$LIBGCRYPT_VERSION-done
1275 uninstall_libgcrypt() {
1276 if [ ! -z "$installed_libgcrypt_version" ] ; then
1278 # GnuTLS depends on this, so uninstall it.
1280 uninstall_gnutls "$@"
1282 echo "Uninstalling libgcrypt:"
1283 cd libgcrypt-$installed_libgcrypt_version
1284 $DO_MAKE_UNINSTALL || exit 1
1285 make distclean || exit 1
1287 rm libgcrypt-$installed_libgcrypt_version-done
1289 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1291 # Get rid of the previously downloaded and unpacked version.
1293 rm -rf libgcrypt-$installed_libgcrypt_version
1294 rm -rf libgcrypt-$installed_libgcrypt_version.tar.gz
1297 installed_libgcrypt_version=""
1302 if [ "$GNUTLS_VERSION" -a ! -f gnutls-$GNUTLS_VERSION-done ] ; then
1304 # GnuTLS requires libgcrypt (or nettle, in newer versions).
1306 if [ -z $LIBGCRYPT_VERSION ]
1308 echo "GnuTLS requires libgcrypt, but you didn't install libgcrypt" 1>&2
1312 echo "Downloading, building, and installing GnuTLS:"
1313 [ -f gnutls-$GNUTLS_VERSION.tar.bz2 ] || curl -L -O http://ftp.gnu.org/gnu/gnutls/gnutls-$GNUTLS_VERSION.tar.bz2 || exit 1
1314 bzcat gnutls-$GNUTLS_VERSION.tar.bz2 | tar xf - || exit 1
1315 cd gnutls-$GNUTLS_VERSION
1317 # Use libgcrypt instead of nettle since it is already required by
1320 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
1321 make $MAKE_BUILD_OPTS || exit 1
1323 # The pkgconfig file for GnuTLS says "requires zlib", but OS X,
1324 # while it supplies zlib, doesn't supply a pkgconfig file for
1327 # Patch the GnuTLS pkgconfig file not to require zlib.
1328 # (If the capabilities of GnuTLS that Wireshark uses don't
1329 # depend on building GnuTLS with zlib, an alternative would be
1330 # to configure it not to use zlib.)
1332 patch -p0 lib/gnutls.pc.in <../../macosx-support-lib-patches/gnutls-pkgconfig.patch || exit 1
1333 $DO_MAKE_INSTALL || exit 1
1335 touch gnutls-$GNUTLS_VERSION-done
1339 uninstall_gnutls() {
1340 if [ ! -z "$installed_gnutls_version" ] ; then
1341 echo "Uninstalling GnuTLS:"
1342 cd gnutls-$installed_gnutls_version
1343 $DO_MAKE_UNINSTALL || exit 1
1344 make distclean || exit 1
1346 rm gnutls-$installed_gnutls_version-done
1348 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1350 # Get rid of the previously downloaded and unpacked version.
1352 rm -rf gnutls-$installed_gnutls_version
1353 rm -rf gnutls-$installed_gnutls_version.tar.bz2
1356 installed_gnutls_version=""
1361 if [ "$LUA_VERSION" -a ! -f lua-$LUA_VERSION-done ] ; then
1362 echo "Downloading, building, and installing Lua:"
1363 [ -f lua-$LUA_VERSION.tar.gz ] || curl -L -O http://www.lua.org/ftp/lua-$LUA_VERSION.tar.gz || exit 1
1364 gzcat lua-$LUA_VERSION.tar.gz | tar xf - || exit 1
1366 make MYCFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" MYLDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" $MAKE_BUILD_OPTS macosx || exit 1
1367 $DO_MAKE_INSTALL || exit 1
1369 touch lua-$LUA_VERSION-done
1374 if [ ! -z "$installed_lua_version" ] ; then
1375 echo "Uninstalling Lua:"
1377 # Lua has no "make uninstall", so just remove stuff manually.
1378 # There's no configure script, so there's no need for
1379 # "make distclean", either; just do "make clean".
1381 (cd /usr/local/bin; $DO_RM -f lua luac)
1382 (cd /usr/local/include; $DO_RM -f lua.h luaconf.h lualib.h lauxlib.h lua.hpp)
1383 (cd /usr/local/lib; $DO_RM -f liblua.a)
1384 (cd /usr/local/man/man1; $DO_RM -f lua.1 luac.1)
1385 cd lua-$installed_lua_version
1386 make clean || exit 1
1388 rm lua-$installed_lua_version-done
1390 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1392 # Get rid of the previously downloaded and unpacked version.
1394 rm -rf lua-$installed_lua_version
1395 rm -rf lua-$installed_lua_version.tar.gz
1398 installed_lua_version=""
1402 install_portaudio() {
1404 # Check for both the old versionless portaudio-done and the new
1405 # versioned -done file.
1407 if [ "$PORTAUDIO_VERSION" -a ! -f portaudio-$PORTAUDIO_VERSION-done ] ; then
1408 echo "Downloading, building, and installing PortAudio:"
1409 [ -f $PORTAUDIO_VERSION.tgz ] || curl -L -O http://www.portaudio.com/archives/$PORTAUDIO_VERSION.tgz || exit 1
1410 gzcat $PORTAUDIO_VERSION.tgz | tar xf - || exit 1
1413 # Un-comment an include that's required on Lion.
1415 patch -p0 include/pa_mac_core.h <../../macosx-support-lib-patches/portaudio-pa_mac_core.h.patch
1417 # Fix a bug that showed up with clang (but is a bug with any
1420 patch -p0 src/hostapi/coreaudio/pa_mac_core.c <../../macosx-support-lib-patches/portaudio-pa_mac_core.c.patch
1422 # Disable fat builds - the configure script doesn't work right
1423 # with Xcode 4 if you leave them enabled, and we don't build
1424 # any other libraries fat (GLib, for example, would be very
1425 # hard to build fat), so there's no advantage to having PortAudio
1428 # Set the minimum OS X version to 10.4, to suppress some
1429 # deprecation warnings. (Good luck trying to make any of
1430 # this build on an OS+Xcode with a pre-10.4 SDK; we don't
1431 # worry about the user requesting that.)
1433 # Explicitly disable deprecation, so the damn thing will build
1434 # on El Capitan with Xcode 7.
1436 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
1437 make $MAKE_BUILD_OPTS || exit 1
1438 $DO_MAKE_INSTALL || exit 1
1440 touch portaudio-$PORTAUDIO_VERSION-done
1444 uninstall_portaudio() {
1445 if [ ! -z "$installed_portaudio_version" ] ; then
1446 echo "Uninstalling PortAudio:"
1448 $DO_MAKE_UNINSTALL || exit 1
1449 make distclean || exit 1
1451 rm portaudio-$installed_portaudio_version-done
1453 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1455 # Get rid of the previously downloaded and unpacked version.
1458 rm -rf $installed_portaudio_version.tgz
1461 installed_portaudio_version=""
1466 if [ "$GEOIP_VERSION" -a ! -f geoip-$GEOIP_VERSION-done ] ; then
1467 echo "Downloading, building, and installing GeoIP API:"
1468 [ -f GeoIP-$GEOIP_VERSION.tar.gz ] || curl -L -O http://geolite.maxmind.com/download/geoip/api/c/GeoIP-$GEOIP_VERSION.tar.gz || exit 1
1469 gzcat GeoIP-$GEOIP_VERSION.tar.gz | tar xf - || exit 1
1470 cd GeoIP-$GEOIP_VERSION
1471 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1473 # Grr. Their man pages "helpfully" have an ISO 8859-1
1474 # copyright symbol in the copyright notice, but OS X's
1475 # default character encoding is UTF-8. sed on Mountain
1476 # Lion barfs at the "illegal character sequence" represented
1477 # by an ISO 8859-1 copyright symbol, as it's not a valid
1480 # iconv the relevant man pages into UTF-8.
1482 for i in geoipupdate.1.in geoiplookup6.1.in geoiplookup.1.in
1484 iconv -f iso8859-1 -t utf-8 man/"$i" >man/"$i".tmp &&
1485 mv man/"$i".tmp man/"$i"
1487 make $MAKE_BUILD_OPTS || exit 1
1488 $DO_MAKE_INSTALL || exit 1
1490 touch geoip-$GEOIP_VERSION-done
1495 if [ ! -z "$installed_geoip_version" ] ; then
1496 echo "Uninstalling GeoIP API:"
1497 cd GeoIP-$installed_geoip_version
1498 $DO_MAKE_UNINSTALL || exit 1
1499 make distclean || exit 1
1501 rm geoip-$installed_geoip_version-done
1503 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1505 # Get rid of the previously downloaded and unpacked version.
1507 rm -rf GeoIP-$installed_geoip_version
1508 rm -rf GeoIP-$installed_geoip_version.tar.gz
1511 installed_geoip_version=""
1516 if [ "$CARES_VERSION" -a ! -f c-ares-$CARES_VERSION-done ] ; then
1517 echo "Downloading, building, and installing C-Ares API:"
1518 [ -f c-ares-$CARES_VERSION.tar.gz ] || curl -L -O https://c-ares.haxx.se/download/c-ares-$CARES_VERSION.tar.gz || exit 1
1519 gzcat c-ares-$CARES_VERSION.tar.gz | tar xf - || exit 1
1520 cd c-ares-$CARES_VERSION
1521 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1522 make $MAKE_BUILD_OPTS || exit 1
1523 $DO_MAKE_INSTALL || exit 1
1525 touch c-ares-$CARES_VERSION-done
1529 uninstall_c_ares() {
1530 if [ ! -z "$installed_cares_version" ] ; then
1531 echo "Uninstalling C-Ares API:"
1532 cd c-ares-$installed_cares_version
1533 $DO_MAKE_UNINSTALL || exit 1
1534 make distclean || exit 1
1536 rm c-ares-$installed_cares_version-done
1538 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1540 # Get rid of the previously downloaded and unpacked version.
1542 rm -rf c-ares-$installed_cares_version
1543 rm -rf c-ares-$installed_cares_version.tar.gz
1546 installed_cares_version=""
1551 if [ "$LIBSSH_VERSION" -a ! -f libssh-$LIBSSH_VERSION-done ] ; then
1552 echo "Downloading, building, and installing libssh:"
1553 [ -f libssh-$LIBSSH_VERSION.tar.xz ] || curl -L -O https://red.libssh.org/attachments/download/195/libssh-$LIBSSH_VERSION.tar.xz || exit 1
1554 xzcat libssh-$LIBSSH_VERSION.tar.xz | tar xf - || exit 1
1555 cd libssh-$LIBSSH_VERSION
1558 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" cmake -DWITH_GCRYPT=1 ../ || exit 1
1559 make $MAKE_BUILD_OPTS || exit 1
1560 $DO_MAKE_INSTALL || exit 1
1562 touch libssh-$LIBSSH_VERSION-done
1566 uninstall_libssh() {
1567 if [ ! -z "$installed_libssh_version" ] ; then
1568 echo "Sadly, libssh uses cmake, and doesn't support uninstall."
1573 if [ "$NGHTTP2_VERSION" -a ! -f nghttp2-$NGHTTP2_VERSION-done ] ; then
1574 echo "Downloading, building, and installing nghttp2:"
1575 [ -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
1576 xzcat nghttp2-$NGHTTP2_VERSION.tar.xz | tar xf - || exit 1
1577 cd nghttp2-$NGHTTP2_VERSION
1578 ./configure || exit 1
1579 make $MAKE_BUILD_OPTS || exit 1
1580 $DO_MAKE_INSTALL || exit 1
1582 touch nghttp2-$NGHTTP2_VERSION-done
1586 uninstall_nghttp2() {
1587 if [ ! -z "$installed_nghttp2_version" ] ; then
1588 echo "Uninstalling nghttp2:"
1589 cd nghttp2-$installed_nghttp2_version
1590 $DO_MAKE_UNINSTALL || exit 1
1591 make distclean || exit 1
1593 rm nghttp2-$installed_nghttp2_version-done
1595 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1597 # Get rid of the previously downloaded and unpacked version.
1599 rm -rf nghttp2-$installed_nghttp2_version
1600 rm -rf nghttp2-$installed_nghttp2_version.tar.xz
1603 installed_nghttp2_version=""
1609 # Check whether the versions we have installed are the versions
1610 # requested; if not, uninstall the installed versions.
1612 if [ ! -z "$installed_nghttp2_version" -a \
1613 "$installed_nghttp2_version" != "$NGHTTP2_VERSION" ] ; then
1614 echo "Installed nghttp2 version is $installed_nghttp2_version"
1615 if [ -z "$NGHTTP2_VERSION" ] ; then
1616 echo "nghttp2 is not requested"
1618 echo "Requested nghttp2 version is $NGHTTP2_VERSION"
1620 uninstall_nghttp2 -r
1623 if [ ! -z "$installed_libssh_version" -a \
1624 "$installed_libssh_version" != "$LIBSSH_VERSION" ] ; then
1625 echo "Installed libssh version is $installed_libssh_version"
1626 if [ -z "$LIBSSH_VERSION" ] ; then
1627 echo "libssh is not requested"
1629 echo "Requested libssh version is $LIBSSH_VERSION"
1634 if [ ! -z "$installed_cares_version" -a \
1635 "$installed_cares_version" != "$CARES_VERSION" ] ; then
1636 echo "Installed C-Ares version is $installed_cares_version"
1637 if [ -z "$CARES_VERSION" ] ; then
1638 echo "C-Ares is not requested"
1640 echo "Requested C-Ares version is $CARES_VERSION"
1645 if [ ! -z "$installed_geoip_version" -a \
1646 "$installed_geoip_version" != "$GEOIP_VERSION" ] ; then
1647 echo "Installed GeoIP API version is $installed_geoip_version"
1648 if [ -z "$GEOIP_VERSION" ] ; then
1649 echo "GeoIP is not requested"
1651 echo "Requested GeoIP version is $GEOIP_VERSION"
1656 if [ ! -z "$installed_lz4_version" -a \
1657 "$installed_lz4_version" != "$LZ4_VERSION" ] ; then
1658 echo "Installed LZ4 version is $installed_lz4_version"
1659 if [ -z "$LZ4_VERSION" ] ; then
1660 echo "LZ4 is not requested"
1662 echo "Requested LZ4 version is $LZ4_VERSION"
1667 if [ ! -z "$installed_snappy_version" -a \
1668 "$installed_snappy_version" != "$SNAPPY_VERSION" ] ; then
1669 echo "Installed SNAPPY version is $installed_snappy_version"
1670 if [ -z "$SNAPPY_VERSION" ] ; then
1671 echo "SNAPPY is not requested"
1673 echo "Requested SNAPPY version is $SNAPPY_VERSION"
1678 if [ ! -z "$installed_sbc_version" -a \
1679 "$installed_sbc_version" != "$SBC_VERSION" ] ; then
1680 echo "Installed SBC version is $installed_sbc_version"
1681 if [ -z "$SBC_VERSION" ] ; then
1682 echo "SBC is not requested"
1684 echo "Requested SBC version is $SBC_VERSION"
1689 if [ ! -z "$installed_portaudio_version" -a \
1690 "$installed_portaudio_version" != "$PORTAUDIO_VERSION" ] ; then
1691 echo "Installed PortAudio version is $installed_portaudio_version"
1692 if [ -z "$PORTAUDIO_VERSION" ] ; then
1693 echo "PortAudio is not requested"
1695 echo "Requested PortAudio version is $PORTAUDIO_VERSION"
1697 uninstall_portaudio -r
1700 if [ ! -z "$installed_lua_version" -a \
1701 "$installed_lua_version" != "$LUA_VERSION" ] ; then
1702 echo "Installed Lua version is $installed_lua_version"
1703 if [ -z "$LUA_VERSION" ] ; then
1704 echo "Lua is not requested"
1706 echo "Requested Lua version is $LUA_VERSION"
1711 if [ ! -z "$installed_gnutls_version" -a \
1712 "$installed_gnutls_version" != "$GNUTLS_VERSION" ] ; then
1713 echo "Installed GnuTLS version is $installed_gnutls_version"
1714 if [ -z "$GNUTLS_VERSION" ] ; then
1715 echo "GnuTLS is not requested"
1717 echo "Requested GnuTLS version is $GNUTLS_VERSION"
1722 if [ ! -z "$installed_libgcrypt_version" -a \
1723 "$installed_libgcrypt_version" != "$LIBGCRYPT_VERSION" ] ; then
1724 echo "Installed libgcrypt version is $installed_libgcrypt_version"
1725 if [ -z "$LIBGCRYPT_VERSION" ] ; then
1726 echo "libgcrypt is not requested"
1728 echo "Requested libgcrypt version is $LIBGCRYPT_VERSION"
1730 uninstall_libgcrypt -r
1733 if [ ! -z "$installed_libgpg_error_version" -a \
1734 "$installed_libgpg_error_version" != "$LIBGPG_ERROR_VERSION" ] ; then
1735 echo "Installed libgpg-error version is $installed_libgpg_error_version"
1736 if [ -z "$LIBGPG_ERROR_VERSION" ] ; then
1737 echo "libgpg-error is not requested"
1739 echo "Requested libgpg-error version is $LIBGPG_ERROR_VERSION"
1741 uninstall_libgpg_error -r
1744 if [ ! -z "$installed_libsmi_version" -a \
1745 "$installed_libsmi_version" != "$LIBSMI_VERSION" ] ; then
1746 echo "Installed libsmi version is $installed_libsmi_version"
1747 if [ -z "$LIBSMI_VERSION" ] ; then
1748 echo "libsmi is not requested"
1750 echo "Requested libsmi version is $LIBSMI_VERSION"
1755 if [ ! -z "$installed_gtk_version" -a \
1756 "$installed_gtk_version" != "$GTK_VERSION" ] ; then
1757 echo "Installed GTK+ version is $installed_gtk_version"
1758 if [ -z "$GTK_VERSION" ] ; then
1759 echo "GTK+ is not requested"
1761 echo "Requested GTK+ version is $GTK_VERSION"
1766 if [ ! -z "$installed_gdk_pixbuf_version" -a \
1767 "$installed_gdk_pixbuf_version" != "$GDK_PIXBUF_VERSION" ] ; then
1768 echo "Installed gdk-pixbuf version is $installed_gdk_pixbuf_version"
1769 if [ -z "$GDK_PIXBUF_VERSION" ] ; then
1770 echo "gdk-pixbuf is not requested"
1772 echo "Requested gdk-pixbuf version is $GDK_PIXBUF_VERSION"
1774 uninstall_gdk_pixbuf -r
1777 if [ ! -z "$installed_pango_version" -a \
1778 "$installed_pango_version" != "$PANGO_VERSION" ] ; then
1779 echo "Installed Pango version is $installed_pango_version"
1780 if [ -z "$PANGO_VERSION" ] ; then
1781 echo "Pango is not requested"
1783 echo "Requested Pango version is $PANGO_VERSION"
1788 if [ ! -z "$installed_atk_version" -a \
1789 "$installed_atk_version" != "$ATK_VERSION" ] ; then
1790 echo "Installed ATK version is $installed_atk_version"
1791 if [ -z "$ATK_VERSION" ] ; then
1792 echo "ATK is not requested"
1794 echo "Requested ATK version is $ATK_VERSION"
1799 if [ ! -z "$installed_cairo_version" -a \
1800 "$installed_cairo_version" != "$CAIRO_VERSION" ] ; then
1801 echo "Installed Cairo version is $installed_cairo_version"
1802 if [ -z "$CAIRO_VERSION" ] ; then
1803 echo "Cairo is not requested"
1805 echo "Requested Cairo version is $CAIRO_VERSION"
1810 if [ ! -z "$installed_pixman_version" -a \
1811 "$installed_pixman_version" != "$PIXMAN_VERSION" ] ; then
1812 echo "Installed pixman version is $installed_pixman_version"
1813 if [ -z "$PIXMAN_VERSION" ] ; then
1814 echo "pixman is not requested"
1816 echo "Requested pixman version is $PIXMAN_VERSION"
1821 if [ ! -z "$installed_libpng_version" -a \
1822 "$installed_libpng_version" != "$PNG_VERSION" ] ; then
1823 echo "Installed libpng version is $installed_libpng_version"
1824 if [ -z "$PNG_VERSION" ] ; then
1825 echo "libpng is not requested"
1827 echo "Requested libpng version is $PNG_VERSION"
1832 if [ ! -z "$installed_qt_version" -a \
1833 "$installed_qt_version" != "$QT_VERSION" ] ; then
1834 echo "Installed Qt version is $installed_qt_version"
1835 if [ -z "$QT_VERSION" ] ; then
1836 echo "Qt is not requested"
1838 echo "Requested Qt version is $QT_VERSION"
1843 if [ ! -z "$installed_glib_version" -a \
1844 "$installed_glib_version" != "$GLIB_VERSION" ] ; then
1845 echo "Installed GLib version is $installed_glib_version"
1846 if [ -z "$GLIB_VERSION" ] ; then
1847 echo "GLib is not requested"
1849 echo "Requested GLib version is $GLIB_VERSION"
1854 if [ ! -z "$installed_pkg_config_version" -a \
1855 "$installed_pkg_config_version" != "$PKG_CONFIG_VERSION" ] ; then
1856 echo "Installed pkg-config version is $installed_pkg_config_version"
1857 if [ -z "$PKG_CONFIG_VERSION" ] ; then
1858 echo "pkg-config is not requested"
1860 echo "Requested pkg-config version is $PKG_CONFIG_VERSION"
1862 uninstall_pkg_config -r
1865 if [ ! -z "$installed_gettext_version" -a \
1866 "$installed_gettext_version" != "$GETTEXT_VERSION" ] ; then
1867 echo "Installed GNU gettext version is $installed_gettext_version"
1868 if [ -z "$GETTEXT_VERSION" ] ; then
1869 echo "GNU gettext is not requested"
1871 echo "Requested GNU gettext version is $GETTEXT_VERSION"
1873 uninstall_gettext -r
1876 if [ ! -z "$installed_cmake_version" -a \
1877 "$installed_cmake_version" != "$CMAKE_VERSION" ] ; then
1878 echo "Installed CMake version is $installed_cmake_version"
1879 if [ -z "$CMAKE_VERSION" ] ; then
1880 echo "CMake is not requested"
1882 echo "Requested CMake version is $CMAKE_VERSION"
1885 # XXX - really remove this?
1886 # Or should we remember it as installed only if this script
1892 if [ ! -z "$installed_libtool_version" -a \
1893 "$installed_libtool_version" != "$LIBTOOL_VERSION" ] ; then
1894 echo "Installed GNU libtool version is $installed_libtool_version"
1895 if [ -z "$LIBTOOL_VERSION" ] ; then
1896 echo "GNU libtool is not requested"
1898 echo "Requested GNU libtool version is $LIBTOOL_VERSION"
1900 uninstall_libtool -r
1903 if [ ! -z "$installed_automake_version" -a \
1904 "$installed_automake_version" != "$AUTOMAKE_VERSION" ] ; then
1905 echo "Installed GNU automake version is $installed_automake_version"
1906 if [ -z "$AUTOMAKE_VERSION" ] ; then
1907 echo "GNU automake is not requested"
1909 echo "Requested GNU automake version is $AUTOMAKE_VERSION"
1911 uninstall_automake -r
1914 if [ ! -z "$installed_autoconf_version" -a \
1915 "$installed_autoconf_version" != "$AUTOCONF_VERSION" ] ; then
1916 echo "Installed GNU autoconf version is $installed_autoconf_version"
1917 if [ -z "$AUTOCONF_VERSION" ] ; then
1918 echo "GNU autoconf is not requested"
1920 echo "Requested GNU autoconf version is $AUTOCONF_VERSION"
1922 uninstall_autoconf -r
1925 if [ ! -z "$installed_xz_version" -a \
1926 "$installed_xz_version" != "$XZ_VERSION" ] ; then
1927 echo "Installed xz version is $installed_xz_version"
1928 if [ -z "$XZ_VERSION" ] ; then
1929 echo "xz is not requested"
1931 echo "Requested xz version is $XZ_VERSION"
1937 # Start with xz: It is the sole download format of glib later than 2.31.2
1950 # Start with GNU gettext; GLib requires it, and OS X doesn't have it
1951 # or a BSD-licensed replacement.
1953 # At least on Lion with Xcode 4, _FORTIFY_SOURCE gets defined as 2
1954 # by default, which causes, for example, stpncpy to be defined as
1955 # a hairy macro that collides with the GNU gettext configure script's
1956 # attempts to workaround AIX's lack of a declaration for stpncpy,
1957 # with the result being a huge train wreck. Define _FORTIFY_SOURCE
1958 # as 0 in an attempt to keep the trains on separate tracks.
1963 # GLib depends on pkg-config.
1964 # By default, pkg-config depends on GLib; we break the dependency cycle
1965 # by configuring pkg-config to use its own internal version of GLib.
1972 # Now we have reached a point where we can build everything but
1973 # the GUI (Wireshark).
1977 if [ "$GTK_VERSION" ]; then
1979 # GTK+ 3 requires a newer Cairo build than the one that comes with
1980 # 10.6, so we build Cairo if we are using GTK+ 3.
1982 # In 10.6 and 10.7, it's an X11 library; if we build with "native" GTK+
1983 # rather than X11 GTK+, we might have to build and install Cairo.
1984 # In 10.8 and later, there is no X11, but it's included in Xquartz;
1985 # again, if we build with "native" GTK+, we'd have to build and install
1988 if [[ "$GTK_MAJOR_VERSION" -eq 3 || "$cairo_not_in_the_os" = yes ]]; then
1990 # Requirements for Cairo first
1992 # The libpng that comes with the X11 for Leopard has a bogus
1993 # pkg-config file that lies about where the header files are,
1994 # which causes other packages not to be able to find its
1997 # The libpng in later versions is not what the version of
1998 # libpixman we build below wants - it wants libpng15.
2003 # The libpixman versions that come with the X11s for Leopard,
2004 # Snow Leopard, and Lion is too old to support Cairo's image
2005 # surface backend feature (which requires pixman-1 >= 0.22.0).
2007 # XXX - what about the one that comes with the latest version
2013 # And now Cairo itself.
2014 # XXX - with the libxcb that comes with 10.6,
2015 # xcb_discard_reply() is missing, and the build fails.
2030 # Now we have reached a point where we can build everything including
2031 # the GUI (Wireshark), but not with any optional features such as
2032 # SNMP OID resolution, some forms of decryption, Lua scripting, playback
2033 # of audio, or GeoIP mapping of IP addresses.
2035 # We now conditionally download optional libraries to support them;
2036 # the default is to download them all.
2041 install_libgpg_error
2067 if [ -d macosx-support-libs ]
2069 cd macosx-support-libs
2072 # Uninstall items in the reverse order from the order in which they're
2073 # installed. Only uninstall if the download/build/install process
2074 # completed; uninstall the version that appears in the name of
2077 # We also do a "make distclean", so that we don't have leftovers from
2078 # old configurations.
2102 uninstall_libgpg_error
2108 uninstall_gdk_pixbuf
2124 uninstall_pkg_config
2129 # XXX - really remove this?
2130 # Or should we remember it as installed only if this script
2146 # Do we have permission to write in /usr/local?
2148 # If so, assume we have permission to write in its subdirectories.
2149 # (If that's not the case, this test needs to check the subdirectories
2152 # If not, do "make install", "make uninstall", the removes for Lua,
2153 # and the renames of [g]libtool* with sudo.
2155 if [ -w /usr/local ]
2157 DO_MAKE_INSTALL="make install"
2158 DO_MAKE_UNINSTALL="make uninstall"
2162 DO_MAKE_INSTALL="sudo make install"
2163 DO_MAKE_UNINSTALL="sudo make uninstall"
2169 # If we have SDKs available, the default target OS is the major version
2170 # of the one we're running; get that and strip off the third component
2173 for i in /Developer/SDKs \
2174 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
2175 /Library/Developer/CommandLineTools/SDKs
2179 min_osx_target=`sw_vers -productVersion | sed 's/\([0-9]*\)\.\([0-9]*\)\.[0-9]*/\1.\2/'`
2182 # That's also the OS whose SDK we'd be using.
2184 sdk_target=$min_osx_target
2190 # Parse command-line flags:
2193 # -t <target> - build libraries so that they'll work on the specified
2194 # version of OS X and later versions.
2195 # -u - do an uninstall.
2197 while getopts ht:u name
2204 min_osx_target="$OPTARG"
2207 echo "Usage: macosx-setup.sh [ -t <target> ] [ -u ]" 1>&1
2214 # Get the version numbers of installed packages, if any.
2216 if [ -d macosx-support-libs ]
2218 cd macosx-support-libs
2220 installed_xz_version=`ls xz-*-done 2>/dev/null | sed 's/xz-\(.*\)-done/\1/'`
2221 installed_autoconf_version=`ls autoconf-*-done 2>/dev/null | sed 's/autoconf-\(.*\)-done/\1/'`
2222 installed_automake_version=`ls automake-*-done 2>/dev/null | sed 's/automake-\(.*\)-done/\1/'`
2223 installed_libtool_version=`ls libtool-*-done 2>/dev/null | sed 's/libtool-\(.*\)-done/\1/'`
2224 installed_cmake_version=`ls cmake-*-done 2>/dev/null | sed 's/cmake-\(.*\)-done/\1/'`
2225 installed_gettext_version=`ls gettext-*-done 2>/dev/null | sed 's/gettext-\(.*\)-done/\1/'`
2226 installed_pkg_config_version=`ls pkg-config-*-done 2>/dev/null | sed 's/pkg-config-\(.*\)-done/\1/'`
2227 installed_glib_version=`ls glib-*-done 2>/dev/null | sed 's/glib-\(.*\)-done/\1/'`
2228 installed_qt_version=`ls qt-*-done 2>/dev/null | sed 's/qt-\(.*\)-done/\1/'`
2229 installed_libpng_version=`ls libpng-*-done 2>/dev/null | sed 's/libpng-\(.*\)-done/\1/'`
2230 installed_pixman_version=`ls pixman-*-done 2>/dev/null | sed 's/pixman-\(.*\)-done/\1/'`
2231 installed_cairo_version=`ls cairo-*-done 2>/dev/null | sed 's/cairo-\(.*\)-done/\1/'`
2232 installed_atk_version=`ls atk-*-done 2>/dev/null | sed 's/atk-\(.*\)-done/\1/'`
2233 installed_pango_version=`ls pango-*-done 2>/dev/null | sed 's/pango-\(.*\)-done/\1/'`
2234 installed_gdk_pixbuf_version=`ls gdk-pixbuf-*-done 2>/dev/null | sed 's/gdk-pixbuf-\(.*\)-done/\1/'`
2235 installed_gtk_version=`ls gtk+-*-done 2>/dev/null | sed 's/gtk+-\(.*\)-done/\1/'`
2236 installed_libsmi_version=`ls libsmi-*-done 2>/dev/null | sed 's/libsmi-\(.*\)-done/\1/'`
2237 installed_libgpg_error_version=`ls libgpg-error-*-done 2>/dev/null | sed 's/libgpg-error-\(.*\)-done/\1/'`
2238 installed_libgcrypt_version=`ls libgcrypt-*-done 2>/dev/null | sed 's/libgcrypt-\(.*\)-done/\1/'`
2239 installed_gnutls_version=`ls gnutls-*-done 2>/dev/null | sed 's/gnutls-\(.*\)-done/\1/'`
2240 installed_lua_version=`ls lua-*-done 2>/dev/null | sed 's/lua-\(.*\)-done/\1/'`
2241 installed_portaudio_version=`ls portaudio-*-done 2>/dev/null | sed 's/portaudio-\(.*\)-done/\1/'`
2242 installed_snappy_version=`ls snappy-*-done 2>/dev/null | sed 's/snappy-\(.*\)-done/\1/'`
2243 installed_lz4_version=`ls lz4-*-done 2>/dev/null | sed 's/lz4-\(.*\)-done/\1/'`
2244 installed_sbc_version=`ls sbc-*-done 2>/dev/null | sed 's/sbc-\(.*\)-done/\1/'`
2245 installed_geoip_version=`ls geoip-*-done 2>/dev/null | sed 's/geoip-\(.*\)-done/\1/'`
2246 installed_cares_version=`ls c-ares-*-done 2>/dev/null | sed 's/c-ares-\(.*\)-done/\1/'`
2247 installed_libssh_version=`ls libssh-*-done 2>/dev/null | sed 's/libssh-\(.*\)-done/\1/'`
2248 installed_nghttp2_version=`ls nghttp2-*-done 2>/dev/null | sed 's/nghttp2-\(.*\)-done/\1/'`
2251 # If we don't have a versioned -done file for portaudio, but do have
2252 # an unversioned -done file for it, assume the installed version is the
2253 # requested version, and rename the -done file to include that version.
2255 if [ -z "$installed_portaudio_version" -a -f portaudio-done ] ; then
2256 mv portaudio-done portaudio-$PORTAUDIO_VERSION-done
2257 installed_portaudio_version=`ls portaudio-*-done 2>/dev/null | sed 's/portaudio-\(.*\)-done/\1/'`
2263 if [ "$do_uninstall" = "yes" ]
2270 # Configure scripts tend to set CFLAGS and CXXFLAGS to "-g -O2" if
2271 # invoked without CFLAGS or CXXFLAGS being set in the environment.
2273 # However, we *are* setting them in the environment, for our own
2274 # nefarious purposes, so start them out as "-g -O2".
2280 # To make this work on Leopard (rather than working *on* Snow Leopard
2281 # when building *for* Leopard) will take more work.
2283 # For one thing, Leopard's /usr/X11/lib/libXdamage.la claims, at least
2284 # with all software updates applied, that the Xdamage shared library
2285 # is libXdamage.1.0.0.dylib, but it is, in fact, libXdamage.1.1.0.dylib.
2286 # This causes problems when building GTK+, so the script would have to
2289 if [[ $DARWIN_MAJOR_VERSION -le 9 ]]; then
2290 echo "This script does not support any versions of OS X before Snow Leopard" 1>&2
2294 # if no make options are present, set default options
2295 if [ -z "$MAKE_BUILD_OPTS" ] ; then
2296 # by default use 1.5x number of cores for parallel build
2297 MAKE_BUILD_OPTS="-j $(( $(sysctl -n hw.logicalcpu) * 3 / 2))"
2301 # If we have a target release, look for the oldest SDK that's for an
2302 # OS equal to or later than that one, and build libraries against it
2303 # rather than against the headers and, more importantly, libraries
2304 # that come with the OS, so that we don't end up with support libraries
2305 # that only work on the OS version on which we built them, not earlier
2306 # versions of the same release, or earlier releases if the minimum is
2309 if [ ! -z "$min_osx_target" ]
2312 # Get the real version - strip off the "10.".
2313 # We'll worry about that if, as, and when there's ever
2316 deploy_real_version=`echo "$min_osx_target" | sed -n 's/10\.\(.*\)/\1/p'`
2319 # Search each directory that might contain SDKs.
2322 for sdksdir in /Developer/SDKs \
2323 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
2324 /Library/Developer/CommandLineTools/SDKs
2327 # Get a list of all the SDKs.
2329 if ! test -d "$sdksdir"
2332 # There is no directory with that name.
2333 # Move on to the next one in the list, if any.
2339 # Get a list of all the SDKs in that directory, if any.
2341 sdklist=`(cd "$sdksdir"; ls -d MacOSX10.[0-9]*.sdk 2>/dev/null)`
2346 # Get the real version for this SDK.
2348 sdk_real_version=`echo "$sdk" | sed -n 's/MacOSX10\.\(.*\)\.sdk/\1/p'`
2351 # Is it for the deployment target or some later release?
2353 if test "$sdk_real_version" -ge "$deploy_real_version"
2358 sdkpath="$sdksdir/$sdk"
2359 qt_sdk_arg="-sdk $sdk"
2365 if [ -z "$sdkpath" ]
2367 echo "macosx-setup.sh: Couldn't find an SDK for OS X $min_osx_target or later" 1>&2
2372 sdk_target=10.$sdk_real_version
2373 echo "Using the 10.$sdk_real_version SDK"
2376 # Make sure there are links to /usr/local/include and /usr/local/lib
2377 # in the SDK's usr/local.
2379 if [ ! -e $SDKPATH/usr/local/include ]
2381 if [ ! -d $SDKPATH/usr/local ]
2383 sudo mkdir $SDKPATH/usr/local
2385 sudo ln -s /usr/local/include $SDKPATH/usr/local/include
2387 if [ ! -e $SDKPATH/usr/local/lib ]
2389 if [ ! -d $SDKPATH/usr/local ]
2391 sudo mkdir $SDKPATH/usr/local
2393 sudo ln -s /usr/local/lib $SDKPATH/usr/local/lib
2397 # Set the minimum OS version for which to build to the specified
2398 # minimum target OS version, so we don't, for example, end up using
2399 # linker features supported by the OS verson on which we're building
2400 # but not by the target version.
2402 VERSION_MIN_FLAGS="-mmacosx-version-min=$min_osx_target"
2405 # Compile and link against the SDK.
2407 SDKFLAGS="-isysroot $SDKPATH"
2409 if [[ "$min_osx_target" == "10.5" ]]
2412 # Cairo is part of Mac OS X 10.6 and later.
2413 # The *headers* are supplied by 10.5, but the *libraries*
2414 # aren't, so we have to build it if we're building for 10.5.
2416 cairo_not_in_the_os=yes
2419 # Build with older versions of the support libraries, as
2420 # were used on the Wireshark Leopard buildbot at one
2421 # point. (Most of these versions come from the About page
2422 # from Wireshark 1.8.6, the last build done on that buildbot;
2423 # the ATK version isn't reported, so this is a guess.)
2425 # If you want to try building with newer versions of
2426 # the libraries, note that:
2428 # The version of fontconfig that comes with Leopard doesn't
2429 # support FC_WEIGHT_EXTRABLACK, so we can't use any version
2430 # of Pango newer than 1.22.4.
2432 # However, Pango 1.22.4 doesn't work with versions of GLib
2433 # after 2.29.6, because Pango 1.22.4 uses G_CONST_RETURN and
2434 # GLib 2.29.8 and later deprecate it (there doesn't appear to
2435 # be a GLib 2.29.7). That means we'd either have to patch
2436 # Pango not to use it (just use "const"; G_CONST_RETURN was
2437 # there to allow code to choose whether to use "const" or not),
2438 # or use GLib 2.29.6 or earlier.
2440 # GLib 2.29.6 includes an implementation of g_bit_lock() that,
2441 # on x86 (32-bit and 64-bit), uses asms in a fashion
2442 # ("asm volatile goto") that requires GCC 4.5 or later, which
2443 # is later than the compilers that come with Leopard and Snow
2444 # Leopard. Recent versions of GLib check for that, but 2.29.6
2445 # doesn't, so, if you want to build GLib 2.29.6 on Leopard or
2446 # Snow Leopard, you would have to patch glib/gbitlock.c to do
2447 # what the newer versions of GLib do:
2449 # define a USE_ASM_GOTO macro that indicates whether "asm goto"
2451 # #if (defined (i386) || defined (__amd64__))
2452 # #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
2453 # #define USE_ASM_GOTO 1
2457 # replace all occurrences of
2459 # #if defined (__GNUC__) && (defined (i386) || defined (__amd64__))
2463 # #ifdef USE_ASM_GOTO
2465 # Using GLib 2.29.6 or earlier, however, means that we can't
2466 # use a version of ATK later than 2.3.93, as those versions
2467 # don't work with GLib 2.29.6. The same applies to gdk-pixbuf;
2468 # versions of gdk-pixbuf after 2.24.1 won't work with GLib
2471 # Then you have to make sure that what you've build doesn't
2472 # cause the X server that comes with Leopard to crash; at
2473 # least one attempt at building for Leopard did.
2475 # At least if building on Leopard, you might also find
2476 # that, with various older versions of Cairo, including
2477 # 1.6.4 and at least some 1.8.x versions, when you try to
2478 # build it, the build fails because it can't find
2479 # png_set_longjmp_fn(). I vaguely remember dealing with that,
2480 # ages ago, but don't remember what I did.
2483 if [ "$CAIRO_VERSION" ]
2487 if [ "$ATK_VERSION" ]
2491 if [ "$PANGO_VERSION" ]
2493 PANGO_VERSION=1.20.2
2495 if [ "$GTK_VERSION" ]
2501 # That version of GTK+ includes gdk-pixbuf.
2502 # XXX - base this on the version of GTK+ requested.
2507 # Libgcrypt 1.5.0 fails to compile due to some problem with an
2508 # asm in rijndael.c, at least with i686-apple-darwin10-gcc-4.2.1
2509 # (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) when building
2512 # We try libgcrypt 1.4.3 instead, as that's what shows up in
2513 # the version from the Leopard buildbot.
2514 LIBGCRYPT_VERSION=1.4.3
2517 # Build 32-bit while we're at it; Leopard has a bug that
2518 # causes some BPF functions not to work with 64-bit userland
2519 # code, so capturing won't work.
2521 CFLAGS="$CFLAGS -arch i386"
2522 CXXFLAGS="$CXXFLAGS -arch i386"
2523 export LDFLAGS="$LDFLAGS -arch i386"
2531 # You need Xcode or the command-line tools installed to get the compilers.
2533 if [ ! -x /usr/bin/xcodebuild ]; then
2534 echo "Please install Xcode first (should be available on DVD or from the Mac App Store)."
2538 if [ "$QT_VERSION" ]; then
2540 # We need Xcode, not just the command-line tools, installed to build
2543 # At least with Xcode 8, /usr/bin/xcodebuild --help fails if only
2544 # the command-line tools are installed and succeeds if Xcode is
2545 # installed. Unfortunately, it fails *with* Xcode 3, but
2546 # /usr/bin/xcodebuild -version works with that and with Xcode 8.
2547 # Hopefully it fails with only the command-line tools installed.
2549 if /usr/bin/xcodebuild -version >/dev/null 2>&1; then
2552 echo "Please install Xcode first (should be available on DVD or from the Mac App Store)."
2553 echo "The command-line build tools are not sufficient to build Qt."
2557 if [ "$GTK_VERSION" ]; then
2559 # If we're building with GTK+, you also need the X11 SDK; with at least
2560 # some versions of OS X and Xcode, that is, I think, an optional install.
2561 # (Or it might be installed with X11, but I think *that* is an optional
2562 # install on at least some versions of OS X.)
2564 if [ ! -d /usr/X11/include ]; then
2565 echo "Please install X11 and the X11 SDK first."
2566 echo " You can either download the latest package from"
2567 echo " http://www.xquartz.org/ and install it or install"
2568 echo " the native Apple package if you are on Lion or below."
2573 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig
2576 # Do all the downloads and untarring in a subdirectory, so all that
2577 # stuff can be removed once we've installed the support libraries.
2579 if [ ! -d macosx-support-libs ]
2581 mkdir macosx-support-libs || exit 1
2583 cd macosx-support-libs
2590 # Indicate what paths to use for pkg-config and cmake.
2592 pkg_config_path=/usr/local/lib/pkgconfig
2593 if [ "$QT_VERSION" ]; then
2594 qt_base_path=$HOME/Qt$QT_VERSION/$QT_MAJOR_MINOR_VERSION/clang_64
2595 pkg_config_path="$pkg_config_path":"$qt_base_path/lib/pkgconfig"
2596 CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH":"$qt_base_path/lib/cmake"
2598 pkg_config_path="$pkg_config_path":/usr/X11/lib/pkgconfig
2600 echo "You are now prepared to build Wireshark."
2602 if [[ $CMAKE ]]; then
2603 echo "To build with CMAKE:"
2605 echo "export PKG_CONFIG_PATH=$pkg_config_path"
2606 echo "export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH"
2607 echo "export PATH=$PATH:$qt_base_path/bin"
2609 echo "mkdir build; cd build"
2611 echo "make $MAKE_BUILD_OPTS app_bundle"
2612 echo "make install/strip"
2615 if [[ $AUTOTOOLS ]]; then
2616 echo "To build with AUTOTOOLS:"
2618 echo "export PKG_CONFIG_PATH=$pkg_config_path"
2621 echo "mkdir build; cd build"
2623 echo "make $MAKE_BUILD_OPTS"
2627 echo "Make sure you are allowed capture access to the network devices"
2628 echo "See: https://wiki.wireshark.org/CaptureSetup/CapturePrivileges"