summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 88480a85f311c32af0ffdbb5d87b4ec496a01d79 (plain)
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
# Maintainer: someone5678 <someone5678 dot dev at google dot com>

pkgname=bpfmt-git
_pkgname=bpfmt
pkgver=20240612.r9.b46c67c
pkgrel=1
pkgdesc='A tool for formatting AOSP soong blueprint build files'
url='https://android.googlesource.com/platform/build/blueprint'
arch=('any')
license=('Apache-2.0')
makedepends=('git' 'go')
provides=($_pkgname)
source=('git+https://android.googlesource.com/platform/build/blueprint')
sha256sums=("SKIP")

pkgver() {
	cd "${srcdir}/blueprint"
	(
		set -o pipefail
		printf "%s.r%s.%s" \
		"$(git log -1 --date=format:%Y%m%d --format=%ad bpfmt)" \
		"$(git rev-list --count HEAD bpfmt)" \
		"$(git log bpfmt | head -n 1 | cut -d" " -f2 | awk '{print substr($0,0,7)}')"
	)
}

build() {
  cd "$srcdir/blueprint/$_pkgname"
  go build
}

package() {
  install -Dm755 "$srcdir/blueprint/$_pkgname/$_pkgname" "$pkgdir/usr/bin/$_pkgname"
  install -Dm644 "$srcdir/blueprint/LICENSE" -t "$pkgdir/usr/share/licenses/$_pkgname"
}