aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2023-02-01 16:38:01 -0800
committerGerald Combs <gerald@wireshark.org>2023-02-02 23:13:29 +0000
commit1bcc5d097d331fafb016a2b4d5371feb50484acc (patch)
treef2cbe5afc82a5b90f85b7d3464d801c045f91da3 /tools
parente93f42350400687800262925839fb14f40ab234b (diff)
GitLab CI: Add a macOS merge request build.
Add an initial "macOS Build" job that uses GitLab's macOS beta. https://about.gitlab.com/blog/2021/08/23/build-cloud-for-macos-beta/ Add command line options to macos-setup-brew.sh and use it to install our packages. Skip running tests for now.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/macos-setup-brew.sh136
1 files changed, 120 insertions, 16 deletions
diff --git a/tools/macos-setup-brew.sh b/tools/macos-setup-brew.sh
index 1ffbef8315..cb706f7776 100755
--- a/tools/macos-setup-brew.sh
+++ b/tools/macos-setup-brew.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# Copyright 2014, Evan Huus (See AUTHORS file)
#
# Enhance (2016) by Alexis La Goutte (For use with Travis CI)
@@ -9,20 +9,126 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
+set -e -u -o pipefail
+
# Update to last brew release
-brew update
+if [ -z "$HOMEBREW_NO_AUTO_UPDATE" ] ; then
+ brew update
+fi
+
+function print_usage() {
+ printf "\\nUtility to setup a macOS system for Wireshark Development using Homebrew.\\n"
+ printf "The basic usage installs the needed software\\n\\n"
+ printf "Usage: %s [--install-optional] [--install-dmg-deps] [...other options...]\\n" "$0"
+ printf "\\t--install-optional: install optional software as well\\n"
+ printf "\\t--install-dmg-deps: install packages required to build the .dmg file\\n"
+ printf "\\t--install-sparkle-deps: install the Sparkle automatic updater\\n"
+ printf "\\t--install-all: install everything\\n"
+ printf "\\t[other]: other options are passed as-is to apt\\n"
+}
+
+INSTALLED_FORMULAE=$( brew list --formulae )
+function install_formulae() {
+ INSTALL_LIST=()
+ for FORMULA in "$@" ; do
+ if ! grep --word-regexp "$FORMULA" > /dev/null 2>&1 <<<"$INSTALLED_FORMULAE" ; then
+ INSTALL_LIST+=( "$FORMULA" )
+ fi
+ done
+ if (( ${#INSTALL_LIST[@]} != 0 )); then
+ brew install "${INSTALL_LIST[@]}"
+ else
+ printf "Nothing to install.\n"
+ fi
+}
+
+ADDITIONAL=0
+DMGDEPS=0
+SPARKLEDEPS=0
+OPTIONS=()
+for arg; do
+ case $arg in
+ --help)
+ print_usage
+ exit 0
+ ;;
+ --install-optional)
+ ADDITIONAL=1
+ ;;
+ --install-dmg-deps)
+ DMGDEPS=1
+ ;;
+ --install-sparkle-deps)
+ DMGDEPS=1
+ ;;
+ --install-all)
+ ADDITIONAL=1
+ DMGDEPS=1
+ SPARKLEDEPS=1
+ ;;
+ *)
+ OPTIONS+=("$arg")
+ ;;
+ esac
+done
+
+BUILD_LIST=(
+ ccache
+ cmake
+ ninja
+)
+
+# Qt isn't technically required, but...
+REQUIRED_LIST=(
+ c-ares
+ glib
+ libgcrypt
+ pcre2
+ qt6
+)
-# install some libs needed by Wireshark
-brew install opus c-ares glib libgcrypt gnutls lua@5.1 cmake python nghttp2 snappy lz4 libxml2 ninja \
- libmaxminddb libsmi spandsp brotli minizip zstd libssh libilbc speexdsp gettext pcre2 qt6 "$@"
+ADDITIONAL_LIST=(
+ brotli
+ gettext
+ gnutls
+ libilbc
+ libmaxminddb
+ libsmi
+ libssh
+ libxml2
+ lua@5.1
+ lz4
+ minizip
+ nghttp2
+ opus
+ snappy
+ spandsp
+ speexdsp
+ zstd
+)
-# install custom tap of sparkle v1 as homebrew now uses sparkle v2 per default which is not compatible
-curl -o /tmp/sparkle.rb https://raw.githubusercontent.com/Homebrew/homebrew-cask/c6dfe6baf1639998ba1707f68668cf8fa97bac9d/Casks/sparkle.rb
-brew install /tmp/sparkle.rb
-rm /tmp/sparkle.rb
+ACTUAL_LIST=( "${BUILD_LIST[@]}" "${REQUIRED_LIST[@]}" )
-# Uncomment to enable automatic updates using Sparkle
-# brew cask install sparkle
+# Now arrange for optional support libraries
+if [ $ADDITIONAL -ne 0 ] ; then
+ ACTUAL_LIST+=( "${ADDITIONAL_LIST[@]}" )
+fi
+
+if (( ${#OPTIONS[@]} != 0 )); then
+ ACTUAL_LIST+=( "${OPTIONS[@]}" )
+fi
+
+install_formulae "${ACTUAL_LIST[@]}"
+
+
+if [ $DMGDEPS -ne 0 ] ; then
+ pip3 install dmgbuild
+ pip3 install biplist
+fi
+
+if [ $SPARKLEDEPS -ne 0 ] ; then
+ brew cask install sparkle
+fi
# Uncomment to add PNG compression utilities used by compress-pngs:
# brew install advancecomp optipng oxipng pngcrush
@@ -30,11 +136,9 @@ rm /tmp/sparkle.rb
# Uncomment to enable generation of documentation
# brew install asciidoctor
-# Uncomment to build dmg bundle
-# /usr/local/bin/pip3 install dmgbuild
-# /usr/local/bin/pip3 install biplist
-
-brew doctor
+if [ -z "$HOMEBREW_NO_AUTO_UPDATE" ] ; then
+ brew doctor
+fi
exit 0
#