summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 1b7b68bf407bc9389c2f36c82afab0129ef350c0 (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
# Maintainer: Erik Bender <erik.bender@develerik.dev>

_pkgname=git-credential-1password
_orga=develerik
_gourl=github.com/$_orga/$_pkgname

pkgname="${_pkgname}-git"
pkgver=r35.76a354f
pkgrel=1
pkgdesc="Git credential.helper using 1Password for storage"
arch=('x86_64' 'aarch64' 'armv7h' 'armv6h')
url="https://$_gourl"
license=('ISC')
makedepends=('git' 'go>=1.18')
depends=('git' '1password-cli')
provides=('git-credential-1password')
conflicts=("$_pkgname-dev-git" "$_pkgname-bin" "$_pkgname")
source=("git+https://$_gourl.git")
md5sums=('SKIP')

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

build() {
  local flags

  _flags=(
    -X=$_gourl/cmd.Version="$pkgver"
    -s
    -w
    -linkmode=external
  )

  export CGO_ENABLED=0

  cd $srcdir/$_pkgname
  go build -ldflags="${_flags[*]}" -o "$_pkgname" $_gourl
}

package() {
  cd ${srcdir}/${_pkgname}
  install -DT -m0755 "$_pkgname" "$pkgdir/usr/bin/$_pkgname"
}