summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 8bf09e6babc799d52677272101586e90c38d8c66 (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
# Maintainer: Andy Weidenbaum <archbaum@gmail.com>

pkgname=dcrdata-git
pkgver=20220501
pkgrel=1
pkgdesc="Decred block explorer"
arch=('aarch64' 'armv6h' 'armv7h' 'i686' 'x86_64')
makedepends=('nodejs' 'npm' 'git' 'go')
groups=('decred')
url="https://github.com/decred/dcrdata"
license=('ISC')
options=('!strip' '!emptydirs')
source=(git+https://github.com/decred/dcrdata)
sha256sums=('SKIP')
provides=('dcrdata')
conflicts=('dcrdata')

pkgver() {
  date +%Y%m%d
}

prepare() {
  rm -rf $srcdir/checkout
  git clone "$srcdir/dcrdata" "$srcdir/checkout"
}

build() {
  msg2 'Building dcrdata and dependencies...'
  export GO111MODULE=on
  cd "$srcdir/checkout/cmd/dcrdata"
  go build -trimpath -v -ldflags "-s -w"  .
  npm clean-install
  npm run build
}

package() {
  msg2 'Installing license...'
  install -Dm 644 "$srcdir/checkout/LICENSE" \
          -t "$pkgdir/usr/share/licenses/dcrdata"

  msg2 'Installing docs...'
  for _doc in README.md \
              cmd/dcrdata/sample-dcrdata.conf \
              cmd/dcrdata/sample-nginx.conf \
              cmd/dcrdata/sample-rate_limiting.html; do
    install -Dm 644 "$srcdir/checkout/$_doc" \
            -t "$pkgdir/usr/share/doc/dcrdata"
  done

  msg2 'Installing...'
  install -Dm 755 "$srcdir/checkout/cmd/dcrdata/dcrdata" -t "$pkgdir/usr/bin"
  cp -R "$srcdir/checkout/cmd/dcrdata/views" "$srcdir/checkout/cmd/dcrdata/public" "$pkgdir/usr/bin"
}