From 4403bd98d93daa77ae1658658efe355e1d0ff827 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Valverde?= Date: Sun, 14 Nov 2021 19:31:25 +0000 Subject: [PATCH] tools: Add MSYS2 setup script to install dependencies --- README.msys2 | 34 ++++++------ tools/msys2-setup.sh | 121 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+), 18 deletions(-) create mode 100644 tools/msys2-setup.sh diff --git a/README.msys2 b/README.msys2 index eca14f299b..52c6650d2f 100644 --- a/README.msys2 +++ b/README.msys2 @@ -15,10 +15,17 @@ Steps to setup the build environment: $ pacman -S pactoys -5. Install the toolchain: +5. Install the dependencies. From the source directory run: + + $ ./tools/msys2-setup.sh --install-all + + Individual packages can be installed using pacboy: $ pacboy -S toolchain:x cmake:x ninja:x ccache:x + There isn't a native git package provided with MSYS2 so it's recommended that + you continue using the Git-For-Windows installer (or see [1]). + From this point on it's a typical ninja build: 1. Open the MSYS2 MINGW64 shell. @@ -32,20 +39,10 @@ From this point on it's a typical ninja build: $ cmake -DENABLE_CCACHE=Yes -DDISABLE_WERROR=Yes .. -4. Instal missing dependencies using pacman (there are a few gaps) and - re-run cmake, e.g.: - - $ pacboy -S glib2:x libpcap:x libgcrypt:x gnutls:x qt5:x \ - asciidoctor:x libssh:x libmaxminddb:x snappy:x spandsp:x \ - libilbc:x doxygen:x winsparkle:x opus:x speexdsp:x - -5. Build by running "ninja" in the build directory: +4. Build by running "ninja" in the build directory: $ ninja -There isn't a native git package provided with MSYS2 so it's recommended that -you continue using the Git-For-Windows installer (or see [1]). - Currently the Wireshark MinGW-w64 build using MSYS2 has the following limitations: @@ -53,12 +50,13 @@ limitations: * Some optional dependencies are not available in the official MSYS2 repositories. These are: - * AirPcap - * libsmi - * Kerberos - * Lua-unicode (Lua 5.1 is available and can be used instead) - * SBC codec - * BCG729 codec + + - AirPcap + - libsmi + - Kerberos + - Lua-unicode (Lua 5.1 is available and can be used instead) + - SBC codec + - BCG729 codec * There is no Wireshark binary package available. More work is needed to implement this. To be decided if it will use NSIS or something diff --git a/tools/msys2-setup.sh b/tools/msys2-setup.sh new file mode 100644 index 0000000000..c17b65388b --- /dev/null +++ b/tools/msys2-setup.sh @@ -0,0 +1,121 @@ +#!/bin/bash +# Setup development environment on MSYS2 +# +# Wireshark - Network traffic analyzer +# By Gerald Combs +# Copyright 1998 Gerald Combs +# +# SPDX-License-Identifier: GPL-2.0-or-later +# +# We drag in tools that might not be needed by all users; it's easier +# that way. +# + +if [ "$1" = "--help" ] +then + printf "\\nUtility to setup an MSYS2 MinGW-w64 system for Wireshark development.\\n" + printf "The basic usage installs the needed software\\n\\n" + printf "Usage: %s [--install-optional] [...other options...]\\n" "$0" + printf "\\t--install-optional: install optional software as well\\n" + printf "\\t--install-test-deps: install packages required to run all tests\\n" + printf "\\t--install-all: install everything\\n" + printf "\\t[other]: other options are passed as-is to pacman\\n" + printf "\\tPass --noconfirm to bypass any \"are you sure?\" messages.\\n" + exit 1 +fi + +ADDITIONAL=0 +TESTDEPS=0 +LUA=0 +for arg; do + case $arg in + --install-optional) + ADDITIONAL=1 + ;; + --install-test-deps) + TESTDEPS=1 + ;; + --install-all) + ADDITIONAL=1 + TESTDEPS=1 + LUA=1 + ;; + *) + OPTIONS="$OPTIONS $arg" + ;; + esac +done + +# +# Lua is kind of a mess. Lua 5.2 is not available. Some packages depend +# on LuaJIT and it conflicts with Lua 5.1. This will probably have to +# be fixed by the MSYS2 maintainers. Take a hands off approach for now. +# +BASIC_LIST="base-devel \ + mingw-w64-x86_64-brotli \ + mingw-w64-x86_64-c-ares \ + mingw-w64-x86_64-cmake \ + mingw-w64-x86_64-glib2 \ + mingw-w64-x86_64-gnutls \ + mingw-w64-x86_64-libgcrypt \ + mingw-w64-x86_64-libilbc \ + mingw-w64-x86_64-libmaxminddb \ + mingw-w64-x86_64-nghttp2 \ + mingw-w64-x86_64-libpcap \ + mingw-w64-x86_64-libssh \ + mingw-w64-x86_64-libxml2 \ + mingw-w64-x86_64-lz4 \ + mingw-w64-x86_64-minizip \ + mingw-w64-x86_64-ninja \ + mingw-w64-x86_64-opus \ + mingw-w64-x86_64-pcre2 \ + mingw-w64-x86_64-perl \ + mingw-w64-x86_64-python \ + mingw-w64-x86_64-qt5-base \ + mingw-w64-x86_64-qt5-multimedia \ + mingw-w64-x86_64-qt5-tools \ + mingw-w64-x86_64-snappy \ + mingw-w64-x86_64-spandsp \ + mingw-w64-x86_64-speexdsp \ + mingw-w64-x86_64-toolchain \ + mingw-w64-x86_64-winsparkle \ + mingw-w64-x86_64-zlib \ + mingw-w64-x86_64-zstd" + +ADDITIONAL_LIST="mingw-w64-x86_64-asciidoctor \ + mingw-w64-x86_64-ccache \ + mingw-w64-x86_64-doxygen \ + mingw-w64-x86_64-libxslt" + +TESTDEPS_LIST="mingw-w64-x86_64-python-pytest \ + mingw-w64-x86_64-python-pytest-xdist" + +ACTUAL_LIST=$BASIC_LIST + +if [ $ADDITIONAL -ne 0 ] +then + ACTUAL_LIST="$ACTUAL_LIST $ADDITIONAL_LIST" +fi + +if [ $TESTDEPS -ne 0 ] +then + ACTUAL_LIST="$ACTUAL_LIST $TESTDEPS_LIST" +fi + +# Partial upgrades are unsupported. +pacman -Syu --needed $ACTUAL_LIST $OPTIONS || exit 2 + +if [ $ADDITIONAL -eq 0 ] +then + printf "\n*** Optional packages not installed. Rerun with --install-optional to have them.\n" +fi + +if [ $TESTDEPS -eq 0 ] +then + printf "\n*** Test deps not installed. Rerun with --install-test-deps to have them.\n" +fi + +if [ $LUA -ne 0 ] +then + printf "\n*** Lua 5.1 can be installed with: pacman -S mingw-w64-x86_64-lua51\n" +fi