net-p2p/dogecoind-1.5.1-r1
[portage-squeep] / net-p2p / dogecoind / dogecoind-1.5.1-r1.ebuild
1 # Distributed under the terms of the GNU General Public License v2
2
3 EAPI=5
4
5 DB_VER="5.1"
6
7 inherit bash-completion-r1 db-use eutils systemd user
8
9 MyPV="${PV/_/-}"
10 MyPN="dogecoin"
11 MyP="${MyPN}-${MyPV}"
12
13 DESCRIPTION="P2P Internet currency based on Bitcoin but wow such doge"
14 HOMEPAGE="https://dogecoin.com/"
15 SRC_URI="https://github.com/${MyPN}-project/${MyPN}/archive/${MyPV}.tar.gz -> ${MyP}.tar.gz"
16 SRC_URI="https://github.com/${MyPN}/${MyPN}/archive/${MyPV}.tar.gz -> ${MyP}.tar.gz"
17
18 LICENSE="MIT ISC GPL-2"
19 SLOT="0"
20 KEYWORDS="amd64 x86"
21 IUSE="bash-completion examples ipv6 logrotate upnp"
22
23 RDEPEND="
24 dev-libs/boost[threads(+)]
25 dev-libs/openssl:0[-bindist]
26 logrotate? (
27 app-admin/logrotate
28 )
29 upnp? (
30 net-libs/miniupnpc
31 )
32 sys-libs/db:$(db_ver_to_slot "${DB_VER}")[cxx]
33 dev-libs/leveldb[-snappy]
34 "
35 DEPEND="${RDEPEND}
36 >=app-shells/bash-4.1
37 sys-apps/sed
38 "
39
40 S="${WORKDIR}/${MyP}"
41
42 pkg_setup() {
43 local UG='dogecoin'
44 enewgroup "${UG}"
45 enewuser "${UG}" -1 -1 /var/lib/dogecoin "${UG}"
46 }
47
48 src_prepare() {
49 # epatch "${FILESDIR}"/${MyPN}-sys_leveldb.patch
50 # rm -r src/leveldb
51
52 if has_version '>=dev-libs/boost-1.52'; then
53 sed -i 's/\(-l db_cxx\)/-l boost_chrono$(BOOST_LIB_SUFFIX) \1/' src/makefile.unix
54 fi
55 }
56
57 src_configure() {
58 OPTS=()
59
60 OPTS+=("DEBUGFLAGS=")
61 OPTS+=("CXXFLAGS=${CXXFLAGS}")
62 OPTS+=("LDFLAGS=${LDFLAGS}")
63
64 if use upnp; then
65 OPTS+=("USE_UPNP=1")
66 else
67 OPTS+=("USE_UPNP=-")
68 fi
69
70 use ipv6 || OPTS+=("USE_IPV6=-")
71
72 OPTS+=("USE_SYSTEM_LEVELDB=1")
73 OPTS+=("BDB_INCLUDE_PATH=$(db_includedir "${DB_VER}")")
74 OPTS+=("BDB_LIB_SUFFIX=-${DB_VER}")
75
76 # if has_version '>=dev-libs/boost-1.52'; then
77 # OPTS+=("LIBS+=-lboost_chrono\$\$BOOST_LIB_SUFFIX")
78 # fi
79
80 cd src || die
81 emake CC="$(tc-getCC)" CXX="$(tc-getCXX)" -f makefile.unix "${OPTS[@]}" ${PN}
82 }
83
84 #Tests are broken with and without our dogecoin-sys_leveldb.patch.
85 #When tests work, make sure to inherit toolchain-funcs
86 #src_test() {
87 # cd src || die
88 # emake CC="$(tc-getCC)" CXX="$(tc-getCXX)" -f makefile.unix "${OPTS[@]}" test_dogecoin
89 # ./test_dogecoin || die 'Tests failed'
90 #}
91
92 src_install() {
93 dobin src/${PN}
94
95 insinto /etc/dogecoin
96 doins "${FILESDIR}/dogecoin.conf"
97 fowners dogecoin:dogecoin /etc/dogecoin/dogecoin.conf
98 fperms 600 /etc/dogecoin/dogecoin.conf
99
100 newconfd "${FILESDIR}/dogecoin.confd" ${PN}
101 newinitd "${FILESDIR}/dogecoin.initd" ${PN}
102 systemd_dounit "${FILESDIR}/dogecoin.service"
103
104 keepdir /var/lib/dogecoin/.dogecoin
105 fperms 700 /var/lib/dogecoin
106 fowners dogecoin:dogecoin /var/lib/dogecoin/
107 fowners dogecoin:dogecoin /var/lib/dogecoin/.dogecoin
108 dosym /etc/dogecoin/dogecoin.conf /var/lib/dogecoin/.dogecoin/dogecoin.conf
109
110 # dodoc doc/README.md doc/release-notes.md
111 # newman contrib/debian/manpages/bitcoind.1 dogecoind.1
112 # newman contrib/debian/manpages/bitcoin.conf.5 dogecoin.conf.5
113
114 if use bash-completion; then
115 :;
116 # newbashcomp contrib/bitcoind.bash-completion ${PN}.bash-completion
117 fi
118
119 if use examples; then
120 docinto examples
121 # dodoc -r contrib/{bitrpc,pyminer,spendfrom,tidy_datadir.sh,wallettools}
122 fi
123
124 if use logrotate; then
125 insinto /etc/logrotate.d
126 newins "${FILESDIR}/dogecoind.logrotate" dogecoind
127 fi
128 }