# Maintainer: George Rawlinson pkgname=jsed pkgver=0.2.2.r2.g724b05d pkgrel=1 pkgdesc="Command-line JSON editor" arch=('x86_64') url="https://github.com/jtopjian/jsed" license=('MIT') depends=('glibc') makedepends=('git' 'go') options=('!lto') _commit='724b05dd00da568058c1cbd4122c146fb5139497' source=("$pkgname::git+$url.git#commit=$_commit") b2sums=('SKIP') pkgver() { cd "$pkgname" git describe --tags | sed -e 's/^v//' -e 's/-/.r/' -e 's/-/./' } prepare() { cd "$pkgname" # create directory for build output mkdir build # download dependencies go mod download } build() { cd "$pkgname" # set Go flags export CGO_CPPFLAGS="${CPPFLAGS}" export CGO_CFLAGS="${CFLAGS}" export CGO_CXXFLAGS="${CXXFLAGS}" go build -v \ -trimpath \ -buildmode=pie \ -mod=readonly \ -modcacherw \ -ldflags "-linkmode external -extldflags $LDFLAGS" \ -o build \ . } check() { cd "$pkgname" go test -v ./... } package() { cd "$pkgname" # binary install -vDm755 -t "$pkgdir/usr/bin" build/jsed # documentation install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" README.md # license install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE.txt }