pkgname=duf pkgver=0.9.1 pkgdesc="Disk Usage/Free Utility - a better 'df' alternative" homepage="https://github.com/muesli/duf" license=("MIT" "BSD" "Apache-2.0") sources=("${pkgname}-${pkgver}.tar.gz") bdepends=("go") urls=("https://github.com/muesli/duf/archive/refs/tags/v${pkgver}.tar.gz") sha512sums=("5ebb8b8800268f97590488307c83f7adcd133339e5f2b86d26903b112ab826fefc66175c0f03e23b6ac1a7ebe81c416bb44f302e459b36cae6fe50279345d203") src_prepare() { tar -xf ${distdir}/${sources[0]} --strip-components=1 } src_build() { local commit=$(zcat ${distdir}/${sources[0]} | git get-tar-commit-id) local extraflags="-X main.Version=$pkgver -X main.CommitSHA=$commit" export CGO_CPPFLAGS="$CPPFLAGS" export CGO_CFLAGS="$CFLAGS" export CGO_CXXFLAGS="$CXXFLAGS" go build \ -trimpath \ -buildmode=pie \ -mod=readonly \ -modcacherw \ -ldflags "-linkmode external $extraflags -extldflags \"$LDFLAGS\"" \ -o "$pkgname" . } src_install() { install -Dm0755 -t "$pkgdir/usr/bin/" "$pkgname" install -Dm0644 -t "$pkgdir/usr/share/man/man1/" "$pkgname.1" install -Dm0644 -t "$pkgdir/usr/share/licenses/$pkgname/" LICENSE } # vim:ft=sh syn=sh et sw=2: