logo

overlay

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

godot-4.2.9999.ebuild (7290B)


  1. # Copyright 2022-2023 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=8
  4. PYTHON_COMPAT=( python3_{9..11} )
  5. inherit bash-completion-r1 desktop python-any-r1 scons-utils toolchain-funcs xdg git-r3
  6. DESCRIPTION="Multi-platform 2D and 3D game engine with a feature-rich editor (wayland PR)"
  7. HOMEPAGE="https://godotengine.org/ https://github.com/godotengine/godot/pull/57025"
  8. EGIT_REPO_URI="https://github.com/Riteo/godot.git"
  9. EGIT_BRANCH="wayland"
  10. LICENSE="
  11. MIT
  12. Apache-2.0 BSD Boost-1.0 CC0-1.0 Unlicense ZLIB
  13. gui? ( CC-BY-4.0 ) tools? ( OFL-1.1 )"
  14. SLOT="4"
  15. # Enable roughly same as upstream by default so it works as expected,
  16. # except raycast (tools-only heavy dependency), and deprecated.
  17. IUSE="
  18. alsa +dbus debug deprecated +fontconfig +gui pulseaudio raycast
  19. +runner speech test +theora +tools +udev +upnp +vulkan wayland +webp X"
  20. # TODO: tests still need more figuring out
  21. RESTRICT="test"
  22. REQUIRED_USE="gui? ( || ( wayland X ) )"
  23. # dlopen: libglvnd
  24. RDEPEND="
  25. app-arch/brotli:=
  26. app-arch/zstd:=
  27. dev-games/recastnavigation:=
  28. dev-libs/icu:=
  29. dev-libs/libpcre2:=[pcre32]
  30. media-libs/freetype[brotli,harfbuzz]
  31. media-libs/harfbuzz:=[icu]
  32. media-libs/libogg
  33. media-libs/libpng:=
  34. media-libs/libvorbis
  35. <net-libs/mbedtls-3:=
  36. net-libs/wslay
  37. sys-libs/zlib:=
  38. alsa? ( media-libs/alsa-lib )
  39. dbus? ( sys-apps/dbus )
  40. fontconfig? ( media-libs/fontconfig )
  41. gui? (
  42. media-libs/libglvnd
  43. X? (
  44. x11-libs/libX11
  45. x11-libs/libXcursor
  46. x11-libs/libXext
  47. x11-libs/libXi
  48. x11-libs/libXinerama
  49. x11-libs/libXrandr
  50. x11-libs/libXrender
  51. x11-libs/libxkbcommon
  52. )
  53. wayland? (
  54. gui-libs/libdecor
  55. dev-libs/wayland
  56. )
  57. tools? ( raycast? ( media-libs/embree:3 ) )
  58. vulkan? ( media-libs/vulkan-loader[X?] )
  59. )
  60. pulseaudio? ( media-libs/libpulse )
  61. speech? ( app-accessibility/speech-dispatcher )
  62. theora? ( media-libs/libtheora )
  63. tools? ( app-misc/ca-certificates )
  64. udev? ( virtual/udev )
  65. upnp? ( net-libs/miniupnpc:= )
  66. webp? ( media-libs/libwebp:= )"
  67. DEPEND="
  68. ${RDEPEND}
  69. X? ( x11-base/xorg-proto )
  70. wayland? ( dev-libs/wayland-protocols )
  71. tools? ( test? ( dev-cpp/doctest ) )"
  72. BDEPEND="
  73. virtual/pkgconfig
  74. wayland? ( dev-util/wayland-scanner )
  75. "
  76. PATCHES=(
  77. "${FILESDIR}"/${PN}-4.0_beta3-headless-header.patch
  78. "${FILESDIR}"/${PN}-4.0_rc2-musl.patch
  79. "${FILESDIR}"/${PN}-4.0_rc3-scons.patch
  80. )
  81. src_prepare() {
  82. default
  83. sed -i "1,5s/ godot/&${SLOT}/i" misc/dist/linux/godot.6 || die
  84. sed -i "/id/s/Godot/&${SLOT}/" misc/dist/linux/org.godotengine.Godot.appdata.xml || die
  85. sed -e "s/=godot/&${SLOT}/" -e "/^Name=/s/$/ ${SLOT}/" \
  86. -i misc/dist/linux/org.godotengine.Godot.desktop || die
  87. sed -i "s|pkg-config |$(tc-getPKG_CONFIG) |" platform/linuxbsd/detect.py || die
  88. # use of builtin_ switches can be messy (see below), delete to be sure
  89. local unbundle=(
  90. brotli doctest embree freetype graphite harfbuzz icu4c libogg
  91. libpng libtheora libvorbis libwebp linuxbsd_headers mbedtls
  92. miniupnpc pcre2 recastnavigation volk wayland wayland-protocols wslay
  93. zlib zstd
  94. # certs: unused by generated header, but scons panics if not found
  95. )
  96. rm -r "${unbundle[@]/#/thirdparty/}" || die
  97. ln -s "${ESYSROOT}"/usr/include/doctest thirdparty/ || die
  98. }
  99. src_compile() {
  100. local -x BUILD_NAME=gentoo # replaces "custom_build" in version string
  101. local esconsargs=(
  102. AR="$(tc-getAR)" CC="$(tc-getCC)" CXX="$(tc-getCXX)"
  103. progress=no
  104. verbose=yes
  105. use_sowrap=no
  106. alsa=$(usex alsa)
  107. dbus=$(usex dbus)
  108. deprecated=$(usex deprecated)
  109. fontconfig=$(usex fontconfig)
  110. opengl3=$(usex gui)
  111. pulseaudio=$(usex pulseaudio)
  112. speechd=$(usex speech)
  113. udev=$(usex udev)
  114. use_volk=no # unnecessary when linking directly to libvulkan
  115. vulkan=$(usex gui $(usex vulkan))
  116. x11=$(usex gui $(usex X))
  117. wayland=$(usex gui $(usex wayland))
  118. system_certs_path="${EPREFIX}"/etc/ssl/certs/ca-certificates.crt
  119. # platform/*/detect.py uses builtin_* switches to check if need
  120. # to link with system libraries, but many ignore whether the dep
  121. # is actually used, so "enable" deleted builtins on disabled deps
  122. builtin_brotli=no
  123. builtin_certs=no
  124. builtin_embree=$(usex !gui yes $(usex !tools yes $(usex !raycast)))
  125. builtin_enet=yes # bundled copy is patched for IPv6+DTLS support
  126. builtin_freetype=no
  127. builtin_glslang=yes #879111 (for now, may revisit if more stable)
  128. builtin_graphite=no
  129. builtin_harfbuzz=no
  130. builtin_icu4c=no
  131. builtin_libdecor=no
  132. builtin_libogg=no
  133. builtin_libpng=no
  134. builtin_libtheora=$(usex !theora)
  135. builtin_libvorbis=no
  136. builtin_libwebp=$(usex !webp)
  137. builtin_mbedtls=no
  138. builtin_miniupnpc=$(usex !upnp)
  139. builtin_msdfgen=yes # not wired for unbundling nor packaged
  140. builtin_pcre2=no
  141. builtin_recastnavigation=no
  142. builtin_rvo2=yes # bundled copy has godot-specific changes
  143. builtin_squish=yes # ^ likewise, may not be safe to unbundle
  144. builtin_wayland=no
  145. builtin_wslay=no
  146. builtin_xatlas=yes # not wired for unbundling nor packaged
  147. builtin_zlib=no
  148. builtin_zstd=no
  149. # (more is bundled in third_party/ but they lack builtin_* switches)
  150. # modules with optional dependencies, "possible" to disable more but
  151. # gets messy and breaks all sorts of features (expected enabled)
  152. module_mono_enabled=no # unhandled
  153. # note raycast is only enabled on amd64+arm64, see raycast/config.py
  154. module_raycast_enabled=$(usex gui $(usex tools $(usex raycast)))
  155. module_theora_enabled=$(usex theora)
  156. module_upnp_enabled=$(usex upnp)
  157. module_webp_enabled=$(usex webp)
  158. # let *FLAGS handle these, e.g. can pass -flto as-is
  159. debug_symbols=no
  160. lto=none
  161. optimize=custom
  162. use_static_cpp=no
  163. )
  164. if use runner && use tools; then
  165. # build alternate faster + ~60% smaller binary for running
  166. # games or servers without game development debug paths
  167. escons extra_suffix=runner target=template_release "${esconsargs[@]}"
  168. fi
  169. esconsargs+=(
  170. target=$(usex tools editor template_$(usex debug{,} release))
  171. dev_build=$(usex debug)
  172. # harmless but note this bakes in --test in the final binary
  173. tests=$(usex tools $(usex test))
  174. )
  175. escons extra_suffix=main "${esconsargs[@]}"
  176. }
  177. src_test() {
  178. xdg_environment_reset
  179. bin/godot*.main --headless --test || die
  180. }
  181. src_install() {
  182. local s=godot${SLOT}
  183. newbin bin/godot*.main ${s}
  184. if use runner && use tools; then
  185. newbin bin/godot*.runner ${s}-runner
  186. else
  187. # always available, revdeps shouldn't depend on [runner]
  188. dosym ${s} /usr/bin/${s}-runner
  189. fi
  190. newman misc/dist/linux/godot.6 ${s}.6
  191. dodoc AUTHORS.md CHANGELOG.md DONORS.md README.md
  192. if use gui; then
  193. newicon icon.svg ${s}.svg
  194. newmenu misc/dist/linux/org.godotengine.Godot.desktop \
  195. org.godotengine.${s^}.desktop
  196. insinto /usr/share/metainfo
  197. newins misc/dist/linux/org.godotengine.Godot.appdata.xml \
  198. org.godotengine.${s^}.appdata.xml
  199. insinto /usr/share/mime/application
  200. newins misc/dist/linux/org.godotengine.Godot.xml \
  201. org.godotengine.${s^}.xml
  202. fi
  203. newbashcomp misc/dist/shell/godot.bash-completion ${s}
  204. bashcomp_alias ${s}{,-runner}
  205. insinto /usr/share/fish/vendor_completions.d
  206. newins misc/dist/shell/godot.fish ${s}.fish
  207. dosym ${s}.fish /usr/share/fish/vendor_completions.d/${s}-runner.fish
  208. insinto /usr/share/zsh/site-functions
  209. newins misc/dist/shell/_godot.zsh-completion _${s}
  210. dosym _${s} /usr/share/zsh/site-functions/_${s}-runner
  211. }