+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DB_VER="5.1"
+
+inherit autotools db-use flag-o-matic systemd
+
+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="debug examples logrotate upnp +wallet test"
+
+RDEPEND="
+ >=dev-libs/boost-1.74.0[threads(+)]
+ dev-libs/openssl:0
+ logrotate? (
+ app-admin/logrotate
+ )
+ upnp? (
+ net-libs/miniupnpc
+ )
+ wallet? (
+ 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() {
+# epatch "${FILESDIR}/0001-Fix-for-Boost-1.74.patch"
+# epatch "${FILESDIR}/0002-httpserver-include-deque.patch"
+# epatch_user
+ default
+ eautoreconf
+}
+
+src_configure() {
+ append-cppflags "-I/usr/include/db${DB_VER}"
+ econf \
+ $(use_enable wallet) \
+ $(use_enable test tests) \
+ --disable-hardening \
+ $(use_enable debug) \
+ $(use_with upnp miniupnpc) \
+ --with-gui=no
+}
+
+src_test() {
+ emake check
+}
+
+src_install() {
+ dobin "src/${PN}"
+ dobin "src/dogecoin-cli"
+
+ 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" "${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
+ # dodoc RELEASE_NOTES_1_8.2.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
+}