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
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
() {
33 for FORMULA
in "$@" ; do
34 if ! grep --word-regexp "$FORMULA" > /dev
/null
2>&1 <<<"$INSTALLED_FORMULAE" ; then
35 INSTALL_LIST
+=( "$FORMULA" )
38 if (( ${#INSTALL_LIST[@]} != 0 )); then
39 brew
install "${INSTALL_LIST[@]}"
41 printf "Nothing to install.\n"
48 INSTALL_SPARKLE_DEPS
=0
67 --install-sparkle-deps)
68 INSTALL_SPARKLE_DEPS
=1
73 --install-stratoshark)
80 INSTALL_SPARKLE_DEPS
=1
95 # Qt isn't technically required, but...
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"
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 \
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
214 # indent-tabs-mode: nil
217 # ex: set shiftwidth=4 tabstop=8 expandtab:
218 # :indentSize=4:tabSize=8:noTabs=true: