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
108 # In case we want to build GTK *and* we don't have Apple's X11 SDK installed
109 # we may want to install XQuartz. The version will only be used in the printing
110 # of a URL, the package will not be installed.
112 XQUARTZ_VERSION=2.7.5
114 # The following libraries are optional.
115 # Comment them out if you don't want them, but note that some of
116 # the optional libraries are required by other optional libraries.
120 # libgpg-error is required for libgcrypt.
122 LIBGPG_ERROR_VERSION=1.10
124 # libgcrypt is required for GnuTLS.
126 LIBGCRYPT_VERSION=1.5.0
127 GNUTLS_VERSION=2.12.19
128 # Use 5.2.3, not 5.3, for now; lua_bitop.c hasn't been ported to 5.3
129 # yet, and we need to check for compatibility issues (we'd want Lua
130 # scripts to work with 5.1, 5.2, and 5.3, as long as they only use Lua
131 # features present in all three versions)
133 PORTAUDIO_VERSION=pa_stable_v19_20111121
135 # XXX - they appear to have an unversioned gzipped tarball for the
136 # current version; should we just download that, with some other
137 # way of specifying whether to download the GeoIP API?
143 DARWIN_MAJOR_VERSION=`uname -r | sed 's/\([0-9]*\).*/\1/'`
146 # GNU autotools; they're provided with releases up to Snow Leopard, but
147 # not in later releases.
149 if [ -n "$AUTOTOOLS" -a $DARWIN_MAJOR_VERSION -gt 10 ]; then
150 AUTOCONF_VERSION=2.69
151 AUTOMAKE_VERSION=1.13.3
152 LIBTOOL_VERSION=2.4.2
156 if [ "$XZ_VERSION" -a ! -f xz-$XZ_VERSION-done ] ; then
157 echo "Downloading, building, and installing xz:"
158 [ -f xz-$XZ_VERSION.tar.bz2 ] || curl -O http://tukaani.org/xz/xz-$XZ_VERSION.tar.bz2 || exit 1
159 bzcat xz-$XZ_VERSION.tar.bz2 | tar xf - || exit 1
161 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0" ./configure || exit 1
162 make $MAKE_BUILD_OPTS || exit 1
163 $DO_MAKE_INSTALL || exit 1
165 touch xz-$XZ_VERSION-done
170 if [ ! -z "$installed_xz_version" ] ; then
171 echo "Uninstalling xz:"
172 cd xz-$installed_xz_version
173 $DO_MAKE_UNINSTALL || exit 1
174 make distclean || exit 1
176 rm xz-$installed_xz_version-done
178 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
180 # Get rid of the previously downloaded and unpacked version.
182 rm -rf xz-$installed_xz_version
183 rm -rf xz-$installed_xz_version.tar.bz2
186 installed_xz_version=""
191 if [ "$AUTOCONF_VERSION" -a ! -f autoconf-$AUTOCONF_VERSION-done ] ; then
192 echo "Downloading, building and installing GNU autoconf..."
193 [ -f autoconf-$AUTOCONF_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/autoconf/autoconf-$AUTOCONF_VERSION.tar.xz || exit 1
194 xzcat autoconf-$AUTOCONF_VERSION.tar.xz | tar xf - || exit 1
195 cd autoconf-$AUTOCONF_VERSION
196 ./configure || exit 1
197 make $MAKE_BUILD_OPTS || exit 1
198 $DO_MAKE_INSTALL || exit 1
200 touch autoconf-$AUTOCONF_VERSION-done
204 uninstall_autoconf() {
205 if [ ! -z "$installed_autoconf_version" ] ; then
207 # automake and libtool depend on this, so uninstall them.
212 echo "Uninstalling GNU autoconf:"
213 cd autoconf-$installed_autoconf_version
214 $DO_MAKE_UNINSTALL || exit 1
215 make distclean || exit 1
217 rm autoconf-$installed_autoconf_version-done
219 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
221 # Get rid of the previously downloaded and unpacked version.
223 rm -rf autoconf-$installed_autoconf_version
224 rm -rf autoconf-$installed_autoconf_version.tar.xz
227 installed_autoconf_version=""
232 if [ "$AUTOMAKE_VERSION" -a ! -f automake-$AUTOMAKE_VERSION-done ] ; then
233 echo "Downloading, building and installing GNU automake..."
234 [ -f automake-$AUTOMAKE_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/automake/automake-$AUTOMAKE_VERSION.tar.xz || exit 1
235 xzcat automake-$AUTOMAKE_VERSION.tar.xz | tar xf - || exit 1
236 cd automake-$AUTOMAKE_VERSION
237 ./configure || exit 1
238 make $MAKE_BUILD_OPTS || exit 1
239 $DO_MAKE_INSTALL || exit 1
241 touch automake-$AUTOMAKE_VERSION-done
245 uninstall_automake() {
246 if [ ! -z "$installed_automake_version" ] ; then
248 # libtool depends on this(?), so uninstall it.
250 uninstall_libtool "$@"
252 echo "Uninstalling GNU automake:"
253 cd automake-$installed_automake_version
254 $DO_MAKE_UNINSTALL || exit 1
255 make distclean || exit 1
257 rm automake-$installed_automake_version-done
259 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
261 # Get rid of the previously downloaded and unpacked version.
263 rm -rf automake-$installed_automake_version
264 rm -rf automake-$installed_automake_version.tar.xz
267 installed_automake_version=""
272 if [ "$LIBTOOL_VERSION" -a ! -f libtool-$LIBTOOL_VERSION-done ] ; then
273 echo "Downloading, building and installing GNU libtool..."
274 [ -f libtool-$LIBTOOL_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/libtool/libtool-$LIBTOOL_VERSION.tar.xz || exit 1
275 xzcat libtool-$LIBTOOL_VERSION.tar.xz | tar xf - || exit 1
276 cd libtool-$LIBTOOL_VERSION
277 ./configure || exit 1
278 make $MAKE_BUILD_OPTS || exit 1
279 $DO_MAKE_INSTALL || exit 1
280 $DO_MV /usr/local/bin/libtool /usr/local/bin/glibtool
281 $DO_MV /usr/local/bin/libtoolize /usr/local/bin/glibtoolize
283 touch libtool-$LIBTOOL_VERSION-done
287 uninstall_libtool() {
288 if [ ! -z "$installed_libtool_version" ] ; then
289 echo "Uninstalling GNU libtool:"
290 cd libtool-$installed_libtool_version
291 $DO_MV /usr/local/bin/glibtool /usr/local/bin/libtool
292 $DO_MV /usr/local/bin/glibtoolize /usr/local/bin/libtoolize
293 $DO_MAKE_UNINSTALL || exit 1
294 make distclean || exit 1
296 rm libtool-$installed_libtool_version-done
298 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
300 # Get rid of the previously downloaded and unpacked version.
302 rm -rf libtool-$installed_libtool_version
303 rm -rf libtool-$installed_libtool_version.tar.xz
306 installed_libtool_version=""
311 if [ -n "$CMAKE" -a ! -f cmake-$CMAKE_VERSION-done ]; then
312 echo "Downloading and installing CMake:"
313 CMAKE_MAJOR_VERSION="`expr $CMAKE_VERSION : '\([0-9][0-9]*\).*'`"
314 CMAKE_MINOR_VERSION="`expr $CMAKE_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
315 CMAKE_DOTDOT_VERSION="`expr $CMAKE_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
316 CMAKE_MAJOR_MINOR_VERSION=$CMAKE_MAJOR_VERSION.$CMAKE_MINOR_VERSION
319 # NOTE: the "64" in "Darwin64" doesn't mean "64-bit-only"; the
320 # package in question supports both 32-bit and 64-bit x86.
322 case "$CMAKE_MAJOR_VERSION" in
325 echo "CMake $CMAKE_VERSION" is too old 1>&2
330 # Download the DMG, run the installer.
332 [ -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
333 sudo hdiutil attach cmake-$CMAKE_VERSION-Darwin64-universal.dmg || exit 1
334 sudo installer -target / -pkg /Volumes/cmake-$CMAKE_VERSION-Darwin64-universal/cmake-$CMAKE_VERSION-Darwin64-universal.pkg || exit 1
335 sudo hdiutil detach /Volumes/cmake-$CMAKE_VERSION-Darwin64-universal
340 # Download the DMG and do a drag install, where "drag" means
343 # 3.0.* and 3.1.0 have a Darwin64-universal DMG.
344 # 3.1.1 and later have a Darwin-x86_64 DMG.
345 # Probably not many people are still developing on 32-bit
346 # Macs, so we don't worry about them.
348 if [ "$CMAKE_MINOR_VERSION" = 0 -o \
349 "$CMAKE_VERSION" = 3.1.0 ]; then
350 type="Darwin64-universal"
354 [ -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
355 sudo hdiutil attach cmake-$CMAKE_VERSION-$type.dmg || exit 1
356 sudo ditto /Volumes/cmake-$CMAKE_VERSION-$type/CMake.app /Applications/CMake.app || exit 1
359 # Plant the appropriate symbolic links in /usr/local/bin.
360 # It's a drag-install, so there's no installer to make them,
361 # and the CMake code to put them in place is lame, as
363 # 1) it defaults to /usr/bin, not /usr/local/bin;
364 # 2) it doesn't request the necessary root privileges;
365 # 3) it can't be run from the command line;
367 # so we do it ourselves.
369 for i in ccmake cmake cmake-gui cmakexbuild cpack ctest
371 sudo ln -s /Applications/CMake.app/Contents/bin/$i /usr/local/bin/$i
373 sudo hdiutil detach /Volumes/cmake-$CMAKE_VERSION-$type
379 touch cmake-$CMAKE_VERSION-done
384 if [ ! -z "$installed_cmake_version" ]; then
385 echo "Uninstalling CMake:"
386 installed_cmake_major_version="`expr $installed_cmake_version : '\([0-9][0-9]*\).*'`"
387 case "$installed_cmake_major_version" in
390 echo "CMake $installed_cmake_version" is too old 1>&2
394 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
395 for i in ccmake cmake cmake-gui cmakexbuild cpack ctest
397 sudo rm -f /usr/bin/$i /usr/local/bin/$i
399 sudo pkgutil --forget com.Kitware.CMake
400 rm cmake-$installed_cmake_version-done
404 sudo rm -rf /Applications/CMake.app
405 for i in ccmake cmake cmake-gui cmakexbuild cpack ctest
407 sudo rm -f /usr/local/bin/$i
409 rm cmake-$installed_cmake_version-done
413 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
415 # Get rid of the previously downloaded and unpacked version,
416 # whatever it might happen to be called.
418 rm -f cmake-$installed_cmake_version-Darwin64-universal.dmg
419 rm -f cmake-$installed_cmake_version-Darwin-x86_64.dmg
422 installed_cmake_version=""
427 if [ ! -f gettext-$GETTEXT_VERSION-done ] ; then
428 echo "Downloading, building, and installing GNU gettext:"
429 [ -f gettext-$GETTEXT_VERSION.tar.gz ] || curl -O http://ftp.gnu.org/pub/gnu/gettext/gettext-$GETTEXT_VERSION.tar.gz || exit 1
430 gzcat gettext-$GETTEXT_VERSION.tar.gz | tar xf - || exit 1
431 cd gettext-$GETTEXT_VERSION
432 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0 $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
433 make $MAKE_BUILD_OPTS || exit 1
434 $DO_MAKE_INSTALL || exit 1
436 touch gettext-$GETTEXT_VERSION-done
440 uninstall_gettext() {
441 if [ ! -z "$installed_gettext_version" ] ; then
443 # GLib depends on this, so uninstall it.
447 echo "Uninstalling GNU gettext:"
448 cd gettext-$installed_gettext_version
449 $DO_MAKE_UNINSTALL || exit 1
450 make distclean || exit 1
452 rm gettext-$installed_gettext_version-done
454 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
456 # Get rid of the previously downloaded and unpacked version.
458 rm -rf gettext-$installed_gettext_version
459 rm -rf gettext-$installed_gettext_version.tar.gz
462 installed_gettext_version=""
466 install_pkg_config() {
467 if [ ! -f pkg-config-$PKG_CONFIG_VERSION-done ] ; then
468 echo "Downloading, building, and installing pkg-config:"
469 [ -f pkg-config-$PKG_CONFIG_VERSION.tar.gz ] || curl -O http://pkgconfig.freedesktop.org/releases/pkg-config-$PKG_CONFIG_VERSION.tar.gz || exit 1
470 gzcat pkg-config-$PKG_CONFIG_VERSION.tar.gz | tar xf - || exit 1
471 cd pkg-config-$PKG_CONFIG_VERSION
472 ./configure --with-internal-glib || exit 1
473 make $MAKE_BUILD_OPTS || exit 1
474 $DO_MAKE_INSTALL || exit 1
476 touch pkg-config-$PKG_CONFIG_VERSION-done
480 uninstall_pkg_config() {
481 if [ ! -z "$installed_pkg_config_version" ] ; then
482 echo "Uninstalling pkg-config:"
483 cd pkg-config-$installed_pkg_config_version
484 $DO_MAKE_UNINSTALL || exit 1
485 make distclean || exit 1
487 rm pkg-config-$installed_pkg_config_version-done
489 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
491 # Get rid of the previously downloaded and unpacked version.
493 rm -rf pkg-config-$installed_pkg_config_version
494 rm -rf pkg-config-$installed_pkg_config_version.tar.gz
497 installed_pkg_config_version=""
502 if [ ! -f glib-$GLIB_VERSION-done ] ; then
503 echo "Downloading, building, and installing GLib:"
504 glib_dir=`expr $GLIB_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
505 GLIB_MAJOR_VERSION="`expr $GLIB_VERSION : '\([0-9][0-9]*\).*'`"
506 GLIB_MINOR_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
507 GLIB_DOTDOT_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
508 if [[ $GLIB_MAJOR_VERSION -gt 2 ||
509 $GLIB_MINOR_VERSION -gt 28 ||
510 ($GLIB_MINOR_VERSION -eq 28 && $GLIB_DOTDOT_VERSION -ge 8) ]]
513 # Starting with GLib 2.28.8, xz-compressed tarballs are available.
515 [ -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
516 xzcat glib-$GLIB_VERSION.tar.xz | tar xf - || exit 1
518 [ -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
519 bzcat glib-$GLIB_VERSION.tar.bz2 | tar xf - || exit 1
521 cd glib-$GLIB_VERSION
523 # OS X ships with libffi, but doesn't provide its pkg-config file;
524 # explicitly specify LIBFFI_CFLAGS and LIBFFI_LIBS, so the configure
525 # script doesn't try to use pkg-config to get the appropriate
526 # C flags and loader flags.
528 # And, what's worse, at least with the version of Xcode that comes
529 # with Leopard, /usr/include/ffi/fficonfig.h doesn't define MACOSX,
530 # which causes the build of GLib to fail. If we don't find
531 # "#define.*MACOSX" in /usr/include/ffi/fficonfig.h, explicitly
534 # While we're at it, suppress -Wformat-nonliteral to avoid a case
535 # where clang's stricter rules on when not to complain about
536 # non-literal format arguments cause it to complain about code
537 # that's safe but it wasn't told that. See my comment #25 in
540 # https://bugzilla.gnome.org/show_bug.cgi?id=691608#c25
542 # First, determine where the system include files are. (It's not
543 # necessarily /usr/include.) There's a bit of a greasy hack here;
544 # pre-5.x versions of the developer tools don't support the
545 # --show-sdk-path option, and will produce no output, so includedir
546 # will be set to /usr/include (in those older versions of the
547 # developer tools, there is a /usr/include directory).
549 includedir=`xcrun --show-sdk-path 2>/dev/null`/usr/include
550 if grep -qs '#define.*MACOSX' $includedir/ffi/fficonfig.h
552 # It's defined, nothing to do
553 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
555 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
559 # Apply the fix to GNOME bug 529806:
561 # https://bugzilla.gnome.org/show_bug.cgi?id=529806
563 # if we have a version of GLib prior to 2.30.
565 if [[ $GLIB_MAJOR_VERSION -eq 2 && $GLIB_MINOR_VERSION -le 30 ]]
567 patch -p0 <../../macosx-support-lib-patches/glib-gconvert.c.patch || exit 1
569 make $MAKE_BUILD_OPTS || exit 1
570 $DO_MAKE_INSTALL || exit 1
572 touch glib-$GLIB_VERSION-done
577 if [ ! -z "$installed_glib_version" ] ; then
579 # ATK, Pango, and GTK depend on this, so uninstall them.
585 echo "Uninstalling GLib:"
586 cd glib-$installed_glib_version
587 $DO_MAKE_UNINSTALL || exit 1
588 make distclean || exit 1
590 rm glib-$installed_glib_version-done
592 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
594 # Get rid of the previously downloaded and unpacked version.
596 rm -rf glib-$installed_glib_version
597 rm -rf glib-$installed_glib_version.tar.xz glib-$installed_glib_version.tar.bz2
600 installed_glib_version=""
605 if [ "$QT_VERSION" -a ! -f qt-$QT_VERSION-done ]; then
606 echo "Downloading, building, and installing Qt:"
608 # What you get for this URL might just be a 302 Found reply, so use
609 # -L so we get redirected.
611 [ -f qt-opensource-mac-x64-clang-$QT_VERSION.dmg ] || curl -L -O http://download.qt.io/archive/qt/$QT_MAJOR_MINOR_VERSION/$QT_VERSION/qt-opensource-mac-x64-clang-$QT_VERSION.dmg || exit 1
612 sudo hdiutil attach qt-opensource-mac-x64-clang-$QT_VERSION.dmg || exit 1
615 # Run the executable directly, so that we wait for it to finish.
617 /Volumes/qt-opensource-mac-x64-clang-$QT_VERSION/qt-opensource-mac-x64-clang-$QT_VERSION.app/Contents/MacOS/qt-opensource-mac-x64-clang-$QT_VERSION
618 sudo hdiutil detach /Volumes/qt-opensource-mac-x64-clang-$QT_VERSION
621 # Versions 5.3.x through 5.5.0, at least, have bogus .pc files.
622 # See bugs QTBUG-35256 and QTBUG-47162.
626 for i in $HOME/Qt$QT_VERSION/$QT_MAJOR_MINOR_VERSION/clang_64/lib/pkgconfig/*.pc
630 g/Cflags: /s;;Cflags: -F\${libdir} ;
631 g/Cflags: /s;-I\${includedir}/Qt\([a-zA-Z0-9_]*\);-I\${libdir}/Qt\1.framework/Versions/5/Headers;
637 touch qt-$QT_VERSION-done
642 if [ ! -z "$installed_qt_version" ] ; then
643 echo "Uninstalling Qt:"
644 rm -rf $HOME/Qt$installed_qt_version
645 rm qt-$installed_qt_version-done
647 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
649 # Get rid of the previously downloaded version.
651 rm -rf qt-opensource-mac-x64-clang-$installed_qt_version.dmg
654 installed_qt_version=""
659 if [ ! -f libpng-$PNG_VERSION-done ] ; then
660 echo "Downloading, building, and installing libpng:"
662 # The FTP site puts libpng x.y.* into a libpngxy directory.
664 subdir=`echo $PNG_VERSION | sed 's/\([1-9][0-9]*\)\.\([1-9][0-9]*\).*/libpng\1\2'/`
665 [ -f libpng-$PNG_VERSION.tar.xz ] || curl -O ftp://ftp.simplesystems.org/pub/libpng/png/src/$subdir/libpng-$PNG_VERSION.tar.xz
666 xzcat libpng-$PNG_VERSION.tar.xz | tar xf - || exit 1
667 cd libpng-$PNG_VERSION
668 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
669 make $MAKE_BUILD_OPTS || exit 1
670 $DO_MAKE_INSTALL || exit 1
672 touch libpng-$PNG_VERSION-done
677 if [ ! -z "$installed_libpng_version" ] ; then
679 # Cairo depends on this, so uninstall it.
683 echo "Uninstalling libpng:"
684 cd libpng-$installed_libpng_version
685 $DO_MAKE_UNINSTALL || exit 1
686 make distclean || exit 1
688 rm libpng-$installed_libpng_version-done
690 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
692 # Get rid of the previously downloaded and unpacked version.
694 rm -rf libpng-$installed_libpng_version
695 rm -rf libpng-$installed_libpng_version.tar.xz
698 installed_libpng_version=""
703 if [ ! -f pixman-$PIXMAN_VERSION-done ] ; then
704 echo "Downloading, building, and installing pixman:"
705 [ -f pixman-$PIXMAN_VERSION.tar.gz ] || curl -O http://www.cairographics.org/releases/pixman-$PIXMAN_VERSION.tar.gz
706 gzcat pixman-$PIXMAN_VERSION.tar.gz | tar xf - || exit 1
707 cd pixman-$PIXMAN_VERSION
708 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
709 make $MAKE_BUILD_OPTS || exit 1
710 $DO_MAKE_INSTALL || exit 1
712 touch pixman-$PIXMAN_VERSION-done
717 if [ ! -z "$installed_pixman_version" ] ; then
719 # Cairo depends on this, so uninstall it.
723 echo "Uninstalling pixman:"
724 cd pixman-$installed_pixman_version
725 $DO_MAKE_UNINSTALL || exit 1
726 make distclean || exit 1
728 rm pixman-$installed_pixman_version-done
730 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
732 # Get rid of the previously downloaded and unpacked version.
734 rm -rf pixman-$installed_pixman_version
735 rm -rf pixman-$installed_pixman_version.tar.gz
738 installed_pixman_version=""
743 if [ ! -f cairo-$CAIRO_VERSION-done ] ; then
744 echo "Downloading, building, and installing Cairo:"
745 CAIRO_MAJOR_VERSION="`expr $CAIRO_VERSION : '\([0-9][0-9]*\).*'`"
746 CAIRO_MINOR_VERSION="`expr $CAIRO_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
747 CAIRO_DOTDOT_VERSION="`expr $CAIRO_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
748 if [[ $CAIRO_MAJOR_VERSION -gt 1 ||
749 $CAIRO_MINOR_VERSION -gt 12 ||
750 ($CAIRO_MINOR_VERSION -eq 12 && $CAIRO_DOTDOT_VERSION -ge 2) ]]
753 # Starting with Cairo 1.12.2, the tarballs are compressed with
754 # xz rather than gzip.
756 [ -f cairo-$CAIRO_VERSION.tar.xz ] || curl -O http://cairographics.org/releases/cairo-$CAIRO_VERSION.tar.xz || exit 1
757 xzcat cairo-$CAIRO_VERSION.tar.xz | tar xf - || exit 1
759 [ -f cairo-$CAIRO_VERSION.tar.gz ] || curl -O http://cairographics.org/releases/cairo-$CAIRO_VERSION.tar.gz || exit 1
760 gzcat cairo-$CAIRO_VERSION.tar.gz | tar xf - || exit 1
762 cd cairo-$CAIRO_VERSION
763 # CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-quartz=no || exit 1
764 # Maybe follow http://cairographics.org/end_to_end_build_for_mac_os_x/
765 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-quartz=yes || exit 1
767 # We must avoid the version of libpng that comes with X11; the
768 # only way I've found to force that is to forcibly set INCLUDES
769 # when we do the build, so that this comes before CAIRO_CFLAGS,
770 # which has -I/usr/X11/include added to it before anything
771 # connected to libpng is.
773 INCLUDES="-I/usr/local/include/libpng15" make $MAKE_BUILD_OPTS || exit 1
774 $DO_MAKE_INSTALL || exit 1
776 touch cairo-$CAIRO_VERSION-done
781 if [ ! -z "$installed_cairo_version" ] ; then
783 # GTK+ depends on this, so uninstall it.
787 echo "Uninstalling Cairo:"
788 cd cairo-$installed_cairo_version
789 $DO_MAKE_UNINSTALL || exit 1
790 make distclean || exit 1
792 rm cairo-$installed_cairo_version-done
794 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
796 # Get rid of the previously downloaded and unpacked version.
798 rm -rf cairo-$installed_cairo_version
799 rm -rf cairo-$installed_cairo_version.tar.xz cairo-$installed_cairo_version.tar.gz
802 installed_cairo_version=""
807 if [ ! -f atk-$ATK_VERSION-done ] ; then
808 echo "Downloading, building, and installing ATK:"
809 atk_dir=`expr $ATK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
810 ATK_MAJOR_VERSION="`expr $ATK_VERSION : '\([0-9][0-9]*\).*'`"
811 ATK_MINOR_VERSION="`expr $ATK_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
812 ATK_DOTDOT_VERSION="`expr $ATK_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
813 if [[ $ATK_MAJOR_VERSION -gt 2 ||
814 ($ATK_MAJOR_VERSION -eq 2 && $ATK_MINOR_VERSION -gt 0) ||
815 ($ATK_MANOR_VERSION -eq 2 && $ATK_MINOR_VERSION -eq 0 && $ATK_DOTDOT_VERSION -ge 1) ]]
818 # Starting with ATK 2.0.1, xz-compressed tarballs are available.
820 [ -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
821 xzcat atk-$ATK_VERSION.tar.xz | tar xf - || exit 1
823 [ -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
824 bzcat atk-$ATK_VERSION.tar.bz2 | tar xf - || exit 1
827 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
828 make $MAKE_BUILD_OPTS || exit 1
829 $DO_MAKE_INSTALL || exit 1
831 touch atk-$ATK_VERSION-done
836 if [ ! -z "$installed_atk_version" ] ; then
838 # GTK+ depends on this, so uninstall it.
842 echo "Uninstalling ATK:"
843 cd atk-$installed_atk_version
844 $DO_MAKE_UNINSTALL || exit 1
845 make distclean || exit 1
847 rm atk-$installed_atk_version-done
849 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
851 # Get rid of the previously downloaded and unpacked version.
853 rm -rf atk-$installed_atk_version
854 rm -rf atk-$installed_atk_version.tar.xz atk-$installed_atk_version.tar.bz2
857 installed_atk_version=""
862 if [ ! -f pango-$PANGO_VERSION-done ] ; then
863 echo "Downloading, building, and installing Pango:"
864 pango_dir=`expr $PANGO_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
865 PANGO_MAJOR_VERSION="`expr $PANGO_VERSION : '\([0-9][0-9]*\).*'`"
866 PANGO_MINOR_VERSION="`expr $PANGO_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
867 if [[ $PANGO_MAJOR_VERSION -gt 1 ||
868 $PANGO_MINOR_VERSION -ge 29 ]]
871 # Starting with Pango 1.29, the tarballs are compressed with
872 # xz rather than bzip2.
874 [ -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
875 xzcat pango-$PANGO_VERSION.tar.xz | tar xf - || exit 1
877 [ -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
878 bzcat pango-$PANGO_VERSION.tar.bz2 | tar xf - || exit 1
880 cd pango-$PANGO_VERSION
881 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
882 make $MAKE_BUILD_OPTS || exit 1
883 $DO_MAKE_INSTALL || exit 1
885 touch pango-$PANGO_VERSION-done
890 if [ ! -z "$installed_pango_version" ] ; then
892 # GTK+ depends on this, so uninstall it.
896 echo "Uninstalling Pango:"
897 cd pango-$installed_pango_version
898 $DO_MAKE_UNINSTALL || exit 1
899 make distclean || exit 1
901 rm pango-$installed_pango_version-done
903 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
905 # Get rid of the previously downloaded and unpacked version.
907 rm -rf pango-$installed_pango_version
908 rm -rf pango-$installed_pango_version.tar.xz pango-$installed_pango_version.tar.bz2
911 installed_pango_version=""
915 install_gdk_pixbuf() {
916 if [ "$GDK_PIXBUF_VERSION" -a ! -f gdk-pixbuf-$GDK_PIXBUF_VERSION-done ] ; then
917 echo "Downloading, building, and installing gdk-pixbuf:"
918 gdk_pixbuf_dir=`expr $GDK_PIXBUF_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
919 [ -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
920 xzcat gdk-pixbuf-$GDK_PIXBUF_VERSION.tar.xz | tar xf - || exit 1
921 cd gdk-pixbuf-$GDK_PIXBUF_VERSION
923 # If we're building using the 10.6 SDK, force the use of libpng12.
925 # The OS's X11, and corresponding SDK, didn't introduce libpng15,
926 # or pkg-config files, until 10.7, so, for 10.6 have to explicitly
927 # set LIBPNG to override the configure script, and also force the
928 # CFLAGS to look for the header files for libpng12 (note that
929 # -isysroot doesn't affect the arguments to -I, so we need to
930 # include the SDK path explicitly).
932 if [[ "$sdk_target" = 10.6 ]]
934 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
936 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
938 make $MAKE_BUILD_OPTS || exit 1
939 $DO_MAKE_INSTALL || exit 1
941 touch gdk-pixbuf-$GDK_PIXBUF_VERSION-done
945 uninstall_gdk_pixbuf() {
946 if [ ! -z "$installed_gdk_pixbuf_version" ] ; then
948 # GTK+ depends on this, so uninstall it.
952 echo "Uninstalling gdk-pixbuf:"
953 cd gdk-pixbuf-$installed_gdk_pixbuf_version
954 $DO_MAKE_UNINSTALL || exit 1
955 make distclean || exit 1
957 rm gdk-pixbuf-$installed_gdk_pixbuf_version-done
959 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
961 # Get rid of the previously downloaded and unpacked version.
963 rm -rf gdk-pixbuf-$installed_gdk_pixbuf_version
964 rm -rf gdk-pixbuf-$installed_gdk_pixbuf_version.tar.xz
967 installed_gdk_pixbuf_version=""
972 if [ ! -f gtk+-$GTK_VERSION-done ] ; then
973 echo "Downloading, building, and installing GTK+:"
974 gtk_dir=`expr $GTK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
975 if [[ $GTK_MAJOR_VERSION -gt 2 ||
976 $GTK_MINOR_VERSION -gt 24 ||
977 ($GTK_MINOR_VERSION -eq 24 && $GTK_DOTDOT_VERSION -ge 5) ]]
980 # Starting with GTK+ 2.24.5, the tarballs are compressed with
981 # xz rather than gzip, in addition to bzip2; use xz, as we've
982 # built and installed it, and as xz compresses better than
983 # bzip2 so the tarballs take less time to download.
985 [ -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
986 xzcat gtk+-$GTK_VERSION.tar.xz | tar xf - || exit 1
988 [ -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
989 bzcat gtk+-$GTK_VERSION.tar.bz2 | tar xf - || exit 1
992 if [ $DARWIN_MAJOR_VERSION -ge "12" ]
995 # GTK+ 2.24.10, at least, doesn't build on Mountain Lion with the
996 # CUPS printing backend - either the CUPS API changed incompatibly
997 # or the backend was depending on non-API implementation details.
999 # Configure it out, on Mountain Lion and later, for now.
1000 # (12 is the Darwin major version number in Mountain Lion.)
1002 # Also, configure out libtiff and libjpeg; configure scripts
1003 # just ignore unknown --enable/--disable and --with/--without
1004 # options (at least they've always do so up to now).
1006 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
1008 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
1010 make $MAKE_BUILD_OPTS || exit 1
1011 $DO_MAKE_INSTALL || exit 1
1013 touch gtk+-$GTK_VERSION-done
1018 if [ ! -z "$installed_gtk_version" ] ; then
1019 echo "Uninstalling GTK+:"
1020 cd gtk+-$installed_gtk_version
1021 $DO_MAKE_UNINSTALL || exit 1
1022 make distclean || exit 1
1024 rm gtk+-$installed_gtk_version-done
1026 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1028 # Get rid of the previously downloaded and unpacked version.
1030 rm -rf gtk+-$installed_gtk_version
1031 rm -rf gtk+-$installed_gtk_version.tar.xz gtk+-$installed_gtk_version.tar.bz2
1034 installed_gtk_version=""
1039 if [ "$LIBSMI_VERSION" -a ! -f libsmi-$LIBSMI_VERSION-done ] ; then
1040 echo "Downloading, building, and installing libsmi:"
1041 [ -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
1042 gzcat libsmi-$LIBSMI_VERSION.tar.gz | tar xf - || exit 1
1043 cd libsmi-$LIBSMI_VERSION
1044 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1045 make $MAKE_BUILD_OPTS || exit 1
1046 $DO_MAKE_INSTALL || exit 1
1048 touch libsmi-$LIBSMI_VERSION-done
1052 uninstall_libsmi() {
1053 if [ ! -z "$installed_libsmi_version" ] ; then
1054 echo "Uninstalling libsmi:"
1055 cd libsmi-$installed_libsmi_version
1056 $DO_MAKE_UNINSTALL || exit 1
1057 make distclean || exit 1
1059 rm libsmi-$installed_libsmi_version-done
1061 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1063 # Get rid of the previously downloaded and unpacked version.
1065 rm -rf libsmi-$installed_libsmi_version
1066 rm -rf libsmi-$installed_libsmi_version.tar.gz
1069 installed_libsmi_version=""
1073 install_libgpg_error() {
1074 if [ "$LIBGPG_ERROR_VERSION" -a ! -f libgpg-error-$LIBGPG_ERROR_VERSION-done ] ; then
1075 echo "Downloading, building, and installing libgpg-error:"
1076 [ -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
1077 bzcat libgpg-error-$LIBGPG_ERROR_VERSION.tar.bz2 | tar xf - || exit 1
1078 cd libgpg-error-$LIBGPG_ERROR_VERSION
1079 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1080 make $MAKE_BUILD_OPTS || exit 1
1081 $DO_MAKE_INSTALL || exit 1
1083 touch libgpg-error-$LIBGPG_ERROR_VERSION-done
1087 uninstall_libgpg_error() {
1088 if [ ! -z "$installed_libgpg_error_version" ] ; then
1090 # libgcrypt depends on this, so uninstall it.
1092 uninstall_libgcrypt "$@"
1094 echo "Uninstalling libgpg-error:"
1095 cd libgpg-error-$installed_libgpg_error_version
1096 $DO_MAKE_UNINSTALL || exit 1
1097 make distclean || exit 1
1099 rm libgpg-error-$installed_libgpg_error_version-done
1101 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1103 # Get rid of the previously downloaded and unpacked version.
1105 rm -rf libgpg-error-$installed_libgpg_error_version
1106 rm -rf libgpg-error-$installed_libgpg_error_version.tar.bz2
1109 installed_libgpg_error_version=""
1113 install_libgcrypt() {
1114 if [ "$LIBGCRYPT_VERSION" -a ! -f libgcrypt-$LIBGCRYPT_VERSION-done ] ; then
1116 # libgpg-error is required for libgcrypt.
1118 if [ -z $LIBGPG_ERROR_VERSION ]
1120 echo "libgcrypt requires libgpg-error, but you didn't install libgpg-error." 1>&2
1124 echo "Downloading, building, and installing libgcrypt:"
1125 [ -f libgcrypt-$LIBGCRYPT_VERSION.tar.gz ] || curl -L -O ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-$LIBGCRYPT_VERSION.tar.gz || exit 1
1126 gzcat libgcrypt-$LIBGCRYPT_VERSION.tar.gz | tar xf - || exit 1
1127 cd libgcrypt-$LIBGCRYPT_VERSION
1129 # The assembler language code is not compatible with the OS X
1130 # x86 assembler (or is it an x86-64 vs. x86-32 issue?).
1132 # libgcrypt expects gnu89, not c99/gnu99, semantics for
1133 # "inline". See, for example:
1135 # http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2010-October/198809.html
1137 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
1138 make $MAKE_BUILD_OPTS || exit 1
1139 $DO_MAKE_INSTALL || exit 1
1141 touch libgcrypt-$LIBGCRYPT_VERSION-done
1145 uninstall_libgcrypt() {
1146 if [ ! -z "$installed_libgcrypt_version" ] ; then
1148 # GnuTLS depends on this, so uninstall it.
1150 uninstall_gnutls "$@"
1152 echo "Uninstalling libgcrypt:"
1153 cd libgcrypt-$installed_libgcrypt_version
1154 $DO_MAKE_UNINSTALL || exit 1
1155 make distclean || exit 1
1157 rm libgcrypt-$installed_libgcrypt_version-done
1159 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1161 # Get rid of the previously downloaded and unpacked version.
1163 rm -rf libgcrypt-$installed_libgcrypt_version
1164 rm -rf libgcrypt-$installed_libgcrypt_version.tar.gz
1167 installed_libgcrypt_version=""
1172 if [ "$GNUTLS_VERSION" -a ! -f gnutls-$GNUTLS_VERSION-done ] ; then
1174 # GnuTLS requires libgcrypt (or nettle, in newer versions).
1176 if [ -z $LIBGCRYPT_VERSION ]
1178 echo "GnuTLS requires libgcrypt, but you didn't install libgcrypt" 1>&2
1182 echo "Downloading, building, and installing GnuTLS:"
1183 [ -f gnutls-$GNUTLS_VERSION.tar.bz2 ] || curl -L -O http://ftp.gnu.org/gnu/gnutls/gnutls-$GNUTLS_VERSION.tar.bz2 || exit 1
1184 bzcat gnutls-$GNUTLS_VERSION.tar.bz2 | tar xf - || exit 1
1185 cd gnutls-$GNUTLS_VERSION
1187 # Use libgcrypt, not nettle.
1188 # XXX - is there some reason to prefer nettle? Or does
1189 # Wireshark directly use libgcrypt routines?
1191 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
1192 make $MAKE_BUILD_OPTS || exit 1
1194 # The pkgconfig file for GnuTLS says "requires zlib", but OS X,
1195 # while it supplies zlib, doesn't supply a pkgconfig file for
1198 # Patch the GnuTLS pkgconfig file not to require zlib.
1199 # (If the capabilities of GnuTLS that Wireshark uses don't
1200 # depend on building GnuTLS with zlib, an alternative would be
1201 # to configure it not to use zlib.)
1203 patch -p0 lib/gnutls.pc.in <../../macosx-support-lib-patches/gnutls-pkgconfig.patch || exit 1
1204 $DO_MAKE_INSTALL || exit 1
1206 touch gnutls-$GNUTLS_VERSION-done
1210 uninstall_gnutls() {
1211 if [ ! -z "$installed_gnutls_version" ] ; then
1212 echo "Uninstalling GnuTLS:"
1213 cd gnutls-$installed_gnutls_version
1214 $DO_MAKE_UNINSTALL || exit 1
1215 make distclean || exit 1
1217 rm gnutls-$installed_gnutls_version-done
1219 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1221 # Get rid of the previously downloaded and unpacked version.
1223 rm -rf gnutls-$installed_gnutls_version
1224 rm -rf gnutls-$installed_gnutls_version.tar.bz2
1227 installed_gnutls_version=""
1232 if [ "$LUA_VERSION" -a ! -f lua-$LUA_VERSION-done ] ; then
1233 echo "Downloading, building, and installing Lua:"
1234 [ -f lua-$LUA_VERSION.tar.gz ] || curl -L -O http://www.lua.org/ftp/lua-$LUA_VERSION.tar.gz || exit 1
1235 gzcat lua-$LUA_VERSION.tar.gz | tar xf - || exit 1
1237 make $MAKE_BUILD_OPTS macosx || exit 1
1238 $DO_MAKE_INSTALL || exit 1
1240 touch lua-$LUA_VERSION-done
1245 if [ ! -z "$installed_lua_version" ] ; then
1246 echo "Uninstalling Lua:"
1248 # Lua has no "make uninstall", so just remove stuff manually.
1249 # There's no configure script, so there's no need for
1250 # "make distclean", either; just do "make clean".
1252 (cd /usr/local/bin; $DO_RM -f lua luac)
1253 (cd /usr/local/include; $DO_RM -f lua.h luaconf.h lualib.h lauxlib.h lua.hpp)
1254 (cd /usr/local/lib; $DO_RM -f liblua.a)
1255 (cd /usr/local/man/man1; $DO_RM -f lua.1 luac.1)
1256 cd lua-$installed_lua_version
1257 make clean || exit 1
1259 rm lua-$installed_lua_version-done
1261 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1263 # Get rid of the previously downloaded and unpacked version.
1265 rm -rf lua-$installed_lua_version
1266 rm -rf lua-$installed_lua_version.tar.gz
1269 installed_lua_version=""
1273 install_portaudio() {
1275 # Check for both the old versionless portaudio-done and the new
1276 # versioned -done file.
1278 if [ "$PORTAUDIO_VERSION" -a ! -f portaudio-$PORTAUDIO_VERSION-done ] ; then
1279 echo "Downloading, building, and installing PortAudio:"
1280 [ -f $PORTAUDIO_VERSION.tgz ] || curl -L -O http://www.portaudio.com/archives/$PORTAUDIO_VERSION.tgz || exit 1
1281 gzcat $PORTAUDIO_VERSION.tgz | tar xf - || exit 1
1284 # Un-comment an include that's required on Lion.
1286 patch -p0 include/pa_mac_core.h <../../macosx-support-lib-patches/portaudio-pa_mac_core.h.patch
1288 # Fix a bug that showed up with clang (but is a bug with any
1291 patch -p0 src/hostapi/coreaudio/pa_mac_core.c <../../macosx-support-lib-patches/portaudio-pa_mac_core.c.patch
1293 # Disable fat builds - the configure script doesn't work right
1294 # with Xcode 4 if you leave them enabled, and we don't build
1295 # any other libraries fat (GLib, for example, would be very
1296 # hard to build fat), so there's no advantage to having PortAudio
1299 # Set the minimum OS X version to 10.4, to suppress some
1300 # deprecation warnings. (Good luck trying to make any of
1301 # this build on an OS+Xcode with a pre-10.4 SDK; we don't
1302 # worry about the user requesting that.)
1304 # Explicitly disable deprecation, so the damn thing will build
1305 # on El Capitan with Xcode 7.
1307 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
1308 make $MAKE_BUILD_OPTS || exit 1
1309 $DO_MAKE_INSTALL || exit 1
1311 touch portaudio-$PORTAUDIO_VERSION-done
1315 uninstall_portaudio() {
1316 if [ ! -z "$installed_portaudio_version" ] ; then
1317 echo "Uninstalling PortAudio:"
1319 $DO_MAKE_UNINSTALL || exit 1
1320 make distclean || exit 1
1322 rm portaudio-$installed_portaudio_version-done
1324 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1326 # Get rid of the previously downloaded and unpacked version.
1329 rm -rf $installed_portaudio_version.tgz
1332 installed_portaudio_version=""
1337 if [ "$GEOIP_VERSION" -a ! -f geoip-$GEOIP_VERSION-done ] ; then
1338 echo "Downloading, building, and installing GeoIP API:"
1339 [ -f GeoIP-$GEOIP_VERSION.tar.gz ] || curl -L -O http://geolite.maxmind.com/download/geoip/api/c/GeoIP-$GEOIP_VERSION.tar.gz || exit 1
1340 gzcat GeoIP-$GEOIP_VERSION.tar.gz | tar xf - || exit 1
1341 cd GeoIP-$GEOIP_VERSION
1342 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1344 # Grr. Their man pages "helpfully" have an ISO 8859-1
1345 # copyright symbol in the copyright notice, but OS X's
1346 # default character encoding is UTF-8. sed on Mountain
1347 # Lion barfs at the "illegal character sequence" represented
1348 # by an ISO 8859-1 copyright symbol, as it's not a valid
1351 # iconv the relevant man pages into UTF-8.
1353 for i in geoipupdate.1.in geoiplookup6.1.in geoiplookup.1.in
1355 iconv -f iso8859-1 -t utf-8 man/"$i" >man/"$i".tmp &&
1356 mv man/"$i".tmp man/"$i"
1358 make $MAKE_BUILD_OPTS || exit 1
1359 $DO_MAKE_INSTALL || exit 1
1361 touch geoip-$GEOIP_VERSION-done
1366 if [ ! -z "$installed_geoip_version" ] ; then
1367 echo "Uninstalling GeoIP API:"
1368 cd GeoIP-$installed_geoip_version
1369 $DO_MAKE_UNINSTALL || exit 1
1370 make distclean || exit 1
1372 rm geoip-$installed_geoip_version-done
1374 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1376 # Get rid of the previously downloaded and unpacked version.
1378 rm -rf GeoIP-$installed_geoip_version
1379 rm -rf GeoIP-$installed_geoip_version.tar.gz
1382 installed_geoip_version=""
1387 if [ "$CARES_VERSION" -a ! -f c-ares-$CARES_VERSION-done ] ; then
1388 echo "Downloading, building, and installing C-Ares API:"
1389 [ -f c-ares-$CARES_VERSION.tar.gz ] || curl -L -O http://c-ares.haxx.se/download/c-ares-$CARES_VERSION.tar.gz || exit 1
1390 gzcat c-ares-$CARES_VERSION.tar.gz | tar xf - || exit 1
1391 cd c-ares-$CARES_VERSION
1392 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1393 make $MAKE_BUILD_OPTS || exit 1
1394 $DO_MAKE_INSTALL || exit 1
1396 touch c-ares-$CARES_VERSION-done
1400 uninstall_c_ares() {
1401 if [ ! -z "$installed_cares_version" ] ; then
1402 echo "Uninstalling C-Ares API:"
1403 cd c-ares-$installed_cares_version
1404 $DO_MAKE_UNINSTALL || exit 1
1405 make distclean || exit 1
1407 rm c-ares-$installed_cares_version-done
1409 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1411 # Get rid of the previously downloaded and unpacked version.
1413 rm -rf c-ares-$installed_cares_version
1414 rm -rf c-ares-$installed_cares_version.tar.gz
1417 installed_cares_version=""
1423 # Check whether the versions we have installed are the versions
1424 # requested; if not, uninstall the installed versions.
1426 if [ ! -z "$installed_cares_version" -a \
1427 "$installed_cares_version" != "$CARES_VERSION" ] ; then
1428 echo "Installed C-Ares version is $installed_cares_version"
1429 if [ -z "$CARES_VERSION" ] ; then
1430 echo "C-Ares is not requested"
1432 echo "Requested C-Ares version is $CARES_VERSION"
1437 if [ ! -z "$installed_geoip_version" -a \
1438 "$installed_geoip_version" != "$GEOIP_VERSION" ] ; then
1439 echo "Installed GeoIP API version is $installed_geoip_version"
1440 if [ -z "$GEOIP_VERSION" ] ; then
1441 echo "GeoIP is not requested"
1443 echo "Requested GeoIP version is $GEOIP_VERSION"
1448 if [ ! -z "$installed_portaudio_version" -a \
1449 "$installed_portaudio_version" != "$PORTAUDIO_VERSION" ] ; then
1450 echo "Installed PortAudio version is $installed_portaudio_version"
1451 if [ -z "$PORTAUDIO_VERSION" ] ; then
1452 echo "PortAudio is not requested"
1454 echo "Requested PortAudio version is $PORTAUDIO_VERSION"
1456 uninstall_portaudio -r
1459 if [ ! -z "$installed_lua_version" -a \
1460 "$installed_lua_version" != "$LUA_VERSION" ] ; then
1461 echo "Installed Lua version is $installed_lua_version"
1462 if [ -z "$LUA_VERSION" ] ; then
1463 echo "Lua is not requested"
1465 echo "Requested Lua version is $LUA_VERSION"
1470 if [ ! -z "$installed_gnutls_version" -a \
1471 "$installed_gnutls_version" != "$GNUTLS_VERSION" ] ; then
1472 echo "Installed GnuTLS version is $installed_gnutls_version"
1473 if [ -z "$GNUTLS_VERSION" ] ; then
1474 echo "GnuTLS is not requested"
1476 echo "Requested GnuTLS version is $GNUTLS_VERSION"
1481 if [ ! -z "$installed_libgcrypt_version" -a \
1482 "$installed_libgcrypt_version" != "$LIBGCRYPT_VERSION" ] ; then
1483 echo "Installed libgcrypt version is $installed_libgcrypt_version"
1484 if [ -z "$LIBGCRYPT_VERSION" ] ; then
1485 echo "libgcrypt is not requested"
1487 echo "Requested libgcrypt version is $LIBGCRYPT_VERSION"
1489 uninstall_libgcrypt -r
1492 if [ ! -z "$installed_libgpg_error_version" -a \
1493 "$installed_libgpg_error_version" != "$LIBGPG_ERROR_VERSION" ] ; then
1494 echo "Installed libgpg-error version is $installed_libgpg_error_version"
1495 if [ -z "$LIBGPG_ERROR_VERSION" ] ; then
1496 echo "libgpg-error is not requested"
1498 echo "Requested libgpg-error version is $LIBGPG_ERROR_VERSION"
1500 uninstall_libgpg_error -r
1503 if [ ! -z "$installed_libsmi_version" -a \
1504 "$installed_libsmi_version" != "$LIBSMI_VERSION" ] ; then
1505 echo "Installed libsmi version is $installed_libsmi_version"
1506 if [ -z "$LIBSMI_VERSION" ] ; then
1507 echo "libsmi is not requested"
1509 echo "Requested libsmi version is $LIBSMI_VERSION"
1514 if [ ! -z "$installed_gtk_version" -a \
1515 "$installed_gtk_version" != "$GTK_VERSION" ] ; then
1516 echo "Installed GTK+ version is $installed_gtk_version"
1517 if [ -z "$GTK_VERSION" ] ; then
1518 echo "GTK+ is not requested"
1520 echo "Requested GTK+ version is $GTK_VERSION"
1525 if [ ! -z "$installed_gdk_pixbuf_version" -a \
1526 "$installed_gdk_pixbuf_version" != "$GDK_PIXBUF_VERSION" ] ; then
1527 echo "Installed gdk-pixbuf version is $installed_gdk_pixbuf_version"
1528 if [ -z "$GDK_PIXBUF_VERSION" ] ; then
1529 echo "gdk-pixbuf is not requested"
1531 echo "Requested gdk-pixbuf version is $GDK_PIXBUF_VERSION"
1533 uninstall_gdk_pixbuf -r
1536 if [ ! -z "$installed_pango_version" -a \
1537 "$installed_pango_version" != "$PANGO_VERSION" ] ; then
1538 echo "Installed Pango version is $installed_pango_version"
1539 if [ -z "$PANGO_VERSION" ] ; then
1540 echo "Pango is not requested"
1542 echo "Requested Pango version is $PANGO_VERSION"
1547 if [ ! -z "$installed_atk_version" -a \
1548 "$installed_atk_version" != "$ATK_VERSION" ] ; then
1549 echo "Installed ATK version is $installed_atk_version"
1550 if [ -z "$ATK_VERSION" ] ; then
1551 echo "ATK is not requested"
1553 echo "Requested ATK version is $ATK_VERSION"
1558 if [ ! -z "$installed_cairo_version" -a \
1559 "$installed_cairo_version" != "$CAIRO_VERSION" ] ; then
1560 echo "Installed Cairo version is $installed_cairo_version"
1561 if [ -z "$CAIRO_VERSION" ] ; then
1562 echo "Cairo is not requested"
1564 echo "Requested Cairo version is $CAIRO_VERSION"
1569 if [ ! -z "$installed_pixman_version" -a \
1570 "$installed_pixman_version" != "$PIXMAN_VERSION" ] ; then
1571 echo "Installed pixman version is $installed_pixman_version"
1572 if [ -z "$PIXMAN_VERSION" ] ; then
1573 echo "pixman is not requested"
1575 echo "Requested pixman version is $PIXMAN_VERSION"
1580 if [ ! -z "$installed_libpng_version" -a \
1581 "$installed_libpng_version" != "$PNG_VERSION" ] ; then
1582 echo "Installed libpng version is $installed_libpng_version"
1583 if [ -z "$PNG_VERSION" ] ; then
1584 echo "libpng is not requested"
1586 echo "Requested libpng version is $PNG_VERSION"
1591 if [ ! -z "$installed_qt_version" -a \
1592 "$installed_qt_version" != "$QT_VERSION" ] ; then
1593 echo "Installed Qt version is $installed_qt_version"
1594 if [ -z "$QT_VERSION" ] ; then
1595 echo "Qt is not requested"
1597 echo "Requested Qt version is $QT_VERSION"
1602 if [ ! -z "$installed_glib_version" -a \
1603 "$installed_glib_version" != "$GLIB_VERSION" ] ; then
1604 echo "Installed GLib version is $installed_glib_version"
1605 if [ -z "$GLIB_VERSION" ] ; then
1606 echo "GLib is not requested"
1608 echo "Requested GLib version is $GLIB_VERSION"
1613 if [ ! -z "$installed_pkg_config_version" -a \
1614 "$installed_pkg_config_version" != "$PKG_CONFIG_VERSION" ] ; then
1615 echo "Installed pkg-config version is $installed_pkg_config_version"
1616 if [ -z "$PKG_CONFIG_VERSION" ] ; then
1617 echo "pkg-config is not requested"
1619 echo "Requested pkg-config version is $PKG_CONFIG_VERSION"
1621 uninstall_pkg_config -r
1624 if [ ! -z "$installed_gettext_version" -a \
1625 "$installed_gettext_version" != "$GETTEXT_VERSION" ] ; then
1626 echo "Installed GNU gettext version is $installed_gettext_version"
1627 if [ -z "$GETTEXT_VERSION" ] ; then
1628 echo "GNU gettext is not requested"
1630 echo "Requested GNU gettext version is $GETTEXT_VERSION"
1632 uninstall_gettext -r
1635 if [ ! -z "$installed_cmake_version" -a \
1636 "$installed_cmake_version" != "$CMAKE_VERSION" ] ; then
1637 echo "Installed CMake version is $installed_cmake_version"
1638 if [ -z "$CMAKE_VERSION" ] ; then
1639 echo "CMake is not requested"
1641 echo "Requested CMake version is $CMAKE_VERSION"
1644 # XXX - really remove this?
1645 # Or should we remember it as installed only if this script
1651 if [ ! -z "$installed_libtool_version" -a \
1652 "$installed_libtool_version" != "$LIBTOOL_VERSION" ] ; then
1653 echo "Installed GNU libtool version is $installed_libtool_version"
1654 if [ -z "$LIBTOOL_VERSION" ] ; then
1655 echo "GNU libtool is not requested"
1657 echo "Requested GNU libtool version is $LIBTOOL_VERSION"
1659 uninstall_libtool -r
1662 if [ ! -z "$installed_automake_version" -a \
1663 "$installed_automake_version" != "$AUTOMAKE_VERSION" ] ; then
1664 echo "Installed GNU automake version is $installed_automake_version"
1665 if [ -z "$AUTOMAKE_VERSION" ] ; then
1666 echo "GNU automake is not requested"
1668 echo "Requested GNU automake version is $AUTOMAKE_VERSION"
1670 uninstall_automake -r
1673 if [ ! -z "$installed_autoconf_version" -a \
1674 "$installed_autoconf_version" != "$AUTOCONF_VERSION" ] ; then
1675 echo "Installed GNU autoconf version is $installed_autoconf_version"
1676 if [ -z "$AUTOCONF_VERSION" ] ; then
1677 echo "GNU autoconf is not requested"
1679 echo "Requested GNU autoconf version is $AUTOCONF_VERSION"
1681 uninstall_autoconf -r
1684 if [ ! -z "$installed_xz_version" -a \
1685 "$installed_xz_version" != "$XZ_VERSION" ] ; then
1686 echo "Installed xz version is $installed_xz_version"
1687 if [ -z "$XZ_VERSION" ] ; then
1688 echo "xz is not requested"
1690 echo "Requested xz version is $XZ_VERSION"
1696 # Start with xz: It is the sole download format of glib later than 2.31.2
1709 # Start with GNU gettext; GLib requires it, and OS X doesn't have it
1710 # or a BSD-licensed replacement.
1712 # At least on Lion with Xcode 4, _FORTIFY_SOURCE gets defined as 2
1713 # by default, which causes, for example, stpncpy to be defined as
1714 # a hairy macro that collides with the GNU gettext configure script's
1715 # attempts to workaround AIX's lack of a declaration for stpncpy,
1716 # with the result being a huge train wreck. Define _FORTIFY_SOURCE
1717 # as 0 in an attempt to keep the trains on separate tracks.
1722 # GLib depends on pkg-config.
1723 # By default, pkg-config depends on GLib; we break the dependency cycle
1724 # by configuring pkg-config to use its own internal version of GLib.
1731 # Now we have reached a point where we can build everything but
1732 # the GUI (Wireshark).
1736 if [ "$GTK_VERSION" ]; then
1738 # GTK+ 3 requires a newer Cairo build than the one that comes with
1739 # 10.6, so we build Cairo if we are using GTK+ 3.
1741 # In 10.6 and 10.7, it's an X11 library; if we build with "native" GTK+
1742 # rather than X11 GTK+, we might have to build and install Cairo.
1743 # In 10.8 and later, there is no X11, but it's included in Xquartz;
1744 # again, if we build with "native" GTK+, we'd have to build and install
1747 if [[ "$GTK_MAJOR_VERSION" -eq 3 || "$cairo_not_in_the_os" = yes ]]; then
1749 # Requirements for Cairo first
1751 # The libpng that comes with the X11 for Leopard has a bogus
1752 # pkg-config file that lies about where the header files are,
1753 # which causes other packages not to be able to find its
1756 # The libpng in later versions is not what the version of
1757 # libpixman we build below wants - it wants libpng15.
1762 # The libpixman versions that come with the X11s for Leopard,
1763 # Snow Leopard, and Lion is too old to support Cairo's image
1764 # surface backend feature (which requires pixman-1 >= 0.22.0).
1766 # XXX - what about the one that comes with the latest version
1772 # And now Cairo itself.
1773 # XXX - with the libxcb that comes with 10.6,
1774 # xcb_discard_reply() is missing, and the build fails.
1789 # Now we have reached a point where we can build everything including
1790 # the GUI (Wireshark), but not with any optional features such as
1791 # SNMP OID resolution, some forms of decryption, Lua scripting, playback
1792 # of audio, or GeoIP mapping of IP addresses.
1794 # We now conditionally download optional libraries to support them;
1795 # the default is to download them all.
1800 install_libgpg_error
1816 if [ -d macosx-support-libs ]
1818 cd macosx-support-libs
1821 # Uninstall items in the reverse order from the order in which they're
1822 # installed. Only uninstall if the download/build/install process
1823 # completed; uninstall the version that appears in the name of
1826 # We also do a "make distclean", so that we don't have leftovers from
1827 # old configurations.
1841 uninstall_libgpg_error
1847 uninstall_gdk_pixbuf
1863 uninstall_pkg_config
1868 # XXX - really remove this?
1869 # Or should we remember it as installed only if this script
1885 # Do we have permission to write in /usr/local?
1887 # If so, assume we have permission to write in its subdirectories.
1888 # (If that's not the case, this test needs to check the subdirectories
1891 # If not, do "make install", "make uninstall", the removes for Lua,
1892 # and the renames of [g]libtool* with sudo.
1894 if [ -w /usr/local ]
1896 DO_MAKE_INSTALL="make install"
1897 DO_MAKE_UNINSTALL="make uninstall"
1901 DO_MAKE_INSTALL="sudo make install"
1902 DO_MAKE_UNINSTALL="sudo make uninstall"
1908 # If we have SDKs available, the default target OS is the major version
1909 # of the one we're running; get that and strip off the third component
1912 for i in /Developer/SDKs \
1913 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
1914 /Library/Developer/CommandLineTools/SDKs
1918 min_osx_target=`sw_vers -productVersion | sed 's/\([0-9]*\)\.\([0-9]*\)\.[0-9]*/\1.\2/'`
1921 # That's also the OS whose SDK we'd be using.
1923 sdk_target=$min_osx_target
1929 # Parse command-line flags:
1932 # -t <target> - build libraries so that they'll work on the specified
1933 # version of OS X and later versions.
1934 # -u - do an uninstall.
1936 while getopts ht:u name
1943 min_osx_target="$OPTARG"
1946 echo "Usage: macosx-setup.sh [ -t <target> ] [ -u ]" 1>&1
1953 # Get the version numbers of installed packages, if any.
1955 if [ -d macosx-support-libs ]
1957 cd macosx-support-libs
1959 installed_xz_version=`ls xz-*-done 2>/dev/null | sed 's/xz-\(.*\)-done/\1/'`
1960 installed_autoconf_version=`ls autoconf-*-done 2>/dev/null | sed 's/autoconf-\(.*\)-done/\1/'`
1961 installed_automake_version=`ls automake-*-done 2>/dev/null | sed 's/automake-\(.*\)-done/\1/'`
1962 installed_libtool_version=`ls libtool-*-done 2>/dev/null | sed 's/libtool-\(.*\)-done/\1/'`
1963 installed_cmake_version=`ls cmake-*-done 2>/dev/null | sed 's/cmake-\(.*\)-done/\1/'`
1964 installed_gettext_version=`ls gettext-*-done 2>/dev/null | sed 's/gettext-\(.*\)-done/\1/'`
1965 installed_pkg_config_version=`ls pkg-config-*-done 2>/dev/null | sed 's/pkg-config-\(.*\)-done/\1/'`
1966 installed_glib_version=`ls glib-*-done 2>/dev/null | sed 's/glib-\(.*\)-done/\1/'`
1967 installed_qt_version=`ls qt-*-done 2>/dev/null | sed 's/qt-\(.*\)-done/\1/'`
1968 installed_libpng_version=`ls libpng-*-done 2>/dev/null | sed 's/libpng-\(.*\)-done/\1/'`
1969 installed_pixman_version=`ls pixman-*-done 2>/dev/null | sed 's/pixman-\(.*\)-done/\1/'`
1970 installed_cairo_version=`ls cairo-*-done 2>/dev/null | sed 's/cairo-\(.*\)-done/\1/'`
1971 installed_atk_version=`ls atk-*-done 2>/dev/null | sed 's/atk-\(.*\)-done/\1/'`
1972 installed_pango_version=`ls pango-*-done 2>/dev/null | sed 's/pango-\(.*\)-done/\1/'`
1973 installed_gdk_pixbuf_version=`ls gdk-pixbuf-*-done 2>/dev/null | sed 's/gdk-pixbuf-\(.*\)-done/\1/'`
1974 installed_gtk_version=`ls gtk+-*-done 2>/dev/null | sed 's/gtk+-\(.*\)-done/\1/'`
1975 installed_libsmi_version=`ls libsmi-*-done 2>/dev/null | sed 's/libsmi-\(.*\)-done/\1/'`
1976 installed_libgpg_error_version=`ls libgpg-error-*-done 2>/dev/null | sed 's/libgpg-error-\(.*\)-done/\1/'`
1977 installed_libgcrypt_version=`ls libgcrypt-*-done 2>/dev/null | sed 's/libgcrypt-\(.*\)-done/\1/'`
1978 installed_gnutls_version=`ls gnutls-*-done 2>/dev/null | sed 's/gnutls-\(.*\)-done/\1/'`
1979 installed_lua_version=`ls lua-*-done 2>/dev/null | sed 's/lua-\(.*\)-done/\1/'`
1980 installed_portaudio_version=`ls portaudio-*-done 2>/dev/null | sed 's/portaudio-\(.*\)-done/\1/'`
1981 installed_geoip_version=`ls geoip-*-done 2>/dev/null | sed 's/geoip-\(.*\)-done/\1/'`
1982 installed_cares_version=`ls c-ares-*-done 2>/dev/null | sed 's/c-ares-\(.*\)-done/\1/'`
1985 # If we don't have a versioned -done file for portaudio, but do have
1986 # an unversioned -done file for it, assume the installed version is the
1987 # requested version, and rename the -done file to include that version.
1989 if [ -z "$installed_portaudio_version" -a -f portaudio-done ] ; then
1990 mv portaudio-done portaudio-$PORTAUDIO_VERSION-done
1991 installed_portaudio_version=`ls portaudio-*-done 2>/dev/null | sed 's/portaudio-\(.*\)-done/\1/'`
1997 if [ "$do_uninstall" = "yes" ]
2004 # Configure scripts tend to set CFLAGS and CXXFLAGS to "-g -O2" if
2005 # invoked without CFLAGS or CXXFLAGS being set in the environment.
2007 # However, we *are* setting them in the environment, for our own
2008 # nefarious purposes, so start them out as "-g -O2".
2014 # To make this work on Leopard (rather than working *on* Snow Leopard
2015 # when building *for* Leopard) will take more work.
2017 # For one thing, Leopard's /usr/X11/lib/libXdamage.la claims, at least
2018 # with all software updates applied, that the Xdamage shared library
2019 # is libXdamage.1.0.0.dylib, but it is, in fact, libXdamage.1.1.0.dylib.
2020 # This causes problems when building GTK+, so the script would have to
2023 if [[ $DARWIN_MAJOR_VERSION -le 9 ]]; then
2024 echo "This script does not support any versions of OS X before Snow Leopard" 1>&2
2028 # if no make options are present, set default options
2029 if [ -z "$MAKE_BUILD_OPTS" ] ; then
2030 # by default use 1.5x number of cores for parallel build
2031 MAKE_BUILD_OPTS="-j $(( $(sysctl -n hw.logicalcpu) * 3 / 2))"
2035 # If we have a target release, look for the oldest SDK that's for an
2036 # OS equal to or later than that one, and build libraries against it
2037 # rather than against the headers and, more importantly, libraries
2038 # that come with the OS, so that we don't end up with support libraries
2039 # that only work on the OS version on which we built them, not earlier
2040 # versions of the same release, or earlier releases if the minimum is
2043 if [ ! -z "$min_osx_target" ]
2046 # Get the real version - strip off the "10.".
2047 # We'll worry about that if, as, and when there's ever
2050 deploy_real_version=`echo "$min_osx_target" | sed -n 's/10\.\(.*\)/\1/p'`
2053 # Search each directory that might contain SDKs.
2056 for sdksdir in /Developer/SDKs \
2057 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
2058 /Library/Developer/CommandLineTools/SDKs
2061 # Get a list of all the SDKs.
2063 if ! test -d "$sdksdir"
2066 # There is no directory with that name.
2067 # Move on to the next one in the list, if any.
2073 # Get a list of all the SDKs in that directory, if any.
2075 sdklist=`(cd "$sdksdir"; ls -d MacOSX10.[0-9]*.sdk 2>/dev/null)`
2080 # Get the real version for this SDK.
2082 sdk_real_version=`echo "$sdk" | sed -n 's/MacOSX10\.\(.*\)\.sdk/\1/p'`
2085 # Is it for the deployment target or some later release?
2087 if test "$sdk_real_version" -ge "$deploy_real_version"
2092 sdkpath="$sdksdir/$sdk"
2093 qt_sdk_arg="-sdk $sdk"
2099 if [ -z "$sdkpath" ]
2101 echo "macosx-setup.sh: Couldn't find an SDK for OS X $min_osx_target or later" 1>&2
2106 sdk_target=10.$sdk_real_version
2107 echo "Using the 10.$sdk_real_version SDK"
2110 # Make sure there are links to /usr/local/include and /usr/local/lib
2111 # in the SDK's usr/local.
2113 if [ ! -e $SDKPATH/usr/local/include ]
2115 if [ ! -d $SDKPATH/usr/local ]
2117 sudo mkdir $SDKPATH/usr/local
2119 sudo ln -s /usr/local/include $SDKPATH/usr/local/include
2121 if [ ! -e $SDKPATH/usr/local/lib ]
2123 if [ ! -d $SDKPATH/usr/local ]
2125 sudo mkdir $SDKPATH/usr/local
2127 sudo ln -s /usr/local/lib $SDKPATH/usr/local/lib
2131 # Set the minimum OS version for which to build to the specified
2132 # minimum target OS version, so we don't, for example, end up using
2133 # linker features supported by the OS verson on which we're building
2134 # but not by the target version.
2136 VERSION_MIN_FLAGS="-mmacosx-version-min=$min_osx_target"
2139 # Compile and link against the SDK.
2141 SDKFLAGS="-isysroot $SDKPATH"
2143 if [[ "$min_osx_target" == "10.5" ]]
2146 # Cairo is part of Mac OS X 10.6 and later.
2147 # The *headers* are supplied by 10.5, but the *libraries*
2148 # aren't, so we have to build it if we're building for 10.5.
2150 cairo_not_in_the_os=yes
2153 # Build with older versions of the support libraries, as
2154 # were used on the Wireshark Leopard buildbot at one
2155 # point. (Most of these versions come from the About page
2156 # from Wireshark 1.8.6, the last build done on that buildbot;
2157 # the ATK version isn't reported, so this is a guess.)
2159 # If you want to try building with newer versions of
2160 # the libraries, note that:
2162 # The version of fontconfig that comes with Leopard doesn't
2163 # support FC_WEIGHT_EXTRABLACK, so we can't use any version
2164 # of Pango newer than 1.22.4.
2166 # However, Pango 1.22.4 doesn't work with versions of GLib
2167 # after 2.29.6, because Pango 1.22.4 uses G_CONST_RETURN and
2168 # GLib 2.29.8 and later deprecate it (there doesn't appear to
2169 # be a GLib 2.29.7). That means we'd either have to patch
2170 # Pango not to use it (just use "const"; G_CONST_RETURN was
2171 # there to allow code to choose whether to use "const" or not),
2172 # or use GLib 2.29.6 or earlier.
2174 # GLib 2.29.6 includes an implementation of g_bit_lock() that,
2175 # on x86 (32-bit and 64-bit), uses asms in a fashion
2176 # ("asm volatile goto") that requires GCC 4.5 or later, which
2177 # is later than the compilers that come with Leopard and Snow
2178 # Leopard. Recent versions of GLib check for that, but 2.29.6
2179 # doesn't, so, if you want to build GLib 2.29.6 on Leopard or
2180 # Snow Leopard, you would have to patch glib/gbitlock.c to do
2181 # what the newer versions of GLib do:
2183 # define a USE_ASM_GOTO macro that indicates whether "asm goto"
2185 # #if (defined (i386) || defined (__amd64__))
2186 # #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
2187 # #define USE_ASM_GOTO 1
2191 # replace all occurrences of
2193 # #if defined (__GNUC__) && (defined (i386) || defined (__amd64__))
2197 # #ifdef USE_ASM_GOTO
2199 # Using GLib 2.29.6 or earlier, however, means that we can't
2200 # use a version of ATK later than 2.3.93, as those versions
2201 # don't work with GLib 2.29.6. The same applies to gdk-pixbuf;
2202 # versions of gdk-pixbuf after 2.24.1 won't work with GLib
2205 # Then you have to make sure that what you've build doesn't
2206 # cause the X server that comes with Leopard to crash; at
2207 # least one attempt at building for Leopard did.
2209 # At least if building on Leopard, you might also find
2210 # that, with various older versions of Cairo, including
2211 # 1.6.4 and at least some 1.8.x versions, when you try to
2212 # build it, the build fails because it can't find
2213 # png_set_longjmp_fn(). I vaguely remember dealing with that,
2214 # ages ago, but don't remember what I did.
2219 PANGO_VERSION=1.20.2
2223 # That version of GTK+ includes gdk-pixbuf.
2224 # XXX - base this on the version of GTK+ requested.
2229 # Libgcrypt 1.5.0 fails to compile due to some problem with an
2230 # asm in rijndael.c, at least with i686-apple-darwin10-gcc-4.2.1
2231 # (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) when building
2234 # We try libgcrypt 1.4.3 instead, as that's what shows up in
2235 # the version from the Leopard buildbot.
2236 LIBGCRYPT_VERSION=1.4.3
2239 # Build 32-bit while we're at it; Leopard has a bug that
2240 # causes some BPF functions not to work with 64-bit userland
2241 # code, so capturing won't work.
2243 CFLAGS="$CFLAGS -arch i386"
2244 CXXFLAGS="$CXXFLAGS -arch i386"
2245 export LDFLAGS="$LDFLAGS -arch i386"
2253 # You need Xcode or the command-line tools installed to get the compilers.
2255 if [ ! -x /usr/bin/xcodebuild ]; then
2256 echo "Please install Xcode first (should be available on DVD or from http://developer.apple.com/xcode/index.php)."
2260 if [ "$QT_VERSION" ]; then
2262 # We need Xcode, not just the command-line tools, installed to build
2265 if ! /usr/bin/xcrun -find xcrun >/dev/null 2>&1; then
2266 echo "Please install Xcode first (should be available on DVD or from http://developer.apple.com/xcode/index.php)."
2267 echo "The command-line build tools are not sufficient to build Qt."
2271 if [ "$GTK_VERSION" ]; then
2273 # If we're building with GTK+, you also need the X11 SDK; with at least
2274 # some versions of OS X and Xcode, that is, I think, an optional install.
2275 # (Or it might be installed with X11, but I think *that* is an optional
2276 # install on at least some versions of OS X.)
2278 if [ ! -d /usr/X11/include ]; then
2279 echo "Please install X11 and the X11 SDK first."
2280 echo " You can either use http://xquartz.macosforge.org/, e.g."
2281 echo " http://xquartz-dl.macosforge.org/SL/XQuartz-$XQUARTZ_VERSION.dmg"
2282 echo " or the native Apple packages if you are on Lion or below."
2287 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig
2290 # Do all the downloads and untarring in a subdirectory, so all that
2291 # stuff can be removed once we've installed the support libraries.
2293 if [ ! -d macosx-support-libs ]
2295 mkdir macosx-support-libs || exit 1
2297 cd macosx-support-libs
2304 # Indicate what paths to use for pkg-config and cmake.
2306 pkg_config_path=/usr/local/lib/pkgconfig
2307 if [ "$QT_VERSION" ]; then
2308 qt_base_path=$HOME/Qt$QT_VERSION/$QT_MAJOR_MINOR_VERSION/clang_64
2309 pkg_config_path="$pkg_config_path":"$qt_base_path/clang_64/lib/pkgconfig"
2310 CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH":"$qt_base_path/lib/cmake"
2312 pkg_config_path="$pkg_config_path":/usr/X11/lib/pkgconfig
2314 echo "You are now prepared to build Wireshark."
2316 if [[ $CMAKE ]]; then
2317 echo "To build with CMAKE:"
2319 echo "export PKG_CONFIG_PATH=$pkg_config_path"
2320 echo "export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH"
2321 echo "export PATH=$PATH:$qt_base_path/bin"
2323 echo "mkdir build; cd build"
2325 echo "make $MAKE_BUILD_OPTS app_bundle"
2326 echo "make install/strip"
2329 if [[ $AUTOTOOLS ]]; then
2330 echo "To build with AUTOTOOLS:"
2332 echo "export PKG_CONFIG_PATH=$pkg_config_path"
2335 echo "mkdir build; cd build"
2337 echo "make $MAKE_BUILD_OPTS"
2341 echo "Make sure you are allowed capture access to the network devices"
2342 echo "See: https://wiki.wireshark.org/CaptureSetup/CapturePrivileges"