datacoin-hp-9999.ebuild 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. # Copyright 1999-2014 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. DB_VER="4.8"
  5. inherit bash-completion-r1 git-2 eutils db-use systemd user
  6. MyPV="${PV/_/-}"
  7. MyPN="${PN/-hp/d}"
  8. MyP="primecoin-${MyPV}"
  9. DESCRIPTION="High-performance version of datacoin (primecoin-hp fork)"
  10. HOMEPAGE="https://github.com/foo1inge/datacoin-hp"
  11. EGIT_REPO_URI="https://github.com/foo1inge/${PN}.git"
  12. LICENSE="MIT"
  13. SLOT="0"
  14. KEYWORDS=""
  15. IUSE="examples upnp ipv6 examples logrotate hardened"
  16. RDEPEND="
  17. dev-libs/boost[threads(+)]
  18. dev-libs/openssl:0[-bindist]
  19. upnp? (
  20. net-libs/miniupnpc
  21. )
  22. sys-libs/db:$(db_ver_to_slot "${DB_VER}")[cxx]
  23. <=dev-libs/leveldb-1.12.0[-snappy]
  24. "
  25. DEPEND="${RDEPEND}
  26. >=app-shells/bash-4.1
  27. sys-apps/sed
  28. net-p2p/bitcoind
  29. "
  30. S="${WORKDIR}/${MyP}-linux/src"
  31. src_prepare() {
  32. epatch "${FILESDIR}"/${PN}-sys_leveldb.patch
  33. rm -r src/leveldd
  34. if has_version '>=dev-libs/boost-1.52'; then
  35. sed -i 's/\(-l db_cxx\)/-l boost_chrono$(BOOST_LIB_SUFFIX) \1/' src/makefile.unix
  36. fi
  37. }
  38. pkg_setup() {
  39. local UG="${PN}"
  40. enewgroup "${UG}"
  41. enewuser "${UG}" -1 -1 /var/lib/datacoin "${UG}"
  42. }
  43. src_configure() {
  44. OPTS=()
  45. OPTS+=("DEBUGFLAGS=")
  46. OPTS+=("CXXFLAGS=${CXXFLAGS}")
  47. OPTS+=("LDFLAGS=${LDFLAGS}")
  48. if use upnp; then
  49. OPTS+=("USE_UPNP=1")
  50. else
  51. OPTS+=("USE_UPNP=")
  52. fi
  53. use ipv6 || OPTS+=("USE_IPV6=0")
  54. use hardened || OPTS+=("PIE=1")
  55. OPTS+=("USE_SYSTEM_LEVELDB=1")
  56. OPTS+=("BDB_INCLUDE_PATH=$(db_includedir "${DB_VER}")")
  57. OPTS+=("BDB_LIB_SUFFIX=-${DB_VER}")
  58. cd src || die
  59. emake CC="$(tc-getCC)" CXX="$(tc-getCXX)" -f makefile.unix "${OPTS[@]}" ${MyPN}
  60. }
  61. #Tests are broken with and without our primecoin-sys_leveldb.patch.
  62. #When tests work, make sure to inherit toolchain-funcs
  63. #src_test() {
  64. # cd src || die
  65. # emake CC="$(tc-getCC)" CXX="$(tc-getCXX)" -f makefile.unix "${OPTS[@]}" test_primecoin
  66. # ./test_primecoin || die 'Tests failed'
  67. #}
  68. src_install() {
  69. dobin src/${MyPN}
  70. insinto /etc/datacoin
  71. doins "${FILESDIR}/datacoin.conf"
  72. fowners ${PN}:${PN} /etc/datacoin/datacoin.conf
  73. fperms 600 /etc/datacoin/datacoin.conf
  74. newconfd "${FILESDIR}/datacoin.confd" ${PN}
  75. newinitd "${FILESDIR}/datacoin.initd" ${PN}
  76. systemd_dounit "${FILESDIR}/datacoin.service"
  77. keepdir /var/lib/datacoin/.datacoin
  78. fperms 700 /var/lib/datacoin
  79. fowners ${PN}:${PN} /var/lib/datacoin/
  80. fowners ${PN}:${PN} /var/lib/datacoin/.datacoin
  81. dosym /etc/datacoin/datacoin.conf /var/lib/datacoin/.datacoin/datacoin.conf
  82. dodoc doc/README.md doc/release-notes.md
  83. newman contrib/debian/manpages/bitcoind.1 ${MyPN}.1
  84. newman contrib/debian/manpages/bitcoin.conf.5 datacoin.conf.5
  85. sed -i -e 's/bitcoin/datacoin-hp/g' contrib/bitcoind.bash-completion
  86. newbashcomp contrib/bitcoind.bash-completion ${PN}.bash-completion
  87. if use examples; then
  88. docinto examples
  89. dodoc -r contrib/{bitrpc,pyminer,spendfrom,tidy_datadir.sh,wallettools}
  90. fi
  91. if use logrotate; then
  92. insinto /etc/logrotate.d
  93. newins "${FILESDIR}/datacoind.logrotate" ${MyPN}
  94. fi
  95. }