summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a716dd54fe21ffef474b63ea23e8d2d7906438b5 (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
# shellcheck disable=SC2034 # unused var
# shellcheck disable=SC2154 # var referenced but not assigned
# shellcheck disable=SC2164 # cd might fail

# Maintainer: Štěpán Němec <stepnem@smrk.net>

# there is already a package named 'forge' in the extra
# repository; 'git-pkgs-forge' is the name used by brew
# (macOS), let's follow suit
pkgname=git-pkgs-forge
_cmdname=forge
pkgver=0.10.1
pkgrel=1
pkgdesc='CLI for working with git forges (GitHub, GitLab, Gitea/Forgejo, Bitbucket Cloud, Gerrit, Tangled)'
arch=(x86_64)
url=https://github.com/git-pkgs/forge
license=(MIT)
depends=(glibc)
makedepends=(go)
source=("$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz")
sha256sums=('4e6674f10c84da580776d3b3c4eb6fcd46ef76828b43a2caa602f2cdcf483047')

build() {
  cd "$_cmdname-$pkgver"
  export CGO_ENABLED=1 # -linkmode=external (which Arch wants) needs this :-(
  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"
  go build -o "$_cmdname" ./cmd/forge
}

check() {
  cd "$_cmdname-$pkgver"
  go test ./...
}

package() {
  cd "$_cmdname-$pkgver"
  install -Dm755 "$_cmdname" "$pkgdir/usr/bin/$_cmdname"
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}