about summary refs log tree commit diff
path: root/xbulk
blob: 833910fe859b46790341e38947784529f5a6aa46 (plain) (blame)
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
#!/bin/sh
# xbulk [-n] [-k] [xbps-src flags...] PKGS... - simple XBPS bulk builder

ARGS=
MAKEARGS=
PKGS=

mainpkg() {
	dir=$(readlink -f srcpkgs/"$1")
	echo ${dir##*/}
}

for pkg; do
	case $pkg in
		-n|-k) MAKEARGS="$MAKEARGS $pkg";;
		-*) ARGS="$ARGS $pkg";;
		*) PKGS="$PKGS
$(mainpkg $pkg)"
	esac
done

{
for pkg in $PKGS; do
	echo all: pkg-$pkg
	for dep in $(./xbps-src show-build-deps $pkg |
			sed '1d;s|[<>].*$||g'); do
		mainpkg $dep |
		grep -Fx "$PKGS" |
		sed 's/^/pkg-'$pkg': pkg-/'
	done
done
printf '%s\n' pkg-%: "	pkg=\$@; ./xbps-src $ARGS pkg \$\${pkg#pkg-}"
} | make -f - $MAKEARGS