net-p2p/torrentinfo: amd64 stable wrt bug #721410
[gentoo.git] / net-p2p / bitcoin-qt / bitcoin-qt-0.16.3.ebuild
1 # Copyright 2010-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 DB_VER="4.8"
7 inherit autotools bash-completion-r1 db-use desktop gnome2-utils xdg-utils
8
9 BITCOINCORE_COMMITHASH="49e34e288005a5b144a642e197b628396f5a0765"
10 KNOTS_PV="${PV}.knots20180918"
11 KNOTS_P="bitcoin-${KNOTS_PV}"
12
13 DESCRIPTION="An end-user Qt GUI for the Bitcoin crypto-currency"
14 HOMEPAGE="https://bitcoincore.org/ https://bitcoinknots.org/"
15 SRC_URI="
16         https://github.com/bitcoin/bitcoin/archive/${BITCOINCORE_COMMITHASH}.tar.gz -> bitcoin-v${PV}.tar.gz
17         https://bitcoinknots.org/files/0.16.x/${KNOTS_PV}/${KNOTS_P}.patches.txz -> ${KNOTS_P}.patches.tar.xz
18 "
19
20 LICENSE="MIT"
21 SLOT="0"
22 KEYWORDS="amd64 ~arm ~arm64 ~ppc x86 ~amd64-linux ~x86-linux"
23
24 IUSE="+asm +bip70 dbus kde +libevent knots libressl +qrcode test upnp +wallet zeromq"
25 RESTRICT="!test? ( test )"
26
27 RDEPEND="
28         >=dev-libs/boost-1.52.0:=[threads(+)]
29         >=dev-libs/libsecp256k1-0.0.0_pre20151118:=[recovery]
30         dev-libs/univalue:=
31         dev-qt/qtcore:5
32         dev-qt/qtgui:5
33         dev-qt/qtnetwork:5
34         dev-qt/qtwidgets:5
35         virtual/bitcoin-leveldb
36         bip70? ( dev-libs/protobuf:= )
37         dbus? (
38                 dev-qt/qtdbus:5
39         )
40         libevent? ( dev-libs/libevent:= )
41         !libressl? ( dev-libs/openssl:0=[-bindist] )
42         libressl? ( dev-libs/libressl:0= )
43         qrcode? (
44                 media-gfx/qrencode:=
45         )
46         upnp? ( >=net-libs/miniupnpc-1.9.20150916:= )
47         wallet? ( sys-libs/db:$(db_ver_to_slot "${DB_VER}")=[cxx] )
48         zeromq? ( net-libs/zeromq:= )
49 "
50 DEPEND="${RDEPEND}
51         dev-qt/linguist-tools:5
52         knots? (
53                 gnome-base/librsvg
54                 media-gfx/imagemagick[png]
55         )
56 "
57
58 DOCS=( doc/bips.md doc/files.md doc/release-notes.md )
59
60 S="${WORKDIR}/bitcoin-${BITCOINCORE_COMMITHASH}"
61
62 pkg_pretend() {
63         if use knots; then
64                 elog "You are building ${PN} from Bitcoin Knots."
65                 elog "For more information, see:"
66                 elog "https://bitcoinknots.org/files/0.16.x/${KNOTS_PV}/${KNOTS_P}.desc.html"
67         else
68                 elog "You are building ${PN} from Bitcoin Core."
69                 elog "For more information, see:"
70                 elog "https://bitcoincore.org/en/2018/09/18/release-${PV}/"
71         fi
72         elog "Replace By Fee policy is now always enabled by default: Your node will"
73         elog "preferentially mine and relay transactions paying the highest fee, regardless"
74         elog "of receive order. To disable RBF, set mempoolreplacement=never in bitcoin.conf"
75 }
76
77 src_prepare() {
78         sed -i 's/^\(complete -F _bitcoind \)bitcoind \(bitcoin-qt\)$/\1\2/' contrib/bitcoind.bash-completion || die
79
80         # Save the generic icon for later
81         cp src/qt/res/src/bitcoin.svg bitcoin128.svg || die
82
83         local knots_patchdir="${WORKDIR}/${KNOTS_P}.patches/"
84
85         eapply "${FILESDIR}"/${PN}-0.16.3-boost-1.72-missing-include.patch
86         eapply "${knots_patchdir}/${KNOTS_P}.syslibs.patch"
87
88         if use knots; then
89                 eapply "${knots_patchdir}/${KNOTS_P}.f.patch"
90                 eapply "${knots_patchdir}/${KNOTS_P}.branding.patch"
91                 eapply "${knots_patchdir}/${KNOTS_P}.ts.patch"
92         fi
93
94         eapply_user
95
96         echo '#!/bin/true' >share/genbuild.sh || die
97         mkdir -p src/obj || die
98         echo "#define BUILD_SUFFIX gentoo${PVR#${PV}}" >src/obj/build.h || die
99
100         eautoreconf
101         rm -r src/leveldb src/secp256k1 || die
102 }
103
104 src_configure() {
105         local my_econf=(
106                 $(use_enable asm)
107                 $(use_enable bip70)
108                 $(use_with dbus qtdbus)
109                 $(use_with libevent)
110                 $(use_with qrcode qrencode)
111                 $(use_with upnp miniupnpc)
112                 $(use_enable upnp upnp-default)
113                 $(use_enable test tests)
114                 $(use_enable wallet)
115                 $(use_enable zeromq zmq)
116                 --with-gui=qt5
117                 --disable-util-cli
118                 --disable-util-tx
119                 --disable-bench
120                 --without-libs
121                 --without-daemon
122                 --disable-ccache
123                 --disable-static
124                 --with-system-leveldb
125                 --with-system-libsecp256k1
126                 --with-system-univalue
127         )
128         econf "${my_econf[@]}"
129 }
130
131 src_install() {
132         default
133
134         rm -f "${ED}/usr/bin/test_bitcoin" || die
135
136         insinto /usr/share/icons/hicolor/scalable/apps/
137         doins bitcoin128.svg
138         if use knots; then
139                 newins src/qt/res/src/bitcoin.svg bitcoinknots.svg
140         fi
141
142         newmenu "contrib/debian/bitcoin-qt.desktop" "org.bitcoin.bitcoin-qt.desktop"
143
144         use libevent && dodoc doc/REST-interface.md doc/tor.md
145
146         use zeromq && dodoc doc/zmq.md
147
148         newbashcomp contrib/bitcoind.bash-completion ${PN}
149
150         if use kde; then
151                 insinto /usr/share/kservices5
152                 doins contrib/debian/bitcoin-qt.protocol
153                 dosym "../../kservices5/bitcoin-qt.protocol" "/usr/share/kde4/services/bitcoin-qt.protocol"
154         fi
155 }
156
157 update_caches() {
158         gnome2_icon_cache_update
159         xdg_desktop_database_update
160 }
161
162 pkg_postinst() {
163         update_caches
164
165         if use libevent; then
166                 elog "To have ${PN} automatically use Tor when it's running, be sure your"
167                 elog "'torrc' config file has 'ControlPort' and 'CookieAuthentication' setup"
168                 elog "correctly, and add your user to the 'tor' user group."
169         fi
170 }
171
172 pkg_postrm() {
173         update_caches
174 }