summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4eba9673b2f327174075142bd35828d137b3783f (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Maintainer: Polpetta
# Maintainer: robertfoster

pkgname=yap-git
pkgver=r73.6b8ec80
pkgrel=1
pkgdesc="Package software with ease"
arch=('armv6h' 'armv7h' 'arm' 'aarch64' 'i686' 'x86_64')
url="https://github.com/M0Rf30/yap"
license=('GPL3')
# provides=("${pkgname%-git}")
# conflicts=("${pkgname%-git}")
depends=('glibc')
makedepends=('git' 'go')
optdepends=(
  'apk-tools: for alpine experimenting on native host'
  'dpkg: for deb experimenting on native host'
  'rpm-tools: for rpm experimenting on native host'
)
source=("${pkgname%-git}::git+${url}")

pkgver() {
  cd "$srcdir/${pkgname%-git}"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
  cd "$srcdir/${pkgname%-git}"
  export CGO_LDFLAGS="$LDFLAGS"
  export CGO_CFLAGS="$CFLAGS"
  export CGO_CPPFLAGS="$CPPFLAGS"
  export CGO_CXXFLAGS="$CXXFLAGS"
  export GOFLAGS="-buildmode=pie \
  -trimpath \
  -mod=readonly \
  -modcacherw"

  go build \
    -buildvcs=false \
    -ldflags="-w -s -linkmode=external \
  -X main.version=${pkgver}" \
    .
}

package() {
  cd "$srcdir/${pkgname%-git}"

  install -Dm 755 "${pkgname%-git}" \
    "${pkgdir}/usr/bin/${pkgname%-git}"

  mkdir -p "${pkgdir}/usr/share/bash-completion/completions/"
  mkdir -p "${pkgdir}/usr/share/zsh/site-functions/"
  mkdir -p "${pkgdir}/usr/share/fish/vendor_completions.d/"

  ./"${pkgname%-git}" completion bash > \
    "${pkgdir}/usr/share/bash-completion/completions/${pkgname%-git}"
  ./"${pkgname%-git}" completion zsh > \
    "${pkgdir}/usr/share/zsh/site-functions/_${pkgname%-git}"
  ./"${pkgname%-git}" completion fish > \
    "${pkgdir}/usr/share/fish/vendor_completions.d/${pkgname%-git}.fish"

  install -Dm644 -t \
    "${pkgdir}/usr/share/licenses/${pkgname%-git}/GPL3" LICENSE.md
  install -Dm644 -t \
    "${pkgdir}/usr/share/doc/${pkgname%-git}" README.md
}

sha256sums=('SKIP')