summaryrefslogtreecommitdiffstats
path: root/tools/msys2-setup.sh
blob: be78607e29e4c35340b732d57ca0c661e24ab19b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/bin/bash
# Setup development environment on MSYS2
#
# Wireshark - Network traffic analyzer
# By Gerald Combs <gerald@wireshark.org>
# 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.
#

function print_usage() {
	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-nsis-deps: install packages required to build NSIS installer\\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"
}

ADDITIONAL=0
TESTDEPS=0
OPTIONS=
for arg; do
	case $arg in
		--help)
			print_usage
			exit 0
			;;
		--install-optional)
			ADDITIONAL=1
			;;
		--install-nsis-deps)
			NSISDEPS=1
			;;
		--install-test-deps)
			TESTDEPS=1
			;;
		--install-all)
			ADDITIONAL=1
			NSISDEPS=1
			TESTDEPS=1
			;;
		*)
			OPTIONS="$OPTIONS $arg"
			;;
	esac
done

PACKAGE_PREFIX="${MINGW_PACKAGE_PREFIX:-mingw-w64-x86_64}"

#
# Lua packaging is kind of a mess. Lua 5.2 is not available. Some packages have
# a hard dependency on LuaJIT and it conflicts with Lua 5.1 and vice-versa.
# This will probably have to be fixed by the MSYS2 maintainers.
# XXX Is this still true? We can use Lua 5.3 and 5.4 now, though we still
# might want to package our own version to use our UTF-8 on Windows patch
# (though we don't apply that patch yet.)
#
BASIC_LIST="base-devel \
	git \
	${PACKAGE_PREFIX}-bcg729 \
	${PACKAGE_PREFIX}-brotli \
	${PACKAGE_PREFIX}-c-ares \
	${PACKAGE_PREFIX}-cmake \
	${PACKAGE_PREFIX}-glib2 \
	${PACKAGE_PREFIX}-gnutls \
	${PACKAGE_PREFIX}-libgcrypt \
	${PACKAGE_PREFIX}-libilbc \
	${PACKAGE_PREFIX}-libmaxminddb \
	${PACKAGE_PREFIX}-nghttp2 \
	${PACKAGE_PREFIX}-libpcap \
	${PACKAGE_PREFIX}-libsmi \
	${PACKAGE_PREFIX}-libssh \
	${PACKAGE_PREFIX}-libxml2 \
	${PACKAGE_PREFIX}-lz4 \
	${PACKAGE_PREFIX}-minizip \
	${PACKAGE_PREFIX}-ninja \
	${PACKAGE_PREFIX}-opencore-amr \
	${PACKAGE_PREFIX}-opus \
	${PACKAGE_PREFIX}-pcre2 \
	${PACKAGE_PREFIX}-python \
	${PACKAGE_PREFIX}-qt6-base \
	${PACKAGE_PREFIX}-qt6-multimedia \
	${PACKAGE_PREFIX}-qt6-tools \
	${PACKAGE_PREFIX}-qt6-translations \
	${PACKAGE_PREFIX}-qt6-5compat \
	${PACKAGE_PREFIX}-sbc \
	${PACKAGE_PREFIX}-snappy \
	${PACKAGE_PREFIX}-spandsp \
	${PACKAGE_PREFIX}-speexdsp \
	${PACKAGE_PREFIX}-toolchain \
	${PACKAGE_PREFIX}-winsparkle \
	${PACKAGE_PREFIX}-zlib \
	${PACKAGE_PREFIX}-zstd"

ADDITIONAL_LIST="${PACKAGE_PREFIX}-asciidoctor \
	${PACKAGE_PREFIX}-ccache \
	${PACKAGE_PREFIX}-docbook-xsl \
	${PACKAGE_PREFIX}-doxygen \
	${PACKAGE_PREFIX}-libxslt \
	${PACKAGE_PREFIX}-perl \
	${PACKAGE_PREFIX}-ntldd"

NSISDEPS_LIST="${PACKAGE_PREFIX}-nsis"

TESTDEPS_LIST="${PACKAGE_PREFIX}-python-pytest \
	${PACKAGE_PREFIX}-python-pytest-xdist"

ACTUAL_LIST=$BASIC_LIST

if [ $ADDITIONAL -ne 0 ]
then
	ACTUAL_LIST="$ACTUAL_LIST $ADDITIONAL_LIST"
fi

if [ $NSISDEPS -ne 0 ]
then
	ACTUAL_LIST="$ACTUAL_LIST $NSISDEPS_LIST"
fi

if [ $TESTDEPS -ne 0 ]
then
	ACTUAL_LIST="$ACTUAL_LIST $TESTDEPS_LIST"
fi

# Partial upgrades are unsupported.
pacman --sync --refresh --sysupgrade --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 [ $NSISDEPS -eq 0 ]
then
	printf "\n*** NSIS installer deps not installed. Rerun with --install-nsis-deps 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