--- /dev/null
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+DB_VER="5.1"
+
+inherit autotools bash-completion-r1 db-use eutils versionator systemd user
+
+MyPV="${PV/_/}"
+MyPN="dogecoin"
+MyP="${MyPN}-${MyPV}"
+
+DESCRIPTION="P2P Internet currency based on Bitcoin but wow such doge"
+HOMEPAGE="https://dogecoin.com/"
+SRC_URI="https://github.com/${MyPN}/${MyPN}/archive/v${MyPV}.tar.gz -> ${MyPN}-v${PV}.tgz"
+
+LICENSE="MIT ISC GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="bash-completion debug examples ipv6 logrotate upnp +wallet"
+
+RDEPEND="
+ >=dev-libs/boost-1.41.0[threads(+)]
+ dev-libs/openssl:0[-bindist]
+ logrotate? (
+ app-admin/logrotate
+ )
+ upnp? (
+ net-libs/miniupnpc
+ )
+ sys-libs/db:$(db_ver_to_slot "${DB_VER}")[cxx]
+"
+DEPEND="${RDEPEND}
+ >=app-shells/bash-4.1
+ sys-apps/sed
+"
+
+S="${WORKDIR}/${MyP}"
+
+pkg_setup() {
+ local UG='dogecoin'
+ enewgroup "${UG}"
+ enewuser "${UG}" -1 -1 /var/lib/dogecoin "${UG}"
+}
+
+src_prepare() {
+ # bitcoin for some reason doesn't use embedded leveldb
+ # but we will, because version/bug pinning is a good thing
+# rm -r src/leveldb
+# sed -e 's/^\(LIBLEVELDB=\).*$/\1-lleveldb/' \
+# -e 's/^\(LIBMEMENV=\).*$/\1-lmemenv/' \
+# -e 's/^\(AM_CONDITIONAL(\[EMBEDDED_LEVELDB\],\[\).*\(\])\)$/\1false\2/' \
+# -i configure.ac
+
+ eautoreconf
+}
+
+src_configure() {
+ econf \
+ --disable-silent-rules \
+ $(use_enable wallet) \
+ $(use_enable ipv6) \
+ $(use_enable test tests) \
+ --disable-hardening \
+ --disable-ccache \
+ $(use_enable debug) \
+ $(use_with upnp miniupnpc) \
+ --without-gui
+}
+
+src_test() {
+ emake check
+}
+
+src_install() {
+ dobin "src/${PN}"
+
+ insinto /etc/dogecoin
+ newins "${FILESDIR}/dogecoin.conf" dogecoin.conf
+ fowners dogecoin:dogecoin /etc/dogecoin/dogecoin.conf
+ fperms 600 /etc/dogecoin/dogecoin.conf
+
+ newconfd "${FILESDIR}/dogecoin.confd" "${PN}"
+ newinitd "${FILESDIR}/dogecoin.initd-r1" "${PN}"
+ systemd_dounit "${FILESDIR}/dogecoind.service"
+
+ keepdir /var/lib/dogecoin/.dogecoin
+ fperms 700 /var/lib/dogecoin
+ fowners dogecoin:dogecoin /var/lib/dogecoin/
+ fowners dogecoin:dogecoin /var/lib/dogecoin/.dogecoin
+ dosym /etc/dogecoin/dogecoin.conf /var/lib/dogecoin/.dogecoin/dogecoin.conf
+
+ dodoc doc/README.md doc/release-notes.md
+ doman contrib/debian/manpages/{dogecoind.1,dogecoin.conf.5}
+
+ if use bash-completion; then
+ newbashcomp "contrib/${PN}.bash-completion" "${PN}"
+ fi
+
+ if use examples; then
+ docinto examples
+ dodoc -r contrib/{README.md,bitrpc,pyminer,spendfrom,linearize,qos}
+ fi
+
+ if use logrotate; then
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}/dogecoind.logrotate" dogecoind
+ fi
+}