summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 15bc9115b58001940eadd6b357e9b96ac40f1055 (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
# Maintainer: Carl Smedstad <carsme@archlinux.org>
# Contributor: Radoslaw Mejer <radmen@radmen.info>

pkgname=jd-tool
_pkgname=jd
pkgver=1.9.1
pkgrel=1
pkgdesc="JSON diff and patch"
arch=(x86_64 aarch64)
url="https://github.com/josephburnett/jd"
license=(MIT)
depends=(glibc)
makedepends=(go)
source=("$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz")
sha256sums=('92f1b183510874a73327bfb70cb2c0fed2fc1f2d08191f0736dc4863d6766110')

prepare() {
  cd $_pkgname-$pkgver
  GOFLAGS="-mod=readonly" go mod vendor -v
}

build() {
  cd $_pkgname-$pkgver
  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export CGO_LDFLAGS="${LDFLAGS}"
  export GOFLAGS="-buildmode=pie -mod=vendor -modcacherw -buildvcs=false"
  export GOPATH="$srcdir"
  local ld_flags=" \
    -compressdwarf=false \
    -linkmode=external \
  "
  go build -v -ldflags "$ld_flags"
}

check() {
  cd $_pkgname-$pkgver
  local unit_tests=$(
    go list ./... | grep -v github.com/josephburnett/jd/web/ui
  )
  # shellcheck disable=2086
  go test $unit_tests
}

package() {
  cd $_pkgname-$pkgver
  install -vDm755 -t "$pkgdir/usr/bin" jd
  install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
}