summaryrefslogtreecommitdiff
path: root/dev-games/ogre/ogre-14.5.2.ebuild
blob: 4e06f4d73f392a31ed3ca22881e91c56e40d34a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# Copyright 2025-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit cmake flag-o-matic virtualx

# Components/Overlay/CMakeLists.txt
IMGUI_PV="1.91.9b"

DESCRIPTION="Object-oriented Graphics Rendering Engine"
HOMEPAGE="https://www.ogre3d.org/"
SRC_URI="
	https://github.com/OGRECave/ogre/archive/refs/tags/v${PV}.tar.gz
		-> ${P}.tar.gz
	https://github.com/ocornut/imgui/archive/v${IMGUI_PV}.tar.gz
		-> imgui-${IMGUI_PV}.tar.gz
"

LICENSE="MIT public-domain"
SLOT="0/$(ver_cut 1-2)"
KEYWORDS="~amd64 ~arm ~x86"

IUSE="assimp bullet cg doc +dotscene egl-only freeimage +gl3plus gles2 glslang opengl qt6 samples test tiny tools sdl vulkan wayland"
REQUIRED_USE="
	|| ( gl3plus gles2 opengl tiny vulkan )
	egl-only? ( || ( gl3plus gles2 opengl ) )
	test? ( samples )
	vulkan? ( glslang )
	wayland? ( egl-only )
"
# vulkan broken, proper handling required for wayland
RESTRICT="
	!test? ( test )
	vulkan? ( test )
	wayland? ( test )
"

# freetype and zlib are automagic
# vulkan-loader is dlopen'd
RDEPEND="
	media-libs/freetype:2
	virtual/zlib:=
	assimp? ( media-libs/assimp:= )
	bullet? ( sci-physics/bullet:= )
	cg? ( media-gfx/nvidia-cg-toolkit )
	dotscene? ( dev-libs/pugixml )
	freeimage? ( media-libs/freeimage )
	gl3plus? ( virtual/opengl )
	glslang? ( dev-util/glslang:= )
	gles2? ( virtual/opengl )
	opengl? ( virtual/opengl )
	qt6? ( dev-qt/qtbase:6[gui] )
	sdl? ( media-libs/libsdl2 )
	tools? ( dev-libs/pugixml )
	vulkan? ( media-libs/vulkan-loader )
	wayland? ( dev-libs/wayland )
	!wayland? (
		x11-libs/libX11
		x11-libs/libXaw
		x11-libs/libXt
		gl3plus? ( x11-libs/libXrandr )
		gles2? ( x11-libs/libXrandr )
		opengl? ( x11-libs/libXrandr )
	)
"
DEPEND="${RDEPEND}
	test? ( dev-cpp/gtest )
	vulkan? ( dev-util/vulkan-headers )
"
BDEPEND="
	virtual/pkgconfig
	doc? ( app-text/doxygen[dot] )
"

PATCHES=(
	"${FILESDIR}"/ogre-14.5.2-fix-tests.patch
	"${FILESDIR}"/ogre-14.5.2-clang22.patch
)

src_prepare() {
	cmake_src_prepare

	# Users should set this via their CFLAGS (like -march)
	sed -e '/check_cxx_compiler_flag(-msse OGRE_GCC_HAS_SSE)/d' \
		-i CMakeLists.txt || die

	# Force Qt6
	sed -e '/find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Gui QUIET CONFIG)/ { s/Qt5// }' \
		-i CMake/Dependencies.cmake || die

	# Lets not install test binaries
	sed -e '/ogre_install_target(Test_Ogre "" FALSE)/d' \
		-i Tests/CMakeLists.txt || die
}

src_configure() {
	# odr violations
	filter-lto

	local mycmakeargs=(
		# https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fb809aeadee57ffa24591e60cfb41aecd4823090
		-DOGRE_ENABLE_PRECOMPILED_HEADERS=OFF

		-DOGRE_BUILD_COMPONENT_BITES=ON
		-DOGRE_BUILD_COMPONENT_BULLET=$(usex bullet)
		-DOGRE_BUILD_COMPONENT_CSHARP=OFF
		-DOGRE_BUILD_COMPONENT_JAVA=OFF
		-DOGRE_BUILD_COMPONENT_MESHLODGENERATOR=ON
		-DOGRE_BUILD_COMPONENT_OVERLAY=ON
		-DOGRE_BUILD_COMPONENT_OVERLAY_IMGUI=ON
		-DOGRE_BUILD_COMPONENT_PAGING=ON
		-DOGRE_BUILD_COMPONENT_PROPERTY=ON
		-DOGRE_BUILD_COMPONENT_PYTHON=OFF
		-DOGRE_BUILD_COMPONENT_RTSHADERSYSTEM=ON
		-DOGRE_BUILD_COMPONENT_TERRAIN=ON
		-DOGRE_BUILD_COMPONENT_VOLUME=ON

		-DOGRE_BUILD_PLUGIN_ASSIMP=$(usex assimp)
		-DOGRE_BUILD_PLUGIN_BSP=ON
		-DOGRE_BUILD_PLUGIN_CG=$(usex cg) # "deprecated"
		-DOGRE_BUILD_PLUGIN_DOT_SCENE=$(usex dotscene)
		-DOGRE_BUILD_PLUGIN_EXRCODEC=OFF # "deprecated" and doesn't work
		-DOGRE_BUILD_PLUGIN_FREEIMAGE=$(usex freeimage) # "deprecated"
		-DOGRE_BUILD_PLUGIN_GLSLANG=$(usex glslang)
		-DOGRE_BUILD_PLUGIN_OCTREE=ON
		-DOGRE_BUILD_PLUGIN_PCZ=ON
		-DOGRE_BUILD_PLUGIN_PFX=ON
		-DOGRE_BUILD_PLUGIN_RSIMAGE=OFF # rust
		-DOGRE_BUILD_PLUGIN_STBI=ON # vendored stb headers

		-DOGRE_BUILD_RENDERSYSTEM_GL=$(usex opengl)
		-DOGRE_BUILD_RENDERSYSTEM_GL3PLUS=$(usex gl3plus)
		-DOGRE_BUILD_RENDERSYSTEM_GLES2=$(usex gles2)
		# "BETA". Tests will not pass with this
		-DOGRE_BUILD_RENDERSYSTEM_VULKAN=$(usex vulkan)
		-DOGRE_BUILD_RENDERSYSTEM_TINY=$(usex tiny)

		-DOGRE_BUILD_SAMPLES=$(usex samples)
		-DOGRE_INSTALL_SAMPLES=$(usex samples)
		-DOGRE_BUILD_TOOLS=$(usex tools)
		-DOGRE_INSTALL_TOOLS=$(usex tools)
		-DOGRE_BUILD_XSIEXPORTER=OFF # softimage
		-DOGRE_BUILD_TESTS=$(usex test)

		-DOGRE_BUILD_DEPENDENCIES=OFF
		-DIMGUI_DIR="${WORKDIR}/imgui-${IMGUI_PV}"

		-DOGRE_CFG_INSTALL_PATH="/etc/OGRE"
		-DOGRE_MEDIA_PATH="share/OGRE/Media"

		-DOGRE_DOCS_PATH="share/docs/${PF}"
		-DOGRE_INSTALL_DOCS=$(usex doc)

		$(cmake_use_find_package qt6 QT)
		$(cmake_use_find_package sdl SDL2)
	)

	if use gl3plus || use gles2 || use opengl ; then
		mycmakeargs+=(
			# TODO: wayland support needs more work.
			# tests don't run with tinywl and it doesnt work at runtime
			-DOGRE_USE_WAYLAND=$(usex wayland)
			-DOGRE_GLSUPPORT_USE_EGL=$(usex egl-only)
		)
	fi

	cmake_src_configure
}

src_compile() {
	cmake_src_compile
	use doc && cmake_build OgreDoc
}

src_test() {
	virtx cmake_src_test
}

pkg_postinst() {
	if use samples; then
		elog "If you experience crashes when starting /usr/bin/SampleBrowser,"
		elog "remove the cache directory at:"
		elog "  '~/.cache/OGRE Sample Browser'"
		elog "first, before filing a bug report."
	fi
}