summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9095465c0bb16c47b94e919dfd8d7180405ba51d (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# Maintainer: Andy Weidenbaum <archbaum@gmail.com>

pkgbase=btcd
pkgname=('btcd' 'btcwallet')
pkgver=20170818
pkgrel=1
arch=('i686' 'x86_64')
makedepends=('git' 'glide' 'go')
groups=('btcsuite')
url="https://github.com/btcsuite"
license=('ISC')
options=('!strip' '!emptydirs')
source=(git+https://github.com/btcsuite/btcd
        git+https://github.com/btcsuite/btcwallet)
sha256sums=('SKIP' 'SKIP')

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

prepare() {
  export GOPATH="$srcdir"
  git clone "$srcdir/btcd" "$GOPATH/src/github.com/btcsuite/btcd"
  git clone "$srcdir/btcwallet" "$GOPATH/src/github.com/btcsuite/btcwallet"
}

build() {
  export GOPATH="$srcdir"

  msg2 'Building btcd and dependencies...'
  cd "$GOPATH/src/github.com/btcsuite/btcd"
  glide install
  go install . ./cmd/...

  msg2 'Building btcwallet and dependencies...'
  cd "$GOPATH/src/github.com/btcsuite/btcwallet"
  glide install
  go install . ./cmd/...

  msg2 'Prepending btc to unqualified binaries...'
  for _bin in $(find "$srcdir/bin"  \
                        -mindepth 1 \
                        -maxdepth 1 \
                        -type f ! -name "btc*" -printf '%f\n'); do
    mv "$srcdir/bin/$_bin" "$srcdir/bin/btc$_bin"
  done
}

package_btcd() {
  pkgdesc="An alternative full node Bitcoin implementation written in Go"
  provides=('btcd')
  conflicts=('btcd')

  msg2 'Installing btcd license...'
  install -Dm 644 "$srcdir/src/github.com/btcsuite/btcd/LICENSE" \
          -t "$pkgdir/usr/share/licenses/btcd"

  msg2 'Installing btcd docs...'
  for _doc in CHANGES README.md sample-btcd.conf; do
    install -Dm 644 "$srcdir/src/github.com/btcsuite/btcd/$_doc" \
            -t "$pkgdir/usr/share/doc/btcd"
  done
  cp -dpr --no-preserve=ownership "$srcdir/src/github.com/btcsuite/btcd/docs" \
    "$pkgdir/usr/share/doc/btcd"

  msg2 'Installing btcd...'
  for _bin in btcaddblock \
              btcctl \
              btcd \
              btcfindcheckpoint \
              btcgencerts; do
    install -Dm 755 "$srcdir/bin/$_bin" -t "$pkgdir/usr/bin"
  done

  msg2 'Cleaning up pkgdir...'
  find "$pkgdir" -type d -name .git -exec rm -r '{}' +
  find "$pkgdir" -type f -name .gitignore -exec rm -r '{}' +
}

package_btcwallet() {
  pkgdesc="Secure Bitcoin wallet daemon written in Go"
  provides=('btcwallet')
  conflicts=('btcwallet')

  msg2 'Installing btcwallet license...'
  install -Dm 644 "$srcdir/src/github.com/btcsuite/btcwallet/LICENSE" \
          -t "$pkgdir/usr/share/licenses/btcwallet"

  msg2 'Installing btcwallet docs...'
  for _doc in CHANGES README.md sample-btcwallet.conf; do
    install -Dm 644 "$srcdir/src/github.com/btcsuite/btcwallet/$_doc" \
            -t "$pkgdir/usr/share/doc/btcwallet"
  done
  cp -dpr --no-preserve=ownership \
    "$srcdir/src/github.com/btcsuite/btcwallet/docs" \
    "$pkgdir/usr/share/doc/btcwallet"

  msg2 'Installing btcwallet...'
  for _bin in btcdropwtxmgr \
              btcsweepaccount \
              btcwallet; do
    install -Dm 755 "$srcdir/bin/$_bin" -t "$pkgdir/usr/bin"
  done

  msg2 'Cleaning up pkgdir...'
  find "$pkgdir" -type d -name .git -exec rm -r '{}' +
  find "$pkgdir" -type f -name .gitignore -exec rm -r '{}' +
}