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

pkgname=libbitcoin-server-git
pkgver=20151221
pkgrel=1
pkgdesc="Bitcoin Full Node and Query Server"
arch=('i686' 'x86_64')
makedepends=('autoconf'
             'automake'
             'boost'
             'boost-libs'
             'czmq-git'
             'czmqpp-git'
             'gcc'
             'git'
             'libbitcoin'
             'libbitcoin-blockchain'
             'libbitcoin-consensus'
             'libbitcoin-node'
             'libconfig'
             'libsodium'
             'libtool'
             'make'
             'pkg-config'
             'secp256k1-git'
             'zeromq')
optdepends=('libbitcoin-explorer: CurveZMQ client/server authentication')
groups=('libbitcoin')
url="https://github.com/libbitcoin/libbitcoin-server"
license=('AGPL3')
source=(git+https://github.com/libbitcoin/libbitcoin-server#branch=version2
        git+https://github.com/libbitcoin/libbitcoin-server.wiki
        bs.logrotate
        bs.service
        bsinit.service)
sha256sums=('SKIP'
            'SKIP'
            '09ea3d2bf7cb87a0760c2a73893d62d1868d232c9e925cabf6140b1b031efee3'
            '564112d0860f1523049bd89779e1b1bfc189a3d143d2cc808441981ed793658a'
            '2bcf3615cd8e5ba6d4c78429b018b9bf756d5fad6ab879963a13f19e47315c7d')
provides=('libbitcoin-server')
conflicts=('libbitcoin-server')
install=bs.install

pkgver() {
  cd ${pkgname%-git}
  git log -1 --format="%cd" --date=short | sed "s|-||g"
}

prepare() {
  cd ${pkgname%-git}

  msg2 'Configuring...'
  cp -dpr --no-preserve=ownership data/bs.cfg data/bs.cfg.in
  sed -i 's@^database_path.*@database_path = /srv/bs/blockchain@' data/bs.cfg.in
  sed -i 's@^debug_file.*@debug_file = /var/log/bs/debug.log@' data/bs.cfg.in
  sed -i 's@^error_file.*@error_file = /var/log/bs/error.log@' data/bs.cfg.in
  sed -i 's@^hosts_file.*@hosts_file = /etc/bs/hosts.cache@' data/bs.cfg.in
}

build() {
  cd ${pkgname%-git}

  msg2 'Building...'
  ./autogen.sh
  ./configure \
    --prefix=/usr \
    --sbindir=/usr/bin \
    --libexecdir=/usr/lib/libbitcoin-server \
    --sysconfdir=/etc \
    --sharedstatedir=/usr/share/libbitcoin-server \
    --localstatedir=/var/lib/libbitcoin-server \
    --with-bash-completiondir=/usr/share/bash-completion/completions \
    --with-gnu-ld
  make
}

package() {
  cd ${pkgname%-git}

  msg2 'Installing license...'
  install -Dm 644 COPYING -t "$pkgdir/usr/share/licenses/libbitcoin-server"

  msg2 'Installing...'
  install -dm 700 "$pkgdir/etc/bs"
  install -dm 700 "$pkgdir/srv/bs"
  make DESTDIR="$pkgdir" install

  msg2 'Installing documentation...'
  cp -dpr --no-preserve=ownership "$srcdir/libbitcoin-server.wiki" \
    "$pkgdir/usr/share/doc/libbitcoin-server/wiki"

  msg2 'Installing conf...'
  install -Dm 600 data/bs.cfg.in "$pkgdir/etc/bs/bs.cfg"

  msg2 'Installing systemd service files...'
  install -Dm 644 "$srcdir/bs.service" \
    "$pkgdir/usr/lib/systemd/system/bs.service"
  install -Dm 644 "$srcdir/bsinit.service" \
    "$pkgdir/usr/lib/systemd/system/bsinit.service"

  msg2 'Installing logrotate conf...'
  install -dm 700 "$pkgdir/var/log/bs"
  install -Dm 644 "$srcdir/bs.logrotate" "$pkgdir/etc/logrotate.d/bs"

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