regen pidl all: rm epan/dissectors/pidl/*-stamp; pushd epan/dissectors/pidl/ && make...
[wireshark-sm.git] / tools / alpine-setup.sh
blob0cdb779934f97da383de2076aabe779ba4c3a6e7
1 #!/bin/ash
2 # Setup development environment on alpine systems
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
11 # that way.
14 set -e -u -o pipefail
16 print_usage() {
17 printf "\\nUtility to setup a alpine system for Wireshark Development.\\n"
18 printf "The basic usage installs the needed software\\n\\n"
19 printf "Usage: %s [--install-optional] [...other options...]\\n" "$0"
20 printf "\\t--install-optional: install optional software as well\\n"
21 printf "\\t--install-all: install everything\\n"
22 printf "\\t[other]: other options are passed as-is to apk\\n"
25 ADDITIONAL=0
26 OPTIONS=
27 for arg; do
28 case $arg in
29 --help)
30 print_usage
31 exit 0
33 --install-optional)
34 ADDITIONAL=1
36 --install-all)
37 ADDITIONAL=1
40 OPTIONS="$OPTIONS $arg"
42 esac
43 done
45 # Check if the user is root
46 if [ "$(id -u)" -ne 0 ]
47 then
48 echo "You must be root."
49 exit 1
52 BASIC_LIST="
53 bash
54 cmake
55 ninja
56 gcc
57 g++
58 glib-dev
59 libgcrypt-dev
60 flex
61 tiff-dev
62 c-ares-dev
63 pcre2-dev
64 qt6-qtbase-dev
65 qt6-qttools-dev
66 qt6-qtmultimedia-dev
67 qt6-qtsvg-dev
68 qt6-qt5compat-dev
69 speexdsp-dev
70 python3
73 ADDITIONAL_LIST="
74 git
75 asciidoctor
76 libssh-dev
77 spandsp-dev
78 libcap-dev
79 libcap-setcap
80 libpcap-dev
81 libxml2-dev
82 libmaxminddb-dev
83 krb5-dev
84 lz4-dev
85 gnutls-dev
86 snappy-dev
87 nghttp2-dev
88 nghttp3-dev
89 lua5.4-dev
90 libnl3-dev
91 sbc-dev
92 minizip-dev
93 brotli-dev
94 opencore-amr-dev
95 perl
96 py3-pytest
97 py3-pytest-xdist
100 # Uncomment to add PNG compression utilities used by compress-pngs:
101 # ADDITIONAL_LIST="$ADDITIONAL_LIST
102 # advancecomp
103 # optipng
104 # oxipng
105 # pngcrush"
107 # Adds package $2 to list variable $1 if the package is found.
108 # If $3 is given, then this version requirement must be satisfied.
109 add_package() {
110 local list="$1" pkgname="$2"
112 # fail if the package is not known
113 apk list "$pkgname" &> /dev/null || return 1
115 # package is found, append it to list
116 eval "${list}=\"\${${list}} \${pkgname}\""
119 ACTUAL_LIST=$BASIC_LIST
121 # Now arrange for optional support libraries
122 if [ $ADDITIONAL -ne 0 ]
123 then
124 ACTUAL_LIST="$ACTUAL_LIST $ADDITIONAL_LIST"
127 apk update || exit 2
128 # shellcheck disable=SC2086
129 apk add $ACTUAL_LIST $OPTIONS || exit 2
131 if [ $ADDITIONAL -eq 0 ]
132 then
133 printf "\n*** Optional packages not installed. Rerun with --install-optional to have them.\n"