qudos-0.40.1.ebuild 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit eutils toolchain-funcs games
  5. FILE_STEM="QuDos-${PV}-src"
  6. PK3_FILE="QuDos-${PV}.pk3"
  7. MY_PN="quake2"
  8. DESCRIPTION="Enhanced Quake 2 engine"
  9. HOMEPAGE="https://github.com/ZwS/qudos"
  10. SRC_URI="mirror://gentoo/${FILE_STEM}.tar.bz2
  11. https://github.com/ZwS/qudos/raw/master/quake2/baseq2/qudos.pk3 -> ${PK3_FILE}"
  12. LICENSE="GPL-2+"
  13. SLOT="0"
  14. KEYWORDS="~amd64 ~x86"
  15. IUSE="cdinstall debug dedicated demo dga ipv6 joystick mods opengl qmax oss sdl textures"
  16. DEPEND="opengl? (
  17. virtual/opengl
  18. virtual/glu )
  19. sdl? ( media-libs/libsdl[joystick?,opengl,sound,video]
  20. virtual/opengl
  21. virtual/glu )
  22. virtual/jpeg:0
  23. media-libs/libogg
  24. media-libs/libpng:0
  25. media-libs/libvorbis
  26. sys-libs/zlib
  27. x11-libs/libX11
  28. x11-libs/libXext
  29. x11-libs/libXxf86dga
  30. x11-libs/libXxf86vm"
  31. RDEPEND="${DEPEND}
  32. cdinstall? ( games-fps/quake2-data )
  33. demo? ( games-fps/quake2-demodata[symlink] )
  34. textures? ( games-fps/quake2-textures )"
  35. S=${WORKDIR}/${FILE_STEM}
  36. dir=${GAMES_DATADIR}/${MY_PN}
  37. default_client() {
  38. if use opengl || use sdl || ! use dedicated ; then
  39. # Build default client
  40. return 0
  41. fi
  42. return 1
  43. }
  44. pkg_setup() {
  45. games_pkg_setup
  46. if ! use qmax && $( use opengl || use sdl ) ; then
  47. elog "The 'qmax' graphical improvements are recommended."
  48. echo
  49. fi
  50. if use debug ; then
  51. ewarn "The 'debug' USE flag may cause compilation to fail with:"
  52. ewarn
  53. ewarn "src/qcommon/cmd.c:364: warning: dereferencing type-punned"
  54. ewarn "pointer will break strict-aliasing rules."
  55. echo
  56. fi
  57. # Determine the default sound driver, in order of preference
  58. # snd_drv is not a local variable
  59. snd_drv=""
  60. [[ -z "${snd_drv}" ]] && use oss && snd_drv="oss"
  61. [[ -z "${snd_drv}" ]] && use sdl && snd_drv="sdl"
  62. # Default if nothing else chosen
  63. [[ -z "${snd_drv}" ]] && snd_drv="oss"
  64. if default_client ; then
  65. elog "Selected the ${snd_drv} sound driver as the default."
  66. echo
  67. fi
  68. }
  69. src_unpack() {
  70. unpack "${FILE_STEM}.tar.bz2"
  71. }
  72. src_prepare() {
  73. rm docs/gnu.txt
  74. # Change default sound driver and its location
  75. sed -i \
  76. -e "s:\"oss\":\"${snd_drv}\":" \
  77. -e "s:\"\./snd:\"$(games_get_libdir)/${PN}/snd:" \
  78. src/client/snd_dma.c || die
  79. sed -i \
  80. -e 's:jpeg_mem_src:qudos_jpeg_mem_src:g' \
  81. src/ref_gl/gl_image.c || die
  82. if has_version '>=sys-libs/zlib-1.2.5.1-r1' ; then
  83. sed -i \
  84. -e '1i#define OF(x) x' \
  85. src/qcommon/unzip/ioapi.h || die
  86. fi
  87. sed -i -e '106,119 s/CFL/LED/' Makefile || die
  88. epatch \
  89. "${FILESDIR}"/${P}-libpng15.patch \
  90. "${FILESDIR}"/${P}-gnusource.patch
  91. }
  92. src_compile() {
  93. yesno() { usex $1 YES NO; }
  94. local client="YES"
  95. default_client || client="NO"
  96. local type="release"
  97. use debug && type="debug"
  98. emake \
  99. BUILD_QUAKE2="${client}" \
  100. BUILD_DEDICATED=$(yesno dedicated) \
  101. BUILD_GLX=$(yesno opengl) \
  102. BUILD_SDLGL=$(yesno sdl) \
  103. BUILD_ALSA_SND=NO \
  104. BUILD_SDL_SND=$(yesno sdl) \
  105. BUILD_OSS_SND=$(yesno oss) \
  106. WITH_XMMS=NO \
  107. WITH_DGA_MOUSE=$(yesno dga) \
  108. WITH_JOYSTICK=$(yesno joystick) \
  109. TYPE="${type}" \
  110. DATADIR="${dir}" \
  111. LOCALBASE=/usr \
  112. LIBDIR="$(games_get_libdir)"/${PN} \
  113. WITH_QMAX=$(yesno qmax) \
  114. BUILD_3ZB2=$(yesno mods) \
  115. BUILD_CTF=$(yesno mods) \
  116. BUILD_JABOT=$(yesno mods) \
  117. BUILD_ROGUE=$(yesno mods) \
  118. BUILD_XATRIX=$(yesno mods) \
  119. BUILD_ZAERO=$(yesno mods) \
  120. WITH_BOTS=$(yesno mods) \
  121. HAVE_IPV6=$(yesno ipv6) \
  122. CC="$(tc-getCC)" \
  123. WITH_X86_ASM=NO \
  124. WITH_DATADIR=YES \
  125. WITH_LIBDIR=YES \
  126. BUILD_DEBUG_DIR=release \
  127. BUILD_RELEASE_DIR=release
  128. }
  129. src_install() {
  130. if default_client ; then
  131. newgamesbin ${MY_PN}/QuDos ${PN}
  132. # Change from gif to png in next version?
  133. newicon docs/q2_orig/quake2.gif ${PN}.gif
  134. make_desktop_entry ${PN} "QuDos" ${PN}.gif
  135. fi
  136. if use dedicated ; then
  137. newgamesbin ${MY_PN}/QuDos-ded ${PN}-ded
  138. fi
  139. insinto "$(games_get_libdir)"/${PN}
  140. doins -r ${MY_PN}/*
  141. rm "${D}/$(games_get_libdir)"/${PN}/QuDos
  142. insinto "$(games_get_libdir)"/${PN}/baseq2
  143. newins "${DISTDIR}/${PK3_FILE}" qudos.pk3
  144. dodoc $(find docs -name \*.txt) docs/q2_orig/README*
  145. prepgamesdirs
  146. }