Revert "drsuapi_dissect_element_DsGetNCChangesCtr6TS_ctr6 dissect_krb5_PAC_NDRHEADERBLOB"
[wireshark-sm.git] / tools / macos-setup.sh
blob1a5044bca354e101dad68aeea8339e2b13952ae0
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).
5 # Copyright 2011 Michael Tuexen, Joerg Mayer, Guy Harris (see AUTHORS file)
7 # Wireshark - Network traffic analyzer
8 # By Gerald Combs <gerald@wireshark.org>
9 # Copyright 1998 Gerald Combs
11 # SPDX-License-Identifier: GPL-2.0-or-later
13 set -e
15 shopt -s extglob
18 # Get the major version of Darwin, so we can check the major macOS
19 # version.
21 DARWIN_MAJOR_VERSION=$(uname -r | sed 's/\([0-9]*\).*/\1/')
24 # The minimum supported version of Qt is 5.15, so the minimum supported version
25 # of macOS is OS X 10.13 (High Sierra), aka Darwin 17.0.
27 if [[ $DARWIN_MAJOR_VERSION -lt 17 ]]; then
28 echo "This script does not support any versions of macOS before High Sierra" 1>&2
29 exit 1
33 # Get the processor architecture of Darwin. Currently supported: arm, i386
35 DARWIN_PROCESSOR_ARCH=$(uname -m)
37 if [ "$DARWIN_PROCESSOR_ARCH" != "arm64" ] && [ "$DARWIN_PROCESSOR_ARCH" != "x86_64" ]; then
38 echo "This script does not support this processor architecture" 1>&2
39 exit 1
43 # Versions of packages to download and install.
47 # We use curl, but older versions of curl in older macOS releases can't
48 # handle some sites - including the xz site. We also use the --fail-with-body
49 # flag, which was added in curl 7.76.0.
51 # If the version of curl in the system is older than 7.76.0, download
52 # curl and install it.
54 current_curl_version=$( curl --version | sed -n 's/curl \([0-9.]*\) .*/\1/p' )
55 current_curl_major_version="$( expr "$current_curl_version" : '\([0-9][0-9]*\).*' )"
56 current_curl_minor_version="$(expr "$current_curl_version" : '[0-9][0-9]*\.\([0-9][0-9]*\).*' )"
57 if [[ $current_curl_major_version -lt 7 ||
58 ($current_curl_major_version -eq 7 &&
59 $current_curl_minor_version -lt 54) ]]; then
60 CURL_VERSION=${CURL_VERSION-7.88.1}
64 # Some packages need xz to unpack their current source.
65 # XXX: tar, since macOS 10.9, can uncompress xz'ed tarballs,
66 # so perhaps we could get rid of this now?
68 # DO NOT UPDATE THIS TO A COMPROMISED VERSION; see
70 # https://www.openwall.com/lists/oss-security/2024/03/29/4
72 # https://access.redhat.com/security/cve/CVE-2024-3094
74 # https://nvd.nist.gov/vuln/detail/CVE-2024-3094
76 XZ_VERSION=5.2.5
79 # CMake is required to do the build - and to build some of the
80 # dependencies.
82 CMAKE_VERSION=${CMAKE_VERSION-3.21.4}
85 # Ninja isn't required, as make is provided with Xcode, but it is
86 # claimed to build faster than make.
87 # Comment it out if you don't want it.
89 NINJA_VERSION=${NINJA_VERSION-1.12.1}
90 NINJA_SHA256=89a287444b5b3e98f88a945afa50ce937b8ffd1dcc59c555ad9b1baf855298c9
93 # The following libraries and tools are required even to build only TShark.
95 GETTEXT_VERSION=0.22.5
96 GLIB_VERSION=2.80.3
97 if [ "$GLIB_VERSION" ]; then
98 GLIB_MAJOR_VERSION="$( expr $GLIB_VERSION : '\([0-9][0-9]*\).*' )"
99 GLIB_MINOR_VERSION="$( expr $GLIB_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*' )"
100 # Unused?
101 # GLIB_DOTDOT_VERSION="$( expr $GLIB_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*' )"
102 # GLIB_MAJOR_MINOR_VERSION=$GLIB_MAJOR_VERSION.$GLIB_MINOR_VERSION
103 # GLIB_MAJOR_MINOR_DOTDOT_VERSION=$GLIB_MAJOR_VERSION.$GLIB_MINOR_VERSION.$GLIB_DOTDOT_VERSION
105 PKG_CONFIG_VERSION=0.29.2
107 # libgpg-error is required for libgcrypt.
109 LIBGPG_ERROR_VERSION=1.47
111 # libgcrypt is required.
113 LIBGCRYPT_VERSION=1.10.2
115 # libpcre2 is required.
117 PCRE2_VERSION=10.39
120 # One or more of the following libraries are required to build Wireshark.
122 # To override the version of Qt call the script with some of the variables
123 # set to the new values. Setting the variable to empty will disable building
124 # the toolkit and will uninstall # any version previously installed by the
125 # script, e.g.
126 # "QT_VERSION=5.10.1 ./macos-setup.sh"
127 # will build and install with QT 5.10.1.
129 QT_VERSION=${QT_VERSION-6.2.4}
131 if [ "$QT_VERSION" ]; then
132 QT_MAJOR_VERSION="$( expr "$QT_VERSION" : '\([0-9][0-9]*\).*' )"
133 QT_MINOR_VERSION="$( expr "$QT_VERSION" : '[0-9][0-9]*\.\([0-9][0-9]*\).*' )"
134 QT_DOTDOT_VERSION="$( expr "$QT_VERSION" : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*' )"
135 QT_MAJOR_MINOR_VERSION=$QT_MAJOR_VERSION.$QT_MINOR_VERSION
136 QT_MAJOR_MINOR_DOTDOT_VERSION=$QT_MAJOR_VERSION.$QT_MINOR_VERSION.$QT_DOTDOT_VERSION
140 # The following libraries are optional.
141 # Comment them out if you don't want them, but note that some of
142 # the optional libraries are required by other optional libraries.
144 LIBSMI_VERSION=0.4.8
145 GNUTLS_VERSION=3.8.4
146 GNUTLS_SHA256=2bea4e154794f3f00180fa2a5c51fe8b005ac7a31cd58bd44cdfa7f36ebc3a9b
147 if [ "$GNUTLS_VERSION" ]; then
149 # We'll be building GnuTLS, so we may need some additional libraries.
150 # We assume GnuTLS can work with Nettle; newer versions *only* use
151 # Nettle, not libgcrypt.
153 GNUTLS_MAJOR_VERSION="$( expr $GNUTLS_VERSION : '\([0-9][0-9]*\).*' )"
154 GNUTLS_MINOR_VERSION="$( expr $GNUTLS_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*' )"
155 NETTLE_VERSION=3.9.1
158 # And, in turn, Nettle requires GMP.
160 GMP_VERSION=6.3.0
163 # And p11-kit
164 P11KIT_VERSION=0.25.3
166 # Which requires libtasn1
167 LIBTASN1_VERSION=4.19.0
169 # lua_bitop.c has been ported to 5.3 and 5.4 so use the latest release.
170 # We may still need to check for compatibility issues (we'd want Lua
171 # scripts to work with 5.1 through 5.4, as long as they only use Lua
172 # features present in all versions)
173 LUA_VERSION=5.4.6
174 SNAPPY_VERSION=1.2.1
175 ZSTD_VERSION=1.5.6
176 ZLIBNG_VERSION=2.1.6
177 LIBXML2_VERSION=2.11.9 # Matches vcpkg
178 LIBXML2_SHA256=780157a1efdb57188ec474dca87acaee67a3a839c2525b2214d318228451809f
179 LZ4_VERSION=1.10.0
180 SBC_VERSION=2.0
181 CARES_VERSION=1.31.0
182 LIBSSH_VERSION=0.11.1
183 # mmdbresolve
184 MAXMINDDB_VERSION=1.9.1
185 NGHTTP2_VERSION=1.62.1
186 NGHTTP3_VERSION=1.1.0
187 SPANDSP_VERSION=0.0.6
188 SPEEXDSP_VERSION=1.2.1
189 if [ "$SPANDSP_VERSION" ]; then
191 # SpanDSP depends on libtiff.
193 LIBTIFF_VERSION=3.8.1
195 BCG729_VERSION=1.1.1
196 # libilbc 3.0.0 & later link with absiel, which is released under Apache 2.0
197 ILBC_VERSION=2.0.2
198 OPENCORE_AMR_VERSION=0.1.6
199 OPENCORE_AMR_SHA256=483eb4061088e2b34b358e47540b5d495a96cd468e361050fae615b1809dc4a1
200 OPUS_VERSION=1.4
202 # Falco libs (libsinsp and libscap) and their dependencies. Unset for now.
203 #FALCO_LIBS_VERSION=0.18.1
204 if [ "$FALCO_LIBS_VERSION" ] ; then
205 FALCO_LIBS_SHA256=1812e8236c4cb51d3fe5dd066d71be99f25da7ed22d8feeeebeed09bdc26325f
206 JSONCPP_VERSION=1.9.5
207 ONETBB_VERSION=2021.11.0
208 # 2023-06-01 and later require Abseil.
209 RE2_VERSION=2022-06-01
213 # Is /usr/bin/python3 a working version of Python? It may be, as it
214 # might be a wrapper that runs the Python 3 that's part of Xcode.
216 if /usr/bin/python3 --version >/dev/null 2>&1
217 then
219 # Yes - don't bother installing Python 3 from elsewhere
222 else
224 # No - install a Python package.
226 PYTHON3_VERSION=3.12.1
228 BROTLI_VERSION=1.0.9
229 # minizip
230 MINIZIPNG_VERSION=4.0.7
231 ZLIB_VERSION=1.3
232 # Uncomment to enable automatic updates using Sparkle
233 #SPARKLE_VERSION=2.2.2
236 # Asciidoctor is required to build the documentation.
238 # As the Asciidoctor Homebrew formula shows, managing all of the various
239 # dependencies can become quite hairy:
240 # https://github.com/Homebrew/homebrew-core/blob/master/Formula/a/asciidoctor.rb
241 # Maybe we should install a JRE and use AsciidoctorJ instead?
242 ASCIIDOCTOR_VERSION=${ASCIIDOCTOR_VERSION-2.0.16}
243 ASCIIDOCTORPDF_VERSION=${ASCIIDOCTORPDF_VERSION-1.6.1}
244 # css_parser 1.13 and later require Ruby 2.7
246 CSS_PARSER_VERSION=${CSS_PARSER_VERSION-1.12.0}
248 # GNU autotools. They're not supplied with the macOS versions we
249 # support, and we currently use them for minizip.
251 AUTOCONF_VERSION=2.71
252 AUTOMAKE_VERSION=1.16.5
253 LIBTOOL_VERSION=2.4.6
255 install_curl() {
256 if [ "$CURL_VERSION" ] && [ ! -f "curl-$CURL_VERSION-done" ] ; then
257 echo "Downloading, building, and installing curl:"
258 [ -f "curl-$CURL_VERSION.tar.bz2" ] || curl --fail --location --remote-name "https://curl.haxx.se/download/curl-$CURL_VERSION.tar.bz2"
259 $no_build && echo "Skipping installation" && return
260 bzcat "curl-$CURL_VERSION.tar.bz2" | tar xf -
261 cd "curl-$CURL_VERSION"
262 ./configure "${CONFIGURE_OPTS[@]}"
263 make "${MAKE_BUILD_OPTS[@]}"
264 $DO_MAKE_INSTALL
265 cd ..
266 touch "curl-$CURL_VERSION-done"
270 uninstall_curl() {
271 if [ -n "$installed_curl_version" ] ; then
272 echo "Uninstalling curl:"
273 cd "curl-$installed_curl_version"
274 $DO_MAKE_UNINSTALL
275 make distclean
276 cd ..
277 rm "curl-$installed_curl_version-done"
279 if [ "$#" -eq 1 ] && [ "$1" = "-r" ] ; then
281 # Get rid of the previously downloaded and unpacked version.
283 rm -rf "curl-$installed_curl_version"
284 rm -rf "curl-$installed_curl_version.tar.bz2"
287 installed_curl_version=""
291 install_xz() {
292 if [ "$XZ_VERSION" ] && [ ! -f xz-$XZ_VERSION-done ] ; then
293 echo "Downloading, building, and installing xz:"
294 [ -f xz-$XZ_VERSION.tar.bz2 ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" https://tukaani.org/xz/xz-$XZ_VERSION.tar.bz2
295 $no_build && echo "Skipping installation" && return
296 bzcat xz-$XZ_VERSION.tar.bz2 | tar xf -
297 cd xz-$XZ_VERSION
299 # This builds and installs liblzma, which libxml2 uses, and
300 # Wireshark uses libxml2, so we need to build this with
301 # all the minimum-deployment-version and SDK stuff.
303 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0 $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" \
304 ./configure "${CONFIGURE_OPTS[@]}"
305 make "${MAKE_BUILD_OPTS[@]}"
306 $DO_MAKE_INSTALL
307 cd ..
308 touch xz-$XZ_VERSION-done
312 uninstall_xz() {
313 if [ -n "$installed_xz_version" ] ; then
314 echo "Uninstalling xz:"
315 cd "xz-$installed_xz_version"
316 $DO_MAKE_UNINSTALL
317 make distclean
318 cd ..
319 rm "xz-$installed_xz_version-done"
321 if [ "$#" -eq 1 ] && [ "$1" = "-r" ] ; then
323 # Get rid of the previously downloaded and unpacked version.
325 rm -rf "xz-$installed_xz_version"
326 rm -rf "xz-$installed_xz_version.tar.bz2"
329 installed_xz_version=""
333 uninstall_lzip() {
334 if [ -n "$installed_lzip_version" ] ; then
335 echo "Uninstalling lzip:"
336 cd "lzip-$installed_lzip_version"
337 $DO_MAKE_UNINSTALL
338 make distclean
339 cd ..
340 rm "lzip-$installed_lzip_version-done"
342 if [ "$#" -eq 1 ] && [ "$1" = "-r" ] ; then
344 # Get rid of the previously downloaded and unpacked version.
346 rm -rf "lzip-$installed_lzip_version"
347 rm -rf "lzip-$installed_lzip_version.tar.gz"
350 installed_lzip_version=""
354 uninstall_pcre() {
355 if [ -n "$installed_pcre_version" ] ; then
356 echo "Uninstalling leftover pcre:"
357 cd "pcre-$installed_pcre_version"
358 $DO_MAKE_UNINSTALL
359 make distclean
360 cd ..
361 rm "pcre-$installed_pcre_version-done"
363 if [ "$#" -eq 1 ] && [ "$1" = "-r" ] ; then
365 # Get rid of the previously downloaded and unpacked version.
367 rm -rf "pcre-$installed_pcre_version"
368 rm -rf "pcre-$installed_pcre_version.tar.bz2"
371 installed_pcre_version=""
375 install_pcre2() {
376 if [ "$PCRE2_VERSION" ] && [ ! -f "pcre2-$PCRE2_VERSION-done" ] ; then
377 echo "Downloading, building, and installing pcre2:"
378 [ -f "pcre2-$PCRE2_VERSION.tar.bz2" ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" "https://github.com/PhilipHazel/pcre2/releases/download/pcre2-$PCRE2_VERSION/pcre2-10.39.tar.bz2"
379 $no_build && echo "Skipping installation" && return
380 bzcat "pcre2-$PCRE2_VERSION.tar.bz2" | tar xf -
381 cd "pcre2-$PCRE2_VERSION"
382 mkdir build_dir
383 cd build_dir
384 # https://github.com/Homebrew/homebrew-core/blob/master/Formula/pcre2.rb
385 # https://github.com/microsoft/vcpkg/blob/master/ports/pcre2/portfile.cmake
386 "${DO_CMAKE[@]}" -DBUILD_STATIC_LIBS=OFF -DBUILD_SHARED_LIBS=ON -DPCRE2_SUPPORT_JIT=ON -DPCRE2_SUPPORT_UNICODE=ON ..
387 make "${MAKE_BUILD_OPTS[@]}"
388 $DO_MAKE_INSTALL
389 cd ../..
390 touch "pcre2-$PCRE2_VERSION-done"
394 uninstall_pcre2() {
395 if [ -n "$installed_pcre2_version" ] && [ -s "pcre2-$installed_pcre2_version/build_dir/install_manifest.txt" ] ; then
396 echo "Uninstalling pcre2:"
397 # PCRE2 10.39 installs pcre2unicode.3 twice, so this will return an error.
398 while read -r ; do $DO_RM -v "$REPLY" ; done < <(cat "pcre2-$installed_pcre2_version/build_dir/install_manifest.txt"; echo)
399 rm "pcre2-$installed_pcre2_version-done"
401 if [ "$#" -eq 1 ] && [ "$1" = "-r" ] ; then
403 # Get rid of the previously downloaded and unpacked version.
405 rm -rf "pcre2-$installed_pcre2_version"
406 rm -rf "pcre2-$installed_pcre2_version.tar.bz2"
409 installed_pcre2_version=""
413 install_autoconf() {
414 if [ "$AUTOCONF_VERSION" -a ! -f autoconf-$AUTOCONF_VERSION-done ] ; then
415 echo "Downloading, building and installing GNU autoconf..."
416 [ -f autoconf-$AUTOCONF_VERSION.tar.xz ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" https://ftp.gnu.org/gnu/autoconf/autoconf-$AUTOCONF_VERSION.tar.xz
417 $no_build && echo "Skipping installation" && return
418 xzcat autoconf-$AUTOCONF_VERSION.tar.xz | tar xf -
419 cd autoconf-$AUTOCONF_VERSION
420 ./configure "${CONFIGURE_OPTS[@]}"
421 make "${MAKE_BUILD_OPTS[@]}"
422 $DO_MAKE_INSTALL
423 cd ..
424 touch autoconf-$AUTOCONF_VERSION-done
428 uninstall_autoconf() {
429 if [ -n "$installed_autoconf_version" ] ; then
431 # automake and libtool depend on this, so uninstall them.
433 uninstall_libtool "$@"
434 uninstall_automake "$@"
436 echo "Uninstalling GNU autoconf:"
437 cd autoconf-$installed_autoconf_version
438 $DO_MAKE_UNINSTALL
439 make distclean
440 cd ..
441 rm autoconf-$installed_autoconf_version-done
443 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
445 # Get rid of the previously downloaded and unpacked version.
447 rm -rf autoconf-$installed_autoconf_version
448 rm -rf autoconf-$installed_autoconf_version.tar.xz
451 installed_autoconf_version=""
455 install_automake() {
456 if [ "$AUTOMAKE_VERSION" -a ! -f automake-$AUTOMAKE_VERSION-done ] ; then
457 echo "Downloading, building and installing GNU automake..."
458 [ -f automake-$AUTOMAKE_VERSION.tar.xz ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" https://ftp.gnu.org/gnu/automake/automake-$AUTOMAKE_VERSION.tar.xz
459 $no_build && echo "Skipping installation" && return
460 xzcat automake-$AUTOMAKE_VERSION.tar.xz | tar xf -
461 cd automake-$AUTOMAKE_VERSION
462 ./configure "${CONFIGURE_OPTS[@]}"
463 make "${MAKE_BUILD_OPTS[@]}"
464 $DO_MAKE_INSTALL
465 cd ..
466 touch automake-$AUTOMAKE_VERSION-done
470 uninstall_automake() {
471 if [ -n "$installed_automake_version" ] ; then
473 # libtool depends on this(?), so uninstall it.
475 uninstall_libtool "$@"
477 echo "Uninstalling GNU automake:"
478 cd automake-$installed_automake_version
479 $DO_MAKE_UNINSTALL
480 make distclean
481 cd ..
482 rm automake-$installed_automake_version-done
484 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
486 # Get rid of the previously downloaded and unpacked version.
488 rm -rf automake-$installed_automake_version
489 rm -rf automake-$installed_automake_version.tar.xz
492 installed_automake_version=""
496 install_libtool() {
497 if [ "$LIBTOOL_VERSION" -a ! -f libtool-$LIBTOOL_VERSION-done ] ; then
498 echo "Downloading, building and installing GNU libtool..."
499 [ -f libtool-$LIBTOOL_VERSION.tar.xz ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" https://ftp.gnu.org/gnu/libtool/libtool-$LIBTOOL_VERSION.tar.xz
500 $no_build && echo "Skipping installation" && return
501 xzcat libtool-$LIBTOOL_VERSION.tar.xz | tar xf -
502 cd libtool-$LIBTOOL_VERSION
503 ./configure "${CONFIGURE_OPTS[@]}" --program-prefix=g
504 make "${MAKE_BUILD_OPTS[@]}"
505 $DO_MAKE_INSTALL
506 cd ..
507 touch libtool-$LIBTOOL_VERSION-done
511 uninstall_libtool() {
512 if [ -n "$installed_libtool_version" ] ; then
513 echo "Uninstalling GNU libtool:"
514 cd libtool-$installed_libtool_version
515 $DO_MV "$installation_prefix/bin/glibtool" "$installation_prefix/bin/libtool"
516 $DO_MV "$installation_prefix/bin/glibtoolize" "$installation_prefix/bin/libtoolize"
517 $DO_MAKE_UNINSTALL
518 make distclean
519 cd ..
520 rm libtool-$installed_libtool_version-done
522 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
524 # Get rid of the previously downloaded and unpacked version.
526 rm -rf libtool-$installed_libtool_version
527 rm -rf libtool-$installed_libtool_version.tar.xz
530 installed_libtool_version=""
534 install_ninja() {
535 if [ "$NINJA_VERSION" ] && [ ! -f "ninja-$NINJA_VERSION-done" ] ; then
536 echo "Downloading and installing Ninja:"
538 # Download the zipball, unpack it, and move the binary to
539 # $installation_prefix/bin.
541 [ -f "ninja-mac-v$NINJA_VERSION.zip" ] || curl "${CURL_LOCAL_NAME_OPTS[@]}" "ninja-mac-v$NINJA_VERSION.zip" https://github.com/ninja-build/ninja/releases/download/v$NINJA_VERSION/ninja-mac.zip
542 echo "$NINJA_SHA256 ninja-mac-v$NINJA_VERSION.zip" | shasum --algorithm 256 --check
543 $no_build && echo "Skipping installation" && return
544 unzip "ninja-mac-v$NINJA_VERSION.zip"
545 sudo mv ninja "$installation_prefix/bin"
546 touch "ninja-$NINJA_VERSION-done"
550 uninstall_ninja() {
551 if [ -n "$installed_ninja_version" ]; then
552 echo "Uninstalling Ninja:"
553 $DO_RM "$installation_prefix/bin/ninja"
554 rm "ninja-$installed_ninja_version-done"
555 if [ "$#" -eq 1 ] && [ "$1" = "-r" ] ; then
556 rm -f "ninja-mac-v$installed_ninja_version.zip"
559 installed_ninja_version=""
563 install_asciidoctor() {
564 if [ ! -f asciidoctor-${ASCIIDOCTOR_VERSION}-done ]; then
565 echo "Downloading and installing Asciidoctor:"
566 $no_build && echo "Skipping installation" && return
567 sudo gem install -V asciidoctor --version "=${ASCIIDOCTOR_VERSION}"
568 touch asciidoctor-${ASCIIDOCTOR_VERSION}-done
572 uninstall_asciidoctor() {
573 if [ -n "$installed_asciidoctor_version" ]; then
574 echo "Uninstalling Asciidoctor:"
575 sudo gem uninstall -V asciidoctor --version "=${installed_asciidoctor_version}"
576 rm asciidoctor-$installed_asciidoctor_version-done
578 ##if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
580 # Get rid of the previously downloaded and unpacked version,
581 # whatever it might happen to be called.
583 ## rm -f asciidoctor-$installed_asciidoctor_version
584 ##fi
585 installed_asciidoctor_version=""
589 install_asciidoctorpdf() {
590 if [ ! -f asciidoctorpdf-${ASCIIDOCTORPDF_VERSION}-done ]; then
591 ## XXX gem does not track dependencies that are installed for asciidoctor-pdf
592 ## record them for uninstallation
593 ## 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
594 echo "Downloading and installing Asciidoctor-pdf:"
595 $no_build && echo "Skipping installation" && return
596 sudo gem install -V css_parser --version "=${CSS_PARSER_VERSION}"
597 sudo gem install -V asciidoctor-pdf --version "=${ASCIIDOCTORPDF_VERSION}"
598 touch asciidoctorpdf-${ASCIIDOCTORPDF_VERSION}-done
602 uninstall_asciidoctorpdf() {
603 if [ -n "$installed_asciidoctorpdf_version" ]; then
604 echo "Uninstalling Asciidoctor:"
605 sudo gem uninstall -V asciidoctor-pdf --version "=${installed_asciidoctorpdf_version}"
606 ## XXX uninstall dependencies
607 rm asciidoctorpdf-$installed_asciidoctorpdf_version-done
609 ##if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
611 # Get rid of the previously downloaded and unpacked version,
612 # whatever it might happen to be called.
614 ## rm -f asciidoctorpdf-$installed_asciidoctorpdf_version
615 ##fi
616 installed_asciidoctorpdf_version=""
620 install_cmake() {
621 if [ ! -f cmake-$CMAKE_VERSION-done ]; then
622 echo "Downloading and installing CMake:"
623 $no_build && echo "Skipping installation" && return
624 CMAKE_MAJOR_VERSION="$( expr "$CMAKE_VERSION" : '\([0-9][0-9]*\).*' )"
625 CMAKE_MINOR_VERSION="$( expr "$CMAKE_VERSION" : '[0-9][0-9]*\.\([0-9][0-9]*\).*' )"
626 CMAKE_MAJOR_MINOR_VERSION=$CMAKE_MAJOR_VERSION.$CMAKE_MINOR_VERSION
629 # NOTE: the "64" in "Darwin64" doesn't mean "64-bit-only"; the
630 # package in question supports both 32-bit and 64-bit x86.
632 case "$CMAKE_MAJOR_VERSION" in
634 0|1|2)
635 echo "CMake $CMAKE_VERSION" is too old 1>&2
640 # Download the DMG and do a drag install, where "drag" means
641 # "mv".
643 # 3.1.1 to 3.19.1 have a Darwin-x86_64 DMG.
644 # 3.19.2 has a macos-universal DMG for 10.10 and later
645 # 3.19.3 and later have a macos-universal DMG for 10.13 and later,
646 # and a macos10.10-universal DMG for 10.10 and later.
648 if [ "$CMAKE_MINOR_VERSION" -lt 10 ]; then
649 echo "CMake $CMAKE_VERSION" is too old 1>&2
650 elif [ "$CMAKE_MINOR_VERSION" -lt 19 -o \
651 "$CMAKE_VERSION" = 3.19.0 -o \
652 "$CMAKE_VERSION" = 3.19.1 ]; then
653 type="Darwin-x86_64"
654 elif [ "$CMAKE_VERSION" = 3.19.2 -o \
655 "$DARWIN_MAJOR_VERSION" -ge 17 ]; then
656 type="macos-universal"
657 else
658 type="macos10.0-universal"
660 [ -f cmake-$CMAKE_VERSION-$type.dmg ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" https://cmake.org/files/v$CMAKE_MAJOR_MINOR_VERSION/cmake-$CMAKE_VERSION-$type.dmg
661 $no_build && echo "Skipping installation" && return
662 sudo hdiutil attach cmake-$CMAKE_VERSION-$type.dmg
663 sudo ditto /Volumes/cmake-$CMAKE_VERSION-$type/CMake.app /Applications/CMake.app
666 # Plant the appropriate symbolic links in $installation_prefix/bin.
667 # It's a drag-install, so there's no installer to make them,
668 # and the CMake code to put them in place is lame, as
670 # 1) it defaults to /usr/bin, not $installation_prefix/bin;
671 # 2) it doesn't request the necessary root privileges;
672 # 3) it can't be run from the command line;
674 # so we do it ourselves.
676 for i in ccmake cmake cmake-gui cmakexbuild cpack ctest
678 sudo ln -s /Applications/CMake.app/Contents/bin/$i "$installation_prefix/bin/$i"
679 done
680 sudo hdiutil detach /Volumes/cmake-$CMAKE_VERSION-$type
685 esac
686 touch cmake-$CMAKE_VERSION-done
690 uninstall_cmake() {
691 if [ -n "$installed_cmake_version" ]; then
692 echo "Uninstalling CMake:"
693 installed_cmake_major_version="$( expr "$installed_cmake_version" : '\([0-9][0-9]*\).*' )"
694 case "$installed_cmake_major_version" in
696 0|1|2)
697 echo "CMake $installed_cmake_version" is too old 1>&2
701 sudo rm -rf /Applications/CMake.app
702 for i in ccmake cmake cmake-gui cmakexbuild cpack ctest
704 sudo rm -f "$installation_prefix/bin/$i"
705 done
706 rm cmake-$installed_cmake_version-done
708 esac
710 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
712 # Get rid of the previously downloaded and unpacked version,
713 # whatever it might happen to be called.
715 rm -f cmake-$installed_cmake_version-Darwin-x86_64.dmg
716 rm -f cmake-$installed_cmake_version-macos-universal.dmg
717 rm -f cmake-$installed_cmake_version-macos10.0-universal.dmg
720 installed_cmake_version=""
724 install_meson() {
726 # Install Meson with pip3 if we don't have it already.
728 if $MESON --version >/dev/null 2>&1
729 then
730 # We have it.
732 else
733 $no_build && echo "Skipping installation" && return
734 sudo pip3 install meson
735 touch meson-done
739 uninstall_meson() {
741 # If we installed Meson, uninstal it with pip3.
743 if [ -f meson-done ] ; then
744 sudo pip3 uninstall meson
745 rm -f meson-done
749 install_pytest() {
751 # Install pytest with pip3 if we don't have it already.
753 if python3 -m pytest --version &> /dev/null || pytest --version &> /dev/null
754 then
755 # We have it.
757 else
758 sudo pip3 install pytest pytest-xdist
759 touch pytest-done
763 uninstall_pytest() {
765 # If we installed pytest, uninstal it with pip3.
767 if [ -f pytest-done ] ; then
768 sudo pip3 uninstall pytest pytest-xdist
769 rm -f pytest-done
773 install_gettext() {
774 if [ ! -f gettext-$GETTEXT_VERSION-done ] ; then
775 echo "Downloading, building, and installing GNU gettext:"
776 [ -f gettext-$GETTEXT_VERSION.tar.gz ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" https://ftp.gnu.org/pub/gnu/gettext/gettext-$GETTEXT_VERSION.tar.gz
777 $no_build && echo "Skipping installation" && return
778 gzcat gettext-$GETTEXT_VERSION.tar.gz | tar xf -
779 cd gettext-$GETTEXT_VERSION
780 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0 $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" \
781 ./configure "${CONFIGURE_OPTS[@]}"
782 make "${MAKE_BUILD_OPTS[@]}"
783 $DO_MAKE_INSTALL
784 cd ..
785 touch gettext-$GETTEXT_VERSION-done
789 uninstall_gettext() {
790 if [ -n "$installed_gettext_version" ] ; then
792 # GLib depends on this, so uninstall it.
794 uninstall_glib "$@"
796 echo "Uninstalling GNU gettext:"
797 cd gettext-$installed_gettext_version
798 $DO_MAKE_UNINSTALL
799 make distclean
800 cd ..
801 rm gettext-$installed_gettext_version-done
803 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
805 # Get rid of the previously downloaded and unpacked version.
807 rm -rf gettext-$installed_gettext_version
808 rm -rf gettext-$installed_gettext_version.tar.gz
811 installed_gettext_version=""
815 install_pkg_config() {
816 if [ ! -f pkg-config-$PKG_CONFIG_VERSION-done ] ; then
817 echo "Downloading, building, and installing pkg-config:"
818 [ -f pkg-config-$PKG_CONFIG_VERSION.tar.gz ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" https://pkgconfig.freedesktop.org/releases/pkg-config-$PKG_CONFIG_VERSION.tar.gz
819 $no_build && echo "Skipping installation" && return
820 gzcat pkg-config-$PKG_CONFIG_VERSION.tar.gz | tar xf -
821 cd pkg-config-$PKG_CONFIG_VERSION
822 CFLAGS="$CFLAGS -Wno-int-conversion" ./configure "${CONFIGURE_OPTS[@]}" --with-internal-glib
823 make "${MAKE_BUILD_OPTS[@]}"
824 $DO_MAKE_INSTALL
825 cd ..
826 touch pkg-config-$PKG_CONFIG_VERSION-done
830 uninstall_pkg_config() {
831 if [ -n "$installed_pkg_config_version" ] ; then
832 echo "Uninstalling pkg-config:"
833 cd pkg-config-$installed_pkg_config_version
834 $DO_MAKE_UNINSTALL
835 make distclean
836 cd ..
837 rm pkg-config-$installed_pkg_config_version-done
839 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
841 # Get rid of the previously downloaded and unpacked version.
843 rm -rf pkg-config-$installed_pkg_config_version
844 rm -rf pkg-config-$installed_pkg_config_version.tar.gz
847 installed_pkg_config_version=""
851 install_glib() {
852 if [ ! -f glib-$GLIB_VERSION-done ] ; then
853 echo "Downloading, building, and installing GLib:"
854 glib_dir=$( expr "$GLIB_VERSION" : '\([0-9][0-9]*\.[0-9][0-9]*\).*' )
856 # Starting with GLib 2.28.8, xz-compressed tarballs are available.
858 [ -f glib-$GLIB_VERSION.tar.xz ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" "https://download.gnome.org/sources/glib/$glib_dir/glib-$GLIB_VERSION.tar.xz"
859 $no_build && echo "Skipping installation" && return
860 xzcat glib-$GLIB_VERSION.tar.xz | tar xf -
861 cd glib-$GLIB_VERSION
863 # First, determine where the system include files are.
864 # (It's not necessarily /usr/include.) There's a bit of a
865 # greasy hack here; pre-5.x versions of the developer tools
866 # don't support the --show-sdk-path option, and will produce
867 # no output, so includedir will be set to /usr/include
868 # (in those older versions of the developer tools, there is
869 # a /usr/include directory).
871 # We need this for several things we do later.
873 includedir=$( SDKROOT="$SDKPATH" xcrun --show-sdk-path 2>/dev/null )/usr/include
875 # GLib's configuration procedure, whether autotools-based or
876 # Meson-based, really likes to use pkg-config to find libraries,
877 # including libffi.
879 # At least some versions of macOS provide libffi, but, as macOS
880 # doesn't provide pkg-config, they don't provide a .pc file for
881 # it, so the autotools-based configuration needs some trickery
882 # to get it to find the OS-supplied libffi, and the Meson-based
883 # configuration simply won't find it at all.
885 # So, if we have a system-provided libffi, but pkg-config
886 # doesn't find libffi, we construct a .pc file for that libffi,
887 # and install it in $installation_prefix/lib/pkgconfig.
889 # First, check whether pkg-config finds libffi but thinks its
890 # header files are in a non-existent directory. That probaby
891 # means that we generated the .pc file when some SDK was the
892 # appropriate choice, but Xcode has been updated since then
893 # and that SDK is no longer present. If so, we remove it,
894 # so that we will regenerate it if necessary, rather than
895 # trying to build with a bogus include directory. (Yes, this
896 # can happen, and has happened, causing mysterius build
897 # failures when "#include <ffi.h>" fails.)
899 if pkg-config libffi ; then
900 # We have a .pc file for libffi; what does it say the
901 # include directory is?
902 incldir=$( pkg-config --variable=includedir libffi )
903 if [ -n "$incldir" -a ! -d "$incldir" ] ; then
904 # Bogus - remove it, assuming
905 $DO_RM "$installation_prefix/lib/pkgconfig/libffi.pc"
908 if pkg-config libffi ; then
909 # It found libffi; no need to install a .pc file, and we
910 # don't want to overwrite what's there already.
912 elif [ ! -e "$includedir"/ffi/ffi.h ] ; then
913 # We don't appear to have libffi as part of the system, so
914 # let the configuration process figure out what to do.
916 # We test for the header file, not the library, because, in
917 # Big Sur and later, there's no guarantee that, for a system
918 # shared library, there's a corresponding dylib file in
919 # /usr/lib.
921 else
923 # We have libffi, but pkg-config didn't find it; generate
924 # and install the .pc file.
928 # Now generate the .pc file.
930 # We generate the contents of the .pc file by using cat with
931 # a here document containing a template for the file and
932 # piping that to a sed command that replaces @INCLUDEDIR@ in
933 # the template with the include directory we discovered
934 # above, so that the .pc file gives the compiler flags
935 # necessary to find the libffi headers (which are *not*
936 # necessarily in /usr/include, as per the above).
938 # The EOF marker for the here document is in quotes, to tell
939 # the shell not to do shell expansion, as .pc files use a
940 # syntax to refer to .pc file variables that looks like the
941 # syntax to refer to shell variables.
943 # The writing of the libffi.pc file is a greasy hack - the
944 # process of generating the contents of the .pc file writes
945 # to the standard output, but running the last process in
946 # the pipeline as root won't allow the shell that's
947 # *running* it to open the .pc file if we don't have write
948 # permission on $installation_prefix/lib/pkgconfig, so we need a
949 # program that creates a file and then reads from the
950 # standard input and writes to that file. UN*Xes have a
951 # program that does that; it's called "tee". :-)
953 # However, it *also* writes the file to the standard output,
954 # so we redirect that to /dev/null when we run it.
956 cat <<"EOF" | sed "s;@INCLUDEDIR@;$includedir;" | $DO_TEE_TO_PC_FILE "$installation_prefix/lib/pkgconfig/libffi.pc" >/dev/null
957 prefix=/usr
958 libdir=${prefix}/lib
959 includedir=@INCLUDEDIR@
961 Name: ffi
962 Description: Library supporting Foreign Function Interfaces
963 Version: 3.2.9999
964 Libs: -L${libdir} -lffi
965 Cflags: -I${includedir}/ffi
970 # GLib 2.59.1 and later use Meson+Ninja as the build system.
972 case $GLIB_MAJOR_VERSION in
975 echo "GLib $GLIB_VERSION" is too old 1>&2
979 case $GLIB_MINOR_VERSION in
981 [0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9])
982 echo "GLib $GLIB_VERSION" is too old 1>&2
985 5[0-8])
986 if [ ! -f ./configure ]; then
987 LIBTOOLIZE=glibtoolize ./autogen.sh
990 # At least with the version of Xcode that comes with
991 # Leopard, /usr/include/ffi/fficonfig.h doesn't define
992 # MACOSX, which causes the build of GLib to fail for at
993 # least some versions of GLib. If we don't find
994 # "#define.*MACOSX" in /usr/include/ffi/fficonfig.h,
995 # explicitly define it.
997 # While we're at it, suppress -Wformat-nonliteral to
998 # avoid a case where clang's stricter rules on when not
999 # to complain about non-literal format arguments cause
1000 # it to complain about code that's safe but it wasn't
1001 # told that. See my comment #25 in GNOME bug 691608:
1003 # https://bugzilla.gnome.org/show_bug.cgi?id=691608#c25
1005 if grep -qs '#define.*MACOSX' "$includedir/ffi/fficonfig.h"
1006 then
1007 # It's defined, nothing to do
1008 CFLAGS="$CFLAGS -Wno-format-nonliteral $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS -Wno-format-nonliteral $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" \
1009 ./configure "${CONFIGURE_OPTS[@]}"
1010 else
1011 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" \
1012 ./configure "${CONFIGURE_OPTS[@]}"
1014 make "${MAKE_BUILD_OPTS[@]}"
1015 $DO_MAKE_INSTALL
1018 59|[6-9][0-9]|[1-9][0-9][0-9])
1020 # 2.59.0 doesn't require Meson and Ninja, but it
1021 # supports it, and I'm too lazy to add a dot-dot
1022 # version check.
1024 # Disable tests to work around
1026 # https://gitlab.gnome.org/GNOME/glib/-/issues/2902
1028 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" \
1029 $MESON -Dprefix="$installation_prefix" -Dtests=false _build
1030 ninja -C _build
1031 $DO_NINJA_INSTALL
1034 echo "Glib's put out 1000 2.x releases?" 1>&2
1037 esac
1038 esac
1039 cd ..
1040 touch glib-$GLIB_VERSION-done
1044 uninstall_glib() {
1045 if [ -n "$installed_glib_version" ] ; then
1046 echo "Uninstalling GLib:"
1047 cd "glib-$installed_glib_version"
1048 installed_glib_major_version="$( expr "$installed_glib_version" : '\([0-9][0-9]*\).*' )"
1049 installed_glib_minor_version="$( expr "$installed_glib_version" : '[0-9][0-9]*\.\([0-9][0-9]*\).*' )"
1050 # installed_glib_dotdot_version="$( expr $installed_glib_version : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*' )"
1051 # installed_glib_major_minor_version=$installed_glib_major_version.$installed_glib_minor_version
1052 # installed_glib_major_minor_dotdot_version=$installed_glib_major_version.$installed_glib_minor_version.$installed_glib_dotdot_version
1054 # GLib 2.59.1 and later use Meson+Ninja as the build system.
1056 case $installed_glib_major_version in
1059 $DO_MAKE_UNINSTALL
1061 # This appears to delete dependencies out from under other
1062 # Makefiles in the tree, causing it to fail. At least until
1063 # that gets fixed, if it ever gets fixed, we just ignore the
1064 # exit status of "make distclean"
1066 # make distclean
1067 make distclean || echo "Ignoring make distclean failure" 1>&2
1071 case $installed_glib_minor_version in
1073 [0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-8])
1074 $DO_MAKE_UNINSTALL
1076 # This appears to delete dependencies out from under other
1077 # Makefiles in the tree, causing it to fail. At least until
1078 # that gets fixed, if it ever gets fixed, we just ignore the
1079 # exit status of "make distclean"
1081 # make distclean
1082 make distclean || echo "Ignoring make distclean failure" 1>&2
1085 59|[6-9][0-9]|[1-9][0-9][0-9])
1087 # 2.59.0 doesn't require Meson and Ninja, but it
1088 # supports it, and I'm too lazy to add a dot-dot
1089 # version check.
1091 $DO_NINJA_UNINSTALL
1093 # For Meson+Ninja, we do the build in an _build
1094 # subdirectory, so the equivalent of "make distclean"
1095 # is just to remove the directory tree.
1097 rm -rf _build
1101 echo "Glib's put out 1000 2.x releases?" 1>&2
1103 esac
1104 esac
1105 cd ..
1106 rm glib-$installed_glib_version-done
1108 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1110 # Get rid of the previously downloaded and unpacked version.
1112 rm -rf glib-$installed_glib_version
1113 rm -rf glib-$installed_glib_version.tar.xz
1116 installed_glib_version=""
1120 install_qt() {
1121 if [ "$QT_VERSION" -a ! -f qt-$QT_VERSION-done ]; then
1122 echo "Downloading and installing Qt:"
1124 # What you get for this URL might just be a 302 Found reply, so use
1125 # -L so we get redirected.
1127 # 5.0 - 5.1: qt-mac-opensource-{version}-clang-offline.dmg
1128 # 5.2.0: qt-mac-opensource-{version}.dmg
1129 # 5.2.1: qt-opensource-mac-x64-clang-{version}.dmg
1130 # 5.3 - 5.8: qt-opensource-mac-x64-clang-{version}.dmg
1131 # 5.9 - 5.14: qt-opensource-mac-x64-{version}.dmg
1132 # 5.15 - 6.0: Offline installers no longer provided.
1133 # ( https://download.qt.io/archive/qt/5.15/5.15.0/OFFLINE_README.txt )
1134 # XXX: We need a different approach for QT >= 5.15. One option would be to
1135 # install https://github.com/miurahr/aqtinstall, either permanently or into
1136 # a temporary venv.
1138 case $QT_MAJOR_VERSION in
1140 1|2|3|4)
1141 echo "Qt $QT_VERSION" is too old 1>&2
1145 case $QT_MINOR_VERSION in
1147 0|1|2|3|4|5|6|7|8|9|10|11|12|13|14)
1148 echo "Qt $QT_VERSION" is too old 1>&2
1152 echo "The Qt Company no longer provides open source offline installers for Qt $QT_VERSION" 1>&2
1155 esac
1156 [ -f $QT_VOLUME.dmg ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" https://download.qt.io/archive/qt/$QT_MAJOR_MINOR_VERSION/$QT_MAJOR_MINOR_DOTDOT_VERSION/$QT_VOLUME.dmg
1157 $no_build && echo "Skipping installation" && return
1158 sudo hdiutil attach $QT_VOLUME.dmg
1161 # Run the installer executable directly, so that we wait for
1162 # it to finish. Then unmount the volume.
1164 /Volumes/$QT_VOLUME/$QT_VOLUME.app/Contents/MacOS/$QT_VOLUME
1165 sudo hdiutil detach /Volumes/$QT_VOLUME
1166 touch qt-$QT_VERSION-done
1169 echo "The Qt Company no longer provides open source offline installers for Qt $QT_VERSION" 1>&2
1171 esac
1175 uninstall_qt() {
1176 if [ -n "$installed_qt_version" ] ; then
1177 echo "Uninstalling Qt:"
1178 rm -rf $HOME/Qt$installed_qt_version
1179 rm qt-$installed_qt_version-done
1181 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1183 # Get rid of the previously downloaded version.
1185 # 5.0 - 5.1: qt-mac-opensource-{version}-clang-offline.dmg
1186 # 5.2.0: qt-mac-opensource-{version}.dmg
1187 # 5.2.1: qt-opensource-mac-x64-clang-{version}.dmg
1188 # 5.3 - 5.8: qt-opensource-mac-x64-clang-{version}.dmg
1189 # 5.9 - 5.14: qt-opensource-mac-x64-{version}.dmg
1191 installed_qt_major_version="$( expr "$installed_qt_version" : '\([0-9][0-9]*\).*' )"
1192 installed_qt_minor_version="$( expr "$installed_qt_version" : '[0-9][0-9]*\.\([0-9][0-9]*\).*' )"
1193 # installed_qt_dotdot_version="$( expr "$installed_qt_version" : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*' )"
1194 case $installed_qt_major_version in
1196 1|2|3|4)
1197 echo "Qt $installed_qt_version" is too old 1>&2
1201 case $installed_qt_minor_version in
1203 0|1|2|3|4|5|6|7|8|9|10|11)
1204 echo "Qt $installed_qt_version" is too old 1>&2
1207 12|13|14)
1208 installed_qt_volume=qt-opensource-mac-x64-$installed_qt_version.dmg
1210 esac
1211 esac
1212 rm -f $installed_qt_volume
1215 installed_qt_version=""
1219 install_libsmi() {
1220 if [ "$LIBSMI_VERSION" -a ! -f libsmi-$LIBSMI_VERSION-done ] ; then
1221 echo "Downloading, building, and installing libsmi:"
1222 [ -f libsmi-$LIBSMI_VERSION.tar.gz ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" https://www.ibr.cs.tu-bs.de/projects/libsmi/download/libsmi-$LIBSMI_VERSION.tar.gz
1223 $no_build && echo "Skipping installation" && return
1224 gzcat libsmi-$LIBSMI_VERSION.tar.gz | tar xf -
1225 cd libsmi-$LIBSMI_VERSION
1226 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure "${CONFIGURE_OPTS[@]}"
1227 make "${MAKE_BUILD_OPTS[@]}"
1228 $DO_MAKE_INSTALL
1229 cd ..
1230 touch libsmi-$LIBSMI_VERSION-done
1234 uninstall_libsmi() {
1235 if [ -n "$installed_libsmi_version" ] ; then
1236 echo "Uninstalling libsmi:"
1237 cd libsmi-$installed_libsmi_version
1238 $DO_MAKE_UNINSTALL
1239 make distclean
1240 cd ..
1241 rm libsmi-$installed_libsmi_version-done
1243 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1245 # Get rid of the previously downloaded and unpacked version.
1247 rm -rf libsmi-$installed_libsmi_version
1248 rm -rf libsmi-$installed_libsmi_version.tar.gz
1251 installed_libsmi_version=""
1255 install_libgpg_error() {
1256 if [ "$LIBGPG_ERROR_VERSION" -a ! -f libgpg-error-$LIBGPG_ERROR_VERSION-done ] ; then
1257 echo "Downloading, building, and installing libgpg-error:"
1258 [ -f libgpg-error-$LIBGPG_ERROR_VERSION.tar.bz2 ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" https://www.gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-$LIBGPG_ERROR_VERSION.tar.bz2
1259 $no_build && echo "Skipping installation" && return
1260 bzcat libgpg-error-$LIBGPG_ERROR_VERSION.tar.bz2 | tar xf -
1261 cd libgpg-error-$LIBGPG_ERROR_VERSION
1262 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure "${CONFIGURE_OPTS[@]}"
1263 make "${MAKE_BUILD_OPTS[@]}"
1264 $DO_MAKE_INSTALL
1265 cd ..
1266 touch libgpg-error-$LIBGPG_ERROR_VERSION-done
1270 uninstall_libgpg_error() {
1271 if [ -n "$installed_libgpg_error_version" ] ; then
1273 # libgcrypt depends on this, so uninstall it.
1275 uninstall_libgcrypt "$@"
1277 echo "Uninstalling libgpg-error:"
1278 cd libgpg-error-$installed_libgpg_error_version
1279 $DO_MAKE_UNINSTALL
1280 make distclean
1281 cd ..
1282 rm libgpg-error-$installed_libgpg_error_version-done
1284 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1286 # Get rid of the previously downloaded and unpacked version.
1288 rm -rf libgpg-error-$installed_libgpg_error_version
1289 rm -rf libgpg-error-$installed_libgpg_error_version.tar.bz2
1292 installed_libgpg_error_version=""
1296 install_libgcrypt() {
1297 if [ "$LIBGCRYPT_VERSION" -a ! -f libgcrypt-$LIBGCRYPT_VERSION-done ] ; then
1299 # libgpg-error is required for libgcrypt.
1301 if [ -z $LIBGPG_ERROR_VERSION ]
1302 then
1303 echo "libgcrypt requires libgpg-error, but you didn't install libgpg-error." 1>&2
1304 exit 1
1307 echo "Downloading, building, and installing libgcrypt:"
1308 [ -f libgcrypt-$LIBGCRYPT_VERSION.tar.gz ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" https://www.gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-$LIBGCRYPT_VERSION.tar.gz
1309 $no_build && echo "Skipping installation" && return
1310 gzcat libgcrypt-$LIBGCRYPT_VERSION.tar.gz | tar xf -
1311 cd libgcrypt-$LIBGCRYPT_VERSION
1313 # The assembler language code is not compatible with the macOS
1314 # x86 assembler (or is it an x86-64 vs. x86-32 issue?).
1316 # libgcrypt expects gnu89, not c99/gnu99, semantics for
1317 # "inline". See, for example:
1319 # https://lists.freebsd.org/pipermail/freebsd-ports-bugs/2010-October/198809.html
1321 # We specify "unix" as the random number generator so that we
1322 # don't try to use getentropy, because random/rndgetentropy.c
1323 # *REQUIRES* Linux getrandom(), which we don't have. (This should
1324 # not matter, as we only use this for decryption, as far as I know.)
1326 CFLAGS="$CFLAGS -std=gnu89 $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" \
1327 ./configure "${CONFIGURE_OPTS[@]}" --disable-asm --enable-random=unix
1328 make "${MAKE_BUILD_OPTS[@]}"
1329 $DO_MAKE_INSTALL
1330 cd ..
1331 touch libgcrypt-$LIBGCRYPT_VERSION-done
1335 uninstall_libgcrypt() {
1336 if [ -n "$installed_libgcrypt_version" ] ; then
1337 echo "Uninstalling libgcrypt:"
1338 cd libgcrypt-$installed_libgcrypt_version
1339 $DO_MAKE_UNINSTALL
1340 make distclean
1341 cd ..
1342 rm libgcrypt-$installed_libgcrypt_version-done
1344 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1346 # Get rid of the previously downloaded and unpacked version.
1348 rm -rf libgcrypt-$installed_libgcrypt_version
1349 rm -rf libgcrypt-$installed_libgcrypt_version.tar.gz
1352 installed_libgcrypt_version=""
1356 install_gmp() {
1357 if [ "$GMP_VERSION" ] && [ ! -f "gmp-$GMP_VERSION-done" ] ; then
1358 echo "Downloading, building, and installing GMP:"
1359 [ -f "gmp-$GMP_VERSION.tar.xz" ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" https://gmplib.org/download/gmp/gmp-$GMP_VERSION.tar.xz
1360 $no_build && echo "Skipping installation" && return
1361 xzcat "gmp-$GMP_VERSION.tar.xz" | tar xf -
1362 cd "gmp-$GMP_VERSION"
1364 # Create a fat binary: https://gmplib.org/manual/Notes-for-Package-Builds.html
1366 # According to
1368 # https://www.mail-archive.com/gmp-bugs@gmplib.org/msg01492.html
1370 # and other pages, the Shiny New Linker in Xcode 15 causes this
1371 # build to fail with "ld: branch8 out of range 384833 in
1372 # ___gmpn_add_nc_x86_64"; linking with -ld64 is a workaround.
1374 # For now, link with -ld64 on Xcode 15 and later.
1376 XCODE_VERSION=$( xcodebuild -version | sed -n 's;Xcode \(.*\);\1;p' )
1377 XCODE_MAJOR_VERSION="$( expr "$XCODE_VERSION" : '\([0-9][0-9]*\).*' )"
1378 # XCODE_MINOR_VERSION="$( expr $XCODE_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*' )"
1379 # XCODE_DOTDOT_VERSION="$( expr $XCODE_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*' )"
1380 if [ "$XCODE_MAJOR_VERSION" -ge 15 ]
1381 then
1382 LD64_FLAG="-ld64"
1383 else
1384 LD64_FLAG=""
1386 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS $LD64_FLAG" \
1387 ./configure "${CONFIGURE_OPTS[@]}" --enable-fat
1388 make "${MAKE_BUILD_OPTS[@]}"
1389 $DO_MAKE_INSTALL
1390 cd ..
1391 touch "gmp-$GMP_VERSION-done"
1395 uninstall_gmp() {
1396 if [ -n "$installed_gmp_version" ] ; then
1398 # Nettle depends on this, so uninstall it.
1400 uninstall_nettle "$@"
1402 echo "Uninstalling GMP:"
1403 cd "gmp-$installed_gmp_version"
1404 $DO_MAKE_UNINSTALL
1405 make distclean
1406 cd ..
1407 rm "gmp-$installed_gmp_version-done"
1409 if [ "$#" -eq 1 ] && [ "$1" = "-r" ] ; then
1411 # Get rid of the previously downloaded and unpacked version.
1413 rm -rf "gmp-$installed_gmp_version"
1414 rm -rf "gmp-$installed_gmp_version.tar.xz"
1417 installed_gmp_version=""
1421 install_libtasn1() {
1422 if [ "$LIBTASN1_VERSION" ] && [ ! -f "libtasn1-$LIBTASN1_VERSION-done" ] ; then
1423 echo "Downloading, building, and installing libtasn1:"
1424 [ -f "libtasn1-$LIBTASN1_VERSION.tar.gz" ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" "https://ftp.gnu.org/gnu/libtasn1/libtasn1-$LIBTASN1_VERSION.tar.gz"
1425 $no_build && echo "Skipping installation" && return
1426 gzcat "libtasn1-$LIBTASN1_VERSION.tar.gz" | tar xf -
1427 cd "libtasn1-$LIBTASN1_VERSION"
1428 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" \
1429 ./configure "${CONFIGURE_OPTS[@]}"
1430 make "${MAKE_BUILD_OPTS[@]}"
1431 $DO_MAKE_INSTALL
1432 cd ..
1433 touch "libtasn1-$LIBTASN1_VERSION-done"
1437 uninstall_libtasn1() {
1438 if [ -n "$installed_libtasn1_version" ] ; then
1440 # p11-kit depends on this, so uninstall it.
1442 uninstall_p11_kit "$@"
1444 echo "Uninstalling libtasn1:"
1445 cd "libtasn1-$installed_libtasn1_version"
1446 $DO_MAKE_UNINSTALL
1447 make distclean
1448 cd ..
1449 rm "libtasn1-$installed_libtasn1_version-done"
1451 if [ "$#" -eq 1 ] && [ "$1" = "-r" ] ; then
1453 # Get rid of the previously downloaded and unpacked version.
1455 rm -rf "libtasn1-$installed_libtasn1_version"
1456 rm -rf "libtasn1-$installed_libtasn1_version.tar.gz"
1459 installed_libtasn1_version=""
1463 install_p11_kit() {
1464 if [ "$P11KIT_VERSION" ] && [ ! -f "p11-kit-$P11KIT_VERSION-done" ] ; then
1465 echo "Downloading, building, and installing p11-kit:"
1466 [ -f "p11-kit-$P11KIT_VERSION.tar.xz" ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" "https://github.com/p11-glue/p11-kit/releases/download/$P11KIT_VERSION/p11-kit-$P11KIT_VERSION.tar.xz"
1467 $no_build && echo "Skipping installation" && return
1468 xzcat "p11-kit-$P11KIT_VERSION.tar.xz" | tar xf -
1469 cd "p11-kit-$P11KIT_VERSION"
1471 # Prior to Catalina, the libffi that's supplied with macOS
1472 # doesn't support ffi_closure_alloc() or ffi_prep_closure_loc(),
1473 # both of which are required by p11-kit if built with libffi.
1475 # According to
1477 # https://p11-glue.github.io/p11-glue/p11-kit/manual/devel-building.html
1479 # libffi is used "for sharing of PKCS#11 modules between
1480 # multiple callers in the same process. It is highly recommended
1481 # that this dependency be treated as a required dependency.",
1482 # but it's not clear that this matters to us, so we just
1483 # configure p11-kit not to use libffi.
1485 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LIBS=-lintl \
1486 ./configure "${CONFIGURE_OPTS[@]}" --without-libffi --without-trust-paths
1487 make "${MAKE_BUILD_OPTS[@]}"
1488 $DO_MAKE_INSTALL
1489 cd ..
1490 touch "p11-kit-$P11KIT_VERSION-done"
1494 uninstall_p11_kit() {
1495 if [ -n "$installed_p11_kit_version" ] ; then
1497 # Nettle depends on this, so uninstall it.
1499 uninstall_nettle "$@"
1501 echo "Uninstalling p11-kit:"
1502 cd "p11-kit-$installed_p11_kit_version"
1503 $DO_MAKE_UNINSTALL
1504 make distclean
1505 cd ..
1506 rm "p11-kit-$installed_p11_kit_version-done"
1508 if [ "$#" -eq 1 ] && [ "$1" = "-r" ] ; then
1510 # Get rid of the previously downloaded and unpacked version.
1512 rm -rf "p11-kit-$installed_p11_kit_version"
1513 rm -rf "p11-kit-$installed_p11_kit_version.tar.xz"
1516 installed_p11_kit_version=""
1520 install_nettle() {
1521 if [ "$NETTLE_VERSION" ] && [ ! -f "nettle-$NETTLE_VERSION-done" ] ; then
1522 echo "Downloading, building, and installing Nettle:"
1523 [ -f "nettle-$NETTLE_VERSION.tar.gz" ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" "https://ftp.gnu.org/gnu/nettle/nettle-$NETTLE_VERSION.tar.gz"
1524 $no_build && echo "Skipping installation" && return
1525 gzcat "nettle-$NETTLE_VERSION.tar.gz" | tar xf -
1526 cd "nettle-$NETTLE_VERSION"
1527 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" \
1528 ./configure "${CONFIGURE_OPTS[@]}"
1529 make "${MAKE_BUILD_OPTS[@]}"
1530 $DO_MAKE_INSTALL
1531 cd ..
1532 touch "nettle-$NETTLE_VERSION-done"
1536 uninstall_nettle() {
1537 if [ -n "$installed_nettle_version" ] ; then
1539 # GnuTLS depends on this, so uninstall it.
1541 uninstall_gnutls "$@"
1543 echo "Uninstalling Nettle:"
1544 cd "nettle-$installed_nettle_version"
1545 $DO_MAKE_UNINSTALL
1546 make distclean
1547 cd ..
1548 rm "nettle-$installed_nettle_version-done"
1550 if [ "$#" -eq 1 ] && [ "$1" = "-r" ] ; then
1552 # Get rid of the previously downloaded and unpacked version.
1554 rm -rf "nettle-$installed_nettle_version"
1555 rm -rf "nettle-$installed_nettle_version.tar.gz"
1558 installed_nettle_version=""
1562 install_gnutls() {
1563 if [ "$GNUTLS_VERSION" ] && [ ! -f "gnutls-$GNUTLS_VERSION-done" ] ; then
1565 # GnuTLS requires Nettle.
1567 if [ -z "$NETTLE_VERSION" ]
1568 then
1569 echo "GnuTLS requires Nettle, but you didn't install Nettle" 1>&2
1570 exit 1
1573 echo "Downloading, building, and installing GnuTLS:"
1574 [ -f gnutls-$GNUTLS_VERSION.tar.xz ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" "https://www.gnupg.org/ftp/gcrypt/gnutls/v$GNUTLS_MAJOR_VERSION.$GNUTLS_MINOR_VERSION/gnutls-$GNUTLS_VERSION.tar.xz"
1575 echo "$GNUTLS_SHA256 gnutls-$GNUTLS_VERSION.tar.xz" | shasum --algorithm 256 --check
1576 $no_build && echo "Skipping installation" && return
1577 tar -xf gnutls-$GNUTLS_VERSION.tar.xz
1578 cd gnutls-$GNUTLS_VERSION
1579 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" \
1580 ./configure "${CONFIGURE_OPTS[@]}" --with-included-unistring --disable-guile
1581 make "${MAKE_BUILD_OPTS[@]}"
1582 $DO_MAKE_INSTALL
1583 cd ..
1584 touch gnutls-$GNUTLS_VERSION-done
1588 uninstall_gnutls() {
1589 if [ -n "$installed_gnutls_version" ] ; then
1590 echo "Uninstalling GnuTLS:"
1591 cd "gnutls-$installed_gnutls_version"
1592 $DO_MAKE_UNINSTALL
1593 make distclean
1594 cd ..
1595 rm "gnutls-$installed_gnutls_version-done" s
1597 if [ "$#" -eq 1 ] && [ "$1" = "-r" ] ; then
1599 # Get rid of the previously downloaded and unpacked version.
1601 rm -rf "gnutls-$installed_gnutls_version"
1602 rm -rf "gnutls-$installed_gnutls_version.tar.bz2"
1605 installed_gnutls_version=""
1609 install_lua() {
1610 if [ "$LUA_VERSION" -a ! -f lua-$LUA_VERSION-done ] ; then
1611 echo "Downloading, building, and installing Lua:"
1612 [ -f lua-$LUA_VERSION.tar.gz ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" https://www.lua.org/ftp/lua-$LUA_VERSION.tar.gz
1613 $no_build && echo "Skipping installation" && return
1614 gzcat lua-$LUA_VERSION.tar.gz | tar xf -
1615 cd lua-$LUA_VERSION
1616 make INSTALL_TOP="$installation_prefix" MYCFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" MYLDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" macosx
1617 $DO_MAKE INSTALL_TOP="$installation_prefix" install
1618 cd ..
1619 touch lua-$LUA_VERSION-done
1623 uninstall_lua() {
1624 if [ -n "$installed_lua_version" ] ; then
1625 echo "Uninstalling Lua:"
1627 # Lua has no "make uninstall", so just remove stuff manually.
1628 # There's no configure script, so there's no need for
1629 # "make distclean", either; just do "make clean".
1631 (cd "$installation_prefix/bin"; $DO_RM -f lua luac)
1632 (cd "$installation_prefix/include"; $DO_RM -f lua.h luaconf.h lualib.h lauxlib.h lua.hpp)
1633 (cd "$installation_prefix/lib"; $DO_RM -f liblua.a)
1634 (cd "$installation_prefix/man/man1"; $DO_RM -f lua.1 luac.1)
1635 cd lua-$installed_lua_version
1636 make clean
1637 cd ..
1638 rm lua-$installed_lua_version-done
1640 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1642 # Get rid of the previously downloaded and unpacked version.
1644 rm -rf lua-$installed_lua_version
1645 rm -rf lua-$installed_lua_version.tar.gz
1648 installed_lua_version=""
1652 install_snappy() {
1653 if [ "$SNAPPY_VERSION" -a ! -f snappy-$SNAPPY_VERSION-done ] ; then
1654 echo "Downloading, building, and installing snappy:"
1655 [ -f snappy-$SNAPPY_VERSION.tar.gz ] || curl "${CURL_LOCAL_NAME_OPTS[@]}" snappy-$SNAPPY_VERSION.tar.gz https://github.com/google/snappy/archive/$SNAPPY_VERSION.tar.gz
1656 $no_build && echo "Skipping installation" && return
1657 gzcat snappy-$SNAPPY_VERSION.tar.gz | tar xf -
1658 cd snappy-$SNAPPY_VERSION
1659 if [ "$SNAPPY_VERSION" = "1.1.10" ] ; then
1660 # This patch corresponds to https://github.com/google/snappy/commit/27f34a580be4a3becf5f8c0cba13433f53c21337
1661 patch -p0 < "${topdir}/tools/macos-setup-patches/snappy-signed.patch"
1663 mkdir build_dir
1664 cd build_dir
1666 # Build a shared library, because we'll be linking libwireshark,
1667 # which is a C library, with libsnappy, and libsnappy is a C++
1668 # library and requires the C++ run time; the shared library
1669 # will carry that dependency with it, so linking with it should
1670 # Just Work.
1672 "${DO_CMAKE[@]}" -DBUILD_SHARED_LIBS=YES -DSNAPPY_BUILD_BENCHMARKS=NO -DSNAPPY_BUILD_TESTS=NO ..
1673 make "${MAKE_BUILD_OPTS[@]}"
1674 $DO_MAKE_INSTALL
1675 cd ../..
1676 touch snappy-$SNAPPY_VERSION-done
1680 uninstall_snappy() {
1681 if [ -n "$installed_snappy_version" ] ; then
1682 echo "Uninstalling snappy:"
1683 cd snappy-$installed_snappy_version
1685 # snappy uses cmake and doesn't support "make uninstall";
1686 # just remove what we know it installs.
1688 # $DO_MAKE_UNINSTALL
1689 if [ -s build_dir/install_manifest.txt ] ; then
1690 while read -r ; do $DO_RM -v "$REPLY" ; done < <(cat build_dir/install_manifest.txt; echo)
1691 else
1692 $DO_RM -f "$installation_prefix/lib/libsnappy.1.1.8.dylib" \
1693 "$installation_prefix/lib/libsnappy.1.dylib" \
1694 "$installation_prefix/lib/libsnappy.dylib" \
1695 "$installation_prefix/include/snappy-c.h" \
1696 "$installation_prefix/include/snappy-sinksource.h" \
1697 "$installation_prefix/include/snappy-stubs-public.h" \
1698 "$installation_prefix/include/snappy.h" \
1699 "$installation_prefix/lib/cmake/Snappy/SnappyConfig.cmake" \
1700 "$installation_prefix/lib/cmake/Snappy/SnappyConfigVersion.cmake" \
1701 "$installation_prefix/lib/cmake/Snappy/SnappyTargets-noconfig.cmake" \
1702 "$installation_prefix/lib/cmake/Snappy/SnappyTargets.cmake"
1705 # snappy uses cmake and doesn't support "make distclean";
1706 #.just remove the entire build directory.
1708 # make distclean
1709 rm -rf build_dir
1710 cd ..
1711 rm snappy-$installed_snappy_version-done
1713 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1715 # Get rid of the previously downloaded and unpacked version.
1717 rm -rf snappy-$installed_snappy_version
1718 rm -rf snappy-$installed_snappy_version.tar.gz
1721 installed_snappy_version=""
1725 install_zstd() {
1726 if [ "$ZSTD_VERSION" ] && [ ! -f zstd-$ZSTD_VERSION-done ] ; then
1727 echo "Downloading, building, and installing zstd:"
1728 [ -f zstd-$ZSTD_VERSION.tar.gz ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" https://github.com/facebook/zstd/releases/download/v$ZSTD_VERSION/zstd-$ZSTD_VERSION.tar.gz
1729 $no_build && echo "Skipping installation" && return
1730 gzcat zstd-$ZSTD_VERSION.tar.gz | tar xf -
1731 cd zstd-$ZSTD_VERSION
1732 # We shouldn't have to specify DESTDIR.
1733 # https://github.com/facebook/zstd/issues/3146
1734 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" \
1735 make PREFIX="$installation_prefix" DESTDIR="$installation_prefix" "${MAKE_BUILD_OPTS[@]}"
1736 $DO_MAKE PREFIX="$installation_prefix" install
1737 cd ..
1738 touch zstd-$ZSTD_VERSION-done
1742 uninstall_zstd() {
1743 if [ -n "$installed_zstd_version" ] ; then
1744 echo "Uninstalling zstd:"
1745 cd "zstd-$installed_zstd_version"
1746 $DO_MAKE_UNINSTALL
1748 # zstd has no configure script, so there's no need for
1749 # "make distclean", and the Makefile supplied with it
1750 # has no "make distclean" rule; just do "make clean".
1752 make clean
1753 cd ..
1754 rm "zstd-$installed_zstd_version-done"
1756 if [ "$#" -eq 1 ] && [ "$1" = "-r" ] ; then
1758 # Get rid of the previously downloaded and unpacked version.
1760 rm -rf "zstd-$installed_zstd_version"
1761 rm -rf "zstd-$installed_zstd_version.tar.gz"
1764 installed_zstd_version=""
1767 #$ZLIBNG_VERSION
1768 install_zlibng() {
1769 if [ "$ZLIBNG_VERSION" ] && [ ! -f zlib-ng-$ZLIBNG_VERSION-done ] ; then
1770 echo "Downloading, building, and installing zlib-ng:"
1771 [ -f $ZLIBNG_VERSION.tar.gz ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" https://github.com/zlib-ng/zlib-ng/archive/refs/tags/$ZLIBNG_VERSION.tar.gz
1772 $no_build && echo "Skipping installation" && return
1773 gzcat $ZLIBNG_VERSION.tar.gz | tar xf -
1774 cd zlib-ng-$ZLIBNG_VERSION
1775 mkdir build
1776 cd build
1777 "${DO_CMAKE[@]}" ..
1778 make "${MAKE_BUILD_OPTS[@]}"
1779 $DO_MAKE_INSTALL
1780 cd ../..
1781 touch zlib-ng-$ZLIBNG_VERSION-done
1785 uninstall_zlibng() {
1786 if [ -n "$installed_zstd_version" ] ; then
1787 echo "Uninstalling zlibng:"
1788 cd "zlib-ng-$installed_zlibng_version"
1789 $DO_MAKE_UNINSTALL
1791 # XXX not sure what to do here...
1793 make clean
1794 cd ..
1795 rm "zlib-ng-$installed_zlibng_version-done"
1797 if [ "$#" -eq 1 ] && [ "$1" = "-r" ] ; then
1799 # Get rid of the previously downloaded and unpacked version.
1801 rm -rf "zlib-ng-$installed_zlibng_version"
1802 rm -rf "zlib-ng-$installed_zlibng_version.tar.gz"
1805 installed_zlibng_version=""
1808 install_libxml2() {
1809 if [ "$LIBXML2_VERSION" ] && [ ! -f libxml2-$LIBXML2_VERSION-done ] ; then
1810 echo "Downloading, building, and installing libxml2:"
1811 LIBXML2_MAJOR_VERSION="$( expr "$LIBXML2_VERSION" : '\([0-9][0-9]*\).*' )"
1812 LIBXML2_MINOR_VERSION="$( expr "$LIBXML2_VERSION" : '[0-9][0-9]*\.\([0-9][0-9]*\).*' )"
1813 LIBXML2_MAJOR_MINOR_VERSION=$LIBXML2_MAJOR_VERSION.$LIBXML2_MINOR_VERSION
1814 [ -f libxml2-$LIBXML2_VERSION.tar.gz ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" "https://download.gnome.org/sources/libxml2/$LIBXML2_MAJOR_MINOR_VERSION/libxml2-$LIBXML2_VERSION.tar.xz"
1815 echo "$LIBXML2_SHA256 libxml2-$LIBXML2_VERSION.tar.xz" | shasum --algorithm 256 --check
1816 $no_build && echo "Skipping installation" && return
1817 xzcat libxml2-$LIBXML2_VERSION.tar.xz | tar xf -
1818 cd "libxml2-$LIBXML2_VERSION"
1820 # At least on macOS 12.0.1 with Xcode 13.1, when we build
1821 # libxml2, the linker complains that we don't have the right
1822 # to link with the Python framework, so don't build with
1823 # Python.
1825 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" \
1826 ./configure "${CONFIGURE_OPTS[@]}" --without-python
1827 make "${MAKE_BUILD_OPTS[@]}"
1828 $DO_MAKE_INSTALL
1829 cd ..
1830 touch libxml2-$LIBXML2_VERSION-done
1834 uninstall_libxml2() {
1835 if [ -n "$installed_libxml2_version" ] ; then
1836 echo "Uninstalling libxml2:"
1837 cd "libxml2-$installed_libxml2_version"
1838 $DO_MAKE_UNINSTALL
1839 make distclean
1840 cd ..
1841 rm "libxml2-$installed_libxml2_version-done"
1843 if [ "$#" -eq 1 ] && [ "$1" = "-r" ] ; then
1845 # Get rid of the previously downloaded and unpacked version.
1847 rm -rf "libxml2-$installed_libxml2_version"
1848 rm -rf "libxml2-$installed_libxml2_version.tar.xz"
1851 installed_libxml2_version=""
1855 install_lz4() {
1856 if [ "$LZ4_VERSION" ] && [ ! -f lz4-$LZ4_VERSION-done ] ; then
1857 echo "Downloading, building, and installing lz4:"
1859 # lz4 switched from sequentially numbered releases, named rN,
1860 # to vX.Y.Z-numbered releases.
1862 # The old sequentially-numbered releases were in tarballs
1863 # at https://github.com/lz4/lz4/archive/rN.tar.gz, which
1864 # extract into an lz4-rN directory.
1866 # THe new vX.Y.Z-numbered releases are in tarballs at
1867 # https://github.com/lz4/lz4/archive/vX.Y.Z.tar.gz, which
1868 # extract into an lz4-X.Y.Z directory - no, not lz4-vX.Y.Z,
1869 # just lz4-X.Y.Z.
1871 # We expect LZ4_VERSION to be set to rN for the sequentially-
1872 # numbered releases and X.Y.Z - not vX.Y.Z - for the vX.Y.Z-
1873 # numbered releases. We also tell Curl to download the tarball
1874 # with a name that corresponds to the name of the target
1875 # directory, so that it begins with "lz4-" and ends with either
1876 # "rN" or "X.Y.Z", to match what almost all of the other
1877 # support libraries do.
1879 if [[ "$LZ4_VERSION" == r* ]]
1880 then
1881 [ -f lz4-$LZ4_VERSION.tar.gz ] || curl "${CURL_LOCAL_NAME_OPTS[@]}" lz4-$LZ4_VERSION.tar.gz https://github.com/lz4/lz4/archive/$LZ4_VERSION.tar.gz
1882 else
1883 [ -f lz4-$LZ4_VERSION.tar.gz ] || curl "${CURL_LOCAL_NAME_OPTS[@]}" lz4-$LZ4_VERSION.tar.gz https://github.com/lz4/lz4/archive/v$LZ4_VERSION.tar.gz
1885 $no_build && echo "Skipping installation" && return
1886 gzcat lz4-$LZ4_VERSION.tar.gz | tar xf -
1887 cd lz4-$LZ4_VERSION
1889 # No configure script here, but it appears that if MOREFLAGS is
1890 # set, that's added to CFLAGS, and those are combined with LDFLAGS
1891 # and CXXFLAGS into FLAGS, which is used when building source
1892 # files and libraries.
1894 MOREFLAGS="-D_FORTIFY_SOURCE=0 $VERSION_MIN_FLAGS $SDKFLAGS" \
1895 make PREFIX="$installation_prefix" "${MAKE_BUILD_OPTS[@]}"
1896 $DO_MAKE PREFIX="$installation_prefix" install
1897 cd ..
1898 touch lz4-$LZ4_VERSION-done
1902 uninstall_lz4() {
1903 if [ -n "$installed_lz4_version" ] ; then
1904 echo "Uninstalling lz4:"
1905 cd "lz4-$installed_lz4_version"
1906 $DO_MAKE_UNINSTALL
1908 # lz4's Makefile doesn't support "make distclean"; just do
1909 # "make clean". Perhaps not using autotools means that
1910 # there's no need for "make distclean".
1912 # make distclean
1913 make clean
1914 cd ..
1915 rm "lz4-$installed_lz4_version-done"
1917 if [ "$#" -eq 1 ] && [ "$1" = "-r" ] ; then
1919 # Get rid of the previously downloaded and unpacked version.
1921 # "make install" apparently causes some stuff to be
1922 # modified in the build tree, so, as it's done as
1923 # root, that leaves stuff owned by root in the build
1924 # tree. Therefore, we have to remove the build tree
1925 # as root.
1927 sudo rm -rf "lz4-$installed_lz4_version"
1928 rm -rf "lz4-$installed_lz4_version.tar.gz"
1931 installed_lz4_version=""
1935 install_sbc() {
1936 if [ "$SBC_VERSION" -a ! -f sbc-$SBC_VERSION-done ] ; then
1937 echo "Downloading, building, and installing sbc:"
1938 [ -f sbc-$SBC_VERSION.tar.gz ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" https://www.kernel.org/pub/linux/bluetooth/sbc-$SBC_VERSION.tar.gz
1939 $no_build && echo "Skipping installation" && return
1940 gzcat sbc-$SBC_VERSION.tar.gz | tar xf -
1941 cd sbc-$SBC_VERSION
1942 if [ "$DARWIN_PROCESSOR_ARCH" = "arm64" ] ; then
1943 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" \
1944 ./configure "${CONFIGURE_OPTS[@]}" --disable-tools --disable-tester --disable-shared
1945 else
1946 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" \
1947 ./configure "${CONFIGURE_OPTS[@]}" --disable-tools --disable-tester --disable-shared
1949 make "${MAKE_BUILD_OPTS[@]}"
1950 $DO_MAKE_INSTALL
1951 cd ..
1952 touch sbc-$SBC_VERSION-done
1956 uninstall_sbc() {
1957 if [ -n "$installed_sbc_version" ] ; then
1958 echo "Uninstalling sbc:"
1959 cd sbc-$installed_sbc_version
1960 $DO_MAKE_UNINSTALL
1961 make distclean
1962 cd ..
1963 rm sbc-$installed_sbc_version-done
1965 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
1967 # Get rid of the previously downloaded and unpacked version.
1969 rm -rf sbc-$installed_sbc_version
1970 rm -rf sbc-$installed_sbc_version.tar.gz
1973 installed_sbc_version=""
1977 install_maxminddb() {
1978 if [ "$MAXMINDDB_VERSION" -a ! -f maxminddb-$MAXMINDDB_VERSION-done ] ; then
1979 echo "Downloading, building, and installing MaxMindDB API:"
1980 [ -f libmaxminddb-$MAXMINDDB_VERSION.tar.gz ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" https://github.com/maxmind/libmaxminddb/releases/download/$MAXMINDDB_VERSION/libmaxminddb-$MAXMINDDB_VERSION.tar.gz
1981 $no_build && echo "Skipping installation" && return
1982 gzcat libmaxminddb-$MAXMINDDB_VERSION.tar.gz | tar xf -
1983 cd libmaxminddb-$MAXMINDDB_VERSION
1984 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" \
1985 ./configure "${CONFIGURE_OPTS[@]}"
1986 make "${MAKE_BUILD_OPTS[@]}"
1987 $DO_MAKE_INSTALL
1988 cd ..
1989 touch maxminddb-$MAXMINDDB_VERSION-done
1993 uninstall_maxminddb() {
1994 if [ -n "$installed_maxminddb_version" ] ; then
1995 echo "Uninstalling MaxMindDB API:"
1996 cd libmaxminddb-$installed_maxminddb_version
1997 $DO_MAKE_UNINSTALL
1998 make distclean
1999 cd ..
2000 rm maxminddb-$installed_maxminddb_version-done
2002 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
2004 # Get rid of the previously downloaded and unpacked version.
2006 rm -rf libmaxminddb-$installed_maxminddb_version
2007 rm -rf libmaxminddb-$installed_maxminddb_version.tar.gz
2010 installed_maxminddb_version=""
2014 install_c_ares() {
2015 if [ "$CARES_VERSION" -a ! -f c-ares-$CARES_VERSION-done ] ; then
2016 echo "Downloading, building, and installing C-Ares API:"
2017 # https://github.com/c-ares/c-ares/releases/download/v1.31.0/c-ares-1.31.0.tar.gz
2018 [ -f c-ares-$CARES_VERSION.tar.gz ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" https://github.com/c-ares/c-ares/releases/download/v$CARES_VERSION/c-ares-$CARES_VERSION.tar.gz
2019 $no_build && echo "Skipping installation" && return
2020 gzcat c-ares-$CARES_VERSION.tar.gz | tar xf -
2021 cd c-ares-$CARES_VERSION
2022 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" \
2023 ./configure "${CONFIGURE_OPTS[@]}"
2024 make "${MAKE_BUILD_OPTS[@]}"
2025 $DO_MAKE_INSTALL
2026 cd ..
2027 touch c-ares-$CARES_VERSION-done
2031 uninstall_c_ares() {
2032 if [ -n "$installed_cares_version" ] ; then
2033 echo "Uninstalling C-Ares API:"
2034 cd c-ares-$installed_cares_version
2035 $DO_MAKE_UNINSTALL
2036 make distclean
2037 cd ..
2038 rm c-ares-$installed_cares_version-done
2040 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
2042 # Get rid of the previously downloaded and unpacked version.
2044 rm -rf c-ares-$installed_cares_version
2045 rm -rf c-ares-$installed_cares_version.tar.gz
2048 installed_cares_version=""
2052 install_libssh() {
2053 if [ "$LIBSSH_VERSION" -a ! -f libssh-$LIBSSH_VERSION-done ] ; then
2054 echo "Downloading, building, and installing libssh:"
2055 LIBSSH_MAJOR_VERSION="$( expr "$LIBSSH_VERSION" : '\([0-9][0-9]*\).*' )"
2056 LIBSSH_MINOR_VERSION="$( expr "$LIBSSH_VERSION" : '[0-9][0-9]*\.\([0-9][0-9]*\).*' )"
2057 LIBSSH_MAJOR_MINOR_VERSION=$LIBSSH_MAJOR_VERSION.$LIBSSH_MINOR_VERSION
2058 [ -f libssh-$LIBSSH_VERSION.tar.xz ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" https://www.libssh.org/files/$LIBSSH_MAJOR_MINOR_VERSION/libssh-$LIBSSH_VERSION.tar.xz
2059 $no_build && echo "Skipping installation" && return
2060 xzcat libssh-$LIBSSH_VERSION.tar.xz | tar xf -
2061 cd "libssh-$LIBSSH_VERSION"
2062 patch -p1 < "${topdir}/tools/macos-setup-patches/libssh-werror.patch"
2063 mkdir build
2064 cd build
2065 "${DO_CMAKE[@]}" -DWITH_GCRYPT=1 ..
2066 make "${MAKE_BUILD_OPTS[@]}"
2067 $DO_MAKE_INSTALL
2068 cd ../..
2069 touch libssh-$LIBSSH_VERSION-done
2073 uninstall_libssh() {
2074 if [ -n "$installed_libssh_version" ] ; then
2075 echo "Uninstalling libssh:"
2076 cd libssh-$installed_libssh_version
2078 # libssh uses cmake and doesn't support "make uninstall";
2079 # just remove what we know it installs.
2081 # $DO_MAKE_UNINSTALL
2082 $DO_RM -rf "$installation_prefix"/lib/libssh* \
2083 "$installation_prefix"/include/libssh \
2084 "$installation_prefix"/lib/pkgconfig/libssh* \
2085 "$installation_prefix"/lib/cmake/libssh
2087 # libssh uses cmake and doesn't support "make distclean";
2088 # just remove the entire build directory.
2090 # make distclean
2091 rm -rf build
2092 cd ..
2093 rm libssh-$installed_libssh_version-done
2095 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
2097 # Get rid of the previously downloaded and unpacked version.
2099 rm -rf libssh-$installed_libssh_version
2100 rm -rf libssh-$installed_libssh_version.tar.gz
2103 installed_libssh_version=""
2107 install_nghttp2() {
2108 if [ "$NGHTTP2_VERSION" -a ! -f nghttp2-$NGHTTP2_VERSION-done ] ; then
2109 echo "Downloading, building, and installing nghttp2:"
2110 [ -f nghttp2-$NGHTTP2_VERSION.tar.xz ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" https://github.com/nghttp2/nghttp2/releases/download/v$NGHTTP2_VERSION/nghttp2-$NGHTTP2_VERSION.tar.xz
2111 $no_build && echo "Skipping installation" && return
2112 xzcat nghttp2-$NGHTTP2_VERSION.tar.xz | tar xf -
2113 cd nghttp2-$NGHTTP2_VERSION
2114 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" \
2115 ./configure "${CONFIGURE_OPTS[@]}" --enable-lib-only
2116 make "${MAKE_BUILD_OPTS[@]}"
2117 $DO_MAKE_INSTALL
2118 cd ..
2119 touch nghttp2-$NGHTTP2_VERSION-done
2123 uninstall_nghttp2() {
2124 if [ -n "$installed_nghttp2_version" ] ; then
2125 echo "Uninstalling nghttp2:"
2126 cd nghttp2-$installed_nghttp2_version
2127 $DO_MAKE_UNINSTALL
2128 make distclean
2129 cd ..
2130 rm nghttp2-$installed_nghttp2_version-done
2132 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
2134 # Get rid of the previously downloaded and unpacked version.
2136 rm -rf nghttp2-$installed_nghttp2_version
2137 rm -rf nghttp2-$installed_nghttp2_version.tar.xz
2140 installed_nghttp2_version=""
2144 install_nghttp3() {
2145 if [ "$NGHTTP3_VERSION" -a ! -f nghttp3-$NGHTTP3_VERSION-done ] ; then
2146 echo "Downloading, building, and installing nghttp3:"
2147 [ -f nghttp3-$NGHTTP3_VERSION.tar.xz ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" https://github.com/ngtcp2/nghttp3/releases/download/v$NGHTTP3_VERSION/nghttp3-$NGHTTP3_VERSION.tar.xz
2148 $no_build && echo "Skipping installation" && return
2149 xzcat nghttp3-$NGHTTP3_VERSION.tar.xz | tar xf -
2150 cd nghttp3-$NGHTTP3_VERSION
2151 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" \
2152 ./configure "${CONFIGURE_OPTS[@]}" --enable-lib-only
2153 make "${MAKE_BUILD_OPTS[@]}"
2154 $DO_MAKE_INSTALL
2155 cd ..
2156 touch nghttp3-$NGHTTP3_VERSION-done
2160 uninstall_nghttp3() {
2161 if [ -n "$installed_nghttp3_version" ] ; then
2162 echo "Uninstalling nghttp3:"
2163 cd nghttp3-$installed_nghttp3_version
2164 $DO_MAKE_UNINSTALL
2165 make distclean
2166 cd ..
2167 rm nghttp3-$installed_nghttp3_version-done
2169 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
2171 # Get rid of the previously downloaded and unpacked version.
2173 rm -rf nghttp3-$installed_nghttp3_version
2174 rm -rf nghttp3-$installed_nghttp3_version.tar.xz
2177 installed_nghttp3_version=""
2181 install_libtiff() {
2182 if [ "$LIBTIFF_VERSION" -a ! -f tiff-$LIBTIFF_VERSION-done ] ; then
2183 echo "Downloading, building, and installing libtiff:"
2184 [ -f tiff-$LIBTIFF_VERSION.tar.gz ] ||
2185 curl "${CURL_REMOTE_NAME_OPTS[@]}" https://download.osgeo.org/libtiff/tiff-$LIBTIFF_VERSION.tar.gz ||
2186 curl "${CURL_REMOTE_NAME_OPTS[@]}" https://download.osgeo.org/libtiff/old/tiff-$LIBTIFF_VERSION.tar.gz ||
2187 exit 1
2188 $no_build && echo "Skipping installation" && return
2189 gzcat tiff-$LIBTIFF_VERSION.tar.gz | tar xf -
2190 cd tiff-$LIBTIFF_VERSION
2191 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" \
2192 ./configure "${CONFIGURE_OPTS[@]}"
2193 make "${MAKE_BUILD_OPTS[@]}"
2194 $DO_MAKE_INSTALL
2195 cd ..
2196 touch tiff-$LIBTIFF_VERSION-done
2200 uninstall_libtiff() {
2201 if [ -n "$installed_libtiff_version" ] ; then
2202 echo "Uninstalling libtiff:"
2203 cd tiff-$installed_libtiff_version
2204 $DO_MAKE_UNINSTALL
2205 make distclean
2206 cd ..
2207 rm tiff-$installed_libtiff_version-done
2209 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
2211 # Get rid of the previously downloaded and unpacked version.
2213 rm -rf tiff-$installed_libtiff_version
2214 rm -rf tiff-$installed_libtiff_version.tar.gz
2217 installed_libtiff_version=""
2221 install_spandsp() {
2222 if [ "$SPANDSP_VERSION" -a ! -f spandsp-$SPANDSP_VERSION-done ] ; then
2223 echo "Downloading, building, and installing SpanDSP:"
2224 [ -f spandsp-$SPANDSP_VERSION.tar.gz ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" https://www.soft-switch.org/downloads/spandsp/spandsp-$SPANDSP_VERSION.tar.gz
2225 $no_build && echo "Skipping installation" && return
2226 gzcat spandsp-$SPANDSP_VERSION.tar.gz | tar xf -
2227 cd spandsp-$SPANDSP_VERSION
2229 # Don't use -Wunused-but-set-variable, as it's not supported
2230 # by all the gcc versions in the versions of Xcode that we
2231 # support.
2233 patch -p0 < "${topdir}/tools/macos-setup-patches/spandsp-configure-patch"
2234 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" \
2235 ./configure "${CONFIGURE_OPTS[@]}"
2236 make "${MAKE_BUILD_OPTS[@]}"
2237 $DO_MAKE_INSTALL
2238 cd ..
2239 touch spandsp-$SPANDSP_VERSION-done
2243 uninstall_spandsp() {
2244 if [ -n "$installed_spandsp_version" ] ; then
2245 echo "Uninstalling SpanDSP:"
2246 cd spandsp-$installed_spandsp_version
2247 $DO_MAKE_UNINSTALL
2248 make distclean
2249 cd ..
2250 rm spandsp-$installed_spandsp_version-done
2252 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
2254 # Get rid of the previously downloaded and unpacked version.
2256 rm -rf spandsp-$installed_spandsp_version
2257 rm -rf spandsp-$installed_spandsp_version.tar.gz
2260 installed_spandsp_version=""
2264 install_speexdsp() {
2265 if [ "$SPEEXDSP_VERSION" -a ! -f speexdsp-$SPEEXDSP_VERSION-done ] ; then
2266 echo "Downloading, building, and installing SpeexDSP:"
2267 [ -f speexdsp-$SPEEXDSP_VERSION.tar.gz ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" https://ftp.osuosl.org/pub/xiph/releases/speex/speexdsp-$SPEEXDSP_VERSION.tar.gz
2268 $no_build && echo "Skipping installation" && return
2269 gzcat speexdsp-$SPEEXDSP_VERSION.tar.gz | tar xf -
2270 cd speexdsp-$SPEEXDSP_VERSION
2271 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" \
2272 ./configure "${CONFIGURE_OPTS[@]}"
2273 make "${MAKE_BUILD_OPTS[@]}"
2274 $DO_MAKE_INSTALL
2275 cd ..
2276 touch speexdsp-$SPEEXDSP_VERSION-done
2280 uninstall_speexdsp() {
2281 if [ -n "$installed_speexdsp_version" ] ; then
2282 echo "Uninstalling SpeexDSP:"
2283 cd speexdsp-$installed_speexdsp_version
2284 $DO_MAKE_UNINSTALL
2285 make distclean
2286 cd ..
2287 rm speexdsp-$installed_speexdsp_version-done
2289 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
2291 # Get rid of the previously downloaded and unpacked version.
2293 rm -rf speexdsp-$installed_speexdsp_version
2294 rm -rf speexdsp-$installed_speexdsp_version.tar.gz
2297 installed_speexdsp_version=""
2301 install_bcg729() {
2302 if [ "$BCG729_VERSION" -a ! -f bcg729-$BCG729_VERSION-done ] ; then
2303 echo "Downloading, building, and installing bcg729:"
2304 [ -f bcg729-$BCG729_VERSION.tar.gz ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" https://gitlab.linphone.org/BC/public/bcg729/-/archive/$BCG729_VERSION/bcg729-$BCG729_VERSION.tar.gz
2305 $no_build && echo "Skipping installation" && return
2306 gzcat bcg729-$BCG729_VERSION.tar.gz | tar xf -
2307 cd bcg729-$BCG729_VERSION
2308 mkdir build_dir
2309 cd build_dir
2310 "${DO_CMAKE[@]}" ..
2311 make "${MAKE_BUILD_OPTS[@]}"
2312 $DO_MAKE_INSTALL
2313 cd ../..
2314 touch bcg729-$BCG729_VERSION-done
2318 uninstall_bcg729() {
2319 if [ -n "$installed_bcg729_version" ] ; then
2320 echo "Uninstalling bcg729:"
2321 cd bcg729-$installed_bcg729_version
2323 # bcg729 uses cmake on macOS and doesn't support "make uninstall";
2324 # just remove what we know it installs.
2326 # $DO_MAKE_UNINSTALL
2327 $DO_RM -rf "$installation_prefix"/share/Bcg729 \
2328 "$installation_prefix"/lib/libbcg729* \
2329 "$installation_prefix"/include/bcg729 \
2330 "$installation_prefix"/lib/pkgconfig/libbcg729*
2332 # bcg729 uses cmake on macOS and doesn't support "make distclean";
2333 # just remove the enire build directory.
2335 # make distclean
2336 rm -rf build_dir
2337 cd ..
2338 rm bcg729-$installed_bcg729_version-done
2340 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
2342 # Get rid of the previously downloaded and unpacked version.
2344 rm -rf bcg729-$installed_bcg729_version
2345 rm -rf bcg729-$installed_bcg729_version.tar.gz
2348 installed_bcg729_version=""
2352 install_ilbc() {
2353 if [ -n "$ILBC_VERSION" ] && [ ! -f ilbc-$ILBC_VERSION-done ] ; then
2354 echo "Downloading, building, and installing iLBC:"
2355 [ -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
2356 $no_build && echo "Skipping installation" && return
2357 bzcat libilbc-$ILBC_VERSION.tar.bz2 | tar xf -
2358 cd libilbc-$ILBC_VERSION
2359 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" \
2360 ./configure "${CONFIGURE_OPTS[@]}"
2361 make "${MAKE_BUILD_OPTS[@]}"
2362 $DO_MAKE_INSTALL
2363 cd ..
2364 touch ilbc-$ILBC_VERSION-done
2368 uninstall_ilbc() {
2369 if [ -n "$installed_ilbc_version" ] ; then
2370 echo "Uninstalling iLBC:"
2371 cd "libilbc-$installed_ilbc_version"
2372 $DO_MAKE_UNINSTALL
2373 make distclean
2374 cd ..
2375 rm "ilbc-$installed_ilbc_version-done"
2377 if [ "$#" -eq 1 ] && [ "$1" = "-r" ] ; then
2379 # Get rid of the previously downloaded and unpacked version.
2381 rm -rf "libilbc-$installed_ilbc_version"
2382 rm -rf "libilbc-$installed_ilbc_version.tar.bz2"
2385 installed_ilbc_version=""
2389 install_opencore_amr() {
2390 if [ "$OPENCORE_AMR_VERSION" ] && [ ! -f opencore-amr-$OPENCORE_AMR_VERSION-done ] ; then
2391 echo "Downloading, building, and installing opencore-amr:"
2392 [ -f opencore-amr-$OPENCORE_AMR_VERSION.tar.gz ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" https://downloads.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-$OPENCORE_AMR_VERSION.tar.gz
2393 echo "$OPENCORE_AMR_SHA256 opencore-amr-$OPENCORE_AMR_VERSION.tar.gz" | shasum --algorithm 256 --check
2394 $no_build && echo "Skipping installation" && return
2395 tar -xf opencore-amr-$OPENCORE_AMR_VERSION.tar.gz
2396 cd opencore-amr-$OPENCORE_AMR_VERSION
2397 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" \
2398 ./configure "${CONFIGURE_OPTS[@]}"
2399 make "${MAKE_BUILD_OPTS[@]}"
2400 $DO_MAKE_INSTALL
2401 cd ..
2402 touch opencore-amr-$OPENCORE_AMR_VERSION-done
2406 uninstall_opencore_amr() {
2407 if [ -n "$installed_opencore_amr_version" ] ; then
2408 echo "Uninstalling opencore-amr:"
2409 cd "opencore-amr-$installed_opencore_amr_version"
2410 $DO_MAKE_UNINSTALL
2411 make distclean
2412 cd ..
2413 rm "opencore-amr-$installed_opencore_amr_version-done"
2415 if [ "$#" -eq 1 ] && [ "$1" = "-r" ] ; then
2417 # Get rid of the previously downloaded and unpacked version.
2419 rm -rf "opencore-amr-$installed_opencore_amr_version"
2420 rm -rf "opencore-amr-$installed_opencore_amr_version.tar.gz"
2423 installed_opencore_amr_version=""
2427 install_opus() {
2428 if [ "$OPUS_VERSION" -a ! -f opus-$OPUS_VERSION-done ] ; then
2429 echo "Downloading, building, and installing opus:"
2430 [ -f opus-$OPUS_VERSION.tar.gz ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" https://downloads.xiph.org/releases/opus/opus-$OPUS_VERSION.tar.gz
2431 $no_build && echo "Skipping installation" && return
2432 gzcat opus-$OPUS_VERSION.tar.gz | tar xf -
2433 cd opus-$OPUS_VERSION
2434 CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" CXXFLAGS="$CXXFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" \
2435 ./configure "${CONFIGURE_OPTS[@]}"
2436 make "${MAKE_BUILD_OPTS[@]}"
2437 $DO_MAKE_INSTALL
2438 cd ..
2439 touch opus-$OPUS_VERSION-done
2443 uninstall_opus() {
2444 if [ -n "$installed_opus_version" ] ; then
2445 echo "Uninstalling opus:"
2446 cd opus-$installed_opus_version
2447 $DO_MAKE_UNINSTALL
2448 make distclean
2449 cd ..
2450 rm opus-$installed_opus_version-done
2452 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
2454 # Get rid of the previously downloaded and unpacked version.
2456 rm -rf opus-$installed_opus_version
2457 rm -rf opus-$installed_opus_version.tar.gz
2460 installed_opus_version=""
2464 install_jsoncpp() {
2465 if [ "$JSONCPP_VERSION" ] && [ ! -f "jsoncpp-$JSONCPP_VERSION-done" ] ; then
2466 echo "Downloading, building, and installing JsonCpp:"
2467 [ -f "jsoncpp-$JSONCPP_VERSION.tar.gz" ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" --remote-header-name "https://github.com/open-source-parsers/jsoncpp/archive/refs/tags/$JSONCPP_VERSION.tar.gz"
2468 $no_build && echo "Skipping installation" && return
2469 tar -xf "jsoncpp-$JSONCPP_VERSION.tar.gz"
2470 cd "jsoncpp-$JSONCPP_VERSION"
2471 mkdir build_dir
2472 cd build_dir
2473 "${DO_CMAKE[@]}" -DBUILD_OBJECT_LIBS=OFF -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=OFF -DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF ..
2474 make "${MAKE_BUILD_OPTS[@]}"
2475 $DO_MAKE_INSTALL
2476 cd ../..
2477 touch "jsoncpp-$JSONCPP_VERSION-done"
2481 uninstall_jsoncpp() {
2482 if [ "$installed_jsoncpp_version" ] && [ -s "jsoncpp-$installed_jsoncpp_version/build_dir/install_manifest.txt" ] ; then
2483 echo "Uninstalling JsonCpp:"
2484 while read -r ; do $DO_RM -v "$REPLY" ; done < <(cat "jsoncpp-$installed_jsoncpp_version/build_dir/install_manifest.txt"; echo)
2485 rm "jsoncpp-$JSONCPP_VERSION-done"
2487 if [ "$#" -eq 1 ] && [ "$1" = "-r" ] ; then
2489 # Get rid of the previously downloaded and unpacked version.
2491 rm -rf "jsoncpp-$installed_jsoncpp_version"
2492 rm -rf "jsoncpp-$installed_jsoncpp_version.tar.gz"
2495 installed_jsoncpp_version=""
2499 install_onetbb() {
2500 if [ "$ONETBB_VERSION" ] && [ ! -f "onetbb-$ONETBB_VERSION-done" ] ; then
2501 echo "Downloading, building, and installing oneTBB:"
2502 [ -f "oneTBB-$ONETBB_VERSION.tar.gz" ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" --remote-header-name "https://github.com/oneapi-src/oneTBB/archive/refs/tags/v$ONETBB_VERSION.tar.gz"
2503 $no_build && echo "Skipping installation" && return
2504 tar -xf "oneTBB-$ONETBB_VERSION.tar.gz"
2505 cd "oneTBB-$ONETBB_VERSION"
2506 mkdir build_dir
2507 cd build_dir
2508 "${DO_CMAKE[@]}" -DBUILD_SHARED_LIBS=ON -DTBB_TEST=OFF ..
2509 make "${MAKE_BUILD_OPTS[@]}" tbb
2510 $DO_MAKE_INSTALL
2511 cd ../..
2512 touch "onetbb-$ONETBB_VERSION-done"
2516 uninstall_onetbb() {
2517 if [ "$installed_onetbb_version" ] && [ -s "oneTBB-$installed_onetbb_version/build_dir/install_manifest.txt" ] ; then
2518 echo "Uninstalling oneTBB:"
2519 while read -r ; do $DO_RM -v "$REPLY" ; done < <(cat "oneTBB-$installed_onetbb_version/build_dir/install_manifest.txt"; echo)
2520 rm "onetbb-$installed_onetbb_version-done"
2522 if [ "$#" -eq 1 ] && [ "$1" = "-r" ] ; then
2524 # Get rid of the previously downloaded and unpacked version.
2526 rm -rf "oneTBB-$installed_onetbb_version"
2527 rm -rf "oneTBB-$installed_onetbb_version.tar.gz"
2530 installed_onetbb_version=""
2534 install_re2() {
2535 if [ "$RE2_VERSION" ] && [ ! -f "re2-$RE2_VERSION-done" ] ; then
2536 echo "Downloading, building, and installing RE2:"
2537 [ -f "re2-$RE2_VERSION.tar.gz" ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" --remote-header-name "https://github.com/google/re2/archive/refs/tags/$RE2_VERSION.tar.gz"
2538 $no_build && echo "Skipping installation" && return
2539 tar -xf "re2-$RE2_VERSION.tar.gz"
2540 cd "re2-$RE2_VERSION"
2541 mkdir build_dir
2542 cd build_dir
2543 "${DO_CMAKE[@]}" -DBUILD_SHARED_LIBS=ON -DRE2_BUILD_TESTING=OFF ..
2544 make "${MAKE_BUILD_OPTS[@]}"
2545 $DO_MAKE_INSTALL
2546 cd ../..
2547 touch "re2-$RE2_VERSION-done"
2551 uninstall_re2() {
2552 if [ -n "$installed_re2_version" ] && [ -s "re2-$installed_re2_version/build_dir/install_manifest.txt" ] ; then
2553 echo "Uninstalling RE2:"
2554 while read -r ; do $DO_RM -v "$REPLY" ; done < <(cat "re2-$installed_re2_version/build_dir/install_manifest.txt"; echo)
2555 rm "re2-$installed_re2_version-done"
2557 if [ "$#" -eq 1 ] && [ "$1" = "-r" ] ; then
2559 # Get rid of the previously downloaded and unpacked version.
2561 rm -rf "re2-$installed_re2_version"
2562 rm -rf "re2-$installed_re2_version.tar.gz"
2565 installed_re2_version=""
2569 install_falco_libs() {
2570 if [ "$FALCO_LIBS_VERSION" ] && [ ! -f "falco-libs-$FALCO_LIBS_VERSION-done" ] ; then
2571 echo "Downloading, building, and installing libsinsp and libscap:"
2572 [ -f "falco-libs-$FALCO_LIBS_VERSION.tar.gz" ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" --remote-header-name "https://github.com/falcosecurity/libs/archive/refs/tags/$FALCO_LIBS_VERSION.tar.gz"
2573 [ -f "falco-libs-$FALCO_LIBS_VERSION.tar.gz" ] || mv "libs-$FALCO_LIBS_VERSION.tar.gz" "falco-libs-$FALCO_LIBS_VERSION.tar.gz"
2574 $no_build && echo "Skipping installation" && return
2575 echo "$FALCO_LIBS_SHA256 falco-libs-$FALCO_LIBS_VERSION.tar.gz" | shasum --algorithm 256 --check
2576 tar -xf "falco-libs-$FALCO_LIBS_VERSION.tar.gz"
2577 mv "libs-$FALCO_LIBS_VERSION" "falco-libs-$FALCO_LIBS_VERSION"
2578 cd "falco-libs-$FALCO_LIBS_VERSION"
2579 patch -p1 < "${topdir}/tools/macos-setup-patches/falco-uthash_h-install.patch"
2580 patch -p1 < "${topdir}/tools/macos-setup-patches/falco-include-dirs.patch"
2581 mkdir build_dir
2582 cd build_dir
2583 "${DO_CMAKE[@]}" -DFALCOSECURITY_LIBS_VERSION="$FALCO_LIBS_VERSION" \
2584 -DBUILD_SHARED_LIBS=ON -DMINIMAL_BUILD=ON -DCREATE_TEST_TARGETS=OFF \
2585 -DUSE_BUNDLED_DEPS=ON -DUSE_BUNDLED_CARES=OFF -DUSE_BUNDLED_ZLIB=OFF \
2586 -DUSE_BUNDLED_JSONCPP=OFF -DUSE_BUNDLED_TBB=OFF -DUSE_BUNDLED_RE2=OFF \
2588 make "${MAKE_BUILD_OPTS[@]}"
2589 $DO_MAKE_INSTALL
2590 cd ../..
2591 touch "falco-libs-$FALCO_LIBS_VERSION-done"
2595 uninstall_falco_libs() {
2596 if [ -n "$installed_falco_libs_version" ] && [ -s "falco-libs-$installed_falco_libs_version/build_dir/install_manifest.txt" ] ; then
2597 echo "Uninstalling Falco libs:"
2598 $DO_RM "$installation_prefix"/include/falcosecurity/uthash.h
2599 while read -r ; do $DO_RM -v "$REPLY" ; done < <(cat "falco-libs-$installed_falco_libs_version/build_dir/install_manifest.txt"; echo)
2600 rm "falco-libs-$installed_falco_libs_version-done"
2602 if [ "$#" -eq 1 ] && [ "$1" = "-r" ] ; then
2604 # Get rid of the previously downloaded and unpacked version.
2606 rm -rf "falco-libs-$installed_falco_libs_version"
2607 rm -rf "falco-libs-$installed_falco_libs_version.tar.gz"
2610 installed_falco_libs_version=""
2614 install_python3() {
2615 # The macos11 universal2 installer can be deployed to older versions,
2616 # down to 10.9 (Mavericks). The 10.9 installer was deprecated in 3.9.8
2617 # and stopped being released after 3.9.13
2618 local macver=11
2619 if [ "$PYTHON3_VERSION" -a ! -f python3-$PYTHON3_VERSION-done ] ; then
2620 echo "Downloading and installing python3:"
2621 [ -f python-$PYTHON3_VERSION-macos$macver.pkg ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" https://www.python.org/ftp/python/$PYTHON3_VERSION/python-$PYTHON3_VERSION-macos$macver.pkg
2622 $no_build && echo "Skipping installation" && return
2623 sudo installer -target / -pkg python-$PYTHON3_VERSION-macos$macver.pkg
2624 touch python3-$PYTHON3_VERSION-done
2627 # On macOS, the pip3 installed from Python packages appears to
2628 # install scripts /Library/Frameworks/Python.framework/Versions/M.N/bin,
2629 # where M.N is the major and minor version of Python (the dot-dot
2630 # release is irrelevant).
2632 # Strip off any dot-dot component in $PYTHON3_VERSION.
2634 python_version=$( echo "$PYTHON3_VERSION" | sed 's/\([1-9][0-9]*\.[1-9][0-9]*\).*/\1/' )
2636 # Now treat Meson as being in the directory in question.
2638 MESON="/Library/Frameworks/Python.framework/Versions/$python_version/bin/meson"
2639 else
2641 # We're using the Python 3 that's in /usr/bin, the pip3 for
2642 # which installs scripts in /usr/local/bin, so, when we
2643 # install Meson, look for it there.
2645 MESON=/usr/local/bin/meson
2649 uninstall_python3() {
2650 # Major version (e.g. "3.7")
2651 local PYTHON_VERSION=${installed_python3_version%.*}
2652 if [ -n "$installed_python3_version" ] ; then
2653 echo "Uninstalling python3:"
2654 frameworkdir="/Library/Frameworks/Python.framework/Versions/$PYTHON_VERSION"
2655 sudo rm -rf "$frameworkdir"
2656 sudo rm -rf "/Applications/Python $PYTHON_VERSION"
2657 sudo find "$installation_prefix"/bin -maxdepth 1 -lname "*$frameworkdir/bin/*" -delete
2658 # Remove three symlinks and empty directories. Removing directories
2659 # might fail if for some reason multiple versions are installed.
2660 sudo rm /Library/Frameworks/Python.framework/Headers
2661 sudo rm /Library/Frameworks/Python.framework/Python
2662 sudo rm /Library/Frameworks/Python.framework/Resources
2663 sudo rmdir /Library/Frameworks/Python.framework/Versions
2664 sudo rmdir /Library/Frameworks/Python.framework
2665 sudo pkgutil --forget org.python.Python.PythonApplications-$PYTHON_VERSION
2666 sudo pkgutil --forget org.python.Python.PythonDocumentation-$PYTHON_VERSION
2667 sudo pkgutil --forget org.python.Python.PythonFramework-$PYTHON_VERSION
2668 sudo pkgutil --forget org.python.Python.PythonUnixTools-$PYTHON_VERSION
2669 rm python3-$installed_python3_version-done
2671 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
2673 # Get rid of the previously downloaded and unpacked version.
2675 rm -f python-$installed_python3_version-macos11.pkg
2676 rm -f python-$installed_python3_version-macos11.0.pkg
2677 rm -f python-$installed_python3_version-macosx10.9.pkg
2678 rm -f python-$installed_python3_version-macosx10.6.pkg
2681 installed_python3_version=""
2685 install_brotli() {
2686 if [ "$BROTLI_VERSION" -a ! -f brotli-$BROTLI_VERSION-done ] ; then
2687 echo "Downloading, building, and installing brotli:"
2688 [ -f brotli-$BROTLI_VERSION.tar.gz ] || curl "${CURL_LOCAL_NAME_OPTS[@]}" brotli-$BROTLI_VERSION.tar.gz https://github.com/google/brotli/archive/v$BROTLI_VERSION.tar.gz
2689 $no_build && echo "Skipping installation" && return
2690 gzcat brotli-$BROTLI_VERSION.tar.gz | tar xf -
2691 cd brotli-$BROTLI_VERSION
2692 mkdir build_dir
2693 cd build_dir
2694 "${DO_CMAKE[@]}" ..
2695 make "${MAKE_BUILD_OPTS[@]}"
2696 $DO_MAKE_INSTALL
2697 cd ../..
2698 touch brotli-$BROTLI_VERSION-done
2702 uninstall_brotli() {
2703 if [ -n "$installed_brotli_version" ] ; then
2704 echo "Uninstalling brotli:"
2705 cd brotli-$installed_brotli_version
2707 # brotli uses cmake on macOS and doesn't support "make uninstall";
2708 # just remove what we know it installs.
2710 # $DO_MAKE_UNINSTALL
2711 $DO_RM -rf "$installation_prefix"/bin/brotli \
2712 "$installation_prefix"/lib/libbrotli* \
2713 "$installation_prefix"/include/brotli \
2714 "$installation_prefix"/lib/pkgconfig/libbrotli*
2716 # brotli uses cmake on macOS and doesn't support "make distclean";
2717 # just remove the enire build directory.
2719 # make distclean
2720 rm -rf build_dir
2721 cd ..
2722 rm brotli-$installed_brotli_version-done
2724 if [ "$#" -eq 1 -a "$1" = "-r" ] ; then
2726 # Get rid of the previously downloaded and unpacked version.
2728 rm -rf brotli-$installed_brotli_version
2729 rm -rf brotli-$installed_brotli_version.tar.gz
2732 installed_brotli_version=""
2736 install_minizip() {
2737 if [ "$ZLIB_VERSION" ] && [ ! -f minizip-$ZLIB_VERSION-done ] ; then
2738 echo "Downloading, building, and installing zlib for minizip:"
2739 [ -f zlib-$ZLIB_VERSION.tar.gz ] || curl "${CURL_LOCAL_NAME_OPTS[@]}" zlib-$ZLIB_VERSION.tar.gz https://zlib.net/fossils/zlib-$ZLIB_VERSION.tar.gz
2740 $no_build && echo "Skipping installation" && return
2741 gzcat zlib-$ZLIB_VERSION.tar.gz | tar xf -
2743 # minizip ships both with a minimal Makefile that doesn't
2744 # support "make install", "make uninstall", or "make distclean",
2745 # and with a Makefile.am file that, if we do an autoreconf,
2746 # gives us a configure script, and a Makefile.in that, if we run
2747 # the configure script, gives us a Makefile that supports all of
2748 # those targets, and that installs a pkg-config .pc file for
2749 # minizip.
2751 # So that's what we do.
2753 cd zlib-$ZLIB_VERSION/contrib/minizip
2754 LIBTOOLIZE=glibtoolize autoreconf --force --install
2755 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" \
2756 ./configure "${CONFIGURE_OPTS[@]}"
2757 make "${MAKE_BUILD_OPTS[@]}"
2758 $DO_MAKE_INSTALL
2759 cd ../../..
2760 touch minizip-$ZLIB_VERSION-done
2764 uninstall_minizip() {
2765 if [ -n "$installed_minizip_version" ] ; then
2766 echo "Uninstalling minizip:"
2767 cd zlib-$installed_minizip_version/contrib/minizip
2768 $DO_MAKE_UNINSTALL
2769 make distclean
2770 cd ../../..
2772 rm minizip-$installed_minizip_version-done
2774 if [ "$#" -eq 1 ] && [ "$1" = "-r" ] ; then
2776 # Get rid of the previously downloaded and unpacked version.
2778 rm -rf zlib-$installed_minizip_version
2779 rm -rf zlib-$installed_minizip_version.tar.gz
2782 installed_minizip_version=""
2786 install_minizip_ng() {
2787 if [ "$MINIZIPNG_VERSION" ] && [ ! -f minizip-ng-$MINIZIPNG_VERSION-done ] ; then
2788 echo "Downloading, building, and installing minizip-ng:"
2789 [ -f $MINIZIPNG_VERSION.tar.gz ] || curl "${CURL_REMOTE_NAME_OPTS[@]}" https://github.com/zlib-ng/minizip-ng/archive/refs/tags/$MINIZIPNG_VERSION.tar.gz
2790 $no_build && echo "Skipping installation" && return
2791 gzcat $MINIZIPNG_VERSION.tar.gz | tar xf -
2792 cd minizip-ng-$MINIZIPNG_VERSION
2793 mkdir build
2794 cd build
2795 "${DO_CMAKE[@]}" ..
2796 make "${MAKE_BUILD_OPTS[@]}"
2797 $DO_MAKE_INSTALL
2798 cd ../..
2799 touch minizip-ng-$MINIZIPNG_VERSION-done
2803 uninstall_minizip_ng() {
2804 if [ -n "$installed_minizip_ng_version" ] ; then
2805 echo "Uninstalling minizip-ng:"
2806 cd minizip-ng-$installed_minizip_ng_version/contrib/minizip
2807 $DO_MAKE_UNINSTALL
2808 make distclean
2809 cd ../../..
2811 rm minizip-ng-$installed_minizip_ng_version-done
2813 if [ "$#" -eq 1 ] && [ "$1" = "-r" ] ; then
2815 # Get rid of the previously downloaded and unpacked version.
2817 rm -rf minizip-ng-$installed_minizip_ng_version
2818 rm -rf minizip-ng-$installed_minizip_ng_version.tar.gz
2821 installed_minizip_ng_version=""
2824 install_sparkle() {
2825 if [ "$SPARKLE_VERSION" ] && [ ! -f sparkle-$SPARKLE_VERSION-done ] ; then
2826 echo "Downloading and installing Sparkle:"
2828 # Download the tarball and unpack it in $installation_prefix/Sparkle-x.y.z
2830 [ -f Sparkle-$SPARKLE_VERSION.tar.xz ] || curl "${CURL_LOCAL_NAME_OPTS[@]}" Sparkle-$SPARKLE_VERSION.tar.xz https://github.com/sparkle-project/Sparkle/releases/download/$SPARKLE_VERSION/Sparkle-$SPARKLE_VERSION.tar.xz
2831 $no_build && echo "Skipping installation" && return
2832 test -d "$installation_prefix/Sparkle-$SPARKLE_VERSION" || sudo mkdir "$installation_prefix/Sparkle-$SPARKLE_VERSION"
2833 sudo tar -C "$installation_prefix/Sparkle-$SPARKLE_VERSION" -xpof Sparkle-$SPARKLE_VERSION.tar.xz
2834 touch sparkle-$SPARKLE_VERSION-done
2838 uninstall_sparkle() {
2839 if [ -n "$installed_sparkle_version" ]; then
2840 echo "Uninstalling Sparkle:"
2841 sudo rm -rf "$installation_prefix/Sparkle-$installed_sparkle_version"
2843 rm sparkle-$installed_sparkle_version-done
2845 if [ "$#" -eq 1 ] && [ "$1" = "-r" ] ; then
2846 rm -f "Sparkle-$installed_sparkle_version.tar.xz"
2849 installed_sparkle_version=""
2853 install_all() {
2855 # Check whether the versions we have installed are the versions
2856 # requested; if not, uninstall the installed versions.
2858 if [ -n "$installed_brotli_version" -a \
2859 "$installed_brotli_version" != "$BROTLI_VERSION" ] ; then
2860 echo "Installed brotli version is $installed_brotli_version"
2861 if [ -z "$BROTLI_VERSION" ] ; then
2862 echo "brotli is not requested"
2863 else
2864 echo "Requested brotli version is $BROTLI_VERSION"
2866 uninstall_brotli -r
2869 if [ -n "$installed_python3_version" -a \
2870 "$installed_python3_version" != "$PYTHON3_VERSION" ] ; then
2871 echo "Installed python3 version is $installed_python3_version"
2872 if [ -z "$PYTHON3_VERSION" ] ; then
2873 echo "python3 is not requested"
2874 else
2875 echo "Requested python3 version is $PYTHON3_VERSION"
2877 uninstall_python3 -r
2880 if [ -n "$installed_bcg729_version" -a \
2881 "$installed_bcg729_version" != "$BCG729_VERSION" ] ; then
2882 echo "Installed bcg729 version is $installed_bcg729_version"
2883 if [ -z "$BCG729_VERSION" ] ; then
2884 echo "bcg729 is not requested"
2885 else
2886 echo "Requested bcg729 version is $BCG729_VERSION"
2888 uninstall_bcg729 -r
2891 if [ -n "$installed_ilbc_version" ] \
2892 && [ "$installed_ilbc_version" != "$ILBC_VERSION" ] ; then
2893 echo "Installed iLBC version is $installed_ilbc_version"
2894 if [ -z "$ILBC_VERSION" ] ; then
2895 echo "iLBC is not requested"
2896 else
2897 echo "Requested iLBC version is $ILBC_VERSION"
2899 uninstall_ilbc -r
2902 if [ -n "$installed_opencore_amr_version" ] \
2903 && [ "$installed_opencore_amr_version" != "$OPENCORE_AMR_VERSION" ] ; then
2904 echo "Installed opencore-amr version is $installed_opencore_amr_version"
2905 if [ -z "$OPENCORE_AMR_VERSION" ] ; then
2906 echo "opencore-amr is not requested"
2907 else
2908 echo "Requested opencore-amr version is $OPENCORE_AMR_VERSION"
2910 uninstall_opencore_amr -r
2913 if [ -n "$installed_opus_version" ] \
2914 && [ "$installed_opus_version" != "$OPUS_VERSION" ] ; then
2915 echo "Installed opus version is $installed_opus_version"
2916 if [ -z "$OPUS_VERSION" ] ; then
2917 echo "opus is not requested"
2918 else
2919 echo "Requested opus version is $OPUS_VERSION"
2921 uninstall_opus -r
2924 if [ -n "$installed_spandsp_version" -a \
2925 "$installed_spandsp_version" != "$SPANDSP_VERSION" ] ; then
2926 echo "Installed SpanDSP version is $installed_spandsp_version"
2927 if [ -z "$SPANDSP_VERSION" ] ; then
2928 echo "spandsp is not requested"
2929 else
2930 echo "Requested SpanDSP version is $SPANDSP_VERSION"
2932 uninstall_spandsp -r
2935 if [ -n "$installed_speexdsp_version" -a \
2936 "$installed_speexdsp_version" != "$SPEEXDSP_VERSION" ] ; then
2937 echo "Installed SpeexDSP version is $installed_speexdsp_version"
2938 if [ -z "$SPEEXDSP_VERSION" ] ; then
2939 echo "speexdsp is not requested"
2940 else
2941 echo "Requested SpeexDSP version is $SPEEXDSP_VERSION"
2943 uninstall_speexdsp -r
2946 if [ -n "$installed_libtiff_version" -a \
2947 "$installed_libtiff_version" != "$LIBTIFF_VERSION" ] ; then
2948 echo "Installed libtiff version is $installed_libtiff_version"
2949 if [ -z "$LIBTIFF_VERSION" ] ; then
2950 echo "libtiff is not requested"
2951 else
2952 echo "Requested libtiff version is $LIBTIFF_VERSION"
2954 uninstall_libtiff -r
2957 if [ -n "$installed_nghttp2_version" -a \
2958 "$installed_nghttp2_version" != "$NGHTTP2_VERSION" ] ; then
2959 echo "Installed nghttp2 version is $installed_nghttp2_version"
2960 if [ -z "$NGHTTP2_VERSION" ] ; then
2961 echo "nghttp2 is not requested"
2962 else
2963 echo "Requested nghttp2 version is $NGHTTP2_VERSION"
2965 uninstall_nghttp2 -r
2968 if [ -n "$installed_nghttp3_version" -a \
2969 "$installed_nghttp3_version" != "$NGHTTP3_VERSION" ] ; then
2970 echo "Installed nghttp3 version is $installed_nghttp3_version"
2971 if [ -z "$NGHTTP3_VERSION" ] ; then
2972 echo "nghttp3 is not requested"
2973 else
2974 echo "Requested nghttp3 version is $NGHTTP3_VERSION"
2976 uninstall_nghttp3 -r
2979 if [ -n "$installed_libssh_version" -a \
2980 "$installed_libssh_version" != "$LIBSSH_VERSION" ] ; then
2981 echo "Installed libssh version is $installed_libssh_version"
2982 if [ -z "$LIBSSH_VERSION" ] ; then
2983 echo "libssh is not requested"
2984 else
2985 echo "Requested libssh version is $LIBSSH_VERSION"
2987 uninstall_libssh -r
2990 if [ -n "$installed_cares_version" -a \
2991 "$installed_cares_version" != "$CARES_VERSION" ] ; then
2992 echo "Installed C-Ares version is $installed_cares_version"
2993 if [ -z "$CARES_VERSION" ] ; then
2994 echo "C-Ares is not requested"
2995 else
2996 echo "Requested C-Ares version is $CARES_VERSION"
2998 uninstall_c_ares -r
3001 if [ -n "$installed_maxminddb_version" -a \
3002 "$installed_maxminddb_version" != "$MAXMINDDB_VERSION" ] ; then
3003 echo "Installed MaxMindDB API version is $installed_maxminddb_version"
3004 if [ -z "$MAXMINDDB_VERSION" ] ; then
3005 echo "MaxMindDB is not requested"
3006 else
3007 echo "Requested MaxMindDB version is $MAXMINDDB_VERSION"
3009 uninstall_maxminddb -r
3012 if [ -n "$installed_sbc_version" -a \
3013 "$installed_sbc_version" != "$SBC_VERSION" ] ; then
3014 echo "Installed SBC version is $installed_sbc_version"
3015 if [ -z "$SBC_VERSION" ] ; then
3016 echo "SBC is not requested"
3017 else
3018 echo "Requested SBC version is $SBC_VERSION"
3020 uninstall_sbc -r
3023 if [ -n "$installed_lz4_version" -a \
3024 "$installed_lz4_version" != "$LZ4_VERSION" ] ; then
3025 echo "Installed LZ4 version is $installed_lz4_version"
3026 if [ -z "$LZ4_VERSION" ] ; then
3027 echo "LZ4 is not requested"
3028 else
3029 echo "Requested LZ4 version is $LZ4_VERSION"
3031 uninstall_lz4 -r
3034 if [ -n "$installed_libxml2_version" ] && [ "$installed_libxml2_version" != "$LIBXML2_VERSION" ] ; then
3035 echo "Installed libxml2 version is $installed_libxml2_version"
3036 if [ -z "$LIBXML2_VERSION" ] ; then
3037 echo "libxml2 is not requested"
3038 else
3039 echo "Requested libxml2 version is $LIBXML2_VERSION"
3041 uninstall_libxml2 -r
3044 if [ -n "$installed_snappy_version" -a \
3045 "$installed_snappy_version" != "$SNAPPY_VERSION" ] ; then
3046 echo "Installed SNAPPY version is $installed_snappy_version"
3047 if [ -z "$SNAPPY_VERSION" ] ; then
3048 echo "SNAPPY is not requested"
3049 else
3050 echo "Requested SNAPPY version is $SNAPPY_VERSION"
3052 uninstall_snappy -r
3055 if [ -n "$installed_zstd_version" ] && [ "$installed_zstd_version" != "$ZSTD_VERSION" ] ; then
3056 echo "Installed zstd version is $installed_zstd_version"
3057 if [ -z "$ZSTD_VERSION" ] ; then
3058 echo "zstd is not requested"
3059 else
3060 echo "Requested zstd version is $ZSTD_VERSION"
3062 uninstall_zstd -r
3065 if [ -n "$installed_zlibng_version" ] && [ "$installed_zlibng_version" != "$ZLIBNG_VERSION" ] ; then
3066 echo "Installed zlibng version is $installed_zlibng_version"
3067 if [ -z "$ZLIBNG_VERSION" ] ; then
3068 echo "zlibng is not requested"
3069 else
3070 echo "Requested zlibng version is $ZLIBNG_VERSION"
3072 uninstall_zlibng -r
3075 if [ -n "$installed_lua_version" -a \
3076 "$installed_lua_version" != "$LUA_VERSION" ] ; then
3077 echo "Installed Lua version is $installed_lua_version"
3078 if [ -z "$LUA_VERSION" ] ; then
3079 echo "Lua is not requested"
3080 else
3081 echo "Requested Lua version is $LUA_VERSION"
3083 uninstall_lua -r
3086 if [ -n "$installed_gnutls_version" ] && [ "$installed_gnutls_version" != "$GNUTLS_VERSION" ] ; then
3087 echo "Installed GnuTLS version is $installed_gnutls_version"
3088 if [ -z "$GNUTLS_VERSION" ] ; then
3089 echo "GnuTLS is not requested"
3090 else
3091 echo "Requested GnuTLS version is $GNUTLS_VERSION"
3093 uninstall_gnutls -r
3096 if [ -n "$installed_nettle_version" -a \
3097 "$installed_nettle_version" != "$NETTLE_VERSION" ] ; then
3098 echo "Installed Nettle version is $installed_nettle_version"
3099 if [ -z "$NETTLE_VERSION" ] ; then
3100 echo "Nettle is not requested"
3101 else
3102 echo "Requested Nettle version is $NETTLE_VERSION"
3104 uninstall_nettle -r
3107 if [ -n "$installed_gmp_version" -a \
3108 "$installed_gmp_version" != "$GMP_VERSION" ] ; then
3109 echo "Installed GMP version is $installed_gmp_version"
3110 if [ -z "$GMP_VERSION" ] ; then
3111 echo "GMP is not requested"
3112 else
3113 echo "Requested GMP version is $GMP_VERSION"
3115 uninstall_gmp -r
3118 if [ -n "$installed_p11_kit_version" -a \
3119 "$installed_p11_kit_version" != "$P11KIT_VERSION" ] ; then
3120 echo "Installed p11-kit version is $installed_p11_kit_version"
3121 if [ -z "$P11KIT_VERSION" ] ; then
3122 echo "p11-kit is not requested"
3123 else
3124 echo "Requested p11-kit version is $P11KIT_VERSION"
3126 uninstall_p11_kit -r
3129 if [ -n "$installed_libtasn1_version" -a \
3130 "$installed_libtasn1_version" != "$LIBTASN1_VERSION" ] ; then
3131 echo "Installed libtasn1 version is $installed_libtasn1_version"
3132 if [ -z "$LIBTASN1_VERSION" ] ; then
3133 echo "libtasn1 is not requested"
3134 else
3135 echo "Requested libtasn1 version is $LIBTASN1_VERSION"
3137 uninstall_libtasn1 -r
3140 if [ -n "$installed_libgcrypt_version" -a \
3141 "$installed_libgcrypt_version" != "$LIBGCRYPT_VERSION" ] ; then
3142 echo "Installed libgcrypt version is $installed_libgcrypt_version"
3143 if [ -z "$LIBGCRYPT_VERSION" ] ; then
3144 echo "libgcrypt is not requested"
3145 else
3146 echo "Requested libgcrypt version is $LIBGCRYPT_VERSION"
3148 uninstall_libgcrypt -r
3151 if [ -n "$installed_libgpg_error_version" -a \
3152 "$installed_libgpg_error_version" != "$LIBGPG_ERROR_VERSION" ] ; then
3153 echo "Installed libgpg-error version is $installed_libgpg_error_version"
3154 if [ -z "$LIBGPG_ERROR_VERSION" ] ; then
3155 echo "libgpg-error is not requested"
3156 else
3157 echo "Requested libgpg-error version is $LIBGPG_ERROR_VERSION"
3159 uninstall_libgpg_error -r
3162 if [ -n "$installed_libsmi_version" -a \
3163 "$installed_libsmi_version" != "$LIBSMI_VERSION" ] ; then
3164 echo "Installed libsmi version is $installed_libsmi_version"
3165 if [ -z "$LIBSMI_VERSION" ] ; then
3166 echo "libsmi is not requested"
3167 else
3168 echo "Requested libsmi version is $LIBSMI_VERSION"
3170 uninstall_libsmi -r
3173 if [ -n "$installed_qt_version" -a \
3174 "$installed_qt_version" != "$QT_VERSION" ] ; then
3175 echo "Installed Qt version is $installed_qt_version"
3176 if [ -z "$QT_VERSION" ] ; then
3177 echo "Qt is not requested"
3178 else
3179 echo "Requested Qt version is $QT_VERSION"
3181 uninstall_qt -r
3184 if [ -n "$installed_glib_version" -a \
3185 "$installed_glib_version" != "$GLIB_VERSION" ] ; then
3186 echo "Installed GLib version is $installed_glib_version"
3187 if [ -z "$GLIB_VERSION" ] ; then
3188 echo "GLib is not requested"
3189 else
3190 echo "Requested GLib version is $GLIB_VERSION"
3192 uninstall_glib -r
3195 if [ -n "$installed_pkg_config_version" -a \
3196 "$installed_pkg_config_version" != "$PKG_CONFIG_VERSION" ] ; then
3197 echo "Installed pkg-config version is $installed_pkg_config_version"
3198 if [ -z "$PKG_CONFIG_VERSION" ] ; then
3199 echo "pkg-config is not requested"
3200 else
3201 echo "Requested pkg-config version is $PKG_CONFIG_VERSION"
3203 uninstall_pkg_config -r
3206 if [ -n "$installed_gettext_version" -a \
3207 "$installed_gettext_version" != "$GETTEXT_VERSION" ] ; then
3208 echo "Installed GNU gettext version is $installed_gettext_version"
3209 if [ -z "$GETTEXT_VERSION" ] ; then
3210 echo "GNU gettext is not requested"
3211 else
3212 echo "Requested GNU gettext version is $GETTEXT_VERSION"
3214 uninstall_gettext -r
3217 if [ -n "$installed_ninja_version" -a \
3218 "$installed_ninja_version" != "$NINJA_VERSION" ] ; then
3219 echo "Installed Ninja version is $installed_ninja_version"
3220 if [ -z "$NINJA_VERSION" ] ; then
3221 echo "Ninja is not requested"
3222 else
3223 echo "Requested Ninja version is $NINJA_VERSION"
3225 uninstall_ninja -r
3228 if [ -n "$installed_asciidoctorpdf_version" -a \
3229 "$installed_asciidoctorpdf_version" != "$ASCIIDOCTORPDF_VERSION" ] ; then
3230 echo "Installed Asciidoctor-pdf version is $installed_asciidoctorpdf_version"
3231 if [ -z "$ASCIIDOCTORPDF_VERSION" ] ; then
3232 echo "Asciidoctor-pdf is not requested"
3233 else
3234 echo "Requested Asciidoctor-pdf version is $ASCIIDOCTORPDF_VERSION"
3236 # XXX - really remove this?
3237 # Or should we remember it as installed only if this script
3238 # installed it?
3240 uninstall_asciidoctorpdf -r
3243 if [ -n "$installed_asciidoctor_version" -a \
3244 "$installed_asciidoctor_version" != "$ASCIIDOCTOR_VERSION" ] ; then
3245 echo "Installed Asciidoctor version is $installed_asciidoctor_version"
3246 if [ -z "$ASCIIDOCTOR_VERSION" ] ; then
3247 echo "Asciidoctor is not requested"
3248 else
3249 echo "Requested Asciidoctor version is $ASCIIDOCTOR_VERSION"
3251 # XXX - really remove this?
3252 # Or should we remember it as installed only if this script
3253 # installed it?
3255 uninstall_asciidoctor -r
3258 if [ -n "$installed_cmake_version" -a \
3259 "$installed_cmake_version" != "$CMAKE_VERSION" ] ; then
3260 echo "Installed CMake version is $installed_cmake_version"
3261 if [ -z "$CMAKE_VERSION" ] ; then
3262 echo "CMake is not requested"
3263 else
3264 echo "Requested CMake version is $CMAKE_VERSION"
3266 uninstall_cmake -r
3269 if [ -n "$installed_libtool_version" -a \
3270 "$installed_libtool_version" != "$LIBTOOL_VERSION" ] ; then
3271 echo "Installed GNU libtool version is $installed_libtool_version"
3272 if [ -z "$LIBTOOL_VERSION" ] ; then
3273 echo "GNU libtool is not requested"
3274 else
3275 echo "Requested GNU libtool version is $LIBTOOL_VERSION"
3277 uninstall_libtool -r
3280 if [ -n "$installed_automake_version" -a \
3281 "$installed_automake_version" != "$AUTOMAKE_VERSION" ] ; then
3282 echo "Installed GNU automake version is $installed_automake_version"
3283 if [ -z "$AUTOMAKE_VERSION" ] ; then
3284 echo "GNU automake is not requested"
3285 else
3286 echo "Requested GNU automake version is $AUTOMAKE_VERSION"
3288 uninstall_automake -r
3291 if [ -n "$installed_autoconf_version" -a \
3292 "$installed_autoconf_version" != "$AUTOCONF_VERSION" ] ; then
3293 echo "Installed GNU autoconf version is $installed_autoconf_version"
3294 if [ -z "$AUTOCONF_VERSION" ] ; then
3295 echo "GNU autoconf is not requested"
3296 else
3297 echo "Requested GNU autoconf version is $AUTOCONF_VERSION"
3299 uninstall_autoconf -r
3302 if [ -n "$installed_pcre_version" ] ; then
3303 echo "Installed pcre1 version is $installed_pcre_version"
3304 echo "(We no longer build with pcre1)"
3305 uninstall_pcre -r
3308 if [ -n "$installed_pcre2_version" -a \
3309 "$installed_pcre2_version" != "$PCRE2_VERSION" ] ; then
3310 echo "Installed pcre2 version is $installed_pcre2_version"
3311 if [ -z "$PCRE2_VERSION" ] ; then
3312 echo "pcre2 is not requested"
3313 else
3314 echo "Requested pcre2 version is $PCRE2_VERSION"
3316 uninstall_pcre2 -r
3319 if [ -n "$installed_lzip_version" ] ; then
3320 echo "Removing legacy install of lzip"
3321 uninstall_lzip -r
3324 if [ -n "$installed_xz_version" -a \
3325 "$installed_xz_version" != "$XZ_VERSION" ] ; then
3326 echo "Installed xz version is $installed_xz_version"
3327 if [ -z "$XZ_VERSION" ] ; then
3328 echo "xz is not requested"
3329 else
3330 echo "Requested xz version is $XZ_VERSION"
3332 uninstall_xz -r
3335 if [ -n "$installed_curl_version" -a \
3336 "$installed_curl_version" != "$CURL_VERSION" ] ; then
3337 echo "Installed curl version is $installed_curl_version"
3338 if [ -z "$CURL_VERSION" ] ; then
3339 echo "curl is not requested"
3340 else
3341 echo "Requested curl version is $CURL_VERSION"
3343 uninstall_curl -r
3346 if [ -n "$installed_minizip_version" -a \
3347 "$installed_minizip_version" != "$ZLIB_VERSION" ] ; then
3348 echo "Installed minizip (zlib) version is $installed_minizip_version"
3349 if [ -z "$ZLIB_VERSION" ] ; then
3350 echo "minizip is not requested"
3351 else
3352 echo "Requested minizip (zlib) version is $ZLIB_VERSION"
3354 uninstall_minizip -r
3357 if [ -n "$installed_minizip_ng_version" ] && [ "$installed_minizip_ng_version" != "$MINIZIPNG_VERSION" ] ; then
3358 echo "Installed minizip-ng version is $installed_minizip_ng_version"
3359 if [ -z "$MINIZIPNG_VERSION" ] ; then
3360 echo "minizip-ng is not requested"
3361 else
3362 echo "Requested minizip-ng version is $MINIZIPNG_VERSION"
3364 uninstall_minizip_ng -r
3367 if [ -n "$installed_sparkle_version" -a \
3368 "$installed_sparkle_version" != "$SPARKLE_VERSION" ] ; then
3369 echo "Installed Sparkle version is $installed_sparkle_version"
3370 if [ -z "$SPARKLE_VERSION" ] ; then
3371 echo "Sparkle is not requested"
3372 else
3373 echo "Requested Sparkle version is $SPARKLE_VERSION"
3375 uninstall_sparkle -r
3378 if [ "$installed_falco_libs_version" ] && [ "$installed_falco_libs_version" != "$FALCO_LIBS_VERSION" ] ; then
3379 echo "Installed Falco libs (libsinsp and libscap) version is $installed_falco_libs_version"
3380 if [ -z "$FALCO_LIBS_VERSION" ] ; then
3381 echo "Falco libs is not requested"
3382 else
3383 echo "Requested Falco libs version is $FALCO_LIBS_VERSION"
3385 uninstall_falco_libs -r
3388 if [ "$installed_jsoncpp_version" ] && [ "$installed_jsoncpp_version" != "$JSONCPP_VERSION" ] ; then
3389 echo "Installed JsonCpp version is $installed_jsoncpp_version"
3390 if [ -z "$JSONCPP_VERSION" ] ; then
3391 echo "JsonCpp is not requested"
3392 else
3393 echo "Requested JsonCpp version is $JSONCPP_VERSION"
3395 uninstall_jsoncpp -r
3398 if [ "$installed_onetbb_version" ] && [ "$installed_onetbb_version" != "$ONETBB_VERSION" ] ; then
3399 echo "Installed oneTBB version is $installed_onetbb_version"
3400 if [ -z "$ONETBB_VERSION" ] ; then
3401 echo "oneTBB is not requested"
3402 else
3403 echo "Requested oneTBB version is $ONETBB_VERSION"
3405 uninstall_onetbb -r
3408 if [ "$installed_re2_version" ] && [ "$installed_re2_version" != "$RE2_VERSION" ] ; then
3409 echo "Installed RE2 version is $installed_re2_version"
3410 if [ -z "$RE2_VERSION" ] ; then
3411 echo "RE2 is not requested"
3412 else
3413 echo "Requested RE2 version is $RE2_VERSION"
3415 uninstall_re2 -r
3419 # Start with curl: we may need it to download and install xz.
3421 install_curl
3424 # Now install xz: it is the sole download format of glib later than 2.31.2.
3426 install_xz
3428 install_autoconf
3430 install_automake
3432 install_libtool
3434 install_cmake
3436 install_pcre2
3439 # Install Python 3 now; not only is it needed for the Wireshark
3440 # build process, it's also needed for the Meson build system,
3441 # which newer versions of GLib use as their build system.
3443 install_python3
3446 # Now install Meson and pytest.
3448 install_meson
3450 install_pytest
3452 install_ninja
3454 install_asciidoctor
3456 install_asciidoctorpdf
3459 # Start with GNU gettext; GLib requires it, and macOS doesn't have it
3460 # or a BSD-licensed replacement.
3462 # At least on Lion with Xcode 4, _FORTIFY_SOURCE gets defined as 2
3463 # by default, which causes, for example, stpncpy to be defined as
3464 # a hairy macro that collides with the GNU gettext configure script's
3465 # attempts to workaround AIX's lack of a declaration for stpncpy,
3466 # with the result being a huge train wreck. Define _FORTIFY_SOURCE
3467 # as 0 in an attempt to keep the trains on separate tracks.
3469 install_gettext
3472 # GLib depends on pkg-config.
3473 # By default, pkg-config depends on GLib; we break the dependency cycle
3474 # by configuring pkg-config to use its own internal version of GLib.
3476 install_pkg_config
3478 install_glib
3481 # Now we have reached a point where we can build everything but
3482 # the GUI (Wireshark).
3484 install_qt
3487 # Now we have reached a point where we can build everything including
3488 # the GUI (Wireshark), but not with any optional features such as
3489 # SNMP OID resolution, some forms of decryption, Lua scripting, playback
3490 # of audio, or MaxMindDB mapping of IP addresses.
3492 # We now conditionally download optional libraries to support them;
3493 # the default is to download them all.
3496 install_libsmi
3498 install_libgpg_error
3500 install_libgcrypt
3502 install_gmp
3504 install_libtasn1
3506 install_p11_kit
3508 install_nettle
3510 install_gnutls
3512 install_lua
3514 install_snappy
3516 install_zstd
3518 install_zlibng
3520 install_libxml2
3522 install_lz4
3524 install_sbc
3526 install_maxminddb
3528 install_c_ares
3530 install_libssh
3532 install_nghttp2
3534 install_nghttp3
3536 install_libtiff
3538 install_spandsp
3540 install_speexdsp
3542 install_bcg729
3544 install_ilbc
3546 install_opencore_amr
3548 install_opus
3550 install_brotli
3552 install_minizip
3554 install_minizip_ng
3556 install_sparkle
3558 install_re2
3560 install_onetbb
3562 install_jsoncpp
3564 install_falco_libs
3567 uninstall_all() {
3568 if [ -d "${MACOSX_SUPPORT_LIBS}" ]
3569 then
3570 cd "${MACOSX_SUPPORT_LIBS}"
3573 # Uninstall items in the reverse order from the order in which they're
3574 # installed. Only uninstall if the download/build/install process
3575 # completed; uninstall the version that appears in the name of
3576 # the -done file.
3578 # We also do a "make distclean", so that we don't have leftovers from
3579 # old configurations.
3581 uninstall_falco_libs
3583 uninstall_jsoncpp
3585 uninstall_onetbb
3587 uninstall_re2
3589 uninstall_sparkle
3591 uninstall_minizip
3593 uninstall_minizip_ng
3595 uninstall_brotli
3597 uninstall_opus
3599 uninstall_opencore_amr
3601 uninstall_ilbc
3603 uninstall_bcg729
3605 uninstall_speexdsp
3607 uninstall_spandsp
3609 uninstall_libtiff
3611 uninstall_nghttp2
3613 uninstall_nghttp3
3615 uninstall_libssh
3617 uninstall_c_ares
3619 uninstall_maxminddb
3621 uninstall_snappy
3623 uninstall_zstd
3625 uninstall_zlibng
3627 uninstall_libxml2
3629 uninstall_lz4
3631 uninstall_sbc
3633 uninstall_lua
3635 uninstall_gnutls
3637 uninstall_nettle
3639 uninstall_p11_kit
3641 uninstall_libtasn1
3643 uninstall_gmp
3645 uninstall_libgcrypt
3647 uninstall_libgpg_error
3649 uninstall_libsmi
3651 uninstall_qt
3653 uninstall_glib
3655 uninstall_pkg_config
3657 uninstall_gettext
3659 uninstall_ninja
3662 # XXX - really remove this?
3663 # Or should we remember it as installed only if this script
3664 # installed it?
3666 uninstall_asciidoctorpdf
3668 uninstall_asciidoctor
3670 uninstall_pytest
3672 uninstall_meson
3674 uninstall_python3
3676 uninstall_cmake
3678 uninstall_libtool
3680 uninstall_automake
3682 uninstall_autoconf
3684 uninstall_pcre
3686 # Legacy, remove
3687 uninstall_lzip
3689 uninstall_xz
3691 uninstall_curl
3695 # This script is meant to be run in the source root. The following
3696 # code will attempt to get you there, but is not perfect (particularly
3697 # if someone copies the script).
3699 topdir="$( pwd )/$( dirname "$0" )/.."
3700 cd "$topdir"
3702 # Preference of the support libraries directory:
3703 # ${MACOSX_SUPPORT_LIBS}
3704 # ../macosx-support-libs
3705 # ./macosx-support-libs (default if none exists)
3706 if [ ! -d "${MACOSX_SUPPORT_LIBS}" ]; then
3707 unset MACOSX_SUPPORT_LIBS
3709 if [ -d ../macosx-support-libs ]; then
3710 MACOSX_SUPPORT_LIBS=${MACOSX_SUPPORT_LIBS-../macosx-support-libs}
3711 else
3712 MACOSX_SUPPORT_LIBS=${MACOSX_SUPPORT_LIBS-./macosx-support-libs}
3716 # If we have SDKs available, the default target OS is the major version
3717 # of the one we're running; get that and strip off the third component
3718 # if present.
3720 for i in /Developer/SDKs \
3721 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
3722 /Library/Developer/CommandLineTools/SDKs
3724 if [ -d "$i" ]
3725 then
3726 min_osx_target=$( sw_vers -productVersion | sed 's/\([0-9]*\)\.\([0-9]*\)\.[0-9]*/\1.\2/' )
3727 break
3729 done
3732 # Parse command-line flags:
3734 # -h - print help.
3735 # -t <target> - build libraries so that they'll work on the specified
3736 # version of macOS and later versions.
3737 # -u - do an uninstall.
3738 # -n - download all packages, but don't build or install.
3741 no_build=false
3743 installation_prefix=/usr/local
3745 while getopts hnp:t:u name
3747 case $name in
3748 h|\?)
3749 echo "Usage: macos-setup.sh [ -n ] [ -p <installation prefix> ] [ -t <target> ] [ -u ]" 1>&1
3750 exit 0
3753 no_build=true
3756 installation_prefix="$OPTARG"
3759 min_osx_target="$OPTARG"
3762 do_uninstall=yes
3764 esac
3765 done
3768 # Create our custom installation prefix if needed.
3770 if [ "$installation_prefix" != "/usr/local" ] ; then
3771 export PATH="$installation_prefix/bin:$PATH"
3772 if [ ! -d "$installation_prefix" ] ; then
3773 echo "Creating $installation_prefix"
3774 $DO_MKDIR "$installation_prefix"
3779 # Do we have permission to write in $installation_prefix?
3781 # If so, assume we have permission to write in its subdirectories.
3782 # (If that's not the case, this test needs to check the subdirectories
3783 # as well.)
3785 # If not, do "make install", "make uninstall", "ninja install",
3786 # "ninja uninstall", the removes for dependencies that don't support
3787 # "make uninstall" or "ninja uninstall", the renames of [g]libtool*,
3788 # and the writing of a libffi .pc file with sudo.
3790 if [ -w "$installation_prefix" ]
3791 then
3792 DO_MAKE="make"
3793 DO_MAKE_INSTALL="make install"
3794 DO_MAKE_UNINSTALL="make uninstall"
3795 DO_NINJA_INSTALL="ninja -C _build install"
3796 DO_NINJA_UNINSTALL="ninja -C _build uninstall"
3797 DO_TEE_TO_PC_FILE="tee"
3798 DO_RM="rm"
3799 DO_MV="mv"
3800 else
3801 DO_MAKE="sudo make"
3802 DO_MAKE_INSTALL="sudo make install"
3803 DO_MAKE_UNINSTALL="sudo make uninstall"
3804 DO_NINJA_INSTALL="sudo ninja -C _build install"
3805 DO_NINJA_UNINSTALL="sudo ninja -C _build uninstall"
3806 DO_TEE_TO_PC_FILE="sudo tee"
3807 DO_RM="sudo rm"
3808 DO_MV="sudo mv"
3812 # When building with CMake, don't build libraries with an install path
3813 # that begins with @rpath because that will cause binaries linked with it
3814 # to use that path as the library to look for, and that will cause the
3815 # run-time linker, at least on macOS 14 and later, not to find the library
3816 # in $installation_prefix/lib unless you explicitly set DYLD_LIBRARY_PATH to include
3817 # $installation_prefix/lib. That means that you get "didn't find libpcre" errors if
3818 # you try to run binaries from a build unless you set DYLD_LIBRARYPATH to
3819 # include $installation_prefix/lib.
3821 # However, setting CMAKE_MACOSX_RPATH to OFF causes the installed
3822 # library just to have the file name of the library as its install
3823 # name. It needs to be the full installed path of the library in
3824 # order to make running binaries from the build directory work, so
3825 # we set CMAKE_INSTALL_NAME_DIR to $installation_prefix/lib.
3827 # packaging/macosx/osx-app.sh will convert *all* libraries in
3828 # the app bundle to have an @rpath install name, so this won't
3829 # break anything there; it just fixes the ability to run from the
3830 # build directory.
3832 DO_CMAKE=( cmake
3833 -DCMAKE_OSX_DEPLOYMENT_TARGET="$min_osx_target"
3834 -DSDKROOT="$SDKPATH"
3835 -DCMAKE_MACOSX_RPATH=OFF
3836 -DCMAKE_INSTALL_PREFIX="$installation_prefix"
3837 -DCMAKE_INSTALL_NAME_DIR="$installation_prefix/lib"
3841 # Get the version numbers of installed packages, if any.
3843 if [ -d "${MACOSX_SUPPORT_LIBS}" ]
3844 then
3845 cd "${MACOSX_SUPPORT_LIBS}"
3847 installed_xz_version=$( ls xz-*-done 2>/dev/null | sed 's/xz-\(.*\)-done/\1/' )
3848 installed_lzip_version=$( ls lzip-*-done 2>/dev/null | sed 's/lzip-\(.*\)-done/\1/' )
3849 installed_pcre_version=$( ls pcre-*-done 2>/dev/null | sed 's/pcre-\(.*\)-done/\1/' )
3850 installed_pcre2_version=$( ls pcre2-*-done 2>/dev/null | sed 's/pcre2-\(.*\)-done/\1/' )
3851 installed_autoconf_version=$( ls autoconf-*-done 2>/dev/null | sed 's/autoconf-\(.*\)-done/\1/' )
3852 installed_automake_version=$( ls automake-*-done 2>/dev/null | sed 's/automake-\(.*\)-done/\1/' )
3853 installed_libtool_version=$( ls libtool-*-done 2>/dev/null | sed 's/libtool-\(.*\)-done/\1/' )
3854 installed_cmake_version=$( ls cmake-*-done 2>/dev/null | sed 's/cmake-\(.*\)-done/\1/' )
3855 installed_ninja_version=$( ls ninja-*-done 2>/dev/null | sed 's/ninja-\(.*\)-done/\1/' )
3856 installed_asciidoctor_version=$( ls asciidoctor-*-done 2>/dev/null | sed 's/asciidoctor-\(.*\)-done/\1/' )
3857 installed_asciidoctorpdf_version=$( ls asciidoctorpdf-*-done 2>/dev/null | sed 's/asciidoctorpdf-\(.*\)-done/\1/' )
3858 installed_gettext_version=$( ls gettext-*-done 2>/dev/null | sed 's/gettext-\(.*\)-done/\1/' )
3859 installed_pkg_config_version=$( ls pkg-config-*-done 2>/dev/null | sed 's/pkg-config-\(.*\)-done/\1/' )
3860 installed_glib_version=$( ls glib-*-done 2>/dev/null | sed 's/glib-\(.*\)-done/\1/' )
3861 installed_qt_version=$( ls qt-*-done 2>/dev/null | sed 's/qt-\(.*\)-done/\1/' )
3862 installed_libsmi_version=$( ls libsmi-*-done 2>/dev/null | sed 's/libsmi-\(.*\)-done/\1/' )
3863 installed_libgpg_error_version=$( ls libgpg-error-*-done 2>/dev/null | sed 's/libgpg-error-\(.*\)-done/\1/' )
3864 installed_libgcrypt_version=$( ls libgcrypt-*-done 2>/dev/null | sed 's/libgcrypt-\(.*\)-done/\1/' )
3865 installed_gmp_version=$( ls gmp-*-done 2>/dev/null | sed 's/gmp-\(.*\)-done/\1/' )
3866 installed_libtasn1_version=$( ls libtasn1-*-done 2>/dev/null | sed 's/libtasn1-\(.*\)-done/\1/' )
3867 installed_p11_kit_version=$( ls p11-kit-*-done 2>/dev/null | sed 's/p11-kit-\(.*\)-done/\1/' )
3868 installed_nettle_version=$( ls nettle-*-done 2>/dev/null | sed 's/nettle-\(.*\)-done/\1/' )
3869 installed_gnutls_version=$( ls gnutls-*-done 2>/dev/null | sed 's/gnutls-\(.*\)-done/\1/' )
3870 installed_lua_version=$( ls lua-*-done 2>/dev/null | sed 's/lua-\(.*\)-done/\1/' )
3871 installed_snappy_version=$( ls snappy-*-done 2>/dev/null | sed 's/snappy-\(.*\)-done/\1/' )
3872 installed_zstd_version=$( ls zstd-*-done 2>/dev/null | sed 's/zstd-\(.*\)-done/\1/' )
3873 installed_zlibng_version=$( ls zlibng-*-done 2>/dev/null | sed 's/zlibng-\(.*\)-done/\1/' )
3874 installed_libxml2_version=$( ls libxml2-*-done 2>/dev/null | sed 's/libxml2-\(.*\)-done/\1/' )
3875 installed_lz4_version=$( ls lz4-*-done 2>/dev/null | sed 's/lz4-\(.*\)-done/\1/' )
3876 installed_sbc_version=$( ls sbc-*-done 2>/dev/null | sed 's/sbc-\(.*\)-done/\1/' )
3877 installed_maxminddb_version=$( ls maxminddb-*-done 2>/dev/null | sed 's/maxminddb-\(.*\)-done/\1/' )
3878 installed_cares_version=$( ls c-ares-*-done 2>/dev/null | sed 's/c-ares-\(.*\)-done/\1/' )
3879 installed_libssh_version=$( ls libssh-*-done 2>/dev/null | sed 's/libssh-\(.*\)-done/\1/' )
3880 installed_nghttp2_version=$( ls nghttp2-*-done 2>/dev/null | sed 's/nghttp2-\(.*\)-done/\1/' )
3881 installed_nghttp3_version=$( ls nghttp3-*-done 2>/dev/null | sed 's/nghttp3-\(.*\)-done/\1/' )
3882 installed_libtiff_version=$( ls tiff-*-done 2>/dev/null | sed 's/tiff-\(.*\)-done/\1/' )
3883 installed_spandsp_version=$( ls spandsp-*-done 2>/dev/null | sed 's/spandsp-\(.*\)-done/\1/' )
3884 installed_speexdsp_version=$( ls speexdsp-*-done 2>/dev/null | sed 's/speexdsp-\(.*\)-done/\1/' )
3885 installed_bcg729_version=$( ls bcg729-*-done 2>/dev/null | sed 's/bcg729-\(.*\)-done/\1/' )
3886 installed_ilbc_version=$( ls ilbc-*-done 2>/dev/null | sed 's/ilbc-\(.*\)-done/\1/' )
3887 installed_opencore_amr_version=$( ls opencore-amr-*-done 2>/dev/null | sed 's/opencore-amr-\(.*\)-done/\1/' )
3888 installed_opus_version=$( ls opus-*-done 2>/dev/null | sed 's/opus-\(.*\)-done/\1/' )
3889 installed_python3_version=$( ls python3-*-done 2>/dev/null | sed 's/python3-\(.*\)-done/\1/' )
3890 installed_brotli_version=$( ls brotli-*-done 2>/dev/null | sed 's/brotli-\(.*\)-done/\1/' )
3891 installed_minizip_version=$( ls minizip-[0-9.]*-done 2>/dev/null | sed 's/minizip-\(.*\)-done/\1/' )
3892 installed_minizip_ng_version=$( ls minizip-ng-*-done 2>/dev/null | sed 's/minizip-ng-\(.*\)-done/\1/' )
3893 installed_sparkle_version=$( ls sparkle-*-done 2>/dev/null | sed 's/sparkle-\(.*\)-done/\1/' )
3895 cd "$topdir"
3898 if [ "$do_uninstall" = "yes" ]
3899 then
3900 uninstall_all
3901 exit 0
3905 # Configure scripts tend to set CFLAGS and CXXFLAGS to "-g -O2" if
3906 # invoked without CFLAGS or CXXFLAGS being set in the environment.
3908 # However, we *are* setting them in the environment, for our own
3909 # nefarious purposes, so start them out as "-g -O2".
3911 export CFLAGS="-g -O2 -I$installation_prefix/include"
3912 export CXXFLAGS="-g -O2 -I$installation_prefix/include"
3913 export LDFLAGS="-L$installation_prefix/lib"
3914 export PKG_CONFIG_PATH="$installation_prefix/lib/pkgconfig"
3916 CONFIGURE_OPTS=( --prefix="$installation_prefix" )
3917 # if no make options are present, set default options
3918 # Should we just set MAKEFLAGS instead?
3919 if [ -z "$MAKE_BUILD_OPTS" ] ; then
3920 # by default use 1.5x number of cores for parallel build
3921 MAKE_BUILD_OPTS=( -j $(( $(sysctl -n hw.logicalcpu) * 3 / 2)) )
3924 CURL_REMOTE_NAME_OPTS=(--fail-with-body --location --remote-name)
3925 CURL_LOCAL_NAME_OPTS=(--fail-with-body --location --output)
3928 # If we have a target release, look for the oldest SDK that's for an
3929 # OS equal to or later than that one, and build libraries against it
3930 # rather than against the headers and, more importantly, libraries
3931 # that come with the OS, so that we don't end up with support libraries
3932 # that only work on the OS version on which we built them, not earlier
3933 # versions of the same release, or earlier releases if the minimum is
3934 # earlier.
3936 if [ -n "$min_osx_target" ]
3937 then
3939 # Get the major and minor version of the target release.
3940 # We assume it'll be a while before there's a macOS 100. :-)
3942 case "$min_osx_target" in
3944 [1-9][0-9].*)
3946 # major.minor.
3948 min_osx_target_major=$( echo "$min_osx_target" | sed -n 's/\([1-9][0-9]*\)\..*/\1/p' )
3949 min_osx_target_minor=$( echo "$min_osx_target" | sed -n 's/[1-9][0-9]*\.\(.*\)/\1/p' )
3952 [1-9][0-9])
3954 # Just a major version number was specified; make the minor
3955 # version 0.
3957 min_osx_target_major="$min_osx_target"
3958 min_osx_target_minor=0
3962 echo "macosx-setup.sh: Invalid target release $min_osx_target" 1>&2
3963 exit 1
3965 esac
3968 # Search each directory that might contain SDKs.
3970 sdkpath=""
3971 for sdksdir in /Developer/SDKs \
3972 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
3973 /Library/Developer/CommandLineTools/SDKs
3976 # Get a list of all the SDKs.
3978 if ! test -d "$sdksdir"
3979 then
3981 # There is no directory with that name.
3982 # Move on to the next one in the list, if any.
3984 continue
3988 # Get a list of all the SDKs in that directory, if any.
3989 # We assume it'll be a while before there's a macOS 100. :-)
3991 sdklist=$( (cd "$sdksdir"; ls -d MacOSX[1-9][0-9].[0-9]*.sdk 2>/dev/null) )
3993 for sdk in $sdklist
3996 # Get the major and minor version for this SDK.
3998 sdk_major=$( echo "$sdk" | sed -n 's/MacOSX\([1-9][0-9]*\)\..*\.sdk/\1/p' )
3999 sdk_minor=$( echo "$sdk" | sed -n 's/MacOSX[1-9][0-9]*\.\(.*\)\.sdk/\1/p' )
4002 # Is it for the deployment target or some later release?
4003 # Starting with major 11, the minor version no longer matters.
4005 if test "$sdk_major" -gt "$min_osx_target_major" -o \
4006 \( "$sdk_major" -eq "$min_osx_target_major" -a \
4007 \( "$sdk_major" -ge 11 -o \
4008 "$sdk_minor" -ge "$min_osx_target_minor" \) \)
4009 then
4011 # Yes, use it.
4013 sdkpath="$sdksdir/$sdk"
4014 break 2
4016 done
4017 done
4019 if [ -z "$sdkpath" ]
4020 then
4021 echo "macos-setup.sh: Couldn't find an SDK for macOS $min_osx_target or later" 1>&2
4022 exit 1
4025 SDKPATH="$sdkpath"
4026 echo "Using the $sdk_major.$sdk_minor SDK"
4029 # Make sure there are links to $installation_prefix/include and $installation_prefix/lib
4030 # in the SDK's usr/local.
4032 # XXX - Is this needed any more?
4033 # if [ ! -e $SDKPATH$installation_prefix/include ]
4034 # then
4035 # if [ ! -d $SDKPATH$installation_prefix ]
4036 # then
4037 # sudo mkdir $SDKPATH$installation_prefix
4038 # fi
4039 # sudo ln -s $installation_prefix/include $SDKPATH$installation_prefix/include
4040 # fi
4041 # if [ ! -e $SDKPATH$installation_prefix/lib ]
4042 # then
4043 # if [ ! -d $SDKPATH$installation_prefix ]
4044 # then
4045 # sudo mkdir $SDKPATH$installation_prefix
4046 # fi
4047 # sudo ln -s $installation_prefix/lib $SDKPATH$installation_prefix/lib
4048 # fi
4051 # Set the minimum OS version for which to build to the specified
4052 # minimum target OS version, so we don't, for example, end up using
4053 # linker features supported by the OS version on which we're building
4054 # but not by the target version.
4056 VERSION_MIN_FLAGS="-mmacosx-version-min=$min_osx_target"
4059 # Compile and link against the SDK.
4061 SDKFLAGS="-isysroot $SDKPATH"
4066 # You need Xcode or the command-line tools installed to get the compilers (xcrun checks both).
4068 if [ ! -x /usr/bin/xcrun ]; then
4069 echo "Please install Xcode (app or command line) first (should be available on DVD or from the Mac App Store)."
4070 exit 1
4073 if [ "$QT_VERSION" ]; then
4075 # We need Xcode, not just the command-line tools, installed to build
4076 # Qt.
4078 # At least with Xcode 8, /usr/bin/xcodebuild --help fails if only
4079 # the command-line tools are installed and succeeds if Xcode is
4080 # installed. Unfortunately, it fails *with* Xcode 3, but
4081 # /usr/bin/xcodebuild -version works with that and with Xcode 8.
4082 # Hopefully it fails with only the command-line tools installed.
4084 if /usr/bin/xcodebuild -version >/dev/null 2>&1; then
4086 elif qmake --version >/dev/null 2>&1; then
4088 else
4089 echo "Please install Xcode first (should be available on DVD or from the Mac App Store)."
4090 echo "The command-line build tools are not sufficient to build Qt."
4091 echo "Alternatively build QT according to: https://gist.github.com/shoogle/750a330c851bd1a924dfe1346b0b4a08#:~:text=MacOS%2FQt%5C%20Creator-,Go%20to%20Qt%20Creator%20%3E%20Preferences%20%3E%20Build%20%26%20Run%20%3E%20Kits,for%20both%20compilers%2C%20not%20gcc%20."
4092 exit 1
4097 # Do all the downloads and untarring in a subdirectory, so all that
4098 # stuff can be removed once we've installed the support libraries.
4100 if [ ! -d "${MACOSX_SUPPORT_LIBS}" ]
4101 then
4102 mkdir "${MACOSX_SUPPORT_LIBS}"
4104 cd "${MACOSX_SUPPORT_LIBS}"
4106 install_all
4108 echo ""
4111 # Indicate what paths to use for pkg-config and cmake.
4113 if [ "$QT_VERSION" ]; then
4114 qt_base_path=$HOME/Qt$QT_VERSION/$QT_VERSION/clang_64
4115 # CMAKE_PREFIX_PATH="$PACKAGE_CONFIG_PATH:$qt_base_path/lib/cmake"
4118 if $no_build; then
4119 echo "All required dependencies downloaded. Run without -n to install them."
4120 exit 0
4123 if [ "$QT_VERSION" ]; then
4124 if [ -f "qt-$QT_VERSION-done" ]; then
4125 echo "You are now prepared to build Wireshark."
4126 else
4127 echo "Qt was not installed; you will have to install it in order to build the"
4128 echo "Wireshark application, but you can build all the command-line tools in"
4129 echo "the Wireshark distribution."
4130 echo ""
4131 echo "See section 2.1.1. \"Build environment setup\" of the Wireshark Developer's"
4132 echo "Guide for instructions on how to install Qt."
4134 else
4135 echo "You did not install Qt; you will have to install it in order to build"
4136 echo "the Wireshark application, but you can build all the command-line tools in"
4137 echo "the Wireshark distribution."
4139 echo
4140 echo "To build:"
4141 echo
4142 echo "export PATH=$PATH:$qt_base_path/bin"
4143 echo
4144 echo "mkdir build; cd build"
4145 if [ -n "$NINJA_VERSION" ]; then
4146 echo "cmake -G Ninja .."
4147 echo "ninja wireshark_app_bundle stratoshark_app_bundle # (Modify as needed)"
4148 echo "ninja install/strip"
4149 else
4150 echo "cmake .."
4151 echo "make ${MAKE_BUILD_OPTS[*]} wireshark_app_bundle stratoshark_app_bundle # (Modify as needed)"
4152 echo "make install/strip"
4154 echo
4155 echo "Make sure you are allowed capture access to the network devices"
4156 echo "See: https://gitlab.com/wireshark/wireshark/-/wikis/CaptureSetup/CapturePrivileges"
4157 echo
4159 exit 0