summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c17822a8fd82edfbff6c9bfa1447b4204a8be433 (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
# Maintainer:

_pkgname="zvm"
pkgname="$_pkgname-git"
pkgver=0.8.8.r0.g71b7405
pkgrel=1
pkgdesc="A version manager for Zig compilers"
url="https://github.com/tristanisham/zvm"
license=('MIT')
arch=('x86_64')

depends=(
  'glibc'
)
makedepends=(
  'go'
  'git'
)

provides=("$_pkgname")
conflicts=("$_pkgname")

options=('!strip' '!debug')

_pkgsrc="$_pkgname"
source=("$_pkgsrc"::"git+$url.git")
sha256sums=('SKIP')

pkgver() (
  cd "$_pkgsrc"
  git describe --long --tags --abbrev=7 --exclude='*[a-zA-Z][a-zA-Z]*' \
    | sed -E 's/^[^0-9]*//;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 "$_pkgsrc"
  go build -o . ./...
}

package() {
  install -Dm755 "$_pkgsrc/$_pkgname" "$pkgdir/usr/bin/$_pkgname"
  install -Dm644 "$_pkgsrc/LICENSE" -t "$pkgdir/usr/share/licenses/$pkgname/"
}