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 build all libraries as 32-bit libraries uncomment the following three lines.
31 # export CFLAGS="$CFLAGS -arch i386"
32 # export CXXFLAGS="$CXXFLAGS -arch i386"
33 # export LDFLAGS="$LDFLAGS -arch i386"
35 # and change "macx-clang" to "macx-clang-32" in the line below.
37 # Note: when building against the 10.6 SDK, clang fails, because there's
38 # a missing libstdc++.dylib in the SDK; this does not bother g++, however.
40 #TARGET_PLATFORM=macx-g++
41 TARGET_PLATFORM=macx-clang
44 # Versions of packages to download and install.
48 # Some packages need xz to unpack their current source.
49 # xz is not yet provided with OS X.
54 # In case we want to build with cmake.
56 CMAKE_VERSION=2.8.12.2
59 # The following libraries and tools are required even to build only TShark.
61 GETTEXT_VERSION=0.18.2
63 PKG_CONFIG_VERSION=0.28
66 # One or more of the following libraries are required to build Wireshark.
68 # If you don't want to build with Qt, comment out the QT_VERSION= line.
70 # If you want to build with GTK+ 2, comment out the GTK_VERSION=3.* line
71 # and un-comment the GTK_VERSION=2.* line.
73 # If you don't want to build with GTK+ at all, comment out both lines.
78 if [ "$GTK_VERSION" ]; then
80 # We'll be building GTK+, so we need some additional libraries.
82 GTK_MAJOR_VERSION="`expr $GTK_VERSION : '\([0-9][0-9]*\).*'`"
83 GTK_MINOR_VERSION="`expr $GTK_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
84 GTK_DOTDOT_VERSION="`expr $GTK_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
91 GDK_PIXBUF_VERSION=2.28.0
93 if [ "$QT_VERSION" ]; then
94 QT_MAJOR_VERSION="`expr $QT_VERSION : '\([0-9][0-9]*\).*'`"
95 QT_MINOR_VERSION="`expr $QT_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
96 QT_DOTDOT_VERSION="`expr $QT_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
97 QT_MAJOR_MINOR_VERSION=$QT_MAJOR_VERSION.$QT_MINOR_VERSION
100 # In case we want to build GTK *and* we don't have Apple's X11 SDK installed
101 # we may want to install XQuartz. The version will only be used in the printing
102 # of a URL, the package will not be installed.
104 XQUARTZ_VERSION=2.7.5
106 # The following libraries are optional.
107 # Comment them out if you don't want them, but note that some of
108 # the optional libraries are required by other optional libraries.
112 # libgpg-error is required for libgcrypt.
114 LIBGPG_ERROR_VERSION=1.10
116 # libgcrypt is required for GnuTLS.
118 LIBGCRYPT_VERSION=1.5.0
119 GNUTLS_VERSION=2.12.19
120 # Use 5.2.3, not 5.3, for now; lua_bitop.c hasn't been ported to 5.3
121 # yet, and we need to check for compatibility issues (we'd want Lua
122 # scripts to work with 5.1, 5.2, and 5.3, as long as they only use Lua
123 # features present in all three versions)
125 PORTAUDIO_VERSION=pa_stable_v19_20111121
127 # XXX - they appear to have an unversioned gzipped tarball for the
128 # current version; should we just download that, with some other
129 # way of specifying whether to download the GeoIP API?
135 DARWIN_MAJOR_VERSION=`uname -r | sed 's/\([0-9]*\).*/\1/'`
138 # GNU autotools; they're provided with releases up to Snow Leopard, but
139 # not in later releases.
141 if [[ $DARWIN_MAJOR_VERSION -gt 10 ]]; then
142 AUTOCONF_VERSION=2.69
143 AUTOMAKE_VERSION=1.13.3
144 LIBTOOL_VERSION=2.4.2
148 if [ "$XZ_VERSION" -a ! -f xz-$XZ_VERSION-done ] ; then
149 echo "Downloading, building, and installing xz:"
150 [ -f xz-$XZ_VERSION.tar.bz2 ] || curl -O http://tukaani.org/xz/xz-$XZ_VERSION.tar.bz2 || exit 1
151 bzcat xz-$XZ_VERSION.tar.bz2 | tar xf - || exit 1
153 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0" ./configure || exit 1
154 make $MAKE_BUILD_OPTS || exit 1
155 $DO_MAKE_INSTALL || exit 1
157 touch xz-$XZ_VERSION-done
162 if [ ! -z "$installed_xz_version" ] ; then
163 echo "Uninstalling xz:"
164 cd xz-$installed_xz_version
165 $DO_MAKE_UNINSTALL || exit 1
166 make distclean || exit 1
168 rm xz-$installed_xz_version-done
170 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
172 # Get rid of the previously downloaded and unpacked version.
174 rm -rf xz-$installed_xz_version
175 rm -rf xz-$installed_xz_version.tar.bz2
178 installed_xz_version=""
183 if [ "$AUTOCONF_VERSION" -a ! -f autoconf-$AUTOCONF_VERSION-done ] ; then
184 echo "Downloading, building and installing GNU autoconf..."
185 [ -f autoconf-$AUTOCONF_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/autoconf/autoconf-$AUTOCONF_VERSION.tar.xz || exit 1
186 xzcat autoconf-$AUTOCONF_VERSION.tar.xz | tar xf - || exit 1
187 cd autoconf-$AUTOCONF_VERSION
188 ./configure || exit 1
189 make $MAKE_BUILD_OPTS || exit 1
190 $DO_MAKE_INSTALL || exit 1
192 touch autoconf-$AUTOCONF_VERSION-done
196 uninstall_autoconf() {
197 if [ ! -z "$installed_autoconf_version" ] ; then
199 # automake and libtool depend on this, so uninstall them.
204 echo "Uninstalling GNU autoconf:"
205 cd autoconf-$installed_autoconf_version
206 $DO_MAKE_UNINSTALL || exit 1
207 make distclean || exit 1
209 rm autoconf-$installed_autoconf_version-done
211 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
213 # Get rid of the previously downloaded and unpacked version.
215 rm -rf autoconf-$installed_autoconf_version
216 rm -rf autoconf-$installed_autoconf_version.tar.xz
219 installed_autoconf_version=""
224 if [ "$AUTOMAKE_VERSION" -a ! -f automake-$AUTOMAKE_VERSION-done ] ; then
225 echo "Downloading, building and installing GNU automake..."
226 [ -f automake-$AUTOMAKE_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/automake/automake-$AUTOMAKE_VERSION.tar.xz || exit 1
227 xzcat automake-$AUTOMAKE_VERSION.tar.xz | tar xf - || exit 1
228 cd automake-$AUTOMAKE_VERSION
229 ./configure || exit 1
230 make $MAKE_BUILD_OPTS || exit 1
231 $DO_MAKE_INSTALL || exit 1
233 touch automake-$AUTOMAKE_VERSION-done
237 uninstall_automake() {
238 if [ ! -z "$installed_automake_version" ] ; then
240 # libtool depends on this(?), so uninstall it.
242 uninstall_libtool "$@"
244 echo "Uninstalling GNU automake:"
245 cd automake-$installed_automake_version
246 $DO_MAKE_UNINSTALL || exit 1
247 make distclean || exit 1
249 rm automake-$installed_automake_version-done
251 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
253 # Get rid of the previously downloaded and unpacked version.
255 rm -rf automake-$installed_automake_version
256 rm -rf automake-$installed_automake_version.tar.xz
259 installed_automake_version=""
264 if [ "$LIBTOOL_VERSION" -a ! -f libtool-$LIBTOOL_VERSION-done ] ; then
265 echo "Downloading, building and installing GNU libtool..."
266 [ -f libtool-$LIBTOOL_VERSION.tar.xz ] || curl -O ftp://ftp.gnu.org/gnu/libtool/libtool-$LIBTOOL_VERSION.tar.xz || exit 1
267 xzcat libtool-$LIBTOOL_VERSION.tar.xz | tar xf - || exit 1
268 cd libtool-$LIBTOOL_VERSION
269 ./configure || exit 1
270 make $MAKE_BUILD_OPTS || exit 1
271 $DO_MAKE_INSTALL || exit 1
272 $DO_MV /usr/local/bin/libtool /usr/local/bin/glibtool
273 $DO_MV /usr/local/bin/libtoolize /usr/local/bin/glibtoolize
275 touch libtool-$LIBTOOL_VERSION-done
279 uninstall_libtool() {
280 if [ ! -z "$installed_libtool_version" ] ; then
281 echo "Uninstalling GNU libtool:"
282 cd libtool-$installed_libtool_version
283 $DO_MV /usr/local/bin/glibtool /usr/local/bin/libtool
284 $DO_MV /usr/local/bin/glibtoolize /usr/local/bin/libtoolize
285 $DO_MAKE_UNINSTALL || exit 1
286 make distclean || exit 1
288 rm libtool-$installed_libtool_version-done
290 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
292 # Get rid of the previously downloaded and unpacked version.
294 rm -rf libtool-$installed_libtool_version
295 rm -rf libtool-$installed_libtool_version.tar.xz
298 installed_libtool_version=""
303 if [ -n "$CMAKE" -a ! -f cmake-$CMAKE_VERSION-done ]; then
304 echo "Downloading and installing CMake:"
305 cmake_dir=`expr $CMAKE_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
307 # NOTE: the "64" in "Darwin64" doesn't mean "64-bit-only"; the
308 # package in question supports both 32-bit and 64-bit x86.
310 [ -f cmake-$CMAKE_VERSION-Darwin64-universal.dmg ] || curl -O http://www.cmake.org/files/v$cmake_dir/cmake-$CMAKE_VERSION-Darwin64-universal.dmg || exit 1
311 sudo hdiutil attach cmake-$CMAKE_VERSION-Darwin64-universal.dmg || exit 1
312 sudo installer -target / -pkg /Volumes/cmake-$CMAKE_VERSION-Darwin64-universal/cmake-$CMAKE_VERSION-Darwin64-universal.pkg || exit 1
313 sudo hdiutil detach /Volumes/cmake-$CMAKE_VERSION-Darwin64-universal
314 touch cmake-$CMAKE_VERSION-done
319 if [ ! -z "$installed_cmake_version" ]; then
320 echo "Uninstalling CMake:"
321 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
322 sudo rm /usr/bin/ccmake
323 sudo rm /usr/bin/cmake
324 sudo rm /usr/bin/cmake-gui
325 sudo rm /usr/bin/cmakexbuild
326 sudo rm /usr/bin/cpack
327 sudo rm /usr/bin/ctest
328 sudo pkgutil --forget com.Kitware.CMake
329 rm cmake-$installed_cmake_version-done
331 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
333 # Get rid of the previously downloaded and unpacked version.
335 rm -f cmake-$installed_cmake_version-Darwin64-universal.dmg
338 installed_cmake_version=""
343 if [ ! -f gettext-$GETTEXT_VERSION-done ] ; then
344 echo "Downloading, building, and installing GNU gettext:"
345 [ -f gettext-$GETTEXT_VERSION.tar.gz ] || curl -O http://ftp.gnu.org/pub/gnu/gettext/gettext-$GETTEXT_VERSION.tar.gz || exit 1
346 gzcat gettext-$GETTEXT_VERSION.tar.gz | tar xf - || exit 1
347 cd gettext-$GETTEXT_VERSION
348 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0 $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
349 make $MAKE_BUILD_OPTS || exit 1
350 $DO_MAKE_INSTALL || exit 1
352 touch gettext-$GETTEXT_VERSION-done
356 uninstall_gettext() {
357 if [ ! -z "$installed_gettext_version" ] ; then
359 # GLib depends on this, so uninstall it.
363 echo "Uninstalling GNU gettext:"
364 cd gettext-$installed_gettext_version
365 $DO_MAKE_UNINSTALL || exit 1
366 make distclean || exit 1
368 rm gettext-$installed_gettext_version-done
370 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
372 # Get rid of the previously downloaded and unpacked version.
374 rm -rf gettext-$installed_gettext_version
375 rm -rf gettext-$installed_gettext_version.tar.gz
378 installed_gettext_version=""
382 install_pkg_config() {
383 if [ ! -f pkg-config-$PKG_CONFIG_VERSION-done ] ; then
384 echo "Downloading, building, and installing pkg-config:"
385 [ -f pkg-config-$PKG_CONFIG_VERSION.tar.gz ] || curl -O http://pkgconfig.freedesktop.org/releases/pkg-config-$PKG_CONFIG_VERSION.tar.gz || exit 1
386 gzcat pkg-config-$PKG_CONFIG_VERSION.tar.gz | tar xf - || exit 1
387 cd pkg-config-$PKG_CONFIG_VERSION
388 ./configure --with-internal-glib || exit 1
389 make $MAKE_BUILD_OPTS || exit 1
390 $DO_MAKE_INSTALL || exit 1
392 touch pkg-config-$PKG_CONFIG_VERSION-done
396 uninstall_pkg_config() {
397 if [ ! -z "$installed_pkg_config_version" ] ; then
398 echo "Uninstalling pkg-config:"
399 cd pkg-config-$installed_pkg_config_version
400 $DO_MAKE_UNINSTALL || exit 1
401 make distclean || exit 1
403 rm pkg-config-$installed_pkg_config_version-done
405 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
407 # Get rid of the previously downloaded and unpacked version.
409 rm -rf pkg-config-$installed_pkg_config_version
410 rm -rf pkg-config-$installed_pkg_config_version.tar.gz
413 installed_pkg_config_version=""
418 if [ ! -f glib-$GLIB_VERSION-done ] ; then
419 echo "Downloading, building, and installing GLib:"
420 glib_dir=`expr $GLIB_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
421 GLIB_MAJOR_VERSION="`expr $GLIB_VERSION : '\([0-9][0-9]*\).*'`"
422 GLIB_MINOR_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
423 GLIB_DOTDOT_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
424 if [[ $GLIB_MAJOR_VERSION -gt 2 ||
425 $GLIB_MINOR_VERSION -gt 28 ||
426 ($GLIB_MINOR_VERSION -eq 28 && $GLIB_DOTDOT_VERSION -ge 8) ]]
429 # Starting with GLib 2.28.8, xz-compressed tarballs are available.
431 [ -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
432 xzcat glib-$GLIB_VERSION.tar.xz | tar xf - || exit 1
434 [ -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
435 bzcat glib-$GLIB_VERSION.tar.bz2 | tar xf - || exit 1
437 cd glib-$GLIB_VERSION
439 # OS X ships with libffi, but doesn't provide its pkg-config file;
440 # explicitly specify LIBFFI_CFLAGS and LIBFFI_LIBS, so the configure
441 # script doesn't try to use pkg-config to get the appropriate
442 # C flags and loader flags.
444 # And, what's worse, at least with the version of Xcode that comes
445 # with Leopard, /usr/include/ffi/fficonfig.h doesn't define MACOSX,
446 # which causes the build of GLib to fail. If we don't find
447 # "#define.*MACOSX" in /usr/include/ffi/fficonfig.h, explicitly
450 # While we're at it, suppress -Wformat-nonliteral to avoid a case
451 # where clang's stricter rules on when not to complain about
452 # non-literal format arguments cause it to complain about code
453 # that's safe but it wasn't told that. See my comment #25 in
456 # https://bugzilla.gnome.org/show_bug.cgi?id=691608#c25
458 # First, determine where the system include files are. (It's not
459 # necessarily /usr/include.) There's a bit of a greasy hack here;
460 # pre-5.x versions of the developer tools don't support the
461 # --show-sdk-path option, and will produce no output, so includedir
462 # will be set to /usr/include (in those older versions of the
463 # developer tools, there is a /usr/include directory).
465 includedir=`xcrun --show-sdk-path 2>/dev/null`/usr/include
466 if grep -qs '#define.*MACOSX' $includedir/ffi/fficonfig.h
468 # It's defined, nothing to do
469 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
471 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
475 # Apply the fix to GNOME bug 529806:
477 # https://bugzilla.gnome.org/show_bug.cgi?id=529806
479 # if we have a version of GLib prior to 2.30.
481 if [[ $GLIB_MAJOR_VERSION -eq 2 && $GLIB_MINOR_VERSION -le 30 ]]
483 patch -p0 <../../macosx-support-lib-patches/glib-gconvert.c.patch || exit 1
485 make $MAKE_BUILD_OPTS || exit 1
486 $DO_MAKE_INSTALL || exit 1
488 touch glib-$GLIB_VERSION-done
493 if [ ! -z "$installed_glib_version" ] ; then
495 # ATK, Pango, and GTK depend on this, so uninstall them.
501 echo "Uninstalling GLib:"
502 cd glib-$installed_glib_version
503 $DO_MAKE_UNINSTALL || exit 1
504 make distclean || exit 1
506 rm glib-$installed_glib_version-done
508 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
510 # Get rid of the previously downloaded and unpacked version.
512 rm -rf glib-$installed_glib_version
513 rm -rf glib-$installed_glib_version.tar.xz glib-$installed_glib_version.tar.bz2
516 installed_glib_version=""
521 if [ "$QT_VERSION" -a ! -f qt-$QT_VERSION-done ]; then
522 echo "Downloading, building, and installing Qt:"
524 # What you get for this URL might just be a 302 Found reply, so use
525 # -L so we get redirected.
527 [ -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
528 sudo hdiutil attach qt-opensource-mac-x64-clang-$QT_VERSION.dmg || exit 1
531 # Run the executable directly, so that we wait for it to finish.
533 /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
534 sudo hdiutil detach /Volumes/qt-opensource-mac-x64-clang-$QT_VERSION
537 # The 5.3.x versions, at least, have bogus .pc files.
540 for i in $HOME/Qt$QT_VERSION/$QT_MAJOR_MINOR_VERSION/clang_64/lib/pkgconfig/*.pc
544 g/Cflags: /s;;Cflags: -F\${libdir} ;
545 g/Cflags: /s;-I\${includedir}/Qt\([a-zA-Z0-9_]*\);-I\${libdir}/Qt\1.framework/Versions/5/Headers;
550 touch qt-$QT_VERSION-done
555 if [ ! -z "$installed_qt_version" ] ; then
556 echo "Uninstalling Qt:"
557 rm -rf $HOME/Qt$installed_qt_version
558 rm qt-$installed_qt_version-done
560 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
562 # Get rid of the previously downloaded version.
564 rm -rf qt-opensource-mac-x64-clang-$installed_qt_version.dmg
567 installed_qt_version=""
572 if [ ! -f libpng-$PNG_VERSION-done ] ; then
573 echo "Downloading, building, and installing libpng:"
575 # The FTP site puts libpng x.y.* into a libpngxy directory.
577 subdir=`echo $PNG_VERSION | sed 's/\([1-9][0-9]*\)\.\([1-9][0-9]*\).*/libpng\1\2'/`
578 [ -f libpng-$PNG_VERSION.tar.xz ] || curl -O ftp://ftp.simplesystems.org/pub/libpng/png/src/$subdir/libpng-$PNG_VERSION.tar.xz
579 xzcat libpng-$PNG_VERSION.tar.xz | tar xf - || exit 1
580 cd libpng-$PNG_VERSION
581 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
582 make $MAKE_BUILD_OPTS || exit 1
583 $DO_MAKE_INSTALL || exit 1
585 touch libpng-$PNG_VERSION-done
590 if [ ! -z "$installed_libpng_version" ] ; then
592 # Cairo depends on this, so uninstall it.
596 echo "Uninstalling libpng:"
597 cd libpng-$installed_libpng_version
598 $DO_MAKE_UNINSTALL || exit 1
599 make distclean || exit 1
601 rm libpng-$installed_libpng_version-done
603 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
605 # Get rid of the previously downloaded and unpacked version.
607 rm -rf libpng-$installed_libpng_version
608 rm -rf libpng-$installed_libpng_version.tar.xz
611 installed_libpng_version=""
616 if [ ! -f pixman-$PIXMAN_VERSION-done ] ; then
617 echo "Downloading, building, and installing pixman:"
618 [ -f pixman-$PIXMAN_VERSION.tar.gz ] || curl -O http://www.cairographics.org/releases/pixman-$PIXMAN_VERSION.tar.gz
619 gzcat pixman-$PIXMAN_VERSION.tar.gz | tar xf - || exit 1
620 cd pixman-$PIXMAN_VERSION
621 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
622 make $MAKE_BUILD_OPTS || exit 1
623 $DO_MAKE_INSTALL || exit 1
625 touch pixman-$PIXMAN_VERSION-done
630 if [ ! -z "$installed_pixman_version" ] ; then
632 # Cairo depends on this, so uninstall it.
636 echo "Uninstalling pixman:"
637 cd pixman-$installed_pixman_version
638 $DO_MAKE_UNINSTALL || exit 1
639 make distclean || exit 1
641 rm pixman-$installed_pixman_version-done
643 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
645 # Get rid of the previously downloaded and unpacked version.
647 rm -rf pixman-$installed_pixman_version
648 rm -rf pixman-$installed_pixman_version.tar.gz
651 installed_pixman_version=""
656 if [ ! -f cairo-$CAIRO_VERSION-done ] ; then
657 echo "Downloading, building, and installing Cairo:"
658 CAIRO_MAJOR_VERSION="`expr $CAIRO_VERSION : '\([0-9][0-9]*\).*'`"
659 CAIRO_MINOR_VERSION="`expr $CAIRO_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
660 CAIRO_DOTDOT_VERSION="`expr $CAIRO_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
661 if [[ $CAIRO_MAJOR_VERSION -gt 1 ||
662 $CAIRO_MINOR_VERSION -gt 12 ||
663 ($CAIRO_MINOR_VERSION -eq 12 && $CAIRO_DOTDOT_VERSION -ge 2) ]]
666 # Starting with Cairo 1.12.2, the tarballs are compressed with
667 # xz rather than gzip.
669 [ -f cairo-$CAIRO_VERSION.tar.xz ] || curl -O http://cairographics.org/releases/cairo-$CAIRO_VERSION.tar.xz || exit 1
670 xzcat cairo-$CAIRO_VERSION.tar.xz | tar xf - || exit 1
672 [ -f cairo-$CAIRO_VERSION.tar.gz ] || curl -O http://cairographics.org/releases/cairo-$CAIRO_VERSION.tar.gz || exit 1
673 gzcat cairo-$CAIRO_VERSION.tar.gz | tar xf - || exit 1
675 cd cairo-$CAIRO_VERSION
676 # CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-quartz=no || exit 1
677 # Maybe follow http://cairographics.org/end_to_end_build_for_mac_os_x/
678 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-quartz=yes || exit 1
680 # We must avoid the version of libpng that comes with X11; the
681 # only way I've found to force that is to forcibly set INCLUDES
682 # when we do the build, so that this comes before CAIRO_CFLAGS,
683 # which has -I/usr/X11/include added to it before anything
684 # connected to libpng is.
686 INCLUDES="-I/usr/local/include/libpng15" make $MAKE_BUILD_OPTS || exit 1
687 $DO_MAKE_INSTALL || exit 1
689 touch cairo-$CAIRO_VERSION-done
694 if [ ! -z "$installed_cairo_version" ] ; then
696 # GTK+ depends on this, so uninstall it.
700 echo "Uninstalling Cairo:"
701 cd cairo-$installed_cairo_version
702 $DO_MAKE_UNINSTALL || exit 1
703 make distclean || exit 1
705 rm cairo-$installed_cairo_version-done
707 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
709 # Get rid of the previously downloaded and unpacked version.
711 rm -rf cairo-$installed_cairo_version
712 rm -rf cairo-$installed_cairo_version.tar.xz cairo-$installed_cairo_version.tar.gz
715 installed_cairo_version=""
720 if [ ! -f atk-$ATK_VERSION-done ] ; then
721 echo "Downloading, building, and installing ATK:"
722 atk_dir=`expr $ATK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
723 ATK_MAJOR_VERSION="`expr $ATK_VERSION : '\([0-9][0-9]*\).*'`"
724 ATK_MINOR_VERSION="`expr $ATK_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
725 ATK_DOTDOT_VERSION="`expr $ATK_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
726 if [[ $ATK_MAJOR_VERSION -gt 2 ||
727 ($ATK_MAJOR_VERSION -eq 2 && $ATK_MINOR_VERSION -gt 0) ||
728 ($ATK_MANOR_VERSION -eq 2 && $ATK_MINOR_VERSION -eq 0 && $ATK_DOTDOT_VERSION -ge 1) ]]
731 # Starting with ATK 2.0.1, xz-compressed tarballs are available.
733 [ -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
734 xzcat atk-$ATK_VERSION.tar.xz | tar xf - || exit 1
736 [ -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
737 bzcat atk-$ATK_VERSION.tar.bz2 | tar xf - || exit 1
740 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
741 make $MAKE_BUILD_OPTS || exit 1
742 $DO_MAKE_INSTALL || exit 1
744 touch atk-$ATK_VERSION-done
749 if [ ! -z "$installed_atk_version" ] ; then
751 # GTK+ depends on this, so uninstall it.
755 echo "Uninstalling ATK:"
756 cd atk-$installed_atk_version
757 $DO_MAKE_UNINSTALL || exit 1
758 make distclean || exit 1
760 rm atk-$installed_atk_version-done
762 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
764 # Get rid of the previously downloaded and unpacked version.
766 rm -rf atk-$installed_atk_version
767 rm -rf atk-$installed_atk_version.tar.xz atk-$installed_atk_version.tar.bz2
770 installed_atk_version=""
775 if [ ! -f pango-$PANGO_VERSION-done ] ; then
776 echo "Downloading, building, and installing Pango:"
777 pango_dir=`expr $PANGO_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
778 PANGO_MAJOR_VERSION="`expr $PANGO_VERSION : '\([0-9][0-9]*\).*'`"
779 PANGO_MINOR_VERSION="`expr $PANGO_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
780 if [[ $PANGO_MAJOR_VERSION -gt 1 ||
781 $PANGO_MINOR_VERSION -ge 29 ]]
784 # Starting with Pango 1.29, the tarballs are compressed with
785 # xz rather than bzip2.
787 [ -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
788 xzcat pango-$PANGO_VERSION.tar.xz | tar xf - || exit 1
790 [ -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
791 bzcat pango-$PANGO_VERSION.tar.bz2 | tar xf - || exit 1
793 cd pango-$PANGO_VERSION
794 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
795 make $MAKE_BUILD_OPTS || exit 1
796 $DO_MAKE_INSTALL || exit 1
798 touch pango-$PANGO_VERSION-done
803 if [ ! -z "$installed_pango_version" ] ; then
805 # GTK+ depends on this, so uninstall it.
809 echo "Uninstalling Pango:"
810 cd pango-$installed_pango_version
811 $DO_MAKE_UNINSTALL || exit 1
812 make distclean || exit 1
814 rm pango-$installed_pango_version-done
816 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
818 # Get rid of the previously downloaded and unpacked version.
820 rm -rf pango-$installed_pango_version
821 rm -rf pango-$installed_pango_version.tar.xz pango-$installed_pango_version.tar.bz2
824 installed_pango_version=""
828 install_gdk_pixbuf() {
829 if [ "$GDK_PIXBUF_VERSION" -a ! -f gdk-pixbuf-$GDK_PIXBUF_VERSION-done ] ; then
830 echo "Downloading, building, and installing gdk-pixbuf:"
831 gdk_pixbuf_dir=`expr $GDK_PIXBUF_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
832 [ -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
833 xzcat gdk-pixbuf-$GDK_PIXBUF_VERSION.tar.xz | tar xf - || exit 1
834 cd gdk-pixbuf-$GDK_PIXBUF_VERSION
836 # If we're building using the 10.6 SDK, force the use of libpng12.
838 # The OS's X11, and corresponding SDK, didn't introduce libpng15,
839 # or pkg-config files, until 10.7, so, for 10.6 have to explicitly
840 # set LIBPNG to override the configure script, and also force the
841 # CFLAGS to look for the header files for libpng12 (note that
842 # -isysroot doesn't affect the arguments to -I, so we need to
843 # include the SDK path explicitly).
845 if [[ "$sdk_target" = 10.6 ]]
847 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
849 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
851 make $MAKE_BUILD_OPTS || exit 1
852 $DO_MAKE_INSTALL || exit 1
854 touch gdk-pixbuf-$GDK_PIXBUF_VERSION-done
858 uninstall_gdk_pixbuf() {
859 if [ ! -z "$installed_gdk_pixbuf_version" ] ; then
861 # GTK+ depends on this, so uninstall it.
865 echo "Uninstalling gdk-pixbuf:"
866 cd gdk-pixbuf-$installed_gdk_pixbuf_version
867 $DO_MAKE_UNINSTALL || exit 1
868 make distclean || exit 1
870 rm gdk-pixbuf-$installed_gdk_pixbuf_version-done
872 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
874 # Get rid of the previously downloaded and unpacked version.
876 rm -rf gdk-pixbuf-$installed_gdk_pixbuf_version
877 rm -rf gdk-pixbuf-$installed_gdk_pixbuf_version.tar.xz
880 installed_gdk_pixbuf_version=""
885 if [ ! -f gtk+-$GTK_VERSION-done ] ; then
886 echo "Downloading, building, and installing GTK+:"
887 gtk_dir=`expr $GTK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
888 if [[ $GTK_MAJOR_VERSION -gt 2 ||
889 $GTK_MINOR_VERSION -gt 24 ||
890 ($GTK_MINOR_VERSION -eq 24 && $GTK_DOTDOT_VERSION -ge 5) ]]
893 # Starting with GTK+ 2.24.5, the tarballs are compressed with
894 # xz rather than gzip, in addition to bzip2; use xz, as we've
895 # built and installed it, and as xz compresses better than
896 # bzip2 so the tarballs take less time to download.
898 [ -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
899 xzcat gtk+-$GTK_VERSION.tar.xz | tar xf - || exit 1
901 [ -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
902 bzcat gtk+-$GTK_VERSION.tar.bz2 | tar xf - || exit 1
905 if [ $DARWIN_MAJOR_VERSION -ge "12" ]
908 # GTK+ 2.24.10, at least, doesn't build on Mountain Lion with the
909 # CUPS printing backend - either the CUPS API changed incompatibly
910 # or the backend was depending on non-API implementation details.
912 # Configure it out, on Mountain Lion and later, for now.
913 # (12 is the Darwin major version number in Mountain Lion.)
915 # Also, configure out libtiff and libjpeg; configure scripts
916 # just ignore unknown --enable/--disable and --with/--without
917 # options (at least they've always do so up to now).
919 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
921 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
923 make $MAKE_BUILD_OPTS || exit 1
924 $DO_MAKE_INSTALL || exit 1
926 touch gtk+-$GTK_VERSION-done
931 if [ ! -z "$installed_gtk_version" ] ; then
932 echo "Uninstalling GTK+:"
933 cd gtk+-$installed_gtk_version
934 $DO_MAKE_UNINSTALL || exit 1
935 make distclean || exit 1
937 rm gtk+-$installed_gtk_version-done
939 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
941 # Get rid of the previously downloaded and unpacked version.
943 rm -rf gtk+-$installed_gtk_version
944 rm -rf gtk+-$installed_gtk_version.tar.xz gtk+-$installed_gtk_version.tar.bz2
947 installed_gtk_version=""
952 if [ "$LIBSMI_VERSION" -a ! -f libsmi-$LIBSMI_VERSION-done ] ; then
953 echo "Downloading, building, and installing libsmi:"
954 [ -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
955 gzcat libsmi-$LIBSMI_VERSION.tar.gz | tar xf - || exit 1
956 cd libsmi-$LIBSMI_VERSION
957 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
958 make $MAKE_BUILD_OPTS || exit 1
959 $DO_MAKE_INSTALL || exit 1
961 touch libsmi-$LIBSMI_VERSION-done
966 if [ ! -z "$installed_libsmi_version" ] ; then
967 echo "Uninstalling libsmi:"
968 cd libsmi-$installed_libsmi_version
969 $DO_MAKE_UNINSTALL || exit 1
970 make distclean || exit 1
972 rm libsmi-$installed_libsmi_version-done
974 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
976 # Get rid of the previously downloaded and unpacked version.
978 rm -rf libsmi-$installed_libsmi_version
979 rm -rf libsmi-$installed_libsmi_version.tar.gz
982 installed_libsmi_version=""
986 install_libgpg_error() {
987 if [ "$LIBGPG_ERROR_VERSION" -a ! -f libgpg-error-$LIBGPG_ERROR_VERSION-done ] ; then
988 echo "Downloading, building, and installing libgpg-error:"
989 [ -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
990 bzcat libgpg-error-$LIBGPG_ERROR_VERSION.tar.bz2 | tar xf - || exit 1
991 cd libgpg-error-$LIBGPG_ERROR_VERSION
992 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
993 make $MAKE_BUILD_OPTS || exit 1
994 $DO_MAKE_INSTALL || exit 1
996 touch libgpg-error-$LIBGPG_ERROR_VERSION-done
1000 uninstall_libgpg_error() {
1001 if [ ! -z "$installed_libgpg_error_version" ] ; then
1003 # libgcrypt depends on this, so uninstall it.
1005 uninstall_libgcrypt "$@"
1007 echo "Uninstalling libgpg-error:"
1008 cd libgpg-error-$installed_libgpg_error_version
1009 $DO_MAKE_UNINSTALL || exit 1
1010 make distclean || exit 1
1012 rm libgpg-error-$installed_libgpg_error_version-done
1014 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1016 # Get rid of the previously downloaded and unpacked version.
1018 rm -rf libgpg-error-$installed_libgpg_error_version
1019 rm -rf libgpg-error-$installed_libgpg_error_version.tar.bz2
1022 installed_libgpg_error_version=""
1026 install_libgcrypt() {
1027 if [ "$LIBGCRYPT_VERSION" -a ! -f libgcrypt-$LIBGCRYPT_VERSION-done ] ; then
1029 # libgpg-error is required for libgcrypt.
1031 if [ -z $LIBGPG_ERROR_VERSION ]
1033 echo "libgcrypt requires libgpg-error, but you didn't install libgpg-error." 1>&2
1037 echo "Downloading, building, and installing libgcrypt:"
1038 [ -f libgcrypt-$LIBGCRYPT_VERSION.tar.gz ] || curl -L -O ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-$LIBGCRYPT_VERSION.tar.gz || exit 1
1039 gzcat libgcrypt-$LIBGCRYPT_VERSION.tar.gz | tar xf - || exit 1
1040 cd libgcrypt-$LIBGCRYPT_VERSION
1042 # The assembler language code is not compatible with the OS X
1043 # x86 assembler (or is it an x86-64 vs. x86-32 issue?).
1045 # libgcrypt expects gnu89, not c99/gnu99, semantics for
1046 # "inline". See, for example:
1048 # http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2010-October/198809.html
1050 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
1051 make $MAKE_BUILD_OPTS || exit 1
1052 $DO_MAKE_INSTALL || exit 1
1054 touch libgcrypt-$LIBGCRYPT_VERSION-done
1058 uninstall_libgcrypt() {
1059 if [ ! -z "$installed_libgcrypt_version" ] ; then
1061 # GnuTLS depends on this, so uninstall it.
1063 uninstall_gnutls "$@"
1065 echo "Uninstalling libgcrypt:"
1066 cd libgcrypt-$installed_libgcrypt_version
1067 $DO_MAKE_UNINSTALL || exit 1
1068 make distclean || exit 1
1070 rm libgcrypt-$installed_libgcrypt_version-done
1072 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1074 # Get rid of the previously downloaded and unpacked version.
1076 rm -rf libgcrypt-$installed_libgcrypt_version
1077 rm -rf libgcrypt-$installed_libgcrypt_version.tar.gz
1080 installed_libgcrypt_version=""
1085 if [ "$GNUTLS_VERSION" -a ! -f gnutls-$GNUTLS_VERSION-done ] ; then
1087 # GnuTLS requires libgcrypt (or nettle, in newer versions).
1089 if [ -z $LIBGCRYPT_VERSION ]
1091 echo "GnuTLS requires libgcrypt, but you didn't install libgcrypt" 1>&2
1095 echo "Downloading, building, and installing GnuTLS:"
1096 [ -f gnutls-$GNUTLS_VERSION.tar.bz2 ] || curl -L -O http://ftp.gnu.org/gnu/gnutls/gnutls-$GNUTLS_VERSION.tar.bz2 || exit 1
1097 bzcat gnutls-$GNUTLS_VERSION.tar.bz2 | tar xf - || exit 1
1098 cd gnutls-$GNUTLS_VERSION
1100 # Use libgcrypt, not nettle.
1101 # XXX - is there some reason to prefer nettle? Or does
1102 # Wireshark directly use libgcrypt routines?
1104 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
1105 make $MAKE_BUILD_OPTS || exit 1
1107 # The pkgconfig file for GnuTLS says "requires zlib", but OS X,
1108 # while it supplies zlib, doesn't supply a pkgconfig file for
1111 # Patch the GnuTLS pkgconfig file not to require zlib.
1112 # (If the capabilities of GnuTLS that Wireshark uses don't
1113 # depend on building GnuTLS with zlib, an alternative would be
1114 # to configure it not to use zlib.)
1116 patch -p0 lib/gnutls.pc.in <../../macosx-support-lib-patches/gnutls-pkgconfig.patch || exit 1
1117 $DO_MAKE_INSTALL || exit 1
1119 touch gnutls-$GNUTLS_VERSION-done
1123 uninstall_gnutls() {
1124 if [ ! -z "$installed_gnutls_version" ] ; then
1125 echo "Uninstalling GnuTLS:"
1126 cd gnutls-$installed_gnutls_version
1127 $DO_MAKE_UNINSTALL || exit 1
1128 make distclean || exit 1
1130 rm gnutls-$installed_gnutls_version-done
1132 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1134 # Get rid of the previously downloaded and unpacked version.
1136 rm -rf gnutls-$installed_gnutls_version
1137 rm -rf gnutls-$installed_gnutls_version.tar.bz2
1140 installed_gnutls_version=""
1145 if [ "$LUA_VERSION" -a ! -f lua-$LUA_VERSION-done ] ; then
1146 echo "Downloading, building, and installing Lua:"
1147 [ -f lua-$LUA_VERSION.tar.gz ] || curl -L -O http://www.lua.org/ftp/lua-$LUA_VERSION.tar.gz || exit 1
1148 gzcat lua-$LUA_VERSION.tar.gz | tar xf - || exit 1
1150 make $MAKE_BUILD_OPTS macosx || exit 1
1151 $DO_MAKE_INSTALL || exit 1
1153 touch lua-$LUA_VERSION-done
1158 if [ ! -z "$installed_lua_version" ] ; then
1159 echo "Uninstalling Lua:"
1161 # Lua has no "make uninstall", so just remove stuff manually.
1162 # There's no configure script, so there's no need for
1163 # "make distclean", either; just do "make clean".
1165 (cd /usr/local/bin; $DO_RM -f lua luac)
1166 (cd /usr/local/include; $DO_RM -f lua.h luaconf.h lualib.h lauxlib.h lua.hpp)
1167 (cd /usr/local/lib; $DO_RM -f liblua.a)
1168 (cd /usr/local/man/man1; $DO_RM -f lua.1 luac.1)
1169 cd lua-$installed_lua_version
1170 make clean || exit 1
1172 rm lua-$installed_lua_version-done
1174 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1176 # Get rid of the previously downloaded and unpacked version.
1178 rm -rf lua-$installed_lua_version
1179 rm -rf lua-$installed_lua_version.tar.gz
1182 installed_lua_version=""
1186 install_portaudio() {
1188 # Check for both the old versionless portaudio-done and the new
1189 # versioned -done file.
1191 if [ "$PORTAUDIO_VERSION" -a ! -f portaudio-$PORTAUDIO_VERSION-done ] ; then
1192 echo "Downloading, building, and installing PortAudio:"
1193 [ -f $PORTAUDIO_VERSION.tgz ] || curl -L -O http://www.portaudio.com/archives/$PORTAUDIO_VERSION.tgz || exit 1
1194 gzcat $PORTAUDIO_VERSION.tgz | tar xf - || exit 1
1197 # Un-comment an include that's required on Lion.
1199 patch -p0 include/pa_mac_core.h <../../macosx-support-lib-patches/portaudio-pa_mac_core.h.patch
1201 # Fix a bug that showed up with clang (but is a bug with any
1204 patch -p0 src/hostapi/coreaudio/pa_mac_core.c <../../macosx-support-lib-patches/portaudio-pa_mac_core.c.patch
1206 # Disable fat builds - the configure script doesn't work right
1207 # with Xcode 4 if you leave them enabled, and we don't build
1208 # any other libraries fat (GLib, for example, would be very
1209 # hard to build fat), so there's no advantage to having PortAudio
1212 # Set the minimum OS X version to 10.4, to suppress some
1213 # deprecation warnings. (Good luck trying to make any of
1214 # this build on an OS+Xcode with a pre-10.4 SDK; we don't
1215 # worry about the user requesting that.)
1217 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
1218 make $MAKE_BUILD_OPTS || exit 1
1219 $DO_MAKE_INSTALL || exit 1
1221 touch portaudio-$PORTAUDIO_VERSION-done
1225 uninstall_portaudio() {
1226 if [ ! -z "$installed_portaudio_version" ] ; then
1227 echo "Uninstalling PortAudio:"
1229 $DO_MAKE_UNINSTALL || exit 1
1230 make distclean || exit 1
1232 rm portaudio-$installed_portaudio_version-done
1234 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1236 # Get rid of the previously downloaded and unpacked version.
1239 rm -rf $installed_portaudio_version.tgz
1242 installed_portaudio_version=""
1247 if [ "$GEOIP_VERSION" -a ! -f geoip-$GEOIP_VERSION-done ] ; then
1248 echo "Downloading, building, and installing GeoIP API:"
1249 [ -f GeoIP-$GEOIP_VERSION.tar.gz ] || curl -L -O http://geolite.maxmind.com/download/geoip/api/c/GeoIP-$GEOIP_VERSION.tar.gz || exit 1
1250 gzcat GeoIP-$GEOIP_VERSION.tar.gz | tar xf - || exit 1
1251 cd GeoIP-$GEOIP_VERSION
1252 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1254 # Grr. Their man pages "helpfully" have an ISO 8859-1
1255 # copyright symbol in the copyright notice, but OS X's
1256 # default character encoding is UTF-8. sed on Mountain
1257 # Lion barfs at the "illegal character sequence" represented
1258 # by an ISO 8859-1 copyright symbol, as it's not a valid
1261 # iconv the relevant man pages into UTF-8.
1263 for i in geoipupdate.1.in geoiplookup6.1.in geoiplookup.1.in
1265 iconv -f iso8859-1 -t utf-8 man/"$i" >man/"$i".tmp &&
1266 mv man/"$i".tmp man/"$i"
1268 make $MAKE_BUILD_OPTS || exit 1
1269 $DO_MAKE_INSTALL || exit 1
1271 touch geoip-$GEOIP_VERSION-done
1276 if [ ! -z "$installed_geoip_version" ] ; then
1277 echo "Uninstalling GeoIP API:"
1278 cd GeoIP-$installed_geoip_version
1279 $DO_MAKE_UNINSTALL || exit 1
1280 make distclean || exit 1
1282 rm geoip-$installed_geoip_version-done
1284 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1286 # Get rid of the previously downloaded and unpacked version.
1288 rm -rf GeoIP-$installed_geoip_version
1289 rm -rf GeoIP-$installed_geoip_version.tar.gz
1292 installed_geoip_version=""
1297 if [ "$CARES_VERSION" -a ! -f c-ares-$CARES_VERSION-done ] ; then
1298 echo "Downloading, building, and installing C-Ares API:"
1299 [ -f c-ares-$CARES_VERSION.tar.gz ] || curl -L -O http://c-ares.haxx.se/download/c-ares-$CARES_VERSION.tar.gz || exit 1
1300 gzcat c-ares-$CARES_VERSION.tar.gz | tar xf - || exit 1
1301 cd c-ares-$CARES_VERSION
1302 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1303 make $MAKE_BUILD_OPTS || exit 1
1304 $DO_MAKE_INSTALL || exit 1
1306 touch c-ares-$CARES_VERSION-done
1310 uninstall_c_ares() {
1311 if [ ! -z "$installed_cares_version" ] ; then
1312 echo "Uninstalling C-Ares API:"
1313 cd c-ares-$installed_cares_version
1314 $DO_MAKE_UNINSTALL || exit 1
1315 make distclean || exit 1
1317 rm c-ares-$installed_cares_version-done
1319 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1321 # Get rid of the previously downloaded and unpacked version.
1323 rm -rf c-ares-$installed_cares_version
1324 rm -rf c-ares-$installed_cares_version.tar.gz
1327 installed_cares_version=""
1333 # Check whether the versions we have installed are the versions
1334 # requested; if not, uninstall the installed versions.
1336 if [ ! -z "$installed_cares_version" -a \
1337 "$installed_cares_version" != "$CARES_VERSION" ] ; then
1338 echo "Installed C-Ares version is $installed_cares_version"
1339 if [ -z "$CARES_VERSION" ] ; then
1340 echo "C-Ares is not requested"
1342 echo "Requested C-Ares version is $CARES_VERSION"
1347 if [ ! -z "$installed_geoip_version" -a \
1348 "$installed_geoip_version" != "$GEOIP_VERSION" ] ; then
1349 echo "Installed GeoIP API version is $installed_geoip_version"
1350 if [ -z "$GEOIP_VERSION" ] ; then
1351 echo "GeoIP is not requested"
1353 echo "Requested GeoIP version is $GEOIP_VERSION"
1358 if [ ! -z "$installed_portaudio_version" -a \
1359 "$installed_portaudio_version" != "$PORTAUDIO_VERSION" ] ; then
1360 echo "Installed PortAudio version is $installed_portaudio_version"
1361 if [ -z "$PORTAUDIO_VERSION" ] ; then
1362 echo "PortAudio is not requested"
1364 echo "Requested PortAudio version is $PORTAUDIO_VERSION"
1366 uninstall_portaudio -r
1369 if [ ! -z "$installed_lua_version" -a \
1370 "$installed_lua_version" != "$LUA_VERSION" ] ; then
1371 echo "Installed Lua version is $installed_lua_version"
1372 if [ -z "$LUA_VERSION" ] ; then
1373 echo "Lua is not requested"
1375 echo "Requested Lua version is $LUA_VERSION"
1380 if [ ! -z "$installed_gnutls_version" -a \
1381 "$installed_gnutls_version" != "$GNUTLS_VERSION" ] ; then
1382 echo "Installed GnuTLS version is $installed_gnutls_version"
1383 if [ -z "$GNUTLS_VERSION" ] ; then
1384 echo "GnuTLS is not requested"
1386 echo "Requested GnuTLS version is $GNUTLS_VERSION"
1391 if [ ! -z "$installed_libgcrypt_version" -a \
1392 "$installed_libgcrypt_version" != "$LIBGCRYPT_VERSION" ] ; then
1393 echo "Installed libgcrypt version is $installed_libgcrypt_version"
1394 if [ -z "$LIBGCRYPT_VERSION" ] ; then
1395 echo "libgcrypt is not requested"
1397 echo "Requested libgcrypt version is $LIBGCRYPT_VERSION"
1399 uninstall_libgcrypt -r
1402 if [ ! -z "$installed_libgpg_error_version" -a \
1403 "$installed_libgpg_error_version" != "$LIBGPG_ERROR_VERSION" ] ; then
1404 echo "Installed libgpg-error version is $installed_libgpg_error_version"
1405 if [ -z "$LIBGPG_ERROR_VERSION" ] ; then
1406 echo "libgpg-error is not requested"
1408 echo "Requested libgpg-error version is $LIBGPG_ERROR_VERSION"
1410 uninstall_libgpg_error -r
1413 if [ ! -z "$installed_libsmi_version" -a \
1414 "$installed_libsmi_version" != "$LIBSMI_VERSION" ] ; then
1415 echo "Installed libsmi version is $installed_libsmi_version"
1416 if [ -z "$LIBSMI_VERSION" ] ; then
1417 echo "libsmi is not requested"
1419 echo "Requested libsmi version is $LIBSMI_VERSION"
1424 if [ ! -z "$installed_gtk_version" -a \
1425 "$installed_gtk_version" != "$GTK_VERSION" ] ; then
1426 echo "Installed GTK+ version is $installed_gtk_version"
1427 if [ -z "$GTK_VERSION" ] ; then
1428 echo "GTK+ is not requested"
1430 echo "Requested GTK+ version is $GTK_VERSION"
1435 if [ ! -z "$installed_gdk_pixbuf_version" -a \
1436 "$installed_gdk_pixbuf_version" != "$GDK_PIXBUF_VERSION" ] ; then
1437 echo "Installed gdk-pixbuf version is $installed_gdk_pixbuf_version"
1438 if [ -z "$GDK_PIXBUF_VERSION" ] ; then
1439 echo "gdk-pixbuf is not requested"
1441 echo "Requested gdk-pixbuf version is $GDK_PIXBUF_VERSION"
1443 uninstall_gdk_pixbuf -r
1446 if [ ! -z "$installed_pango_version" -a \
1447 "$installed_pango_version" != "$PANGO_VERSION" ] ; then
1448 echo "Installed Pango version is $installed_pango_version"
1449 if [ -z "$PANGO_VERSION" ] ; then
1450 echo "Pango is not requested"
1452 echo "Requested Pango version is $PANGO_VERSION"
1457 if [ ! -z "$installed_atk_version" -a \
1458 "$installed_atk_version" != "$ATK_VERSION" ] ; then
1459 echo "Installed ATK version is $installed_atk_version"
1460 if [ -z "$ATK_VERSION" ] ; then
1461 echo "ATK is not requested"
1463 echo "Requested ATK version is $ATK_VERSION"
1468 if [ ! -z "$installed_cairo_version" -a \
1469 "$installed_cairo_version" != "$CAIRO_VERSION" ] ; then
1470 echo "Installed Cairo version is $installed_cairo_version"
1471 if [ -z "$CAIRO_VERSION" ] ; then
1472 echo "Cairo is not requested"
1474 echo "Requested Cairo version is $CAIRO_VERSION"
1479 if [ ! -z "$installed_pixman_version" -a \
1480 "$installed_pixman_version" != "$PIXMAN_VERSION" ] ; then
1481 echo "Installed pixman version is $installed_pixman_version"
1482 if [ -z "$PIXMAN_VERSION" ] ; then
1483 echo "pixman is not requested"
1485 echo "Requested pixman version is $PIXMAN_VERSION"
1490 if [ ! -z "$installed_libpng_version" -a \
1491 "$installed_libpng_version" != "$PNG_VERSION" ] ; then
1492 echo "Installed libpng version is $installed_libpng_version"
1493 if [ -z "$PNG_VERSION" ] ; then
1494 echo "libpng is not requested"
1496 echo "Requested libpng version is $PNG_VERSION"
1501 if [ ! -z "$installed_qt_version" -a \
1502 "$installed_qt_version" != "$QT_VERSION" ] ; then
1503 echo "Installed Qt version is $installed_qt_version"
1504 if [ -z "$QT_VERSION" ] ; then
1505 echo "Qt is not requested"
1507 echo "Requested Qt version is $QT_VERSION"
1512 if [ ! -z "$installed_glib_version" -a \
1513 "$installed_glib_version" != "$GLIB_VERSION" ] ; then
1514 echo "Installed GLib version is $installed_glib_version"
1515 if [ -z "$GLIB_VERSION" ] ; then
1516 echo "GLib is not requested"
1518 echo "Requested GLib version is $GLIB_VERSION"
1523 if [ ! -z "$installed_pkg_config_version" -a \
1524 "$installed_pkg_config_version" != "$PKG_CONFIG_VERSION" ] ; then
1525 echo "Installed pkg-config version is $installed_pkg_config_version"
1526 if [ -z "$PKG_CONFIG_VERSION" ] ; then
1527 echo "pkg-config is not requested"
1529 echo "Requested pkg-config version is $PKG_CONFIG_VERSION"
1531 uninstall_pkg_config -r
1534 if [ ! -z "$installed_gettext_version" -a \
1535 "$installed_gettext_version" != "$GETTEXT_VERSION" ] ; then
1536 echo "Installed GNU gettext version is $installed_gettext_version"
1537 if [ -z "$GETTEXT_VERSION" ] ; then
1538 echo "GNU gettext is not requested"
1540 echo "Requested GNU gettext version is $GETTEXT_VERSION"
1542 uninstall_gettext -r
1545 if [ ! -z "$installed_cmake_version" -a \
1546 "$installed_cmake_version" != "$CMAKE_VERSION" ] ; then
1547 echo "Installed CMake version is $installed_cmake_version"
1548 if [ -z "$CMAKE_VERSION" ] ; then
1549 echo "CMake is not requested"
1551 echo "Requested CMake version is $CMAKE_VERSION"
1554 # XXX - really remove this?
1555 # Or should we remember it as installed only if this script
1561 if [ ! -z "$installed_libtool_version" -a \
1562 "$installed_libtool_version" != "$LIBTOOL_VERSION" ] ; then
1563 echo "Installed GNU libtool version is $installed_libtool_version"
1564 if [ -z "$LIBTOOL_VERSION" ] ; then
1565 echo "GNU libtool is not requested"
1567 echo "Requested GNU libtool version is $LIBTOOL_VERSION"
1569 uninstall_libtool -r
1572 if [ ! -z "$installed_automake_version" -a \
1573 "$installed_automake_version" != "$AUTOMAKE_VERSION" ] ; then
1574 echo "Installed GNU automake version is $installed_automake_version"
1575 if [ -z "$AUTOMAKE_VERSION" ] ; then
1576 echo "GNU automake is not requested"
1578 echo "Requested GNU automake version is $AUTOMAKE_VERSION"
1580 uninstall_automake -r
1583 if [ ! -z "$installed_autoconf_version" -a \
1584 "$installed_autoconf_version" != "$AUTOCONF_VERSION" ] ; then
1585 echo "Installed GNU autoconf version is $installed_autoconf_version"
1586 if [ -z "$AUTOCONF_VERSION" ] ; then
1587 echo "GNU autoconf is not requested"
1589 echo "Requested GNU autoconf version is $AUTOCONF_VERSION"
1591 uninstall_autoconf -r
1594 if [ ! -z "$installed_xz_version" -a \
1595 "$installed_xz_version" != "$XZ_VERSION" ] ; then
1596 echo "Installed xz version is $installed_xz_version"
1597 if [ -z "$XZ_VERSION" ] ; then
1598 echo "xz is not requested"
1600 echo "Requested xz version is $XZ_VERSION"
1606 # Start with xz: It is the sole download format of glib later than 2.31.2
1619 # Start with GNU gettext; GLib requires it, and OS X doesn't have it
1620 # or a BSD-licensed replacement.
1622 # At least on Lion with Xcode 4, _FORTIFY_SOURCE gets defined as 2
1623 # by default, which causes, for example, stpncpy to be defined as
1624 # a hairy macro that collides with the GNU gettext configure script's
1625 # attempts to workaround AIX's lack of a declaration for stpncpy,
1626 # with the result being a huge train wreck. Define _FORTIFY_SOURCE
1627 # as 0 in an attempt to keep the trains on separate tracks.
1632 # GLib depends on pkg-config.
1633 # By default, pkg-config depends on GLib; we break the dependency cycle
1634 # by configuring pkg-config to use its own internal version of GLib.
1641 # Now we have reached a point where we can build everything but
1642 # the GUI (Wireshark).
1646 if [ "$GTK_VERSION" ]; then
1648 # GTK+ 3 requires a newer Cairo build than the one that comes with
1649 # 10.6, so we build Cairo if we are using GTK+ 3.
1651 # In 10.6 and 10.7, it's an X11 library; if we build with "native" GTK+
1652 # rather than X11 GTK+, we might have to build and install Cairo.
1653 # In 10.8 and later, there is no X11, but it's included in Xquartz;
1654 # again, if we build with "native" GTK+, we'd have to build and install
1657 if [[ "$GTK_MAJOR_VERSION" -eq 3 || "$cairo_not_in_the_os" = yes ]]; then
1659 # Requirements for Cairo first
1661 # The libpng that comes with the X11 for Leopard has a bogus
1662 # pkg-config file that lies about where the header files are,
1663 # which causes other packages not to be able to find its
1666 # The libpng in later versions is not what the version of
1667 # libpixman we build below wants - it wants libpng15.
1672 # The libpixman versions that come with the X11s for Leopard,
1673 # Snow Leopard, and Lion is too old to support Cairo's image
1674 # surface backend feature (which requires pixman-1 >= 0.22.0).
1676 # XXX - what about the one that comes with the latest version
1682 # And now Cairo itself.
1683 # XXX - with the libxcb that comes with 10.6,
1684 # xcb_discard_reply() is missing, and the build fails.
1699 # Now we have reached a point where we can build everything including
1700 # the GUI (Wireshark), but not with any optional features such as
1701 # SNMP OID resolution, some forms of decryption, Lua scripting, playback
1702 # of audio, or GeoIP mapping of IP addresses.
1704 # We now conditionally download optional libraries to support them;
1705 # the default is to download them all.
1710 install_libgpg_error
1726 if [ -d macosx-support-libs ]
1728 cd macosx-support-libs
1731 # Uninstall items in the reverse order from the order in which they're
1732 # installed. Only uninstall if the download/build/install process
1733 # completed; uninstall the version that appears in the name of
1736 # We also do a "make distclean", so that we don't have leftovers from
1737 # old configurations.
1751 uninstall_libgpg_error
1757 uninstall_gdk_pixbuf
1773 uninstall_pkg_config
1778 # XXX - really remove this?
1779 # Or should we remember it as installed only if this script
1795 # Do we have permission to write in /usr/local?
1797 # If so, assume we have permission to write in its subdirectories.
1798 # (If that's not the case, this test needs to check the subdirectories
1801 # If not, do "make install", "make uninstall", the removes for Lua,
1802 # and the renames of [g]libtool* with sudo.
1804 if [ -w /usr/local ]
1806 DO_MAKE_INSTALL="make install"
1807 DO_MAKE_UNINSTALL="make uninstall"
1811 DO_MAKE_INSTALL="sudo make install"
1812 DO_MAKE_UNINSTALL="sudo make uninstall"
1818 # If we have SDKs available, the default target OS is the major version
1819 # of the one we're running; get that and strip off the third component
1822 for i in /Developer/SDKs \
1823 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
1824 /Library/Developer/CommandLineTools/SDKs
1828 min_osx_target=`sw_vers -productVersion | sed 's/\([0-9]*\)\.\([0-9]*\)\.[0-9]*/\1.\2/'`
1831 # That's also the OS whose SDK we'd be using.
1833 sdk_target=$min_osx_target
1839 # Parse command-line flags:
1842 # -t <target> - build libraries so that they'll work on the specified
1843 # version of OS X and later versions.
1844 # -u - do an uninstall.
1846 while getopts ht:u name
1853 min_osx_target="$OPTARG"
1856 echo "Usage: macosx-setup.sh [ -t <target> ] [ -u ]" 1>&1
1863 # Get the version numbers of installed packages, if any.
1865 if [ -d macosx-support-libs ]
1867 cd macosx-support-libs
1869 installed_xz_version=`ls xz-*-done 2>/dev/null | sed 's/xz-\(.*\)-done/\1/'`
1870 installed_autoconf_version=`ls autoconf-*-done 2>/dev/null | sed 's/autoconf-\(.*\)-done/\1/'`
1871 installed_automake_version=`ls automake-*-done 2>/dev/null | sed 's/automake-\(.*\)-done/\1/'`
1872 installed_libtool_version=`ls libtool-*-done 2>/dev/null | sed 's/libtool-\(.*\)-done/\1/'`
1873 installed_cmake_version=`ls cmake-*-done 2>/dev/null | sed 's/cmake-\(.*\)-done/\1/'`
1874 installed_gettext_version=`ls gettext-*-done 2>/dev/null | sed 's/gettext-\(.*\)-done/\1/'`
1875 installed_pkg_config_version=`ls pkg-config-*-done 2>/dev/null | sed 's/pkg-config-\(.*\)-done/\1/'`
1876 installed_glib_version=`ls glib-*-done 2>/dev/null | sed 's/glib-\(.*\)-done/\1/'`
1877 installed_qt_version=`ls qt-*-done 2>/dev/null | sed 's/qt-\(.*\)-done/\1/'`
1878 installed_libpng_version=`ls libpng-*-done 2>/dev/null | sed 's/libpng-\(.*\)-done/\1/'`
1879 installed_pixman_version=`ls pixman-*-done 2>/dev/null | sed 's/pixman-\(.*\)-done/\1/'`
1880 installed_cairo_version=`ls cairo-*-done 2>/dev/null | sed 's/cairo-\(.*\)-done/\1/'`
1881 installed_atk_version=`ls atk-*-done 2>/dev/null | sed 's/atk-\(.*\)-done/\1/'`
1882 installed_pango_version=`ls pango-*-done 2>/dev/null | sed 's/pango-\(.*\)-done/\1/'`
1883 installed_gdk_pixbuf_version=`ls gdk-pixbuf-*-done 2>/dev/null | sed 's/gdk-pixbuf-\(.*\)-done/\1/'`
1884 installed_gtk_version=`ls gtk+-*-done 2>/dev/null | sed 's/gtk+-\(.*\)-done/\1/'`
1885 installed_libsmi_version=`ls libsmi-*-done 2>/dev/null | sed 's/libsmi-\(.*\)-done/\1/'`
1886 installed_libgpg_error_version=`ls libgpg-error-*-done 2>/dev/null | sed 's/libgpg-error-\(.*\)-done/\1/'`
1887 installed_libgcrypt_version=`ls libgcrypt-*-done 2>/dev/null | sed 's/libgcrypt-\(.*\)-done/\1/'`
1888 installed_gnutls_version=`ls gnutls-*-done 2>/dev/null | sed 's/gnutls-\(.*\)-done/\1/'`
1889 installed_lua_version=`ls lua-*-done 2>/dev/null | sed 's/lua-\(.*\)-done/\1/'`
1890 installed_portaudio_version=`ls portaudio-*-done 2>/dev/null | sed 's/portaudio-\(.*\)-done/\1/'`
1891 installed_geoip_version=`ls geoip-*-done 2>/dev/null | sed 's/geoip-\(.*\)-done/\1/'`
1892 installed_cares_version=`ls c-ares-*-done 2>/dev/null | sed 's/c-ares-\(.*\)-done/\1/'`
1895 # If we don't have a versioned -done file for portaudio, but do have
1896 # an unversioned -done file for it, assume the installed version is the
1897 # requested version, and rename the -done file to include that version.
1899 if [ -z "$installed_portaudio_version" -a -f portaudio-done ] ; then
1900 mv portaudio-done portaudio-$PORTAUDIO_VERSION-done
1901 installed_portaudio_version=`ls portaudio-*-done 2>/dev/null | sed 's/portaudio-\(.*\)-done/\1/'`
1907 if [ "$do_uninstall" = "yes" ]
1914 # Configure scripts tend to set CFLAGS and CXXFLAGS to "-g -O2" if
1915 # invoked without CFLAGS or CXXFLAGS being set in the environment.
1917 # However, we *are* setting them in the environment, for our own
1918 # nefarious purposes, so start them out as "-g -O2".
1924 # To make this work on Leopard (rather than working *on* Snow Leopard
1925 # when building *for* Leopard) will take more work.
1927 # For one thing, Leopard's /usr/X11/lib/libXdamage.la claims, at least
1928 # with all software updates applied, that the Xdamage shared library
1929 # is libXdamage.1.0.0.dylib, but it is, in fact, libXdamage.1.1.0.dylib.
1930 # This causes problems when building GTK+, so the script would have to
1933 if [[ $DARWIN_MAJOR_VERSION -le 9 ]]; then
1934 echo "This script does not support any versions of OS X before Snow Leopard" 1>&2
1938 # if no make options are present, set default options
1939 if [ -z "$MAKE_BUILD_OPTS" ] ; then
1940 # by default use 1.5x number of cores for parallel build
1941 MAKE_BUILD_OPTS="-j $(( $(sysctl -n hw.logicalcpu) * 3 / 2))"
1945 # If we have a target release, look for the oldest SDK that's for an
1946 # OS equal to or later than that one, and build libraries against it
1947 # rather than against the headers and, more importantly, libraries
1948 # that come with the OS, so that we don't end up with support libraries
1949 # that only work on the OS version on which we built them, not earlier
1950 # versions of the same release, or earlier releases if the minimum is
1953 if [ ! -z "$min_osx_target" ]
1956 # Get the real version - strip off the "10.".
1957 # We'll worry about that if, as, and when there's ever
1960 deploy_real_version=`echo "$min_osx_target" | sed -n 's/10\.\(.*\)/\1/p'`
1963 # Search each directory that might contain SDKs.
1966 for sdksdir in /Developer/SDKs \
1967 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
1968 /Library/Developer/CommandLineTools/SDKs
1971 # Get a list of all the SDKs.
1973 if ! test -d "$sdksdir"
1976 # There is no directory with that name.
1977 # Move on to the next one in the list, if any.
1983 # Get a list of all the SDKs in that directory, if any.
1985 sdklist=`(cd "$sdksdir"; ls -d MacOSX10.[0-9]*.sdk 2>/dev/null)`
1990 # Get the real version for this SDK.
1992 sdk_real_version=`echo "$sdk" | sed -n 's/MacOSX10\.\(.*\)\.sdk/\1/p'`
1995 # Is it for the deployment target or some later release?
1997 if test "$sdk_real_version" -ge "$deploy_real_version"
2002 sdkpath="$sdksdir/$sdk"
2003 qt_sdk_arg="-sdk $sdk"
2009 if [ -z "$sdkpath" ]
2011 echo "macosx-setup.sh: Couldn't find an SDK for OS X $min_osx_target or later" 1>&2
2016 sdk_target=10.$sdk_real_version
2017 echo "Using the 10.$sdk_real_version SDK"
2020 # Make sure there are links to /usr/local/include and /usr/local/lib
2021 # in the SDK's usr/local.
2023 if [ ! -e $SDKPATH/usr/local/include ]
2025 if [ ! -d $SDKPATH/usr/local ]
2027 sudo mkdir $SDKPATH/usr/local
2029 sudo ln -s /usr/local/include $SDKPATH/usr/local/include
2031 if [ ! -e $SDKPATH/usr/local/lib ]
2033 if [ ! -d $SDKPATH/usr/local ]
2035 sudo mkdir $SDKPATH/usr/local
2037 sudo ln -s /usr/local/lib $SDKPATH/usr/local/lib
2041 # Set the minimum OS version for which to build to the specified
2042 # minimum target OS version, so we don't, for example, end up using
2043 # linker features supported by the OS verson on which we're building
2044 # but not by the target version.
2046 VERSION_MIN_FLAGS="-mmacosx-version-min=$min_osx_target"
2049 # Compile and link against the SDK.
2051 SDKFLAGS="-isysroot $SDKPATH"
2053 if [[ "$min_osx_target" == "10.5" ]]
2056 # Cairo is part of Mac OS X 10.6 and later.
2057 # The *headers* are supplied by 10.5, but the *libraries*
2058 # aren't, so we have to build it if we're building for 10.5.
2060 cairo_not_in_the_os=yes
2063 # Build with older versions of the support libraries, as
2064 # were used on the Wireshark Leopard buildbot at one
2065 # point. (Most of these versions come from the About page
2066 # from Wireshark 1.8.6, the last build done on that buildbot;
2067 # the ATK version isn't reported, so this is a guess.)
2069 # If you want to try building with newer versions of
2070 # the libraries, note that:
2072 # The version of fontconfig that comes with Leopard doesn't
2073 # support FC_WEIGHT_EXTRABLACK, so we can't use any version
2074 # of Pango newer than 1.22.4.
2076 # However, Pango 1.22.4 doesn't work with versions of GLib
2077 # after 2.29.6, because Pango 1.22.4 uses G_CONST_RETURN and
2078 # GLib 2.29.8 and later deprecate it (there doesn't appear to
2079 # be a GLib 2.29.7). That means we'd either have to patch
2080 # Pango not to use it (just use "const"; G_CONST_RETURN was
2081 # there to allow code to choose whether to use "const" or not),
2082 # or use GLib 2.29.6 or earlier.
2084 # GLib 2.29.6 includes an implementation of g_bit_lock() that,
2085 # on x86 (32-bit and 64-bit), uses asms in a fashion
2086 # ("asm volatile goto") that requires GCC 4.5 or later, which
2087 # is later than the compilers that come with Leopard and Snow
2088 # Leopard. Recent versions of GLib check for that, but 2.29.6
2089 # doesn't, so, if you want to build GLib 2.29.6 on Leopard or
2090 # Snow Leopard, you would have to patch glib/gbitlock.c to do
2091 # what the newer versions of GLib do:
2093 # define a USE_ASM_GOTO macro that indicates whether "asm goto"
2095 # #if (defined (i386) || defined (__amd64__))
2096 # #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
2097 # #define USE_ASM_GOTO 1
2101 # replace all occurrences of
2103 # #if defined (__GNUC__) && (defined (i386) || defined (__amd64__))
2107 # #ifdef USE_ASM_GOTO
2109 # Using GLib 2.29.6 or earlier, however, means that we can't
2110 # use a version of ATK later than 2.3.93, as those versions
2111 # don't work with GLib 2.29.6. The same applies to gdk-pixbuf;
2112 # versions of gdk-pixbuf after 2.24.1 won't work with GLib
2115 # Then you have to make sure that what you've build doesn't
2116 # cause the X server that comes with Leopard to crash; at
2117 # least one attempt at building for Leopard did.
2119 # At least if building on Leopard, you might also find
2120 # that, with various older versions of Cairo, including
2121 # 1.6.4 and at least some 1.8.x versions, when you try to
2122 # build it, the build fails because it can't find
2123 # png_set_longjmp_fn(). I vaguely remember dealing with that,
2124 # ages ago, but don't remember what I did.
2129 PANGO_VERSION=1.20.2
2133 # That version of GTK+ includes gdk-pixbuf.
2134 # XXX - base this on the version of GTK+ requested.
2139 # Libgcrypt 1.5.0 fails to compile due to some problem with an
2140 # asm in rijndael.c, at least with i686-apple-darwin10-gcc-4.2.1
2141 # (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) when building
2144 # We try libgcrypt 1.4.3 instead, as that's what shows up in
2145 # the version from the Leopard buildbot.
2146 LIBGCRYPT_VERSION=1.4.3
2149 # Build 32-bit while we're at it; Leopard has a bug that
2150 # causes some BPF functions not to work with 64-bit userland
2151 # code, so capturing won't work.
2153 CFLAGS="$CFLAGS -arch i386"
2154 CXXFLAGS="$CXXFLAGS -arch i386"
2155 export LDFLAGS="$LDFLAGS -arch i386"
2163 # You need Xcode or the command-line tools installed to get the compilers.
2165 if [ ! -x /usr/bin/xcodebuild ]; then
2166 echo "Please install Xcode first (should be available on DVD or from http://developer.apple.com/xcode/index.php)."
2170 if [ "$QT_VERSION" ]; then
2172 # We need Xcode, not just the command-line tools, installed to build
2175 if ! /usr/bin/xcrun -find xcrun >/dev/null 2>&1; then
2176 echo "Please install Xcode first (should be available on DVD or from http://developer.apple.com/xcode/index.php)."
2177 echo "The command-line build tools are not sufficient to build Qt."
2181 if [ "$GTK_VERSION" ]; then
2183 # If we're building with GTK+, you also need the X11 SDK; with at least
2184 # some versions of OS X and Xcode, that is, I think, an optional install.
2185 # (Or it might be installed with X11, but I think *that* is an optional
2186 # install on at least some versions of OS X.)
2188 if [ ! -d /usr/X11/include ]; then
2189 echo "Please install X11 and the X11 SDK first."
2190 echo " You can either use http://xquartz.macosforge.org/, e.g."
2191 echo " http://xquartz-dl.macosforge.org/SL/XQuartz-$XQUARTZ_VERSION.dmg"
2192 echo " or the native Apple packages if you are on Lion or below."
2197 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig
2200 # Do all the downloads and untarring in a subdirectory, so all that
2201 # stuff can be removed once we've installed the support libraries.
2203 if [ ! -d macosx-support-libs ]
2205 mkdir macosx-support-libs || exit 1
2207 cd macosx-support-libs
2214 # Indicate what path to use for pkg-config.
2216 pkg_config_path=/usr/local/lib/pkgconfig
2217 if [ "$QT_VERSION" ]; then
2218 pkg_config_path="$pkg_config_path":"$HOME/Qt$QT_VERSION/$QT_MAJOR_MINOR_VERSION/clang_64/lib/pkgconfig"
2220 pkg_config_path="$pkg_config_path":/usr/X11/lib/pkgconfig
2222 echo "You are now prepared to build Wireshark. To do so do:"
2223 echo "export PKG_CONFIG_PATH=$pkg_config_path"
2225 if [ -n "$CMAKE" ]; then
2226 echo "mkdir build; cd build"
2233 echo "mkdir build; cd build"
2236 echo "make $MAKE_BUILD_OPTS"
2241 echo "Make sure you are allowed capture access to the network devices"
2242 echo "See: https://wiki.wireshark.org/CaptureSetup/CapturePrivileges"