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...
140 ACTUAL_LIST
=( "${BUILD_LIST[@]}" "${REQUIRED_LIST[@]}" )
142 # Now arrange for optional support libraries
143 if [ $INSTALL_OPTIONAL -ne 0 ] ; then
144 ACTUAL_LIST
+=( "${ADDITIONAL_LIST[@]}" )
147 if [ $INSTALL_DOC_DEPS -ne 0 ] ; then
148 ACTUAL_LIST
+=( "${DOC_DEPS_LIST[@]}" )
151 if [ $INSTALL_STRATOSHARK -ne 0 ] ; then
152 ACTUAL_LIST
+=( "${STRATOSHARK_LIST[@]}" )
155 if (( ${#OPTIONS[@]} != 0 )); then
156 ACTUAL_LIST
+=( "${OPTIONS[@]}" )
159 install_formulae
"${ACTUAL_LIST[@]}"
161 if [ $INSTALL_DMG_DEPS -ne 0 ] ; then
162 printf "Sorry, you'll have to install dmgbuild yourself for the time being.\\n"
163 # pip3 install "dmgbuild[badge_icons]"
166 if [ $INSTALL_SPARKLE_DEPS -ne 0 ] ; then
167 brew cask
install sparkle
170 if [ $INSTALL_TEST_DEPS -ne 0 ] ; then
171 printf "Sorry, you'll have to install pytest and pytest-xdist yourself for the time being.\\n"
172 # pip3 install pytest pytest-xdist
175 if [ $INSTALL_STRATOSHARK -ne 0 ] ; then
176 FALCO_LIBS_VERSION
=0.18.1
177 FALCO_LIBS_SHA256
=1812e8236c4cb51d3fe5dd066d71be99f25da7ed22d8feeeebeed09bdc26325f
178 if [ "$FALCO_LIBS_VERSION" ] && [ ! -f "falco-libs-$FALCO_LIBS_VERSION-done" ] ; then
179 echo "Downloading, building, and installing libsinsp and libscap:"
180 [ -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"
181 mv "libs-$FALCO_LIBS_VERSION.tar.gz" "falco-libs-$FALCO_LIBS_VERSION.tar.gz"
182 echo "$FALCO_LIBS_SHA256 falco-libs-$FALCO_LIBS_VERSION.tar.gz" | shasum
--algorithm 256 --check
183 tar -xf "falco-libs-$FALCO_LIBS_VERSION.tar.gz"
184 mv "libs-$FALCO_LIBS_VERSION" "falco-libs-$FALCO_LIBS_VERSION"
185 cd "falco-libs-$FALCO_LIBS_VERSION"
186 patch -p1 < "../tools/macos-setup-patches/falco-uthash_h-install.patch"
189 cmake
-DFALCOSECURITY_LIBS_VERSION="$FALCO_LIBS_VERSION" \
190 -DBUILD_SHARED_LIBS=ON
-DMINIMAL_BUILD=ON
-DCREATE_TEST_TARGETS=OFF \
191 -DUSE_BUNDLED_DEPS=ON
-DUSE_BUNDLED_CARES=OFF
-DUSE_BUNDLED_ZLIB=OFF \
192 -DUSE_BUNDLED_JSONCPP=OFF
-DUSE_BUNDLED_TBB=OFF
-DUSE_BUNDLED_RE2=OFF \
200 # Uncomment to add PNG compression utilities used by compress-pngs:
201 # brew install advancecomp optipng oxipng pngcrush
203 # Uncomment to enable generation of documentation
204 # brew install asciidoctor
213 # indent-tabs-mode: nil
216 # ex: set shiftwidth=4 tabstop=8 expandtab:
217 # :indentSize=4:tabSize=8:noTabs=true: