spacepaste

  1.  
  2. # Copyright 1999-2011 Gentoo Foundation
  3. # Distributed under the terms of the GNU General Public License v2
  4. # $Header: $
  5. EAPI=5
  6. GIT_ECLASS="git-r3"
  7. EGIT_REPO_URI="https://github.com/spring/spring.git"
  8. EGIT_BRANCH="develop"
  9. # Expose map rendering to Lua
  10. EGIT_COMMIT="3a298224e0b3ba067b4b2c1db38f49cfd6d4c68b"
  11. KEYWORDS="~x86 amd64 ~ia64"
  12. inherit games cmake-utils eutils fdo-mime flag-o-matic games ${GIT_ECLASS} java-pkg-opt-2
  13. DESCRIPTION="A 3D multiplayer real-time strategy game engine"
  14. HOMEPAGE="http://springrts.com"
  15. S="${WORKDIR}/${PN}-$PV"
  16. LICENSE="GPL-2"
  17. SLOT="$PV"
  18. IUSE="+ai +java +default headless dedicated test-ai debug -profile -custom-march -custom-cflags +tcmalloc +threaded bindist -lto test"
  19. RESTRICT="nomirror strip"
  20. REQUIRED_USE="
  21. || ( default headless dedicated )
  22. java? ( ai )
  23. "
  24. GUI_DEPEND="
  25. media-libs/devil[jpeg,png,opengl,tiff,gif]
  26. >=media-libs/freetype-2.0.0
  27. >=media-libs/glew-1.6
  28. media-libs/libsdl2[X,opengl]
  29. x11-libs/libXcursor
  30. media-libs/openal
  31. media-libs/libvorbis
  32. media-libs/libogg
  33. virtual/glu
  34. virtual/opengl
  35. "
  36. RDEPEND="
  37. >=dev-libs/boost-1.35
  38. >=sys-libs/zlib-1.2.5.1[minizip]
  39. media-libs/devil[jpeg,png]
  40. java? ( virtual/jdk )
  41. default? ( ${GUI_DEPEND} )
  42. "
  43. DEPEND="${RDEPEND}
  44. >=sys-devel/gcc-4.2
  45. app-arch/p7zip
  46. >=dev-util/cmake-2.6.0
  47. tcmalloc? ( dev-util/google-perftools )
  48. "
  49. ### where to place content files which change each spring release (as opposed to mods, ota-content which go somewhere else)
  50. VERSION_DATADIR="${GAMES_DATADIR}/${PN}"
  51. src_test() {
  52. cmake-utils_src_test
  53. }
  54. src_prepare() {
  55. git submodule init || die
  56. git submodule update || die
  57. }
  58. src_configure() {
  59. # Custom cflags break online play
  60. if use custom-cflags ; then
  61. ewarn "\e[1;31m*********************************************************************\e[0m"
  62. ewarn "You enabled Custom-CFlags! ('custom-cflags' USE flag)"
  63. ewarn "It's \e[1;31mimpossible\e[0m that this build will work in online play."
  64. ewarn "Disable it before doing a bugreport."
  65. ewarn "\e[1;31m*********************************************************************\e[0m"
  66. ebeep 6
  67. else
  68. strip-flags
  69. fi
  70. # Custom march may break online play
  71. if use custom-march ; then
  72. ewarn "\e[1;31m*********************************************************************\e[0m"
  73. ewarn "You enabled Custom-march! ('custom-march' USE flag)"
  74. ewarn "It may break online play."
  75. ewarn "If so, disable it before doing a bugreport."
  76. ewarn "\e[1;31m*********************************************************************\e[0m"
  77. mycmakeargs="${mycmakeargs} -DMARCH_FLAG=$(get-flag march)"
  78. fi
  79. # tcmalloc
  80. mycmakeargs="${mycmakeargs} $(cmake-utils_use_use tcmalloc TCMALLOC)"
  81. # dxt recompression
  82. mycmakeargs="${mycmakeargs} $(cmake-utils_useno bindist USE_LIBSQUISH)"
  83. # threadpool
  84. mycmakeargs="${mycmakeargs} $(cmake-utils_use_use threaded THREADPOOL)"
  85. # LinkingTimeOptimizations
  86. mycmakeargs="${mycmakeargs} $(cmake-utils_use lto LTO)"
  87. if use lto; then
  88. ewarn "\e[1;31m*********************************************************************\e[0m"
  89. ewarn "You enabled LinkingTimeOptimizations! ('lto' USE flag)"
  90. ewarn "It's likely that the compilation fails and/or online play may break."
  91. ewarn "If so, disable it before doing a bugreport."
  92. ewarn "\e[1;31m*********************************************************************\e[0m"
  93. fi
  94. # AI
  95. if use ai ; then
  96. # Several AI are found in submodules
  97. # EGIT_HAS_SUBMODULES="true"
  98. if use !java ; then
  99. # Don't build Java AI
  100. mycmakeargs="${mycmakeargs} -DAI_TYPES=NATIVE"
  101. fi
  102. if use !test-ai ; then
  103. # Don't build example AIs
  104. mycmakeargs="${mycmakeargs} -DAI_EXCLUDE_REGEX='Null|Test'"
  105. fi
  106. else
  107. if use !test-ai ; then
  108. mycmakeargs="${mycmakeargs} -DAI_TYPES=NONE"
  109. else
  110. mycmakeargs="${mycmakeargs} -DAI_TYPES=NATIVE"
  111. mycmakeargs="${mycmakeargs} -DAI_EXCLUDE_REGEX='^[^N].*AI'"
  112. fi
  113. fi
  114. # Selectivly enable/disable build targets
  115. for build_type in default headless dedicated
  116. do
  117. mycmakeargs="${mycmakeargs} $(cmake-utils_use ${build_type} BUILD_spring-${build_type})"
  118. done
  119. # Set common dirs
  120. LIBDIR="$(games_get_libdir)"
  121. # mycmakeargs="${mycmakeargs} -DCMAKE_INSTALL_PREFIX=/usr -DBINDIR=${GAMES_BINDIR#/usr/} -DLIBDIR=${LIBDIR#/usr/} -DDATADIR=${VERSION_DATADIR#/usr/}"
  122. # mycmakeargs="${mycmakeargs} -DCMAKE_INSTALL_PREFIX=/opt/spring/${SLOT} -DDOCDIR=share/doc/spring-${SLOT}"
  123. mycmakeargs="${mycmakeargs} -DCMAKE_INSTALL_PREFIX=/opt/spring/${SLOT}"
  124. # Enable/Disable debug symbols
  125. if use profile ; then
  126. CMAKE_BUILD_TYPE="PROFILE"
  127. else
  128. if use debug ; then
  129. CMAKE_BUILD_TYPE="RELWITHDEBINFO"
  130. else
  131. CMAKE_BUILD_TYPE="RELEASE"
  132. fi
  133. fi
  134. # Configure
  135. cmake-utils_src_configure
  136. }
  137. src_compile () {
  138. cmake-utils_src_compile
  139. }
  140. src_install () {
  141. cmake-utils_src_install
  142. prepgamesdirs
  143. }
  144. pkg_postinst() {
  145. fdo-mime_mime_database_update
  146. games_pkg_postinst
  147. }
  148.