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=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 # If you don't want to build with Qt, comment out the QT_VERSION= line.
73 # Note that Qt 5, prior to 5.5.0, mishandles context menus in ways that,
74 # for example, cause them not to work reliably in the packet detail or
75 # packet data pane; see, for example, Qt bugs QTBUG-31937, QTBUG-41017,
76 # and QTBUG-43464, all of which seem to be the same bug.
78 # If you want to build with GTK+ 2, comment out the GTK_VERSION=3.* line
79 # and un-comment the GTK_VERSION=2.* line.
81 # If you don't want to build with GTK+ at all, comment out both lines.
86 if [ "$GTK_VERSION" ]; then
88 # We'll be building GTK+, so we need some additional libraries.
90 GTK_MAJOR_VERSION="`expr $GTK_VERSION : '\([0-9][0-9]*\).*'`"
91 GTK_MINOR_VERSION="`expr $GTK_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
92 GTK_DOTDOT_VERSION="`expr $GTK_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
99 GDK_PIXBUF_VERSION=2.28.0
101 if [ "$QT_VERSION" ]; then
102 QT_MAJOR_VERSION="`expr $QT_VERSION : '\([0-9][0-9]*\).*'`"
103 QT_MINOR_VERSION="`expr $QT_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
104 QT_DOTDOT_VERSION="`expr $QT_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
105 QT_MAJOR_MINOR_VERSION=$QT_MAJOR_VERSION.$QT_MINOR_VERSION
106 QT_MAJOR_MINOR_DOTDOT_VERSION=$QT_MAJOR_VERSION.$QT_MINOR_VERSION.$QT_DOTDOT_VERSION
109 # In case we want to build GTK *and* we don't have Apple's X11 SDK installed
110 # we may want to install XQuartz. The version will only be used in the printing
111 # of a URL, the package will not be installed.
113 XQUARTZ_VERSION=2.7.5
115 # The following libraries are optional.
116 # Comment them out if you don't want them, but note that some of
117 # the optional libraries are required by other optional libraries.
121 # libgpg-error is required for libgcrypt.
123 LIBGPG_ERROR_VERSION=1.10
125 # libgcrypt is required for GnuTLS.
127 LIBGCRYPT_VERSION=1.5.0
128 GNUTLS_VERSION=2.12.19
129 # Use 5.2.3, not 5.3, for now; lua_bitop.c hasn't been ported to 5.3
130 # yet, and we need to check for compatibility issues (we'd want Lua
131 # scripts to work with 5.1, 5.2, and 5.3, as long as they only use Lua
132 # features present in all three versions)
134 PORTAUDIO_VERSION=pa_stable_v19_20111121
136 # XXX - they appear to have an unversioned gzipped tarball for the
137 # current version; should we just download that, with some other
138 # way of specifying whether to download the GeoIP API?
144 DARWIN_MAJOR_VERSION=`uname -r | sed 's/\([0-9]*\).*/\1/'`
147 # GNU autotools; they're provided with releases up to Snow Leopard, but
148 # not in later releases.
150 if [ -n "$AUTOTOOLS" -a $DARWIN_MAJOR_VERSION -gt 10 ]; then
151 AUTOCONF_VERSION=2.69
152 AUTOMAKE_VERSION=1.13.3
153 LIBTOOL_VERSION=2.4.2
157 if [ "$XZ_VERSION" -a ! -f xz-$XZ_VERSION-done ] ; then
158 echo "Downloading, building, and installing xz:"
159 [ -f xz-$XZ_VERSION.tar.bz2 ] || curl -O http://tukaani.org/xz/xz-$XZ_VERSION.tar.bz2 || exit 1
160 bzcat xz-$XZ_VERSION.tar.bz2 | tar xf - || exit 1
162 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0" ./configure || exit 1
163 make $MAKE_BUILD_OPTS || exit 1
164 $DO_MAKE_INSTALL || exit 1
166 touch xz-$XZ_VERSION-done
171 if [ ! -z "$installed_xz_version" ] ; then
172 echo "Uninstalling xz:"
173 cd xz-$installed_xz_version
174 $DO_MAKE_UNINSTALL || exit 1
175 make distclean || exit 1
177 rm xz-$installed_xz_version-done
179 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
181 # Get rid of the previously downloaded and unpacked version.
183 rm -rf xz-$installed_xz_version
184 rm -rf xz-$installed_xz_version.tar.bz2
187 installed_xz_version=""
192 if [ "$AUTOCONF_VERSION" -a ! -f autoconf-$AUTOCONF_VERSION-done ] ; then
193 echo "Downloading, building and installing GNU autoconf..."
194 [ -f autoconf-$AUTOCONF_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/autoconf/autoconf-$AUTOCONF_VERSION.tar.xz || exit 1
195 xzcat autoconf-$AUTOCONF_VERSION.tar.xz | tar xf - || exit 1
196 cd autoconf-$AUTOCONF_VERSION
197 ./configure || exit 1
198 make $MAKE_BUILD_OPTS || exit 1
199 $DO_MAKE_INSTALL || exit 1
201 touch autoconf-$AUTOCONF_VERSION-done
205 uninstall_autoconf() {
206 if [ ! -z "$installed_autoconf_version" ] ; then
208 # automake and libtool depend on this, so uninstall them.
213 echo "Uninstalling GNU autoconf:"
214 cd autoconf-$installed_autoconf_version
215 $DO_MAKE_UNINSTALL || exit 1
216 make distclean || exit 1
218 rm autoconf-$installed_autoconf_version-done
220 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
222 # Get rid of the previously downloaded and unpacked version.
224 rm -rf autoconf-$installed_autoconf_version
225 rm -rf autoconf-$installed_autoconf_version.tar.xz
228 installed_autoconf_version=""
233 if [ "$AUTOMAKE_VERSION" -a ! -f automake-$AUTOMAKE_VERSION-done ] ; then
234 echo "Downloading, building and installing GNU automake..."
235 [ -f automake-$AUTOMAKE_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/automake/automake-$AUTOMAKE_VERSION.tar.xz || exit 1
236 xzcat automake-$AUTOMAKE_VERSION.tar.xz | tar xf - || exit 1
237 cd automake-$AUTOMAKE_VERSION
238 ./configure || exit 1
239 make $MAKE_BUILD_OPTS || exit 1
240 $DO_MAKE_INSTALL || exit 1
242 touch automake-$AUTOMAKE_VERSION-done
246 uninstall_automake() {
247 if [ ! -z "$installed_automake_version" ] ; then
249 # libtool depends on this(?), so uninstall it.
251 uninstall_libtool "$@"
253 echo "Uninstalling GNU automake:"
254 cd automake-$installed_automake_version
255 $DO_MAKE_UNINSTALL || exit 1
256 make distclean || exit 1
258 rm automake-$installed_automake_version-done
260 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
262 # Get rid of the previously downloaded and unpacked version.
264 rm -rf automake-$installed_automake_version
265 rm -rf automake-$installed_automake_version.tar.xz
268 installed_automake_version=""
273 if [ "$LIBTOOL_VERSION" -a ! -f libtool-$LIBTOOL_VERSION-done ] ; then
274 echo "Downloading, building and installing GNU libtool..."
275 [ -f libtool-$LIBTOOL_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/libtool/libtool-$LIBTOOL_VERSION.tar.xz || exit 1
276 xzcat libtool-$LIBTOOL_VERSION.tar.xz | tar xf - || exit 1
277 cd libtool-$LIBTOOL_VERSION
278 ./configure || exit 1
279 make $MAKE_BUILD_OPTS || exit 1
280 $DO_MAKE_INSTALL || exit 1
281 $DO_MV /usr/local/bin/libtool /usr/local/bin/glibtool
282 $DO_MV /usr/local/bin/libtoolize /usr/local/bin/glibtoolize
284 touch libtool-$LIBTOOL_VERSION-done
288 uninstall_libtool() {
289 if [ ! -z "$installed_libtool_version" ] ; then
290 echo "Uninstalling GNU libtool:"
291 cd libtool-$installed_libtool_version
292 $DO_MV /usr/local/bin/glibtool /usr/local/bin/libtool
293 $DO_MV /usr/local/bin/glibtoolize /usr/local/bin/libtoolize
294 $DO_MAKE_UNINSTALL || exit 1
295 make distclean || exit 1
297 rm libtool-$installed_libtool_version-done
299 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
301 # Get rid of the previously downloaded and unpacked version.
303 rm -rf libtool-$installed_libtool_version
304 rm -rf libtool-$installed_libtool_version.tar.xz
307 installed_libtool_version=""
312 if [ -n "$CMAKE" -a ! -f cmake-$CMAKE_VERSION-done ]; then
313 echo "Downloading and installing CMake:"
314 CMAKE_MAJOR_VERSION="`expr $CMAKE_VERSION : '\([0-9][0-9]*\).*'`"
315 CMAKE_MINOR_VERSION="`expr $CMAKE_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
316 CMAKE_DOTDOT_VERSION="`expr $CMAKE_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
317 CMAKE_MAJOR_MINOR_VERSION=$CMAKE_MAJOR_VERSION.$CMAKE_MINOR_VERSION
320 # NOTE: the "64" in "Darwin64" doesn't mean "64-bit-only"; the
321 # package in question supports both 32-bit and 64-bit x86.
323 case "$CMAKE_MAJOR_VERSION" in
326 echo "CMake $CMAKE_VERSION" is too old 1>&2
331 # Download the DMG, run the installer.
333 [ -f cmake-$CMAKE_VERSION-Darwin64-universal.dmg ] || curl -O http://www.cmake.org/files/v$CMAKE_MAJOR_MINOR_VERSION/cmake-$CMAKE_VERSION-Darwin64-universal.dmg || exit 1
334 sudo hdiutil attach cmake-$CMAKE_VERSION-Darwin64-universal.dmg || exit 1
335 sudo installer -target / -pkg /Volumes/cmake-$CMAKE_VERSION-Darwin64-universal/cmake-$CMAKE_VERSION-Darwin64-universal.pkg || exit 1
336 sudo hdiutil detach /Volumes/cmake-$CMAKE_VERSION-Darwin64-universal
341 # Download the DMG and do a drag install, where "drag" means
344 # 3.0.* and 3.1.0 have a Darwin64-universal DMG.
345 # 3.1.1 and later have a Darwin-x86_64 DMG.
346 # Probably not many people are still developing on 32-bit
347 # Macs, so we don't worry about them.
349 if [ "$CMAKE_MINOR_VERSION" = 0 -o \
350 "$CMAKE_VERSION" = 3.1.0 ]; then
351 type="Darwin64-universal"
355 [ -f cmake-$CMAKE_VERSION-$type.dmg ] || curl -O http://www.cmake.org/files/v$CMAKE_MAJOR_MINOR_VERSION/cmake-$CMAKE_VERSION-$type.dmg || exit 1
356 sudo hdiutil attach cmake-$CMAKE_VERSION-$type.dmg || exit 1
357 sudo ditto /Volumes/cmake-$CMAKE_VERSION-$type/CMake.app /Applications/CMake.app || exit 1
360 # Plant the appropriate symbolic links in /usr/local/bin.
361 # It's a drag-install, so there's no installer to make them,
362 # and the CMake code to put them in place is lame, as
364 # 1) it defaults to /usr/bin, not /usr/local/bin;
365 # 2) it doesn't request the necessary root privileges;
366 # 3) it can't be run from the command line;
368 # so we do it ourselves.
370 for i in ccmake cmake cmake-gui cmakexbuild cpack ctest
372 sudo ln -s /Applications/CMake.app/Contents/bin/$i /usr/local/bin/$i
374 sudo hdiutil detach /Volumes/cmake-$CMAKE_VERSION-$type
380 touch cmake-$CMAKE_VERSION-done
385 if [ ! -z "$installed_cmake_version" ]; then
386 echo "Uninstalling CMake:"
387 installed_cmake_major_version="`expr $installed_cmake_version : '\([0-9][0-9]*\).*'`"
388 case "$installed_cmake_major_version" in
391 echo "CMake $installed_cmake_version" is too old 1>&2
395 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
396 for i in ccmake cmake cmake-gui cmakexbuild cpack ctest
398 sudo rm -f /usr/bin/$i /usr/local/bin/$i
400 sudo pkgutil --forget com.Kitware.CMake
401 rm cmake-$installed_cmake_version-done
405 sudo rm -rf /Applications/CMake.app
406 for i in ccmake cmake cmake-gui cmakexbuild cpack ctest
408 sudo rm -f /usr/local/bin/$i
410 rm cmake-$installed_cmake_version-done
414 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
416 # Get rid of the previously downloaded and unpacked version,
417 # whatever it might happen to be called.
419 rm -f cmake-$installed_cmake_version-Darwin64-universal.dmg
420 rm -f cmake-$installed_cmake_version-Darwin-x86_64.dmg
423 installed_cmake_version=""
428 if [ ! -f gettext-$GETTEXT_VERSION-done ] ; then
429 echo "Downloading, building, and installing GNU gettext:"
430 [ -f gettext-$GETTEXT_VERSION.tar.gz ] || curl -O http://ftp.gnu.org/pub/gnu/gettext/gettext-$GETTEXT_VERSION.tar.gz || exit 1
431 gzcat gettext-$GETTEXT_VERSION.tar.gz | tar xf - || exit 1
432 cd gettext-$GETTEXT_VERSION
433 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0 $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
434 make $MAKE_BUILD_OPTS || exit 1
435 $DO_MAKE_INSTALL || exit 1
437 touch gettext-$GETTEXT_VERSION-done
441 uninstall_gettext() {
442 if [ ! -z "$installed_gettext_version" ] ; then
444 # GLib depends on this, so uninstall it.
448 echo "Uninstalling GNU gettext:"
449 cd gettext-$installed_gettext_version
450 $DO_MAKE_UNINSTALL || exit 1
451 make distclean || exit 1
453 rm gettext-$installed_gettext_version-done
455 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
457 # Get rid of the previously downloaded and unpacked version.
459 rm -rf gettext-$installed_gettext_version
460 rm -rf gettext-$installed_gettext_version.tar.gz
463 installed_gettext_version=""
467 install_pkg_config() {
468 if [ ! -f pkg-config-$PKG_CONFIG_VERSION-done ] ; then
469 echo "Downloading, building, and installing pkg-config:"
470 [ -f pkg-config-$PKG_CONFIG_VERSION.tar.gz ] || curl -O http://pkgconfig.freedesktop.org/releases/pkg-config-$PKG_CONFIG_VERSION.tar.gz || exit 1
471 gzcat pkg-config-$PKG_CONFIG_VERSION.tar.gz | tar xf - || exit 1
472 cd pkg-config-$PKG_CONFIG_VERSION
473 ./configure --with-internal-glib || exit 1
474 make $MAKE_BUILD_OPTS || exit 1
475 $DO_MAKE_INSTALL || exit 1
477 touch pkg-config-$PKG_CONFIG_VERSION-done
481 uninstall_pkg_config() {
482 if [ ! -z "$installed_pkg_config_version" ] ; then
483 echo "Uninstalling pkg-config:"
484 cd pkg-config-$installed_pkg_config_version
485 $DO_MAKE_UNINSTALL || exit 1
486 make distclean || exit 1
488 rm pkg-config-$installed_pkg_config_version-done
490 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
492 # Get rid of the previously downloaded and unpacked version.
494 rm -rf pkg-config-$installed_pkg_config_version
495 rm -rf pkg-config-$installed_pkg_config_version.tar.gz
498 installed_pkg_config_version=""
503 if [ ! -f glib-$GLIB_VERSION-done ] ; then
504 echo "Downloading, building, and installing GLib:"
505 glib_dir=`expr $GLIB_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
506 GLIB_MAJOR_VERSION="`expr $GLIB_VERSION : '\([0-9][0-9]*\).*'`"
507 GLIB_MINOR_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
508 GLIB_DOTDOT_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
509 if [[ $GLIB_MAJOR_VERSION -gt 2 ||
510 $GLIB_MINOR_VERSION -gt 28 ||
511 ($GLIB_MINOR_VERSION -eq 28 && $GLIB_DOTDOT_VERSION -ge 8) ]]
514 # Starting with GLib 2.28.8, xz-compressed tarballs are available.
516 [ -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
517 xzcat glib-$GLIB_VERSION.tar.xz | tar xf - || exit 1
519 [ -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
520 bzcat glib-$GLIB_VERSION.tar.bz2 | tar xf - || exit 1
522 cd glib-$GLIB_VERSION
524 # OS X ships with libffi, but doesn't provide its pkg-config file;
525 # explicitly specify LIBFFI_CFLAGS and LIBFFI_LIBS, so the configure
526 # script doesn't try to use pkg-config to get the appropriate
527 # C flags and loader flags.
529 # And, what's worse, at least with the version of Xcode that comes
530 # with Leopard, /usr/include/ffi/fficonfig.h doesn't define MACOSX,
531 # which causes the build of GLib to fail. If we don't find
532 # "#define.*MACOSX" in /usr/include/ffi/fficonfig.h, explicitly
535 # While we're at it, suppress -Wformat-nonliteral to avoid a case
536 # where clang's stricter rules on when not to complain about
537 # non-literal format arguments cause it to complain about code
538 # that's safe but it wasn't told that. See my comment #25 in
541 # https://bugzilla.gnome.org/show_bug.cgi?id=691608#c25
543 # First, determine where the system include files are. (It's not
544 # necessarily /usr/include.) There's a bit of a greasy hack here;
545 # pre-5.x versions of the developer tools don't support the
546 # --show-sdk-path option, and will produce no output, so includedir
547 # will be set to /usr/include (in those older versions of the
548 # developer tools, there is a /usr/include directory).
550 includedir=`xcrun --show-sdk-path 2>/dev/null`/usr/include
551 if grep -qs '#define.*MACOSX' $includedir/ffi/fficonfig.h
553 # It's defined, nothing to do
554 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
556 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
560 # Apply the fix to GNOME bug 529806:
562 # https://bugzilla.gnome.org/show_bug.cgi?id=529806
564 # if we have a version of GLib prior to 2.30.
566 if [[ $GLIB_MAJOR_VERSION -eq 2 && $GLIB_MINOR_VERSION -le 30 ]]
568 patch -p0 <../../macosx-support-lib-patches/glib-gconvert.c.patch || exit 1
570 make $MAKE_BUILD_OPTS || exit 1
571 $DO_MAKE_INSTALL || exit 1
573 touch glib-$GLIB_VERSION-done
578 if [ ! -z "$installed_glib_version" ] ; then
580 # ATK, Pango, and GTK depend on this, so uninstall them.
586 echo "Uninstalling GLib:"
587 cd glib-$installed_glib_version
588 $DO_MAKE_UNINSTALL || exit 1
589 make distclean || exit 1
591 rm glib-$installed_glib_version-done
593 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
595 # Get rid of the previously downloaded and unpacked version.
597 rm -rf glib-$installed_glib_version
598 rm -rf glib-$installed_glib_version.tar.xz glib-$installed_glib_version.tar.bz2
601 installed_glib_version=""
606 if [ "$QT_VERSION" -a ! -f qt-$QT_VERSION-done ]; then
607 echo "Downloading, building, and installing Qt:"
609 # What you get for this URL might just be a 302 Found reply, so use
610 # -L so we get redirected.
612 if [ "$QT_MAJOR_VERSION" -ge 5 ]
614 QT_VOLUME=qt-opensource-mac-x64-clang-$QT_VERSION
616 QT_VOLUME=qt-opensource-mac-$QT_VERSION
618 [ -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
619 sudo hdiutil attach $QT_VOLUME.dmg || exit 1
621 if [ "$QT_MAJOR_VERSION" -ge 5 ]
624 # Run the installer executable directly, so that we wait for
625 # it to finish. Then unmount the volume.
627 /Volumes/$QT_VOLUME/$QT_VOLUME.app/Contents/MacOS/$QT_VOLUME
628 sudo hdiutil detach /Volumes/$QT_VOLUME
631 # Open the installer package; use -W, so that we wait for
632 # the installer to finish. Then unmount the volume.
634 open -W "/Volumes/Qt $QT_MAJOR_MINOR_DOTDOT_VERSION/Qt.mpkg"
635 sudo hdiutil detach "/Volumes/Qt $QT_MAJOR_MINOR_DOTDOT_VERSION"
639 # Versions 5.3.x through 5.5.0, at least, have bogus .pc files.
640 # See bugs QTBUG-35256 and QTBUG-47162.
644 for i in $HOME/Qt$QT_VERSION/$QT_MAJOR_MINOR_VERSION/clang_64/lib/pkgconfig/*.pc
648 g/Cflags: /s;;Cflags: -F\${libdir} ;
649 g/Cflags: /s;-I\${includedir}/Qt\([a-zA-Z0-9_]*\);-I\${libdir}/Qt\1.framework/Versions/5/Headers;
655 touch qt-$QT_VERSION-done
660 if [ ! -z "$installed_qt_version" ] ; then
661 echo "Uninstalling Qt:"
662 rm -rf $HOME/Qt$installed_qt_version
663 rm qt-$installed_qt_version-done
665 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
667 # Get rid of the previously downloaded version.
669 rm -rf qt-opensource-mac-x64-clang-$installed_qt_version.dmg
672 installed_qt_version=""
677 if [ ! -f libpng-$PNG_VERSION-done ] ; then
678 echo "Downloading, building, and installing libpng:"
680 # The FTP site puts libpng x.y.* into a libpngxy directory.
682 subdir=`echo $PNG_VERSION | sed 's/\([1-9][0-9]*\)\.\([1-9][0-9]*\).*/libpng\1\2'/`
683 [ -f libpng-$PNG_VERSION.tar.xz ] || curl -O ftp://ftp.simplesystems.org/pub/libpng/png/src/$subdir/libpng-$PNG_VERSION.tar.xz
684 xzcat libpng-$PNG_VERSION.tar.xz | tar xf - || exit 1
685 cd libpng-$PNG_VERSION
686 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
687 make $MAKE_BUILD_OPTS || exit 1
688 $DO_MAKE_INSTALL || exit 1
690 touch libpng-$PNG_VERSION-done
695 if [ ! -z "$installed_libpng_version" ] ; then
697 # Cairo depends on this, so uninstall it.
701 echo "Uninstalling libpng:"
702 cd libpng-$installed_libpng_version
703 $DO_MAKE_UNINSTALL || exit 1
704 make distclean || exit 1
706 rm libpng-$installed_libpng_version-done
708 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
710 # Get rid of the previously downloaded and unpacked version.
712 rm -rf libpng-$installed_libpng_version
713 rm -rf libpng-$installed_libpng_version.tar.xz
716 installed_libpng_version=""
721 if [ ! -f pixman-$PIXMAN_VERSION-done ] ; then
722 echo "Downloading, building, and installing pixman:"
723 [ -f pixman-$PIXMAN_VERSION.tar.gz ] || curl -O http://www.cairographics.org/releases/pixman-$PIXMAN_VERSION.tar.gz
724 gzcat pixman-$PIXMAN_VERSION.tar.gz | tar xf - || exit 1
725 cd pixman-$PIXMAN_VERSION
726 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
727 make $MAKE_BUILD_OPTS || exit 1
728 $DO_MAKE_INSTALL || exit 1
730 touch pixman-$PIXMAN_VERSION-done
735 if [ ! -z "$installed_pixman_version" ] ; then
737 # Cairo depends on this, so uninstall it.
741 echo "Uninstalling pixman:"
742 cd pixman-$installed_pixman_version
743 $DO_MAKE_UNINSTALL || exit 1
744 make distclean || exit 1
746 rm pixman-$installed_pixman_version-done
748 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
750 # Get rid of the previously downloaded and unpacked version.
752 rm -rf pixman-$installed_pixman_version
753 rm -rf pixman-$installed_pixman_version.tar.gz
756 installed_pixman_version=""
761 if [ ! -f cairo-$CAIRO_VERSION-done ] ; then
762 echo "Downloading, building, and installing Cairo:"
763 CAIRO_MAJOR_VERSION="`expr $CAIRO_VERSION : '\([0-9][0-9]*\).*'`"
764 CAIRO_MINOR_VERSION="`expr $CAIRO_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
765 CAIRO_DOTDOT_VERSION="`expr $CAIRO_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
766 if [[ $CAIRO_MAJOR_VERSION -gt 1 ||
767 $CAIRO_MINOR_VERSION -gt 12 ||
768 ($CAIRO_MINOR_VERSION -eq 12 && $CAIRO_DOTDOT_VERSION -ge 2) ]]
771 # Starting with Cairo 1.12.2, the tarballs are compressed with
772 # xz rather than gzip.
774 [ -f cairo-$CAIRO_VERSION.tar.xz ] || curl -O http://cairographics.org/releases/cairo-$CAIRO_VERSION.tar.xz || exit 1
775 xzcat cairo-$CAIRO_VERSION.tar.xz | tar xf - || exit 1
777 [ -f cairo-$CAIRO_VERSION.tar.gz ] || curl -O http://cairographics.org/releases/cairo-$CAIRO_VERSION.tar.gz || exit 1
778 gzcat cairo-$CAIRO_VERSION.tar.gz | tar xf - || exit 1
780 cd cairo-$CAIRO_VERSION
781 # CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-quartz=no || exit 1
782 # Maybe follow http://cairographics.org/end_to_end_build_for_mac_os_x/
783 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-quartz=yes || exit 1
785 # We must avoid the version of libpng that comes with X11; the
786 # only way I've found to force that is to forcibly set INCLUDES
787 # when we do the build, so that this comes before CAIRO_CFLAGS,
788 # which has -I/usr/X11/include added to it before anything
789 # connected to libpng is.
791 INCLUDES="-I/usr/local/include/libpng15" make $MAKE_BUILD_OPTS || exit 1
792 $DO_MAKE_INSTALL || exit 1
794 touch cairo-$CAIRO_VERSION-done
799 if [ ! -z "$installed_cairo_version" ] ; then
801 # GTK+ depends on this, so uninstall it.
805 echo "Uninstalling Cairo:"
806 cd cairo-$installed_cairo_version
807 $DO_MAKE_UNINSTALL || exit 1
808 make distclean || exit 1
810 rm cairo-$installed_cairo_version-done
812 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
814 # Get rid of the previously downloaded and unpacked version.
816 rm -rf cairo-$installed_cairo_version
817 rm -rf cairo-$installed_cairo_version.tar.xz cairo-$installed_cairo_version.tar.gz
820 installed_cairo_version=""
825 if [ ! -f atk-$ATK_VERSION-done ] ; then
826 echo "Downloading, building, and installing ATK:"
827 atk_dir=`expr $ATK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
828 ATK_MAJOR_VERSION="`expr $ATK_VERSION : '\([0-9][0-9]*\).*'`"
829 ATK_MINOR_VERSION="`expr $ATK_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
830 ATK_DOTDOT_VERSION="`expr $ATK_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
831 if [[ $ATK_MAJOR_VERSION -gt 2 ||
832 ($ATK_MAJOR_VERSION -eq 2 && $ATK_MINOR_VERSION -gt 0) ||
833 ($ATK_MANOR_VERSION -eq 2 && $ATK_MINOR_VERSION -eq 0 && $ATK_DOTDOT_VERSION -ge 1) ]]
836 # Starting with ATK 2.0.1, xz-compressed tarballs are available.
838 [ -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
839 xzcat atk-$ATK_VERSION.tar.xz | tar xf - || exit 1
841 [ -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
842 bzcat atk-$ATK_VERSION.tar.bz2 | tar xf - || exit 1
845 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
846 make $MAKE_BUILD_OPTS || exit 1
847 $DO_MAKE_INSTALL || exit 1
849 touch atk-$ATK_VERSION-done
854 if [ ! -z "$installed_atk_version" ] ; then
856 # GTK+ depends on this, so uninstall it.
860 echo "Uninstalling ATK:"
861 cd atk-$installed_atk_version
862 $DO_MAKE_UNINSTALL || exit 1
863 make distclean || exit 1
865 rm atk-$installed_atk_version-done
867 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
869 # Get rid of the previously downloaded and unpacked version.
871 rm -rf atk-$installed_atk_version
872 rm -rf atk-$installed_atk_version.tar.xz atk-$installed_atk_version.tar.bz2
875 installed_atk_version=""
880 if [ ! -f pango-$PANGO_VERSION-done ] ; then
881 echo "Downloading, building, and installing Pango:"
882 pango_dir=`expr $PANGO_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
883 PANGO_MAJOR_VERSION="`expr $PANGO_VERSION : '\([0-9][0-9]*\).*'`"
884 PANGO_MINOR_VERSION="`expr $PANGO_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
885 if [[ $PANGO_MAJOR_VERSION -gt 1 ||
886 $PANGO_MINOR_VERSION -ge 29 ]]
889 # Starting with Pango 1.29, the tarballs are compressed with
890 # xz rather than bzip2.
892 [ -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
893 xzcat pango-$PANGO_VERSION.tar.xz | tar xf - || exit 1
895 [ -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
896 bzcat pango-$PANGO_VERSION.tar.bz2 | tar xf - || exit 1
898 cd pango-$PANGO_VERSION
899 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
900 make $MAKE_BUILD_OPTS || exit 1
901 $DO_MAKE_INSTALL || exit 1
903 touch pango-$PANGO_VERSION-done
908 if [ ! -z "$installed_pango_version" ] ; then
910 # GTK+ depends on this, so uninstall it.
914 echo "Uninstalling Pango:"
915 cd pango-$installed_pango_version
916 $DO_MAKE_UNINSTALL || exit 1
917 make distclean || exit 1
919 rm pango-$installed_pango_version-done
921 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
923 # Get rid of the previously downloaded and unpacked version.
925 rm -rf pango-$installed_pango_version
926 rm -rf pango-$installed_pango_version.tar.xz pango-$installed_pango_version.tar.bz2
929 installed_pango_version=""
933 install_gdk_pixbuf() {
934 if [ "$GDK_PIXBUF_VERSION" -a ! -f gdk-pixbuf-$GDK_PIXBUF_VERSION-done ] ; then
935 echo "Downloading, building, and installing gdk-pixbuf:"
936 gdk_pixbuf_dir=`expr $GDK_PIXBUF_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
937 [ -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
938 xzcat gdk-pixbuf-$GDK_PIXBUF_VERSION.tar.xz | tar xf - || exit 1
939 cd gdk-pixbuf-$GDK_PIXBUF_VERSION
941 # If we're building using the 10.6 SDK, force the use of libpng12.
943 # The OS's X11, and corresponding SDK, didn't introduce libpng15,
944 # or pkg-config files, until 10.7, so, for 10.6 have to explicitly
945 # set LIBPNG to override the configure script, and also force the
946 # CFLAGS to look for the header files for libpng12 (note that
947 # -isysroot doesn't affect the arguments to -I, so we need to
948 # include the SDK path explicitly).
950 if [[ "$sdk_target" = 10.6 ]]
952 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
954 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
956 make $MAKE_BUILD_OPTS || exit 1
957 $DO_MAKE_INSTALL || exit 1
959 touch gdk-pixbuf-$GDK_PIXBUF_VERSION-done
963 uninstall_gdk_pixbuf() {
964 if [ ! -z "$installed_gdk_pixbuf_version" ] ; then
966 # GTK+ depends on this, so uninstall it.
970 echo "Uninstalling gdk-pixbuf:"
971 cd gdk-pixbuf-$installed_gdk_pixbuf_version
972 $DO_MAKE_UNINSTALL || exit 1
973 make distclean || exit 1
975 rm gdk-pixbuf-$installed_gdk_pixbuf_version-done
977 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
979 # Get rid of the previously downloaded and unpacked version.
981 rm -rf gdk-pixbuf-$installed_gdk_pixbuf_version
982 rm -rf gdk-pixbuf-$installed_gdk_pixbuf_version.tar.xz
985 installed_gdk_pixbuf_version=""
990 if [ ! -f gtk+-$GTK_VERSION-done ] ; then
991 echo "Downloading, building, and installing GTK+:"
992 gtk_dir=`expr $GTK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
993 if [[ $GTK_MAJOR_VERSION -gt 2 ||
994 $GTK_MINOR_VERSION -gt 24 ||
995 ($GTK_MINOR_VERSION -eq 24 && $GTK_DOTDOT_VERSION -ge 5) ]]
998 # Starting with GTK+ 2.24.5, the tarballs are compressed with
999 # xz rather than gzip, in addition to bzip2; use xz, as we've
1000 # built and installed it, and as xz compresses better than
1001 # bzip2 so the tarballs take less time to download.
1003 [ -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
1004 xzcat gtk+-$GTK_VERSION.tar.xz | tar xf - || exit 1
1006 [ -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
1007 bzcat gtk+-$GTK_VERSION.tar.bz2 | tar xf - || exit 1
1009 cd gtk+-$GTK_VERSION
1010 if [ $DARWIN_MAJOR_VERSION -ge "12" ]
1013 # GTK+ 2.24.10, at least, doesn't build on Mountain Lion with the
1014 # CUPS printing backend - either the CUPS API changed incompatibly
1015 # or the backend was depending on non-API implementation details.
1017 # Configure it out, on Mountain Lion and later, for now.
1018 # (12 is the Darwin major version number in Mountain Lion.)
1020 # Also, configure out libtiff and libjpeg; configure scripts
1021 # just ignore unknown --enable/--disable and --with/--without
1022 # options (at least they've always do so up to now).
1024 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
1026 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
1028 make $MAKE_BUILD_OPTS || exit 1
1029 $DO_MAKE_INSTALL || exit 1
1031 touch gtk+-$GTK_VERSION-done
1036 if [ ! -z "$installed_gtk_version" ] ; then
1037 echo "Uninstalling GTK+:"
1038 cd gtk+-$installed_gtk_version
1039 $DO_MAKE_UNINSTALL || exit 1
1040 make distclean || exit 1
1042 rm gtk+-$installed_gtk_version-done
1044 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1046 # Get rid of the previously downloaded and unpacked version.
1048 rm -rf gtk+-$installed_gtk_version
1049 rm -rf gtk+-$installed_gtk_version.tar.xz gtk+-$installed_gtk_version.tar.bz2
1052 installed_gtk_version=""
1057 if [ "$LIBSMI_VERSION" -a ! -f libsmi-$LIBSMI_VERSION-done ] ; then
1058 echo "Downloading, building, and installing libsmi:"
1059 [ -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
1060 gzcat libsmi-$LIBSMI_VERSION.tar.gz | tar xf - || exit 1
1061 cd libsmi-$LIBSMI_VERSION
1062 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1063 make $MAKE_BUILD_OPTS || exit 1
1064 $DO_MAKE_INSTALL || exit 1
1066 touch libsmi-$LIBSMI_VERSION-done
1070 uninstall_libsmi() {
1071 if [ ! -z "$installed_libsmi_version" ] ; then
1072 echo "Uninstalling libsmi:"
1073 cd libsmi-$installed_libsmi_version
1074 $DO_MAKE_UNINSTALL || exit 1
1075 make distclean || exit 1
1077 rm libsmi-$installed_libsmi_version-done
1079 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1081 # Get rid of the previously downloaded and unpacked version.
1083 rm -rf libsmi-$installed_libsmi_version
1084 rm -rf libsmi-$installed_libsmi_version.tar.gz
1087 installed_libsmi_version=""
1091 install_libgpg_error() {
1092 if [ "$LIBGPG_ERROR_VERSION" -a ! -f libgpg-error-$LIBGPG_ERROR_VERSION-done ] ; then
1093 echo "Downloading, building, and installing libgpg-error:"
1094 [ -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
1095 bzcat libgpg-error-$LIBGPG_ERROR_VERSION.tar.bz2 | tar xf - || exit 1
1096 cd libgpg-error-$LIBGPG_ERROR_VERSION
1097 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1098 make $MAKE_BUILD_OPTS || exit 1
1099 $DO_MAKE_INSTALL || exit 1
1101 touch libgpg-error-$LIBGPG_ERROR_VERSION-done
1105 uninstall_libgpg_error() {
1106 if [ ! -z "$installed_libgpg_error_version" ] ; then
1108 # libgcrypt depends on this, so uninstall it.
1110 uninstall_libgcrypt "$@"
1112 echo "Uninstalling libgpg-error:"
1113 cd libgpg-error-$installed_libgpg_error_version
1114 $DO_MAKE_UNINSTALL || exit 1
1115 make distclean || exit 1
1117 rm libgpg-error-$installed_libgpg_error_version-done
1119 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1121 # Get rid of the previously downloaded and unpacked version.
1123 rm -rf libgpg-error-$installed_libgpg_error_version
1124 rm -rf libgpg-error-$installed_libgpg_error_version.tar.bz2
1127 installed_libgpg_error_version=""
1131 install_libgcrypt() {
1132 if [ "$LIBGCRYPT_VERSION" -a ! -f libgcrypt-$LIBGCRYPT_VERSION-done ] ; then
1134 # libgpg-error is required for libgcrypt.
1136 if [ -z $LIBGPG_ERROR_VERSION ]
1138 echo "libgcrypt requires libgpg-error, but you didn't install libgpg-error." 1>&2
1142 echo "Downloading, building, and installing libgcrypt:"
1143 [ -f libgcrypt-$LIBGCRYPT_VERSION.tar.gz ] || curl -L -O ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-$LIBGCRYPT_VERSION.tar.gz || exit 1
1144 gzcat libgcrypt-$LIBGCRYPT_VERSION.tar.gz | tar xf - || exit 1
1145 cd libgcrypt-$LIBGCRYPT_VERSION
1147 # The assembler language code is not compatible with the OS X
1148 # x86 assembler (or is it an x86-64 vs. x86-32 issue?).
1150 # libgcrypt expects gnu89, not c99/gnu99, semantics for
1151 # "inline". See, for example:
1153 # http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2010-October/198809.html
1155 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
1156 make $MAKE_BUILD_OPTS || exit 1
1157 $DO_MAKE_INSTALL || exit 1
1159 touch libgcrypt-$LIBGCRYPT_VERSION-done
1163 uninstall_libgcrypt() {
1164 if [ ! -z "$installed_libgcrypt_version" ] ; then
1166 # GnuTLS depends on this, so uninstall it.
1168 uninstall_gnutls "$@"
1170 echo "Uninstalling libgcrypt:"
1171 cd libgcrypt-$installed_libgcrypt_version
1172 $DO_MAKE_UNINSTALL || exit 1
1173 make distclean || exit 1
1175 rm libgcrypt-$installed_libgcrypt_version-done
1177 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1179 # Get rid of the previously downloaded and unpacked version.
1181 rm -rf libgcrypt-$installed_libgcrypt_version
1182 rm -rf libgcrypt-$installed_libgcrypt_version.tar.gz
1185 installed_libgcrypt_version=""
1190 if [ "$GNUTLS_VERSION" -a ! -f gnutls-$GNUTLS_VERSION-done ] ; then
1192 # GnuTLS requires libgcrypt (or nettle, in newer versions).
1194 if [ -z $LIBGCRYPT_VERSION ]
1196 echo "GnuTLS requires libgcrypt, but you didn't install libgcrypt" 1>&2
1200 echo "Downloading, building, and installing GnuTLS:"
1201 [ -f gnutls-$GNUTLS_VERSION.tar.bz2 ] || curl -L -O http://ftp.gnu.org/gnu/gnutls/gnutls-$GNUTLS_VERSION.tar.bz2 || exit 1
1202 bzcat gnutls-$GNUTLS_VERSION.tar.bz2 | tar xf - || exit 1
1203 cd gnutls-$GNUTLS_VERSION
1205 # Use libgcrypt, not nettle.
1206 # XXX - is there some reason to prefer nettle? Or does
1207 # Wireshark directly use libgcrypt routines?
1209 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
1210 make $MAKE_BUILD_OPTS || exit 1
1212 # The pkgconfig file for GnuTLS says "requires zlib", but OS X,
1213 # while it supplies zlib, doesn't supply a pkgconfig file for
1216 # Patch the GnuTLS pkgconfig file not to require zlib.
1217 # (If the capabilities of GnuTLS that Wireshark uses don't
1218 # depend on building GnuTLS with zlib, an alternative would be
1219 # to configure it not to use zlib.)
1221 patch -p0 lib/gnutls.pc.in <../../macosx-support-lib-patches/gnutls-pkgconfig.patch || exit 1
1222 $DO_MAKE_INSTALL || exit 1
1224 touch gnutls-$GNUTLS_VERSION-done
1228 uninstall_gnutls() {
1229 if [ ! -z "$installed_gnutls_version" ] ; then
1230 echo "Uninstalling GnuTLS:"
1231 cd gnutls-$installed_gnutls_version
1232 $DO_MAKE_UNINSTALL || exit 1
1233 make distclean || exit 1
1235 rm gnutls-$installed_gnutls_version-done
1237 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1239 # Get rid of the previously downloaded and unpacked version.
1241 rm -rf gnutls-$installed_gnutls_version
1242 rm -rf gnutls-$installed_gnutls_version.tar.bz2
1245 installed_gnutls_version=""
1250 if [ "$LUA_VERSION" -a ! -f lua-$LUA_VERSION-done ] ; then
1251 echo "Downloading, building, and installing Lua:"
1252 [ -f lua-$LUA_VERSION.tar.gz ] || curl -L -O http://www.lua.org/ftp/lua-$LUA_VERSION.tar.gz || exit 1
1253 gzcat lua-$LUA_VERSION.tar.gz | tar xf - || exit 1
1255 make MYCFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" MYLDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" $MAKE_BUILD_OPTS macosx || exit 1
1256 $DO_MAKE_INSTALL || exit 1
1258 touch lua-$LUA_VERSION-done
1263 if [ ! -z "$installed_lua_version" ] ; then
1264 echo "Uninstalling Lua:"
1266 # Lua has no "make uninstall", so just remove stuff manually.
1267 # There's no configure script, so there's no need for
1268 # "make distclean", either; just do "make clean".
1270 (cd /usr/local/bin; $DO_RM -f lua luac)
1271 (cd /usr/local/include; $DO_RM -f lua.h luaconf.h lualib.h lauxlib.h lua.hpp)
1272 (cd /usr/local/lib; $DO_RM -f liblua.a)
1273 (cd /usr/local/man/man1; $DO_RM -f lua.1 luac.1)
1274 cd lua-$installed_lua_version
1275 make clean || exit 1
1277 rm lua-$installed_lua_version-done
1279 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1281 # Get rid of the previously downloaded and unpacked version.
1283 rm -rf lua-$installed_lua_version
1284 rm -rf lua-$installed_lua_version.tar.gz
1287 installed_lua_version=""
1291 install_portaudio() {
1293 # Check for both the old versionless portaudio-done and the new
1294 # versioned -done file.
1296 if [ "$PORTAUDIO_VERSION" -a ! -f portaudio-$PORTAUDIO_VERSION-done ] ; then
1297 echo "Downloading, building, and installing PortAudio:"
1298 [ -f $PORTAUDIO_VERSION.tgz ] || curl -L -O http://www.portaudio.com/archives/$PORTAUDIO_VERSION.tgz || exit 1
1299 gzcat $PORTAUDIO_VERSION.tgz | tar xf - || exit 1
1302 # Un-comment an include that's required on Lion.
1304 patch -p0 include/pa_mac_core.h <../../macosx-support-lib-patches/portaudio-pa_mac_core.h.patch
1306 # Fix a bug that showed up with clang (but is a bug with any
1309 patch -p0 src/hostapi/coreaudio/pa_mac_core.c <../../macosx-support-lib-patches/portaudio-pa_mac_core.c.patch
1311 # Disable fat builds - the configure script doesn't work right
1312 # with Xcode 4 if you leave them enabled, and we don't build
1313 # any other libraries fat (GLib, for example, would be very
1314 # hard to build fat), so there's no advantage to having PortAudio
1317 # Set the minimum OS X version to 10.4, to suppress some
1318 # deprecation warnings. (Good luck trying to make any of
1319 # this build on an OS+Xcode with a pre-10.4 SDK; we don't
1320 # worry about the user requesting that.)
1322 # Explicitly disable deprecation, so the damn thing will build
1323 # on El Capitan with Xcode 7.
1325 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
1326 make $MAKE_BUILD_OPTS || exit 1
1327 $DO_MAKE_INSTALL || exit 1
1329 touch portaudio-$PORTAUDIO_VERSION-done
1333 uninstall_portaudio() {
1334 if [ ! -z "$installed_portaudio_version" ] ; then
1335 echo "Uninstalling PortAudio:"
1337 $DO_MAKE_UNINSTALL || exit 1
1338 make distclean || exit 1
1340 rm portaudio-$installed_portaudio_version-done
1342 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1344 # Get rid of the previously downloaded and unpacked version.
1347 rm -rf $installed_portaudio_version.tgz
1350 installed_portaudio_version=""
1355 if [ "$GEOIP_VERSION" -a ! -f geoip-$GEOIP_VERSION-done ] ; then
1356 echo "Downloading, building, and installing GeoIP API:"
1357 [ -f GeoIP-$GEOIP_VERSION.tar.gz ] || curl -L -O http://geolite.maxmind.com/download/geoip/api/c/GeoIP-$GEOIP_VERSION.tar.gz || exit 1
1358 gzcat GeoIP-$GEOIP_VERSION.tar.gz | tar xf - || exit 1
1359 cd GeoIP-$GEOIP_VERSION
1360 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1362 # Grr. Their man pages "helpfully" have an ISO 8859-1
1363 # copyright symbol in the copyright notice, but OS X's
1364 # default character encoding is UTF-8. sed on Mountain
1365 # Lion barfs at the "illegal character sequence" represented
1366 # by an ISO 8859-1 copyright symbol, as it's not a valid
1369 # iconv the relevant man pages into UTF-8.
1371 for i in geoipupdate.1.in geoiplookup6.1.in geoiplookup.1.in
1373 iconv -f iso8859-1 -t utf-8 man/"$i" >man/"$i".tmp &&
1374 mv man/"$i".tmp man/"$i"
1376 make $MAKE_BUILD_OPTS || exit 1
1377 $DO_MAKE_INSTALL || exit 1
1379 touch geoip-$GEOIP_VERSION-done
1384 if [ ! -z "$installed_geoip_version" ] ; then
1385 echo "Uninstalling GeoIP API:"
1386 cd GeoIP-$installed_geoip_version
1387 $DO_MAKE_UNINSTALL || exit 1
1388 make distclean || exit 1
1390 rm geoip-$installed_geoip_version-done
1392 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1394 # Get rid of the previously downloaded and unpacked version.
1396 rm -rf GeoIP-$installed_geoip_version
1397 rm -rf GeoIP-$installed_geoip_version.tar.gz
1400 installed_geoip_version=""
1405 if [ "$CARES_VERSION" -a ! -f c-ares-$CARES_VERSION-done ] ; then
1406 echo "Downloading, building, and installing C-Ares API:"
1407 [ -f c-ares-$CARES_VERSION.tar.gz ] || curl -L -O http://c-ares.haxx.se/download/c-ares-$CARES_VERSION.tar.gz || exit 1
1408 gzcat c-ares-$CARES_VERSION.tar.gz | tar xf - || exit 1
1409 cd c-ares-$CARES_VERSION
1410 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1411 make $MAKE_BUILD_OPTS || exit 1
1412 $DO_MAKE_INSTALL || exit 1
1414 touch c-ares-$CARES_VERSION-done
1418 uninstall_c_ares() {
1419 if [ ! -z "$installed_cares_version" ] ; then
1420 echo "Uninstalling C-Ares API:"
1421 cd c-ares-$installed_cares_version
1422 $DO_MAKE_UNINSTALL || exit 1
1423 make distclean || exit 1
1425 rm c-ares-$installed_cares_version-done
1427 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1429 # Get rid of the previously downloaded and unpacked version.
1431 rm -rf c-ares-$installed_cares_version
1432 rm -rf c-ares-$installed_cares_version.tar.gz
1435 installed_cares_version=""
1441 # Check whether the versions we have installed are the versions
1442 # requested; if not, uninstall the installed versions.
1444 if [ ! -z "$installed_cares_version" -a \
1445 "$installed_cares_version" != "$CARES_VERSION" ] ; then
1446 echo "Installed C-Ares version is $installed_cares_version"
1447 if [ -z "$CARES_VERSION" ] ; then
1448 echo "C-Ares is not requested"
1450 echo "Requested C-Ares version is $CARES_VERSION"
1455 if [ ! -z "$installed_geoip_version" -a \
1456 "$installed_geoip_version" != "$GEOIP_VERSION" ] ; then
1457 echo "Installed GeoIP API version is $installed_geoip_version"
1458 if [ -z "$GEOIP_VERSION" ] ; then
1459 echo "GeoIP is not requested"
1461 echo "Requested GeoIP version is $GEOIP_VERSION"
1466 if [ ! -z "$installed_portaudio_version" -a \
1467 "$installed_portaudio_version" != "$PORTAUDIO_VERSION" ] ; then
1468 echo "Installed PortAudio version is $installed_portaudio_version"
1469 if [ -z "$PORTAUDIO_VERSION" ] ; then
1470 echo "PortAudio is not requested"
1472 echo "Requested PortAudio version is $PORTAUDIO_VERSION"
1474 uninstall_portaudio -r
1477 if [ ! -z "$installed_lua_version" -a \
1478 "$installed_lua_version" != "$LUA_VERSION" ] ; then
1479 echo "Installed Lua version is $installed_lua_version"
1480 if [ -z "$LUA_VERSION" ] ; then
1481 echo "Lua is not requested"
1483 echo "Requested Lua version is $LUA_VERSION"
1488 if [ ! -z "$installed_gnutls_version" -a \
1489 "$installed_gnutls_version" != "$GNUTLS_VERSION" ] ; then
1490 echo "Installed GnuTLS version is $installed_gnutls_version"
1491 if [ -z "$GNUTLS_VERSION" ] ; then
1492 echo "GnuTLS is not requested"
1494 echo "Requested GnuTLS version is $GNUTLS_VERSION"
1499 if [ ! -z "$installed_libgcrypt_version" -a \
1500 "$installed_libgcrypt_version" != "$LIBGCRYPT_VERSION" ] ; then
1501 echo "Installed libgcrypt version is $installed_libgcrypt_version"
1502 if [ -z "$LIBGCRYPT_VERSION" ] ; then
1503 echo "libgcrypt is not requested"
1505 echo "Requested libgcrypt version is $LIBGCRYPT_VERSION"
1507 uninstall_libgcrypt -r
1510 if [ ! -z "$installed_libgpg_error_version" -a \
1511 "$installed_libgpg_error_version" != "$LIBGPG_ERROR_VERSION" ] ; then
1512 echo "Installed libgpg-error version is $installed_libgpg_error_version"
1513 if [ -z "$LIBGPG_ERROR_VERSION" ] ; then
1514 echo "libgpg-error is not requested"
1516 echo "Requested libgpg-error version is $LIBGPG_ERROR_VERSION"
1518 uninstall_libgpg_error -r
1521 if [ ! -z "$installed_libsmi_version" -a \
1522 "$installed_libsmi_version" != "$LIBSMI_VERSION" ] ; then
1523 echo "Installed libsmi version is $installed_libsmi_version"
1524 if [ -z "$LIBSMI_VERSION" ] ; then
1525 echo "libsmi is not requested"
1527 echo "Requested libsmi version is $LIBSMI_VERSION"
1532 if [ ! -z "$installed_gtk_version" -a \
1533 "$installed_gtk_version" != "$GTK_VERSION" ] ; then
1534 echo "Installed GTK+ version is $installed_gtk_version"
1535 if [ -z "$GTK_VERSION" ] ; then
1536 echo "GTK+ is not requested"
1538 echo "Requested GTK+ version is $GTK_VERSION"
1543 if [ ! -z "$installed_gdk_pixbuf_version" -a \
1544 "$installed_gdk_pixbuf_version" != "$GDK_PIXBUF_VERSION" ] ; then
1545 echo "Installed gdk-pixbuf version is $installed_gdk_pixbuf_version"
1546 if [ -z "$GDK_PIXBUF_VERSION" ] ; then
1547 echo "gdk-pixbuf is not requested"
1549 echo "Requested gdk-pixbuf version is $GDK_PIXBUF_VERSION"
1551 uninstall_gdk_pixbuf -r
1554 if [ ! -z "$installed_pango_version" -a \
1555 "$installed_pango_version" != "$PANGO_VERSION" ] ; then
1556 echo "Installed Pango version is $installed_pango_version"
1557 if [ -z "$PANGO_VERSION" ] ; then
1558 echo "Pango is not requested"
1560 echo "Requested Pango version is $PANGO_VERSION"
1565 if [ ! -z "$installed_atk_version" -a \
1566 "$installed_atk_version" != "$ATK_VERSION" ] ; then
1567 echo "Installed ATK version is $installed_atk_version"
1568 if [ -z "$ATK_VERSION" ] ; then
1569 echo "ATK is not requested"
1571 echo "Requested ATK version is $ATK_VERSION"
1576 if [ ! -z "$installed_cairo_version" -a \
1577 "$installed_cairo_version" != "$CAIRO_VERSION" ] ; then
1578 echo "Installed Cairo version is $installed_cairo_version"
1579 if [ -z "$CAIRO_VERSION" ] ; then
1580 echo "Cairo is not requested"
1582 echo "Requested Cairo version is $CAIRO_VERSION"
1587 if [ ! -z "$installed_pixman_version" -a \
1588 "$installed_pixman_version" != "$PIXMAN_VERSION" ] ; then
1589 echo "Installed pixman version is $installed_pixman_version"
1590 if [ -z "$PIXMAN_VERSION" ] ; then
1591 echo "pixman is not requested"
1593 echo "Requested pixman version is $PIXMAN_VERSION"
1598 if [ ! -z "$installed_libpng_version" -a \
1599 "$installed_libpng_version" != "$PNG_VERSION" ] ; then
1600 echo "Installed libpng version is $installed_libpng_version"
1601 if [ -z "$PNG_VERSION" ] ; then
1602 echo "libpng is not requested"
1604 echo "Requested libpng version is $PNG_VERSION"
1609 if [ ! -z "$installed_qt_version" -a \
1610 "$installed_qt_version" != "$QT_VERSION" ] ; then
1611 echo "Installed Qt version is $installed_qt_version"
1612 if [ -z "$QT_VERSION" ] ; then
1613 echo "Qt is not requested"
1615 echo "Requested Qt version is $QT_VERSION"
1620 if [ ! -z "$installed_glib_version" -a \
1621 "$installed_glib_version" != "$GLIB_VERSION" ] ; then
1622 echo "Installed GLib version is $installed_glib_version"
1623 if [ -z "$GLIB_VERSION" ] ; then
1624 echo "GLib is not requested"
1626 echo "Requested GLib version is $GLIB_VERSION"
1631 if [ ! -z "$installed_pkg_config_version" -a \
1632 "$installed_pkg_config_version" != "$PKG_CONFIG_VERSION" ] ; then
1633 echo "Installed pkg-config version is $installed_pkg_config_version"
1634 if [ -z "$PKG_CONFIG_VERSION" ] ; then
1635 echo "pkg-config is not requested"
1637 echo "Requested pkg-config version is $PKG_CONFIG_VERSION"
1639 uninstall_pkg_config -r
1642 if [ ! -z "$installed_gettext_version" -a \
1643 "$installed_gettext_version" != "$GETTEXT_VERSION" ] ; then
1644 echo "Installed GNU gettext version is $installed_gettext_version"
1645 if [ -z "$GETTEXT_VERSION" ] ; then
1646 echo "GNU gettext is not requested"
1648 echo "Requested GNU gettext version is $GETTEXT_VERSION"
1650 uninstall_gettext -r
1653 if [ ! -z "$installed_cmake_version" -a \
1654 "$installed_cmake_version" != "$CMAKE_VERSION" ] ; then
1655 echo "Installed CMake version is $installed_cmake_version"
1656 if [ -z "$CMAKE_VERSION" ] ; then
1657 echo "CMake is not requested"
1659 echo "Requested CMake version is $CMAKE_VERSION"
1662 # XXX - really remove this?
1663 # Or should we remember it as installed only if this script
1669 if [ ! -z "$installed_libtool_version" -a \
1670 "$installed_libtool_version" != "$LIBTOOL_VERSION" ] ; then
1671 echo "Installed GNU libtool version is $installed_libtool_version"
1672 if [ -z "$LIBTOOL_VERSION" ] ; then
1673 echo "GNU libtool is not requested"
1675 echo "Requested GNU libtool version is $LIBTOOL_VERSION"
1677 uninstall_libtool -r
1680 if [ ! -z "$installed_automake_version" -a \
1681 "$installed_automake_version" != "$AUTOMAKE_VERSION" ] ; then
1682 echo "Installed GNU automake version is $installed_automake_version"
1683 if [ -z "$AUTOMAKE_VERSION" ] ; then
1684 echo "GNU automake is not requested"
1686 echo "Requested GNU automake version is $AUTOMAKE_VERSION"
1688 uninstall_automake -r
1691 if [ ! -z "$installed_autoconf_version" -a \
1692 "$installed_autoconf_version" != "$AUTOCONF_VERSION" ] ; then
1693 echo "Installed GNU autoconf version is $installed_autoconf_version"
1694 if [ -z "$AUTOCONF_VERSION" ] ; then
1695 echo "GNU autoconf is not requested"
1697 echo "Requested GNU autoconf version is $AUTOCONF_VERSION"
1699 uninstall_autoconf -r
1702 if [ ! -z "$installed_xz_version" -a \
1703 "$installed_xz_version" != "$XZ_VERSION" ] ; then
1704 echo "Installed xz version is $installed_xz_version"
1705 if [ -z "$XZ_VERSION" ] ; then
1706 echo "xz is not requested"
1708 echo "Requested xz version is $XZ_VERSION"
1714 # Start with xz: It is the sole download format of glib later than 2.31.2
1727 # Start with GNU gettext; GLib requires it, and OS X doesn't have it
1728 # or a BSD-licensed replacement.
1730 # At least on Lion with Xcode 4, _FORTIFY_SOURCE gets defined as 2
1731 # by default, which causes, for example, stpncpy to be defined as
1732 # a hairy macro that collides with the GNU gettext configure script's
1733 # attempts to workaround AIX's lack of a declaration for stpncpy,
1734 # with the result being a huge train wreck. Define _FORTIFY_SOURCE
1735 # as 0 in an attempt to keep the trains on separate tracks.
1740 # GLib depends on pkg-config.
1741 # By default, pkg-config depends on GLib; we break the dependency cycle
1742 # by configuring pkg-config to use its own internal version of GLib.
1749 # Now we have reached a point where we can build everything but
1750 # the GUI (Wireshark).
1754 if [ "$GTK_VERSION" ]; then
1756 # GTK+ 3 requires a newer Cairo build than the one that comes with
1757 # 10.6, so we build Cairo if we are using GTK+ 3.
1759 # In 10.6 and 10.7, it's an X11 library; if we build with "native" GTK+
1760 # rather than X11 GTK+, we might have to build and install Cairo.
1761 # In 10.8 and later, there is no X11, but it's included in Xquartz;
1762 # again, if we build with "native" GTK+, we'd have to build and install
1765 if [[ "$GTK_MAJOR_VERSION" -eq 3 || "$cairo_not_in_the_os" = yes ]]; then
1767 # Requirements for Cairo first
1769 # The libpng that comes with the X11 for Leopard has a bogus
1770 # pkg-config file that lies about where the header files are,
1771 # which causes other packages not to be able to find its
1774 # The libpng in later versions is not what the version of
1775 # libpixman we build below wants - it wants libpng15.
1780 # The libpixman versions that come with the X11s for Leopard,
1781 # Snow Leopard, and Lion is too old to support Cairo's image
1782 # surface backend feature (which requires pixman-1 >= 0.22.0).
1784 # XXX - what about the one that comes with the latest version
1790 # And now Cairo itself.
1791 # XXX - with the libxcb that comes with 10.6,
1792 # xcb_discard_reply() is missing, and the build fails.
1807 # Now we have reached a point where we can build everything including
1808 # the GUI (Wireshark), but not with any optional features such as
1809 # SNMP OID resolution, some forms of decryption, Lua scripting, playback
1810 # of audio, or GeoIP mapping of IP addresses.
1812 # We now conditionally download optional libraries to support them;
1813 # the default is to download them all.
1818 install_libgpg_error
1834 if [ -d macosx-support-libs ]
1836 cd macosx-support-libs
1839 # Uninstall items in the reverse order from the order in which they're
1840 # installed. Only uninstall if the download/build/install process
1841 # completed; uninstall the version that appears in the name of
1844 # We also do a "make distclean", so that we don't have leftovers from
1845 # old configurations.
1859 uninstall_libgpg_error
1865 uninstall_gdk_pixbuf
1881 uninstall_pkg_config
1886 # XXX - really remove this?
1887 # Or should we remember it as installed only if this script
1903 # Do we have permission to write in /usr/local?
1905 # If so, assume we have permission to write in its subdirectories.
1906 # (If that's not the case, this test needs to check the subdirectories
1909 # If not, do "make install", "make uninstall", the removes for Lua,
1910 # and the renames of [g]libtool* with sudo.
1912 if [ -w /usr/local ]
1914 DO_MAKE_INSTALL="make install"
1915 DO_MAKE_UNINSTALL="make uninstall"
1919 DO_MAKE_INSTALL="sudo make install"
1920 DO_MAKE_UNINSTALL="sudo make uninstall"
1926 # If we have SDKs available, the default target OS is the major version
1927 # of the one we're running; get that and strip off the third component
1930 for i in /Developer/SDKs \
1931 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
1932 /Library/Developer/CommandLineTools/SDKs
1936 min_osx_target=`sw_vers -productVersion | sed 's/\([0-9]*\)\.\([0-9]*\)\.[0-9]*/\1.\2/'`
1939 # That's also the OS whose SDK we'd be using.
1941 sdk_target=$min_osx_target
1947 # Parse command-line flags:
1950 # -t <target> - build libraries so that they'll work on the specified
1951 # version of OS X and later versions.
1952 # -u - do an uninstall.
1954 while getopts ht:u name
1961 min_osx_target="$OPTARG"
1964 echo "Usage: macosx-setup.sh [ -t <target> ] [ -u ]" 1>&1
1971 # Get the version numbers of installed packages, if any.
1973 if [ -d macosx-support-libs ]
1975 cd macosx-support-libs
1977 installed_xz_version=`ls xz-*-done 2>/dev/null | sed 's/xz-\(.*\)-done/\1/'`
1978 installed_autoconf_version=`ls autoconf-*-done 2>/dev/null | sed 's/autoconf-\(.*\)-done/\1/'`
1979 installed_automake_version=`ls automake-*-done 2>/dev/null | sed 's/automake-\(.*\)-done/\1/'`
1980 installed_libtool_version=`ls libtool-*-done 2>/dev/null | sed 's/libtool-\(.*\)-done/\1/'`
1981 installed_cmake_version=`ls cmake-*-done 2>/dev/null | sed 's/cmake-\(.*\)-done/\1/'`
1982 installed_gettext_version=`ls gettext-*-done 2>/dev/null | sed 's/gettext-\(.*\)-done/\1/'`
1983 installed_pkg_config_version=`ls pkg-config-*-done 2>/dev/null | sed 's/pkg-config-\(.*\)-done/\1/'`
1984 installed_glib_version=`ls glib-*-done 2>/dev/null | sed 's/glib-\(.*\)-done/\1/'`
1985 installed_qt_version=`ls qt-*-done 2>/dev/null | sed 's/qt-\(.*\)-done/\1/'`
1986 installed_libpng_version=`ls libpng-*-done 2>/dev/null | sed 's/libpng-\(.*\)-done/\1/'`
1987 installed_pixman_version=`ls pixman-*-done 2>/dev/null | sed 's/pixman-\(.*\)-done/\1/'`
1988 installed_cairo_version=`ls cairo-*-done 2>/dev/null | sed 's/cairo-\(.*\)-done/\1/'`
1989 installed_atk_version=`ls atk-*-done 2>/dev/null | sed 's/atk-\(.*\)-done/\1/'`
1990 installed_pango_version=`ls pango-*-done 2>/dev/null | sed 's/pango-\(.*\)-done/\1/'`
1991 installed_gdk_pixbuf_version=`ls gdk-pixbuf-*-done 2>/dev/null | sed 's/gdk-pixbuf-\(.*\)-done/\1/'`
1992 installed_gtk_version=`ls gtk+-*-done 2>/dev/null | sed 's/gtk+-\(.*\)-done/\1/'`
1993 installed_libsmi_version=`ls libsmi-*-done 2>/dev/null | sed 's/libsmi-\(.*\)-done/\1/'`
1994 installed_libgpg_error_version=`ls libgpg-error-*-done 2>/dev/null | sed 's/libgpg-error-\(.*\)-done/\1/'`
1995 installed_libgcrypt_version=`ls libgcrypt-*-done 2>/dev/null | sed 's/libgcrypt-\(.*\)-done/\1/'`
1996 installed_gnutls_version=`ls gnutls-*-done 2>/dev/null | sed 's/gnutls-\(.*\)-done/\1/'`
1997 installed_lua_version=`ls lua-*-done 2>/dev/null | sed 's/lua-\(.*\)-done/\1/'`
1998 installed_portaudio_version=`ls portaudio-*-done 2>/dev/null | sed 's/portaudio-\(.*\)-done/\1/'`
1999 installed_geoip_version=`ls geoip-*-done 2>/dev/null | sed 's/geoip-\(.*\)-done/\1/'`
2000 installed_cares_version=`ls c-ares-*-done 2>/dev/null | sed 's/c-ares-\(.*\)-done/\1/'`
2003 # If we don't have a versioned -done file for portaudio, but do have
2004 # an unversioned -done file for it, assume the installed version is the
2005 # requested version, and rename the -done file to include that version.
2007 if [ -z "$installed_portaudio_version" -a -f portaudio-done ] ; then
2008 mv portaudio-done portaudio-$PORTAUDIO_VERSION-done
2009 installed_portaudio_version=`ls portaudio-*-done 2>/dev/null | sed 's/portaudio-\(.*\)-done/\1/'`
2015 if [ "$do_uninstall" = "yes" ]
2022 # Configure scripts tend to set CFLAGS and CXXFLAGS to "-g -O2" if
2023 # invoked without CFLAGS or CXXFLAGS being set in the environment.
2025 # However, we *are* setting them in the environment, for our own
2026 # nefarious purposes, so start them out as "-g -O2".
2032 # To make this work on Leopard (rather than working *on* Snow Leopard
2033 # when building *for* Leopard) will take more work.
2035 # For one thing, Leopard's /usr/X11/lib/libXdamage.la claims, at least
2036 # with all software updates applied, that the Xdamage shared library
2037 # is libXdamage.1.0.0.dylib, but it is, in fact, libXdamage.1.1.0.dylib.
2038 # This causes problems when building GTK+, so the script would have to
2041 if [[ $DARWIN_MAJOR_VERSION -le 9 ]]; then
2042 echo "This script does not support any versions of OS X before Snow Leopard" 1>&2
2046 # if no make options are present, set default options
2047 if [ -z "$MAKE_BUILD_OPTS" ] ; then
2048 # by default use 1.5x number of cores for parallel build
2049 MAKE_BUILD_OPTS="-j $(( $(sysctl -n hw.logicalcpu) * 3 / 2))"
2053 # If we have a target release, look for the oldest SDK that's for an
2054 # OS equal to or later than that one, and build libraries against it
2055 # rather than against the headers and, more importantly, libraries
2056 # that come with the OS, so that we don't end up with support libraries
2057 # that only work on the OS version on which we built them, not earlier
2058 # versions of the same release, or earlier releases if the minimum is
2061 if [ ! -z "$min_osx_target" ]
2064 # Get the real version - strip off the "10.".
2065 # We'll worry about that if, as, and when there's ever
2068 deploy_real_version=`echo "$min_osx_target" | sed -n 's/10\.\(.*\)/\1/p'`
2071 # Search each directory that might contain SDKs.
2074 for sdksdir in /Developer/SDKs \
2075 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
2076 /Library/Developer/CommandLineTools/SDKs
2079 # Get a list of all the SDKs.
2081 if ! test -d "$sdksdir"
2084 # There is no directory with that name.
2085 # Move on to the next one in the list, if any.
2091 # Get a list of all the SDKs in that directory, if any.
2093 sdklist=`(cd "$sdksdir"; ls -d MacOSX10.[0-9]*.sdk 2>/dev/null)`
2098 # Get the real version for this SDK.
2100 sdk_real_version=`echo "$sdk" | sed -n 's/MacOSX10\.\(.*\)\.sdk/\1/p'`
2103 # Is it for the deployment target or some later release?
2105 if test "$sdk_real_version" -ge "$deploy_real_version"
2110 sdkpath="$sdksdir/$sdk"
2111 qt_sdk_arg="-sdk $sdk"
2117 if [ -z "$sdkpath" ]
2119 echo "macosx-setup.sh: Couldn't find an SDK for OS X $min_osx_target or later" 1>&2
2124 sdk_target=10.$sdk_real_version
2125 echo "Using the 10.$sdk_real_version SDK"
2128 # Make sure there are links to /usr/local/include and /usr/local/lib
2129 # in the SDK's usr/local.
2131 if [ ! -e $SDKPATH/usr/local/include ]
2133 if [ ! -d $SDKPATH/usr/local ]
2135 sudo mkdir $SDKPATH/usr/local
2137 sudo ln -s /usr/local/include $SDKPATH/usr/local/include
2139 if [ ! -e $SDKPATH/usr/local/lib ]
2141 if [ ! -d $SDKPATH/usr/local ]
2143 sudo mkdir $SDKPATH/usr/local
2145 sudo ln -s /usr/local/lib $SDKPATH/usr/local/lib
2149 # Set the minimum OS version for which to build to the specified
2150 # minimum target OS version, so we don't, for example, end up using
2151 # linker features supported by the OS verson on which we're building
2152 # but not by the target version.
2154 VERSION_MIN_FLAGS="-mmacosx-version-min=$min_osx_target"
2157 # Compile and link against the SDK.
2159 SDKFLAGS="-isysroot $SDKPATH"
2161 if [[ "$min_osx_target" == "10.5" ]]
2164 # Cairo is part of Mac OS X 10.6 and later.
2165 # The *headers* are supplied by 10.5, but the *libraries*
2166 # aren't, so we have to build it if we're building for 10.5.
2168 cairo_not_in_the_os=yes
2171 # Build with older versions of the support libraries, as
2172 # were used on the Wireshark Leopard buildbot at one
2173 # point. (Most of these versions come from the About page
2174 # from Wireshark 1.8.6, the last build done on that buildbot;
2175 # the ATK version isn't reported, so this is a guess.)
2177 # If you want to try building with newer versions of
2178 # the libraries, note that:
2180 # The version of fontconfig that comes with Leopard doesn't
2181 # support FC_WEIGHT_EXTRABLACK, so we can't use any version
2182 # of Pango newer than 1.22.4.
2184 # However, Pango 1.22.4 doesn't work with versions of GLib
2185 # after 2.29.6, because Pango 1.22.4 uses G_CONST_RETURN and
2186 # GLib 2.29.8 and later deprecate it (there doesn't appear to
2187 # be a GLib 2.29.7). That means we'd either have to patch
2188 # Pango not to use it (just use "const"; G_CONST_RETURN was
2189 # there to allow code to choose whether to use "const" or not),
2190 # or use GLib 2.29.6 or earlier.
2192 # GLib 2.29.6 includes an implementation of g_bit_lock() that,
2193 # on x86 (32-bit and 64-bit), uses asms in a fashion
2194 # ("asm volatile goto") that requires GCC 4.5 or later, which
2195 # is later than the compilers that come with Leopard and Snow
2196 # Leopard. Recent versions of GLib check for that, but 2.29.6
2197 # doesn't, so, if you want to build GLib 2.29.6 on Leopard or
2198 # Snow Leopard, you would have to patch glib/gbitlock.c to do
2199 # what the newer versions of GLib do:
2201 # define a USE_ASM_GOTO macro that indicates whether "asm goto"
2203 # #if (defined (i386) || defined (__amd64__))
2204 # #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
2205 # #define USE_ASM_GOTO 1
2209 # replace all occurrences of
2211 # #if defined (__GNUC__) && (defined (i386) || defined (__amd64__))
2215 # #ifdef USE_ASM_GOTO
2217 # Using GLib 2.29.6 or earlier, however, means that we can't
2218 # use a version of ATK later than 2.3.93, as those versions
2219 # don't work with GLib 2.29.6. The same applies to gdk-pixbuf;
2220 # versions of gdk-pixbuf after 2.24.1 won't work with GLib
2223 # Then you have to make sure that what you've build doesn't
2224 # cause the X server that comes with Leopard to crash; at
2225 # least one attempt at building for Leopard did.
2227 # At least if building on Leopard, you might also find
2228 # that, with various older versions of Cairo, including
2229 # 1.6.4 and at least some 1.8.x versions, when you try to
2230 # build it, the build fails because it can't find
2231 # png_set_longjmp_fn(). I vaguely remember dealing with that,
2232 # ages ago, but don't remember what I did.
2235 if [ "$CAIRO_VERSION" ]
2239 if [ "$ATK_VERSION" ]
2243 if [ "$PANGO_VERSION" ]
2245 PANGO_VERSION=1.20.2
2247 if [ "$GTK_VERSION" ]
2253 # That version of GTK+ includes gdk-pixbuf.
2254 # XXX - base this on the version of GTK+ requested.
2259 # Libgcrypt 1.5.0 fails to compile due to some problem with an
2260 # asm in rijndael.c, at least with i686-apple-darwin10-gcc-4.2.1
2261 # (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) when building
2264 # We try libgcrypt 1.4.3 instead, as that's what shows up in
2265 # the version from the Leopard buildbot.
2266 LIBGCRYPT_VERSION=1.4.3
2269 # Build 32-bit while we're at it; Leopard has a bug that
2270 # causes some BPF functions not to work with 64-bit userland
2271 # code, so capturing won't work.
2273 CFLAGS="$CFLAGS -arch i386"
2274 CXXFLAGS="$CXXFLAGS -arch i386"
2275 export LDFLAGS="$LDFLAGS -arch i386"
2283 # You need Xcode or the command-line tools installed to get the compilers.
2285 if [ ! -x /usr/bin/xcodebuild ]; then
2286 echo "Please install Xcode first (should be available on DVD or from http://developer.apple.com/xcode/index.php)."
2290 if [ "$QT_VERSION" ]; then
2292 # We need Xcode, not just the command-line tools, installed to build
2295 if ! /usr/bin/xcrun -find xcrun >/dev/null 2>&1; then
2296 echo "Please install Xcode first (should be available on DVD or from http://developer.apple.com/xcode/index.php)."
2297 echo "The command-line build tools are not sufficient to build Qt."
2301 if [ "$GTK_VERSION" ]; then
2303 # If we're building with GTK+, you also need the X11 SDK; with at least
2304 # some versions of OS X and Xcode, that is, I think, an optional install.
2305 # (Or it might be installed with X11, but I think *that* is an optional
2306 # install on at least some versions of OS X.)
2308 if [ ! -d /usr/X11/include ]; then
2309 echo "Please install X11 and the X11 SDK first."
2310 echo " You can either use http://xquartz.macosforge.org/, e.g."
2311 echo " http://xquartz-dl.macosforge.org/SL/XQuartz-$XQUARTZ_VERSION.dmg"
2312 echo " or the native Apple packages if you are on Lion or below."
2317 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig
2320 # Do all the downloads and untarring in a subdirectory, so all that
2321 # stuff can be removed once we've installed the support libraries.
2323 if [ ! -d macosx-support-libs ]
2325 mkdir macosx-support-libs || exit 1
2327 cd macosx-support-libs
2334 # Indicate what paths to use for pkg-config and cmake.
2336 pkg_config_path=/usr/local/lib/pkgconfig
2337 if [ "$QT_VERSION" ]; then
2338 qt_base_path=$HOME/Qt$QT_VERSION/$QT_MAJOR_MINOR_VERSION/clang_64
2339 pkg_config_path="$pkg_config_path":"$qt_base_path/clang_64/lib/pkgconfig"
2340 CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH":"$qt_base_path/lib/cmake"
2342 pkg_config_path="$pkg_config_path":/usr/X11/lib/pkgconfig
2344 echo "You are now prepared to build Wireshark."
2346 if [[ $CMAKE ]]; then
2347 echo "To build with CMAKE:"
2349 echo "export PKG_CONFIG_PATH=$pkg_config_path"
2350 echo "export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH"
2351 echo "export PATH=$PATH:$qt_base_path/bin"
2353 echo "mkdir build; cd build"
2355 echo "make $MAKE_BUILD_OPTS app_bundle"
2356 echo "make install/strip"
2359 if [[ $AUTOTOOLS ]]; then
2360 echo "To build with AUTOTOOLS:"
2362 echo "export PKG_CONFIG_PATH=$pkg_config_path"
2365 echo "mkdir build; cd build"
2367 echo "make $MAKE_BUILD_OPTS"
2371 echo "Make sure you are allowed capture access to the network devices"
2372 echo "See: https://wiki.wireshark.org/CaptureSetup/CapturePrivileges"