summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7705a0f2a8708088d91cb5245cea13ef2fb3f52e (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
40
41
42
43
44
# Maintainer: Joshua Schmeder <joshua@schmeder.dev>

_pkgname='moar'
pkgname="${_pkgname}-git"
pkgver=1.18.3.r2.ga3df10b
pkgrel=1
pkgdesc='A pager designed to just do the right thing without any configuration.'
arch=('x86_64')
url='https://github.com/walles/moar'
license=('BSD')
makedepends=('git' 'go')
provides=("${_pkgname}")
conflicts=("${_pkgname}")
source=("git+${url}.git")
sha256sums=('SKIP')

prepare() {
  export GOPATH="${srcdir}/gopath"
  go clean -modcache
}

pkgver() {
  git -C "${_pkgname}" describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export CGO_LDFLAGS="${LDFLAGS}"
  export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"

  cd "${_pkgname}"
  export VERSION="$(git describe --tags --dirty --always)"
  go build -v -ldflags="-s -w -X main.versionString=$VERSION" -o "${_pkgname}"
}

package() {
  cd "${_pkgname}"
  install -Dvm755 "${_pkgname}" -t "${pkgdir}/usr/bin"
  install -Dvm644 'README.md' -t "${pkgdir}/usr/share/doc/${_pkgname}"
  install -Dvm644 'LICENSE' -t "${pkgdir}/usr/share/licenses/${_pkgname}"
  install -Dvm644 "${_pkgname}.1" -t "${pkgdir}/usr/share/man/man1"
}