| 1 |
blueness |
1.1 |
# Copyright 1999-2012 Gentoo Foundation
|
| 2 |
|
|
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
|
|
# $Header: $
|
| 4 |
|
|
|
| 5 |
|
|
EAPI="4"
|
| 6 |
|
|
|
| 7 |
|
|
inherit eutils
|
| 8 |
|
|
|
| 9 |
|
|
DESCRIPTION="Modular Bitcoin CPU/GPU/FPGA miner in C"
|
| 10 |
|
|
HOMEPAGE="https://bitcointalk.org/index.php?topic=78192.0"
|
| 11 |
|
|
SRC_URI="http://luke.dashjr.org/programs/bitcoin/files/${PN}/${PV}/${P}.tbz2"
|
| 12 |
|
|
|
| 13 |
|
|
LICENSE="GPL-3"
|
| 14 |
|
|
SLOT="0"
|
| 15 |
|
|
KEYWORDS="~amd64 ~x86"
|
| 16 |
|
|
|
| 17 |
|
|
IUSE="+adl altivec bitforce +cpumining examples hardened icarus modminer ncurses +opencl padlock scrypt sse2 sse2_4way sse4 +udev ztex"
|
| 18 |
|
|
REQUIRED_USE="
|
| 19 |
|
|
|| ( bitforce cpumining icarus modminer opencl ztex )
|
| 20 |
|
|
adl? ( opencl )
|
| 21 |
|
|
altivec? ( cpumining ppc ppc64 )
|
| 22 |
|
|
padlock? ( cpumining || ( amd64 x86 ) )
|
| 23 |
|
|
scrypt? ( || ( cpumining opencl ) )
|
| 24 |
|
|
sse2? ( cpumining || ( amd64 x86 ) )
|
| 25 |
|
|
sse4? ( cpumining amd64 )
|
| 26 |
|
|
"
|
| 27 |
|
|
|
| 28 |
|
|
DEPEND="
|
| 29 |
|
|
net-misc/curl
|
| 30 |
|
|
ncurses? (
|
| 31 |
|
|
sys-libs/ncurses
|
| 32 |
|
|
)
|
| 33 |
|
|
>=dev-libs/jansson-2
|
| 34 |
|
|
udev? (
|
| 35 |
|
|
sys-fs/udev
|
| 36 |
|
|
)
|
| 37 |
|
|
ztex? (
|
| 38 |
|
|
virtual/libusb:1
|
| 39 |
|
|
)
|
| 40 |
|
|
"
|
| 41 |
|
|
RDEPEND="${DEPEND}
|
| 42 |
|
|
opencl? (
|
| 43 |
|
|
virtual/opencl
|
| 44 |
|
|
)
|
| 45 |
|
|
"
|
| 46 |
|
|
DEPEND="${DEPEND}
|
| 47 |
|
|
virtual/pkgconfig
|
| 48 |
|
|
sys-apps/sed
|
| 49 |
|
|
sse2? (
|
| 50 |
|
|
>=dev-lang/yasm-1.0.1
|
| 51 |
|
|
)
|
| 52 |
|
|
sse4? (
|
| 53 |
|
|
>=dev-lang/yasm-1.0.1
|
| 54 |
|
|
)
|
| 55 |
|
|
"
|
| 56 |
|
|
|
| 57 |
|
|
src_prepare() {
|
| 58 |
|
|
sed -i 's/\(^\#define WANT_.*\(SSE\|PADLOCK\|ALTIVEC\)\)/\/\/ \1/' miner.h
|
| 59 |
|
|
}
|
| 60 |
|
|
|
| 61 |
|
|
src_configure() {
|
| 62 |
|
|
local CFLAGS="${CFLAGS}"
|
| 63 |
|
|
if ! use altivec; then
|
| 64 |
|
|
sed -i 's/-faltivec//g' configure
|
| 65 |
|
|
else
|
| 66 |
|
|
CFLAGS="${CFLAGS} -DWANT_ALTIVEC=1"
|
| 67 |
|
|
fi
|
| 68 |
|
|
use padlock && CFLAGS="${CFLAGS} -DWANT_VIA_PADLOCK=1"
|
| 69 |
|
|
if use sse2; then
|
| 70 |
|
|
if use amd64; then
|
| 71 |
|
|
CFLAGS="${CFLAGS} -DWANT_X8664_SSE2=1"
|
| 72 |
|
|
else
|
| 73 |
|
|
CFLAGS="${CFLAGS} -DWANT_X8632_SSE2=1"
|
| 74 |
|
|
fi
|
| 75 |
|
|
fi
|
| 76 |
|
|
use sse2_4way && CFLAGS="${CFLAGS} -DWANT_SSE2_4WAY=1"
|
| 77 |
|
|
use sse4 && CFLAGS="${CFLAGS} -DWANT_X8664_SSE4=1"
|
| 78 |
|
|
use hardened && CFLAGS="${CFLAGS} -nopie"
|
| 79 |
|
|
|
| 80 |
|
|
CFLAGS="${CFLAGS}" \
|
| 81 |
|
|
econf \
|
| 82 |
|
|
$(use_enable adl) \
|
| 83 |
|
|
$(use_enable bitforce) \
|
| 84 |
|
|
$(use_enable cpumining) \
|
| 85 |
|
|
$(use_enable icarus) \
|
| 86 |
|
|
$(use_enable modminer) \
|
| 87 |
|
|
$(use_with ncurses curses) \
|
| 88 |
|
|
$(use_enable opencl) \
|
| 89 |
|
|
$(use_enable scrypt) \
|
| 90 |
|
|
$(use_with udev libudev) \
|
| 91 |
|
|
$(use_enable ztex)
|
| 92 |
|
|
# sanitize directories
|
| 93 |
|
|
sed -i 's~^\(\#define CGMINER_PREFIX \).*$~\1"'"${EPREFIX}/usr/lib/bfgminer"'"~' config.h
|
| 94 |
|
|
}
|
| 95 |
|
|
|
| 96 |
|
|
src_install() {
|
| 97 |
|
|
dobin bfgminer
|
| 98 |
|
|
dodoc AUTHORS NEWS README API-README
|
| 99 |
|
|
if use scrypt; then
|
| 100 |
|
|
dodoc SCRYPT-README
|
| 101 |
|
|
fi
|
| 102 |
|
|
if use icarus || use bitforce; then
|
| 103 |
|
|
dodoc FPGA-README
|
| 104 |
|
|
fi
|
| 105 |
|
|
if use bitforce; then
|
| 106 |
|
|
dobin bitforce-firmware-flash
|
| 107 |
|
|
fi
|
| 108 |
|
|
if use modminer; then
|
| 109 |
|
|
insinto /usr/lib/bfgminer/modminer
|
| 110 |
|
|
doins bitstreams/fpgaminer*.bit
|
| 111 |
|
|
dodoc bitstreams/COPYING_fpgaminer
|
| 112 |
|
|
fi
|
| 113 |
|
|
if use opencl; then
|
| 114 |
|
|
insinto /usr/lib/bfgminer
|
| 115 |
|
|
doins *.cl
|
| 116 |
|
|
fi
|
| 117 |
|
|
if use ztex; then
|
| 118 |
|
|
insinto /usr/lib/bfgminer/ztex
|
| 119 |
|
|
doins bitstreams/ztex*.bit
|
| 120 |
|
|
dodoc bitstreams/COPYING_ztex
|
| 121 |
|
|
fi
|
| 122 |
|
|
if use examples; then
|
| 123 |
|
|
docinto examples
|
| 124 |
|
|
dodoc api-example.php miner.php API.java api-example.c
|
| 125 |
|
|
fi
|
| 126 |
|
|
cd libblkmaker
|
| 127 |
|
|
emake DESTDIR="$D" install
|
| 128 |
|
|
}
|