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 CFLAGS="$CFLAGS -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
1305 make $MAKE_BUILD_OPTS || exit 1
1306 $DO_MAKE_INSTALL || exit 1
1308 touch portaudio-$PORTAUDIO_VERSION-done
1312 uninstall_portaudio() {
1313 if [ ! -z "$installed_portaudio_version" ] ; then
1314 echo "Uninstalling PortAudio:"
1316 $DO_MAKE_UNINSTALL || exit 1
1317 make distclean || exit 1
1319 rm portaudio-$installed_portaudio_version-done
1321 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1323 # Get rid of the previously downloaded and unpacked version.
1326 rm -rf $installed_portaudio_version.tgz
1329 installed_portaudio_version=""
1334 if [ "$GEOIP_VERSION" -a ! -f geoip-$GEOIP_VERSION-done ] ; then
1335 echo "Downloading, building, and installing GeoIP API:"
1336 [ -f GeoIP-$GEOIP_VERSION.tar.gz ] || curl -L -O http://geolite.maxmind.com/download/geoip/api/c/GeoIP-$GEOIP_VERSION.tar.gz || exit 1
1337 gzcat GeoIP-$GEOIP_VERSION.tar.gz | tar xf - || exit 1
1338 cd GeoIP-$GEOIP_VERSION
1339 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1341 # Grr. Their man pages "helpfully" have an ISO 8859-1
1342 # copyright symbol in the copyright notice, but OS X's
1343 # default character encoding is UTF-8. sed on Mountain
1344 # Lion barfs at the "illegal character sequence" represented
1345 # by an ISO 8859-1 copyright symbol, as it's not a valid
1348 # iconv the relevant man pages into UTF-8.
1350 for i in geoipupdate.1.in geoiplookup6.1.in geoiplookup.1.in
1352 iconv -f iso8859-1 -t utf-8 man/"$i" >man/"$i".tmp &&
1353 mv man/"$i".tmp man/"$i"
1355 make $MAKE_BUILD_OPTS || exit 1
1356 $DO_MAKE_INSTALL || exit 1
1358 touch geoip-$GEOIP_VERSION-done
1363 if [ ! -z "$installed_geoip_version" ] ; then
1364 echo "Uninstalling GeoIP API:"
1365 cd GeoIP-$installed_geoip_version
1366 $DO_MAKE_UNINSTALL || exit 1
1367 make distclean || exit 1
1369 rm geoip-$installed_geoip_version-done
1371 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1373 # Get rid of the previously downloaded and unpacked version.
1375 rm -rf GeoIP-$installed_geoip_version
1376 rm -rf GeoIP-$installed_geoip_version.tar.gz
1379 installed_geoip_version=""
1384 if [ "$CARES_VERSION" -a ! -f c-ares-$CARES_VERSION-done ] ; then
1385 echo "Downloading, building, and installing C-Ares API:"
1386 [ -f c-ares-$CARES_VERSION.tar.gz ] || curl -L -O http://c-ares.haxx.se/download/c-ares-$CARES_VERSION.tar.gz || exit 1
1387 gzcat c-ares-$CARES_VERSION.tar.gz | tar xf - || exit 1
1388 cd c-ares-$CARES_VERSION
1389 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1390 make $MAKE_BUILD_OPTS || exit 1
1391 $DO_MAKE_INSTALL || exit 1
1393 touch c-ares-$CARES_VERSION-done
1397 uninstall_c_ares() {
1398 if [ ! -z "$installed_cares_version" ] ; then
1399 echo "Uninstalling C-Ares API:"
1400 cd c-ares-$installed_cares_version
1401 $DO_MAKE_UNINSTALL || exit 1
1402 make distclean || exit 1
1404 rm c-ares-$installed_cares_version-done
1406 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1408 # Get rid of the previously downloaded and unpacked version.
1410 rm -rf c-ares-$installed_cares_version
1411 rm -rf c-ares-$installed_cares_version.tar.gz
1414 installed_cares_version=""
1420 # Check whether the versions we have installed are the versions
1421 # requested; if not, uninstall the installed versions.
1423 if [ ! -z "$installed_cares_version" -a \
1424 "$installed_cares_version" != "$CARES_VERSION" ] ; then
1425 echo "Installed C-Ares version is $installed_cares_version"
1426 if [ -z "$CARES_VERSION" ] ; then
1427 echo "C-Ares is not requested"
1429 echo "Requested C-Ares version is $CARES_VERSION"
1434 if [ ! -z "$installed_geoip_version" -a \
1435 "$installed_geoip_version" != "$GEOIP_VERSION" ] ; then
1436 echo "Installed GeoIP API version is $installed_geoip_version"
1437 if [ -z "$GEOIP_VERSION" ] ; then
1438 echo "GeoIP is not requested"
1440 echo "Requested GeoIP version is $GEOIP_VERSION"
1445 if [ ! -z "$installed_portaudio_version" -a \
1446 "$installed_portaudio_version" != "$PORTAUDIO_VERSION" ] ; then
1447 echo "Installed PortAudio version is $installed_portaudio_version"
1448 if [ -z "$PORTAUDIO_VERSION" ] ; then
1449 echo "PortAudio is not requested"
1451 echo "Requested PortAudio version is $PORTAUDIO_VERSION"
1453 uninstall_portaudio -r
1456 if [ ! -z "$installed_lua_version" -a \
1457 "$installed_lua_version" != "$LUA_VERSION" ] ; then
1458 echo "Installed Lua version is $installed_lua_version"
1459 if [ -z "$LUA_VERSION" ] ; then
1460 echo "Lua is not requested"
1462 echo "Requested Lua version is $LUA_VERSION"
1467 if [ ! -z "$installed_gnutls_version" -a \
1468 "$installed_gnutls_version" != "$GNUTLS_VERSION" ] ; then
1469 echo "Installed GnuTLS version is $installed_gnutls_version"
1470 if [ -z "$GNUTLS_VERSION" ] ; then
1471 echo "GnuTLS is not requested"
1473 echo "Requested GnuTLS version is $GNUTLS_VERSION"
1478 if [ ! -z "$installed_libgcrypt_version" -a \
1479 "$installed_libgcrypt_version" != "$LIBGCRYPT_VERSION" ] ; then
1480 echo "Installed libgcrypt version is $installed_libgcrypt_version"
1481 if [ -z "$LIBGCRYPT_VERSION" ] ; then
1482 echo "libgcrypt is not requested"
1484 echo "Requested libgcrypt version is $LIBGCRYPT_VERSION"
1486 uninstall_libgcrypt -r
1489 if [ ! -z "$installed_libgpg_error_version" -a \
1490 "$installed_libgpg_error_version" != "$LIBGPG_ERROR_VERSION" ] ; then
1491 echo "Installed libgpg-error version is $installed_libgpg_error_version"
1492 if [ -z "$LIBGPG_ERROR_VERSION" ] ; then
1493 echo "libgpg-error is not requested"
1495 echo "Requested libgpg-error version is $LIBGPG_ERROR_VERSION"
1497 uninstall_libgpg_error -r
1500 if [ ! -z "$installed_libsmi_version" -a \
1501 "$installed_libsmi_version" != "$LIBSMI_VERSION" ] ; then
1502 echo "Installed libsmi version is $installed_libsmi_version"
1503 if [ -z "$LIBSMI_VERSION" ] ; then
1504 echo "libsmi is not requested"
1506 echo "Requested libsmi version is $LIBSMI_VERSION"
1511 if [ ! -z "$installed_gtk_version" -a \
1512 "$installed_gtk_version" != "$GTK_VERSION" ] ; then
1513 echo "Installed GTK+ version is $installed_gtk_version"
1514 if [ -z "$GTK_VERSION" ] ; then
1515 echo "GTK+ is not requested"
1517 echo "Requested GTK+ version is $GTK_VERSION"
1522 if [ ! -z "$installed_gdk_pixbuf_version" -a \
1523 "$installed_gdk_pixbuf_version" != "$GDK_PIXBUF_VERSION" ] ; then
1524 echo "Installed gdk-pixbuf version is $installed_gdk_pixbuf_version"
1525 if [ -z "$GDK_PIXBUF_VERSION" ] ; then
1526 echo "gdk-pixbuf is not requested"
1528 echo "Requested gdk-pixbuf version is $GDK_PIXBUF_VERSION"
1530 uninstall_gdk_pixbuf -r
1533 if [ ! -z "$installed_pango_version" -a \
1534 "$installed_pango_version" != "$PANGO_VERSION" ] ; then
1535 echo "Installed Pango version is $installed_pango_version"
1536 if [ -z "$PANGO_VERSION" ] ; then
1537 echo "Pango is not requested"
1539 echo "Requested Pango version is $PANGO_VERSION"
1544 if [ ! -z "$installed_atk_version" -a \
1545 "$installed_atk_version" != "$ATK_VERSION" ] ; then
1546 echo "Installed ATK version is $installed_atk_version"
1547 if [ -z "$ATK_VERSION" ] ; then
1548 echo "ATK is not requested"
1550 echo "Requested ATK version is $ATK_VERSION"
1555 if [ ! -z "$installed_cairo_version" -a \
1556 "$installed_cairo_version" != "$CAIRO_VERSION" ] ; then
1557 echo "Installed Cairo version is $installed_cairo_version"
1558 if [ -z "$CAIRO_VERSION" ] ; then
1559 echo "Cairo is not requested"
1561 echo "Requested Cairo version is $CAIRO_VERSION"
1566 if [ ! -z "$installed_pixman_version" -a \
1567 "$installed_pixman_version" != "$PIXMAN_VERSION" ] ; then
1568 echo "Installed pixman version is $installed_pixman_version"
1569 if [ -z "$PIXMAN_VERSION" ] ; then
1570 echo "pixman is not requested"
1572 echo "Requested pixman version is $PIXMAN_VERSION"
1577 if [ ! -z "$installed_libpng_version" -a \
1578 "$installed_libpng_version" != "$PNG_VERSION" ] ; then
1579 echo "Installed libpng version is $installed_libpng_version"
1580 if [ -z "$PNG_VERSION" ] ; then
1581 echo "libpng is not requested"
1583 echo "Requested libpng version is $PNG_VERSION"
1588 if [ ! -z "$installed_qt_version" -a \
1589 "$installed_qt_version" != "$QT_VERSION" ] ; then
1590 echo "Installed Qt version is $installed_qt_version"
1591 if [ -z "$QT_VERSION" ] ; then
1592 echo "Qt is not requested"
1594 echo "Requested Qt version is $QT_VERSION"
1599 if [ ! -z "$installed_glib_version" -a \
1600 "$installed_glib_version" != "$GLIB_VERSION" ] ; then
1601 echo "Installed GLib version is $installed_glib_version"
1602 if [ -z "$GLIB_VERSION" ] ; then
1603 echo "GLib is not requested"
1605 echo "Requested GLib version is $GLIB_VERSION"
1610 if [ ! -z "$installed_pkg_config_version" -a \
1611 "$installed_pkg_config_version" != "$PKG_CONFIG_VERSION" ] ; then
1612 echo "Installed pkg-config version is $installed_pkg_config_version"
1613 if [ -z "$PKG_CONFIG_VERSION" ] ; then
1614 echo "pkg-config is not requested"
1616 echo "Requested pkg-config version is $PKG_CONFIG_VERSION"
1618 uninstall_pkg_config -r
1621 if [ ! -z "$installed_gettext_version" -a \
1622 "$installed_gettext_version" != "$GETTEXT_VERSION" ] ; then
1623 echo "Installed GNU gettext version is $installed_gettext_version"
1624 if [ -z "$GETTEXT_VERSION" ] ; then
1625 echo "GNU gettext is not requested"
1627 echo "Requested GNU gettext version is $GETTEXT_VERSION"
1629 uninstall_gettext -r
1632 if [ ! -z "$installed_cmake_version" -a \
1633 "$installed_cmake_version" != "$CMAKE_VERSION" ] ; then
1634 echo "Installed CMake version is $installed_cmake_version"
1635 if [ -z "$CMAKE_VERSION" ] ; then
1636 echo "CMake is not requested"
1638 echo "Requested CMake version is $CMAKE_VERSION"
1641 # XXX - really remove this?
1642 # Or should we remember it as installed only if this script
1648 if [ ! -z "$installed_libtool_version" -a \
1649 "$installed_libtool_version" != "$LIBTOOL_VERSION" ] ; then
1650 echo "Installed GNU libtool version is $installed_libtool_version"
1651 if [ -z "$LIBTOOL_VERSION" ] ; then
1652 echo "GNU libtool is not requested"
1654 echo "Requested GNU libtool version is $LIBTOOL_VERSION"
1656 uninstall_libtool -r
1659 if [ ! -z "$installed_automake_version" -a \
1660 "$installed_automake_version" != "$AUTOMAKE_VERSION" ] ; then
1661 echo "Installed GNU automake version is $installed_automake_version"
1662 if [ -z "$AUTOMAKE_VERSION" ] ; then
1663 echo "GNU automake is not requested"
1665 echo "Requested GNU automake version is $AUTOMAKE_VERSION"
1667 uninstall_automake -r
1670 if [ ! -z "$installed_autoconf_version" -a \
1671 "$installed_autoconf_version" != "$AUTOCONF_VERSION" ] ; then
1672 echo "Installed GNU autoconf version is $installed_autoconf_version"
1673 if [ -z "$AUTOCONF_VERSION" ] ; then
1674 echo "GNU autoconf is not requested"
1676 echo "Requested GNU autoconf version is $AUTOCONF_VERSION"
1678 uninstall_autoconf -r
1681 if [ ! -z "$installed_xz_version" -a \
1682 "$installed_xz_version" != "$XZ_VERSION" ] ; then
1683 echo "Installed xz version is $installed_xz_version"
1684 if [ -z "$XZ_VERSION" ] ; then
1685 echo "xz is not requested"
1687 echo "Requested xz version is $XZ_VERSION"
1693 # Start with xz: It is the sole download format of glib later than 2.31.2
1706 # Start with GNU gettext; GLib requires it, and OS X doesn't have it
1707 # or a BSD-licensed replacement.
1709 # At least on Lion with Xcode 4, _FORTIFY_SOURCE gets defined as 2
1710 # by default, which causes, for example, stpncpy to be defined as
1711 # a hairy macro that collides with the GNU gettext configure script's
1712 # attempts to workaround AIX's lack of a declaration for stpncpy,
1713 # with the result being a huge train wreck. Define _FORTIFY_SOURCE
1714 # as 0 in an attempt to keep the trains on separate tracks.
1719 # GLib depends on pkg-config.
1720 # By default, pkg-config depends on GLib; we break the dependency cycle
1721 # by configuring pkg-config to use its own internal version of GLib.
1728 # Now we have reached a point where we can build everything but
1729 # the GUI (Wireshark).
1733 if [ "$GTK_VERSION" ]; then
1735 # GTK+ 3 requires a newer Cairo build than the one that comes with
1736 # 10.6, so we build Cairo if we are using GTK+ 3.
1738 # In 10.6 and 10.7, it's an X11 library; if we build with "native" GTK+
1739 # rather than X11 GTK+, we might have to build and install Cairo.
1740 # In 10.8 and later, there is no X11, but it's included in Xquartz;
1741 # again, if we build with "native" GTK+, we'd have to build and install
1744 if [[ "$GTK_MAJOR_VERSION" -eq 3 || "$cairo_not_in_the_os" = yes ]]; then
1746 # Requirements for Cairo first
1748 # The libpng that comes with the X11 for Leopard has a bogus
1749 # pkg-config file that lies about where the header files are,
1750 # which causes other packages not to be able to find its
1753 # The libpng in later versions is not what the version of
1754 # libpixman we build below wants - it wants libpng15.
1759 # The libpixman versions that come with the X11s for Leopard,
1760 # Snow Leopard, and Lion is too old to support Cairo's image
1761 # surface backend feature (which requires pixman-1 >= 0.22.0).
1763 # XXX - what about the one that comes with the latest version
1769 # And now Cairo itself.
1770 # XXX - with the libxcb that comes with 10.6,
1771 # xcb_discard_reply() is missing, and the build fails.
1786 # Now we have reached a point where we can build everything including
1787 # the GUI (Wireshark), but not with any optional features such as
1788 # SNMP OID resolution, some forms of decryption, Lua scripting, playback
1789 # of audio, or GeoIP mapping of IP addresses.
1791 # We now conditionally download optional libraries to support them;
1792 # the default is to download them all.
1797 install_libgpg_error
1813 if [ -d macosx-support-libs ]
1815 cd macosx-support-libs
1818 # Uninstall items in the reverse order from the order in which they're
1819 # installed. Only uninstall if the download/build/install process
1820 # completed; uninstall the version that appears in the name of
1823 # We also do a "make distclean", so that we don't have leftovers from
1824 # old configurations.
1838 uninstall_libgpg_error
1844 uninstall_gdk_pixbuf
1860 uninstall_pkg_config
1865 # XXX - really remove this?
1866 # Or should we remember it as installed only if this script
1882 # Do we have permission to write in /usr/local?
1884 # If so, assume we have permission to write in its subdirectories.
1885 # (If that's not the case, this test needs to check the subdirectories
1888 # If not, do "make install", "make uninstall", the removes for Lua,
1889 # and the renames of [g]libtool* with sudo.
1891 if [ -w /usr/local ]
1893 DO_MAKE_INSTALL="make install"
1894 DO_MAKE_UNINSTALL="make uninstall"
1898 DO_MAKE_INSTALL="sudo make install"
1899 DO_MAKE_UNINSTALL="sudo make uninstall"
1905 # If we have SDKs available, the default target OS is the major version
1906 # of the one we're running; get that and strip off the third component
1909 for i in /Developer/SDKs \
1910 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
1911 /Library/Developer/CommandLineTools/SDKs
1915 min_osx_target=`sw_vers -productVersion | sed 's/\([0-9]*\)\.\([0-9]*\)\.[0-9]*/\1.\2/'`
1918 # That's also the OS whose SDK we'd be using.
1920 sdk_target=$min_osx_target
1926 # Parse command-line flags:
1929 # -t <target> - build libraries so that they'll work on the specified
1930 # version of OS X and later versions.
1931 # -u - do an uninstall.
1933 while getopts ht:u name
1940 min_osx_target="$OPTARG"
1943 echo "Usage: macosx-setup.sh [ -t <target> ] [ -u ]" 1>&1
1950 # Get the version numbers of installed packages, if any.
1952 if [ -d macosx-support-libs ]
1954 cd macosx-support-libs
1956 installed_xz_version=`ls xz-*-done 2>/dev/null | sed 's/xz-\(.*\)-done/\1/'`
1957 installed_autoconf_version=`ls autoconf-*-done 2>/dev/null | sed 's/autoconf-\(.*\)-done/\1/'`
1958 installed_automake_version=`ls automake-*-done 2>/dev/null | sed 's/automake-\(.*\)-done/\1/'`
1959 installed_libtool_version=`ls libtool-*-done 2>/dev/null | sed 's/libtool-\(.*\)-done/\1/'`
1960 installed_cmake_version=`ls cmake-*-done 2>/dev/null | sed 's/cmake-\(.*\)-done/\1/'`
1961 installed_gettext_version=`ls gettext-*-done 2>/dev/null | sed 's/gettext-\(.*\)-done/\1/'`
1962 installed_pkg_config_version=`ls pkg-config-*-done 2>/dev/null | sed 's/pkg-config-\(.*\)-done/\1/'`
1963 installed_glib_version=`ls glib-*-done 2>/dev/null | sed 's/glib-\(.*\)-done/\1/'`
1964 installed_qt_version=`ls qt-*-done 2>/dev/null | sed 's/qt-\(.*\)-done/\1/'`
1965 installed_libpng_version=`ls libpng-*-done 2>/dev/null | sed 's/libpng-\(.*\)-done/\1/'`
1966 installed_pixman_version=`ls pixman-*-done 2>/dev/null | sed 's/pixman-\(.*\)-done/\1/'`
1967 installed_cairo_version=`ls cairo-*-done 2>/dev/null | sed 's/cairo-\(.*\)-done/\1/'`
1968 installed_atk_version=`ls atk-*-done 2>/dev/null | sed 's/atk-\(.*\)-done/\1/'`
1969 installed_pango_version=`ls pango-*-done 2>/dev/null | sed 's/pango-\(.*\)-done/\1/'`
1970 installed_gdk_pixbuf_version=`ls gdk-pixbuf-*-done 2>/dev/null | sed 's/gdk-pixbuf-\(.*\)-done/\1/'`
1971 installed_gtk_version=`ls gtk+-*-done 2>/dev/null | sed 's/gtk+-\(.*\)-done/\1/'`
1972 installed_libsmi_version=`ls libsmi-*-done 2>/dev/null | sed 's/libsmi-\(.*\)-done/\1/'`
1973 installed_libgpg_error_version=`ls libgpg-error-*-done 2>/dev/null | sed 's/libgpg-error-\(.*\)-done/\1/'`
1974 installed_libgcrypt_version=`ls libgcrypt-*-done 2>/dev/null | sed 's/libgcrypt-\(.*\)-done/\1/'`
1975 installed_gnutls_version=`ls gnutls-*-done 2>/dev/null | sed 's/gnutls-\(.*\)-done/\1/'`
1976 installed_lua_version=`ls lua-*-done 2>/dev/null | sed 's/lua-\(.*\)-done/\1/'`
1977 installed_portaudio_version=`ls portaudio-*-done 2>/dev/null | sed 's/portaudio-\(.*\)-done/\1/'`
1978 installed_geoip_version=`ls geoip-*-done 2>/dev/null | sed 's/geoip-\(.*\)-done/\1/'`
1979 installed_cares_version=`ls c-ares-*-done 2>/dev/null | sed 's/c-ares-\(.*\)-done/\1/'`
1982 # If we don't have a versioned -done file for portaudio, but do have
1983 # an unversioned -done file for it, assume the installed version is the
1984 # requested version, and rename the -done file to include that version.
1986 if [ -z "$installed_portaudio_version" -a -f portaudio-done ] ; then
1987 mv portaudio-done portaudio-$PORTAUDIO_VERSION-done
1988 installed_portaudio_version=`ls portaudio-*-done 2>/dev/null | sed 's/portaudio-\(.*\)-done/\1/'`
1994 if [ "$do_uninstall" = "yes" ]
2001 # Configure scripts tend to set CFLAGS and CXXFLAGS to "-g -O2" if
2002 # invoked without CFLAGS or CXXFLAGS being set in the environment.
2004 # However, we *are* setting them in the environment, for our own
2005 # nefarious purposes, so start them out as "-g -O2".
2011 # To make this work on Leopard (rather than working *on* Snow Leopard
2012 # when building *for* Leopard) will take more work.
2014 # For one thing, Leopard's /usr/X11/lib/libXdamage.la claims, at least
2015 # with all software updates applied, that the Xdamage shared library
2016 # is libXdamage.1.0.0.dylib, but it is, in fact, libXdamage.1.1.0.dylib.
2017 # This causes problems when building GTK+, so the script would have to
2020 if [[ $DARWIN_MAJOR_VERSION -le 9 ]]; then
2021 echo "This script does not support any versions of OS X before Snow Leopard" 1>&2
2025 # if no make options are present, set default options
2026 if [ -z "$MAKE_BUILD_OPTS" ] ; then
2027 # by default use 1.5x number of cores for parallel build
2028 MAKE_BUILD_OPTS="-j $(( $(sysctl -n hw.logicalcpu) * 3 / 2))"
2032 # If we have a target release, look for the oldest SDK that's for an
2033 # OS equal to or later than that one, and build libraries against it
2034 # rather than against the headers and, more importantly, libraries
2035 # that come with the OS, so that we don't end up with support libraries
2036 # that only work on the OS version on which we built them, not earlier
2037 # versions of the same release, or earlier releases if the minimum is
2040 if [ ! -z "$min_osx_target" ]
2043 # Get the real version - strip off the "10.".
2044 # We'll worry about that if, as, and when there's ever
2047 deploy_real_version=`echo "$min_osx_target" | sed -n 's/10\.\(.*\)/\1/p'`
2050 # Search each directory that might contain SDKs.
2053 for sdksdir in /Developer/SDKs \
2054 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
2055 /Library/Developer/CommandLineTools/SDKs
2058 # Get a list of all the SDKs.
2060 if ! test -d "$sdksdir"
2063 # There is no directory with that name.
2064 # Move on to the next one in the list, if any.
2070 # Get a list of all the SDKs in that directory, if any.
2072 sdklist=`(cd "$sdksdir"; ls -d MacOSX10.[0-9]*.sdk 2>/dev/null)`
2077 # Get the real version for this SDK.
2079 sdk_real_version=`echo "$sdk" | sed -n 's/MacOSX10\.\(.*\)\.sdk/\1/p'`
2082 # Is it for the deployment target or some later release?
2084 if test "$sdk_real_version" -ge "$deploy_real_version"
2089 sdkpath="$sdksdir/$sdk"
2090 qt_sdk_arg="-sdk $sdk"
2096 if [ -z "$sdkpath" ]
2098 echo "macosx-setup.sh: Couldn't find an SDK for OS X $min_osx_target or later" 1>&2
2103 sdk_target=10.$sdk_real_version
2104 echo "Using the 10.$sdk_real_version SDK"
2107 # Make sure there are links to /usr/local/include and /usr/local/lib
2108 # in the SDK's usr/local.
2110 if [ ! -e $SDKPATH/usr/local/include ]
2112 if [ ! -d $SDKPATH/usr/local ]
2114 sudo mkdir $SDKPATH/usr/local
2116 sudo ln -s /usr/local/include $SDKPATH/usr/local/include
2118 if [ ! -e $SDKPATH/usr/local/lib ]
2120 if [ ! -d $SDKPATH/usr/local ]
2122 sudo mkdir $SDKPATH/usr/local
2124 sudo ln -s /usr/local/lib $SDKPATH/usr/local/lib
2128 # Set the minimum OS version for which to build to the specified
2129 # minimum target OS version, so we don't, for example, end up using
2130 # linker features supported by the OS verson on which we're building
2131 # but not by the target version.
2133 VERSION_MIN_FLAGS="-mmacosx-version-min=$min_osx_target"
2136 # Compile and link against the SDK.
2138 SDKFLAGS="-isysroot $SDKPATH"
2140 if [[ "$min_osx_target" == "10.5" ]]
2143 # Cairo is part of Mac OS X 10.6 and later.
2144 # The *headers* are supplied by 10.5, but the *libraries*
2145 # aren't, so we have to build it if we're building for 10.5.
2147 cairo_not_in_the_os=yes
2150 # Build with older versions of the support libraries, as
2151 # were used on the Wireshark Leopard buildbot at one
2152 # point. (Most of these versions come from the About page
2153 # from Wireshark 1.8.6, the last build done on that buildbot;
2154 # the ATK version isn't reported, so this is a guess.)
2156 # If you want to try building with newer versions of
2157 # the libraries, note that:
2159 # The version of fontconfig that comes with Leopard doesn't
2160 # support FC_WEIGHT_EXTRABLACK, so we can't use any version
2161 # of Pango newer than 1.22.4.
2163 # However, Pango 1.22.4 doesn't work with versions of GLib
2164 # after 2.29.6, because Pango 1.22.4 uses G_CONST_RETURN and
2165 # GLib 2.29.8 and later deprecate it (there doesn't appear to
2166 # be a GLib 2.29.7). That means we'd either have to patch
2167 # Pango not to use it (just use "const"; G_CONST_RETURN was
2168 # there to allow code to choose whether to use "const" or not),
2169 # or use GLib 2.29.6 or earlier.
2171 # GLib 2.29.6 includes an implementation of g_bit_lock() that,
2172 # on x86 (32-bit and 64-bit), uses asms in a fashion
2173 # ("asm volatile goto") that requires GCC 4.5 or later, which
2174 # is later than the compilers that come with Leopard and Snow
2175 # Leopard. Recent versions of GLib check for that, but 2.29.6
2176 # doesn't, so, if you want to build GLib 2.29.6 on Leopard or
2177 # Snow Leopard, you would have to patch glib/gbitlock.c to do
2178 # what the newer versions of GLib do:
2180 # define a USE_ASM_GOTO macro that indicates whether "asm goto"
2182 # #if (defined (i386) || defined (__amd64__))
2183 # #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
2184 # #define USE_ASM_GOTO 1
2188 # replace all occurrences of
2190 # #if defined (__GNUC__) && (defined (i386) || defined (__amd64__))
2194 # #ifdef USE_ASM_GOTO
2196 # Using GLib 2.29.6 or earlier, however, means that we can't
2197 # use a version of ATK later than 2.3.93, as those versions
2198 # don't work with GLib 2.29.6. The same applies to gdk-pixbuf;
2199 # versions of gdk-pixbuf after 2.24.1 won't work with GLib
2202 # Then you have to make sure that what you've build doesn't
2203 # cause the X server that comes with Leopard to crash; at
2204 # least one attempt at building for Leopard did.
2206 # At least if building on Leopard, you might also find
2207 # that, with various older versions of Cairo, including
2208 # 1.6.4 and at least some 1.8.x versions, when you try to
2209 # build it, the build fails because it can't find
2210 # png_set_longjmp_fn(). I vaguely remember dealing with that,
2211 # ages ago, but don't remember what I did.
2216 PANGO_VERSION=1.20.2
2220 # That version of GTK+ includes gdk-pixbuf.
2221 # XXX - base this on the version of GTK+ requested.
2226 # Libgcrypt 1.5.0 fails to compile due to some problem with an
2227 # asm in rijndael.c, at least with i686-apple-darwin10-gcc-4.2.1
2228 # (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) when building
2231 # We try libgcrypt 1.4.3 instead, as that's what shows up in
2232 # the version from the Leopard buildbot.
2233 LIBGCRYPT_VERSION=1.4.3
2236 # Build 32-bit while we're at it; Leopard has a bug that
2237 # causes some BPF functions not to work with 64-bit userland
2238 # code, so capturing won't work.
2240 CFLAGS="$CFLAGS -arch i386"
2241 CXXFLAGS="$CXXFLAGS -arch i386"
2242 export LDFLAGS="$LDFLAGS -arch i386"
2250 # You need Xcode or the command-line tools installed to get the compilers.
2252 if [ ! -x /usr/bin/xcodebuild ]; then
2253 echo "Please install Xcode first (should be available on DVD or from http://developer.apple.com/xcode/index.php)."
2257 if [ "$QT_VERSION" ]; then
2259 # We need Xcode, not just the command-line tools, installed to build
2262 if ! /usr/bin/xcrun -find xcrun >/dev/null 2>&1; then
2263 echo "Please install Xcode first (should be available on DVD or from http://developer.apple.com/xcode/index.php)."
2264 echo "The command-line build tools are not sufficient to build Qt."
2268 if [ "$GTK_VERSION" ]; then
2270 # If we're building with GTK+, you also need the X11 SDK; with at least
2271 # some versions of OS X and Xcode, that is, I think, an optional install.
2272 # (Or it might be installed with X11, but I think *that* is an optional
2273 # install on at least some versions of OS X.)
2275 if [ ! -d /usr/X11/include ]; then
2276 echo "Please install X11 and the X11 SDK first."
2277 echo " You can either use http://xquartz.macosforge.org/, e.g."
2278 echo " http://xquartz-dl.macosforge.org/SL/XQuartz-$XQUARTZ_VERSION.dmg"
2279 echo " or the native Apple packages if you are on Lion or below."
2284 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig
2287 # Do all the downloads and untarring in a subdirectory, so all that
2288 # stuff can be removed once we've installed the support libraries.
2290 if [ ! -d macosx-support-libs ]
2292 mkdir macosx-support-libs || exit 1
2294 cd macosx-support-libs
2301 # Indicate what paths to use for pkg-config and cmake.
2303 pkg_config_path=/usr/local/lib/pkgconfig
2304 if [ "$QT_VERSION" ]; then
2305 qt_base_path=$HOME/Qt$QT_VERSION/$QT_MAJOR_MINOR_VERSION/clang_64
2306 pkg_config_path="$pkg_config_path":"$qt_base_path/clang_64/lib/pkgconfig"
2307 CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH":"$qt_base_path/lib/cmake"
2309 pkg_config_path="$pkg_config_path":/usr/X11/lib/pkgconfig
2311 echo "You are now prepared to build Wireshark."
2313 if [[ $CMAKE ]]; then
2314 echo "To build with CMAKE:"
2316 echo "export PKG_CONFIG_PATH=$pkg_config_path"
2317 echo "export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH"
2318 echo "export PATH=$PATH:$qt_base_path/bin"
2320 echo "mkdir build; cd build"
2322 echo "make $MAKE_BUILD_OPTS app_bundle"
2323 echo "make install/strip"
2326 if [[ $AUTOTOOLS ]]; then
2327 echo "To build with AUTOTOOLS:"
2329 echo "export PKG_CONFIG_PATH=$pkg_config_path"
2332 echo "mkdir build; cd build"
2334 echo "make $MAKE_BUILD_OPTS"
2338 echo "Make sure you are allowed capture access to the network devices"
2339 echo "See: https://wiki.wireshark.org/CaptureSetup/CapturePrivileges"