4973a50d793b55156b9e3d9e25cd7ae1c5ac4b7a
[gentoo.git] / dev-games / ogre / ogre-2.1_pre20191212.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 CMAKE_REMOVE_MODULES_LIST="FindFreetype FindDoxygen FindZLIB"
7
8 inherit cmake flag-o-matic git-r3
9
10 DESCRIPTION="Object-oriented Graphics Rendering Engine"
11 HOMEPAGE="https://www.ogre3d.org/"
12
13 EGIT_BRANCH="v2-1"
14 EGIT_COMMIT="5b682fb90c9e8e660e2fbf92bbf7797a9246700d"
15 EGIT_REPO_URI="https://github.com/OGRECave/ogre-next.git"
16 EGIT_SUBMODULES=()
17
18 LICENSE="MIT public-domain"
19 SLOT="0/2.1"
20 KEYWORDS="~amd64"
21
22 IUSE="+cache debug doc egl examples +freeimage gles2 json
23         legacy-animations mobile +opengl profile tools"
24
25 # USE flags that do not work, as their options aren't ported, yet.
26 #      cg
27 #      double-precision
28
29 REQUIRED_USE="
30         || ( gles2 opengl )
31         mobile? ( egl gles2 !opengl )"
32
33 RESTRICT="test" #139905
34
35 RDEPEND="
36         dev-games/ois
37         dev-libs/zziplib
38         media-libs/freetype:2
39         x11-libs/libX11
40         x11-libs/libXaw
41         x11-libs/libXrandr
42         x11-libs/libXt
43         egl? ( media-libs/mesa[egl] )
44         freeimage? ( media-libs/freeimage )
45         gles2? ( media-libs/mesa[gles2] )
46         json? ( dev-libs/rapidjson )
47         opengl? (
48                 virtual/glu
49                 virtual/opengl
50         )
51         tools? ( dev-libs/tinyxml[stl] )
52 "
53 # Dependencies for USE flags that do not work, yet.
54 #       cg? ( media-gfx/nvidia-cg-toolkit )
55
56 DEPEND="${RDEPEND}
57         virtual/pkgconfig
58         x11-base/xorg-proto
59         doc? ( app-doc/doxygen )"
60
61 PATCHES=(
62         "${FILESDIR}/${PN}-2.1-samples.patch"
63         "${FILESDIR}/${PN}-2.1-resource_path.patch"
64         "${FILESDIR}/${PN}-2.1-media_path.patch"
65         "${FILESDIR}/${PN}-2.1-enhance_config_loading.patch"
66 )
67
68 src_prepare() {
69         sed -i \
70                 -e "s:share/OGRE/docs:share/doc/${PF}:" \
71                 Docs/CMakeLists.txt || die
72         # Stupid build system hardcodes release names
73         sed -i \
74                 -e '/CONFIGURATIONS/s:CONFIGURATIONS Release.*::' \
75                 CMake/Utils/OgreConfigTargets.cmake || die
76
77         # Fix some path issues
78         cmake_src_prepare
79 }
80
81 src_configure() {
82         local mycmakeargs=(
83                 -DOGRE_BUILD_COMPONENT_HLMS_PBS=$(         usex mobile no yes)
84                 -DOGRE_BUILD_COMPONENT_HLMS_PBS_MOBILE=$(  usex mobile)
85                 -DOGRE_BUILD_COMPONENT_HLMS_UNLIT=$(       usex mobile no yes)
86                 -DOGRE_BUILD_COMPONENT_HLMS_UNLIT_MOBILE=$(usex mobile)
87                 -DOGRE_BUILD_COMPONENT_PLANAR_REFLECTIONS=yes
88                 -DOGRE_BUILD_COMPONENT_SCENE_FORMAT=yes
89                 -DOGRE_BUILD_PLATFORM_NACL=no
90                 -DOGRE_BUILD_RENDERSYSTEM_GL3PLUS=$(usex opengl)
91                 -DOGRE_BUILD_RENDERSYSTEM_GLES=no
92                 -DOGRE_BUILD_RENDERSYSTEM_GLES2=$(usex gles2)
93                 -DOGRE_BUILD_SAMPLES2=$(usex examples)
94                 -DOGRE_BUILD_TESTS=no
95                 -DOGRE_BUILD_TOOLS=$(usex tools)
96                 -DOGRE_CONFIG_ALLOCATOR=$(usex debug 5 1)
97                 -DOGRE_CONFIG_ENABLE_FINE_LIGHT_MASK_GRANULARITY=yes
98                 -DOGRE_CONFIG_ENABLE_FREEIMAGE=$(usex freeimage)
99                 -DOGRE_CONFIG_ENABLE_GL_STATE_CACHE_SUPPORT=$(usex cache)
100                 -DOGRE_CONFIG_ENABLE_GLES3_SUPPORT=$(\
101                         usex gles2 $(\
102                         usex mobile no yes) no)
103                 -DOGRE_CONFIG_ENABLE_JSON=$(usex json)
104                 -DOGRE_CONFIG_MEMTRACK_DEBUG=$(usex debug)
105                 -DOGRE_CONFIG_THREADS=2
106                 -DOGRE_CONFIG_THREAD_PROVIDER=std
107                 -DOGRE_FULL_RPATH=no
108                 -DOGRE_INSTALL_DOCS=$(usex doc)
109                 -DOGRE_INSTALL_SAMPLES=$(usex examples)
110                 -DOGRE_INSTALL_SAMPLES_SOURCE=$(usex examples)
111                 -DOGRE_LEGACY_ANIMATIONS=$(usex legacy-animations)
112                 -DOGRE_PROFILING_PROVIDER=$(usex profile none internal)
113                 -DOGRE_USE_BOOST=no
114         )
115
116         # The double-precision mode can not be enabled, yet.
117         #       -DOGRE_CONFIG_DOUBLE=$(usex double-precision)
118
119         # The CgFxScriptLoader doesn't seem to be completely ported, yet.
120         # USE flag disabled.
121         mycmakeargs+=(
122                 -DOGRE_BUILD_PLUGIN_CG=no
123         )
124
125         # These components are off by default, as they might not be ported, yet.
126         # When advancing to a newer commit, try whether any of the disabled
127         # components can be activated now.
128         mycmakeargs+=(
129                 -DOGRE_BUILD_COMPONENT_PAGING=no
130                 -DOGRE_BUILD_COMPONENT_PROPERTY=no
131                 -DOGRE_BUILD_COMPONENT_RTSHADERSYSTEM=no
132                 -DOGRE_BUILD_RTSHADERSYSTEM_CORE_SHADERS=no
133                 -DOGRE_BUILD_RTSHADERSYSTEM_EXT_SHADERS=no
134                 -DOGRE_BUILD_COMPONENT_TERRAIN=no
135                 -DOGRE_BUILD_COMPONENT_VOLUME=no
136         )
137
138         # Take out the warning about deprecated copy, as Ogre emits thousands of
139         # those. But using a deprecated way of doing things isn't an error and
140         # mainly of interest for developers.
141         # (The warning is part of -Wextra and only effects C++ compilation.)
142         append-cxxflags $(test-flags-CXX -Wno-deprecated-copy)
143
144         # The same with the old ways of using memset(0...) on objects. It is
145         # no longer assumed to be a good idea, but a warning about it isn't
146         # of any value to the user. (And it happens many times in Ogre.)
147         append-cxxflags $(test-flags-CXX -Wno-class-memaccess)
148
149         cmake_src_configure
150 }
151
152 src_install() {
153         cmake_src_install
154
155         CONFIGDIR=/etc/OGRE
156         SHAREDIR=/usr/share/OGRE
157
158         # plugins and resources are the main configuration
159         insinto "${CONFIGDIR}"
160         doins "${BUILD_DIR}"/bin/plugins.cfg
161         doins "${BUILD_DIR}"/bin/plugins_tools.cfg
162         doins "${BUILD_DIR}"/bin/resources.cfg
163         doins "${BUILD_DIR}"/bin/resources2.cfg
164         dosym "${CONFIGDIR}"/plugins.cfg "${SHAREDIR}"/plugins.cfg
165         dosym "${CONFIGDIR}"/plugins_tools.cfg "${SHAREDIR}"/plugins_tools.cfg
166         dosym "${CONFIGDIR}"/resources.cfg "${SHAREDIR}"/resources.cfg
167         dosym "${CONFIGDIR}"/resources2.cfg "${SHAREDIR}"/resources2.cfg
168
169         # These are only for the Samples
170         if use examples ; then
171                 insinto "${SHAREDIR}"
172                 doins "${BUILD_DIR}"/bin/samples.cfg
173         fi
174 }