logo

overlay

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

godot-4.3.9999.ebuild (7414B)


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