2 # Setup development environment on Debian and derivatives such as Ubuntu
4 # Wireshark - Network traffic analyzer
5 # By Gerald Combs <gerald@wireshark.org>
6 # Copyright 1998 Gerald Combs
8 # SPDX-License-Identifier: GPL-2.0-or-later
10 # We drag in tools that might not be needed by all users; it's easier
16 function print_usage
() {
17 printf "\\nUtility to setup a debian-based system for Wireshark Development.\\n"
18 printf "The basic usage installs the needed software\\n\\n"
19 printf "Usage: %s [--install-optional] [--install-deb-deps] [...other options...]\\n" "$0"
20 printf "\\t--install-optional: install optional software as well\\n"
21 printf "\\t--install-deb-deps: install packages required to build the .deb file\\n"
22 printf "\\t--install-test-deps: install packages required to run all tests\\n"
23 printf "\\t--install-qt5-deps: force installation of packages required to use Qt5\\n"
24 printf "\\t--install-qt6-deps: force installation of packages required to use Qt6\\n"
25 printf "\\t--install-all: install everything\\n"
26 printf "\\t[other]: other options are passed as-is to apt\\n"
29 # Adds package $2 to list variable $1 if the package is found.
30 # If $3 is given, then this version requirement must be satisfied.
31 function add_package
() {
32 local list
="$1" pkgname
="$2" versionreq
="${3:-}" version
34 version
=$
(apt-cache show
"$pkgname" 2>/dev
/null |
35 awk '/^Version:/{ print $2; exit}')
36 # fail if the package is not known
37 if [ -z "$version" ]; then
39 elif [ -n "$versionreq" ]; then
40 # Require minimum version or fail.
41 # shellcheck disable=SC2086
42 dpkg
--compare-versions $version ge
$versionreq ||
return 1
45 # package is found, append it to list
46 eval "${list}=\"\${${list}} \${pkgname}\""
86 OPTIONS
="$OPTIONS $arg"
91 # Check if the user is root
92 if [ "$(id -u)" -ne 0 ]
94 echo "You must be root."
136 # qt6-5compat-dev: Debian >= bookworm, Ubuntu >= 23.04
137 # libqt6core5compat6-dev: Ubuntu 22.04
138 add_package QT6_LIST qt6-5compat-dev ||
139 QT6_LIST
="$QT6_LIST libqt6core5compat6-dev"
141 if [ $ADD_QT5 -ne 0 ]
143 BASIC_LIST
="$BASIC_LIST $QT5_LIST"
147 if [ $ADD_QT6 -ne 0 ]
149 BASIC_LIST
="$BASIC_LIST $QT6_LIST"
153 if [ $HAVE_ADD_QT -eq 0 ]
155 # Try to select Qt version from distro
156 test -e /etc
/os-release
&& os_release
='/etc/os-release' || os_release
='/usr/lib/os-release'
157 # shellcheck disable=SC1090
160 # Ubuntu 22.04 (jammy) / Debian 12 (bookworm) or later
161 MAJOR
=$
(echo "$VERSION_ID" | cut
-f1 -d.
)
162 if [ "${ID:-linux}" = "ubuntu" ] && [ "${MAJOR:-0}" -ge "22" ]; then
163 echo "Installing Qt6."
164 BASIC_LIST
="$BASIC_LIST $QT6_LIST"
165 elif [ "${ID:-linux}" = "debian" ] && [ "${MAJOR:-0}" -ge "12" ]; then
166 echo "Installing Qt6."
167 BASIC_LIST
="$BASIC_LIST $QT6_LIST"
169 echo "Installing Qt5."
170 BASIC_LIST
="$BASIC_LIST $QT5_LIST"
188 libopencore-amrnb-dev
203 # Uncomment to add PNG compression utilities used by compress-pngs:
232 # apt-get update must be called before calling add_package
233 # otherwise available packages appear as unavailable
234 apt-get update ||
exit 2
236 # libssh-gcrypt-dev: Debian < trixie, Ubuntu < 25.04
237 # libssh-dev: All releases, but trixie and 25.04 has relicensed OpenSSH
238 # See: https://bugs.debian.org/1074337
239 add_package ADDITIONAL_LIST libssh-dev
0.11.1-1 ||
240 ADDITIONAL_LIST
="$ADDITIONAL_LIST libssh-gcrypt-dev"
242 # Lua 5.4: Debian >= bullseye, Ubuntu >= 22.04 (jammy)
243 # Lua 5.3: Debian >= buster, Ubuntu >= 20.04 (focal)
244 add_package ADDITIONAL_LIST liblua5.4
-dev ||
245 ADDITIONAL_LIST
="$ADDITIONAL_LIST liblua5.3-dev"
247 # Debian >= bookworm, Ubuntu >= 22.04
248 add_package ADDITIONAL_LIST libnghttp3-dev ||
249 echo "libnghttp3-dev is unavailable" >&2
251 # ilbc library from http://www.deb-multimedia.org
252 add_package ADDITIONAL_LIST libilbc-dev ||
253 echo "libilbc-dev is unavailable"
255 # Debian >= bullseye, Ubuntu >= 22.04 (jammy)
256 # bcg729 library libbcg729-dev
257 add_package ADDITIONAL_LIST libbcg729-dev ||
258 echo "libbcg729-dev is unavailable"
260 ACTUAL_LIST
=$BASIC_LIST
262 # Now arrange for optional support libraries
263 if [ $ADDITIONAL -ne 0 ]
265 ACTUAL_LIST
="$ACTUAL_LIST $ADDITIONAL_LIST"
268 if [ $DEBDEPS -ne 0 ]
270 ACTUAL_LIST
="$ACTUAL_LIST $DEBDEPS_LIST"
273 if [ $TESTDEPS -ne 0 ]
275 ACTUAL_LIST
="$ACTUAL_LIST $TESTDEPS_LIST"
278 # shellcheck disable=SC2086
279 apt-get
install $ACTUAL_LIST $OPTIONS ||
exit 2
281 if [ $ADDITIONAL -eq 0 ]
283 printf "\n*** Optional packages not installed. Rerun with --install-optional to have them.\n"
286 if [ $DEBDEPS -eq 0 ]
288 printf "\n*** Debian packages build deps not installed. Rerun with --install-deb-deps to have them.\n"
291 if [ $TESTDEPS -eq 0 ]
293 printf "\n*** Test deps not installed. Rerun with --install-test-deps to have them.\n"