summaryrefslogtreecommitdiff
path: root/net-p2p/primecoind
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /net-p2p/primecoind
reinit the tree, so we can have metadata
Diffstat (limited to 'net-p2p/primecoind')
-rw-r--r--net-p2p/primecoind/Manifest12
-rw-r--r--net-p2p/primecoind/files/primecoin-sys_leveldb.patch176
-rw-r--r--net-p2p/primecoind/files/primecoin.conf8
-rw-r--r--net-p2p/primecoind/files/primecoin.confd10
-rw-r--r--net-p2p/primecoind/files/primecoin.initd104
-rw-r--r--net-p2p/primecoind/files/primecoin.initd-r128
-rw-r--r--net-p2p/primecoind/files/primecoin.service30
-rw-r--r--net-p2p/primecoind/files/primecoind.logrotate7
-rw-r--r--net-p2p/primecoind/metadata.xml11
-rw-r--r--net-p2p/primecoind/primecoind-0.1.2-r1.ebuild122
10 files changed, 508 insertions, 0 deletions
diff --git a/net-p2p/primecoind/Manifest b/net-p2p/primecoind/Manifest
new file mode 100644
index 000000000000..378ba51a813d
--- /dev/null
+++ b/net-p2p/primecoind/Manifest
@@ -0,0 +1,12 @@
+AUX primecoin-sys_leveldb.patch 6836 SHA256 460e6d013d897d108c8c0234dc0a5f57b114b050c586f8877ef8ad7c3f1f6dba SHA512 b7dd42bf2a83528db7b828fd95e93a9c025cb84ea3844591a4012fd2504a785cbdc589ceff6324664a44087d09a133c05eed186c4dfa82b534257224ff0f906f WHIRLPOOL b6a178d084d9f877c82cba21301071e542e39e63865dcb0179d2a2b3d6e1d72d2ae9263a3332c4512298d29850023e5b8b1249f86520d8ad3c55fcd339a46013
+AUX primecoin.conf 80 SHA256 541ae10cc2246b620de3e7efa97eee59efacf83d28ea5f1297a121d0708226d2 SHA512 43bef890505a1fac88887bb39e9fdd4ec673ae8838a40279b33711e970551f5a75ac25171c41f8c83de2c953b157f7a3f57171e868fd9f626007d9909331a19f WHIRLPOOL 728e38b62da2c7c3a1149ac511b92d156f7b3c51dacfadd7ce74d9e6f915a6547c4cc8d34159243f50eee333c63b35949b311ea5a7f48a6c3bf17a5d4d47c123
+AUX primecoin.confd 251 SHA256 a6aed5bde7b688ccdbeff88b67e5f912f031ca65fb9cc5c0ce0ddc3d00fd7ac2 SHA512 e291ae30a35b19e29982615875003c0d9c81b70e79f023ad4ada0166ba9199df5dd17d7f72750d9fe681e2c7ccfa5696e9f34a661449fa4a1210690e4d4c0d4e WHIRLPOOL a36b5e113598c68c947b829822d5f0f4f8a1944dda2905a73268f2ec48ff47b1dd2af4833c22e7acda92de52125e671cb6d8b847c3421658d044c16170aeeb87
+AUX primecoin.initd 2542 SHA256 b1f4d84e01621d53565b4ece24b8d23792a93a68d53cb7f34dd163458e97d2e0 SHA512 6125ce365b17345db342cb41010786e9565ddddbf1da28ef1faeaf6d7d70bdbc7e6e17395c69099be90739f34318e3d515474d0c77d772e78cc6ca0ec83c9946 WHIRLPOOL c78de164bf7ff4c84bff16b5b828a3e226abe2dbfec457202c952d4d5f34bfe8437e41b886ff60ab9dbebb8432521d5810c6a41df21fface4caa56791abf23fb
+AUX primecoin.initd-r1 837 SHA256 2e2f61bff2040d58ac55657b11388f1b8a0da9373412f469ea1f5144ab4bf1d7 SHA512 ec177c18803f7922c9cdc4501d4df89368dcce8eba917c9f117a445dd9040c63580b999aa462b45cf54f06d9db0ae1d1f4970a74841331c9764ffea017d46527 WHIRLPOOL 6e2cfb14fa620a88adc1a5842c36c319eed7359a67759677b15adbd7240bb744f9093c3a71194657548493583390323ff704e9fca09c195a5b6a2d5eb759b6db
+AUX primecoin.service 889 SHA256 f38b0b67a950b1b43dce4906aeece22bd186ddc198bce0b9136edc5bf4149fd3 SHA512 5b37b776f419bf9da51952e9a4b3bc7f8879297d1e6d8d551ea4658a8daf7f2f5138bd018443a514ee7787b8c6265fadc409bbc9bdb1d58a8df34ae312dbfd0f WHIRLPOOL 503a5e730cd9cee91308d8d79a0ed59f3ef0fe7dbd1c673c82deb5f12cf3c7c07de498d31b996c9fe0523ebba50752c792f8b636896b01b04718de2e929512d9
+AUX primecoind.logrotate 116 SHA256 fb78530aad1491be7c75dede40e82809020b438f272a6a8506ba74eb9af0691b SHA512 ad6873f47e73a305e3b44fc0a6e9ef430a2e82392ff6c5230f365aaa1b1d64afc8d97094006dc2b57b8b9245288f3e144ecdccb5913d98d7171fcd6a216022e9 WHIRLPOOL 0d6c4b3fcbe60de559febe9d8029de177821c0aceec31fdae3b9b907aebc24ffc4f1b7ecc2102a8ae486f25ac00fd479a1b349ce2ed39a1e6fb85a620b30a97e
+DIST primecoin-0.1.2.tar.gz 16521236 SHA256 d0f3c6a91b4d505f25e9284bcca85e420cf09d0e6cf71e5a001b7e1367ef46d0 SHA512 cff71b0e6459c4e534e78acef9491090d05c0cb864a068c0a3cb289310a1ee13fd69c7b61a7d6cb9732af54fbcf1fa4e77db8c8528a09bbdafd36421fdf7aff1 WHIRLPOOL 5031efa135dcf08975a06a037179863ad180920e0c55e0ec5d1863b4b24d005ce829fa0e0f081120d3610bc0abd1d3919db477a33e32ec6d0d353b7177480eb1
+EBUILD primecoind-0.1.2-r1.ebuild 3035 SHA256 67ab71d3597b6bfdf785e07f6f1030be0b617f594655c41a9d06103b7994c6c7 SHA512 a1f8479393b56fa516641941817f85d98804be5db6615fea0a7bac6d8337d88e5073926f94a82db2cd7526b7606cd7f297b7256e71f7beae80d325ac9cfd3eb8 WHIRLPOOL f283324199f5e5b66d2384815f577e47fa4843450285b408a61a1cc35a204031c7ad62825a88bdcd0293fc2d186c9d04c2e05a64ad0a0479b7a28ce04291a985
+MISC ChangeLog 2678 SHA256 977573a41218123820d705ceafcde7e68ef443bd7e2eaf5ca8e448f782b881f5 SHA512 f11b25b8b930d71e1f6635fa6b52afe8ba3a47d5155421a64dee9fd12d234a5ab1a39f35cbe7cf81e9193ff9aed0693427453f0ff6227ccc9d5ca54c2627f819 WHIRLPOOL 2f40ead9580fb31e74ea6b54ce3419cc2c41e41e0899f3683e9719112337a623441c62c3b3dc1706425652055aa9f27631ffdd9fafdfbbd3627dba6e5bc09273
+MISC ChangeLog-2015 1173 SHA256 8ff6f15ec68fe6b1eb7fc7745679b17185441359b96b381bdf810e1bf8386682 SHA512 62397e08e30bd3c1db6e24626a1197be0c47b467ebe549ea81a68fb6c1a7b8e0080005cfdfac88f1b1dc56a862099a95525082acb58a2889ab9e03ee9ea3dac9 WHIRLPOOL 76fd1d80f06cd8272c10e903823b3919ed5dd8ede2c7b863ba04b6d7d68663fc8fbedab8b9f81036f7a80c0e51d585589d4ab5f5c43d42341f3ba167c48faa2b
+MISC metadata.xml 335 SHA256 e482988119e97fa0138e04cd8a7f1a4a694651a753c3f35394f3c74e1afb4d61 SHA512 9903b33b23cafb7b00e86e624c95ec056e4f162e9dab89c39b3cb53abe3694dfa6f5dccee38f591aef9d075f46612c865579ea1ec8342cacd622a130baf606f1 WHIRLPOOL 6aa49498c1710ca594cf9868474d24dc9f7a386f6061b97a8bf08be97a88d88e5959e5699ae0ca66e806d0b3cfc09be867ce34bee66a9c09469e7d45ab05ea5c
diff --git a/net-p2p/primecoind/files/primecoin-sys_leveldb.patch b/net-p2p/primecoind/files/primecoin-sys_leveldb.patch
new file mode 100644
index 000000000000..39d0aa63fb77
--- /dev/null
+++ b/net-p2p/primecoind/files/primecoin-sys_leveldb.patch
@@ -0,0 +1,176 @@
+diff -Naur primecoin-0.1.2-linux.orig/src/bitcoin-qt.pro primecoin-0.1.2-linux/src/bitcoin-qt.pro
+--- primecoin-0.1.2-linux.orig/src/bitcoin-qt.pro 2013-08-05 08:37:14.000000000 -0400
++++ primecoin-0.1.2-linux/src/bitcoin-qt.pro 2013-11-30 16:39:48.464770389 -0500
+@@ -4,7 +4,7 @@
+ VERSION = 0.8.3
+ INCLUDEPATH += src src/json src/qt
+ QT += network
+-DEFINES += QT_GUI BOOST_THREAD_USE_LIB BOOST_SPIRIT_THREADSAFE
++DEFINES += QT_GUI BOOST_THREAD_USE_LIB BOOST_SPIRIT_THREADSAFE LEVELDB_WITHOUT_MEMENV
+ CONFIG += no_include_pwd
+ CONFIG += thread
+
+@@ -98,25 +98,29 @@
+ QTPLUGIN += qcncodecs qjpcodecs qtwcodecs qkrcodecs qtaccessiblewidgets
+ }
+
++contains(USE_SYSTEM_LEVELDB, 1) {
++ LIBS += -lleveldb
++} else {
+ INCLUDEPATH += src/leveldb/include src/leveldb/helpers
+-LIBS += $$PWD/src/leveldb/libleveldb.a $$PWD/src/leveldb/libmemenv.a
++LIBS += $$PWD/src/leveldb/libleveldb.a
+ !win32 {
+ # we use QMAKE_CXXFLAGS_RELEASE even without RELEASE=1 because we use RELEASE to indicate linking preferences not -O preferences
+- genleveldb.commands = cd $$PWD/src/leveldb && CC=$$QMAKE_CC CXX=$$QMAKE_CXX $(MAKE) OPT=\"$$QMAKE_CXXFLAGS $$QMAKE_CXXFLAGS_RELEASE\" libleveldb.a libmemenv.a
++ genleveldb.commands = cd $$PWD/src/leveldb && CC=$$QMAKE_CC CXX=$$QMAKE_CXX $(MAKE) OPT=\"$$QMAKE_CXXFLAGS $$QMAKE_CXXFLAGS_RELEASE\" libleveldb.a
+ } else {
+ # make an educated guess about what the ranlib command is called
+ isEmpty(QMAKE_RANLIB) {
+ QMAKE_RANLIB = $$replace(QMAKE_STRIP, strip, ranlib)
+ }
+ LIBS += -lshlwapi
+- genleveldb.commands = cd $$PWD/src/leveldb && CC=$$QMAKE_CC CXX=$$QMAKE_CXX TARGET_OS=OS_WINDOWS_CROSSCOMPILE $(MAKE) OPT=\"$$QMAKE_CXXFLAGS $$QMAKE_CXXFLAGS_RELEASE\" libleveldb.a libmemenv.a && $$QMAKE_RANLIB $$PWD/src/leveldb/libleveldb.a && $$QMAKE_RANLIB $$PWD/src/leveldb/libmemenv.a
++ genleveldb.commands = cd $$PWD/src/leveldb && CC=$$QMAKE_CC CXX=$$QMAKE_CXX TARGET_OS=OS_WINDOWS_CROSSCOMPILE $(MAKE) OPT=\"$$QMAKE_CXXFLAGS $$QMAKE_CXXFLAGS_RELEASE\" libleveldb.a && $$QMAKE_RANLIB $$PWD/src/leveldb/libleveldb.a
+ }
+ genleveldb.target = $$PWD/src/leveldb/libleveldb.a
+ genleveldb.depends = FORCE
+ PRE_TARGETDEPS += $$PWD/src/leveldb/libleveldb.a
+ QMAKE_EXTRA_TARGETS += genleveldb
++}
+ # Gross ugly hack that depends on qmake internals, unfortunately there is no other way to do it.
+-QMAKE_CLEAN += $$PWD/src/leveldb/libleveldb.a; cd $$PWD/src/leveldb ; $(MAKE) clean
++QMAKE_CLEAN += $$PWD/src/leveldb/libleveldb.a; cd $$PWD/src/leveldb && $(MAKE) clean || true
+
+ # regenerate src/build.h
+ !win32|contains(USE_BUILD_INFO, 1) {
+diff -Naur primecoin-0.1.2-linux.orig/src/src/leveldb.cpp primecoin-0.1.2-linux/src/src/leveldb.cpp
+--- primecoin-0.1.2-linux.orig/src/src/leveldb.cpp 2013-08-05 08:37:20.000000000 -0400
++++ primecoin-0.1.2-linux/src/src/leveldb.cpp 2013-11-30 16:41:25.632773774 -0500
+@@ -8,7 +8,9 @@
+ #include <leveldb/env.h>
+ #include <leveldb/cache.h>
+ #include <leveldb/filter_policy.h>
+-#include <memenv/memenv.h>
++#ifndef LEVELDB_WITHOUT_MEMENV
++#include <memenv.h>
++#endif
+
+ #include <boost/filesystem.hpp>
+
+@@ -43,8 +45,12 @@
+ options = GetOptions(nCacheSize);
+ options.create_if_missing = true;
+ if (fMemory) {
++#ifndef LEVELDB_WITHOUT_MEMENV
+ penv = leveldb::NewMemEnv(leveldb::Env::Default());
+ options.env = penv;
++#else
++ throw std::runtime_error("CLevelDB(): compiled without memenv support");
++#endif
+ } else {
+ if (fWipe) {
+ printf("Wiping LevelDB in %s\n", path.string().c_str());
+diff -Naur primecoin-0.1.2-linux.orig/src/src/makefile.unix primecoin-0.1.2-linux/src/src/makefile.unix
+--- primecoin-0.1.2-linux.orig/src/src/makefile.unix 2013-08-05 08:37:21.000000000 -0400
++++ primecoin-0.1.2-linux/src/src/makefile.unix 2013-11-30 17:20:06.545854617 -0500
+@@ -111,8 +111,7 @@
+ # adds some defaults in front. Unfortunately, LDFLAGS=... $(LDFLAGS) does not work.
+ xLDFLAGS=$(LDHARDENING) $(LDFLAGS)
+
+-OBJS= \
+- leveldb/libleveldb.a \
++BASEOBJS := \
+ obj/alert.o \
+ obj/version.o \
+ obj/checkpoints.o \
+@@ -121,7 +120,6 @@
+ obj/crypter.o \
+ obj/key.o \
+ obj/db.o \
+- obj/init.o \
+ obj/keystore.o \
+ obj/main.o \
+ obj/net.o \
+@@ -141,25 +139,44 @@
+ obj/hash.o \
+ obj/bloom.o \
+ obj/noui.o \
+- obj/leveldb.o \
+ obj/txdb.o \
+ obj/prime.o \
+ obj/checkpointsync.o
+
++OBJS := \
++ obj/leveldb.o \
++ obj/init.o \
++ $(BASEOBJS)
++
++TESTOBJS := \
++ obj-test/leveldb.o \
++ $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp)) \
++ $(BASEOBJS)
++
+ all: primecoind
+
+ test check: test_primecoin FORCE
+ ./test_primecoin
+
++ifdef USE_SYSTEM_LEVELDB
++ LIBS += -lleveldb
++ TESTLIBS += -lmemenv
++else
+ #
+ # LevelDB support
+ #
+ MAKEOVERRIDES =
+-LIBS += $(CURDIR)/leveldb/libleveldb.a $(CURDIR)/leveldb/libmemenv.a
++LIBS += $(CURDIR)/leveldb/libleveldb.a
++TESTLIBS += $(CURDIR)/leveldb/libmemenv.a
+ DEFS += $(addprefix -I,$(CURDIR)/leveldb/include)
+ DEFS += $(addprefix -I,$(CURDIR)/leveldb/helpers)
+ leveldb/libleveldb.a:
+- @echo "Building LevelDB ..." && cd leveldb && $(MAKE) CC=$(CC) CXX=$(CXX) OPT="$(xCXXFLAGS)" libleveldb.a libmemenv.a && cd ..
++ @echo "Building LevelDB ..." && cd leveldb && $(MAKE) CC=$(CC) CXX=$(CXX) OPT="$(xCXXFLAGS)" libleveldb.a && cd ..
++leveldb/libmemenv.a:
++ @echo "Building LevelDB memenv ..." && cd leveldb && $(MAKE) CC=$(CC) CXX=$(CXX) OPT="$(xCXXFLAGS)" libmemenv.a && cd ..
++OBJS += leveldb/libleveldb.a
++TESTOBJS += leveldb/libmemenv.a
++endif
+
+ # auto-generated dependencies:
+ -include obj/*.P
+@@ -170,24 +187,22 @@
+ version.cpp: obj/build.h
+ DEFS += -DHAVE_BUILD_INFO
+
+-obj/%.o: %.cpp
+- $(CXX) -c $(xCXXFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $<
++P_TO_D = \
+ @cp $(@:%.o=%.d) $(@:%.o=%.P); \
+- sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
++ sed -e 's/\#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
+ rm -f $(@:%.o=%.d)
+
+-primecoind: $(OBJS:obj/%=obj/%)
+- $(LINK) $(xCXXFLAGS) -o $@ $^ $(xLDFLAGS) $(LIBS)
++obj/%.o: %.cpp
++ $(CXX) -c $(xCXXFLAGS) -DLEVELDB_WITHOUT_MEMENV -MMD -MF $(@:%.o=%.d) -o $@ $<
++ $(P_TO_D)
+
+-TESTOBJS := $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp))
++primecoind: $(OBJS)
++ $(LINK) $(xCXXFLAGS) -o $@ $^ $(xLDFLAGS) $(LIBS)
+
+ obj-test/%.o: test/%.cpp
+- $(CXX) -c $(TESTDEFS) $(xCXXFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $<
+- @cp $(@:%.o=%.d) $(@:%.o=%.P); \
+- sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+- -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
+- rm -f $(@:%.o=%.d)
++ $(CXX) -c $(xCXXFLAGS) -DLEVELDB_WITHOUT_MEMENV -MMD -MF $(@:%.o=%.d) -o $@ $<
++ $(P_TO_D)
+
+ test_primecoin: $(TESTOBJS) $(filter-out obj/init.o,$(OBJS:obj/%=obj/%))
+ $(LINK) $(xCXXFLAGS) -o $@ $(LIBPATHS) $^ $(TESTLIBS) $(xLDFLAGS) $(LIBS)
diff --git a/net-p2p/primecoind/files/primecoin.conf b/net-p2p/primecoind/files/primecoin.conf
new file mode 100644
index 000000000000..c6a55f3d9133
--- /dev/null
+++ b/net-p2p/primecoind/files/primecoin.conf
@@ -0,0 +1,8 @@
+# http://www.bitcoin.org/smf/index.php?topic=644.0
+#rpcuser=
+#rpcpassword=
+
+
+
+
+
diff --git a/net-p2p/primecoind/files/primecoin.confd b/net-p2p/primecoind/files/primecoin.confd
new file mode 100644
index 000000000000..6dd0defc0cea
--- /dev/null
+++ b/net-p2p/primecoind/files/primecoin.confd
@@ -0,0 +1,10 @@
+# Config file for /etc/init.d/primecoind
+
+# owner of primeciond process (don't change, must be existing)
+PRIMECOIN_USER="primecoin"
+
+# See http://www.bitcoin.org/smf/index.php?topic=1063
+PRIMECOIN_OPTS="${PRIMECOIN_OPTS}"
+
+# nice level
+NICELEVEL="19"
diff --git a/net-p2p/primecoind/files/primecoin.initd b/net-p2p/primecoind/files/primecoin.initd
new file mode 100644
index 000000000000..37a24b8a6b71
--- /dev/null
+++ b/net-p2p/primecoind/files/primecoin.initd
@@ -0,0 +1,104 @@
+#!/sbin/openrc-run
+# Distributed under the terms of the GNU General Public License, v2 or later
+
+VARDIR="/var/lib/primecoin"
+CONFFILE="${VARDIR}/.primecoin/primecoin.conf"
+
+depend() {
+ need net
+}
+
+checkconfig() {
+ if [[ "${PRIMECOIN_USER}" == "" ]] ; then
+ eerror "Please edit /etc/conf.d/primecoind"
+ eerror "A user must be specified to run primecoind as that user."
+ eerror "Modify USER to your needs (you may also add a group after a colon)"
+ return 1
+ fi
+ if ! `getent passwd | cut -d ':' -f 1 | grep $( echo "${PRIMECOIN_USER}" | cut -d ':' -f 1 ) -sq` ; then
+ eerror "Please edit /etc/conf.d/primecoind"
+ eerror "Specified user must exist!"
+ return 1
+ fi
+ if `echo "${PRIMECOIN_USER}" | grep ':' -sq` ; then
+ if ! `cut -d ':' -f 1 /etc/group | grep $( echo "${PRIMECOIN_USER}" | cut -d ':' -f 2 ) -sq` ; then
+ eerror "Please edit /etc/conf.d/primecoind"
+ eerror "Specified group must exist!"
+ return 1
+ fi
+ fi
+ if ! grep -q '^rpcpassword=' "${CONFFILE}"; then
+ eerror "Please edit `readlink -f ${CONFFILE}`"
+ eerror "There must be at least a line assigning rpcpassword=something-secure"
+ return 1
+ fi
+ if ! stat -Lc '%a' "${CONFFILE}" | grep -q '^[4567]00$'; then
+ eerror "`readlink -f ${CONFFILE}` should not be readable by other users"
+ return 1
+ fi
+ return 0
+}
+
+start() {
+ checkconfig || return 1
+ ebegin "Starting Primecoind daemon"
+
+ pkg-config openrc
+ if [ $? = 0 ]; then
+ start_openrc
+ else
+ start_baselayout
+ fi
+}
+
+stop() {
+ ebegin "Stopping Primecoin daemon"
+
+ pkg-config openrc
+ if [ $? = 0 ]; then
+ stop_openrc
+ else
+ stop_baselayout
+ fi
+}
+
+start_openrc() {
+ start-stop-daemon \
+ --start --user "${PRIMECOIN_USER}" --name primecoind \
+ --pidfile /var/run/primecoind.pid --make-pidfile \
+ --env HOME="${VARDIR}" --exec /usr/bin/primecoind \
+ --nicelevel "${NICELEVEL}" \
+ --background \
+ --wait 2000 \
+ -- ${PRIMECOIN_OPTS}
+ eend $?
+}
+
+stop_openrc() {
+ start-stop-daemon --stop --user "${PRIMECOIN_USER}" \
+ --name primecoind --pidfile /var/run/primecoind.pid \
+ --wait 30000 \
+ --progress
+ eend $?
+}
+
+start_baselayout() {
+ start-stop-daemon \
+ --start --user "${PRIMECOIN_USER}" --name primecoind \
+ --pidfile /var/run/primecoind.pid --make-pidfile \
+ --env HOME="${VARDIR}" --exec /usr/bin/primecoind \
+ --chuid "${PRIMECOIN_USER}" \
+ --nicelevel "${NICELEVEL}" \
+ --background \
+ -- ${PRIMECOIN_OPTS}
+ eend $?
+}
+
+stop_baselayout() {
+ start-stop-daemon \
+ --stop \
+ --user "${PRIMECOIN_USER}" \
+ --name primecoind \
+ --pidfile /var/run/primecoind.pid
+ eend $?
+}
diff --git a/net-p2p/primecoind/files/primecoin.initd-r1 b/net-p2p/primecoind/files/primecoin.initd-r1
new file mode 100644
index 000000000000..936902b342af
--- /dev/null
+++ b/net-p2p/primecoind/files/primecoin.initd-r1
@@ -0,0 +1,28 @@
+#!/sbin/openrc-run
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+vardir="/var/lib/primecoin"
+conffile="${vardir}/.primecoin/primecoin.conf"
+primecoind_user="${PRIMECOIN_USER:-nobody:nobody}"
+
+description="Bitcoin crypto-currency wallet for automated services"
+pidfile="/run/${SVCNAME}.pid"
+command="/usr/bin/primecoind"
+command_args="${PRIMECOIN_OPTS}"
+command_background="true"
+start_stop_daemon_args="-u ${primecoind_user} -e HOME=${vardir} -N ${NICELEVEL:-0} -w 2000"
+
+depend() {
+ need net
+}
+
+start_pre() {
+ checkpath -f -o ${primecoind_user} -m 0400 ${conffile} || return 1
+
+ if ! grep -q '^rpcpassword=' "${conffile}"; then
+ eerror "Please edit `readlink -f ${conffile}`"
+ eerror "There must be at least a line assigning rpcpassword=something-secure"
+ return 1
+ fi
+}
diff --git a/net-p2p/primecoind/files/primecoin.service b/net-p2p/primecoind/files/primecoin.service
new file mode 100644
index 000000000000..8fd2ecaba5a2
--- /dev/null
+++ b/net-p2p/primecoind/files/primecoin.service
@@ -0,0 +1,30 @@
+# It's not recommended to modify this file in-place, because it will be
+# overwritten during package upgrades. If you want to customize, the
+# best way is to create file
+# "/etc/systemd/system/primecoind.service.d/*.conf"
+# containing your changes
+
+# For example, if you want to change some daemon and/or unit options,
+# create a file named
+# "/etc/systemd/system/primecoind.service.d/myopts.conf"
+# containing:
+# [Service]
+# Environment="PRIMECOIN_OPTS=-debug -logtimestamps"
+# Nice=10
+# This will override the setting appearing below.
+
+# Note that almost all daemon options could be specified in
+# /etc/primecoin/primecoin.conf
+
+[Unit]
+Description=Primecoin Daemon
+After=network.target
+
+[Service]
+User=primecoin
+Environment=PRIMECOIN_OPTS=
+ExecStart=/usr/bin/primecoind -daemon=0 $PRIMECOIN_OPTS
+ExecReload=/bin/kill -HUP $MAINPID
+
+[Install]
+WantedBy=multi-user.target
diff --git a/net-p2p/primecoind/files/primecoind.logrotate b/net-p2p/primecoind/files/primecoind.logrotate
new file mode 100644
index 000000000000..84623c46f961
--- /dev/null
+++ b/net-p2p/primecoind/files/primecoind.logrotate
@@ -0,0 +1,7 @@
+/var/lib/primecoin/.primecoin/debug.log {
+ weekly
+ sharedscripts
+ postrotate
+ killall -HUP primecoind
+ endscript
+}
diff --git a/net-p2p/primecoind/metadata.xml b/net-p2p/primecoind/metadata.xml
new file mode 100644
index 000000000000..ddbf34a0deff
--- /dev/null
+++ b/net-p2p/primecoind/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <!-- maintainer-needed -->
+ <use>
+ <flag name="logrotate">Use app-admin/logrotate for rotating logs</flag>
+ </use>
+ <upstream>
+ <remote-id type="sourceforge">primecoin</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/net-p2p/primecoind/primecoind-0.1.2-r1.ebuild b/net-p2p/primecoind/primecoind-0.1.2-r1.ebuild
new file mode 100644
index 000000000000..6a57982eb96b
--- /dev/null
+++ b/net-p2p/primecoind/primecoind-0.1.2-r1.ebuild
@@ -0,0 +1,122 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+DB_VER="4.8"
+
+inherit bash-completion-r1 db-use eutils systemd user
+
+MyPV="${PV/_/-}"
+MyPN="primecoin"
+MyP="${MyPN}-${MyPV}"
+
+DESCRIPTION="P2P Internet currency based on Bitcoin but easier to mine"
+HOMEPAGE="http://primecoin.org/"
+SRC_URI="mirror://sourceforge/${MyPN}/${MyP}-linux.tar.gz -> ${MyP}.tar.gz"
+
+LICENSE="MIT ISC GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="examples ipv6 logrotate upnp"
+
+RDEPEND="
+ dev-libs/boost[threads(+)]
+ dev-libs/openssl:0[-bindist]
+ logrotate? (
+ app-admin/logrotate
+ )
+ upnp? (
+ net-libs/miniupnpc
+ )
+ sys-libs/db:$(db_ver_to_slot "${DB_VER}")[cxx]
+ <=dev-libs/leveldb-1.12.0[-snappy]
+"
+DEPEND="${RDEPEND}
+ >=app-shells/bash-4.1
+ sys-apps/sed
+"
+
+S="${WORKDIR}/${MyP}-linux/src"
+
+pkg_setup() {
+ local UG='primecoin'
+ enewgroup "${UG}"
+ enewuser "${UG}" -1 -1 /var/lib/primecoin "${UG}"
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${MyPN}-sys_leveldb.patch
+ rm -r src/leveldb
+
+ if has_version '>=dev-libs/boost-1.52'; then
+ sed -i 's/\(-l db_cxx\)/-l boost_chrono$(BOOST_LIB_SUFFIX) \1/' src/makefile.unix
+ fi
+}
+
+src_configure() {
+ OPTS=()
+
+ OPTS+=("DEBUGFLAGS=")
+ OPTS+=("CXXFLAGS=${CXXFLAGS}")
+ OPTS+=("LDFLAGS=${LDFLAGS}")
+
+ if use upnp; then
+ OPTS+=("USE_UPNP=1")
+ else
+ OPTS+=("USE_UPNP=-")
+ fi
+
+ use ipv6 || OPTS+=("USE_IPV6=-")
+
+ OPTS+=("USE_SYSTEM_LEVELDB=1")
+ OPTS+=("BDB_INCLUDE_PATH=$(db_includedir "${DB_VER}")")
+ OPTS+=("BDB_LIB_SUFFIX=-${DB_VER}")
+
+ cd src || die
+ emake CC="$(tc-getCC)" CXX="$(tc-getCXX)" -f makefile.unix "${OPTS[@]}" ${PN}
+}
+
+#Tests are broken with and without our primecoin-sys_leveldb.patch.
+#When tests work, make sure to inherit toolchain-funcs
+#src_test() {
+# cd src || die
+# emake CC="$(tc-getCC)" CXX="$(tc-getCXX)" -f makefile.unix "${OPTS[@]}" test_primecoin
+# ./test_primecoin || die 'Tests failed'
+#}
+
+src_install() {
+ dobin src/${PN}
+
+ insinto /etc/primecoin
+ doins "${FILESDIR}/primecoin.conf"
+ fowners primecoin:primecoin /etc/primecoin/primecoin.conf
+ fperms 600 /etc/primecoin/primecoin.conf
+
+ newconfd "${FILESDIR}/primecoin.confd" ${PN}
+ newinitd "${FILESDIR}/primecoin.initd-r1" ${PN}
+ systemd_dounit "${FILESDIR}/primecoin.service"
+
+ keepdir /var/lib/primecoin/.primecoin
+ fperms 700 /var/lib/primecoin
+ fowners primecoin:primecoin /var/lib/primecoin/
+ fowners primecoin:primecoin /var/lib/primecoin/.primecoin
+ dosym /etc/primecoin/primecoin.conf /var/lib/primecoin/.primecoin/primecoin.conf
+
+ dodoc doc/README.md doc/release-notes.md
+ newman contrib/debian/manpages/bitcoind.1 primecoind.1
+ newman contrib/debian/manpages/bitcoin.conf.5 primecoin.conf.5
+
+ sed -i -e 's/bitcoin/primecoin/g' contrib/bitcoind.bash-completion
+ newbashcomp contrib/bitcoind.bash-completion ${PN}.bash-completion
+
+ if use examples; then
+ docinto examples
+ dodoc -r contrib/{bitrpc,pyminer,spendfrom,tidy_datadir.sh,wallettools}
+ fi
+
+ if use logrotate; then
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}/primecoind.logrotate" primecoind
+ fi
+}