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
# Host-toolchain presence check for Linux. See Darwin/build-essentials-stub
# for the general idea - this just carries Linux-appropriate install hints.
pkgname=build-essentials-stub
pkgver=0
pkgrel=0
pkgdesc="verifies Linux build toolchain presence (cc, make, tar, curl)"
arch="all"
checkdeps="cc make tar curl"
_hint() {
case "$1" in
cc | make)
echo "apt: apt install build-essential | apk: apk add build-base | dnf: dnf groupinstall 'Development Tools'"
;;
tar | curl)
echo "apt: apt install $1 | apk: apk add $1 | dnf: dnf install $1"
;;
*)
echo "no install hint available for '$1'"
;;
esac
}
verify() {
_missing=""
for _tool in $checkdeps; do
command -v "$_tool" >/dev/null 2>&1 || _missing="$_missing $_tool"
done
[ -z "$_missing" ] && return 0
for _tool in $_missing; do
echo "! missing required tool: $_tool ($(_hint "$_tool"))" >&2
done
return 1
}