summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 0b8c3e7d42d30e69bc8062811a8e3759b32effb6 (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
36
37
38
39
# Maintainer: Pieter Joost van de Sande <pj@born2code.net>
pkgname=reftools-git
_pkgname=reftools
provides=('fixplurals' 'fillstruct' 'fillswitch')
pkgver=20201119.01cf781
pkgrel=1
pkgdesc='reftools - refactoring tools for Go'
url='https://github.com/davidrjenni/reftools'
arch=('any')
license=('BSD2')
makedepends=('git' 'go')
depends=()
source=('git://github.com/davidrjenni/reftools.git')
sha256sums=('SKIP')

pkgver() {
	cd "${srcdir}/${_pkgname}"
	git log -1 --format='%cd.%h' --date=short | tr -d -
}

build() {
  cd "${srcdir}/${_pkgname}"
  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
  go build -o fillstruct -ldflags "-extldflags ${LDFLAGS} -s -w -X main.version=${pkgver}" ./cmd/fillstruct
  go build -o fillswitch -ldflags "-extldflags ${LDFLAGS} -s -w -X main.version=${pkgver}" ./cmd/fillswitch
  go build -o fixplurals -ldflags "-extldflags ${LDFLAGS} -s -w -X main.version=${pkgver}" ./cmd/fillswitch
}

package() {
  install -Dm755 "${srcdir}/${_pkgname}/fillstruct" ${pkgdir}/usr/bin/fillstruct
  install -Dm755 "${srcdir}/${_pkgname}/fillswitch" ${pkgdir}/usr/bin/fillswitch
  install -Dm755 "${srcdir}/${_pkgname}/fixplurals" ${pkgdir}/usr/bin/fixplurals
  install -Dm644 "${srcdir}/${_pkgname}/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

# vim: ft=sh ts=2 sw=2 et