net-p2p/xmr-stak: Unified all-in-one Monero miner
authorCraig Andrews <candrews@gentoo.org>
Sat, 23 Dec 2017 15:37:54 +0000 (10:37 -0500)
committerCraig Andrews <candrews@gentoo.org>
Sat, 23 Dec 2017 19:10:31 +0000 (14:10 -0500)
Package-Manager: Portage-2.3.19, Repoman-2.3.6

net-p2p/xmr-stak/Manifest [new file with mode: 0644]
net-p2p/xmr-stak/files/xmr-stak.service [new file with mode: 0644]
net-p2p/xmr-stak/metadata.xml [new file with mode: 0644]
net-p2p/xmr-stak/xmr-stak-2.2.0.ebuild [new file with mode: 0644]
net-p2p/xmr-stak/xmr-stak-9999.ebuild [new file with mode: 0644]

diff --git a/net-p2p/xmr-stak/Manifest b/net-p2p/xmr-stak/Manifest
new file mode 100644 (file)
index 0000000..6fa8434
--- /dev/null
@@ -0,0 +1 @@
+DIST xmr-stak-2.2.0.tar.gz 316309 BLAKE2B 8a5042e91eff1d7a49dcf50d67430f21459509443117150f59f861edb0c145e0f336cb617ea4f2a7edfd923493efbc8f5ce9cd134a7f7af14b270c8cfdd3cc24 SHA512 1ec30b1f97043307461816e61cb7afaf9e77cfad895b13f5facf98f34da8d9b8751d9885930b0a38777017978fb4f25bb3a69a1c2a5db47b1a851bc88cd7d78d
diff --git a/net-p2p/xmr-stak/files/xmr-stak.service b/net-p2p/xmr-stak/files/xmr-stak.service
new file mode 100644 (file)
index 0000000..00f63c0
--- /dev/null
@@ -0,0 +1,32 @@
+[Unit]
+Description=Unified all-in-one Monero miner
+After=network-online.target
+AssertFileNotEmpty=/etc/xmr-stak/main.config
+
+[Service]
+Environment=GPU_FORCE_64BIT_PTR=1
+Environment=GPU_MAX_HEAP_SIZE=100
+Environment=GPU_USE_SYNC_OBJECTS=1
+Environment=GPU_MAX_ALLOC_PERCENT=100
+Environment=GPU_SINGLE_ALLOC_PERCENT=100
+ExecStart=/usr/bin/xmr-stak --cpu /etc/xmr-stak/cpu.config --amd /etc/xmr-stak/amd.config --nvidia /etc/xmr-stak/nvidia.config -c /etc/xmr-stak/main.config
+DynamicUser=true
+Group=video
+CPUSchedulingPolicy=idle
+PrivateTmp=true
+ProtectHome=true
+ProtectSystem=strict
+NoNewPrivileges=true
+CapabilityBoundingSet=
+MemoryDenyWriteExecute=true
+ProtectKernelModules=true
+ProtectKernelTunables=true
+ProtectControlGroups=true
+RestrictRealtime=true
+RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
+RestrictNamespaces=true
+PrivateUsers=true
+ConfigurationDirectory=xmr-stak
+
+[Install]
+WantedBy=multi-user.target
diff --git a/net-p2p/xmr-stak/metadata.xml b/net-p2p/xmr-stak/metadata.xml
new file mode 100644 (file)
index 0000000..ad51a30
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+       <maintainer type="person">
+               <email>candrews@gentoo.org</email>
+               <name>Craig Andrews</name>
+       </maintainer>
+       <upstream>
+               <remote-id type="github">fireice-uk/xmr-stak</remote-id>
+       </upstream>
+       <use>
+               <flag name="cuda">Enable NVIDIA CUDA toolkit support</flag>
+               <flag name="devfee">Enable payment of devfee to the developer</flag>
+               <flag name="hwloc">Enable CPU affinity support via hwloc</flag>
+               <flag name="opencl">Enable OpenCL support</flag>
+               <flag name="webserver">Enable internal webserver</flag>
+       </use>
+</pkgmetadata>
diff --git a/net-p2p/xmr-stak/xmr-stak-2.2.0.ebuild b/net-p2p/xmr-stak/xmr-stak-2.2.0.ebuild
new file mode 100644 (file)
index 0000000..a135ea9
--- /dev/null
@@ -0,0 +1,64 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit cmake-utils systemd
+
+if [[ ${PV} == "9999" ]] ; then
+       EGIT_REPO_URI="https://github.com/fireice-uk/xmr-stak.git"
+       inherit git-r3
+       SRC_URI=""
+else
+       SRC_URI="https://github.com/fireice-uk/xmr-stak/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+       KEYWORDS="~amd64"
+fi
+
+DESCRIPTION="Unified all-in-one Monero miner"
+HOMEPAGE="https://github.com/fireice-uk/xmr-stak"
+LICENSE="GPL-3"
+SLOT="0"
+IUSE="cuda devfee hwloc opencl ssl webserver"
+
+DEPEND="cuda? ( dev-util/nvidia-cuda-toolkit )
+       hwloc? ( sys-apps/hwloc )
+       opencl? ( virtual/opencl )
+       ssl? ( dev-libs/openssl:0= )
+       webserver? ( net-libs/libmicrohttpd )"
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+       cmake-utils_src_prepare
+       if ! use devfee; then
+               sed -i -e 's!fDevDonationLevel = .*;!fDevDonationLevel = 0.0;!' xmrstak/donate-level.hpp || die
+       fi
+}
+
+src_configure() {
+       local mycmakeargs=(
+               -DCUDA_ENABLE=$(usex cuda)
+               -DHWLOC_ENABLE=$(usex hwloc)
+               -DMICROHTTPD_ENABLE=$(usex webserver)
+               -DOpenCL_ENABLE=$(usex opencl)
+               -DOpenSSL_ENABLE=$(usex ssl)
+       )
+       cmake-utils_src_configure
+}
+
+src_install() {
+       cmake-utils_src_install
+       systemd_dounit "${FILESDIR}"/${PN}.service
+       dodir /etc/xmr-stak
+}
+
+pkg_postinst() {
+       if [ ! -e "${ROOT}etc/xmr-stak/main.config" ]; then
+               ewarn "To use xmr-stack:"
+               if use cuda || use opencl; then
+                       ewarn "As root or as a user that is a member of the 'video' group,"
+               fi
+               ewarn "run:"
+               ewarn "/usr/bin/xmr-stak --cpu /etc/xmr-stak/cpu.config --amd /etc/xmr-stak/amd.config --nvidia /etc/xmr-stak/nvidia.config -c /etc/xmr-stak/main.config"
+               ewarn "If the systemd will be used, xmr-stak can now be terminated and 'systemctl start xmr-stak' can be used."
+       fi
+}
diff --git a/net-p2p/xmr-stak/xmr-stak-9999.ebuild b/net-p2p/xmr-stak/xmr-stak-9999.ebuild
new file mode 100644 (file)
index 0000000..a135ea9
--- /dev/null
@@ -0,0 +1,64 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit cmake-utils systemd
+
+if [[ ${PV} == "9999" ]] ; then
+       EGIT_REPO_URI="https://github.com/fireice-uk/xmr-stak.git"
+       inherit git-r3
+       SRC_URI=""
+else
+       SRC_URI="https://github.com/fireice-uk/xmr-stak/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+       KEYWORDS="~amd64"
+fi
+
+DESCRIPTION="Unified all-in-one Monero miner"
+HOMEPAGE="https://github.com/fireice-uk/xmr-stak"
+LICENSE="GPL-3"
+SLOT="0"
+IUSE="cuda devfee hwloc opencl ssl webserver"
+
+DEPEND="cuda? ( dev-util/nvidia-cuda-toolkit )
+       hwloc? ( sys-apps/hwloc )
+       opencl? ( virtual/opencl )
+       ssl? ( dev-libs/openssl:0= )
+       webserver? ( net-libs/libmicrohttpd )"
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+       cmake-utils_src_prepare
+       if ! use devfee; then
+               sed -i -e 's!fDevDonationLevel = .*;!fDevDonationLevel = 0.0;!' xmrstak/donate-level.hpp || die
+       fi
+}
+
+src_configure() {
+       local mycmakeargs=(
+               -DCUDA_ENABLE=$(usex cuda)
+               -DHWLOC_ENABLE=$(usex hwloc)
+               -DMICROHTTPD_ENABLE=$(usex webserver)
+               -DOpenCL_ENABLE=$(usex opencl)
+               -DOpenSSL_ENABLE=$(usex ssl)
+       )
+       cmake-utils_src_configure
+}
+
+src_install() {
+       cmake-utils_src_install
+       systemd_dounit "${FILESDIR}"/${PN}.service
+       dodir /etc/xmr-stak
+}
+
+pkg_postinst() {
+       if [ ! -e "${ROOT}etc/xmr-stak/main.config" ]; then
+               ewarn "To use xmr-stack:"
+               if use cuda || use opencl; then
+                       ewarn "As root or as a user that is a member of the 'video' group,"
+               fi
+               ewarn "run:"
+               ewarn "/usr/bin/xmr-stak --cpu /etc/xmr-stak/cpu.config --amd /etc/xmr-stak/amd.config --nvidia /etc/xmr-stak/nvidia.config -c /etc/xmr-stak/main.config"
+               ewarn "If the systemd will be used, xmr-stak can now be terminated and 'systemctl start xmr-stak' can be used."
+       fi
+}