summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 1a5d9c499edb1818ff33c27eb92979dbe98fc7ff (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
# Maintainer: Nicola Squartini <tensor5@gmail.com>
# Maintainer: kpcyrd <kpcyrd[at]archlinux[dot]org>

pkgname=zcash
pkgver=5.3.0
_commit=35186b00928f3ba994f0e66bb234c412cbffc7b6
_db_version=6.2.23
pkgrel=4
pkgdesc='Permissionless financial system employing zero-knowledge security'
arch=('x86_64')
url='https://z.cash/'
license=('MIT')
depends=('boost-libs' 'libevent' 'libsodium' 'zeromq')
makedepends=('boost' 'clang' 'cmake' 'cxxbridge' 'git' 'gmock' 'python' 'rust' 'utf8cpp' 'wget')
options=(!lto)
source=("git+https://github.com/zcash/zcash.git#commit=${_commit}"
        "https://download.oracle.com/berkeley-db/db-${_db_version}.tar.gz"
        'zcashd.service')
sha256sums=('SKIP'
            '47612c8991aa9ac2f6be721267c8d3cdccf5ac83105df8e50809daea24e95dc7'
            '7b0919ac447824199aff8c17b5a5799b46414818c6aed314506c5295d0ce9ccd')

get_rust_target() {
    RUSTC_BOOTSTRAP=1 rustc -Z unstable-options --print target-spec-json | python -c 'import json,sys;obj=json.load(sys.stdin);print(obj["llvm-target"])'
}

build() {
    cd "db-${_db_version}/build_unix"

    ../dist/configure \
        --prefix=/ \
        --disable-shared \
        --enable-cxx \
        --disable-replication \
        --enable-option-checking \
        --with-pic
    make libdb_cxx-6.2.a libdb-6.2.a
    make DESTDIR="${srcdir}/db-root" install

    cd "${srcdir}/${pkgname}"

    CPPFLAGS="${CPPFLAGS} -I${srcdir}/db-root/include -I/usr/include/utf8cpp"
    LDFLAGS="${LDFLAGS} -L${srcdir}/db-root/lib"

    export CC=/usr/bin/clang
    export CXX=/usr/bin/clang++

    ./autogen.sh
    ./configure --prefix=/usr \
        --enable-online-rust
    cp /usr/share/cxxbridge/cxx.h src/rust/include/rust/
    make RUST_TARGET="$(get_rust_target)"
}

package() {
    cd ${pkgname}

    make DESTDIR="${pkgdir}" RUST_TARGET="$(get_rust_target)" install

    for ext in '-cli' '-tx' 'd'; do
        install -Dm644 contrib/zcash${ext}.bash-completion \
            "${pkgdir}"/usr/share/bash-completion/completions/zcash${ext}
    done

    install -Dm644 ../zcashd.service -t "${pkgdir}"/usr/lib/systemd/user
    install -Dm644 COPYING "${pkgdir}"/usr/share/licenses/${pkgname}/COPYING
}