Gentoo Archives: gentoo-commits

From: Jonathan Scruggs <dracwyrm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-gfx/blender/, media-gfx/blender/files/
Date: Tue, 30 Jan 2018 18:44:27
Message-Id: 1517337758.1f42d5c611fea036935b4a59b2cfbde2863e1c12.dracwyrm@gentoo
1 commit: 1f42d5c611fea036935b4a59b2cfbde2863e1c12
2 Author: Jonathan Scruggs <dracwyrm <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jan 29 14:57:36 2018 +0000
4 Commit: Jonathan Scruggs <dracwyrm <AT> gentoo <DOT> org>
5 CommitDate: Tue Jan 30 18:42:38 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1f42d5c6
7
8 media-gfx/blender: add fix to build with osl 1.9
9
10 Package-Manager: Portage-2.3.20, Repoman-2.3.6
11
12 media-gfx/blender/blender-2.79-r1.ebuild | 290 +++++++++++++++++++++
13 .../blender-2.79-fix-build-with-OSL-1.9.x.patch | 26 ++
14 2 files changed, 316 insertions(+)
15
16 diff --git a/media-gfx/blender/blender-2.79-r1.ebuild b/media-gfx/blender/blender-2.79-r1.ebuild
17 new file mode 100644
18 index 00000000000..108783768d0
19 --- /dev/null
20 +++ b/media-gfx/blender/blender-2.79-r1.ebuild
21 @@ -0,0 +1,290 @@
22 +# Copyright 1999-2018 Gentoo Foundation
23 +# Distributed under the terms of the GNU General Public License v2
24 +
25 +EAPI=6
26 +PYTHON_COMPAT=( python{3_5,3_6} )
27 +
28 +inherit check-reqs cmake-utils xdg-utils flag-o-matic gnome2-utils \
29 + pax-utils python-single-r1 toolchain-funcs versionator
30 +
31 +DESCRIPTION="3D Creation/Animation/Publishing System"
32 +HOMEPAGE="http://www.blender.org"
33 +
34 +SRC_URI="http://download.blender.org/source/${P}.tar.gz"
35 +
36 +# Blender can have letters in the version string,
37 +# so strip of the letter if it exists.
38 +MY_PV="$(get_version_component_range 1-2)"
39 +
40 +SLOT="0"
41 +LICENSE="|| ( GPL-2 BL )"
42 +KEYWORDS="~amd64 ~x86"
43 +IUSE="+bullet +dds +elbeem +game-engine +openexr collada colorio \
44 + cuda cycles debug doc ffmpeg fftw headless jack jemalloc jpeg2k libav \
45 + llvm man ndof nls openal opencl openimageio openmp opensubdiv openvdb \
46 + osl player sdl sndfile test tiff valgrind"
47 +
48 +REQUIRED_USE="${PYTHON_REQUIRED_USE}
49 + player? ( game-engine !headless )
50 + cuda? ( cycles )
51 + cycles? ( openexr tiff openimageio )
52 + opencl? ( cycles )
53 + osl? ( cycles llvm )"
54 +
55 +RDEPEND="${PYTHON_DEPS}
56 + >=dev-libs/boost-1.62:=[nls?,threads(+)]
57 + dev-libs/lzo:2
58 + >=dev-python/numpy-1.10.1[${PYTHON_USEDEP}]
59 + dev-python/requests[${PYTHON_USEDEP}]
60 + media-libs/freetype
61 + media-libs/glew:*
62 + media-libs/libpng:0=
63 + media-libs/libsamplerate
64 + sys-libs/zlib
65 + virtual/glu
66 + virtual/jpeg:0=
67 + virtual/libintl
68 + virtual/opengl
69 + collada? ( >=media-libs/opencollada-1.6.18:= )
70 + colorio? ( media-libs/opencolorio )
71 + cuda? ( dev-util/nvidia-cuda-toolkit:= )
72 + ffmpeg? ( media-video/ffmpeg:=[x264,mp3,encode,theora,jpeg2k?] )
73 + libav? ( >=media-video/libav-11.3:=[x264,mp3,encode,theora,jpeg2k?] )
74 + fftw? ( sci-libs/fftw:3.0= )
75 + !headless? (
76 + x11-libs/libX11
77 + x11-libs/libXi
78 + x11-libs/libXxf86vm
79 + )
80 + jack? ( virtual/jack )
81 + jemalloc? ( dev-libs/jemalloc:= )
82 + jpeg2k? ( media-libs/openjpeg:0 )
83 + llvm? ( sys-devel/llvm:= )
84 + ndof? (
85 + app-misc/spacenavd
86 + dev-libs/libspnav
87 + )
88 + nls? ( virtual/libiconv )
89 + openal? ( media-libs/openal )
90 + opencl? ( virtual/opencl )
91 + openimageio? ( >=media-libs/openimageio-1.7.0 )
92 + openexr? (
93 + >=media-libs/ilmbase-2.2.0:=
94 + >=media-libs/openexr-2.2.0:=
95 + )
96 + opensubdiv? ( >=media-libs/opensubdiv-3.3.0:=[cuda=,opencl=] )
97 + openvdb? (
98 + media-gfx/openvdb[${PYTHON_USEDEP},abi3-compat(+),openvdb-compression(+)]
99 + dev-cpp/tbb
100 + >=dev-libs/c-blosc-1.5.2
101 + )
102 + osl? ( media-libs/osl:= )
103 + sdl? ( media-libs/libsdl2[sound,joystick] )
104 + sndfile? ( media-libs/libsndfile )
105 + tiff? ( media-libs/tiff:0 )
106 + valgrind? ( dev-util/valgrind )"
107 +
108 +DEPEND="${RDEPEND}
109 + virtual/pkgconfig
110 + >=dev-cpp/eigen-3.2.8:3
111 + nls? ( sys-devel/gettext )
112 + doc? (
113 + app-doc/doxygen[-nodot(-),dot(+),latex]
114 + dev-python/sphinx[latex]
115 + )"
116 +
117 +PATCHES=(
118 + "${FILESDIR}/${PN}-fix-install-rules.patch"
119 + "${FILESDIR}/${P}-fix-build-with-OSL-1.9.x.patch"
120 +)
121 +
122 +blender_check_requirements() {
123 + [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
124 +
125 + if use doc; then
126 + CHECKREQS_DISK_BUILD="4G" check-reqs_pkg_pretend
127 + fi
128 +}
129 +
130 +pkg_pretend() {
131 + blender_check_requirements
132 +}
133 +
134 +pkg_setup() {
135 + blender_check_requirements
136 + python-single-r1_pkg_setup
137 +}
138 +
139 +src_prepare() {
140 + cmake-utils_src_prepare
141 +
142 + # we don't want static glew, but it's scattered across
143 + # multiple files that differ from version to version
144 + # !!!CHECK THIS SED ON EVERY VERSION BUMP!!!
145 + local file
146 + while IFS="" read -d $'\0' -r file ; do
147 + sed -i -e '/-DGLEW_STATIC/d' "${file}" || die
148 + done < <(find . -type f -name "CMakeLists.txt")
149 +
150 + # Disable MS Windows help generation. The variable doesn't do what it
151 + # it sounds like.
152 + sed -e "s|GENERATE_HTMLHELP = YES|GENERATE_HTMLHELP = NO|" \
153 + -i doc/doxygen/Doxyfile || die
154 +}
155 +
156 +src_configure() {
157 + # FIX: forcing '-funsigned-char' fixes an anti-aliasing issue with menu
158 + # shadows, see bug #276338 for reference
159 + append-flags -funsigned-char
160 + append-lfs-flags
161 + append-cppflags -DOPENVDB_3_ABI_COMPATIBLE
162 +
163 + local mycmakeargs=(
164 + -DPYTHON_VERSION="${EPYTHON/python/}"
165 + -DPYTHON_LIBRARY="$(python_get_library_path)"
166 + -DPYTHON_INCLUDE_DIR="$(python_get_includedir)"
167 + -DWITH_INSTALL_PORTABLE=OFF
168 + -DWITH_PYTHON_INSTALL=OFF
169 + -DWITH_PYTHON_INSTALL_NUMPY=OFF
170 + -DWITH_STATIC_LIBS=OFF
171 + -DWITH_SYSTEM_GLEW=ON
172 + -DWITH_SYSTEM_OPENJPEG=ON
173 + -DWITH_SYSTEM_EIGEN3=ON
174 + -DWITH_SYSTEM_LZO=ON
175 + -DWITH_C11=ON
176 + -DWITH_CXX11=ON
177 + -DWITH_BOOST=ON
178 + -DWITH_BULLET=$(usex bullet)
179 + -DWITH_CODEC_FFMPEG=$(usex ffmpeg)
180 + -DWITH_CODEC_SNDFILE=$(usex sndfile)
181 + -DWITH_CUDA=$(usex cuda)
182 + -DWITH_CYCLES_DEVICE_CUDA=$(usex cuda TRUE FALSE)
183 + -DWITH_CYCLES=$(usex cycles)
184 + -DWITH_CYCLES_OSL=$(usex osl)
185 + -DWITH_LLVM=$(usex llvm)
186 + -DWITH_FFTW3=$(usex fftw)
187 + -DWITH_GAMEENGINE=$(usex game-engine)
188 + -DWITH_HEADLESS=$(usex headless)
189 + -DWITH_X11=$(usex !headless)
190 + -DWITH_IMAGE_DDS=$(usex dds)
191 + -DWITH_IMAGE_OPENEXR=$(usex openexr)
192 + -DWITH_IMAGE_OPENJPEG=$(usex jpeg2k)
193 + -DWITH_IMAGE_TIFF=$(usex tiff)
194 + -DWITH_INPUT_NDOF=$(usex ndof)
195 + -DWITH_INTERNATIONAL=$(usex nls)
196 + -DWITH_JACK=$(usex jack)
197 + -DWITH_MOD_FLUID=$(usex elbeem)
198 + -DWITH_MOD_OCEANSIM=$(usex fftw)
199 + -DWITH_OPENAL=$(usex openal)
200 + -DWITH_OPENCL=$(usex opencl)
201 + -DWITH_OPENCOLORIO=$(usex colorio)
202 + -DWITH_OPENCOLLADA=$(usex collada)
203 + -DWITH_OPENIMAGEIO=$(usex openimageio)
204 + -DWITH_OPENMP=$(usex openmp)
205 + -DWITH_OPENSUBDIV=$(usex opensubdiv)
206 + -DWITH_OPENVDB=$(usex openvdb)
207 + -DWITH_OPENVDB_BLOSC=$(usex openvdb)
208 + -DWITH_PLAYER=$(usex player)
209 + -DWITH_SDL=$(usex sdl)
210 + -DWITH_CXX_GUARDEDALLOC=$(usex debug)
211 + -DWITH_ASSERT_ABORT=$(usex debug)
212 + -DWITH_GTESTS=$(usex test)
213 + -DWITH_DOC_MANPAGE=$(usex man)
214 + -DWITH_MEM_JEMALLOC=$(usex jemalloc)
215 + -DWITH_MEM_VALGRIND=$(usex valgrind)
216 + )
217 + cmake-utils_src_configure
218 +}
219 +
220 +src_compile() {
221 + cmake-utils_src_compile
222 +
223 + if use doc; then
224 + # Workaround for binary drivers.
225 + addpredict /dev/ati
226 + addpredict /dev/dri
227 + addpredict /dev/nvidiactl
228 +
229 + einfo "Generating Blender C/C++ API docs ..."
230 + cd "${CMAKE_USE_DIR}"/doc/doxygen || die
231 + doxygen -u Doxyfile || die
232 + doxygen || die "doxygen failed to build API docs."
233 +
234 + cd "${CMAKE_USE_DIR}" || die
235 + einfo "Generating (BPY) Blender Python API docs ..."
236 + "${BUILD_DIR}"/bin/blender --background --python doc/python_api/sphinx_doc_gen.py -noaudio || die "sphinx failed."
237 +
238 + cd "${CMAKE_USE_DIR}"/doc/python_api || die
239 + sphinx-build sphinx-in BPY_API || die "sphinx failed."
240 + fi
241 +}
242 +
243 +src_test() {
244 + if use test; then
245 + einfo "Running Blender Unit Tests ..."
246 + cd "${BUILD_DIR}"/bin/tests || die
247 + local f
248 + for f in *_test; do
249 + ./"${f}" || die
250 + done
251 + fi
252 +}
253 +
254 +src_install() {
255 + # Pax mark blender for hardened support.
256 + pax-mark m "${CMAKE_BUILD_DIR}"/bin/blender
257 +
258 + if use doc; then
259 + docinto "html/API/python"
260 + dodoc -r "${CMAKE_USE_DIR}"/doc/python_api/BPY_API/.
261 +
262 + docinto "html/API/blender"
263 + dodoc -r "${CMAKE_USE_DIR}"/doc/doxygen/html/.
264 + fi
265 +
266 + cmake-utils_src_install
267 +
268 + # fix doc installdir
269 + docinto "html"
270 + dodoc "${CMAKE_USE_DIR}"/release/text/readme.html
271 + rm -r "${ED%/}"/usr/share/doc/blender || die
272 +
273 + python_fix_shebang "${ED%/}/usr/bin/blender-thumbnailer.py"
274 + python_optimize "${ED%/}/usr/share/blender/${MY_PV}/scripts"
275 +}
276 +
277 +pkg_preinst() {
278 + gnome2_icon_savelist
279 +}
280 +
281 +pkg_postinst() {
282 + elog
283 + elog "Blender uses python integration. As such, may have some"
284 + elog "inherit risks with running unknown python scripts."
285 + elog
286 + elog "It is recommended to change your blender temp directory"
287 + elog "from /tmp to /home/user/tmp or another tmp file under your"
288 + elog "home directory. This can be done by starting blender, then"
289 + elog "dragging the main menu down do display all paths."
290 + elog
291 + ewarn
292 + ewarn "This ebuild does not unbundle the massive amount of 3rd party"
293 + ewarn "libraries which are shipped with blender. Note that"
294 + ewarn "these have caused security issues in the past."
295 + ewarn "If you are concerned about security, file a bug upstream:"
296 + ewarn " https://developer.blender.org/"
297 + ewarn
298 + gnome2_icon_cache_update
299 + xdg_mimeinfo_database_update
300 +}
301 +
302 +pkg_postrm() {
303 + gnome2_icon_cache_update
304 + xdg_mimeinfo_database_update
305 +
306 + ewarn ""
307 + ewarn "You may want to remove the following directory."
308 + ewarn "~/.config/${PN}/${MY_PV}/cache/"
309 + ewarn "It may contain extra render kernels not tracked by portage"
310 + ewarn ""
311 +}
312
313 diff --git a/media-gfx/blender/files/blender-2.79-fix-build-with-OSL-1.9.x.patch b/media-gfx/blender/files/blender-2.79-fix-build-with-OSL-1.9.x.patch
314 new file mode 100644
315 index 00000000000..6b22f9335fd
316 --- /dev/null
317 +++ b/media-gfx/blender/files/blender-2.79-fix-build-with-OSL-1.9.x.patch
318 @@ -0,0 +1,26 @@
319 +From d089875c4c753f084e02849462ec1bd6f785eadf Mon Sep 17 00:00:00 2001
320 +From: Brecht Van Lommel <brechtvanlommel@×××××.com>
321 +Date: Sat, 18 Nov 2017 06:11:17 +0100
322 +Subject: [PATCH] Fix build with OSL 1.9.x, automatically aligns to 16 bytes
323 + now.
324 +
325 +---
326 + intern/cycles/kernel/osl/osl_closures.cpp | 4 ++++
327 + 1 file changed, 4 insertions(+)
328 +
329 +diff --git a/intern/cycles/kernel/osl/osl_closures.cpp b/intern/cycles/kernel/osl/osl_closures.cpp
330 +index e3e85705ebc..597d25e9f30 100644
331 +--- a/intern/cycles/kernel/osl/osl_closures.cpp
332 ++++ b/intern/cycles/kernel/osl/osl_closures.cpp
333 +@@ -232,7 +232,11 @@ static void register_closure(OSL::ShadingSystem *ss, const char *name, int id, O
334 + /* optimization: it's possible to not use a prepare function at all and
335 + * only initialize the actual class when accessing the closure component
336 + * data, but then we need to map the id to the class somehow */
337 ++#if OSL_LIBRARY_VERSION_CODE >= 10900
338 ++ ss->register_closure(name, id, params, prepare, NULL);
339 ++#else
340 + ss->register_closure(name, id, params, prepare, NULL, 16);
341 ++#endif
342 + }
343 +
344 + void OSLShader::register_closures(OSLShadingSystem *ss_)