1#!/bin/bash 2# Setup development environment on macOS (tested with 10.6.8 and Xcode 3# 3.2.6 and with 10.12.4 and Xcode 8.3). 4# 5# Copyright 2011 Michael Tuexen, Joerg Mayer, Guy Harris (see AUTHORS file) 6# 7# Wireshark - Network traffic analyzer 8# By Gerald Combs <gerald@wireshark.org> 9# Copyright 1998 Gerald Combs 10# 11# SPDX-License-Identifier: GPL-2.0-or-later 12 13shopt -s extglob 14 15# 16# Get the major version of Darwin, so we can check the major macOS 17# version. 18# 19DARWIN_MAJOR_VERSION=`uname -r | sed 's/\([0-9]*\).*/\1/'` 20 21# 22# The minimum supported version of Qt is 5.6, so the minimum supported version 23# of macOS is OS X 10.8 (Mountain Lion), aka Darwin 12.0 24if [[ $DARWIN_MAJOR_VERSION -lt 12 ]]; then 25 echo "This script does not support any versions of macOS before Mountain Lion" 1>&2 26 exit 1 27fi 28 29# 30# Get the processor architecture of Darwin. Currently supported: arm, i386 31# 32DARWIN_PROCESSOR_ARCH=`uname -p` 33 34if [ "$DARWIN_PROCESSOR_ARCH" != "arm" -a "$DARWIN_PROCESSOR_ARCH" != "i386" ]; then 35 echo "This script does not support this processor architecture" 1>&2 36 exit 1 37fi 38 39# 40# Versions of packages to download and install. 41# 42 43# 44# We use curl, but older versions of curl in older macOS releases can't 45# handle some sites - including the xz site. 46# 47# If the version of curl in the system is older than 7.54.0, download 48# curl and install it. 49# 50current_curl_version=`curl --version | sed -n 's/curl \([0-9.]*\) .*/\1/p'` 51current_curl_major_version="`expr $current_curl_version : '\([0-9][0-9]*\).*'`" 52current_curl_minor_version="`expr $current_curl_version : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`" 53if [[ $current_curl_major_version -lt 7 || 54 ($current_curl_major_version -eq 7 && 55 $current_curl_minor_version -lt 54) ]]; then 56 CURL_VERSION=${CURL_VERSION-7.60.0} 57fi 58 59# 60# Some packages need xz to unpack their current source. 61# While tar, since macOS 10.9, can uncompress xz'ed tarballs, 62# it can't do so in older versions, and xz isn't provided with macOS. 63# 64XZ_VERSION=5.2.5 65 66# 67# Some packages need lzip to unpack their current source. 68# 69LZIP_VERSION=1.21 70 71# 72# The version of libPCRE on Catalina is insufficient to build glib due to 73# missing UTF-8 support. 74# 75PCRE_VERSION=8.44 76 77# 78# CMake is required to do the build - and to build some of the 79# dependencies. 80# 81# 3.19.2 is the first version to support Apple Silicon, but the precompiled 82# binary on cmake.org is only a universal binary that requires macOS 10.0 83# (Yosemite) or newer. 84# 85# So on Mountain Lion and Mavericks we choose the last stable release that 86# works on them (3.18.6), and on Yosemite and later we choose the latest stable 87# version (currently 3.19.7). 88# 89if [[ $DARWIN_MAJOR_VERSION -gt 13 ]]; then 90 CMAKE_VERSION=${CMAKE_VERSION-3.19.7} 91else 92 CMAKE_VERSION=${CMAKE_VERSION-3.18.6} 93fi 94 95# 96# Ninja isn't required, as make is provided with Xcode, but it is 97# claimed to build faster than make. 98# Comment it out if you don't want it. 99# 100NINJA_VERSION=${NINJA_VERSION-1.10.2} 101 102# 103# The following libraries and tools are required even to build only TShark. 104# 105GETTEXT_VERSION=0.21 106GLIB_VERSION=2.68.4 107if [ "$GLIB_VERSION" ]; then 108 GLIB_MAJOR_VERSION="`expr $GLIB_VERSION : '\([0-9][0-9]*\).*'`" 109 GLIB_MINOR_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`" 110 GLIB_DOTDOT_VERSION="`expr $GLIB_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`" 111 GLIB_MAJOR_MINOR_VERSION=$GLIB_MAJOR_VERSION.$GLIB_MINOR_VERSION 112 GLIB_MAJOR_MINOR_DOTDOT_VERSION=$GLIB_MAJOR_VERSION.$GLIB_MINOR_VERSION.$GLIB_DOTDOT_VERSION 113fi 114PKG_CONFIG_VERSION=0.29.2 115# 116# libgpg-error is required for libgcrypt. 117# 118LIBGPG_ERROR_VERSION=1.39 119# 120# libgcrypt is required. 121# 122LIBGCRYPT_VERSION=1.8.7 123 124# 125# One or more of the following libraries are required to build Wireshark. 126# 127# To override the version of Qt call the script with some of the variables 128# set to the new values. Setting the variable to empty will disable building 129# the toolkit and will uninstall # any version previously installed by the 130# script, e.g. 131# "QT_VERSION=5.10.1 ./macos-setup.sh" 132# will build and install with QT 5.10.1. 133# 134QT_VERSION=${QT_VERSION-5.12.10} 135 136if [ "$QT_VERSION" ]; then 137 QT_MAJOR_VERSION="`expr $QT_VERSION : '\([0-9][0-9]*\).*'`" 138 QT_MINOR_VERSION="`expr $QT_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`" 139 QT_DOTDOT_VERSION="`expr $QT_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`" 140 QT_MAJOR_MINOR_VERSION=$QT_MAJOR_VERSION.$QT_MINOR_VERSION 141 QT_MAJOR_MINOR_DOTDOT_VERSION=$QT_MAJOR_VERSION.$QT_MINOR_VERSION.$QT_DOTDOT_VERSION 142fi 143 144# 145# The following libraries are optional. 146# Comment them out if you don't want them, but note that some of 147# the optional libraries are required by other optional libraries. 148# 149LIBSMI_VERSION=0.4.8 150GNUTLS_VERSION=3.6.15 151if [ "$GNUTLS_VERSION" ]; then 152 # 153 # We'll be building GnuTLS, so we may need some additional libraries. 154 # We assume GnuTLS can work with Nettle; newer versions *only* use 155 # Nettle, not libgcrypt. 156 # 157 GNUTLS_MAJOR_VERSION="`expr $GNUTLS_VERSION : '\([0-9][0-9]*\).*'`" 158 GNUTLS_MINOR_VERSION="`expr $GNUTLS_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`" 159 NETTLE_VERSION=3.6 160 161 # 162 # And, in turn, Nettle requires GMP. 163 # 164 GMP_VERSION=6.2.1 165 166 # 167 # And p11-kit 168 P11KIT_VERSION=0.23.21 169 170 # Which requires libtasn1 171 LIBTASN1_VERSION=4.16.0 172fi 173# Use 5.2.4, not 5.3, for now; lua_bitop.c hasn't been ported to 5.3 174# yet, and we need to check for compatibility issues (we'd want Lua 175# scripts to work with 5.1, 5.2, and 5.3, as long as they only use Lua 176# features present in all three versions) 177LUA_VERSION=5.2.4 178SNAPPY_VERSION=1.1.8 179ZSTD_VERSION=1.4.2 180LIBXML2_VERSION=2.9.9 181LZ4_VERSION=1.9.2 182SBC_VERSION=1.3 183CARES_VERSION=1.15.0 184LIBSSH_VERSION=0.9.0 185# mmdbresolve 186MAXMINDDB_VERSION=1.4.3 187NGHTTP2_VERSION=1.39.2 188SPANDSP_VERSION=0.0.6 189SPEEXDSP_VERSION=1.2.0 190if [ "$SPANDSP_VERSION" ]; then 191 # 192 # SpanDSP depends on libtiff. 193 # 194 LIBTIFF_VERSION=3.8.1 195fi 196BCG729_VERSION=1.0.2 197ILBC_VERSION=2.0.2 198OPUS_VERSION=1.3.1 199 200# 201# Is /usr/bin/python3 a working version of Python? It may be, as it 202# might be a wrapper that runs the Python 3 that's part of Xcode. 203# 204if /usr/bin/python3 --version >/dev/null 2>&1 205then 206 # 207 # Yes - don't bother installing Python 3 from elsewhere 208 # 209 : 210else 211 # 212 # No - install a Python package. 213 # 214 # 3.7.6 is the final version of Python to have official packages for the 215 # 64-bit/32-bit variant that supports 10.6 (Snow Leopard) through 10.8 216 # (Mountain Lion), and 3.9.1 is the first version of Python to support 217 # macOS 11 Big Sur and Apple Silicon (Arm-based Macs). 218 # 219 # So on Mountain Lion, choose 3.7.6, otherwise get the latest stable 220 # version (3.9.5). 221 # 222 if [[ $DARWIN_MAJOR_VERSION -gt 12 ]]; then 223 PYTHON3_VERSION=3.9.5 224 else 225 PYTHON3_VERSION=3.7.6 226 fi 227fi 228BROTLI_VERSION=1.0.9 229# minizip 230ZLIB_VERSION=1.2.11 231# Uncomment to enable automatic updates using Sparkle 232#SPARKLE_VERSION=1.26.0 233 234# 235# Asciidoctor is required to build the documentation. 236# 237ASCIIDOCTOR_VERSION=${ASCIIDOCTOR_VERSION-2.0.10} 238ASCIIDOCTORPDF_VERSION=${ASCIIDOCTORPDF_VERSION-1.5.0.beta.5} 239 240# 241# GNU autotools; they're provided with releases up to Snow Leopard, but 242# not in later releases, and the Snow Leopard version is too old for 243# current Wireshark, so we install them unconditionally. 244# 245AUTOCONF_VERSION=2.69 246AUTOMAKE_VERSION=1.15 247LIBTOOL_VERSION=2.4.6 248 249install_curl() { 250 if [ "$CURL_VERSION" -a ! -f curl-$CURL_VERSION-done ] ; then 251 echo "Downloading, building, and installing curl:" 252 [ -f curl-$CURL_VERSION.tar.bz2 ] || curl -L -O https://curl.haxx.se/download/curl-$CURL_VERSION.tar.bz2 || exit 1 253 $no_build && echo "Skipping installation" && return 254 bzcat curl-$CURL_VERSION.tar.bz2 | tar xf - || exit 1 255 cd curl-$CURL_VERSION 256 ./configure || exit 1 257 make $MAKE_BUILD_OPTS || exit 1 258 $DO_MAKE_INSTALL || exit 1 259 cd .. 260 touch curl-$CURL_VERSION-done 261 fi 262} 263 264uninstall_curl() { 265 if [ ! -z "$installed_curl_version" ] ; then 266 echo "Uninstalling curl:" 267 cd curl-$installed_curl_version 268 $DO_MAKE_UNINSTALL || exit 1 269 make distclean || exit 1 270 cd .. 271 rm curl-$installed_curl_version-done 272 273 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 274 # 275 # Get rid of the previously downloaded and unpacked version. 276 # 277 rm -rf curl-$installed_curl_version 278 rm -rf curl-$installed_curl_version.tar.bz2 279 fi 280 281 installed_curl_version="" 282 fi 283} 284 285install_xz() { 286 if [ "$XZ_VERSION" -a ! -f xz-$XZ_VERSION-done ] ; then 287 echo "Downloading, building, and installing xz:" 288 [ -f xz-$XZ_VERSION.tar.bz2 ] || curl -L -O http://tukaani.org/xz/xz-$XZ_VERSION.tar.bz2 || exit 1 289 $no_build && echo "Skipping installation" && return 290 bzcat xz-$XZ_VERSION.tar.bz2 | tar xf - || exit 1 291 cd xz-$XZ_VERSION 292 # 293 # This builds and installs liblzma, which libxml2 uses, and 294 # Wireshark uses liblzma, so we need to build this with 295 # all the minimum-deployment-version and SDK stuff. 296 # 297 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0 $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1 298 make $MAKE_BUILD_OPTS || exit 1 299 $DO_MAKE_INSTALL || exit 1 300 cd .. 301 touch xz-$XZ_VERSION-done 302 fi 303} 304 305uninstall_xz() { 306 if [ ! -z "$installed_xz_version" ] ; then 307 echo "Uninstalling xz:" 308 cd xz-$installed_xz_version 309 $DO_MAKE_UNINSTALL || exit 1 310 make distclean || exit 1 311 cd .. 312 rm xz-$installed_xz_version-done 313 314 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 315 # 316 # Get rid of the previously downloaded and unpacked version. 317 # 318 rm -rf xz-$installed_xz_version 319 rm -rf xz-$installed_xz_version.tar.bz2 320 fi 321 322 installed_xz_version="" 323 fi 324} 325 326install_lzip() { 327 if [ "$LZIP_VERSION" -a ! -f lzip-$LZIP_VERSION-done ] ; then 328 echo "Downloading, building, and installing lzip:" 329 [ -f lzip-$LZIP_VERSION.tar.gz ] || curl -L -O http://download.savannah.gnu.org/releases/lzip/lzip-$LZIP_VERSION.tar.gz || exit 1 330 $no_build && echo "Skipping installation" && return 331 gzcat lzip-$LZIP_VERSION.tar.gz | tar xf - || exit 1 332 cd lzip-$LZIP_VERSION 333 ./configure || exit 1 334 make $MAKE_BUILD_OPTS || exit 1 335 $DO_MAKE_INSTALL || exit 1 336 cd .. 337 touch lzip-$LZIP_VERSION-done 338 fi 339} 340 341uninstall_lzip() { 342 if [ ! -z "$installed_lzip_version" ] ; then 343 echo "Uninstalling lzip:" 344 cd lzip-$installed_lzip_version 345 $DO_MAKE_UNINSTALL || exit 1 346 make distclean || exit 1 347 cd .. 348 rm lzip-$installed_lzip_version-done 349 350 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 351 # 352 # Get rid of the previously downloaded and unpacked version. 353 # 354 rm -rf lzip-$installed_lzip_version 355 rm -rf lzip-$installed_lzip_version.tar.gz 356 fi 357 358 installed_lzip_version="" 359 fi 360} 361 362install_pcre() { 363 if [ "$PCRE_VERSION" -a ! -f pcre-$PCRE_VERSION-done ] ; then 364 echo "Downloading, building, and installing pcre:" 365 [ -f pcre-$PCRE_VERSION.tar.bz2 ] || curl -L -O https://ftp.pcre.org/pub/pcre/pcre-$PCRE_VERSION.tar.bz2 || exit 1 366 $no_build && echo "Skipping installation" && return 367 bzcat pcre-$PCRE_VERSION.tar.bz2 | tar xf - || exit 1 368 cd pcre-$PCRE_VERSION 369 ./configure --enable-unicode-properties || exit 1 370 make $MAKE_BUILD_OPTS || exit 1 371 $DO_MAKE_INSTALL || exit 1 372 cd .. 373 touch pcre-$PCRE_VERSION-done 374 fi 375} 376 377uninstall_pcre() { 378 if [ ! -z "$installed_pcre_version" ] ; then 379 echo "Uninstalling pcre:" 380 cd pcre-$installed_pcre_version 381 $DO_MAKE_UNINSTALL || exit 1 382 make distclean || exit 1 383 cd .. 384 rm pcre-$installed_pcre_version-done 385 386 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 387 # 388 # Get rid of the previously downloaded and unpacked version. 389 # 390 rm -rf pcre-$installed_pcre_version 391 rm -rf pcre-$installed_pcre_version.tar.bz2 392 fi 393 394 installed_pcre_version="" 395 fi 396} 397 398install_autoconf() { 399 if [ "$AUTOCONF_VERSION" -a ! -f autoconf-$AUTOCONF_VERSION-done ] ; then 400 echo "Downloading, building and installing GNU autoconf..." 401 [ -f autoconf-$AUTOCONF_VERSION.tar.xz ] || curl -L -O ftp://ftp.gnu.org/gnu/autoconf/autoconf-$AUTOCONF_VERSION.tar.xz || exit 1 402 $no_build && echo "Skipping installation" && return 403 xzcat autoconf-$AUTOCONF_VERSION.tar.xz | tar xf - || exit 1 404 cd autoconf-$AUTOCONF_VERSION 405 ./configure || exit 1 406 make $MAKE_BUILD_OPTS || exit 1 407 $DO_MAKE_INSTALL || exit 1 408 cd .. 409 touch autoconf-$AUTOCONF_VERSION-done 410 fi 411} 412 413uninstall_autoconf() { 414 if [ ! -z "$installed_autoconf_version" ] ; then 415 # 416 # automake and libtool depend on this, so uninstall them. 417 # 418 uninstall_libtool "$@" 419 uninstall_automake "$@" 420 421 echo "Uninstalling GNU autoconf:" 422 cd autoconf-$installed_autoconf_version 423 $DO_MAKE_UNINSTALL || exit 1 424 make distclean || exit 1 425 cd .. 426 rm autoconf-$installed_autoconf_version-done 427 428 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 429 # 430 # Get rid of the previously downloaded and unpacked version. 431 # 432 rm -rf autoconf-$installed_autoconf_version 433 rm -rf autoconf-$installed_autoconf_version.tar.xz 434 fi 435 436 installed_autoconf_version="" 437 fi 438} 439 440install_automake() { 441 if [ "$AUTOMAKE_VERSION" -a ! -f automake-$AUTOMAKE_VERSION-done ] ; then 442 echo "Downloading, building and installing GNU automake..." 443 [ -f automake-$AUTOMAKE_VERSION.tar.xz ] || curl -L -O ftp://ftp.gnu.org/gnu/automake/automake-$AUTOMAKE_VERSION.tar.xz || exit 1 444 $no_build && echo "Skipping installation" && return 445 xzcat automake-$AUTOMAKE_VERSION.tar.xz | tar xf - || exit 1 446 cd automake-$AUTOMAKE_VERSION 447 ./configure || exit 1 448 make $MAKE_BUILD_OPTS || exit 1 449 $DO_MAKE_INSTALL || exit 1 450 cd .. 451 touch automake-$AUTOMAKE_VERSION-done 452 fi 453} 454 455uninstall_automake() { 456 if [ ! -z "$installed_automake_version" ] ; then 457 # 458 # libtool depends on this(?), so uninstall it. 459 # 460 uninstall_libtool "$@" 461 462 echo "Uninstalling GNU automake:" 463 cd automake-$installed_automake_version 464 $DO_MAKE_UNINSTALL || exit 1 465 make distclean || exit 1 466 cd .. 467 rm automake-$installed_automake_version-done 468 469 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 470 # 471 # Get rid of the previously downloaded and unpacked version. 472 # 473 rm -rf automake-$installed_automake_version 474 rm -rf automake-$installed_automake_version.tar.xz 475 fi 476 477 installed_automake_version="" 478 fi 479} 480 481install_libtool() { 482 if [ "$LIBTOOL_VERSION" -a ! -f libtool-$LIBTOOL_VERSION-done ] ; then 483 echo "Downloading, building and installing GNU libtool..." 484 [ -f libtool-$LIBTOOL_VERSION.tar.xz ] || curl -L -O ftp://ftp.gnu.org/gnu/libtool/libtool-$LIBTOOL_VERSION.tar.xz || exit 1 485 $no_build && echo "Skipping installation" && return 486 xzcat libtool-$LIBTOOL_VERSION.tar.xz | tar xf - || exit 1 487 cd libtool-$LIBTOOL_VERSION 488 ./configure --program-prefix=g || exit 1 489 make $MAKE_BUILD_OPTS || exit 1 490 $DO_MAKE_INSTALL || exit 1 491 cd .. 492 touch libtool-$LIBTOOL_VERSION-done 493 fi 494} 495 496uninstall_libtool() { 497 if [ ! -z "$installed_libtool_version" ] ; then 498 echo "Uninstalling GNU libtool:" 499 cd libtool-$installed_libtool_version 500 $DO_MV /usr/local/bin/glibtool /usr/local/bin/libtool 501 $DO_MV /usr/local/bin/glibtoolize /usr/local/bin/libtoolize 502 $DO_MAKE_UNINSTALL || exit 1 503 make distclean || exit 1 504 cd .. 505 rm libtool-$installed_libtool_version-done 506 507 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 508 # 509 # Get rid of the previously downloaded and unpacked version. 510 # 511 rm -rf libtool-$installed_libtool_version 512 rm -rf libtool-$installed_libtool_version.tar.xz 513 fi 514 515 installed_libtool_version="" 516 fi 517} 518 519install_ninja() { 520 if [ "$NINJA_VERSION" -a ! -f ninja-$NINJA_VERSION-done ] ; then 521 echo "Downloading and installing Ninja:" 522 # 523 # Download the zipball, unpack it, and move the binary to 524 # /usr/local/bin. 525 # 526 [ -f ninja-mac-v$NINJA_VERSION.zip ] || curl -L -o ninja-mac-v$NINJA_VERSION.zip https://github.com/ninja-build/ninja/releases/download/v$NINJA_VERSION/ninja-mac.zip || exit 1 527 $no_build && echo "Skipping installation" && return 528 unzip ninja-mac-v$NINJA_VERSION.zip 529 sudo mv ninja /usr/local/bin 530 touch ninja-$NINJA_VERSION-done 531 fi 532} 533 534uninstall_ninja() { 535 if [ ! -z "$installed_ninja_version" ]; then 536 echo "Uninstalling Ninja:" 537 sudo rm /usr/local/bin/ninja 538 rm ninja-$installed_ninja_version-done 539 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 540 rm -f ninja-mac-v$installed_ninja_version.zip 541 fi 542 543 installed_ninja_version="" 544 fi 545} 546 547install_asciidoctor() { 548 if [ ! -f asciidoctor-${ASCIIDOCTOR_VERSION}-done ]; then 549 echo "Downloading and installing Asciidoctor:" 550 sudo gem install -V asciidoctor --version "=${ASCIIDOCTOR_VERSION}" 551 touch asciidoctor-${ASCIIDOCTOR_VERSION}-done 552 fi 553} 554 555uninstall_asciidoctor() { 556 if [ ! -z "$installed_asciidoctor_version" ]; then 557 echo "Uninstalling Asciidoctor:" 558 sudo gem uninstall -V asciidoctor --version "=${installed_asciidoctor_version}" 559 rm asciidoctor-$installed_asciidoctor_version-done 560 561 ##if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 562 # 563 # Get rid of the previously downloaded and unpacked version, 564 # whatever it might happen to be called. 565 # 566 ## rm -f asciidoctor-$installed_asciidoctor_version 567 ##fi 568 installed_asciidoctor_version="" 569 fi 570} 571 572install_asciidoctorpdf() { 573 if [ ! -f asciidoctorpdf-${ASCIIDOCTORPDF_VERSION}-done ]; then 574 ## XXX gem does not track dependencies that are installed for asciidoctor-pdf 575 ## record them for uninstallation 576 ## ttfunk, pdf-core, prawn, prawn-table, Ascii85, ruby-rc4, hashery, afm, pdf-reader, prawn-templates, public_suffix, addressable, css_parser, prawn-svg, prawn-icon, safe_yaml, thread_safe, polyglot, treetop, asciidoctor-pdf 577 echo "Downloading and installing Asciidoctor-pdf:" 578 sudo gem install -V asciidoctor-pdf --prerelease --version "=${ASCIIDOCTORPDF_VERSION}" 579 touch asciidoctorpdf-${ASCIIDOCTORPDF_VERSION}-done 580 fi 581} 582 583uninstall_asciidoctorpdf() { 584 if [ ! -z "$installed_asciidoctorpdf_version" ]; then 585 echo "Uninstalling Asciidoctor:" 586 sudo gem uninstall -V asciidoctor-pdf --version "=${installed_asciidoctorpdf_version}" 587 ## XXX uninstall dependencies 588 rm asciidoctorpdf-$installed_asciidoctorpdf_version-done 589 590 ##if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 591 # 592 # Get rid of the previously downloaded and unpacked version, 593 # whatever it might happen to be called. 594 # 595 ## rm -f asciidoctorpdf-$installed_asciidoctorpdf_version 596 ##fi 597 installed_asciidoctorpdf_version="" 598 fi 599} 600 601install_cmake() { 602 if [ ! -f cmake-$CMAKE_VERSION-done ]; then 603 echo "Downloading and installing CMake:" 604 CMAKE_MAJOR_VERSION="`expr $CMAKE_VERSION : '\([0-9][0-9]*\).*'`" 605 CMAKE_MINOR_VERSION="`expr $CMAKE_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`" 606 CMAKE_MAJOR_MINOR_VERSION=$CMAKE_MAJOR_VERSION.$CMAKE_MINOR_VERSION 607 608 # 609 # NOTE: the "64" in "Darwin64" doesn't mean "64-bit-only"; the 610 # package in question supports both 32-bit and 64-bit x86. 611 # 612 case "$CMAKE_MAJOR_VERSION" in 613 614 0|1|2) 615 echo "CMake $CMAKE_VERSION" is too old 1>&2 616 ;; 617 618 3) 619 # 620 # Download the DMG and do a drag install, where "drag" means 621 # "mv". 622 # 623 # 3.1.1 to 3.19.1 have a Darwin-x86_64 DMG. 624 # 3.19.2 has a macos-universal DMG for 10.10 and later 625 # 3.19.3 and later have a macos-universal DMG for 10.13 and later, 626 # and a macos10.10-universal DMG for 10.10 and later. 627 # 628 if [ "$CMAKE_MINOR_VERSION" -lt 5 ]; then 629 echo "CMake $CMAKE_VERSION" is too old 1>&2 630 elif [ "$CMAKE_MINOR_VERSION" -lt 19 -o \ 631 "$CMAKE_VERSION" = 3.19.0 -o \ 632 "$CMAKE_VERSION" = 3.19.1 ]; then 633 type="Darwin-x86_64" 634 elif [ "$CMAKE_VERSION" = 3.19.2 -o \ 635 "$DARWIN_MAJOR_VERSION" -ge 17 ]; then 636 type="macos-universal" 637 else 638 type="macos10.0-universal" 639 fi 640 [ -f cmake-$CMAKE_VERSION-$type.dmg ] || curl -L -O https://cmake.org/files/v$CMAKE_MAJOR_MINOR_VERSION/cmake-$CMAKE_VERSION-$type.dmg || exit 1 641 $no_build && echo "Skipping installation" && return 642 sudo hdiutil attach cmake-$CMAKE_VERSION-$type.dmg || exit 1 643 sudo ditto /Volumes/cmake-$CMAKE_VERSION-$type/CMake.app /Applications/CMake.app || exit 1 644 645 # 646 # Plant the appropriate symbolic links in /usr/local/bin. 647 # It's a drag-install, so there's no installer to make them, 648 # and the CMake code to put them in place is lame, as 649 # 650 # 1) it defaults to /usr/bin, not /usr/local/bin; 651 # 2) it doesn't request the necessary root privileges; 652 # 3) it can't be run from the command line; 653 # 654 # so we do it ourselves. 655 # 656 for i in ccmake cmake cmake-gui cmakexbuild cpack ctest 657 do 658 sudo ln -s /Applications/CMake.app/Contents/bin/$i /usr/local/bin/$i 659 done 660 sudo hdiutil detach /Volumes/cmake-$CMAKE_VERSION-$type 661 ;; 662 663 *) 664 ;; 665 esac 666 touch cmake-$CMAKE_VERSION-done 667 fi 668} 669 670uninstall_cmake() { 671 if [ ! -z "$installed_cmake_version" ]; then 672 echo "Uninstalling CMake:" 673 installed_cmake_major_version="`expr $installed_cmake_version : '\([0-9][0-9]*\).*'`" 674 case "$installed_cmake_major_version" in 675 676 0|1|2) 677 echo "CMake $installed_cmake_version" is too old 1>&2 678 ;; 679 680 3) 681 sudo rm -rf /Applications/CMake.app 682 for i in ccmake cmake cmake-gui cmakexbuild cpack ctest 683 do 684 sudo rm -f /usr/local/bin/$i 685 done 686 rm cmake-$installed_cmake_version-done 687 ;; 688 esac 689 690 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 691 # 692 # Get rid of the previously downloaded and unpacked version, 693 # whatever it might happen to be called. 694 # 695 rm -f cmake-$installed_cmake_version-Darwin-x86_64.dmg 696 rm -f cmake-$installed_cmake_version-macos-universal.dmg 697 rm -f cmake-$installed_cmake_version-macos10.0-universal.dmg 698 fi 699 700 installed_cmake_version="" 701 fi 702} 703 704install_meson() { 705 # 706 # Install Meson with pip3 if we don't have it already. 707 # 708 if $MESON --version >/dev/null 2>&1 709 then 710 # We have it. 711 : 712 else 713 sudo pip3 install meson 714 touch meson-done 715 fi 716} 717 718uninstall_meson() { 719 # 720 # If we installed Meson, uninstal it with pip3. 721 # 722 if [ -f meson-done ] ; then 723 sudo pip3 uninstall meson 724 rm -f meson-done 725 fi 726} 727 728install_gettext() { 729 if [ ! -f gettext-$GETTEXT_VERSION-done ] ; then 730 echo "Downloading, building, and installing GNU gettext:" 731 [ -f gettext-$GETTEXT_VERSION.tar.gz ] || curl -L -O http://ftp.gnu.org/pub/gnu/gettext/gettext-$GETTEXT_VERSION.tar.gz || exit 1 732 $no_build && echo "Skipping installation" && return 733 gzcat gettext-$GETTEXT_VERSION.tar.gz | tar xf - || exit 1 734 cd gettext-$GETTEXT_VERSION 735 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0 $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1 736 make $MAKE_BUILD_OPTS || exit 1 737 $DO_MAKE_INSTALL || exit 1 738 cd .. 739 touch gettext-$GETTEXT_VERSION-done 740 fi 741} 742 743uninstall_gettext() { 744 if [ ! -z "$installed_gettext_version" ] ; then 745 # 746 # GLib depends on this, so uninstall it. 747 # 748 uninstall_glib "$@" 749 750 echo "Uninstalling GNU gettext:" 751 cd gettext-$installed_gettext_version 752 $DO_MAKE_UNINSTALL || exit 1 753 make distclean || exit 1 754 cd .. 755 rm gettext-$installed_gettext_version-done 756 757 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 758 # 759 # Get rid of the previously downloaded and unpacked version. 760 # 761 rm -rf gettext-$installed_gettext_version 762 rm -rf gettext-$installed_gettext_version.tar.gz 763 fi 764 765 installed_gettext_version="" 766 fi 767} 768 769install_pkg_config() { 770 if [ ! -f pkg-config-$PKG_CONFIG_VERSION-done ] ; then 771 echo "Downloading, building, and installing pkg-config:" 772 [ -f pkg-config-$PKG_CONFIG_VERSION.tar.gz ] || curl -L -O https://pkgconfig.freedesktop.org/releases/pkg-config-$PKG_CONFIG_VERSION.tar.gz || exit 1 773 $no_build && echo "Skipping installation" && return 774 gzcat pkg-config-$PKG_CONFIG_VERSION.tar.gz | tar xf - || exit 1 775 cd pkg-config-$PKG_CONFIG_VERSION 776 ./configure --with-internal-glib || exit 1 777 make $MAKE_BUILD_OPTS || exit 1 778 $DO_MAKE_INSTALL || exit 1 779 cd .. 780 touch pkg-config-$PKG_CONFIG_VERSION-done 781 fi 782} 783 784uninstall_pkg_config() { 785 if [ ! -z "$installed_pkg_config_version" ] ; then 786 echo "Uninstalling pkg-config:" 787 cd pkg-config-$installed_pkg_config_version 788 $DO_MAKE_UNINSTALL || exit 1 789 make distclean || exit 1 790 cd .. 791 rm pkg-config-$installed_pkg_config_version-done 792 793 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 794 # 795 # Get rid of the previously downloaded and unpacked version. 796 # 797 rm -rf pkg-config-$installed_pkg_config_version 798 rm -rf pkg-config-$installed_pkg_config_version.tar.gz 799 fi 800 801 installed_pkg_config_version="" 802 fi 803} 804 805install_glib() { 806 if [ ! -f glib-$GLIB_VERSION-done ] ; then 807 echo "Downloading, building, and installing GLib:" 808 glib_dir=`expr $GLIB_VERSION : '\([0-9][0-9]*\.[0-9][0-9]*\).*'` 809 # 810 # Starting with GLib 2.28.8, xz-compressed tarballs are available. 811 # 812 [ -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 813 $no_build && echo "Skipping installation" && return 814 xzcat glib-$GLIB_VERSION.tar.xz | tar xf - || exit 1 815 cd glib-$GLIB_VERSION 816 # 817 # First, determine where the system include files are. 818 # (It's not necessarily /usr/include.) There's a bit of a 819 # greasy hack here; pre-5.x versions of the developer tools 820 # don't support the --show-sdk-path option, and will produce 821 # no output, so includedir will be set to /usr/include 822 # (in those older versions of the developer tools, there is 823 # a /usr/include directory). 824 # 825 # We need this for several things we do later. 826 # 827 includedir=`SDKROOT="$SDKPATH" xcrun --show-sdk-path 2>/dev/null`/usr/include 828 # 829 # GLib's configuration procedure, whether autotools-based or 830 # Meson-based, really likes to use pkg-config to find libraries, 831 # including libffi. 832 # 833 # At least some versions of macOS provide libffi, but, as macOS 834 # doesn't provide pkg-config, they don't provide a .pc file for 835 # it, so the autotools-based configuration needs some trickery 836 # to get it to find the OS-supplied libffi, and the Meson-based 837 # configuration simply won't find it at all. 838 # 839 # So, if we have a system-provided libffi, but pkg-config 840 # doesn't find libffi, we construct a .pc file for that libffi, 841 # and install it in /usr/local/lib/pkgconfig. 842 # 843 if pkg-config libffi ; then 844 # It found libffi; no need to install a .pc file, and we 845 # don't want to overwrite what's there already. 846 : 847 elif [ ! -e $includedir/ffi/ffi.h ] ; then 848 # We don't appear to have libffi as part of the system, so 849 # let the configuration process figure out what to do. 850 # 851 # We test for the header file, not the library, because, in 852 # Big Sur and later, there's no guarantee that, for a system 853 # shared library, there's a corresponding dylib file in 854 # /usr/lib. 855 : 856 else 857 # 858 # We have libffi, but pkg-config didn't find it; generate 859 # and install the .pc file. 860 # 861 862 # 863 # Now generate the .pc file. 864 # 865 # We generate the contents of the .pc file by using cat with 866 # a here document containing a template for the file and 867 # piping that to a sed command that replaces @INCLUDEDIR@ in 868 # the template with the include directory we discovered 869 # above, so that the .pc file gives the compiler flags 870 # necessary to find the libffi headers (which are *not* 871 # necessarily in /usr/include, as per the above). 872 # 873 # The EOF marker for the here document is in quotes, to tell 874 # the shell not to do shell expansion, as .pc files use a 875 # syntax to refer to .pc file variables that looks like the 876 # syntax to refer to shell variables. 877 # 878 # The writing of the libffi.pc file is a greasy hack - the 879 # process of generating the contents of the .pc file writes 880 # to the standard output, but running the last process in 881 # the pipeline as root won't allow the shell that's 882 # *running* it to open the .pc file if we don't have write 883 # permission on /usr/local/lib/pkgconfig, so we need a 884 # program that creates a file and then reads from the 885 # standard input and writes to that file. UN*Xes have a 886 # program that does that; it's called "tee". :-) 887 # 888 # However, it *also* writes the file to the standard output, 889 # so we redirect that to /dev/null when we run it. 890 # 891 cat <<"EOF" | sed "s;@INCLUDEDIR@;$includedir;" | $DO_TEE_TO_PC_FILE /usr/local/lib/pkgconfig/libffi.pc >/dev/null 892prefix=/usr 893libdir=${prefix}/lib 894includedir=@INCLUDEDIR@ 895 896Name: ffi 897Description: Library supporting Foreign Function Interfaces 898Version: 3.2.9999 899Libs: -L${libdir} -lffi 900Cflags: -I${includedir}/ffi 901EOF 902 fi 903 904 # 905 # GLib 2.59.1 and later use Meson+Ninja as the build system. 906 # 907 case $GLIB_MAJOR_VERSION in 908 909 1) 910 echo "GLib $GLIB_VERSION" is too old 1>&2 911 ;; 912 913 *) 914 case $GLIB_MINOR_VERSION in 915 916 [0-9]|1[0-9]|2[0-9]|3[0-7]) 917 echo "GLib $GLIB_VERSION" is too old 1>&2 918 ;; 919 920 3[8-9]|4[0-9]|5[0-8]) 921 if [ ! -f ./configure ]; then 922 LIBTOOLIZE=glibtoolize ./autogen.sh 923 fi 924 # 925 # At least with the version of Xcode that comes with 926 # Leopard, /usr/include/ffi/fficonfig.h doesn't define 927 # MACOSX, which causes the build of GLib to fail for at 928 # least some versions of GLib. If we don't find 929 # "#define.*MACOSX" in /usr/include/ffi/fficonfig.h, 930 # explicitly define it. 931 # 932 # While we're at it, suppress -Wformat-nonliteral to 933 # avoid a case where clang's stricter rules on when not 934 # to complain about non-literal format arguments cause 935 # it to complain about code that's safe but it wasn't 936 # told that. See my comment #25 in GNOME bug 691608: 937 # 938 # https://bugzilla.gnome.org/show_bug.cgi?id=691608#c25 939 # 940 if grep -qs '#define.*MACOSX' $includedir/ffi/fficonfig.h 941 then 942 # It's defined, nothing to do 943 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 944 else 945 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 946 fi 947 make $MAKE_BUILD_OPTS || exit 1 948 $DO_MAKE_INSTALL || exit 1 949 ;; 950 951 59|[6-9][0-9]|[1-9][0-9][0-9]) 952 # 953 # 2.59.0 doesn't require Meson and Ninja, but it 954 # supports it, and I'm too lazy to add a dot-dot 955 # version check. 956 # 957 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" $MESON _build || exit 1 958 ninja $MAKE_BUILD_OPTS -C _build || exit 1 959 $DO_NINJA_INSTALL || exit 1 960 ;; 961 *) 962 echo "Glib's put out 1000 2.x releases?" 1>&2 963 ;; 964 965 esac 966 esac 967 cd .. 968 touch glib-$GLIB_VERSION-done 969 fi 970} 971 972uninstall_glib() { 973 if [ ! -z "$installed_glib_version" ] ; then 974 echo "Uninstalling GLib:" 975 cd glib-$installed_glib_version 976 installed_glib_major_version="`expr $installed_glib_version : '\([0-9][0-9]*\).*'`" 977 installed_glib_minor_version="`expr $installed_glib_version : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`" 978 installed_glib_dotdot_version="`expr $installed_glib_version : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`" 979 installed_glib_major_minor_version=$installed_glib_major_version.$installed_glib_minor_version 980 installed_glib_major_minor_dotdot_version=$installed_glib_major_version.$installed_glib_minor_version.$installed_glib_dotdot_version 981 # 982 # GLib 2.59.1 and later use Meson+Ninja as the build system. 983 # 984 case $installed_glib_major_version in 985 986 1) 987 $DO_MAKE_UNINSTALL || exit 1 988 # 989 # This appears to delete dependencies out from under other 990 # Makefiles in the tree, causing it to fail. At least until 991 # that gets fixed, if it ever gets fixed, we just ignore the 992 # exit status of "make distclean" 993 # 994 # make distclean || exit 1 995 make distclean || echo "Ignoring make distclean failure" 1>&2 996 ;; 997 998 *) 999 case $installed_glib_minor_version in 1000 1001 [0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-8]) 1002 $DO_MAKE_UNINSTALL || exit 1 1003 # 1004 # This appears to delete dependencies out from under other 1005 # Makefiles in the tree, causing it to fail. At least until 1006 # that gets fixed, if it ever gets fixed, we just ignore the 1007 # exit status of "make distclean" 1008 # 1009 # make distclean || exit 1 1010 make distclean || echo "Ignoring make distclean failure" 1>&2 1011 ;; 1012 1013 59|[6-9][0-9]|[1-9][0-9][0-9]) 1014 # 1015 # 2.59.0 doesn't require Meson and Ninja, but it 1016 # supports it, and I'm too lazy to add a dot-dot 1017 # version check. 1018 # 1019 $DO_NINJA_UNINSTALL || exit 1 1020 # 1021 # For Meson+Ninja, we do the build in an _build 1022 # subdirectory, so the equivalent of "make distclean" 1023 # is just to remove the directory tree. 1024 # 1025 rm -rf _build 1026 ;; 1027 1028 *) 1029 echo "Glib's put out 1000 2.x releases?" 1>&2 1030 ;; 1031 esac 1032 esac 1033 cd .. 1034 rm glib-$installed_glib_version-done 1035 1036 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 1037 # 1038 # Get rid of the previously downloaded and unpacked version. 1039 # 1040 rm -rf glib-$installed_glib_version 1041 rm -rf glib-$installed_glib_version.tar.xz 1042 fi 1043 1044 installed_glib_version="" 1045 fi 1046} 1047 1048install_qt() { 1049 if [ "$QT_VERSION" -a ! -f qt-$QT_VERSION-done ]; then 1050 echo "Downloading and installing Qt:" 1051 # 1052 # What you get for this URL might just be a 302 Found reply, so use 1053 # -L so we get redirected. 1054 # 1055 # 5.0 - 5.1: qt-mac-opensource-{version}-clang-offline.dmg 1056 # 5.2.0: qt-mac-opensource-{version}.dmg 1057 # 5.2.1: qt-opensource-mac-x64-clang-{version}.dmg 1058 # 5.3 - 5.8: qt-opensource-mac-x64-clang-{version}.dmg 1059 # 5.9 - 5.14: qt-opensource-mac-x64-{version}.dmg 1060 # 5.15 - 6.0: Offline installers no longer provided. 1061 # ( http://download.qt.io/archive/qt/5.15/5.15.0/OFFLINE_README.txt ) 1062 # XXX: We need a different approach for QT >= 5.15 1063 # 1064 case $QT_MAJOR_VERSION in 1065 1066 1|2|3|4) 1067 echo "Qt $QT_VERSION" is too old 1>&2 1068 ;; 1069 1070 5) 1071 case $QT_MINOR_VERSION in 1072 1073 0|1|2|3|4|5) 1074 echo "Qt $QT_VERSION" is too old 1>&2 1075 ;; 1076 1077 6|7|8) 1078 QT_VOLUME=qt-opensource-mac-x64-clang-$QT_VERSION 1079 ;; 1080 1081 9|10|11|12|13|14) 1082 QT_VOLUME=qt-opensource-mac-x64-$QT_VERSION 1083 ;; 1084 *) 1085 echo "The Qt Company no longer provides open source offline installers for Qt $QT_VERSION" 1>&2 1086 ;; 1087 1088 esac 1089 [ -f $QT_VOLUME.dmg ] || curl -L -O http://download.qt.io/archive/qt/$QT_MAJOR_MINOR_VERSION/$QT_MAJOR_MINOR_DOTDOT_VERSION/$QT_VOLUME.dmg || exit 1 1090 $no_build && echo "Skipping installation" && return 1091 sudo hdiutil attach $QT_VOLUME.dmg || exit 1 1092 1093 # 1094 # Run the installer executable directly, so that we wait for 1095 # it to finish. Then unmount the volume. 1096 # 1097 /Volumes/$QT_VOLUME/$QT_VOLUME.app/Contents/MacOS/$QT_VOLUME 1098 sudo hdiutil detach /Volumes/$QT_VOLUME 1099 touch qt-$QT_VERSION-done 1100 ;; 1101 *) 1102 echo "The Qt Company no longer provides open source offline installers for Qt $QT_VERSION" 1>&2 1103 ;; 1104 esac 1105 fi 1106} 1107 1108uninstall_qt() { 1109 if [ ! -z "$installed_qt_version" ] ; then 1110 echo "Uninstalling Qt:" 1111 rm -rf $HOME/Qt$installed_qt_version 1112 rm qt-$installed_qt_version-done 1113 1114 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 1115 # 1116 # Get rid of the previously downloaded version. 1117 # 1118 # 5.0 - 5.1: qt-mac-opensource-{version}-clang-offline.dmg 1119 # 5.2.0: qt-mac-opensource-{version}.dmg 1120 # 5.2.1: qt-opensource-mac-x64-clang-{version}.dmg 1121 # 5.3 - 5.8: qt-opensource-mac-x64-clang-{version}.dmg 1122 # 5.9 - 5.14: qt-opensource-mac-x64-{version}.dmg 1123 # 1124 installed_qt_major_version="`expr $installed_qt_version : '\([0-9][0-9]*\).*'`" 1125 installed_qt_minor_version="`expr $installed_qt_version : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`" 1126 installed_qt_dotdot_version="`expr $installed_qt_version : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`" 1127 case $installed_qt_major_version in 1128 1129 1|2|3|4) 1130 echo "Qt $installed_qt_version" is too old 1>&2 1131 ;; 1132 1133 5*) 1134 case $installed_qt_minor_version in 1135 1136 0|1|2) 1137 echo "Qt $installed_qt_version" is too old 1>&2 1138 ;; 1139 1140 3|4|5|6|7|8) 1141 installed_qt_volume=qt-opensource-mac-x64-clang-$installed_qt_version.dmg 1142 ;; 1143 1144 9|10|11|12|13|14) 1145 installed_qt_volume=qt-opensource-mac-x64-$installed_qt_version.dmg 1146 ;; 1147 esac 1148 esac 1149 rm -f $installed_qt_volume 1150 fi 1151 1152 installed_qt_version="" 1153 fi 1154} 1155 1156install_libsmi() { 1157 if [ "$LIBSMI_VERSION" -a ! -f libsmi-$LIBSMI_VERSION-done ] ; then 1158 echo "Downloading, building, and installing libsmi:" 1159 [ -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 1160 $no_build && echo "Skipping installation" && return 1161 gzcat libsmi-$LIBSMI_VERSION.tar.gz | tar xf - || exit 1 1162 cd libsmi-$LIBSMI_VERSION 1163 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1 1164 make $MAKE_BUILD_OPTS || exit 1 1165 $DO_MAKE_INSTALL || exit 1 1166 cd .. 1167 touch libsmi-$LIBSMI_VERSION-done 1168 fi 1169} 1170 1171uninstall_libsmi() { 1172 if [ ! -z "$installed_libsmi_version" ] ; then 1173 echo "Uninstalling libsmi:" 1174 cd libsmi-$installed_libsmi_version 1175 $DO_MAKE_UNINSTALL || exit 1 1176 make distclean || exit 1 1177 cd .. 1178 rm libsmi-$installed_libsmi_version-done 1179 1180 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 1181 # 1182 # Get rid of the previously downloaded and unpacked version. 1183 # 1184 rm -rf libsmi-$installed_libsmi_version 1185 rm -rf libsmi-$installed_libsmi_version.tar.gz 1186 fi 1187 1188 installed_libsmi_version="" 1189 fi 1190} 1191 1192install_libgpg_error() { 1193 if [ "$LIBGPG_ERROR_VERSION" -a ! -f libgpg-error-$LIBGPG_ERROR_VERSION-done ] ; then 1194 echo "Downloading, building, and installing libgpg-error:" 1195 [ -f libgpg-error-$LIBGPG_ERROR_VERSION.tar.bz2 ] || curl -L -O https://www.gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-$LIBGPG_ERROR_VERSION.tar.bz2 || exit 1 1196 $no_build && echo "Skipping installation" && return 1197 bzcat libgpg-error-$LIBGPG_ERROR_VERSION.tar.bz2 | tar xf - || exit 1 1198 cd libgpg-error-$LIBGPG_ERROR_VERSION 1199 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1 1200 make $MAKE_BUILD_OPTS || exit 1 1201 $DO_MAKE_INSTALL || exit 1 1202 cd .. 1203 touch libgpg-error-$LIBGPG_ERROR_VERSION-done 1204 fi 1205} 1206 1207uninstall_libgpg_error() { 1208 if [ ! -z "$installed_libgpg_error_version" ] ; then 1209 # 1210 # libgcrypt depends on this, so uninstall it. 1211 # 1212 uninstall_libgcrypt "$@" 1213 1214 echo "Uninstalling libgpg-error:" 1215 cd libgpg-error-$installed_libgpg_error_version 1216 $DO_MAKE_UNINSTALL || exit 1 1217 make distclean || exit 1 1218 cd .. 1219 rm libgpg-error-$installed_libgpg_error_version-done 1220 1221 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 1222 # 1223 # Get rid of the previously downloaded and unpacked version. 1224 # 1225 rm -rf libgpg-error-$installed_libgpg_error_version 1226 rm -rf libgpg-error-$installed_libgpg_error_version.tar.bz2 1227 fi 1228 1229 installed_libgpg_error_version="" 1230 fi 1231} 1232 1233install_libgcrypt() { 1234 if [ "$LIBGCRYPT_VERSION" -a ! -f libgcrypt-$LIBGCRYPT_VERSION-done ] ; then 1235 # 1236 # libgpg-error is required for libgcrypt. 1237 # 1238 if [ -z $LIBGPG_ERROR_VERSION ] 1239 then 1240 echo "libgcrypt requires libgpg-error, but you didn't install libgpg-error." 1>&2 1241 exit 1 1242 fi 1243 1244 echo "Downloading, building, and installing libgcrypt:" 1245 [ -f libgcrypt-$LIBGCRYPT_VERSION.tar.gz ] || curl -L -O https://www.gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-$LIBGCRYPT_VERSION.tar.gz || exit 1 1246 $no_build && echo "Skipping installation" && return 1247 gzcat libgcrypt-$LIBGCRYPT_VERSION.tar.gz | tar xf - || exit 1 1248 cd libgcrypt-$LIBGCRYPT_VERSION 1249 # 1250 # The assembler language code is not compatible with the macOS 1251 # x86 assembler (or is it an x86-64 vs. x86-32 issue?). 1252 # 1253 # libgcrypt expects gnu89, not c99/gnu99, semantics for 1254 # "inline". See, for example: 1255 # 1256 # http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2010-October/198809.html 1257 # 1258 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 1259 make $MAKE_BUILD_OPTS || exit 1 1260 $DO_MAKE_INSTALL || exit 1 1261 cd .. 1262 touch libgcrypt-$LIBGCRYPT_VERSION-done 1263 fi 1264} 1265 1266uninstall_libgcrypt() { 1267 if [ ! -z "$installed_libgcrypt_version" ] ; then 1268 echo "Uninstalling libgcrypt:" 1269 cd libgcrypt-$installed_libgcrypt_version 1270 $DO_MAKE_UNINSTALL || exit 1 1271 make distclean || exit 1 1272 cd .. 1273 rm libgcrypt-$installed_libgcrypt_version-done 1274 1275 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 1276 # 1277 # Get rid of the previously downloaded and unpacked version. 1278 # 1279 rm -rf libgcrypt-$installed_libgcrypt_version 1280 rm -rf libgcrypt-$installed_libgcrypt_version.tar.gz 1281 fi 1282 1283 installed_libgcrypt_version="" 1284 fi 1285} 1286 1287install_gmp() { 1288 if [ "$GMP_VERSION" -a ! -f gmp-$GMP_VERSION-done ] ; then 1289 echo "Downloading, building, and installing GMP:" 1290 [ -f gmp-$GMP_VERSION.tar.lz ] || curl -L -O https://gmplib.org/download/gmp/gmp-$GMP_VERSION.tar.lz || exit 1 1291 $no_build && echo "Skipping installation" && return 1292 lzip -c -d gmp-$GMP_VERSION.tar.lz | tar xf - || exit 1 1293 cd gmp-$GMP_VERSION 1294 # Create a fat binary: https://gmplib.org/manual/Notes-for-Package-Builds.html 1295 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --enable-fat || exit 1 1296 make $MAKE_BUILD_OPTS || exit 1 1297 $DO_MAKE_INSTALL || exit 1 1298 cd .. 1299 touch gmp-$GMP_VERSION-done 1300 fi 1301} 1302 1303uninstall_gmp() { 1304 if [ ! -z "$installed_gmp_version" ] ; then 1305 # 1306 # Nettle depends on this, so uninstall it. 1307 # 1308 uninstall_nettle "$@" 1309 1310 echo "Uninstalling GMP:" 1311 cd gmp-$installed_gmp_version 1312 $DO_MAKE_UNINSTALL || exit 1 1313 make distclean || exit 1 1314 cd .. 1315 rm gmp-$installed_gmp_version-done 1316 1317 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 1318 # 1319 # Get rid of the previously downloaded and unpacked version. 1320 # 1321 rm -rf gmp-$installed_gmp_version 1322 rm -rf gmp-$installed_gmp_version.tar.lz 1323 fi 1324 1325 installed_gmp_version="" 1326 fi 1327} 1328 1329install_libtasn1() { 1330 if [ "$LIBTASN1_VERSION" -a ! -f libtasn1-$LIBTASN1_VERSION-done ] ; then 1331 echo "Downloading, building, and installing libtasn1:" 1332 [ -f libtasn1-$LIBTASN1_VERSION.tar.gz ] || curl -L -O https://ftpmirror.gnu.org/libtasn1/libtasn1-$LIBTASN1_VERSION.tar.gz || exit 1 1333 $no_build && echo "Skipping installation" && return 1334 gzcat libtasn1-$LIBTASN1_VERSION.tar.gz | tar xf - || exit 1 1335 cd libtasn1-$LIBTASN1_VERSION 1336 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1 1337 make $MAKE_BUILD_OPTS || exit 1 1338 $DO_MAKE_INSTALL || exit 1 1339 cd .. 1340 touch libtasn1-$LIBTASN1_VERSION-done 1341 fi 1342} 1343 1344uninstall_libtasn1() { 1345 if [ ! -z "$installed_libtasn1_version" ] ; then 1346 # 1347 # p11-kit depends on this, so uninstall it. 1348 # 1349 uninstall_p11_kit "$@" 1350 1351 echo "Uninstalling libtasn1:" 1352 cd libtasn1-$installed_libtasn1_version 1353 $DO_MAKE_UNINSTALL || exit 1 1354 make distclean || exit 1 1355 cd .. 1356 rm libtasn1-$installed_libtasn1_version-done 1357 1358 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 1359 # 1360 # Get rid of the previously downloaded and unpacked version. 1361 # 1362 rm -rf libtasn1-$installed_libtasn1_version 1363 rm -rf libtasn1-$installed_libtasn1_version.tar.gz 1364 fi 1365 1366 installed_libtasn1_version="" 1367 fi 1368} 1369 1370install_p11_kit() { 1371 if [ "$P11KIT_VERSION" -a ! -f p11-kit-$P11KIT_VERSION-done ] ; then 1372 echo "Downloading, building, and installing p11-kit:" 1373 [ -f p11-kit-$P11KIT_VERSION.tar.xz ] || curl -L -O https://github.com/p11-glue/p11-kit/releases/download/$P11KIT_VERSION/p11-kit-$P11KIT_VERSION.tar.xz || exit 1 1374 $no_build && echo "Skipping installation" && return 1375 xzcat p11-kit-$P11KIT_VERSION.tar.xz | tar xf - || exit 1 1376 cd p11-kit-$P11KIT_VERSION 1377 # 1378 # Prior to Catalina, the libffi that's supplied with macOS 1379 # doesn't support ffi_closure_alloc() or ffi_prep_closure_loc(), 1380 # both of which are required by p11-kit if built with libffi. 1381 # 1382 # According to 1383 # 1384 # https://p11-glue.github.io/p11-glue/p11-kit/manual/devel-building.html 1385 # 1386 # libffi is used "for sharing of PKCS#11 modules between 1387 # multiple callers in the same process. It is highly recommended 1388 # that this dependency be treated as a required dependency.", 1389 # but it's not clear that this matters to us, so we just 1390 # configure p11-kit not to use libffi. 1391 # 1392 CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --without-libffi --without-trust-paths || exit 1 1393 make $MAKE_BUILD_OPTS || exit 1 1394 $DO_MAKE_INSTALL || exit 1 1395 cd .. 1396 touch p11-kit-$P11KIT_VERSION-done 1397 fi 1398} 1399 1400uninstall_p11_kit() { 1401 if [ ! -z "$installed_p11_kit_version" ] ; then 1402 # 1403 # Nettle depends on this, so uninstall it. 1404 # 1405 uninstall_nettle "$@" 1406 1407 echo "Uninstalling p11-kit:" 1408 cd p11-kit-$installed_p11_kit_version 1409 $DO_MAKE_UNINSTALL || exit 1 1410 make distclean || exit 1 1411 cd .. 1412 rm p11-kit-$installed_p11_kit_version-done 1413 1414 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 1415 # 1416 # Get rid of the previously downloaded and unpacked version. 1417 # 1418 rm -rf p11-kit-$installed_p11_kit_version 1419 rm -rf p11-kit-$installed_p11_kit_version.tar.xz 1420 fi 1421 1422 installed_p11_kit_version="" 1423 fi 1424} 1425 1426install_nettle() { 1427 if [ "$NETTLE_VERSION" -a ! -f nettle-$NETTLE_VERSION-done ] ; then 1428 echo "Downloading, building, and installing Nettle:" 1429 [ -f nettle-$NETTLE_VERSION.tar.gz ] || curl -L -O https://ftp.gnu.org/gnu/nettle/nettle-$NETTLE_VERSION.tar.gz || exit 1 1430 $no_build && echo "Skipping installation" && return 1431 gzcat nettle-$NETTLE_VERSION.tar.gz | tar xf - || exit 1 1432 cd nettle-$NETTLE_VERSION 1433 if [ "$DARWIN_PROCESSOR_ARCH" = "arm" ] ; then 1434 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --disable-assembler || exit 1 1435 else 1436 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1 1437 fi 1438 make $MAKE_BUILD_OPTS || exit 1 1439 $DO_MAKE_INSTALL || exit 1 1440 cd .. 1441 touch nettle-$NETTLE_VERSION-done 1442 fi 1443} 1444 1445uninstall_nettle() { 1446 if [ ! -z "$installed_nettle_version" ] ; then 1447 # 1448 # GnuTLS depends on this, so uninstall it. 1449 # 1450 uninstall_gnutls "$@" 1451 1452 echo "Uninstalling Nettle:" 1453 cd nettle-$installed_nettle_version 1454 $DO_MAKE_UNINSTALL || exit 1 1455 make distclean || exit 1 1456 cd .. 1457 rm nettle-$installed_nettle_version-done 1458 1459 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 1460 # 1461 # Get rid of the previously downloaded and unpacked version. 1462 # 1463 rm -rf nettle-$installed_nettle_version 1464 rm -rf nettle-$installed_nettle_version.tar.gz 1465 fi 1466 1467 installed_nettle_version="" 1468 fi 1469} 1470 1471install_gnutls() { 1472 if [ "$GNUTLS_VERSION" -a ! -f gnutls-$GNUTLS_VERSION-done ] ; then 1473 # 1474 # GnuTLS requires Nettle. 1475 # 1476 if [ -z $NETTLE_VERSION ] 1477 then 1478 echo "GnuTLS requires Nettle, but you didn't install Nettle" 1>&2 1479 exit 1 1480 fi 1481 1482 echo "Downloading, building, and installing GnuTLS:" 1483 if [[ $GNUTLS_MAJOR_VERSION -ge 3 ]] 1484 then 1485 # 1486 # Starting with GnuTLS 3.x, the tarballs are compressed with 1487 # xz rather than bzip2. 1488 # 1489 [ -f gnutls-$GNUTLS_VERSION.tar.xz ] || curl -L -O https://www.gnupg.org/ftp/gcrypt/gnutls/v$GNUTLS_MAJOR_VERSION.$GNUTLS_MINOR_VERSION/gnutls-$GNUTLS_VERSION.tar.xz || exit 1 1490 $no_build && echo "Skipping installation" && return 1491 xzcat gnutls-$GNUTLS_VERSION.tar.xz | tar xf - || exit 1 1492 else 1493 [ -f gnutls-$GNUTLS_VERSION.tar.bz2 ] || curl -L -O https://www.gnupg.org/ftp/gcrypt/gnutls/v$GNUTLS_MAJOR_VERSION.$GNUTLS_MINOR_VERSION/gnutls-$GNUTLS_VERSION.tar.bz2 || exit 1 1494 $no_build && echo "Skipping installation" && return 1495 bzcat gnutls-$GNUTLS_VERSION.tar.bz2 | tar xf - || exit 1 1496 fi 1497 cd gnutls-$GNUTLS_VERSION 1498 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --with-included-unistring --disable-guile || exit 1 1499 make $MAKE_BUILD_OPTS || exit 1 1500 $DO_MAKE_INSTALL || exit 1 1501 cd .. 1502 touch gnutls-$GNUTLS_VERSION-done 1503 fi 1504} 1505 1506uninstall_gnutls() { 1507 if [ ! -z "$installed_gnutls_version" ] ; then 1508 echo "Uninstalling GnuTLS:" 1509 cd gnutls-$installed_gnutls_version 1510 $DO_MAKE_UNINSTALL || exit 1 1511 make distclean || exit 1 1512 cd .. 1513 rm gnutls-$installed_gnutls_version-done 1514 1515 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 1516 # 1517 # Get rid of the previously downloaded and unpacked version. 1518 # 1519 rm -rf gnutls-$installed_gnutls_version 1520 rm -rf gnutls-$installed_gnutls_version.tar.bz2 1521 fi 1522 1523 installed_gnutls_version="" 1524 fi 1525} 1526 1527install_lua() { 1528 if [ "$LUA_VERSION" -a ! -f lua-$LUA_VERSION-done ] ; then 1529 echo "Downloading, building, and installing Lua:" 1530 [ -f lua-$LUA_VERSION.tar.gz ] || curl -L -O http://www.lua.org/ftp/lua-$LUA_VERSION.tar.gz || exit 1 1531 $no_build && echo "Skipping installation" && return 1532 gzcat lua-$LUA_VERSION.tar.gz | tar xf - || exit 1 1533 cd lua-$LUA_VERSION 1534 make MYCFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" MYLDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" $MAKE_BUILD_OPTS macosx || exit 1 1535 $DO_MAKE_INSTALL || exit 1 1536 cd .. 1537 touch lua-$LUA_VERSION-done 1538 fi 1539} 1540 1541uninstall_lua() { 1542 if [ ! -z "$installed_lua_version" ] ; then 1543 echo "Uninstalling Lua:" 1544 # 1545 # Lua has no "make uninstall", so just remove stuff manually. 1546 # There's no configure script, so there's no need for 1547 # "make distclean", either; just do "make clean". 1548 # 1549 (cd /usr/local/bin; $DO_RM -f lua luac) 1550 (cd /usr/local/include; $DO_RM -f lua.h luaconf.h lualib.h lauxlib.h lua.hpp) 1551 (cd /usr/local/lib; $DO_RM -f liblua.a) 1552 (cd /usr/local/man/man1; $DO_RM -f lua.1 luac.1) 1553 cd lua-$installed_lua_version 1554 make clean || exit 1 1555 cd .. 1556 rm lua-$installed_lua_version-done 1557 1558 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 1559 # 1560 # Get rid of the previously downloaded and unpacked version. 1561 # 1562 rm -rf lua-$installed_lua_version 1563 rm -rf lua-$installed_lua_version.tar.gz 1564 fi 1565 1566 installed_lua_version="" 1567 fi 1568} 1569 1570install_snappy() { 1571 if [ "$SNAPPY_VERSION" -a ! -f snappy-$SNAPPY_VERSION-done ] ; then 1572 echo "Downloading, building, and installing snappy:" 1573 [ -f snappy-$SNAPPY_VERSION.tar.gz ] || curl -L -o snappy-$SNAPPY_VERSION.tar.gz https://github.com/google/snappy/archive/$SNAPPY_VERSION.tar.gz || exit 1 1574 $no_build && echo "Skipping installation" && return 1575 gzcat snappy-$SNAPPY_VERSION.tar.gz | tar xf - || exit 1 1576 cd snappy-$SNAPPY_VERSION 1577 mkdir build_dir 1578 cd build_dir 1579 # 1580 # Build a shared library, because we'll be linking libwireshark, 1581 # which is a C library, with libsnappy, and libsnappy is a C++ 1582 # library and requires the C++ run time; the shared library 1583 # will carry that dependency with it, so linking with it should 1584 # Just Work. 1585 # 1586 MACOSX_DEPLOYMENT_TARGET=$min_osx_target SDKROOT="$SDKPATH" cmake -DBUILD_SHARED_LIBS=YES ../ || exit 1 1587 make $MAKE_BUILD_OPTS || exit 1 1588 $DO_MAKE_INSTALL || exit 1 1589 cd ../.. 1590 touch snappy-$SNAPPY_VERSION-done 1591 fi 1592} 1593 1594uninstall_snappy() { 1595 if [ ! -z "$installed_snappy_version" ] ; then 1596 echo "Uninstalling snappy:" 1597 cd snappy-$installed_snappy_version 1598 # 1599 # snappy uses cmake and doesn't support "make uninstall"; 1600 # just remove what we know it installs. 1601 # 1602 # $DO_MAKE_UNINSTALL || exit 1 1603 $DO_RM -f /usr/local/lib/libsnappy.1.1.8.dylib \ 1604 /usr/local/lib/libsnappy.1.dylib \ 1605 /usr/local/lib/libsnappy.dylib \ 1606 /usr/local/include/snappy-c.h \ 1607 /usr/local/include/snappy-sinksource.h \ 1608 /usr/local/include/snappy-stubs-public.h \ 1609 /usr/local/include/snappy.h \ 1610 /usr/local/lib/cmake/Snappy/SnappyConfig.cmake \ 1611 /usr/local/lib/cmake/Snappy/SnappyConfigVersion.cmake \ 1612 /usr/local/lib/cmake/Snappy/SnappyTargets-noconfig.cmake \ 1613 /usr/local/lib/cmake/Snappy/SnappyTargets.cmake || exit 1 1614 # 1615 # snappy uses cmake and doesn't support "make distclean"; 1616 #.just remove the entire build directory. 1617 # 1618 # make distclean || exit 1 1619 rm -rf build_dir || exit 1 1620 cd .. 1621 rm snappy-$installed_snappy_version-done 1622 1623 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 1624 # 1625 # Get rid of the previously downloaded and unpacked version. 1626 # 1627 rm -rf snappy-$installed_snappy_version 1628 rm -rf snappy-$installed_snappy_version.tar.gz 1629 fi 1630 1631 installed_snappy_version="" 1632 fi 1633} 1634 1635install_zstd() { 1636 if [ "$ZSTD_VERSION" -a ! -f zstd-$ZSTD_VERSION-done ] ; then 1637 echo "Downloading, building, and installing zstd:" 1638 [ -f zstd-$ZSTD_VERSION.tar.gz ] || curl -L -O https://github.com/facebook/zstd/releases/download/v$ZSTD_VERSION/zstd-$ZSTD_VERSION.tar.gz || exit 1 1639 $no_build && echo "Skipping installation" && return 1640 gzcat zstd-$ZSTD_VERSION.tar.gz | tar xf - || exit 1 1641 cd zstd-$ZSTD_VERSION 1642 make $MAKE_BUILD_OPTS || exit 1 1643 $DO_MAKE_INSTALL || exit 1 1644 cd .. 1645 touch zstd-$ZSTD_VERSION-done 1646 fi 1647} 1648 1649uninstall_zstd() { 1650 if [ ! -z "$installed_zstd_version" ] ; then 1651 echo "Uninstalling zstd:" 1652 cd zstd-$installed_zstd_version 1653 $DO_MAKE_UNINSTALL || exit 1 1654 # 1655 # zstd has no configure script, so there's no need for 1656 # "make distclean", and the Makefile supplied with it 1657 # has no "make distclean" rule; just do "make clean". 1658 # 1659 make clean || exit 1 1660 cd .. 1661 rm zstd-$installed_zstd_version-done 1662 1663 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 1664 # 1665 # Get rid of the previously downloaded and unpacked version. 1666 # 1667 rm -rf zstd-$installed_zstd_version 1668 rm -rf zstd-$installed_zstd_version.tar.gz 1669 fi 1670 1671 installed_zstd_version="" 1672 fi 1673} 1674 1675install_libxml2() { 1676 if [ "$LIBXML2_VERSION" -a ! -f libxml2-$LIBXML2_VERSION-done ] ; then 1677 echo "Downloading, building, and installing libxml2:" 1678 [ -f libxml2-$LIBXML2_VERSION.tar.gz ] || curl -L -O ftp://xmlsoft.org/libxml2/libxml2-$LIBXML2_VERSION.tar.gz || exit 1 1679 $no_build && echo "Skipping installation" && return 1680 gzcat libxml2-$LIBXML2_VERSION.tar.gz | tar xf - || exit 1 1681 cd libxml2-$LIBXML2_VERSION 1682 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0 $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS -D_FORTIFY_SOURCE=0 $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1 1683 make $MAKE_BUILD_OPTS || exit 1 1684 $DO_MAKE_INSTALL || exit 1 1685 cd .. 1686 touch libxml2-$LIBXML2_VERSION-done 1687 fi 1688} 1689 1690uninstall_libxml2() { 1691 if [ ! -z "$installed_libxml2_version" ] ; then 1692 echo "Uninstalling libxml2:" 1693 cd libxml2-$installed_libxml2_version 1694 $DO_MAKE_UNINSTALL || exit 1 1695 make distclean || exit 1 1696 cd .. 1697 rm libxml2-$installed_libxml2_version-done 1698 1699 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 1700 # 1701 # Get rid of the previously downloaded and unpacked version. 1702 # 1703 rm -rf libxml2-$installed_libxml2_version 1704 rm -rf libxml2-$installed_libxml2_version.tar.gz 1705 fi 1706 1707 installed_libxml2_version="" 1708 fi 1709} 1710 1711install_lz4() { 1712 if [ "$LZ4_VERSION" -a ! -f lz4-$LZ4_VERSION-done ] ; then 1713 echo "Downloading, building, and installing lz4:" 1714 # 1715 # lz4 switched from sequentially numbered releases, named rN, 1716 # to vX.Y.Z-numbered releases. 1717 # 1718 # The old sequentially-numbered releases were in tarballs 1719 # at https://github.com/lz4/lz4/archive/rN.tar.gz, which 1720 # extract into an lz4-rN directory. 1721 # 1722 # THe new vX.Y.Z-numbered releases are in tarballs at 1723 # https://github.com/lz4/lz4/archive/vX.Y.Z.tar.gz, which 1724 # extract into an lz4-X.Y.Z directory - no, not lz4-vX.Y.Z, 1725 # just lz4-X.Y.Z. 1726 # 1727 # We expect LZ4_VERSION to be set to rN for the sequentially- 1728 # numbered releases and X.Y.Z - not vX.Y.Z - for the vX.Y.Z- 1729 # numbered releases. We also tell Curl to download the tarball 1730 # with a name that corresponds to the name of the target 1731 # directory, so that it begins with "lz4-" and ends with either 1732 # "rN" or "X.Y.Z", to match what almost all of the other 1733 # support libraries do. 1734 # 1735 if [[ "$LZ4_VERSION" == r* ]] 1736 then 1737 [ -f lz4-$LZ4_VERSION.tar.gz ] || curl -L -o lz4-$LZ4_VERSION.tar.gz https://github.com/lz4/lz4/archive/$LZ4_VERSION.tar.gz || exit 1 1738 else 1739 [ -f lz4-$LZ4_VERSION.tar.gz ] || curl -L -o lz4-$LZ4_VERSION.tar.gz https://github.com/lz4/lz4/archive/v$LZ4_VERSION.tar.gz || exit 1 1740 fi 1741 $no_build && echo "Skipping installation" && return 1742 gzcat lz4-$LZ4_VERSION.tar.gz | tar xf - || exit 1 1743 cd lz4-$LZ4_VERSION 1744 # 1745 # No configure script here, but it appears that if MOREFLAGS is 1746 # set, that's added to CFLAGS, and those are combined with LDFLAGS 1747 # and CXXFLAGS into FLAGS, which is used when building source 1748 # files and libraries. 1749 # 1750 MOREFLAGS="-D_FORTIFY_SOURCE=0 $VERSION_MIN_FLAGS $SDKFLAGS" make $MAKE_BUILD_OPTS || exit 1 1751 $DO_MAKE_INSTALL || exit 1 1752 cd .. 1753 touch lz4-$LZ4_VERSION-done 1754 fi 1755} 1756 1757uninstall_lz4() { 1758 if [ ! -z "$installed_lz4_version" ] ; then 1759 echo "Uninstalling lz4:" 1760 cd lz4-$installed_lz4_version 1761 $DO_MAKE_UNINSTALL || exit 1 1762 # 1763 # lz4's Makefile doesn't support "make distclean"; just do 1764 # "make clean". Perhaps not using autotools means that 1765 # there's no need for "make distclean". 1766 # 1767 # make distclean || exit 1 1768 make clean || exit 1 1769 cd .. 1770 rm lz4-$installed_lz4_version-done 1771 1772 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 1773 # 1774 # Get rid of the previously downloaded and unpacked version. 1775 # 1776 # "make install" apparently causes some stuff to be 1777 # modified in the build tree, so, as it's done as 1778 # root, that leaves stuff owned by root in the build 1779 # tree. Therefore, we have to remove the build tree 1780 # as root. 1781 # 1782 sudo rm -rf lz4-$installed_lz4_version 1783 rm -rf lz4-$installed_lz4_version.tar.gz 1784 fi 1785 1786 installed_lz4_version="" 1787 fi 1788} 1789 1790install_sbc() { 1791 if [ "$SBC_VERSION" -a ! -f sbc-$SBC_VERSION-done ] ; then 1792 echo "Downloading, building, and installing sbc:" 1793 [ -f sbc-$SBC_VERSION.tar.gz ] || curl -L -O https://www.kernel.org/pub/linux/bluetooth/sbc-$SBC_VERSION.tar.gz || exit 1 1794 $no_build && echo "Skipping installation" && return 1795 gzcat sbc-$SBC_VERSION.tar.gz | tar xf - || exit 1 1796 cd sbc-$SBC_VERSION 1797 if [ "$DARWIN_PROCESSOR_ARCH" = "arm" ] ; then 1798 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0 $VERSION_MIN_FLAGS $SDKFLAGS -U__ARM_NEON__" CXXFLAGS="$CXXFLAGS -D_FORTIFY_SOURCE=0 $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --disable-tools --disable-tester --disable-shared || exit 1 1799 else 1800 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0 $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS -D_FORTIFY_SOURCE=0 $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --disable-tools --disable-tester --disable-shared || exit 1 1801 fi 1802 make $MAKE_BUILD_OPTS || exit 1 1803 $DO_MAKE_INSTALL || exit 1 1804 cd .. 1805 touch sbc-$SBC_VERSION-done 1806 fi 1807} 1808 1809uninstall_sbc() { 1810 if [ ! -z "$installed_sbc_version" ] ; then 1811 echo "Uninstalling sbc:" 1812 cd sbc-$installed_sbc_version 1813 $DO_MAKE_UNINSTALL || exit 1 1814 make distclean || exit 1 1815 cd .. 1816 rm sbc-$installed_sbc_version-done 1817 1818 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 1819 # 1820 # Get rid of the previously downloaded and unpacked version. 1821 # 1822 rm -rf sbc-$installed_sbc_version 1823 rm -rf sbc-$installed_sbc_version.tar.gz 1824 fi 1825 1826 installed_sbc_version="" 1827 fi 1828} 1829 1830install_maxminddb() { 1831 if [ "$MAXMINDDB_VERSION" -a ! -f maxminddb-$MAXMINDDB_VERSION-done ] ; then 1832 echo "Downloading, building, and installing MaxMindDB API:" 1833 [ -f libmaxminddb-$MAXMINDDB_VERSION.tar.gz ] || curl -L -O https://github.com/maxmind/libmaxminddb/releases/download/$MAXMINDDB_VERSION/libmaxminddb-$MAXMINDDB_VERSION.tar.gz || exit 1 1834 $no_build && echo "Skipping installation" && return 1835 gzcat libmaxminddb-$MAXMINDDB_VERSION.tar.gz | tar xf - || exit 1 1836 cd libmaxminddb-$MAXMINDDB_VERSION 1837 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1 1838 make $MAKE_BUILD_OPTS || exit 1 1839 $DO_MAKE_INSTALL || exit 1 1840 cd .. 1841 touch maxminddb-$MAXMINDDB_VERSION-done 1842 fi 1843} 1844 1845uninstall_maxminddb() { 1846 if [ ! -z "$installed_maxminddb_version" ] ; then 1847 echo "Uninstalling MaxMindDB API:" 1848 cd libmaxminddb-$installed_maxminddb_version 1849 $DO_MAKE_UNINSTALL || exit 1 1850 make distclean || exit 1 1851 cd .. 1852 rm maxminddb-$installed_maxminddb_version-done 1853 1854 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 1855 # 1856 # Get rid of the previously downloaded and unpacked version. 1857 # 1858 rm -rf libmaxminddb-$installed_maxminddb_version 1859 rm -rf libmaxminddb-$installed_maxminddb_version.tar.gz 1860 fi 1861 1862 installed_maxminddb_version="" 1863 fi 1864} 1865 1866install_c_ares() { 1867 if [ "$CARES_VERSION" -a ! -f c-ares-$CARES_VERSION-done ] ; then 1868 echo "Downloading, building, and installing C-Ares API:" 1869 [ -f c-ares-$CARES_VERSION.tar.gz ] || curl -L -O https://c-ares.org/download/c-ares-$CARES_VERSION.tar.gz || exit 1 1870 $no_build && echo "Skipping installation" && return 1871 gzcat c-ares-$CARES_VERSION.tar.gz | tar xf - || exit 1 1872 cd c-ares-$CARES_VERSION 1873 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1 1874 make $MAKE_BUILD_OPTS || exit 1 1875 $DO_MAKE_INSTALL || exit 1 1876 cd .. 1877 touch c-ares-$CARES_VERSION-done 1878 fi 1879} 1880 1881uninstall_c_ares() { 1882 if [ ! -z "$installed_cares_version" ] ; then 1883 echo "Uninstalling C-Ares API:" 1884 cd c-ares-$installed_cares_version 1885 $DO_MAKE_UNINSTALL || exit 1 1886 make distclean || exit 1 1887 cd .. 1888 rm c-ares-$installed_cares_version-done 1889 1890 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 1891 # 1892 # Get rid of the previously downloaded and unpacked version. 1893 # 1894 rm -rf c-ares-$installed_cares_version 1895 rm -rf c-ares-$installed_cares_version.tar.gz 1896 fi 1897 1898 installed_cares_version="" 1899 fi 1900} 1901 1902install_libssh() { 1903 if [ "$LIBSSH_VERSION" -a ! -f libssh-$LIBSSH_VERSION-done ] ; then 1904 echo "Downloading, building, and installing libssh:" 1905 LIBSSH_MAJOR_VERSION="`expr $LIBSSH_VERSION : '\([0-9][0-9]*\).*'`" 1906 LIBSSH_MINOR_VERSION="`expr $LIBSSH_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`" 1907 LIBSSH_MAJOR_MINOR_VERSION=$LIBSSH_MAJOR_VERSION.$LIBSSH_MINOR_VERSION 1908 [ -f libssh-$LIBSSH_VERSION.tar.xz ] || curl -L -O https://www.libssh.org/files/$LIBSSH_MAJOR_MINOR_VERSION/libssh-$LIBSSH_VERSION.tar.xz 1909 $no_build && echo "Skipping installation" && return 1910 xzcat libssh-$LIBSSH_VERSION.tar.xz | tar xf - || exit 1 1911 cd libssh-$LIBSSH_VERSION 1912 mkdir build 1913 cd build 1914 MACOSX_DEPLOYMENT_TARGET=$min_osx_target SDKROOT="$SDKPATH" cmake -DWITH_GCRYPT=1 ../ || exit 1 1915 make $MAKE_BUILD_OPTS || exit 1 1916 $DO_MAKE_INSTALL || exit 1 1917 cd ../.. 1918 touch libssh-$LIBSSH_VERSION-done 1919 fi 1920} 1921 1922uninstall_libssh() { 1923 if [ ! -z "$installed_libssh_version" ] ; then 1924 echo "Uninstalling libssh:" 1925 cd libssh-$installed_libssh_version 1926 # 1927 # libssh uses cmake and doesn't support "make uninstall"; 1928 # just remove what we know it installs. 1929 # 1930 # $DO_MAKE_UNINSTALL || exit 1 1931 $DO_RM -rf /usr/local/lib/libssh* \ 1932 /usr/local/include/libssh \ 1933 /usr/local/lib/pkgconfig/libssh* \ 1934 /usr/local/lib/cmake/libssh || exit 1 1935 # 1936 # libssh uses cmake and doesn't support "make distclean"; 1937 # just remove the entire build directory. 1938 # 1939 # make distclean || exit 1 1940 rm -rf build || exit 1 1941 cd .. 1942 rm libssh-$installed_libssh_version-done 1943 1944 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 1945 # 1946 # Get rid of the previously downloaded and unpacked version. 1947 # 1948 rm -rf libssh-$installed_libssh_version 1949 rm -rf libssh-$installed_libssh_version.tar.gz 1950 fi 1951 1952 installed_libssh_version="" 1953 fi 1954} 1955 1956install_nghttp2() { 1957 if [ "$NGHTTP2_VERSION" -a ! -f nghttp2-$NGHTTP2_VERSION-done ] ; then 1958 echo "Downloading, building, and installing nghttp2:" 1959 [ -f nghttp2-$NGHTTP2_VERSION.tar.xz ] || curl -L -O https://github.com/nghttp2/nghttp2/releases/download/v$NGHTTP2_VERSION/nghttp2-$NGHTTP2_VERSION.tar.xz || exit 1 1960 $no_build && echo "Skipping installation" && return 1961 xzcat nghttp2-$NGHTTP2_VERSION.tar.xz | tar xf - || exit 1 1962 cd nghttp2-$NGHTTP2_VERSION 1963 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1 1964 make $MAKE_BUILD_OPTS || exit 1 1965 $DO_MAKE_INSTALL || exit 1 1966 cd .. 1967 touch nghttp2-$NGHTTP2_VERSION-done 1968 fi 1969} 1970 1971uninstall_nghttp2() { 1972 if [ ! -z "$installed_nghttp2_version" ] ; then 1973 echo "Uninstalling nghttp2:" 1974 cd nghttp2-$installed_nghttp2_version 1975 $DO_MAKE_UNINSTALL || exit 1 1976 make distclean || exit 1 1977 cd .. 1978 rm nghttp2-$installed_nghttp2_version-done 1979 1980 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 1981 # 1982 # Get rid of the previously downloaded and unpacked version. 1983 # 1984 rm -rf nghttp2-$installed_nghttp2_version 1985 rm -rf nghttp2-$installed_nghttp2_version.tar.xz 1986 fi 1987 1988 installed_nghttp2_version="" 1989 fi 1990} 1991 1992install_libtiff() { 1993 if [ "$LIBTIFF_VERSION" -a ! -f tiff-$LIBTIFF_VERSION-done ] ; then 1994 echo "Downloading, building, and installing libtiff:" 1995 [ -f libtiff-$LIBTIFF_VERSION.tar.gz ] || curl -L -O http://dl.maptools.org/dl/libtiff/tiff-$LIBTIFF_VERSION.tar.gz || exit 1 1996 $no_build && echo "Skipping installation" && return 1997 gzcat tiff-$LIBTIFF_VERSION.tar.gz | tar xf - || exit 1 1998 cd tiff-$LIBTIFF_VERSION 1999 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1 2000 make $MAKE_BUILD_OPTS || exit 1 2001 $DO_MAKE_INSTALL || exit 1 2002 cd .. 2003 touch tiff-$LIBTIFF_VERSION-done 2004 fi 2005} 2006 2007uninstall_libtiff() { 2008 if [ ! -z "$installed_libtiff_version" ] ; then 2009 echo "Uninstalling libtiff:" 2010 cd tiff-$installed_libtiff_version 2011 $DO_MAKE_UNINSTALL || exit 1 2012 make distclean || exit 1 2013 cd .. 2014 rm tiff-$installed_libtiff_version-done 2015 2016 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 2017 # 2018 # Get rid of the previously downloaded and unpacked version. 2019 # 2020 rm -rf tiff-$installed_libtiff_version 2021 rm -rf tiff-$installed_libtiff_version.tar.gz 2022 fi 2023 2024 installed_libtiff_version="" 2025 fi 2026} 2027 2028install_spandsp() { 2029 if [ "$SPANDSP_VERSION" -a ! -f spandsp-$SPANDSP_VERSION-done ] ; then 2030 echo "Downloading, building, and installing SpanDSP:" 2031 [ -f spandsp-$SPANDSP_VERSION.tar.gz ] || curl -L -O https://www.soft-switch.org/downloads/spandsp/spandsp-$SPANDSP_VERSION.tar.gz || exit 1 2032 $no_build && echo "Skipping installation" && return 2033 gzcat spandsp-$SPANDSP_VERSION.tar.gz | tar xf - || exit 1 2034 cd spandsp-$SPANDSP_VERSION 2035 # 2036 # Don't use -Wunused-but-set-variable, as it's not supported 2037 # by all the gcc versions in the versions of Xcode that we 2038 # support. 2039 # 2040 patch -p0 <${topdir}/macosx-support-lib-patches/spandsp-configure-patch || exit 1 2041 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1 2042 make $MAKE_BUILD_OPTS || exit 1 2043 $DO_MAKE_INSTALL || exit 1 2044 cd .. 2045 touch spandsp-$SPANDSP_VERSION-done 2046 fi 2047} 2048 2049uninstall_spandsp() { 2050 if [ ! -z "$installed_spandsp_version" ] ; then 2051 echo "Uninstalling SpanDSP:" 2052 cd spandsp-$installed_spandsp_version 2053 $DO_MAKE_UNINSTALL || exit 1 2054 make distclean || exit 1 2055 cd .. 2056 rm spandsp-$installed_spandsp_version-done 2057 2058 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 2059 # 2060 # Get rid of the previously downloaded and unpacked version. 2061 # 2062 rm -rf spandsp-$installed_spandsp_version 2063 rm -rf spandsp-$installed_spandsp_version.tar.gz 2064 fi 2065 2066 installed_spandsp_version="" 2067 fi 2068} 2069 2070install_speexdsp() { 2071 if [ "$SPEEXDSP_VERSION" -a ! -f speexdsp-$SPEEXDSP_VERSION-done ] ; then 2072 echo "Downloading, building, and installing SpeexDSP:" 2073 [ -f speexdsp-$SPEEXDSP_VERSION.tar.gz ] || curl -L -O http://downloads.us.xiph.org/releases/speex/speexdsp-$SPEEXDSP_VERSION.tar.gz || exit 1 2074 $no_build && echo "Skipping installation" && return 2075 gzcat speexdsp-$SPEEXDSP_VERSION.tar.gz | tar xf - || exit 1 2076 cd speexdsp-$SPEEXDSP_VERSION 2077 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1 2078 make $MAKE_BUILD_OPTS || exit 1 2079 $DO_MAKE_INSTALL || exit 1 2080 cd .. 2081 touch speexdsp-$SPEEXDSP_VERSION-done 2082 fi 2083} 2084 2085uninstall_speexdsp() { 2086 if [ ! -z "$installed_speexdsp_version" ] ; then 2087 echo "Uninstalling SpeexDSP:" 2088 cd speexdsp-$installed_speexdsp_version 2089 $DO_MAKE_UNINSTALL || exit 1 2090 make distclean || exit 1 2091 cd .. 2092 rm speexdsp-$installed_speexdsp_version-done 2093 2094 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 2095 # 2096 # Get rid of the previously downloaded and unpacked version. 2097 # 2098 rm -rf speexdsp-$installed_speexdsp_version 2099 rm -rf speexdsp-$installed_speexdsp_version.tar.gz 2100 fi 2101 2102 installed_speexdsp_version="" 2103 fi 2104} 2105 2106install_bcg729() { 2107 if [ "$BCG729_VERSION" -a ! -f bcg729-$BCG729_VERSION-done ] ; then 2108 echo "Downloading, building, and installing bcg729:" 2109 [ -f bcg729-$BCG729_VERSION.tar.gz ] || curl -L -O http://download-mirror.savannah.gnu.org/releases/linphone/plugins/sources/bcg729-$BCG729_VERSION.tar.gz || exit 1 2110 $no_build && echo "Skipping installation" && return 2111 gzcat bcg729-$BCG729_VERSION.tar.gz | tar xf - || exit 1 2112 cd bcg729-$BCG729_VERSION 2113 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1 2114 make $MAKE_BUILD_OPTS || exit 1 2115 $DO_MAKE_INSTALL || exit 1 2116 cd .. 2117 touch bcg729-$BCG729_VERSION-done 2118 fi 2119} 2120 2121uninstall_bcg729() { 2122 if [ ! -z "$installed_bcg729_version" ] ; then 2123 echo "Uninstalling bcg729:" 2124 cd bcg729-$installed_bcg729_version 2125 $DO_MAKE_UNINSTALL || exit 1 2126 make distclean || exit 1 2127 cd .. 2128 rm bcg729-$installed_bcg729_version-done 2129 2130 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 2131 # 2132 # Get rid of the previously downloaded and unpacked version. 2133 # 2134 rm -rf bcg729-$installed_bcg729_version 2135 rm -rf bcg729-$installed_bcg729_version.tar.gz 2136 fi 2137 2138 installed_bcg729_version="" 2139 fi 2140} 2141 2142install_ilbc() { 2143 if [ -n "$ILBC_VERSION" ] && [ ! -f ilbc-$ILBC_VERSION-done ] ; then 2144 echo "Downloading, building, and installing iLBC:" 2145 [ -f libilbc-$ILBC_VERSION.tar.bz ] || curl --location --remote-name https://github.com/TimothyGu/libilbc/releases/download/v$ILBC_VERSION/libilbc-$ILBC_VERSION.tar.bz2 || exit 1 2146 $no_build && echo "Skipping installation" && return 2147 bzcat libilbc-$ILBC_VERSION.tar.bz2 | tar xf - || exit 1 2148 cd libilbc-$ILBC_VERSION || exit 1 2149 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1 2150 make $MAKE_BUILD_OPTS || exit 1 2151 $DO_MAKE_INSTALL || exit 1 2152 cd .. 2153 touch ilbc-$ILBC_VERSION-done 2154 fi 2155} 2156 2157uninstall_ilbc() { 2158 if [ -n "$installed_ilbc_version" ] ; then 2159 echo "Uninstalling iLBC:" 2160 cd "libilbc-$installed_ilbc_version" || exit 1 2161 $DO_MAKE_UNINSTALL || exit 1 2162 make distclean || exit 1 2163 cd .. 2164 rm "ilbc-$installed_ilbc_version-done" 2165 2166 if [ "$#" -eq 1 ] && [ "$1" = "-r" ] ; then 2167 # 2168 # Get rid of the previously downloaded and unpacked version. 2169 # 2170 rm -rf "libilbc-$installed_ilbc_version" 2171 rm -rf "libilbc-$installed_ilbc_version.tar.bz2" 2172 fi 2173 2174 installed_ilbc_version="" 2175 fi 2176} 2177 2178install_opus() { 2179 if [ "$OPUS_VERSION" -a ! -f opus-$OPUS_VERSION-done ] ; then 2180 echo "Downloading, building, and installing opus:" 2181 [ -f opus-$OPUS_VERSION.tar.gz ] || curl -L -O https://archive.mozilla.org/pub/opus/opus-$OPUS_VERSION.tar.gz || exit 1 2182 $no_build && echo "Skipping installation" && return 2183 gzcat opus-$OPUS_VERSION.tar.gz | tar xf - || exit 1 2184 cd opus-$OPUS_VERSION 2185 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1 2186 make $MAKE_BUILD_OPTS || exit 1 2187 $DO_MAKE_INSTALL || exit 1 2188 cd .. 2189 touch opus-$OPUS_VERSION-done 2190 fi 2191} 2192 2193uninstall_opus() { 2194 if [ ! -z "$installed_opus_version" ] ; then 2195 echo "Uninstalling opus:" 2196 cd opus-$installed_opus_version 2197 $DO_MAKE_UNINSTALL || exit 1 2198 make distclean || exit 1 2199 cd .. 2200 rm opus-$installed_opus_version-done 2201 2202 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 2203 # 2204 # Get rid of the previously downloaded and unpacked version. 2205 # 2206 rm -rf opus-$installed_opus_version 2207 rm -rf opus-$installed_opus_version.tar.gz 2208 fi 2209 2210 installed_opus_version="" 2211 fi 2212} 2213 2214install_python3() { 2215 # The macos11 installer can be deployed to older versions, down to 2216 # 10.9 (Mavericks), but is still considered experimental so continue 2217 # to use the 64-bit installer (10.9) on earlier releases for now. 2218 local macver=x10.9 2219 if [[ $DARWIN_MAJOR_VERSION -gt 19 ]]; then 2220 # The macos11 installer is required for Arm-based Macs, which require 2221 # macOS 11 Big Sur. Note that the package name is "11.0" (no x) for 2222 # 3.9.1 but simply "11" for 3.9.2 (and later) 2223 if [[ $PYTHON3_VERSION = 3.9.1 ]]; then 2224 macver=11.0 2225 else 2226 macver=11 2227 fi 2228 elif [[ $DARWIN_MAJOR_VERSION -lt 13 ]]; then 2229 # The 64-bit installer requires 10.9 (Mavericks), use the 64-bit/32-bit 2230 # variant for 10.8 (Mountain Lion). 2231 macver=x10.6 2232 fi 2233 if [ "$PYTHON3_VERSION" -a ! -f python3-$PYTHON3_VERSION-done ] ; then 2234 echo "Downloading and installing python3:" 2235 [ -f python-$PYTHON3_VERSION-macos$macver.pkg ] || curl -L -O https://www.python.org/ftp/python/$PYTHON3_VERSION/python-$PYTHON3_VERSION-macos$macver.pkg || exit 1 2236 $no_build && echo "Skipping installation" && return 2237 sudo installer -target / -pkg python-$PYTHON3_VERSION-macos$macver.pkg || exit 1 2238 touch python3-$PYTHON3_VERSION-done 2239 2240 # 2241 # On macOS, the pip3 installed from Python packages appears to 2242 # install scripts /Library/Frameworks/Python.framework/Versions/M.N/bin, 2243 # where M.N is the major and minor version of Python (the dot-dot 2244 # release is irrelevant). 2245 # 2246 # Strip off any dot-dot component in $PYTHON3_VERSION. 2247 # 2248 python_version=`echo $PYTHON3_VERSION | sed 's/\([1-9][0-9]*\.[1-9][0-9]*\).*/\1/'` 2249 # 2250 # Now treat Meson as being in the directory in question. 2251 # 2252 MESON="/Library/Frameworks/Python.framework/Versions/$python_version/bin/meson" 2253 else 2254 # 2255 # We're using the Python 3 that's in /usr/bin, the pip3 for 2256 # which installs scripts in /usr/local/bin, so, when we 2257 # install Meson, look for it there. 2258 # 2259 MESON=/usr/local/bin/meson 2260 fi 2261} 2262 2263uninstall_python3() { 2264 # Major version (e.g. "3.7") 2265 local PYTHON_VERSION=${installed_python3_version%.*} 2266 if [ ! -z "$installed_python3_version" ] ; then 2267 echo "Uninstalling python3:" 2268 frameworkdir="/Library/Frameworks/Python.framework/Versions/$PYTHON_VERSION" 2269 sudo rm -rf "$frameworkdir" 2270 sudo rm -rf "/Applications/Python $PYTHON_VERSION" 2271 sudo find /usr/local/bin -maxdepth 1 -lname "*$frameworkdir/bin/*" -delete 2272 # Remove three symlinks and empty directories. Removing directories 2273 # might fail if for some reason multiple versions are installed. 2274 sudo rm /Library/Frameworks/Python.framework/Headers 2275 sudo rm /Library/Frameworks/Python.framework/Python 2276 sudo rm /Library/Frameworks/Python.framework/Resources 2277 sudo rmdir /Library/Frameworks/Python.framework/Versions 2278 sudo rmdir /Library/Frameworks/Python.framework 2279 sudo pkgutil --forget org.python.Python.PythonApplications-$PYTHON_VERSION 2280 sudo pkgutil --forget org.python.Python.PythonDocumentation-$PYTHON_VERSION 2281 sudo pkgutil --forget org.python.Python.PythonFramework-$PYTHON_VERSION 2282 sudo pkgutil --forget org.python.Python.PythonUnixTools-$PYTHON_VERSION 2283 rm python3-$installed_python3_version-done 2284 2285 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 2286 # 2287 # Get rid of the previously downloaded and unpacked version. 2288 # 2289 rm -f python-$installed_python3_version-macos11.pkg 2290 rm -f python-$installed_python3_version-macos11.0.pkg 2291 rm -f python-$installed_python3_version-macosx10.9.pkg 2292 rm -f python-$installed_python3_version-macosx10.6.pkg 2293 fi 2294 2295 installed_python3_version="" 2296 fi 2297} 2298 2299install_brotli() { 2300 if [ "$BROTLI_VERSION" -a ! -f brotli-$BROTLI_VERSION-done ] ; then 2301 echo "Downloading, building, and installing brotli:" 2302 [ -f brotli-$BROTLI_VERSION.tar.gz ] || curl -L -o brotli-$BROTLI_VERSION.tar.gz https://github.com/google/brotli/archive/v$BROTLI_VERSION.tar.gz || exit 1 2303 $no_build && echo "Skipping installation" && return 2304 gzcat brotli-$BROTLI_VERSION.tar.gz | tar xf - || exit 1 2305 cd brotli-$BROTLI_VERSION 2306 mkdir build_dir 2307 cd build_dir 2308 MACOSX_DEPLOYMENT_TARGET=$min_osx_target SDKROOT="$SDKPATH" cmake ../ || exit 1 2309 make $MAKE_BUILD_OPTS || exit 1 2310 $DO_MAKE_INSTALL || exit 1 2311 cd ../.. 2312 touch brotli-$BROTLI_VERSION-done 2313 fi 2314} 2315 2316uninstall_brotli() { 2317 if [ ! -z "$installed_brotli_version" ] ; then 2318 echo "Uninstalling brotli:" 2319 cd brotli-$installed_brotli_version 2320 # 2321 # brotli uses cmake on macOS and doesn't support "make uninstall"; 2322 # just remove what we know it installs. 2323 # 2324 # $DO_MAKE_UNINSTALL || exit 1 2325 $DO_RM -rf /usr/local/bin/brotli \ 2326 /usr/local/lib/libbrotli* \ 2327 /usr/local/include/brotli \ 2328 /usr/local/lib/pkgconfig/libbrotli* || exit 1 2329 # 2330 # brotli uses cmake on macOS and doesn't support "make distclean"; 2331 # just remove the enire build directory. 2332 # 2333 # make distclean || exit 1 2334 rm -rf build_dir || exit 1 2335 cd .. 2336 rm brotli-$installed_brotli_version-done 2337 2338 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then 2339 # 2340 # Get rid of the previously downloaded and unpacked version. 2341 # 2342 rm -rf brotli-$installed_brotli_version 2343 rm -rf brotli-$installed_brotli_version.tar.gz 2344 fi 2345 2346 installed_brotli_version="" 2347 fi 2348} 2349 2350install_minizip() { 2351 if [ "$ZLIB_VERSION" ] && [ ! -f minizip-$ZLIB_VERSION-done ] ; then 2352 echo "Downloading, building, and installing zlib for minizip:" 2353 [ -f zlib-$ZLIB_VERSION.tar.gz ] || curl -L -o zlib-$ZLIB_VERSION.tar.gz https://zlib.net/zlib-$ZLIB_VERSION.tar.gz || exit 1 2354 $no_build && echo "Skipping installation" && return 2355 gzcat zlib-$ZLIB_VERSION.tar.gz | tar xf - || exit 1 2356 # 2357 # minizip ships both with a minimal Makefile that doesn't 2358 # support "make install", "make uninstall", or "make distclean", 2359 # and with a Makefile.am file that, if we do an autoreconf, 2360 # gives us a configure script, and a Makefile.in that, if we run 2361 # the configure script, gives us a Makefile that supports ll of 2362 # those targets, and that installs a pkg-config .pc file for 2363 # minizip. 2364 # 2365 # So that's what we do. 2366 # 2367 cd zlib-$ZLIB_VERSION/contrib/minizip || exit 1 2368 LIBTOOLIZE=glibtoolize autoreconf --force --install 2369 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0 $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS -D_FORTIFY_SOURCE=0 $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure || exit 1 2370 make $MAKE_BUILD_OPTS || exit 1 2371 $DO_MAKE_INSTALL || exit 1 2372 cd ../../.. 2373 touch minizip-$ZLIB_VERSION-done 2374 fi 2375} 2376 2377uninstall_minizip() { 2378 if [ -n "$installed_minizip_version" ] ; then 2379 echo "Uninstalling minizip:" 2380 cd zlib-$installed_minizip_version/contrib/minizip 2381 $DO_MAKE_UNINSTALL || exit 1 2382 make distclean || exit 1 2383 cd ../../.. 2384 2385 rm minizip-$installed_minizip_version-done 2386 2387 if [ "$#" -eq 1 ] && [ "$1" = "-r" ] ; then 2388 # 2389 # Get rid of the previously downloaded and unpacked version. 2390 # 2391 rm -rf zlib-$installed_minizip_version 2392 rm -rf zlib-$installed_minizip_version.tar.gz 2393 fi 2394 2395 installed_minizip_version="" 2396 fi 2397} 2398 2399install_sparkle() { 2400 if [ "$SPARKLE_VERSION" ] && [ ! -f sparkle-$SPARKLE_VERSION-done ] ; then 2401 echo "Downloading and installing Sparkle:" 2402 # 2403 # Download the tarball and unpack it in /usr/local/Sparkle-x.y.z 2404 # 2405 [ -f Sparkle-$SPARKLE_VERSION.tar.xz ] || curl -L -o Sparkle-$SPARKLE_VERSION.tar.xz https://github.com/sparkle-project/Sparkle/releases/download/$SPARKLE_VERSION/Sparkle-$SPARKLE_VERSION.tar.xz || exit 1 2406 $no_build && echo "Skipping installation" && return 2407 test -d "/usr/local/Sparkle-$SPARKLE_VERSION" || sudo mkdir "/usr/local/Sparkle-$SPARKLE_VERSION" 2408 sudo tar -C "/usr/local/Sparkle-$SPARKLE_VERSION" -xpof Sparkle-$SPARKLE_VERSION.tar.xz 2409 touch sparkle-$SPARKLE_VERSION-done 2410 fi 2411} 2412 2413uninstall_sparkle() { 2414 if [ -n "$installed_sparkle_version" ]; then 2415 echo "Uninstalling Sparkle:" 2416 sudo rm -rf "/usr/local/Sparkle-$installed_sparkle_version" 2417 if [ "$#" -eq 1 ] && [ "$1" = "-r" ] ; then 2418 rm -f "Sparkle-$installed_sparkle_version.tar.xz" 2419 fi 2420 2421 installed_sparkle_version="" 2422 fi 2423} 2424 2425install_all() { 2426 # 2427 # Check whether the versions we have installed are the versions 2428 # requested; if not, uninstall the installed versions. 2429 # 2430 if [ ! -z "$installed_brotli_version" -a \ 2431 "$installed_brotli_version" != "$BROTLI_VERSION" ] ; then 2432 echo "Installed brotli version is $installed_brotli_version" 2433 if [ -z "$BROTLI_VERSION" ] ; then 2434 echo "brotli is not requested" 2435 else 2436 echo "Requested brotli version is $BROTLI_VERSION" 2437 fi 2438 uninstall_brotli -r 2439 fi 2440 2441 if [ ! -z "$installed_python3_version" -a \ 2442 "$installed_python3_version" != "$PYTHON3_VERSION" ] ; then 2443 echo "Installed python3 version is $installed_python3_version" 2444 if [ -z "$PYTHON3_VERSION" ] ; then 2445 echo "python3 is not requested" 2446 else 2447 echo "Requested python3 version is $PYTHON3_VERSION" 2448 fi 2449 uninstall_python3 -r 2450 fi 2451 2452 if [ ! -z "$installed_bcg729_version" -a \ 2453 "$installed_bcg729_version" != "$BCG729_VERSION" ] ; then 2454 echo "Installed bcg729 version is $installed_bcg729_version" 2455 if [ -z "$BCG729_VERSION" ] ; then 2456 echo "bcg729 is not requested" 2457 else 2458 echo "Requested bcg729 version is $BCG729_VERSION" 2459 fi 2460 uninstall_bcg729 -r 2461 fi 2462 2463 if [ -n "$installed_ilbc_version" ] \ 2464 && [ "$installed_ilbc_version" != "$ILBC_VERSION" ] ; then 2465 echo "Installed iLBC version is $installed_ilbc_version" 2466 if [ -z "$ILBC_VERSION" ] ; then 2467 echo "iLBC is not requested" 2468 else 2469 echo "Requested iLBC version is $ILBC_VERSION" 2470 fi 2471 uninstall_ilbc -r 2472 fi 2473 2474 if [ -n "$installed_opus_version" ] \ 2475 && [ "$installed_opus_version" != "$OPUS_VERSION" ] ; then 2476 echo "Installed opus version is $installed_opus_version" 2477 if [ -z "$OPUS_VERSION" ] ; then 2478 echo "opus is not requested" 2479 else 2480 echo "Requested opus version is $OPUS_VERSION" 2481 fi 2482 uninstall_opus -r 2483 fi 2484 2485 if [ ! -z "$installed_spandsp_version" -a \ 2486 "$installed_spandsp_version" != "$SPANDSP_VERSION" ] ; then 2487 echo "Installed SpanDSP version is $installed_spandsp_version" 2488 if [ -z "$SPANDSP_VERSION" ] ; then 2489 echo "spandsp is not requested" 2490 else 2491 echo "Requested SpanDSP version is $SPANDSP_VERSION" 2492 fi 2493 uninstall_spandsp -r 2494 fi 2495 2496 if [ ! -z "$installed_speexdsp_version" -a \ 2497 "$installed_speexdsp_version" != "$SPEEXDSP_VERSION" ] ; then 2498 echo "Installed SpeexDSP version is $installed_speexdsp_version" 2499 if [ -z "$SPEEXDSP_VERSION" ] ; then 2500 echo "speexdsp is not requested" 2501 else 2502 echo "Requested SpeexDSP version is $SPEEXDSP_VERSION" 2503 fi 2504 uninstall_speexdsp -r 2505 fi 2506 2507 if [ ! -z "$installed_libtiff_version" -a \ 2508 "$installed_libtiff_version" != "$LIBTIFF_VERSION" ] ; then 2509 echo "Installed libtiff version is $installed_libtiff_version" 2510 if [ -z "$LIBTIFF_VERSION" ] ; then 2511 echo "libtiff is not requested" 2512 else 2513 echo "Requested libtiff version is $LIBTIFF_VERSION" 2514 fi 2515 uninstall_libtiff -r 2516 fi 2517 2518 if [ ! -z "$installed_nghttp2_version" -a \ 2519 "$installed_nghttp2_version" != "$NGHTTP2_VERSION" ] ; then 2520 echo "Installed nghttp2 version is $installed_nghttp2_version" 2521 if [ -z "$NGHTTP2_VERSION" ] ; then 2522 echo "nghttp2 is not requested" 2523 else 2524 echo "Requested nghttp2 version is $NGHTTP2_VERSION" 2525 fi 2526 uninstall_nghttp2 -r 2527 fi 2528 2529 if [ ! -z "$installed_libssh_version" -a \ 2530 "$installed_libssh_version" != "$LIBSSH_VERSION" ] ; then 2531 echo "Installed libssh version is $installed_libssh_version" 2532 if [ -z "$LIBSSH_VERSION" ] ; then 2533 echo "libssh is not requested" 2534 else 2535 echo "Requested libssh version is $LIBSSH_VERSION" 2536 fi 2537 uninstall_libssh -r 2538 fi 2539 2540 if [ ! -z "$installed_cares_version" -a \ 2541 "$installed_cares_version" != "$CARES_VERSION" ] ; then 2542 echo "Installed C-Ares version is $installed_cares_version" 2543 if [ -z "$CARES_VERSION" ] ; then 2544 echo "C-Ares is not requested" 2545 else 2546 echo "Requested C-Ares version is $CARES_VERSION" 2547 fi 2548 uninstall_c_ares -r 2549 fi 2550 2551 if [ ! -z "$installed_maxminddb_version" -a \ 2552 "$installed_maxminddb_version" != "$MAXMINDDB_VERSION" ] ; then 2553 echo "Installed MaxMindDB API version is $installed_maxminddb_version" 2554 if [ -z "$MAXMINDDB_VERSION" ] ; then 2555 echo "MaxMindDB is not requested" 2556 else 2557 echo "Requested MaxMindDB version is $MAXMINDDB_VERSION" 2558 fi 2559 uninstall_maxminddb -r 2560 fi 2561 2562 if [ ! -z "$installed_sbc_version" -a \ 2563 "$installed_sbc_version" != "$SBC_VERSION" ] ; then 2564 echo "Installed SBC version is $installed_sbc_version" 2565 if [ -z "$SBC_VERSION" ] ; then 2566 echo "SBC is not requested" 2567 else 2568 echo "Requested SBC version is $SBC_VERSION" 2569 fi 2570 uninstall_sbc -r 2571 fi 2572 2573 if [ ! -z "$installed_lz4_version" -a \ 2574 "$installed_lz4_version" != "$LZ4_VERSION" ] ; then 2575 echo "Installed LZ4 version is $installed_lz4_version" 2576 if [ -z "$LZ4_VERSION" ] ; then 2577 echo "LZ4 is not requested" 2578 else 2579 echo "Requested LZ4 version is $LZ4_VERSION" 2580 fi 2581 uninstall_lz4 -r 2582 fi 2583 2584 if [ ! -z "$installed_libxml2_version" -a \ 2585 "$installed_libxml2_version" != "$LIBXML2_VERSION" ] ; then 2586 echo "Installed libxml2 version is $installed_libxml2_version" 2587 if [ -z "$LIBXML2_VERSION" ] ; then 2588 echo "libxml2 is not requested" 2589 else 2590 echo "Requested libxml2 version is $LIBXML2_VERSION" 2591 fi 2592 uninstall_libxml2 -r 2593 fi 2594 2595 if [ ! -z "$installed_snappy_version" -a \ 2596 "$installed_snappy_version" != "$SNAPPY_VERSION" ] ; then 2597 echo "Installed SNAPPY version is $installed_snappy_version" 2598 if [ -z "$SNAPPY_VERSION" ] ; then 2599 echo "SNAPPY is not requested" 2600 else 2601 echo "Requested SNAPPY version is $SNAPPY_VERSION" 2602 fi 2603 uninstall_snappy -r 2604 fi 2605 2606 if [ ! -z "$installed_lua_version" -a \ 2607 "$installed_lua_version" != "$LUA_VERSION" ] ; then 2608 echo "Installed Lua version is $installed_lua_version" 2609 if [ -z "$LUA_VERSION" ] ; then 2610 echo "Lua is not requested" 2611 else 2612 echo "Requested Lua version is $LUA_VERSION" 2613 fi 2614 uninstall_lua -r 2615 fi 2616 2617 if [ ! -z "$installed_gnutls_version" -a \ 2618 "$installed_gnutls_version" != "$GNUTLS_VERSION" ] ; then 2619 echo "Installed GnuTLS version is $installed_gnutls_version" 2620 if [ -z "$GNUTLS_VERSION" ] ; then 2621 echo "GnuTLS is not requested" 2622 else 2623 echo "Requested GnuTLS version is $GNUTLS_VERSION" 2624 fi 2625 uninstall_gnutls -r 2626 fi 2627 2628 if [ ! -z "$installed_nettle_version" -a \ 2629 "$installed_nettle_version" != "$NETTLE_VERSION" ] ; then 2630 echo "Installed Nettle version is $installed_nettle_version" 2631 if [ -z "$NETTLE_VERSION" ] ; then 2632 echo "Nettle is not requested" 2633 else 2634 echo "Requested Nettle version is $NETTLE_VERSION" 2635 fi 2636 uninstall_nettle -r 2637 fi 2638 2639 if [ ! -z "$installed_gmp_version" -a \ 2640 "$installed_gmp_version" != "$GMP_VERSION" ] ; then 2641 echo "Installed GMP version is $installed_gmp_version" 2642 if [ -z "$GMP_VERSION" ] ; then 2643 echo "GMP is not requested" 2644 else 2645 echo "Requested GMP version is $GMP_VERSION" 2646 fi 2647 uninstall_gmp -r 2648 fi 2649 2650 if [ ! -z "$installed_p11_kit_version" -a \ 2651 "$installed_p11_kit_version" != "$P11KIT_VERSION" ] ; then 2652 echo "Installed p11-kit version is $installed_p11_kit_version" 2653 if [ -z "$P11KIT_VERSION" ] ; then 2654 echo "p11-kit is not requested" 2655 else 2656 echo "Requested p11-kit version is $P11KIT_VERSION" 2657 fi 2658 uninstall_p11_kit -r 2659 fi 2660 2661 if [ ! -z "$installed_libtasn1_version" -a \ 2662 "$installed_libtasn1_version" != "$LIBTASN1_VERSION" ] ; then 2663 echo "Installed libtasn1 version is $installed_libtasn1_version" 2664 if [ -z "$LIBTASN1_VERSION" ] ; then 2665 echo "libtasn1 is not requested" 2666 else 2667 echo "Requested libtasn1 version is $LIBTASN1_VERSION" 2668 fi 2669 uninstall_libtasn1 -r 2670 fi 2671 2672 if [ ! -z "$installed_libgcrypt_version" -a \ 2673 "$installed_libgcrypt_version" != "$LIBGCRYPT_VERSION" ] ; then 2674 echo "Installed libgcrypt version is $installed_libgcrypt_version" 2675 if [ -z "$LIBGCRYPT_VERSION" ] ; then 2676 echo "libgcrypt is not requested" 2677 else 2678 echo "Requested libgcrypt version is $LIBGCRYPT_VERSION" 2679 fi 2680 uninstall_libgcrypt -r 2681 fi 2682 2683 if [ ! -z "$installed_libgpg_error_version" -a \ 2684 "$installed_libgpg_error_version" != "$LIBGPG_ERROR_VERSION" ] ; then 2685 echo "Installed libgpg-error version is $installed_libgpg_error_version" 2686 if [ -z "$LIBGPG_ERROR_VERSION" ] ; then 2687 echo "libgpg-error is not requested" 2688 else 2689 echo "Requested libgpg-error version is $LIBGPG_ERROR_VERSION" 2690 fi 2691 uninstall_libgpg_error -r 2692 fi 2693 2694 if [ ! -z "$installed_libsmi_version" -a \ 2695 "$installed_libsmi_version" != "$LIBSMI_VERSION" ] ; then 2696 echo "Installed libsmi version is $installed_libsmi_version" 2697 if [ -z "$LIBSMI_VERSION" ] ; then 2698 echo "libsmi is not requested" 2699 else 2700 echo "Requested libsmi version is $LIBSMI_VERSION" 2701 fi 2702 uninstall_libsmi -r 2703 fi 2704 2705 if [ ! -z "$installed_qt_version" -a \ 2706 "$installed_qt_version" != "$QT_VERSION" ] ; then 2707 echo "Installed Qt version is $installed_qt_version" 2708 if [ -z "$QT_VERSION" ] ; then 2709 echo "Qt is not requested" 2710 else 2711 echo "Requested Qt version is $QT_VERSION" 2712 fi 2713 uninstall_qt -r 2714 fi 2715 2716 if [ ! -z "$installed_glib_version" -a \ 2717 "$installed_glib_version" != "$GLIB_VERSION" ] ; then 2718 echo "Installed GLib version is $installed_glib_version" 2719 if [ -z "$GLIB_VERSION" ] ; then 2720 echo "GLib is not requested" 2721 else 2722 echo "Requested GLib version is $GLIB_VERSION" 2723 fi 2724 uninstall_glib -r 2725 fi 2726 2727 if [ ! -z "$installed_pkg_config_version" -a \ 2728 "$installed_pkg_config_version" != "$PKG_CONFIG_VERSION" ] ; then 2729 echo "Installed pkg-config version is $installed_pkg_config_version" 2730 if [ -z "$PKG_CONFIG_VERSION" ] ; then 2731 echo "pkg-config is not requested" 2732 else 2733 echo "Requested pkg-config version is $PKG_CONFIG_VERSION" 2734 fi 2735 uninstall_pkg_config -r 2736 fi 2737 2738 if [ ! -z "$installed_gettext_version" -a \ 2739 "$installed_gettext_version" != "$GETTEXT_VERSION" ] ; then 2740 echo "Installed GNU gettext version is $installed_gettext_version" 2741 if [ -z "$GETTEXT_VERSION" ] ; then 2742 echo "GNU gettext is not requested" 2743 else 2744 echo "Requested GNU gettext version is $GETTEXT_VERSION" 2745 fi 2746 uninstall_gettext -r 2747 fi 2748 2749 if [ ! -z "$installed_ninja_version" -a \ 2750 "$installed_ninja_version" != "$NINJA_VERSION" ] ; then 2751 echo "Installed Ninja version is $installed_ninja_version" 2752 if [ -z "$NINJA_VERSION" ] ; then 2753 echo "Ninja is not requested" 2754 else 2755 echo "Requested Ninja version is $NINJA_VERSION" 2756 fi 2757 uninstall_ninja -r 2758 fi 2759 2760 if [ ! -z "$installed_asciidoctorpdf_version" -a \ 2761 "$installed_asciidoctorpdf_version" != "$ASCIIDOCTORPDF_VERSION" ] ; then 2762 echo "Installed Asciidoctor-pdf version is $installed_asciidoctorpdf_version" 2763 if [ -z "$ASCIIDOCTORPDF_VERSION" ] ; then 2764 echo "Asciidoctor-pdf is not requested" 2765 else 2766 echo "Requested Asciidoctor-pdf version is $ASCIIDOCTORPDF_VERSION" 2767 fi 2768 # XXX - really remove this? 2769 # Or should we remember it as installed only if this script 2770 # installed it? 2771 # 2772 uninstall_asciidoctorpdf -r 2773 fi 2774 2775 if [ ! -z "$installed_asciidoctor_version" -a \ 2776 "$installed_asciidoctor_version" != "$ASCIIDOCTOR_VERSION" ] ; then 2777 echo "Installed Asciidoctor version is $installed_asciidoctor_version" 2778 if [ -z "$ASCIIDOCTOR_VERSION" ] ; then 2779 echo "Asciidoctor is not requested" 2780 else 2781 echo "Requested Asciidoctor version is $ASCIIDOCTOR_VERSION" 2782 fi 2783 # XXX - really remove this? 2784 # Or should we remember it as installed only if this script 2785 # installed it? 2786 # 2787 uninstall_asciidoctor -r 2788 fi 2789 2790 if [ ! -z "$installed_cmake_version" -a \ 2791 "$installed_cmake_version" != "$CMAKE_VERSION" ] ; then 2792 echo "Installed CMake version is $installed_cmake_version" 2793 if [ -z "$CMAKE_VERSION" ] ; then 2794 echo "CMake is not requested" 2795 else 2796 echo "Requested CMake version is $CMAKE_VERSION" 2797 fi 2798 uninstall_cmake -r 2799 fi 2800 2801 if [ ! -z "$installed_libtool_version" -a \ 2802 "$installed_libtool_version" != "$LIBTOOL_VERSION" ] ; then 2803 echo "Installed GNU libtool version is $installed_libtool_version" 2804 if [ -z "$LIBTOOL_VERSION" ] ; then 2805 echo "GNU libtool is not requested" 2806 else 2807 echo "Requested GNU libtool version is $LIBTOOL_VERSION" 2808 fi 2809 uninstall_libtool -r 2810 fi 2811 2812 if [ ! -z "$installed_automake_version" -a \ 2813 "$installed_automake_version" != "$AUTOMAKE_VERSION" ] ; then 2814 echo "Installed GNU automake version is $installed_automake_version" 2815 if [ -z "$AUTOMAKE_VERSION" ] ; then 2816 echo "GNU automake is not requested" 2817 else 2818 echo "Requested GNU automake version is $AUTOMAKE_VERSION" 2819 fi 2820 uninstall_automake -r 2821 fi 2822 2823 if [ ! -z "$installed_autoconf_version" -a \ 2824 "$installed_autoconf_version" != "$AUTOCONF_VERSION" ] ; then 2825 echo "Installed GNU autoconf version is $installed_autoconf_version" 2826 if [ -z "$AUTOCONF_VERSION" ] ; then 2827 echo "GNU autoconf is not requested" 2828 else 2829 echo "Requested GNU autoconf version is $AUTOCONF_VERSION" 2830 fi 2831 uninstall_autoconf -r 2832 fi 2833 2834 if [ ! -z "$installed_pcre_version" -a \ 2835 "$installed_pcre_version" != "$PCRE_VERSION" ] ; then 2836 echo "Installed pcre version is $installed_pcre_version" 2837 if [ -z "$PCRE_VERSION" ] ; then 2838 echo "pcre is not requested" 2839 else 2840 echo "Requested pcre version is $PCRE_VERSION" 2841 fi 2842 uninstall_pcre -r 2843 fi 2844 2845 if [ ! -z "$installed_lzip_version" -a \ 2846 "$installed_lzip_version" != "$LZIP_VERSION" ] ; then 2847 echo "Installed lzip version is $installed_lzip_version" 2848 if [ -z "$LZIP_VERSION" ] ; then 2849 echo "lzip is not requested" 2850 else 2851 echo "Requested lzip version is $LZIP_VERSION" 2852 fi 2853 uninstall_lzip -r 2854 fi 2855 2856 if [ ! -z "$installed_xz_version" -a \ 2857 "$installed_xz_version" != "$XZ_VERSION" ] ; then 2858 echo "Installed xz version is $installed_xz_version" 2859 if [ -z "$XZ_VERSION" ] ; then 2860 echo "xz is not requested" 2861 else 2862 echo "Requested xz version is $XZ_VERSION" 2863 fi 2864 uninstall_xz -r 2865 fi 2866 2867 if [ ! -z "$installed_curl_version" -a \ 2868 "$installed_curl_version" != "$CURL_VERSION" ] ; then 2869 echo "Installed curl version is $installed_curl_version" 2870 if [ -z "$CURL_VERSION" ] ; then 2871 echo "curl is not requested" 2872 else 2873 echo "Requested curl version is $CURL_VERSION" 2874 fi 2875 uninstall_curl -r 2876 fi 2877 2878 if [ ! -z "$installed_minizip_version" -a \ 2879 "$installed_minizip_version" != "$ZLIB_VERSION" ] ; then 2880 echo "Installed minizip (zlib) version is $installed_minizip_version" 2881 if [ -z "$ZLIB_VERSION" ] ; then 2882 echo "minizip is not requested" 2883 else 2884 echo "Requested minizip (zlib) version is $ZLIB_VERSION" 2885 fi 2886 uninstall_minizip -r 2887 fi 2888 2889 if [ ! -z "$installed_sparkle_version" -a \ 2890 "$installed_sparkle_version" != "$SPARKLE_VERSION" ] ; then 2891 echo "Installed Sparkle version is $installed_sparkle_version" 2892 if [ -z "$SPARKLE_VERSION" ] ; then 2893 echo "Sparkle is not requested" 2894 else 2895 echo "Requested Sparkle version is $SPARKLE_VERSION" 2896 fi 2897 uninstall_sparkle -r 2898 fi 2899 2900 # 2901 # Start with curl: we may need it to download and install xz. 2902 # 2903 install_curl 2904 2905 # 2906 # Now intall xz: it is the sole download format of glib later than 2.31.2. 2907 # 2908 install_xz 2909 2910 install_lzip 2911 2912 install_pcre 2913 2914 install_autoconf 2915 2916 install_automake 2917 2918 install_libtool 2919 2920 install_cmake 2921 2922 # 2923 # Install Python 3 now; not only is it needed for the Wireshark 2924 # build process, it's also needed for the Meson build system, 2925 # which newer versions of GLib use as their build system. 2926 # 2927 install_python3 2928 2929 # 2930 # Now install Meson. 2931 # 2932 install_meson 2933 2934 install_ninja 2935 2936 install_asciidoctor 2937 2938 install_asciidoctorpdf 2939 2940 # 2941 # Start with GNU gettext; GLib requires it, and macOS doesn't have it 2942 # or a BSD-licensed replacement. 2943 # 2944 # At least on Lion with Xcode 4, _FORTIFY_SOURCE gets defined as 2 2945 # by default, which causes, for example, stpncpy to be defined as 2946 # a hairy macro that collides with the GNU gettext configure script's 2947 # attempts to workaround AIX's lack of a declaration for stpncpy, 2948 # with the result being a huge train wreck. Define _FORTIFY_SOURCE 2949 # as 0 in an attempt to keep the trains on separate tracks. 2950 # 2951 install_gettext 2952 2953 # 2954 # GLib depends on pkg-config. 2955 # By default, pkg-config depends on GLib; we break the dependency cycle 2956 # by configuring pkg-config to use its own internal version of GLib. 2957 # 2958 install_pkg_config 2959 2960 install_glib 2961 2962 # 2963 # Now we have reached a point where we can build everything but 2964 # the GUI (Wireshark). 2965 # 2966 install_qt 2967 2968 # 2969 # Now we have reached a point where we can build everything including 2970 # the GUI (Wireshark), but not with any optional features such as 2971 # SNMP OID resolution, some forms of decryption, Lua scripting, playback 2972 # of audio, or MaxMindDB mapping of IP addresses. 2973 # 2974 # We now conditionally download optional libraries to support them; 2975 # the default is to download them all. 2976 # 2977 2978 install_libsmi 2979 2980 install_libgpg_error 2981 2982 install_libgcrypt 2983 2984 install_gmp 2985 2986 install_libtasn1 2987 2988 install_p11_kit 2989 2990 install_nettle 2991 2992 install_gnutls 2993 2994 install_lua 2995 2996 install_snappy 2997 2998 install_zstd 2999 3000 install_libxml2 3001 3002 install_lz4 3003 3004 install_sbc 3005 3006 install_maxminddb 3007 3008 install_c_ares 3009 3010 install_libssh 3011 3012 install_nghttp2 3013 3014 install_libtiff 3015 3016 install_spandsp 3017 3018 install_speexdsp 3019 3020 install_bcg729 3021 3022 install_ilbc 3023 3024 install_opus 3025 3026 install_brotli 3027 3028 install_minizip 3029 3030 install_sparkle 3031} 3032 3033uninstall_all() { 3034 if [ -d "${MACOSX_SUPPORT_LIBS}" ] 3035 then 3036 cd "${MACOSX_SUPPORT_LIBS}" 3037 3038 # 3039 # Uninstall items in the reverse order from the order in which they're 3040 # installed. Only uninstall if the download/build/install process 3041 # completed; uninstall the version that appears in the name of 3042 # the -done file. 3043 # 3044 # We also do a "make distclean", so that we don't have leftovers from 3045 # old configurations. 3046 # 3047 uninstall_sparkle 3048 3049 uninstall_minizip 3050 3051 uninstall_brotli 3052 3053 uninstall_opus 3054 3055 uninstall_ilbc 3056 3057 uninstall_bcg729 3058 3059 uninstall_speexdsp 3060 3061 uninstall_spandsp 3062 3063 uninstall_libtiff 3064 3065 uninstall_nghttp2 3066 3067 uninstall_libssh 3068 3069 uninstall_c_ares 3070 3071 uninstall_maxminddb 3072 3073 uninstall_snappy 3074 3075 uninstall_zstd 3076 3077 uninstall_libxml2 3078 3079 uninstall_lz4 3080 3081 uninstall_sbc 3082 3083 uninstall_lua 3084 3085 uninstall_gnutls 3086 3087 uninstall_nettle 3088 3089 uninstall_p11_kit 3090 3091 uninstall_libtasn1 3092 3093 uninstall_gmp 3094 3095 uninstall_libgcrypt 3096 3097 uninstall_libgpg_error 3098 3099 uninstall_libsmi 3100 3101 uninstall_qt 3102 3103 uninstall_glib 3104 3105 uninstall_pkg_config 3106 3107 uninstall_gettext 3108 3109 uninstall_ninja 3110 3111 # 3112 # XXX - really remove this? 3113 # Or should we remember it as installed only if this script 3114 # installed it? 3115 # 3116 uninstall_asciidoctorpdf 3117 3118 uninstall_asciidoctor 3119 3120 uninstall_meson 3121 3122 uninstall_python3 3123 3124 uninstall_cmake 3125 3126 uninstall_libtool 3127 3128 uninstall_automake 3129 3130 uninstall_autoconf 3131 3132 uninstall_pcre 3133 3134 uninstall_lzip 3135 3136 uninstall_xz 3137 3138 uninstall_curl 3139 fi 3140} 3141 3142# 3143# Do we have permission to write in /usr/local? 3144# 3145# If so, assume we have permission to write in its subdirectories. 3146# (If that's not the case, this test needs to check the subdirectories 3147# as well.) 3148# 3149# If not, do "make install", "make uninstall", "ninja install", 3150# "ninja uninstall", the removes for dependencies that don't support 3151# "make uninstall" or "ninja uninstall", the renames of [g]libtool*, 3152# and the writing of a libffi .pc file with sudo. 3153# 3154if [ -w /usr/local ] 3155then 3156 DO_MAKE_INSTALL="make install" 3157 DO_MAKE_UNINSTALL="make uninstall" 3158 DO_NINJA_INSTALL="ninja -C _build install" 3159 DO_NINJA_UNINSTALL="ninja -C _build uninstall" 3160 DO_TEE_TO_PC_FILE="tee" 3161 DO_RM="rm" 3162 DO_MV="mv" 3163else 3164 DO_MAKE_INSTALL="sudo make install" 3165 DO_MAKE_UNINSTALL="sudo make uninstall" 3166 DO_NINJA_INSTALL="sudo ninja -C _build install" 3167 DO_NINJA_UNINSTALL="sudo ninja -C _build uninstall" 3168 DO_TEE_TO_PC_FILE="sudo tee" 3169 DO_RM="sudo rm" 3170 DO_MV="sudo mv" 3171fi 3172 3173# This script is meant to be run in the source root. The following 3174# code will attempt to get you there, but is not perfect (particulary 3175# if someone copies the script). 3176 3177topdir=`pwd`/`dirname $0`/.. 3178cd $topdir 3179 3180# Preference of the support libraries directory: 3181# ${MACOSX_SUPPORT_LIBS} 3182# ../macosx-support-libs 3183# ./macosx-support-libs (default if none exists) 3184if [ ! -d "${MACOSX_SUPPORT_LIBS}" ]; then 3185 unset MACOSX_SUPPORT_LIBS 3186fi 3187if [ -d ../macosx-support-libs ]; then 3188 MACOSX_SUPPORT_LIBS=${MACOSX_SUPPORT_LIBS-../macosx-support-libs} 3189else 3190 MACOSX_SUPPORT_LIBS=${MACOSX_SUPPORT_LIBS-./macosx-support-libs} 3191fi 3192 3193# 3194# If we have SDKs available, the default target OS is the major version 3195# of the one we're running; get that and strip off the third component 3196# if present. 3197# 3198for i in /Developer/SDKs \ 3199 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \ 3200 /Library/Developer/CommandLineTools/SDKs 3201do 3202 if [ -d "$i" ] 3203 then 3204 min_osx_target=`sw_vers -productVersion | sed 's/\([0-9]*\)\.\([0-9]*\)\.[0-9]*/\1.\2/'` 3205 break 3206 fi 3207done 3208 3209# 3210# Parse command-line flags: 3211# 3212# -h - print help. 3213# -t <target> - build libraries so that they'll work on the specified 3214# version of macOS and later versions. 3215# -u - do an uninstall. 3216# -n - download all packages, but don't build or install. 3217# 3218 3219no_build=false 3220 3221while getopts ht:un name 3222do 3223 case $name in 3224 u) 3225 do_uninstall=yes 3226 ;; 3227 n) 3228 no_build=true 3229 ;; 3230 t) 3231 min_osx_target="$OPTARG" 3232 ;; 3233 h|?) 3234 echo "Usage: macos-setup.sh [ -t <target> ] [ -u ] [ -n ]" 1>&1 3235 exit 0 3236 ;; 3237 esac 3238done 3239 3240# 3241# Get the version numbers of installed packages, if any. 3242# 3243if [ -d "${MACOSX_SUPPORT_LIBS}" ] 3244then 3245 cd "${MACOSX_SUPPORT_LIBS}" 3246 3247 installed_xz_version=`ls xz-*-done 2>/dev/null | sed 's/xz-\(.*\)-done/\1/'` 3248 installed_lzip_version=`ls lzip-*-done 2>/dev/null | sed 's/lzip-\(.*\)-done/\1/'` 3249 installed_pcre_version=`ls pcre-*-done 2>/dev/null | sed 's/pcre-\(.*\)-done/\1/'` 3250 installed_autoconf_version=`ls autoconf-*-done 2>/dev/null | sed 's/autoconf-\(.*\)-done/\1/'` 3251 installed_automake_version=`ls automake-*-done 2>/dev/null | sed 's/automake-\(.*\)-done/\1/'` 3252 installed_libtool_version=`ls libtool-*-done 2>/dev/null | sed 's/libtool-\(.*\)-done/\1/'` 3253 installed_cmake_version=`ls cmake-*-done 2>/dev/null | sed 's/cmake-\(.*\)-done/\1/'` 3254 installed_ninja_version=`ls ninja-*-done 2>/dev/null | sed 's/ninja-\(.*\)-done/\1/'` 3255 installed_asciidoctor_version=`ls asciidoctor-*-done 2>/dev/null | sed 's/asciidoctor-\(.*\)-done/\1/'` 3256 installed_asciidoctorpdf_version=`ls asciidoctorpdf-*-done 2>/dev/null | sed 's/asciidoctorpdf-\(.*\)-done/\1/'` 3257 installed_gettext_version=`ls gettext-*-done 2>/dev/null | sed 's/gettext-\(.*\)-done/\1/'` 3258 installed_pkg_config_version=`ls pkg-config-*-done 2>/dev/null | sed 's/pkg-config-\(.*\)-done/\1/'` 3259 installed_glib_version=`ls glib-*-done 2>/dev/null | sed 's/glib-\(.*\)-done/\1/'` 3260 installed_qt_version=`ls qt-*-done 2>/dev/null | sed 's/qt-\(.*\)-done/\1/'` 3261 installed_libsmi_version=`ls libsmi-*-done 2>/dev/null | sed 's/libsmi-\(.*\)-done/\1/'` 3262 installed_libgpg_error_version=`ls libgpg-error-*-done 2>/dev/null | sed 's/libgpg-error-\(.*\)-done/\1/'` 3263 installed_libgcrypt_version=`ls libgcrypt-*-done 2>/dev/null | sed 's/libgcrypt-\(.*\)-done/\1/'` 3264 installed_gmp_version=`ls gmp-*-done 2>/dev/null | sed 's/gmp-\(.*\)-done/\1/'` 3265 installed_libtasn1_version=`ls libtasn1-*-done 2>/dev/null | sed 's/libtasn1-\(.*\)-done/\1/'` 3266 installed_p11_kit_version=`ls p11-kit-*-done 2>/dev/null | sed 's/p11-kit-\(.*\)-done/\1/'` 3267 installed_nettle_version=`ls nettle-*-done 2>/dev/null | sed 's/nettle-\(.*\)-done/\1/'` 3268 installed_gnutls_version=`ls gnutls-*-done 2>/dev/null | sed 's/gnutls-\(.*\)-done/\1/'` 3269 installed_lua_version=`ls lua-*-done 2>/dev/null | sed 's/lua-\(.*\)-done/\1/'` 3270 installed_snappy_version=`ls snappy-*-done 2>/dev/null | sed 's/snappy-\(.*\)-done/\1/'` 3271 installed_zstd_version=`ls zstd-*-done 2>/dev/null | sed 's/zstd-\(.*\)-done/\1/'` 3272 installed_libxml2_version=`ls libxml2-*-done 2>/dev/null | sed 's/libxml2-\(.*\)-done/\1/'` 3273 installed_lz4_version=`ls lz4-*-done 2>/dev/null | sed 's/lz4-\(.*\)-done/\1/'` 3274 installed_sbc_version=`ls sbc-*-done 2>/dev/null | sed 's/sbc-\(.*\)-done/\1/'` 3275 installed_maxminddb_version=`ls maxminddb-*-done 2>/dev/null | sed 's/maxminddb-\(.*\)-done/\1/'` 3276 installed_cares_version=`ls c-ares-*-done 2>/dev/null | sed 's/c-ares-\(.*\)-done/\1/'` 3277 installed_libssh_version=`ls libssh-*-done 2>/dev/null | sed 's/libssh-\(.*\)-done/\1/'` 3278 installed_nghttp2_version=`ls nghttp2-*-done 2>/dev/null | sed 's/nghttp2-\(.*\)-done/\1/'` 3279 installed_libtiff_version=`ls tiff-*-done 2>/dev/null | sed 's/tiff-\(.*\)-done/\1/'` 3280 installed_spandsp_version=`ls spandsp-*-done 2>/dev/null | sed 's/spandsp-\(.*\)-done/\1/'` 3281 installed_speexdsp_version=`ls speexdsp-*-done 2>/dev/null | sed 's/speexdsp-\(.*\)-done/\1/'` 3282 installed_bcg729_version=`ls bcg729-*-done 2>/dev/null | sed 's/bcg729-\(.*\)-done/\1/'` 3283 installed_ilbc_version=`ls ilbc-*-done 2>/dev/null | sed 's/ilbc-\(.*\)-done/\1/'` 3284 installed_opus_version=`ls opus-*-done 2>/dev/null | sed 's/opus-\(.*\)-done/\1/'` 3285 installed_python3_version=`ls python3-*-done 2>/dev/null | sed 's/python3-\(.*\)-done/\1/'` 3286 installed_brotli_version=`ls brotli-*-done 2>/dev/null | sed 's/brotli-\(.*\)-done/\1/'` 3287 installed_minizip_version=`ls minizip-*-done 2>/dev/null | sed 's/minizip-\(.*\)-done/\1/'` 3288 installed_sparkle_version=`ls sparkle-*-done 2>/dev/null | sed 's/sparkle-\(.*\)-done/\1/'` 3289 3290 cd $topdir 3291fi 3292 3293if [ "$do_uninstall" = "yes" ] 3294then 3295 uninstall_all 3296 exit 0 3297fi 3298 3299# 3300# Configure scripts tend to set CFLAGS and CXXFLAGS to "-g -O2" if 3301# invoked without CFLAGS or CXXFLAGS being set in the environment. 3302# 3303# However, we *are* setting them in the environment, for our own 3304# nefarious purposes, so start them out as "-g -O2". 3305# 3306CFLAGS="-g -O2" 3307CXXFLAGS="-g -O2" 3308 3309# if no make options are present, set default options 3310if [ -z "$MAKE_BUILD_OPTS" ] ; then 3311 # by default use 1.5x number of cores for parallel build 3312 MAKE_BUILD_OPTS="-j $(( $(sysctl -n hw.logicalcpu) * 3 / 2))" 3313fi 3314 3315# 3316# If we have a target release, look for the oldest SDK that's for an 3317# OS equal to or later than that one, and build libraries against it 3318# rather than against the headers and, more importantly, libraries 3319# that come with the OS, so that we don't end up with support libraries 3320# that only work on the OS version on which we built them, not earlier 3321# versions of the same release, or earlier releases if the minimum is 3322# earlier. 3323# 3324if [ ! -z "$min_osx_target" ] 3325then 3326 # 3327 # Get the major and minor version of the target release. 3328 # We assume it'll be a while before there's a macOS 100. :-) 3329 # 3330 case "$min_osx_target" in 3331 3332 [1-9][0-9].*) 3333 # 3334 # major.minor. 3335 # 3336 min_osx_target_major=`echo "$min_osx_target" | sed -n 's/\([1-9][0-9]*\)\..*/\1/p'` 3337 min_osx_target_minor=`echo "$min_osx_target" | sed -n 's/[1-9][0-9]*\.\(.*\)/\1/p'` 3338 ;; 3339 3340 [1-9][0-9]) 3341 # 3342 # Just a major version number was specified; make the minor 3343 # version 0. 3344 # 3345 min_osx_target_major="$min_osx_target" 3346 min_osx_target_minor=0 3347 ;; 3348 3349 *) 3350 echo "macosx-setup.sh: Invalid target release $min_osx_target" 1>&2 3351 exit 1 3352 ;; 3353 esac 3354 3355 # 3356 # Search each directory that might contain SDKs. 3357 # 3358 sdkpath="" 3359 for sdksdir in /Developer/SDKs \ 3360 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \ 3361 /Library/Developer/CommandLineTools/SDKs 3362 do 3363 # 3364 # Get a list of all the SDKs. 3365 # 3366 if ! test -d "$sdksdir" 3367 then 3368 # 3369 # There is no directory with that name. 3370 # Move on to the next one in the list, if any. 3371 # 3372 continue 3373 fi 3374 3375 # 3376 # Get a list of all the SDKs in that directory, if any. 3377 # We assume it'll be a while before there's a macOS 100. :-) 3378 # 3379 sdklist=`(cd "$sdksdir"; ls -d MacOSX[1-9][0-9].[0-9]*.sdk 2>/dev/null)` 3380 3381 for sdk in $sdklist 3382 do 3383 # 3384 # Get the major and minor version for this SDK. 3385 # 3386 sdk_major=`echo "$sdk" | sed -n 's/MacOSX\([1-9][0-9]*\)\..*\.sdk/\1/p'` 3387 sdk_minor=`echo "$sdk" | sed -n 's/MacOSX[1-9][0-9]*\.\(.*\)\.sdk/\1/p'` 3388 3389 # 3390 # Is it for the deployment target or some later release? 3391 # Starting with major 11, the minor version no longer matters. 3392 # 3393 if test "$sdk_major" -gt "$min_osx_target_major" -o \ 3394 \( "$sdk_major" -eq "$min_osx_target_major" -a \ 3395 \( "$sdk_major" -ge 11 -o \ 3396 "$sdk_minor" -ge "$min_osx_target_minor" \) \) 3397 then 3398 # 3399 # Yes, use it. 3400 # 3401 sdkpath="$sdksdir/$sdk" 3402 break 2 3403 fi 3404 done 3405 done 3406 3407 if [ -z "$sdkpath" ] 3408 then 3409 echo "macos-setup.sh: Couldn't find an SDK for macOS $min_osx_target or later" 1>&2 3410 exit 1 3411 fi 3412 3413 SDKPATH="$sdkpath" 3414 echo "Using the $sdk_major.$sdk_minor SDK" 3415 3416 # 3417 # Make sure there are links to /usr/local/include and /usr/local/lib 3418 # in the SDK's usr/local. 3419 # 3420 if [ ! -e $SDKPATH/usr/local/include ] 3421 then 3422 if [ ! -d $SDKPATH/usr/local ] 3423 then 3424 sudo mkdir $SDKPATH/usr/local 3425 fi 3426 sudo ln -s /usr/local/include $SDKPATH/usr/local/include 3427 fi 3428 if [ ! -e $SDKPATH/usr/local/lib ] 3429 then 3430 if [ ! -d $SDKPATH/usr/local ] 3431 then 3432 sudo mkdir $SDKPATH/usr/local 3433 fi 3434 sudo ln -s /usr/local/lib $SDKPATH/usr/local/lib 3435 fi 3436 3437 # 3438 # Set the minimum OS version for which to build to the specified 3439 # minimum target OS version, so we don't, for example, end up using 3440 # linker features supported by the OS verson on which we're building 3441 # but not by the target version. 3442 # 3443 VERSION_MIN_FLAGS="-mmacosx-version-min=$min_osx_target" 3444 3445 # 3446 # Compile and link against the SDK. 3447 # 3448 SDKFLAGS="-isysroot $SDKPATH" 3449 3450fi 3451 3452export CFLAGS 3453export CXXFLAGS 3454 3455# 3456# You need Xcode or the command-line tools installed to get the compilers. 3457# 3458if [ ! -x /usr/bin/xcodebuild ]; then 3459 echo "Please install Xcode first (should be available on DVD or from the Mac App Store)." 3460 exit 1 3461fi 3462 3463if [ "$QT_VERSION" ]; then 3464 # 3465 # We need Xcode, not just the command-line tools, installed to build 3466 # Qt. 3467 # 3468 # At least with Xcode 8, /usr/bin/xcodebuild --help fails if only 3469 # the command-line tools are installed and succeeds if Xcode is 3470 # installed. Unfortunately, it fails *with* Xcode 3, but 3471 # /usr/bin/xcodebuild -version works with that and with Xcode 8. 3472 # Hopefully it fails with only the command-line tools installed. 3473 # 3474 if /usr/bin/xcodebuild -version >/dev/null 2>&1; then 3475 : 3476 else 3477 echo "Please install Xcode first (should be available on DVD or from the Mac App Store)." 3478 echo "The command-line build tools are not sufficient to build Qt." 3479 exit 1 3480 fi 3481fi 3482 3483export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig 3484 3485# 3486# Do all the downloads and untarring in a subdirectory, so all that 3487# stuff can be removed once we've installed the support libraries. 3488 3489if [ ! -d "${MACOSX_SUPPORT_LIBS}" ] 3490then 3491 mkdir "${MACOSX_SUPPORT_LIBS}" || exit 1 3492fi 3493cd "${MACOSX_SUPPORT_LIBS}" 3494 3495install_all 3496 3497echo "" 3498 3499# 3500# Indicate what paths to use for pkg-config and cmake. 3501# 3502pkg_config_path=/usr/local/lib/pkgconfig 3503if [ "$QT_VERSION" ]; then 3504 qt_base_path=$HOME/Qt$QT_VERSION/$QT_VERSION/clang_64 3505 pkg_config_path="$pkg_config_path":"$qt_base_path/lib/pkgconfig" 3506 CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH":"$qt_base_path/lib/cmake" 3507fi 3508 3509if $no_build; then 3510 echo "All required dependencies downloaded. Run without -n to install them." 3511 exit 0 3512fi 3513 3514echo "You are now prepared to build Wireshark." 3515echo 3516echo "To build:" 3517echo 3518echo "export PKG_CONFIG_PATH=$pkg_config_path" 3519echo "export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH" 3520echo "export PATH=$PATH:$qt_base_path/bin" 3521echo 3522echo "mkdir build; cd build" 3523if [ ! -z "$NINJA_VERSION" ]; then 3524 echo "cmake -G Ninja .." 3525 echo "ninja app_bundle" 3526 echo "ninja install/strip" 3527else 3528 echo "cmake .." 3529 echo "make $MAKE_BUILD_OPTS app_bundle" 3530 echo "make install/strip" 3531fi 3532echo 3533echo "Make sure you are allowed capture access to the network devices" 3534echo "See: https://gitlab.com/wireshark/wireshark/-/wikis/CaptureSetup/CapturePrivileges" 3535echo 3536 3537exit 0 3538