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