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

ARGS=
MAKEARGS=
PKGS=

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

while [ $# -gt 0 ]; do
	case $1 in
		-n|-k) MAKEARGS="$MAKEARGS $1";;
		-a|-H|-m|-o|-r) ARGS="$ARGS $1 $2"; shift;;
		-*) ARGS="$ARGS $1";;
		*) PKGS="$PKGS
$(mainpkg $1)"
	esac
	shift
done

{
for pkg in $PKGS; do
	echo all: pkg-$pkg
	for dep in $(./xbps-src $ARGS show-build-deps $pkg |
			sed '/^[<=>]/d'); 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