blob: 6ee6b5d590ecebc31f6f47ee8ac7ecc37545af9e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit cmake flag-o-matic git-r3
KERNELS_DIR="opt/lib"
DESCRIPTION="Ethereum miner with CUDA and stratum support"
HOMEPAGE="https://github.com/ethereum-mining/ethminer"
EGIT_REPO_URI="https://github.com/ethereum-mining/${PN}.git"
EGIT_SUBMODULES=( cmake/cable )
KEYWORDS=""
LICENSE="GPL-3+ LGPL-3+"
SLOT="0"
IUSE="apicore binkern cpu cuda dbus debug +opencl verbose-debug +system-opencl"
QA_PREBUILT="${KERNELS_DIR}/ethash_*"
RDEPEND="
dev-cpp/ethash
>=dev-cpp/libjson-rpc-cpp-1.0.0[http-client]
dev-libs/boost
dev-libs/jsoncpp
dev-libs/openssl
cuda? ( dev-util/nvidia-cuda-toolkit )
dbus? ( sys-apps/dbus )
opencl? ( virtual/opencl )
"
DEPEND="${RDEPEND}
dbus? ( virtual/pkgconfig )
acct-user/ethminer
"
BDEPEND="
>=dev-util/cmake-3.5
dev-cpp/cli11
virtual/pkgconfig
"
PATCHES=(
"${FILESDIR}"/${PV}-fix_compilation_issues.patch
)
src_unpack() {
default
if [[ ${PV} == 9999 ]]
then
git-r3_src_unpack
return
fi
rmdir "${S}"/cmake/cable || die
mv cable-${CABLE_VER} "${S}"/cmake/cable || die
}
src_prepare() {
rm cmake/cable/HunterGate.cmake || die
find -name CMakeLists.txt | xargs sed -i \
-e '/find_package/ s/CONFIG//' \
-e '/hunter_add_package/d'
find -name *.h | xargs sed -i \
-e '/include.*json/ s:json/json\.h:jsoncpp/&:'
sed -i \
-e '/include.*Hunter/d' \
-e '/^HunterGate(/,/^)/d' \
-e '/cable_set_build_type/d' \
-e '/find_package.*jsoncpp/d' \
CMakeLists.txt || die
sed -i \
-e '/include_directories.+BEFORE/ s:\.\.:& \.:' \
-e '/find_package.*CLI11/d' \
-e '/target_link_libraries/ s/CLI11::CLI11//' \
-e 's/target_link_libraries.*ethminer.*PRIVATE/& crypto/' \
-e '/find_package.*PkgConfig/ s/PkgConfig/DBus1 REQUIRED/' \
-e '/set.*ENV/d' \
-e '/pkg_check_modules.*DBUS/d' \
-e '/include_directories.*DBUS_INCLUDE_DIRS/ s/DBUS/DBus1/' \
-e '/link_directories.*DBUS/d' \
-e '/target_link_libraries.*DBUS_LIBRARIES/ s/DBUS_LIBRARIES/DBus1_LIBRARY/' \
ethminer/CMakeLists.txt || die
sed -i \
-e '/target_link_libraries/ s/ethcore//' \
libethash-{cl,cpu,cuda}/CMakeLists.txt
sed -i \
-e "/install/ s:\(DESTINATION.*\)\$.*kernels:\1/${KERNELS_DIR}:" \
libethash-cl/kernels/CMakeLists.txt
sed -i \
-e 's/jsoncpp_lib_static/jsoncpp/' \
-e 's/jsoncpp_static/jsoncpp/' \
libpoolprotocols/CMakeLists.txt || die
sed -i \
-e 's/fname_strm.*<<.*program_location.*/fname_strm/' \
-e "s:/kernels/ethash_:/${KERNELS_DIR}/ethash_:" \
libethash-cl/CLMiner.cpp
sed -i \
-e 's/get_io_service()/context()/' \
libethcore/Farm.cpp || die
sed -i \
-e '/boost::bind/ s/_1/boost::placeholders::_1/' \
libpoolprotocols/getwork/EthGetworkClient.cpp || die
if [[ ${PV} != 9999 ]]
then
sed -i -e '/find_package.*Git/d' \
cmake/cable/CableBuildInfo.cmake
fi
# fix build with >nvidia-cuda-toolkit-10.2 (https://stackoverflow.com/q/64774548/5424487)
sed -i -e 's/compute_30/compute_50/' -e 's/sm_30/sm_50/' libethash-cuda/CMakeLists.txt || die
cmake_src_prepare
}
src_configure() {
local mycxxflags=(
-Wno-deprecated-declarations
-I"${WORKDIR}/CLI11-${CLI11_VER}/include"
-DBOOST_BIND_GLOBAL_PLACEHOLDERS
)
append-cxxflags ${mycxxflags[@]}
local mycmakeargs=(
-DBUILD_SHARED_LIBS=OFF
-DAPICORE=$(usex apicore)
-DBINKERN=$(usex binkern)
-DDEVBUILD=$(usex verbose-debug)
-DETHASHCL=$(usex opencl)
-DETHASHCPU=$(usex cpu)
-DETHASHCUDA=$(usex cuda)
-DETHDBUS=$(usex dbus)
-DUSE_SYS_OPENCL=$(usex system-opencl)
)
cmake_src_configure
}
src_install() {
cmake_src_install
## newinitd "${FILESDIR}/${PN}-initd" "${PN}"
## newconfd "${FILESDIR}/${PN}-confd" "${PN}"
keepdir /var/{lib,log}/ethminer
fowners ethminer:ethminer /var/{lib,log}/ethminer
}
|