decrypt drsuapi attributes
[wireshark-sm.git] / tools / macos-setup-brew.sh
blob2b4fc79314eeb0db951f859da4ddbb27f6d14f65
1 #!/bin/bash
2 # Copyright 2014, Evan Huus (See AUTHORS file)
4 # Enhance (2016) by Alexis La Goutte (For use with Travis CI)
6 # Wireshark - Network traffic analyzer
7 # By Gerald Combs <gerald@wireshark.org>
8 # Copyright 1998 Gerald Combs
10 # SPDX-License-Identifier: GPL-2.0-or-later
12 set -e -u -o pipefail
14 eval "$(brew shellenv)"
16 HOMEBREW_NO_AUTO_UPDATE=${HOMEBREW_NO_AUTO_UPDATE:-}
18 function print_usage() {
19 printf "\\nUtility to setup a macOS system for Wireshark Development using Homebrew.\\n"
20 printf "The basic usage installs the needed software\\n\\n"
21 printf "Usage: %s [--install-optional] [--install-dmg-deps] [...other options...]\\n" "$0"
22 printf "\\t--install-optional: install optional software as well\\n"
23 printf "\\t--install-dmg-deps: install packages required to build the .dmg file\\n"
24 printf "\\t--install-sparkle-deps: install the Sparkle automatic updater\\n"
25 printf "\\t--install-all: install everything\\n"
26 printf "\\t--install-stratoshark: install everything to compile Stratoshark and Falco bridge\\n"
27 printf "\\t[other]: other options are passed as-is to brew\\n"
30 INSTALLED_FORMULAE=$( brew list --formulae )
31 function install_formulae() {
32 INSTALL_LIST=()
33 for FORMULA in "$@" ; do
34 if ! grep --word-regexp "$FORMULA" > /dev/null 2>&1 <<<"$INSTALLED_FORMULAE" ; then
35 INSTALL_LIST+=( "$FORMULA" )
37 done
38 if (( ${#INSTALL_LIST[@]} != 0 )); then
39 brew install "${INSTALL_LIST[@]}"
40 else
41 printf "Nothing to install.\n"
45 INSTALL_OPTIONAL=0
46 INSTALL_DOC_DEPS=0
47 INSTALL_DMG_DEPS=0
48 INSTALL_SPARKLE_DEPS=0
49 INSTALL_TEST_DEPS=0
50 INSTALL_STRATOSHARK=0
51 OPTIONS=()
52 for arg; do
53 case $arg in
54 --help)
55 print_usage
56 exit 0
58 --install-optional)
59 INSTALL_OPTIONAL=1
61 --install-doc-deps)
62 INSTALL_DOC_DEPS=1
64 --install-dmg-deps)
65 INSTALL_DMG_DEPS=1
67 --install-sparkle-deps)
68 INSTALL_SPARKLE_DEPS=1
70 --install-test-deps)
71 INSTALL_TEST_DEPS=1
73 --install-stratoshark)
74 INSTALL_STRATOSHARK=1
76 --install-all)
77 INSTALL_OPTIONAL=1
78 INSTALL_DOC_DEPS=1
79 INSTALL_DMG_DEPS=1
80 INSTALL_SPARKLE_DEPS=1
81 INSTALL_TEST_DEPS=1
84 OPTIONS+=("$arg")
86 esac
87 done
89 BUILD_LIST=(
90 ccache
91 cmake
92 ninja
95 # Qt isn't technically required, but...
96 REQUIRED_LIST=(
97 c-ares
98 glib
99 libgcrypt
100 pcre2
102 speexdsp
105 ADDITIONAL_LIST=(
106 brotli
107 gettext
108 gnutls
109 libilbc
110 libmaxminddb
111 libnghttp2
112 libnghttp3
113 libsmi
114 libssh
115 libxml2
118 minizip
119 minizip-ng
120 opencore-amr
121 opus
122 snappy
123 spandsp
124 zlib-ng
125 zstd
128 DOC_DEPS_LIST=(
129 asciidoctor
130 docbook
131 docbook-xsl
134 STRATOSHARK_LIST=(
135 jsoncpp
136 onetbb
138 uthash
141 ACTUAL_LIST=( "${BUILD_LIST[@]}" "${REQUIRED_LIST[@]}" )
143 # Now arrange for optional support libraries
144 if [ $INSTALL_OPTIONAL -ne 0 ] ; then
145 ACTUAL_LIST+=( "${ADDITIONAL_LIST[@]}" )
148 if [ $INSTALL_DOC_DEPS -ne 0 ] ; then
149 ACTUAL_LIST+=( "${DOC_DEPS_LIST[@]}" )
152 if [ $INSTALL_STRATOSHARK -ne 0 ] ; then
153 ACTUAL_LIST+=( "${STRATOSHARK_LIST[@]}" )
156 if (( ${#OPTIONS[@]} != 0 )); then
157 ACTUAL_LIST+=( "${OPTIONS[@]}" )
160 install_formulae "${ACTUAL_LIST[@]}"
162 if [ $INSTALL_DMG_DEPS -ne 0 ] ; then
163 printf "Sorry, you'll have to install dmgbuild yourself for the time being.\\n"
164 # pip3 install "dmgbuild[badge_icons]"
167 if [ $INSTALL_SPARKLE_DEPS -ne 0 ] ; then
168 brew install --cask sparkle
171 if [ $INSTALL_TEST_DEPS -ne 0 ] ; then
172 printf "Sorry, you'll have to install pytest and pytest-xdist yourself for the time being.\\n"
173 # pip3 install pytest pytest-xdist
176 if [ $INSTALL_STRATOSHARK -ne 0 ] ; then
177 FALCO_LIBS_VERSION=0.18.1
178 FALCO_LIBS_SHA256=1812e8236c4cb51d3fe5dd066d71be99f25da7ed22d8feeeebeed09bdc26325f
179 if [ "$FALCO_LIBS_VERSION" ] && [ ! -f "falco-libs-$FALCO_LIBS_VERSION-done" ] ; then
180 echo "Downloading, building, and installing libsinsp and libscap:"
181 [ -f "falco-libs-$FALCO_LIBS_VERSION.tar.gz" ] || curl -L -O --remote-header-name "https://github.com/falcosecurity/libs/archive/refs/tags/$FALCO_LIBS_VERSION.tar.gz"
182 mv "libs-$FALCO_LIBS_VERSION.tar.gz" "falco-libs-$FALCO_LIBS_VERSION.tar.gz"
183 echo "$FALCO_LIBS_SHA256 falco-libs-$FALCO_LIBS_VERSION.tar.gz" | shasum --algorithm 256 --check
184 tar -xf "falco-libs-$FALCO_LIBS_VERSION.tar.gz"
185 mv "libs-$FALCO_LIBS_VERSION" "falco-libs-$FALCO_LIBS_VERSION"
186 cd "falco-libs-$FALCO_LIBS_VERSION"
187 patch -p1 < "../tools/macos-setup-patches/falco-uthash_h-install.patch"
188 mkdir build_dir
189 cd build_dir
190 cmake -DFALCOSECURITY_LIBS_VERSION="$FALCO_LIBS_VERSION" \
191 -DBUILD_SHARED_LIBS=ON -DMINIMAL_BUILD=ON -DCREATE_TEST_TARGETS=OFF \
192 -DUSE_BUNDLED_DEPS=ON -DUSE_BUNDLED_CARES=OFF -DUSE_BUNDLED_ZLIB=OFF \
193 -DUSE_BUNDLED_JSONCPP=OFF -DUSE_BUNDLED_TBB=OFF -DUSE_BUNDLED_RE2=OFF \
195 make
196 sudo make install
197 cd ../..
201 # Uncomment to add PNG compression utilities used by compress-pngs:
202 # brew install advancecomp optipng oxipng pngcrush
204 # Uncomment to enable generation of documentation
205 # brew install asciidoctor
207 exit 0
209 # Editor modelines
211 # Local Variables:
212 # c-basic-offset: 4
213 # tab-width: 8
214 # indent-tabs-mode: nil
215 # End:
217 # ex: set shiftwidth=4 tabstop=8 expandtab:
218 # :indentSize=4:tabSize=8:noTabs=true: