| 1 |
# Copyright 2010-2012 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: $
|
| 4 |
|
| 5 |
EAPI="4"
|
| 6 |
|
| 7 |
DB_VER="4.8"
|
| 8 |
|
| 9 |
inherit db-use eutils versionator toolchain-funcs
|
| 10 |
|
| 11 |
DESCRIPTION="Original Bitcoin crypto-currency wallet for automated services"
|
| 12 |
HOMEPAGE="http://bitcoin.org/"
|
| 13 |
SRC_URI="http://gitorious.org/bitcoin/bitcoind-stable/archive-tarball/v${PV/_/} -> bitcoin-v${PV}.tgz
|
| 14 |
bip16? ( http://luke.dashjr.org/programs/bitcoin/files/bip16/0.5.6-Minimal-support-for-mining-BIP16-pay-to-script-hash-.patch.xz )
|
| 15 |
eligius? (
|
| 16 |
!bip16? ( http://luke.dashjr.org/programs/bitcoin/files/eligius_sendfee/0.5.0.6rc1-eligius_sendfee.patch.xz )
|
| 17 |
)
|
| 18 |
"
|
| 19 |
|
| 20 |
LICENSE="MIT ISC GPL-2"
|
| 21 |
SLOT="0"
|
| 22 |
KEYWORDS="~amd64 ~arm ~x86"
|
| 23 |
IUSE="+bip16 +eligius examples logrotate ssl upnp"
|
| 24 |
|
| 25 |
RDEPEND="
|
| 26 |
>=dev-libs/boost-1.41.0
|
| 27 |
dev-libs/openssl[-bindist]
|
| 28 |
logrotate? (
|
| 29 |
app-admin/logrotate
|
| 30 |
)
|
| 31 |
upnp? (
|
| 32 |
net-libs/miniupnpc
|
| 33 |
)
|
| 34 |
sys-libs/db:$(db_ver_to_slot "${DB_VER}")[cxx]
|
| 35 |
"
|
| 36 |
DEPEND="${RDEPEND}
|
| 37 |
>=app-shells/bash-4.1
|
| 38 |
"
|
| 39 |
|
| 40 |
S="${WORKDIR}/bitcoin-bitcoind-stable"
|
| 41 |
|
| 42 |
pkg_setup() {
|
| 43 |
local UG='bitcoin'
|
| 44 |
enewgroup "${UG}"
|
| 45 |
enewuser "${UG}" -1 -1 /var/lib/bitcoin "${UG}"
|
| 46 |
}
|
| 47 |
|
| 48 |
src_prepare() {
|
| 49 |
cd src || die
|
| 50 |
if use bip16; then
|
| 51 |
epatch "${WORKDIR}/0.5.6-Minimal-support-for-mining-BIP16-pay-to-script-hash-.patch"
|
| 52 |
use eligius && epatch "${FILESDIR}/0.5.0.5+bip16-eligius_sendfee.patch"
|
| 53 |
else
|
| 54 |
use eligius && epatch "${WORKDIR}/0.5.0.6rc1-eligius_sendfee.patch"
|
| 55 |
fi
|
| 56 |
use logrotate && epatch "${FILESDIR}/0.4.7-reopen_log_file.patch"
|
| 57 |
}
|
| 58 |
|
| 59 |
src_compile() {
|
| 60 |
OPTS=()
|
| 61 |
local BOOST_PKG BOOST_VER BOOST_INC
|
| 62 |
|
| 63 |
OPTS+=("DEBUGFLAGS=")
|
| 64 |
OPTS+=("CXXFLAGS=${CXXFLAGS}")
|
| 65 |
OPTS+=("LDFLAGS=${LDFLAGS}")
|
| 66 |
|
| 67 |
OPTS+=("BDB_INCLUDE_PATH=$(db_includedir "${DB_VER}")")
|
| 68 |
OPTS+=("BDB_LIB_SUFFIX=-${DB_VER}")
|
| 69 |
|
| 70 |
BOOST_PKG="$(best_version 'dev-libs/boost')"
|
| 71 |
BOOST_VER="$(get_version_component_range 1-2 "${BOOST_PKG/*boost-/}")"
|
| 72 |
BOOST_VER="$(replace_all_version_separators _ "${BOOST_VER}")"
|
| 73 |
BOOST_INC="/usr/include/boost-${BOOST_VER}"
|
| 74 |
OPTS+=("BOOST_INCLUDE_PATH=${BOOST_INC}")
|
| 75 |
OPTS+=("BOOST_LIB_SUFFIX=-${BOOST_VER}")
|
| 76 |
|
| 77 |
use ssl && OPTS+=(USE_SSL=1)
|
| 78 |
if use upnp; then
|
| 79 |
OPTS+=(USE_UPNP=1)
|
| 80 |
else
|
| 81 |
OPTS+=(USE_UPNP=)
|
| 82 |
fi
|
| 83 |
|
| 84 |
cd src || die
|
| 85 |
emake CC="$(tc-getCC)" CXX="$(tc-getCXX)" -f makefile.unix "${OPTS[@]}" ${PN}
|
| 86 |
}
|
| 87 |
|
| 88 |
src_test() {
|
| 89 |
cd src || die
|
| 90 |
emake CC="$(tc-getCC)" CXX="$(tc-getCXX)" -f makefile.unix "${OPTS[@]}" test_bitcoin
|
| 91 |
./test_bitcoin || die 'Tests failed'
|
| 92 |
}
|
| 93 |
|
| 94 |
src_install() {
|
| 95 |
dobin src/${PN}
|
| 96 |
|
| 97 |
insinto /etc/bitcoin
|
| 98 |
newins "${FILESDIR}/bitcoin.conf" bitcoin.conf
|
| 99 |
fowners bitcoin:bitcoin /etc/bitcoin/bitcoin.conf
|
| 100 |
fperms 600 /etc/bitcoin/bitcoin.conf
|
| 101 |
|
| 102 |
newconfd "${FILESDIR}/bitcoin.confd" ${PN}
|
| 103 |
newinitd "${FILESDIR}/bitcoin.initd" ${PN}
|
| 104 |
|
| 105 |
keepdir /var/lib/bitcoin/.bitcoin
|
| 106 |
fperms 700 /var/lib/bitcoin
|
| 107 |
fowners bitcoin:bitcoin /var/lib/bitcoin/
|
| 108 |
fowners bitcoin:bitcoin /var/lib/bitcoin/.bitcoin
|
| 109 |
dosym /etc/bitcoin/bitcoin.conf /var/lib/bitcoin/.bitcoin/bitcoin.conf
|
| 110 |
|
| 111 |
dodoc doc/README
|
| 112 |
|
| 113 |
if use examples; then
|
| 114 |
docinto examples
|
| 115 |
dodoc -r contrib/{bitrpc,pyminer,wallettools}
|
| 116 |
fi
|
| 117 |
|
| 118 |
if use logrotate; then
|
| 119 |
insinto /etc/logrotate.d
|
| 120 |
newins "${FILESDIR}/bitcoind.logrotate" bitcoind
|
| 121 |
fi
|
| 122 |
}
|