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_MAJOR_VERSION="`expr $CMAKE_VERSION : '\([0-9][0-9]*\).*'`"
306 CMAKE_MINOR_VERSION="`expr $CMAKE_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
307 CMAKE_DOTDOT_VERSION="`expr $CMAKE_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
308 CMAKE_MAJOR_MINOR_VERSION=$CMAKE_MAJOR_VERSION.$CMAKE_MINOR_VERSION
311 # NOTE: the "64" in "Darwin64" doesn't mean "64-bit-only"; the
312 # package in question supports both 32-bit and 64-bit x86.
314 case "$CMAKE_MAJOR_VERSION" in
317 echo "CMake $CMAKE_VERSION" is too old 1>&2
322 # Download the DMG, run the installer.
324 [ -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
325 sudo hdiutil attach cmake-$CMAKE_VERSION-Darwin64-universal.dmg || exit 1
326 sudo installer -target / -pkg /Volumes/cmake-$CMAKE_VERSION-Darwin64-universal/cmake-$CMAKE_VERSION-Darwin64-universal.pkg || exit 1
327 sudo hdiutil detach /Volumes/cmake-$CMAKE_VERSION-Darwin64-universal
332 # Download the DMG and do a drag install, where "drag" means
335 # 3.0.* and 3.1.0 have a Darwin64-universal DMG.
336 # 3.1.1 and later have a Darwin-x86_64 DMG.
337 # Probably not many people are still developing on 32-bit
338 # Macs, so we don't worry about them.
340 if [ "$CMAKE_MINOR_VERSION" = 0 -o \
341 "$CMAKE_VERSION" = 3.1.0 ]; then
342 type="Darwin64-universal"
346 [ -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
347 sudo hdiutil attach cmake-$CMAKE_VERSION-$type.dmg || exit 1
348 sudo ditto /Volumes/cmake-$CMAKE_VERSION-$type/CMake.app /Applications/CMake.app || exit 1
351 # Plant the appropriate symbolic links in /usr/local/bin.
352 # It's a drag-install, so there's no installer to make them,
353 # and the CMake code to put them in place is lame, as
355 # 1) it defaults to /usr/bin, not /usr/local/bin;
356 # 2) it doesn't request the necessary root privileges;
357 # 3) it can't be run from the command line;
359 # so we do it ourselves.
361 for i in ccmake cmake cmake-gui cmakexbuild cpack ctest
363 sudo ln -s /Applications/CMake.app/Contents/bin/$i /usr/local/bin/$i
365 sudo hdiutil detach /Volumes/cmake-$CMAKE_VERSION-$type
371 touch cmake-$CMAKE_VERSION-done
376 if [ ! -z "$installed_cmake_version" ]; then
377 echo "Uninstalling CMake:"
378 installed_cmake_major_version="`expr $installed_cmake_version : '\([0-9][0-9]*\).*'`"
379 case "$installed_cmake_major_version" in
382 echo "CMake $installed_cmake_version" is too old 1>&2
386 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
387 for i in ccmake cmake cmake-gui cmakexbuild cpack ctest
389 sudo rm -f /usr/bin/$i /usr/local/bin/$i
391 sudo pkgutil --forget com.Kitware.CMake
392 rm cmake-$installed_cmake_version-done
396 sudo rm -rf /Applications/CMake.app
397 for i in ccmake cmake cmake-gui cmakexbuild cpack ctest
399 sudo rm -f /usr/local/bin/$i
401 rm cmake-$installed_cmake_version-done
405 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
407 # Get rid of the previously downloaded and unpacked version,
408 # whatever it might happen to be called.
410 rm -f cmake-$installed_cmake_version-Darwin64-universal.dmg
411 rm -f cmake-$installed_cmake_version-Darwin-x86_64.dmg
414 installed_cmake_version=""
419 if [ ! -f gettext-$GETTEXT_VERSION-done ] ; then
420 echo "Downloading, building, and installing GNU gettext:"
421 [ -f gettext-$GETTEXT_VERSION.tar.gz ] || curl -O http://ftp.gnu.org/pub/gnu/gettext/gettext-$GETTEXT_VERSION.tar.gz || exit 1
422 gzcat gettext-$GETTEXT_VERSION.tar.gz | tar xf - || exit 1
423 cd gettext-$GETTEXT_VERSION
424 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0 $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
425 make $MAKE_BUILD_OPTS || exit 1
426 $DO_MAKE_INSTALL || exit 1
428 touch gettext-$GETTEXT_VERSION-done
432 uninstall_gettext() {
433 if [ ! -z "$installed_gettext_version" ] ; then
435 # GLib depends on this, so uninstall it.
439 echo "Uninstalling GNU gettext:"
440 cd gettext-$installed_gettext_version
441 $DO_MAKE_UNINSTALL || exit 1
442 make distclean || exit 1
444 rm gettext-$installed_gettext_version-done
446 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
448 # Get rid of the previously downloaded and unpacked version.
450 rm -rf gettext-$installed_gettext_version
451 rm -rf gettext-$installed_gettext_version.tar.gz
454 installed_gettext_version=""
458 install_pkg_config() {
459 if [ ! -f pkg-config-$PKG_CONFIG_VERSION-done ] ; then
460 echo "Downloading, building, and installing pkg-config:"
461 [ -f pkg-config-$PKG_CONFIG_VERSION.tar.gz ] || curl -O http://pkgconfig.freedesktop.org/releases/pkg-config-$PKG_CONFIG_VERSION.tar.gz || exit 1
462 gzcat pkg-config-$PKG_CONFIG_VERSION.tar.gz | tar xf - || exit 1
463 cd pkg-config-$PKG_CONFIG_VERSION
464 ./configure --with-internal-glib || exit 1
465 make $MAKE_BUILD_OPTS || exit 1
466 $DO_MAKE_INSTALL || exit 1
468 touch pkg-config-$PKG_CONFIG_VERSION-done
472 uninstall_pkg_config() {
473 if [ ! -z "$installed_pkg_config_version" ] ; then
474 echo "Uninstalling pkg-config:"
475 cd pkg-config-$installed_pkg_config_version
476 $DO_MAKE_UNINSTALL || exit 1
477 make distclean || exit 1
479 rm pkg-config-$installed_pkg_config_version-done
481 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
483 # Get rid of the previously downloaded and unpacked version.
485 rm -rf pkg-config-$installed_pkg_config_version
486 rm -rf pkg-config-$installed_pkg_config_version.tar.gz
489 installed_pkg_config_version=""
494 if [ ! -f glib-$GLIB_VERSION-done ] ; then
495 echo "Downloading, building, and installing GLib:"
496 glib_dir=`expr $GLIB_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
497 GLIB_MAJOR_VERSION="`expr $GLIB_VERSION : '\([0-9][0-9]*\).*'`"
498 GLIB_MINOR_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
499 GLIB_DOTDOT_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
500 if [[ $GLIB_MAJOR_VERSION -gt 2 ||
501 $GLIB_MINOR_VERSION -gt 28 ||
502 ($GLIB_MINOR_VERSION -eq 28 && $GLIB_DOTDOT_VERSION -ge 8) ]]
505 # Starting with GLib 2.28.8, xz-compressed tarballs are available.
507 [ -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
508 xzcat glib-$GLIB_VERSION.tar.xz | tar xf - || exit 1
510 [ -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
511 bzcat glib-$GLIB_VERSION.tar.bz2 | tar xf - || exit 1
513 cd glib-$GLIB_VERSION
515 # OS X ships with libffi, but doesn't provide its pkg-config file;
516 # explicitly specify LIBFFI_CFLAGS and LIBFFI_LIBS, so the configure
517 # script doesn't try to use pkg-config to get the appropriate
518 # C flags and loader flags.
520 # And, what's worse, at least with the version of Xcode that comes
521 # with Leopard, /usr/include/ffi/fficonfig.h doesn't define MACOSX,
522 # which causes the build of GLib to fail. If we don't find
523 # "#define.*MACOSX" in /usr/include/ffi/fficonfig.h, explicitly
526 # While we're at it, suppress -Wformat-nonliteral to avoid a case
527 # where clang's stricter rules on when not to complain about
528 # non-literal format arguments cause it to complain about code
529 # that's safe but it wasn't told that. See my comment #25 in
532 # https://bugzilla.gnome.org/show_bug.cgi?id=691608#c25
534 # First, determine where the system include files are. (It's not
535 # necessarily /usr/include.) There's a bit of a greasy hack here;
536 # pre-5.x versions of the developer tools don't support the
537 # --show-sdk-path option, and will produce no output, so includedir
538 # will be set to /usr/include (in those older versions of the
539 # developer tools, there is a /usr/include directory).
541 includedir=`xcrun --show-sdk-path 2>/dev/null`/usr/include
542 if grep -qs '#define.*MACOSX' $includedir/ffi/fficonfig.h
544 # It's defined, nothing to do
545 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
547 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
551 # Apply the fix to GNOME bug 529806:
553 # https://bugzilla.gnome.org/show_bug.cgi?id=529806
555 # if we have a version of GLib prior to 2.30.
557 if [[ $GLIB_MAJOR_VERSION -eq 2 && $GLIB_MINOR_VERSION -le 30 ]]
559 patch -p0 <../../macosx-support-lib-patches/glib-gconvert.c.patch || exit 1
561 make $MAKE_BUILD_OPTS || exit 1
562 $DO_MAKE_INSTALL || exit 1
564 touch glib-$GLIB_VERSION-done
569 if [ ! -z "$installed_glib_version" ] ; then
571 # ATK, Pango, and GTK depend on this, so uninstall them.
577 echo "Uninstalling GLib:"
578 cd glib-$installed_glib_version
579 $DO_MAKE_UNINSTALL || exit 1
580 make distclean || exit 1
582 rm glib-$installed_glib_version-done
584 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
586 # Get rid of the previously downloaded and unpacked version.
588 rm -rf glib-$installed_glib_version
589 rm -rf glib-$installed_glib_version.tar.xz glib-$installed_glib_version.tar.bz2
592 installed_glib_version=""
597 if [ "$QT_VERSION" -a ! -f qt-$QT_VERSION-done ]; then
598 echo "Downloading, building, and installing Qt:"
600 # What you get for this URL might just be a 302 Found reply, so use
601 # -L so we get redirected.
603 [ -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
604 sudo hdiutil attach qt-opensource-mac-x64-clang-$QT_VERSION.dmg || exit 1
607 # Run the executable directly, so that we wait for it to finish.
609 /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
610 sudo hdiutil detach /Volumes/qt-opensource-mac-x64-clang-$QT_VERSION
613 # The 5.3.x versions, at least, have bogus .pc files.
616 for i in $HOME/Qt$QT_VERSION/$QT_MAJOR_MINOR_VERSION/clang_64/lib/pkgconfig/*.pc
620 g/Cflags: /s;;Cflags: -F\${libdir} ;
621 g/Cflags: /s;-I\${includedir}/Qt\([a-zA-Z0-9_]*\);-I\${libdir}/Qt\1.framework/Versions/5/Headers;
626 touch qt-$QT_VERSION-done
631 if [ ! -z "$installed_qt_version" ] ; then
632 echo "Uninstalling Qt:"
633 rm -rf $HOME/Qt$installed_qt_version
634 rm qt-$installed_qt_version-done
636 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
638 # Get rid of the previously downloaded version.
640 rm -rf qt-opensource-mac-x64-clang-$installed_qt_version.dmg
643 installed_qt_version=""
648 if [ ! -f libpng-$PNG_VERSION-done ] ; then
649 echo "Downloading, building, and installing libpng:"
651 # The FTP site puts libpng x.y.* into a libpngxy directory.
653 subdir=`echo $PNG_VERSION | sed 's/\([1-9][0-9]*\)\.\([1-9][0-9]*\).*/libpng\1\2'/`
654 [ -f libpng-$PNG_VERSION.tar.xz ] || curl -O ftp://ftp.simplesystems.org/pub/libpng/png/src/$subdir/libpng-$PNG_VERSION.tar.xz
655 xzcat libpng-$PNG_VERSION.tar.xz | tar xf - || exit 1
656 cd libpng-$PNG_VERSION
657 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
658 make $MAKE_BUILD_OPTS || exit 1
659 $DO_MAKE_INSTALL || exit 1
661 touch libpng-$PNG_VERSION-done
666 if [ ! -z "$installed_libpng_version" ] ; then
668 # Cairo depends on this, so uninstall it.
672 echo "Uninstalling libpng:"
673 cd libpng-$installed_libpng_version
674 $DO_MAKE_UNINSTALL || exit 1
675 make distclean || exit 1
677 rm libpng-$installed_libpng_version-done
679 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
681 # Get rid of the previously downloaded and unpacked version.
683 rm -rf libpng-$installed_libpng_version
684 rm -rf libpng-$installed_libpng_version.tar.xz
687 installed_libpng_version=""
692 if [ ! -f pixman-$PIXMAN_VERSION-done ] ; then
693 echo "Downloading, building, and installing pixman:"
694 [ -f pixman-$PIXMAN_VERSION.tar.gz ] || curl -O http://www.cairographics.org/releases/pixman-$PIXMAN_VERSION.tar.gz
695 gzcat pixman-$PIXMAN_VERSION.tar.gz | tar xf - || exit 1
696 cd pixman-$PIXMAN_VERSION
697 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
698 make $MAKE_BUILD_OPTS || exit 1
699 $DO_MAKE_INSTALL || exit 1
701 touch pixman-$PIXMAN_VERSION-done
706 if [ ! -z "$installed_pixman_version" ] ; then
708 # Cairo depends on this, so uninstall it.
712 echo "Uninstalling pixman:"
713 cd pixman-$installed_pixman_version
714 $DO_MAKE_UNINSTALL || exit 1
715 make distclean || exit 1
717 rm pixman-$installed_pixman_version-done
719 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
721 # Get rid of the previously downloaded and unpacked version.
723 rm -rf pixman-$installed_pixman_version
724 rm -rf pixman-$installed_pixman_version.tar.gz
727 installed_pixman_version=""
732 if [ ! -f cairo-$CAIRO_VERSION-done ] ; then
733 echo "Downloading, building, and installing Cairo:"
734 CAIRO_MAJOR_VERSION="`expr $CAIRO_VERSION : '\([0-9][0-9]*\).*'`"
735 CAIRO_MINOR_VERSION="`expr $CAIRO_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
736 CAIRO_DOTDOT_VERSION="`expr $CAIRO_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
737 if [[ $CAIRO_MAJOR_VERSION -gt 1 ||
738 $CAIRO_MINOR_VERSION -gt 12 ||
739 ($CAIRO_MINOR_VERSION -eq 12 && $CAIRO_DOTDOT_VERSION -ge 2) ]]
742 # Starting with Cairo 1.12.2, the tarballs are compressed with
743 # xz rather than gzip.
745 [ -f cairo-$CAIRO_VERSION.tar.xz ] || curl -O http://cairographics.org/releases/cairo-$CAIRO_VERSION.tar.xz || exit 1
746 xzcat cairo-$CAIRO_VERSION.tar.xz | tar xf - || exit 1
748 [ -f cairo-$CAIRO_VERSION.tar.gz ] || curl -O http://cairographics.org/releases/cairo-$CAIRO_VERSION.tar.gz || exit 1
749 gzcat cairo-$CAIRO_VERSION.tar.gz | tar xf - || exit 1
751 cd cairo-$CAIRO_VERSION
752 # CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-quartz=no || exit 1
753 # Maybe follow http://cairographics.org/end_to_end_build_for_mac_os_x/
754 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-quartz=yes || exit 1
756 # We must avoid the version of libpng that comes with X11; the
757 # only way I've found to force that is to forcibly set INCLUDES
758 # when we do the build, so that this comes before CAIRO_CFLAGS,
759 # which has -I/usr/X11/include added to it before anything
760 # connected to libpng is.
762 INCLUDES="-I/usr/local/include/libpng15" make $MAKE_BUILD_OPTS || exit 1
763 $DO_MAKE_INSTALL || exit 1
765 touch cairo-$CAIRO_VERSION-done
770 if [ ! -z "$installed_cairo_version" ] ; then
772 # GTK+ depends on this, so uninstall it.
776 echo "Uninstalling Cairo:"
777 cd cairo-$installed_cairo_version
778 $DO_MAKE_UNINSTALL || exit 1
779 make distclean || exit 1
781 rm cairo-$installed_cairo_version-done
783 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
785 # Get rid of the previously downloaded and unpacked version.
787 rm -rf cairo-$installed_cairo_version
788 rm -rf cairo-$installed_cairo_version.tar.xz cairo-$installed_cairo_version.tar.gz
791 installed_cairo_version=""
796 if [ ! -f atk-$ATK_VERSION-done ] ; then
797 echo "Downloading, building, and installing ATK:"
798 atk_dir=`expr $ATK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
799 ATK_MAJOR_VERSION="`expr $ATK_VERSION : '\([0-9][0-9]*\).*'`"
800 ATK_MINOR_VERSION="`expr $ATK_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
801 ATK_DOTDOT_VERSION="`expr $ATK_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
802 if [[ $ATK_MAJOR_VERSION -gt 2 ||
803 ($ATK_MAJOR_VERSION -eq 2 && $ATK_MINOR_VERSION -gt 0) ||
804 ($ATK_MANOR_VERSION -eq 2 && $ATK_MINOR_VERSION -eq 0 && $ATK_DOTDOT_VERSION -ge 1) ]]
807 # Starting with ATK 2.0.1, xz-compressed tarballs are available.
809 [ -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
810 xzcat atk-$ATK_VERSION.tar.xz | tar xf - || exit 1
812 [ -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
813 bzcat atk-$ATK_VERSION.tar.bz2 | tar xf - || exit 1
816 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
817 make $MAKE_BUILD_OPTS || exit 1
818 $DO_MAKE_INSTALL || exit 1
820 touch atk-$ATK_VERSION-done
825 if [ ! -z "$installed_atk_version" ] ; then
827 # GTK+ depends on this, so uninstall it.
831 echo "Uninstalling ATK:"
832 cd atk-$installed_atk_version
833 $DO_MAKE_UNINSTALL || exit 1
834 make distclean || exit 1
836 rm atk-$installed_atk_version-done
838 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
840 # Get rid of the previously downloaded and unpacked version.
842 rm -rf atk-$installed_atk_version
843 rm -rf atk-$installed_atk_version.tar.xz atk-$installed_atk_version.tar.bz2
846 installed_atk_version=""
851 if [ ! -f pango-$PANGO_VERSION-done ] ; then
852 echo "Downloading, building, and installing Pango:"
853 pango_dir=`expr $PANGO_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
854 PANGO_MAJOR_VERSION="`expr $PANGO_VERSION : '\([0-9][0-9]*\).*'`"
855 PANGO_MINOR_VERSION="`expr $PANGO_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
856 if [[ $PANGO_MAJOR_VERSION -gt 1 ||
857 $PANGO_MINOR_VERSION -ge 29 ]]
860 # Starting with Pango 1.29, the tarballs are compressed with
861 # xz rather than bzip2.
863 [ -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
864 xzcat pango-$PANGO_VERSION.tar.xz | tar xf - || exit 1
866 [ -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
867 bzcat pango-$PANGO_VERSION.tar.bz2 | tar xf - || exit 1
869 cd pango-$PANGO_VERSION
870 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
871 make $MAKE_BUILD_OPTS || exit 1
872 $DO_MAKE_INSTALL || exit 1
874 touch pango-$PANGO_VERSION-done
879 if [ ! -z "$installed_pango_version" ] ; then
881 # GTK+ depends on this, so uninstall it.
885 echo "Uninstalling Pango:"
886 cd pango-$installed_pango_version
887 $DO_MAKE_UNINSTALL || exit 1
888 make distclean || exit 1
890 rm pango-$installed_pango_version-done
892 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
894 # Get rid of the previously downloaded and unpacked version.
896 rm -rf pango-$installed_pango_version
897 rm -rf pango-$installed_pango_version.tar.xz pango-$installed_pango_version.tar.bz2
900 installed_pango_version=""
904 install_gdk_pixbuf() {
905 if [ "$GDK_PIXBUF_VERSION" -a ! -f gdk-pixbuf-$GDK_PIXBUF_VERSION-done ] ; then
906 echo "Downloading, building, and installing gdk-pixbuf:"
907 gdk_pixbuf_dir=`expr $GDK_PIXBUF_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
908 [ -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
909 xzcat gdk-pixbuf-$GDK_PIXBUF_VERSION.tar.xz | tar xf - || exit 1
910 cd gdk-pixbuf-$GDK_PIXBUF_VERSION
912 # If we're building using the 10.6 SDK, force the use of libpng12.
914 # The OS's X11, and corresponding SDK, didn't introduce libpng15,
915 # or pkg-config files, until 10.7, so, for 10.6 have to explicitly
916 # set LIBPNG to override the configure script, and also force the
917 # CFLAGS to look for the header files for libpng12 (note that
918 # -isysroot doesn't affect the arguments to -I, so we need to
919 # include the SDK path explicitly).
921 if [[ "$sdk_target" = 10.6 ]]
923 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
925 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
927 make $MAKE_BUILD_OPTS || exit 1
928 $DO_MAKE_INSTALL || exit 1
930 touch gdk-pixbuf-$GDK_PIXBUF_VERSION-done
934 uninstall_gdk_pixbuf() {
935 if [ ! -z "$installed_gdk_pixbuf_version" ] ; then
937 # GTK+ depends on this, so uninstall it.
941 echo "Uninstalling gdk-pixbuf:"
942 cd gdk-pixbuf-$installed_gdk_pixbuf_version
943 $DO_MAKE_UNINSTALL || exit 1
944 make distclean || exit 1
946 rm gdk-pixbuf-$installed_gdk_pixbuf_version-done
948 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
950 # Get rid of the previously downloaded and unpacked version.
952 rm -rf gdk-pixbuf-$installed_gdk_pixbuf_version
953 rm -rf gdk-pixbuf-$installed_gdk_pixbuf_version.tar.xz
956 installed_gdk_pixbuf_version=""
961 if [ ! -f gtk+-$GTK_VERSION-done ] ; then
962 echo "Downloading, building, and installing GTK+:"
963 gtk_dir=`expr $GTK_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'`
964 if [[ $GTK_MAJOR_VERSION -gt 2 ||
965 $GTK_MINOR_VERSION -gt 24 ||
966 ($GTK_MINOR_VERSION -eq 24 && $GTK_DOTDOT_VERSION -ge 5) ]]
969 # Starting with GTK+ 2.24.5, the tarballs are compressed with
970 # xz rather than gzip, in addition to bzip2; use xz, as we've
971 # built and installed it, and as xz compresses better than
972 # bzip2 so the tarballs take less time to download.
974 [ -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
975 xzcat gtk+-$GTK_VERSION.tar.xz | tar xf - || exit 1
977 [ -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
978 bzcat gtk+-$GTK_VERSION.tar.bz2 | tar xf - || exit 1
981 if [ $DARWIN_MAJOR_VERSION -ge "12" ]
984 # GTK+ 2.24.10, at least, doesn't build on Mountain Lion with the
985 # CUPS printing backend - either the CUPS API changed incompatibly
986 # or the backend was depending on non-API implementation details.
988 # Configure it out, on Mountain Lion and later, for now.
989 # (12 is the Darwin major version number in Mountain Lion.)
991 # Also, configure out libtiff and libjpeg; configure scripts
992 # just ignore unknown --enable/--disable and --with/--without
993 # options (at least they've always do so up to now).
995 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
997 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
999 make $MAKE_BUILD_OPTS || exit 1
1000 $DO_MAKE_INSTALL || exit 1
1002 touch gtk+-$GTK_VERSION-done
1007 if [ ! -z "$installed_gtk_version" ] ; then
1008 echo "Uninstalling GTK+:"
1009 cd gtk+-$installed_gtk_version
1010 $DO_MAKE_UNINSTALL || exit 1
1011 make distclean || exit 1
1013 rm gtk+-$installed_gtk_version-done
1015 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1017 # Get rid of the previously downloaded and unpacked version.
1019 rm -rf gtk+-$installed_gtk_version
1020 rm -rf gtk+-$installed_gtk_version.tar.xz gtk+-$installed_gtk_version.tar.bz2
1023 installed_gtk_version=""
1028 if [ "$LIBSMI_VERSION" -a ! -f libsmi-$LIBSMI_VERSION-done ] ; then
1029 echo "Downloading, building, and installing libsmi:"
1030 [ -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
1031 gzcat libsmi-$LIBSMI_VERSION.tar.gz | tar xf - || exit 1
1032 cd libsmi-$LIBSMI_VERSION
1033 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1034 make $MAKE_BUILD_OPTS || exit 1
1035 $DO_MAKE_INSTALL || exit 1
1037 touch libsmi-$LIBSMI_VERSION-done
1041 uninstall_libsmi() {
1042 if [ ! -z "$installed_libsmi_version" ] ; then
1043 echo "Uninstalling libsmi:"
1044 cd libsmi-$installed_libsmi_version
1045 $DO_MAKE_UNINSTALL || exit 1
1046 make distclean || exit 1
1048 rm libsmi-$installed_libsmi_version-done
1050 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1052 # Get rid of the previously downloaded and unpacked version.
1054 rm -rf libsmi-$installed_libsmi_version
1055 rm -rf libsmi-$installed_libsmi_version.tar.gz
1058 installed_libsmi_version=""
1062 install_libgpg_error() {
1063 if [ "$LIBGPG_ERROR_VERSION" -a ! -f libgpg-error-$LIBGPG_ERROR_VERSION-done ] ; then
1064 echo "Downloading, building, and installing libgpg-error:"
1065 [ -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
1066 bzcat libgpg-error-$LIBGPG_ERROR_VERSION.tar.bz2 | tar xf - || exit 1
1067 cd libgpg-error-$LIBGPG_ERROR_VERSION
1068 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1069 make $MAKE_BUILD_OPTS || exit 1
1070 $DO_MAKE_INSTALL || exit 1
1072 touch libgpg-error-$LIBGPG_ERROR_VERSION-done
1076 uninstall_libgpg_error() {
1077 if [ ! -z "$installed_libgpg_error_version" ] ; then
1079 # libgcrypt depends on this, so uninstall it.
1081 uninstall_libgcrypt "$@"
1083 echo "Uninstalling libgpg-error:"
1084 cd libgpg-error-$installed_libgpg_error_version
1085 $DO_MAKE_UNINSTALL || exit 1
1086 make distclean || exit 1
1088 rm libgpg-error-$installed_libgpg_error_version-done
1090 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1092 # Get rid of the previously downloaded and unpacked version.
1094 rm -rf libgpg-error-$installed_libgpg_error_version
1095 rm -rf libgpg-error-$installed_libgpg_error_version.tar.bz2
1098 installed_libgpg_error_version=""
1102 install_libgcrypt() {
1103 if [ "$LIBGCRYPT_VERSION" -a ! -f libgcrypt-$LIBGCRYPT_VERSION-done ] ; then
1105 # libgpg-error is required for libgcrypt.
1107 if [ -z $LIBGPG_ERROR_VERSION ]
1109 echo "libgcrypt requires libgpg-error, but you didn't install libgpg-error." 1>&2
1113 echo "Downloading, building, and installing libgcrypt:"
1114 [ -f libgcrypt-$LIBGCRYPT_VERSION.tar.gz ] || curl -L -O ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-$LIBGCRYPT_VERSION.tar.gz || exit 1
1115 gzcat libgcrypt-$LIBGCRYPT_VERSION.tar.gz | tar xf - || exit 1
1116 cd libgcrypt-$LIBGCRYPT_VERSION
1118 # The assembler language code is not compatible with the OS X
1119 # x86 assembler (or is it an x86-64 vs. x86-32 issue?).
1121 # libgcrypt expects gnu89, not c99/gnu99, semantics for
1122 # "inline". See, for example:
1124 # http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2010-October/198809.html
1126 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
1127 make $MAKE_BUILD_OPTS || exit 1
1128 $DO_MAKE_INSTALL || exit 1
1130 touch libgcrypt-$LIBGCRYPT_VERSION-done
1134 uninstall_libgcrypt() {
1135 if [ ! -z "$installed_libgcrypt_version" ] ; then
1137 # GnuTLS depends on this, so uninstall it.
1139 uninstall_gnutls "$@"
1141 echo "Uninstalling libgcrypt:"
1142 cd libgcrypt-$installed_libgcrypt_version
1143 $DO_MAKE_UNINSTALL || exit 1
1144 make distclean || exit 1
1146 rm libgcrypt-$installed_libgcrypt_version-done
1148 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1150 # Get rid of the previously downloaded and unpacked version.
1152 rm -rf libgcrypt-$installed_libgcrypt_version
1153 rm -rf libgcrypt-$installed_libgcrypt_version.tar.gz
1156 installed_libgcrypt_version=""
1161 if [ "$GNUTLS_VERSION" -a ! -f gnutls-$GNUTLS_VERSION-done ] ; then
1163 # GnuTLS requires libgcrypt (or nettle, in newer versions).
1165 if [ -z $LIBGCRYPT_VERSION ]
1167 echo "GnuTLS requires libgcrypt, but you didn't install libgcrypt" 1>&2
1171 echo "Downloading, building, and installing GnuTLS:"
1172 [ -f gnutls-$GNUTLS_VERSION.tar.bz2 ] || curl -L -O http://ftp.gnu.org/gnu/gnutls/gnutls-$GNUTLS_VERSION.tar.bz2 || exit 1
1173 bzcat gnutls-$GNUTLS_VERSION.tar.bz2 | tar xf - || exit 1
1174 cd gnutls-$GNUTLS_VERSION
1176 # Use libgcrypt, not nettle.
1177 # XXX - is there some reason to prefer nettle? Or does
1178 # Wireshark directly use libgcrypt routines?
1180 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
1181 make $MAKE_BUILD_OPTS || exit 1
1183 # The pkgconfig file for GnuTLS says "requires zlib", but OS X,
1184 # while it supplies zlib, doesn't supply a pkgconfig file for
1187 # Patch the GnuTLS pkgconfig file not to require zlib.
1188 # (If the capabilities of GnuTLS that Wireshark uses don't
1189 # depend on building GnuTLS with zlib, an alternative would be
1190 # to configure it not to use zlib.)
1192 patch -p0 lib/gnutls.pc.in <../../macosx-support-lib-patches/gnutls-pkgconfig.patch || exit 1
1193 $DO_MAKE_INSTALL || exit 1
1195 touch gnutls-$GNUTLS_VERSION-done
1199 uninstall_gnutls() {
1200 if [ ! -z "$installed_gnutls_version" ] ; then
1201 echo "Uninstalling GnuTLS:"
1202 cd gnutls-$installed_gnutls_version
1203 $DO_MAKE_UNINSTALL || exit 1
1204 make distclean || exit 1
1206 rm gnutls-$installed_gnutls_version-done
1208 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1210 # Get rid of the previously downloaded and unpacked version.
1212 rm -rf gnutls-$installed_gnutls_version
1213 rm -rf gnutls-$installed_gnutls_version.tar.bz2
1216 installed_gnutls_version=""
1221 if [ "$LUA_VERSION" -a ! -f lua-$LUA_VERSION-done ] ; then
1222 echo "Downloading, building, and installing Lua:"
1223 [ -f lua-$LUA_VERSION.tar.gz ] || curl -L -O http://www.lua.org/ftp/lua-$LUA_VERSION.tar.gz || exit 1
1224 gzcat lua-$LUA_VERSION.tar.gz | tar xf - || exit 1
1226 make $MAKE_BUILD_OPTS macosx || exit 1
1227 $DO_MAKE_INSTALL || exit 1
1229 touch lua-$LUA_VERSION-done
1234 if [ ! -z "$installed_lua_version" ] ; then
1235 echo "Uninstalling Lua:"
1237 # Lua has no "make uninstall", so just remove stuff manually.
1238 # There's no configure script, so there's no need for
1239 # "make distclean", either; just do "make clean".
1241 (cd /usr/local/bin; $DO_RM -f lua luac)
1242 (cd /usr/local/include; $DO_RM -f lua.h luaconf.h lualib.h lauxlib.h lua.hpp)
1243 (cd /usr/local/lib; $DO_RM -f liblua.a)
1244 (cd /usr/local/man/man1; $DO_RM -f lua.1 luac.1)
1245 cd lua-$installed_lua_version
1246 make clean || exit 1
1248 rm lua-$installed_lua_version-done
1250 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1252 # Get rid of the previously downloaded and unpacked version.
1254 rm -rf lua-$installed_lua_version
1255 rm -rf lua-$installed_lua_version.tar.gz
1258 installed_lua_version=""
1262 install_portaudio() {
1264 # Check for both the old versionless portaudio-done and the new
1265 # versioned -done file.
1267 if [ "$PORTAUDIO_VERSION" -a ! -f portaudio-$PORTAUDIO_VERSION-done ] ; then
1268 echo "Downloading, building, and installing PortAudio:"
1269 [ -f $PORTAUDIO_VERSION.tgz ] || curl -L -O http://www.portaudio.com/archives/$PORTAUDIO_VERSION.tgz || exit 1
1270 gzcat $PORTAUDIO_VERSION.tgz | tar xf - || exit 1
1273 # Un-comment an include that's required on Lion.
1275 patch -p0 include/pa_mac_core.h <../../macosx-support-lib-patches/portaudio-pa_mac_core.h.patch
1277 # Fix a bug that showed up with clang (but is a bug with any
1280 patch -p0 src/hostapi/coreaudio/pa_mac_core.c <../../macosx-support-lib-patches/portaudio-pa_mac_core.c.patch
1282 # Disable fat builds - the configure script doesn't work right
1283 # with Xcode 4 if you leave them enabled, and we don't build
1284 # any other libraries fat (GLib, for example, would be very
1285 # hard to build fat), so there's no advantage to having PortAudio
1288 # Set the minimum OS X version to 10.4, to suppress some
1289 # deprecation warnings. (Good luck trying to make any of
1290 # this build on an OS+Xcode with a pre-10.4 SDK; we don't
1291 # worry about the user requesting that.)
1293 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
1294 make $MAKE_BUILD_OPTS || exit 1
1295 $DO_MAKE_INSTALL || exit 1
1297 touch portaudio-$PORTAUDIO_VERSION-done
1301 uninstall_portaudio() {
1302 if [ ! -z "$installed_portaudio_version" ] ; then
1303 echo "Uninstalling PortAudio:"
1305 $DO_MAKE_UNINSTALL || exit 1
1306 make distclean || exit 1
1308 rm portaudio-$installed_portaudio_version-done
1310 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1312 # Get rid of the previously downloaded and unpacked version.
1315 rm -rf $installed_portaudio_version.tgz
1318 installed_portaudio_version=""
1323 if [ "$GEOIP_VERSION" -a ! -f geoip-$GEOIP_VERSION-done ] ; then
1324 echo "Downloading, building, and installing GeoIP API:"
1325 [ -f GeoIP-$GEOIP_VERSION.tar.gz ] || curl -L -O http://geolite.maxmind.com/download/geoip/api/c/GeoIP-$GEOIP_VERSION.tar.gz || exit 1
1326 gzcat GeoIP-$GEOIP_VERSION.tar.gz | tar xf - || exit 1
1327 cd GeoIP-$GEOIP_VERSION
1328 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1330 # Grr. Their man pages "helpfully" have an ISO 8859-1
1331 # copyright symbol in the copyright notice, but OS X's
1332 # default character encoding is UTF-8. sed on Mountain
1333 # Lion barfs at the "illegal character sequence" represented
1334 # by an ISO 8859-1 copyright symbol, as it's not a valid
1337 # iconv the relevant man pages into UTF-8.
1339 for i in geoipupdate.1.in geoiplookup6.1.in geoiplookup.1.in
1341 iconv -f iso8859-1 -t utf-8 man/"$i" >man/"$i".tmp &&
1342 mv man/"$i".tmp man/"$i"
1344 make $MAKE_BUILD_OPTS || exit 1
1345 $DO_MAKE_INSTALL || exit 1
1347 touch geoip-$GEOIP_VERSION-done
1352 if [ ! -z "$installed_geoip_version" ] ; then
1353 echo "Uninstalling GeoIP API:"
1354 cd GeoIP-$installed_geoip_version
1355 $DO_MAKE_UNINSTALL || exit 1
1356 make distclean || exit 1
1358 rm geoip-$installed_geoip_version-done
1360 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1362 # Get rid of the previously downloaded and unpacked version.
1364 rm -rf GeoIP-$installed_geoip_version
1365 rm -rf GeoIP-$installed_geoip_version.tar.gz
1368 installed_geoip_version=""
1373 if [ "$CARES_VERSION" -a ! -f c-ares-$CARES_VERSION-done ] ; then
1374 echo "Downloading, building, and installing C-Ares API:"
1375 [ -f c-ares-$CARES_VERSION.tar.gz ] || curl -L -O http://c-ares.haxx.se/download/c-ares-$CARES_VERSION.tar.gz || exit 1
1376 gzcat c-ares-$CARES_VERSION.tar.gz | tar xf - || exit 1
1377 cd c-ares-$CARES_VERSION
1378 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1
1379 make $MAKE_BUILD_OPTS || exit 1
1380 $DO_MAKE_INSTALL || exit 1
1382 touch c-ares-$CARES_VERSION-done
1386 uninstall_c_ares() {
1387 if [ ! -z "$installed_cares_version" ] ; then
1388 echo "Uninstalling C-Ares API:"
1389 cd c-ares-$installed_cares_version
1390 $DO_MAKE_UNINSTALL || exit 1
1391 make distclean || exit 1
1393 rm c-ares-$installed_cares_version-done
1395 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1397 # Get rid of the previously downloaded and unpacked version.
1399 rm -rf c-ares-$installed_cares_version
1400 rm -rf c-ares-$installed_cares_version.tar.gz
1403 installed_cares_version=""
1409 # Check whether the versions we have installed are the versions
1410 # requested; if not, uninstall the installed versions.
1412 if [ ! -z "$installed_cares_version" -a \
1413 "$installed_cares_version" != "$CARES_VERSION" ] ; then
1414 echo "Installed C-Ares version is $installed_cares_version"
1415 if [ -z "$CARES_VERSION" ] ; then
1416 echo "C-Ares is not requested"
1418 echo "Requested C-Ares version is $CARES_VERSION"
1423 if [ ! -z "$installed_geoip_version" -a \
1424 "$installed_geoip_version" != "$GEOIP_VERSION" ] ; then
1425 echo "Installed GeoIP API version is $installed_geoip_version"
1426 if [ -z "$GEOIP_VERSION" ] ; then
1427 echo "GeoIP is not requested"
1429 echo "Requested GeoIP version is $GEOIP_VERSION"
1434 if [ ! -z "$installed_portaudio_version" -a \
1435 "$installed_portaudio_version" != "$PORTAUDIO_VERSION" ] ; then
1436 echo "Installed PortAudio version is $installed_portaudio_version"
1437 if [ -z "$PORTAUDIO_VERSION" ] ; then
1438 echo "PortAudio is not requested"
1440 echo "Requested PortAudio version is $PORTAUDIO_VERSION"
1442 uninstall_portaudio -r
1445 if [ ! -z "$installed_lua_version" -a \
1446 "$installed_lua_version" != "$LUA_VERSION" ] ; then
1447 echo "Installed Lua version is $installed_lua_version"
1448 if [ -z "$LUA_VERSION" ] ; then
1449 echo "Lua is not requested"
1451 echo "Requested Lua version is $LUA_VERSION"
1456 if [ ! -z "$installed_gnutls_version" -a \
1457 "$installed_gnutls_version" != "$GNUTLS_VERSION" ] ; then
1458 echo "Installed GnuTLS version is $installed_gnutls_version"
1459 if [ -z "$GNUTLS_VERSION" ] ; then
1460 echo "GnuTLS is not requested"
1462 echo "Requested GnuTLS version is $GNUTLS_VERSION"
1467 if [ ! -z "$installed_libgcrypt_version" -a \
1468 "$installed_libgcrypt_version" != "$LIBGCRYPT_VERSION" ] ; then
1469 echo "Installed libgcrypt version is $installed_libgcrypt_version"
1470 if [ -z "$LIBGCRYPT_VERSION" ] ; then
1471 echo "libgcrypt is not requested"
1473 echo "Requested libgcrypt version is $LIBGCRYPT_VERSION"
1475 uninstall_libgcrypt -r
1478 if [ ! -z "$installed_libgpg_error_version" -a \
1479 "$installed_libgpg_error_version" != "$LIBGPG_ERROR_VERSION" ] ; then
1480 echo "Installed libgpg-error version is $installed_libgpg_error_version"
1481 if [ -z "$LIBGPG_ERROR_VERSION" ] ; then
1482 echo "libgpg-error is not requested"
1484 echo "Requested libgpg-error version is $LIBGPG_ERROR_VERSION"
1486 uninstall_libgpg_error -r
1489 if [ ! -z "$installed_libsmi_version" -a \
1490 "$installed_libsmi_version" != "$LIBSMI_VERSION" ] ; then
1491 echo "Installed libsmi version is $installed_libsmi_version"
1492 if [ -z "$LIBSMI_VERSION" ] ; then
1493 echo "libsmi is not requested"
1495 echo "Requested libsmi version is $LIBSMI_VERSION"
1500 if [ ! -z "$installed_gtk_version" -a \
1501 "$installed_gtk_version" != "$GTK_VERSION" ] ; then
1502 echo "Installed GTK+ version is $installed_gtk_version"
1503 if [ -z "$GTK_VERSION" ] ; then
1504 echo "GTK+ is not requested"
1506 echo "Requested GTK+ version is $GTK_VERSION"
1511 if [ ! -z "$installed_gdk_pixbuf_version" -a \
1512 "$installed_gdk_pixbuf_version" != "$GDK_PIXBUF_VERSION" ] ; then
1513 echo "Installed gdk-pixbuf version is $installed_gdk_pixbuf_version"
1514 if [ -z "$GDK_PIXBUF_VERSION" ] ; then
1515 echo "gdk-pixbuf is not requested"
1517 echo "Requested gdk-pixbuf version is $GDK_PIXBUF_VERSION"
1519 uninstall_gdk_pixbuf -r
1522 if [ ! -z "$installed_pango_version" -a \
1523 "$installed_pango_version" != "$PANGO_VERSION" ] ; then
1524 echo "Installed Pango version is $installed_pango_version"
1525 if [ -z "$PANGO_VERSION" ] ; then
1526 echo "Pango is not requested"
1528 echo "Requested Pango version is $PANGO_VERSION"
1533 if [ ! -z "$installed_atk_version" -a \
1534 "$installed_atk_version" != "$ATK_VERSION" ] ; then
1535 echo "Installed ATK version is $installed_atk_version"
1536 if [ -z "$ATK_VERSION" ] ; then
1537 echo "ATK is not requested"
1539 echo "Requested ATK version is $ATK_VERSION"
1544 if [ ! -z "$installed_cairo_version" -a \
1545 "$installed_cairo_version" != "$CAIRO_VERSION" ] ; then
1546 echo "Installed Cairo version is $installed_cairo_version"
1547 if [ -z "$CAIRO_VERSION" ] ; then
1548 echo "Cairo is not requested"
1550 echo "Requested Cairo version is $CAIRO_VERSION"
1555 if [ ! -z "$installed_pixman_version" -a \
1556 "$installed_pixman_version" != "$PIXMAN_VERSION" ] ; then
1557 echo "Installed pixman version is $installed_pixman_version"
1558 if [ -z "$PIXMAN_VERSION" ] ; then
1559 echo "pixman is not requested"
1561 echo "Requested pixman version is $PIXMAN_VERSION"
1566 if [ ! -z "$installed_libpng_version" -a \
1567 "$installed_libpng_version" != "$PNG_VERSION" ] ; then
1568 echo "Installed libpng version is $installed_libpng_version"
1569 if [ -z "$PNG_VERSION" ] ; then
1570 echo "libpng is not requested"
1572 echo "Requested libpng version is $PNG_VERSION"
1577 if [ ! -z "$installed_qt_version" -a \
1578 "$installed_qt_version" != "$QT_VERSION" ] ; then
1579 echo "Installed Qt version is $installed_qt_version"
1580 if [ -z "$QT_VERSION" ] ; then
1581 echo "Qt is not requested"
1583 echo "Requested Qt version is $QT_VERSION"
1588 if [ ! -z "$installed_glib_version" -a \
1589 "$installed_glib_version" != "$GLIB_VERSION" ] ; then
1590 echo "Installed GLib version is $installed_glib_version"
1591 if [ -z "$GLIB_VERSION" ] ; then
1592 echo "GLib is not requested"
1594 echo "Requested GLib version is $GLIB_VERSION"
1599 if [ ! -z "$installed_pkg_config_version" -a \
1600 "$installed_pkg_config_version" != "$PKG_CONFIG_VERSION" ] ; then
1601 echo "Installed pkg-config version is $installed_pkg_config_version"
1602 if [ -z "$PKG_CONFIG_VERSION" ] ; then
1603 echo "pkg-config is not requested"
1605 echo "Requested pkg-config version is $PKG_CONFIG_VERSION"
1607 uninstall_pkg_config -r
1610 if [ ! -z "$installed_gettext_version" -a \
1611 "$installed_gettext_version" != "$GETTEXT_VERSION" ] ; then
1612 echo "Installed GNU gettext version is $installed_gettext_version"
1613 if [ -z "$GETTEXT_VERSION" ] ; then
1614 echo "GNU gettext is not requested"
1616 echo "Requested GNU gettext version is $GETTEXT_VERSION"
1618 uninstall_gettext -r
1621 if [ ! -z "$installed_cmake_version" -a \
1622 "$installed_cmake_version" != "$CMAKE_VERSION" ] ; then
1623 echo "Installed CMake version is $installed_cmake_version"
1624 if [ -z "$CMAKE_VERSION" ] ; then
1625 echo "CMake is not requested"
1627 echo "Requested CMake version is $CMAKE_VERSION"
1630 # XXX - really remove this?
1631 # Or should we remember it as installed only if this script
1637 if [ ! -z "$installed_libtool_version" -a \
1638 "$installed_libtool_version" != "$LIBTOOL_VERSION" ] ; then
1639 echo "Installed GNU libtool version is $installed_libtool_version"
1640 if [ -z "$LIBTOOL_VERSION" ] ; then
1641 echo "GNU libtool is not requested"
1643 echo "Requested GNU libtool version is $LIBTOOL_VERSION"
1645 uninstall_libtool -r
1648 if [ ! -z "$installed_automake_version" -a \
1649 "$installed_automake_version" != "$AUTOMAKE_VERSION" ] ; then
1650 echo "Installed GNU automake version is $installed_automake_version"
1651 if [ -z "$AUTOMAKE_VERSION" ] ; then
1652 echo "GNU automake is not requested"
1654 echo "Requested GNU automake version is $AUTOMAKE_VERSION"
1656 uninstall_automake -r
1659 if [ ! -z "$installed_autoconf_version" -a \
1660 "$installed_autoconf_version" != "$AUTOCONF_VERSION" ] ; then
1661 echo "Installed GNU autoconf version is $installed_autoconf_version"
1662 if [ -z "$AUTOCONF_VERSION" ] ; then
1663 echo "GNU autoconf is not requested"
1665 echo "Requested GNU autoconf version is $AUTOCONF_VERSION"
1667 uninstall_autoconf -r
1670 if [ ! -z "$installed_xz_version" -a \
1671 "$installed_xz_version" != "$XZ_VERSION" ] ; then
1672 echo "Installed xz version is $installed_xz_version"
1673 if [ -z "$XZ_VERSION" ] ; then
1674 echo "xz is not requested"
1676 echo "Requested xz version is $XZ_VERSION"
1682 # Start with xz: It is the sole download format of glib later than 2.31.2
1695 # Start with GNU gettext; GLib requires it, and OS X doesn't have it
1696 # or a BSD-licensed replacement.
1698 # At least on Lion with Xcode 4, _FORTIFY_SOURCE gets defined as 2
1699 # by default, which causes, for example, stpncpy to be defined as
1700 # a hairy macro that collides with the GNU gettext configure script's
1701 # attempts to workaround AIX's lack of a declaration for stpncpy,
1702 # with the result being a huge train wreck. Define _FORTIFY_SOURCE
1703 # as 0 in an attempt to keep the trains on separate tracks.
1708 # GLib depends on pkg-config.
1709 # By default, pkg-config depends on GLib; we break the dependency cycle
1710 # by configuring pkg-config to use its own internal version of GLib.
1717 # Now we have reached a point where we can build everything but
1718 # the GUI (Wireshark).
1722 if [ "$GTK_VERSION" ]; then
1724 # GTK+ 3 requires a newer Cairo build than the one that comes with
1725 # 10.6, so we build Cairo if we are using GTK+ 3.
1727 # In 10.6 and 10.7, it's an X11 library; if we build with "native" GTK+
1728 # rather than X11 GTK+, we might have to build and install Cairo.
1729 # In 10.8 and later, there is no X11, but it's included in Xquartz;
1730 # again, if we build with "native" GTK+, we'd have to build and install
1733 if [[ "$GTK_MAJOR_VERSION" -eq 3 || "$cairo_not_in_the_os" = yes ]]; then
1735 # Requirements for Cairo first
1737 # The libpng that comes with the X11 for Leopard has a bogus
1738 # pkg-config file that lies about where the header files are,
1739 # which causes other packages not to be able to find its
1742 # The libpng in later versions is not what the version of
1743 # libpixman we build below wants - it wants libpng15.
1748 # The libpixman versions that come with the X11s for Leopard,
1749 # Snow Leopard, and Lion is too old to support Cairo's image
1750 # surface backend feature (which requires pixman-1 >= 0.22.0).
1752 # XXX - what about the one that comes with the latest version
1758 # And now Cairo itself.
1759 # XXX - with the libxcb that comes with 10.6,
1760 # xcb_discard_reply() is missing, and the build fails.
1775 # Now we have reached a point where we can build everything including
1776 # the GUI (Wireshark), but not with any optional features such as
1777 # SNMP OID resolution, some forms of decryption, Lua scripting, playback
1778 # of audio, or GeoIP mapping of IP addresses.
1780 # We now conditionally download optional libraries to support them;
1781 # the default is to download them all.
1786 install_libgpg_error
1802 if [ -d macosx-support-libs ]
1804 cd macosx-support-libs
1807 # Uninstall items in the reverse order from the order in which they're
1808 # installed. Only uninstall if the download/build/install process
1809 # completed; uninstall the version that appears in the name of
1812 # We also do a "make distclean", so that we don't have leftovers from
1813 # old configurations.
1827 uninstall_libgpg_error
1833 uninstall_gdk_pixbuf
1849 uninstall_pkg_config
1854 # XXX - really remove this?
1855 # Or should we remember it as installed only if this script
1871 # Do we have permission to write in /usr/local?
1873 # If so, assume we have permission to write in its subdirectories.
1874 # (If that's not the case, this test needs to check the subdirectories
1877 # If not, do "make install", "make uninstall", the removes for Lua,
1878 # and the renames of [g]libtool* with sudo.
1880 if [ -w /usr/local ]
1882 DO_MAKE_INSTALL="make install"
1883 DO_MAKE_UNINSTALL="make uninstall"
1887 DO_MAKE_INSTALL="sudo make install"
1888 DO_MAKE_UNINSTALL="sudo make uninstall"
1894 # If we have SDKs available, the default target OS is the major version
1895 # of the one we're running; get that and strip off the third component
1898 for i in /Developer/SDKs \
1899 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
1900 /Library/Developer/CommandLineTools/SDKs
1904 min_osx_target=`sw_vers -productVersion | sed 's/\([0-9]*\)\.\([0-9]*\)\.[0-9]*/\1.\2/'`
1907 # That's also the OS whose SDK we'd be using.
1909 sdk_target=$min_osx_target
1915 # Parse command-line flags:
1918 # -t <target> - build libraries so that they'll work on the specified
1919 # version of OS X and later versions.
1920 # -u - do an uninstall.
1922 while getopts ht:u name
1929 min_osx_target="$OPTARG"
1932 echo "Usage: macosx-setup.sh [ -t <target> ] [ -u ]" 1>&1
1939 # Get the version numbers of installed packages, if any.
1941 if [ -d macosx-support-libs ]
1943 cd macosx-support-libs
1945 installed_xz_version=`ls xz-*-done 2>/dev/null | sed 's/xz-\(.*\)-done/\1/'`
1946 installed_autoconf_version=`ls autoconf-*-done 2>/dev/null | sed 's/autoconf-\(.*\)-done/\1/'`
1947 installed_automake_version=`ls automake-*-done 2>/dev/null | sed 's/automake-\(.*\)-done/\1/'`
1948 installed_libtool_version=`ls libtool-*-done 2>/dev/null | sed 's/libtool-\(.*\)-done/\1/'`
1949 installed_cmake_version=`ls cmake-*-done 2>/dev/null | sed 's/cmake-\(.*\)-done/\1/'`
1950 installed_gettext_version=`ls gettext-*-done 2>/dev/null | sed 's/gettext-\(.*\)-done/\1/'`
1951 installed_pkg_config_version=`ls pkg-config-*-done 2>/dev/null | sed 's/pkg-config-\(.*\)-done/\1/'`
1952 installed_glib_version=`ls glib-*-done 2>/dev/null | sed 's/glib-\(.*\)-done/\1/'`
1953 installed_qt_version=`ls qt-*-done 2>/dev/null | sed 's/qt-\(.*\)-done/\1/'`
1954 installed_libpng_version=`ls libpng-*-done 2>/dev/null | sed 's/libpng-\(.*\)-done/\1/'`
1955 installed_pixman_version=`ls pixman-*-done 2>/dev/null | sed 's/pixman-\(.*\)-done/\1/'`
1956 installed_cairo_version=`ls cairo-*-done 2>/dev/null | sed 's/cairo-\(.*\)-done/\1/'`
1957 installed_atk_version=`ls atk-*-done 2>/dev/null | sed 's/atk-\(.*\)-done/\1/'`
1958 installed_pango_version=`ls pango-*-done 2>/dev/null | sed 's/pango-\(.*\)-done/\1/'`
1959 installed_gdk_pixbuf_version=`ls gdk-pixbuf-*-done 2>/dev/null | sed 's/gdk-pixbuf-\(.*\)-done/\1/'`
1960 installed_gtk_version=`ls gtk+-*-done 2>/dev/null | sed 's/gtk+-\(.*\)-done/\1/'`
1961 installed_libsmi_version=`ls libsmi-*-done 2>/dev/null | sed 's/libsmi-\(.*\)-done/\1/'`
1962 installed_libgpg_error_version=`ls libgpg-error-*-done 2>/dev/null | sed 's/libgpg-error-\(.*\)-done/\1/'`
1963 installed_libgcrypt_version=`ls libgcrypt-*-done 2>/dev/null | sed 's/libgcrypt-\(.*\)-done/\1/'`
1964 installed_gnutls_version=`ls gnutls-*-done 2>/dev/null | sed 's/gnutls-\(.*\)-done/\1/'`
1965 installed_lua_version=`ls lua-*-done 2>/dev/null | sed 's/lua-\(.*\)-done/\1/'`
1966 installed_portaudio_version=`ls portaudio-*-done 2>/dev/null | sed 's/portaudio-\(.*\)-done/\1/'`
1967 installed_geoip_version=`ls geoip-*-done 2>/dev/null | sed 's/geoip-\(.*\)-done/\1/'`
1968 installed_cares_version=`ls c-ares-*-done 2>/dev/null | sed 's/c-ares-\(.*\)-done/\1/'`
1971 # If we don't have a versioned -done file for portaudio, but do have
1972 # an unversioned -done file for it, assume the installed version is the
1973 # requested version, and rename the -done file to include that version.
1975 if [ -z "$installed_portaudio_version" -a -f portaudio-done ] ; then
1976 mv portaudio-done portaudio-$PORTAUDIO_VERSION-done
1977 installed_portaudio_version=`ls portaudio-*-done 2>/dev/null | sed 's/portaudio-\(.*\)-done/\1/'`
1983 if [ "$do_uninstall" = "yes" ]
1990 # Configure scripts tend to set CFLAGS and CXXFLAGS to "-g -O2" if
1991 # invoked without CFLAGS or CXXFLAGS being set in the environment.
1993 # However, we *are* setting them in the environment, for our own
1994 # nefarious purposes, so start them out as "-g -O2".
2000 # To make this work on Leopard (rather than working *on* Snow Leopard
2001 # when building *for* Leopard) will take more work.
2003 # For one thing, Leopard's /usr/X11/lib/libXdamage.la claims, at least
2004 # with all software updates applied, that the Xdamage shared library
2005 # is libXdamage.1.0.0.dylib, but it is, in fact, libXdamage.1.1.0.dylib.
2006 # This causes problems when building GTK+, so the script would have to
2009 if [[ $DARWIN_MAJOR_VERSION -le 9 ]]; then
2010 echo "This script does not support any versions of OS X before Snow Leopard" 1>&2
2014 # if no make options are present, set default options
2015 if [ -z "$MAKE_BUILD_OPTS" ] ; then
2016 # by default use 1.5x number of cores for parallel build
2017 MAKE_BUILD_OPTS="-j $(( $(sysctl -n hw.logicalcpu) * 3 / 2))"
2021 # If we have a target release, look for the oldest SDK that's for an
2022 # OS equal to or later than that one, and build libraries against it
2023 # rather than against the headers and, more importantly, libraries
2024 # that come with the OS, so that we don't end up with support libraries
2025 # that only work on the OS version on which we built them, not earlier
2026 # versions of the same release, or earlier releases if the minimum is
2029 if [ ! -z "$min_osx_target" ]
2032 # Get the real version - strip off the "10.".
2033 # We'll worry about that if, as, and when there's ever
2036 deploy_real_version=`echo "$min_osx_target" | sed -n 's/10\.\(.*\)/\1/p'`
2039 # Search each directory that might contain SDKs.
2042 for sdksdir in /Developer/SDKs \
2043 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
2044 /Library/Developer/CommandLineTools/SDKs
2047 # Get a list of all the SDKs.
2049 if ! test -d "$sdksdir"
2052 # There is no directory with that name.
2053 # Move on to the next one in the list, if any.
2059 # Get a list of all the SDKs in that directory, if any.
2061 sdklist=`(cd "$sdksdir"; ls -d MacOSX10.[0-9]*.sdk 2>/dev/null)`
2066 # Get the real version for this SDK.
2068 sdk_real_version=`echo "$sdk" | sed -n 's/MacOSX10\.\(.*\)\.sdk/\1/p'`
2071 # Is it for the deployment target or some later release?
2073 if test "$sdk_real_version" -ge "$deploy_real_version"
2078 sdkpath="$sdksdir/$sdk"
2079 qt_sdk_arg="-sdk $sdk"
2085 if [ -z "$sdkpath" ]
2087 echo "macosx-setup.sh: Couldn't find an SDK for OS X $min_osx_target or later" 1>&2
2092 sdk_target=10.$sdk_real_version
2093 echo "Using the 10.$sdk_real_version SDK"
2096 # Make sure there are links to /usr/local/include and /usr/local/lib
2097 # in the SDK's usr/local.
2099 if [ ! -e $SDKPATH/usr/local/include ]
2101 if [ ! -d $SDKPATH/usr/local ]
2103 sudo mkdir $SDKPATH/usr/local
2105 sudo ln -s /usr/local/include $SDKPATH/usr/local/include
2107 if [ ! -e $SDKPATH/usr/local/lib ]
2109 if [ ! -d $SDKPATH/usr/local ]
2111 sudo mkdir $SDKPATH/usr/local
2113 sudo ln -s /usr/local/lib $SDKPATH/usr/local/lib
2117 # Set the minimum OS version for which to build to the specified
2118 # minimum target OS version, so we don't, for example, end up using
2119 # linker features supported by the OS verson on which we're building
2120 # but not by the target version.
2122 VERSION_MIN_FLAGS="-mmacosx-version-min=$min_osx_target"
2125 # Compile and link against the SDK.
2127 SDKFLAGS="-isysroot $SDKPATH"
2129 if [[ "$min_osx_target" == "10.5" ]]
2132 # Cairo is part of Mac OS X 10.6 and later.
2133 # The *headers* are supplied by 10.5, but the *libraries*
2134 # aren't, so we have to build it if we're building for 10.5.
2136 cairo_not_in_the_os=yes
2139 # Build with older versions of the support libraries, as
2140 # were used on the Wireshark Leopard buildbot at one
2141 # point. (Most of these versions come from the About page
2142 # from Wireshark 1.8.6, the last build done on that buildbot;
2143 # the ATK version isn't reported, so this is a guess.)
2145 # If you want to try building with newer versions of
2146 # the libraries, note that:
2148 # The version of fontconfig that comes with Leopard doesn't
2149 # support FC_WEIGHT_EXTRABLACK, so we can't use any version
2150 # of Pango newer than 1.22.4.
2152 # However, Pango 1.22.4 doesn't work with versions of GLib
2153 # after 2.29.6, because Pango 1.22.4 uses G_CONST_RETURN and
2154 # GLib 2.29.8 and later deprecate it (there doesn't appear to
2155 # be a GLib 2.29.7). That means we'd either have to patch
2156 # Pango not to use it (just use "const"; G_CONST_RETURN was
2157 # there to allow code to choose whether to use "const" or not),
2158 # or use GLib 2.29.6 or earlier.
2160 # GLib 2.29.6 includes an implementation of g_bit_lock() that,
2161 # on x86 (32-bit and 64-bit), uses asms in a fashion
2162 # ("asm volatile goto") that requires GCC 4.5 or later, which
2163 # is later than the compilers that come with Leopard and Snow
2164 # Leopard. Recent versions of GLib check for that, but 2.29.6
2165 # doesn't, so, if you want to build GLib 2.29.6 on Leopard or
2166 # Snow Leopard, you would have to patch glib/gbitlock.c to do
2167 # what the newer versions of GLib do:
2169 # define a USE_ASM_GOTO macro that indicates whether "asm goto"
2171 # #if (defined (i386) || defined (__amd64__))
2172 # #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
2173 # #define USE_ASM_GOTO 1
2177 # replace all occurrences of
2179 # #if defined (__GNUC__) && (defined (i386) || defined (__amd64__))
2183 # #ifdef USE_ASM_GOTO
2185 # Using GLib 2.29.6 or earlier, however, means that we can't
2186 # use a version of ATK later than 2.3.93, as those versions
2187 # don't work with GLib 2.29.6. The same applies to gdk-pixbuf;
2188 # versions of gdk-pixbuf after 2.24.1 won't work with GLib
2191 # Then you have to make sure that what you've build doesn't
2192 # cause the X server that comes with Leopard to crash; at
2193 # least one attempt at building for Leopard did.
2195 # At least if building on Leopard, you might also find
2196 # that, with various older versions of Cairo, including
2197 # 1.6.4 and at least some 1.8.x versions, when you try to
2198 # build it, the build fails because it can't find
2199 # png_set_longjmp_fn(). I vaguely remember dealing with that,
2200 # ages ago, but don't remember what I did.
2205 PANGO_VERSION=1.20.2
2209 # That version of GTK+ includes gdk-pixbuf.
2210 # XXX - base this on the version of GTK+ requested.
2215 # Libgcrypt 1.5.0 fails to compile due to some problem with an
2216 # asm in rijndael.c, at least with i686-apple-darwin10-gcc-4.2.1
2217 # (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) when building
2220 # We try libgcrypt 1.4.3 instead, as that's what shows up in
2221 # the version from the Leopard buildbot.
2222 LIBGCRYPT_VERSION=1.4.3
2225 # Build 32-bit while we're at it; Leopard has a bug that
2226 # causes some BPF functions not to work with 64-bit userland
2227 # code, so capturing won't work.
2229 CFLAGS="$CFLAGS -arch i386"
2230 CXXFLAGS="$CXXFLAGS -arch i386"
2231 export LDFLAGS="$LDFLAGS -arch i386"
2239 # You need Xcode or the command-line tools installed to get the compilers.
2241 if [ ! -x /usr/bin/xcodebuild ]; then
2242 echo "Please install Xcode first (should be available on DVD or from http://developer.apple.com/xcode/index.php)."
2246 if [ "$QT_VERSION" ]; then
2248 # We need Xcode, not just the command-line tools, installed to build
2251 if ! /usr/bin/xcrun -find xcrun >/dev/null 2>&1; then
2252 echo "Please install Xcode first (should be available on DVD or from http://developer.apple.com/xcode/index.php)."
2253 echo "The command-line build tools are not sufficient to build Qt."
2257 if [ "$GTK_VERSION" ]; then
2259 # If we're building with GTK+, you also need the X11 SDK; with at least
2260 # some versions of OS X and Xcode, that is, I think, an optional install.
2261 # (Or it might be installed with X11, but I think *that* is an optional
2262 # install on at least some versions of OS X.)
2264 if [ ! -d /usr/X11/include ]; then
2265 echo "Please install X11 and the X11 SDK first."
2266 echo " You can either use http://xquartz.macosforge.org/, e.g."
2267 echo " http://xquartz-dl.macosforge.org/SL/XQuartz-$XQUARTZ_VERSION.dmg"
2268 echo " or the native Apple packages if you are on Lion or below."
2273 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig
2276 # Do all the downloads and untarring in a subdirectory, so all that
2277 # stuff can be removed once we've installed the support libraries.
2279 if [ ! -d macosx-support-libs ]
2281 mkdir macosx-support-libs || exit 1
2283 cd macosx-support-libs
2290 # Indicate what paths to use for pkg-config and cmake.
2292 pkg_config_path=/usr/local/lib/pkgconfig
2293 if [ "$QT_VERSION" ]; then
2294 qt_base_path=$HOME/Qt$QT_VERSION/$QT_MAJOR_MINOR_VERSION/clang_64
2295 pkg_config_path="$pkg_config_path":"$qt_base_path/clang_64/lib/pkgconfig"
2296 CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH":"$qt_base_path/lib/cmake"
2298 pkg_config_path="$pkg_config_path":/usr/X11/lib/pkgconfig
2300 echo "You are now prepared to build Wireshark. To do so do:"
2301 echo "export PKG_CONFIG_PATH=$pkg_config_path"
2303 if [ -n "$CMAKE" ]; then
2304 echo "export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH
2305 echo "export PATH=$PATH:$qt_base_path/bin
2306 echo "mkdir build; cd build"
2308 echo "make $MAKE_BUILD_OPTS app_bundle"
2309 echo "make install/strip
2315 echo "mkdir build; cd build"
2317 echo "make $MAKE_BUILD_OPTS"
2322 echo "Make sure you are allowed capture access to the network devices"
2323 echo "See: https://wiki.wireshark.org/CaptureSetup/CapturePrivileges"