logo

overlay

My own overlay for experimentations, use with caution, no support is provided git clone https://hacktivis.me/git/overlay.git

libsdl2-9999.ebuild (6157B)


  1. # Copyright 1999-2021 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=7
  4. inherit autotools flag-o-matic toolchain-funcs multilib-minimal
  5. if [[ "${PV}" == "9999" ]]
  6. then
  7. inherit git-r3
  8. EGIT_REPO_URI="https://github.com/libsdl-org/SDL"
  9. else
  10. MY_P="SDL2-${PV}"
  11. SRC_URI="https://www.libsdl.org/release/${MY_P}.tar.gz"
  12. S="${WORKDIR}/${MY_P}"
  13. KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ppc ~ppc64 sparc ~x86"
  14. fi
  15. DESCRIPTION="Simple Direct Media Layer"
  16. HOMEPAGE="https://www.libsdl.org/"
  17. LICENSE="ZLIB"
  18. SLOT="0"
  19. IUSE="alsa aqua cpu_flags_ppc_altivec cpu_flags_x86_3dnow cpu_flags_x86_mmx cpu_flags_x86_sse cpu_flags_x86_sse2 custom-cflags dbus fcitx4 gles1 gles2 haptic ibus jack +joystick kms libsamplerate nas opengl oss pulseaudio +sound static-libs +threads udev +video video_cards_vc4 vulkan wayland X xinerama xscreensaver"
  20. REQUIRED_USE="
  21. alsa? ( sound )
  22. fcitx4? ( dbus )
  23. gles1? ( video )
  24. gles2? ( video )
  25. ibus? ( dbus )
  26. jack? ( sound )
  27. nas? ( sound )
  28. opengl? ( video )
  29. pulseaudio? ( sound )
  30. vulkan? ( video )
  31. wayland? ( gles2 )
  32. xinerama? ( X )
  33. xscreensaver? ( X )"
  34. CDEPEND="
  35. alsa? ( >=media-libs/alsa-lib-1.0.27.2[${MULTILIB_USEDEP}] )
  36. dbus? ( >=sys-apps/dbus-1.6.18-r1[${MULTILIB_USEDEP}] )
  37. fcitx4? ( app-i18n/fcitx:4 )
  38. gles1? ( media-libs/mesa[${MULTILIB_USEDEP},gles1] )
  39. gles2? ( >=media-libs/mesa-9.1.6[${MULTILIB_USEDEP},gles2] )
  40. ibus? ( app-i18n/ibus )
  41. jack? ( virtual/jack[${MULTILIB_USEDEP}] )
  42. kms? (
  43. >=x11-libs/libdrm-2.4.82[${MULTILIB_USEDEP}]
  44. >=media-libs/mesa-9.0.0[${MULTILIB_USEDEP},gbm(+)]
  45. )
  46. libsamplerate? ( media-libs/libsamplerate[${MULTILIB_USEDEP}] )
  47. nas? (
  48. >=media-libs/nas-1.9.4[${MULTILIB_USEDEP}]
  49. >=x11-libs/libXt-1.1.4[${MULTILIB_USEDEP}]
  50. )
  51. opengl? (
  52. >=virtual/opengl-7.0-r1[${MULTILIB_USEDEP}]
  53. >=virtual/glu-9.0-r1[${MULTILIB_USEDEP}]
  54. )
  55. pulseaudio? ( >=media-sound/pulseaudio-2.1-r1[${MULTILIB_USEDEP}] )
  56. udev? ( >=virtual/libudev-208:=[${MULTILIB_USEDEP}] )
  57. wayland? (
  58. >=dev-libs/wayland-1.0.6[${MULTILIB_USEDEP}]
  59. >=media-libs/mesa-9.1.6[${MULTILIB_USEDEP},egl(+),gles2,wayland]
  60. >=x11-libs/libxkbcommon-0.2.0[${MULTILIB_USEDEP}]
  61. )
  62. X? (
  63. >=x11-libs/libX11-1.6.2[${MULTILIB_USEDEP}]
  64. >=x11-libs/libXcursor-1.1.14[${MULTILIB_USEDEP}]
  65. >=x11-libs/libXext-1.3.2[${MULTILIB_USEDEP}]
  66. >=x11-libs/libXi-1.7.2[${MULTILIB_USEDEP}]
  67. >=x11-libs/libXrandr-1.4.2[${MULTILIB_USEDEP}]
  68. >=x11-libs/libXxf86vm-1.1.3[${MULTILIB_USEDEP}]
  69. xinerama? ( >=x11-libs/libXinerama-1.1.3[${MULTILIB_USEDEP}] )
  70. xscreensaver? ( >=x11-libs/libXScrnSaver-1.2.2-r1[${MULTILIB_USEDEP}] )
  71. )"
  72. RDEPEND="${CDEPEND}
  73. vulkan? ( media-libs/vulkan-loader )"
  74. DEPEND="${CDEPEND}
  75. ibus? ( dev-libs/glib:2[${MULTILIB_USEDEP}] )
  76. vulkan? ( dev-util/vulkan-headers )
  77. X? ( x11-base/xorg-proto )
  78. "
  79. BDEPEND="
  80. virtual/pkgconfig
  81. "
  82. MULTILIB_WRAPPED_HEADERS=(
  83. /usr/include/SDL2/SDL_config.h
  84. /usr/include/SDL2/SDL_platform.h
  85. /usr/include/SDL2/begin_code.h
  86. /usr/include/SDL2/close_code.h
  87. )
  88. src_prepare() {
  89. default
  90. # Unbundle some headers.
  91. rm -r src/video/khronos || die
  92. ln -s "${ESYSROOT}/usr/include" src/video/khronos || die
  93. # SDL seems to customize SDL_config.h.in to remove macros like
  94. # PACKAGE_NAME. Add AT_NOEAUTOHEADER="yes" to prevent those macros from
  95. # being reintroduced.
  96. # https://bugs.gentoo.org/764959
  97. AT_NOEAUTOHEADER="yes" AT_M4DIR="/usr/share/aclocal acinclude" \
  98. eautoreconf
  99. # libsdl2-2.0.14 build regression. Please check if still needed
  100. multilib_copy_sources
  101. }
  102. multilib_src_configure() {
  103. use custom-cflags || strip-flags
  104. if use ibus; then
  105. local -x IBUS_CFLAGS="-I${ESYSROOT}/usr/include/ibus-1.0 -I${ESYSROOT}/usr/include/glib-2.0 -I${ESYSROOT}/usr/$(get_libdir)/glib-2.0/include"
  106. fi
  107. # sorted by `./configure --help`
  108. local myeconfargs=(
  109. $(use_enable static-libs static)
  110. --enable-atomic
  111. $(use_enable sound audio)
  112. $(use_enable video)
  113. --enable-render
  114. --enable-events
  115. $(use_enable joystick)
  116. $(use_enable haptic)
  117. --enable-power
  118. --enable-filesystem
  119. $(use_enable threads)
  120. --enable-timers
  121. --enable-file
  122. --enable-loadso
  123. --enable-cpuinfo
  124. --enable-assembly
  125. $(use_enable cpu_flags_ppc_altivec altivec)
  126. $(use_enable cpu_flags_x86_sse ssemath)
  127. $(use_enable cpu_flags_x86_mmx mmx)
  128. $(use_enable cpu_flags_x86_3dnow 3dnow)
  129. $(use_enable cpu_flags_x86_sse sse)
  130. $(use_enable cpu_flags_x86_sse2 sse2)
  131. $(use_enable oss)
  132. $(use_enable alsa)
  133. --disable-alsa-shared
  134. $(use_enable jack)
  135. --disable-jack-shared
  136. --disable-esd
  137. $(use_enable pulseaudio)
  138. --disable-pulseaudio-shared
  139. --disable-arts
  140. $(use_enable libsamplerate)
  141. $(use_enable nas)
  142. --disable-nas-shared
  143. --enable-sndio
  144. --disable-sndio-shared
  145. $(use_enable sound diskaudio)
  146. $(use_enable sound dummyaudio)
  147. $(use_enable wayland video-wayland)
  148. --disable-wayland-shared
  149. $(use_enable video_cards_vc4 video-rpi)
  150. $(use_enable X video-x11)
  151. --disable-x11-shared
  152. $(use_enable X video-x11-xcursor)
  153. $(use_enable X video-x11-xdbe)
  154. $(use_enable xinerama video-x11-xinerama)
  155. $(use_enable X video-x11-xinput)
  156. $(use_enable X video-x11-xrandr)
  157. $(use_enable xscreensaver video-x11-scrnsaver)
  158. $(use_enable X video-x11-xshape)
  159. $(use_enable X video-x11-vm)
  160. $(use_enable aqua video-cocoa)
  161. --disable-video-directfb
  162. --disable-fusionsound
  163. --disable-fusionsound-shared
  164. $(use_enable kms video-kmsdrm)
  165. --disable-kmsdrm-shared
  166. $(use_enable video video-dummy)
  167. $(use_enable opengl video-opengl)
  168. $(use_enable gles1 video-opengles1)
  169. $(use_enable gles2 video-opengles2)
  170. $(use_enable vulkan video-vulkan)
  171. $(use_enable udev libudev)
  172. $(use_enable dbus)
  173. $(use_enable fcitx4 fcitx)
  174. $(use_enable ibus)
  175. --disable-directx
  176. --disable-rpath
  177. --disable-render-d3d
  178. $(use_with X x)
  179. )
  180. #ECONF_SOURCE="${S}"
  181. econf "${myeconfargs[@]}"
  182. }
  183. multilib_src_compile() {
  184. emake V=1
  185. }
  186. multilib_src_install() {
  187. emake DESTDIR="${D}" install
  188. }
  189. multilib_src_install_all() {
  190. # Do not delete the static .a libraries here as some are
  191. # mandatory. They may be needed even when linking dynamically.
  192. find "${ED}" -type f -name "*.la" -delete || die
  193. dodoc {BUGS,CREDITS,README-SDL,TODO,WhatsNew}.txt docs/README*.md
  194. }