: nply/foundationpkgs

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 
# Host-toolchain presence check for macOS. Not a real package: verify()
# only checks that the tools below are on PATH and fails with an actionable,
# OS-specific hint when one isn't - it builds/installs nothing itself.
# Depend on this from a recipe's makedepends (e.g. kcgi needs "bmake") to
# turn a silent mid-build() crash into a clear message during dependency
# resolution instead.
pkgname=build-essentials-stub
pkgver=0
pkgrel=0
pkgdesc="verifies macOS build toolchain presence (cc, make, bmake, tar, curl)"
arch="all"

checkdeps="cc make bmake tar curl"

_hint() {
	case "$1" in
	cc | make)
		echo "install Xcode Command Line Tools: xcode-select --install"
		;;
	bmake)
		echo "brew install bmake"
		;;
	tar | curl)
		echo "should ship with macOS - check your PATH"
		;;
	*)
		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
}