# Copyright 1999-2018 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=7 inherit autotools bash-completion-r1 desktop systemd user xdg-utils MY_PN="BitcoinUnlimited" MY_P="bucash${PV/_/-}" DESCRIPTION="A full node Bitcoin (and Bitcoin Cash) implementation with GUI, daemon and utils" HOMEPAGE="https://www.bitcoinunlimited.info" SRC_URI="https://github.com/${MY_PN}/${MY_PN}/archive/${MY_P}.tar.gz -> ${P}.tar.gz" RESTRICT="mirror" LICENSE="MIT" SLOT="bucash" KEYWORDS="~amd64 ~arm ~arm64 ~x86" IUSE="daemon dbus +gui hardened libressl +qrcode +reduce-exports upnp utils +wallet zeromq" REQUIRED_USE="dbus? ( gui ) qrcode? ( gui )" CDEPEND=" dev-libs/boost:0=[threads(+)] dev-libs/libevent gui? ( dev-libs/protobuf dev-qt/qtgui:5 dev-qt/qtnetwork:5 dev-qt/qtwidgets:5 dbus? ( dev-qt/qtdbus:5 ) qrcode? ( media-gfx/qrencode ) ) !libressl? ( dev-libs/openssl:0=[-bindist] ) libressl? ( dev-libs/libressl:0= ) upnp? ( net-libs/miniupnpc ) wallet? ( sys-libs/db:4.8[cxx] ) zeromq? ( net-libs/zeromq ) " DEPEND="${CDEPEND} gui? ( dev-qt/linguist-tools:5 ) " RDEPEND="${CDEPEND} daemon? ( !net-p2p/bitcoind !net-p2p/bitcoinxt[daemon] !net-p2p/bitcoin-abc[daemon] ) gui? ( !net-p2p/bitcoin-qt !net-p2p/bitcoinxt[gui] !net-p2p/bitcoin-abc[gui] ) utils? ( !net-p2p/bitcoin-cli !net-p2p/bitcoin-tx !net-p2p/bitcoinxt[utils] !net-p2p/bitcoin-abc[utils] )" S="${WORKDIR}/${MY_PN}-${MY_P}" pkg_setup() { if use daemon; then enewgroup bitcoin enewuser bitcoin -1 -1 /var/lib/bitcoin bitcoin fi } src_prepare() { use daemon || sed -i 's/have bitcoind &&//;s/^\(complete -F _bitcoind \)bitcoind \(bitcoin-cli\)$/\1\2/' \ contrib/bitcoind.bash-completion || die use utils || sed -i 's/have bitcoind &&//;s/^\(complete -F _bitcoind bitcoind\) bitcoin-cli$/\1/' \ contrib/bitcoind.bash-completion || die echo '#!/bin/true' >share/genbuild.sh || die mkdir -p src/obj || die echo "#define BUILD_SUFFIX gentoo${PVR#${PV}}" >src/obj/build.h || die default eautoreconf } src_configure() { # shellcheck disable=SC2207 local myeconf=( --without-libs --disable-bench --disable-ccache --disable-maintainer-mode --disable-tests $(use_with daemon) $(use_with gui) $(use_with qrcode qrencode) $(use_with upnp miniupnpc) $(use_with utils) $(use_enable hardened hardening) $(use_enable reduce-exports) $(use_enable wallet) $(use_enable zeromq zmq) ) econf "${myeconf[@]}" } src_install() { default if use daemon; then newinitd "${FILESDIR}/${PN}.initd" "${PN}" newconfd "${FILESDIR}/${PN}.confd" "${PN}" systemd_newunit "${FILESDIR}/${PN}.service-r1" "${PN}.service" insinto /etc/bitcoin newins "${FILESDIR}/${PN}.conf" bitcoin.conf fowners bitcoin:bitcoin /etc/bitcoin/bitcoin.conf fperms 600 /etc/bitcoin/bitcoin.conf newins contrib/debian/examples/bitcoin.conf bitcoin.conf.example doins share/rpcuser/rpcuser.py dodoc doc/{bu-xthin,tor}.md doman contrib/debian/manpages/{bitcoind.1,bitcoin.conf.5} newbashcomp contrib/bitcoind.bash-completion bitcoin insinto /etc/logrotate.d newins "${FILESDIR}/${PN}.logrotate" "${PN}" diropts -o bitcoin -g bitcoin -m 0750 keepdir /var/lib/bitcoin/.bitcoin fi if use gui; then local X for X in 16 24 32 64 128 256 512; do newicon -s ${X} "share/pixmaps/bitcoin${X}.png" bitcoin.png done # shellcheck disable=SC1117 make_desktop_entry "bitcoin-qt %u" "Bitcoin Unlimited Cash" "bitcoin" \ "Qt;Network;P2P;Office;Finance;" "MimeType=x-scheme-handler/bitcoincash;\nTerminal=false" use daemon || dodoc doc/{bu-xthin,tor}.md doman contrib/debian/manpages/bitcoin-qt.1 fi if use utils; then doman contrib/debian/manpages/bitcoin-cli.1 use daemon || newbashcomp contrib/bitcoind.bash-completion bitcoin fi } update_caches() { if type gtk-update-icon-cache &>/dev/null; then ebegin "Updating GTK icon cache" gtk-update-icon-cache "${EROOT}/usr/share/icons/hicolor" eend $? fi xdg_desktop_database_update } pkg_postinst() { use gui && update_caches } pkg_postrm() { use gui && update_caches }