drsuapi_dissect_element_DsReplicaObjectIdentifier_dn parents append
[wireshark-sm.git] / tools / macos-setup-brew.sh
blob26d8f9d9a6da0599c06151360644108b8432284c
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
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"
187 mkdir build_dir
188 cd build_dir
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 \
194 make
195 sudo make install
196 cd ../..
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
206 exit 0
208 # Editor modelines
210 # Local Variables:
211 # c-basic-offset: 4
212 # tab-width: 8
213 # indent-tabs-mode: nil
214 # End:
216 # ex: set shiftwidth=4 tabstop=8 expandtab:
217 # :indentSize=4:tabSize=8:noTabs=true: