spacepaste

  1.  
  2. # Copyright 1999-2017 Gentoo Foundation
  3. # Distributed under the terms of the GNU General Public License v2
  4. EAPI=6
  5. inherit cmake-utils eutils gnome2-utils user vcs-snapshot
  6. DESCRIPTION="An InfiniMiner/Minecraft inspired game"
  7. HOMEPAGE="http://minetest.net/"
  8. SRC_URI="https://github.com/${PN}/${PN}/tarball/${PV} -> ${P}.tar.gz"
  9. LICENSE="LGPL-2.1+ CC-BY-SA-3.0 OFL-1.1 Apache-2.0"
  10. SLOT="0"
  11. KEYWORDS="~amd64 ~x86"
  12. IUSE="+curl dedicated doc +leveldb luajit ncurses nls redis +server +sound spatial +truetype"
  13. RDEPEND="dev-db/sqlite:3
  14. sys-libs/zlib
  15. curl? ( net-misc/curl )
  16. !dedicated? (
  17. app-arch/bzip2
  18. >=dev-games/irrlicht-1.8-r2
  19. dev-libs/gmp:0=
  20. media-libs/libpng:0=
  21. virtual/jpeg:0
  22. virtual/opengl
  23. x11-libs/libX11
  24. x11-libs/libXxf86vm
  25. sound? (
  26. media-libs/libogg:=
  27. media-libs/libvorbis:=
  28. media-libs/openal:=
  29. )
  30. truetype? ( media-libs/freetype:2 )
  31. )
  32. leveldb? ( dev-libs/leveldb )
  33. luajit? ( dev-lang/luajit:2 )
  34. ncurses? ( sys-libs/ncurses:0= )
  35. nls? ( virtual/libintl )
  36. redis? ( dev-libs/hiredis )
  37. spatial? ( sci-libs/libspatialindex )"
  38. DEPEND="${RDEPEND}
  39. >=dev-games/irrlicht-1.8-r2
  40. doc? (
  41. app-doc/doxygen
  42. media-gfx/graphviz
  43. )
  44. nls? ( sys-devel/gettext )"
  45. pkg_setup() {
  46. if use server || use dedicated ; then
  47. enewgroup ${PN}
  48. enewuser ${PN} -1 -1 /var/lib/${PN} ${PN}
  49. fi
  50. }
  51. src_prepare() {
  52. cmake-utils_src_prepare
  53. # set paths
  54. sed \
  55. -e "s#@BINDIR@#${EPREFIX}/usr/bin#g" \
  56. -e "s#@GROUP@#${PN}#g" \
  57. "${FILESDIR}"/minetestserver.confd > "${T}"/minetestserver.confd || die
  58. }
  59. src_configure() {
  60. local mycmakeargs=(
  61. -DBUILD_CLIENT=$(usex !dedicated)
  62. -DCUSTOM_BINDIR="${EPREFIX}/usr/bin"
  63. -DCUSTOM_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
  64. -DCUSTOM_LOCALEDIR="${EPREFIX}/usr/share/${PN}/locale"
  65. -DCUSTOM_SHAREDIR="${EPREFIX}/usr/share/${PN}"
  66. -DCUSTOM_EXAMPLE_CONF_DIR="${EPREFIX}/usr/share/doc/${PF}"
  67. -DENABLE_CURL=$(usex curl)
  68. -DENABLE_FREETYPE=$(usex truetype)
  69. -DENABLE_GETTEXT=$(usex nls)
  70. -DENABLE_GLES=0
  71. -DENABLE_LEVELDB=$(usex leveldb)
  72. -DENABLE_REDIS=$(usex redis)
  73. -DENABLE_SPATIAL=$(usex spatial)
  74. -DENABLE_SOUND=$(usex sound)
  75. -DENABLE_LUAJIT=$(usex luajit)
  76. -DENABLE_CURSES=$(usex ncurses)
  77. -DRUN_IN_PLACE=0
  78. )
  79. use dedicated && mycmakeargs+=(
  80. -DIRRLICHT_INCLUDE_DIR="${EPREFIX}/usr/include/irrlicht"
  81. )
  82. cmake-utils_src_configure
  83. }
  84. src_compile() {
  85. cmake-utils_src_compile
  86. if use doc ; then
  87. cmake-utils_src_compile doc
  88. HTML_DOCS=( "${CMAKE_BUILD_DIR}"/doc/html/. )
  89. fi
  90. }
  91. src_install() {
  92. cmake-utils_src_install
  93. if use server || use dedicated ; then
  94. newinitd "${FILESDIR}"/minetestserver.initd minetest-server
  95. newconfd "${T}"/minetestserver.confd minetest-server
  96. fi
  97. }
  98. pkg_postinst() {
  99. gnome2_icon_cache_update
  100. if ! use dedicated ; then
  101. elog
  102. elog "optional dependencies:"
  103. elog " games-action/minetest_game (official mod)"
  104. elog
  105. fi
  106. if use server || use dedicated ; then
  107. elog
  108. elog "Configure your server via /etc/conf.d/minetest-server"
  109. elog "The user \"minetest\" is created with /var/lib/${PN} homedir."
  110. elog "Default logfile is ~/minetest-server.log"
  111. elog
  112. fi
  113. }
  114. pkg_postrm() {
  115. gnome2_icon_cache_update
  116. }
  117.