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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
|
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-gfx/blender/blender-2.60a.ebuild,v 1.4 2011/11/13 22:43:48 sping Exp $
PYTHON_DEPEND="3:3.2"
EAPI=4
if [[ ${PV} == *9999 ]] ; then
SCM="subversion"
ESVN_REPO_URI="https://svn.blender.org/svnroot/bf-blender/trunk/blender"
fi
inherit scons-utils eutils python versionator flag-o-matic toolchain-funcs ${SCM}
IUSE="cycles +game-engine player +elbeem +openexr ffmpeg jpeg2k openal openmp \
+dds debug doc fftw jack apidoc sndfile lcms tweak-mode sdl sse \
redcode +zlib iconv contrib 3dmouse"
LANGS="en ar bg ca cs de el es fi fr hr it ja ko nl pl pt_BR ro ru sr sv uk zh_CN"
for X in ${LANGS} ; do
IUSE="${IUSE} linguas_${X}"
done
DESCRIPTION="3D Creation/Animation/Publishing System"
HOMEPAGE="http://www.blender.org"
if [[ ${PV} == *9999 ]] ; then
SRC_URI=""
elif [[ ${PV%_p*} != ${PV} ]] ; then # Gentoo snapshot
SRC_URI="mirror://gentoo/${P}.tar.xz"
else # Official release
SRC_URI="http://download.blender.org/source/${P}.tar.gz"
fi
#SLOT="$(get_version_component_range 1-2)"
SLOT="2.60"
LICENSE="|| ( GPL-2 BL )"
KEYWORDS="~amd64 ~x86"
RDEPEND="virtual/jpeg
media-libs/libpng
x11-libs/libXi
x11-libs/libX11
media-libs/tiff
media-libs/libsamplerate
virtual/opengl
>=media-libs/freetype-2.0
virtual/libintl
media-libs/glew
>=sci-physics/bullet-2.76
dev-cpp/eigen:3
cycles? (
media-libs/openimageio
dev-libs/boost
)
iconv? ( virtual/libiconv )
zlib? ( sys-libs/zlib )
sdl? ( media-libs/libsdl[audio,joystick] )
openexr? ( media-libs/openexr )
ffmpeg? (
>=virtual/ffmpeg-0.6.90[x264,mp3,encode,theora]
jpeg2k? ( >=virtual/ffmpeg-0.6.90[x264,mp3,encode,theora,jpeg2k] )
)
openal? ( >=media-libs/openal-1.6.372 )
fftw? ( sci-libs/fftw:3.0 )
jack? ( media-sound/jack-audio-connection-kit )
sndfile? ( media-libs/libsndfile )
lcms? ( media-libs/lcms )
3dmouse? ( media-libs/libspnav )"
DEPEND="dev-util/scons
apidoc? (
dev-python/sphinx
app-doc/doxygen[-nodot]
game-engine? ( dev-python/epydoc )
)
${RDEPEND}"
# configure internationalization only if LINGUAS have more
# languages than 'en', otherwise must be disabled
if [[ ${LINGUAS} != "en" && -n ${LINGUAS} ]]; then
DEPEND="${DEPEND}
sys-devel/gettext"
fi
blend_with() {
local UWORD="$2"
[ -z "${UWORD}" ] && UWORD="$1"
if use $1; then
echo "WITH_BF_${UWORD}=1" | tr '[:lower:]' '[:upper:]' \
>> "${S}"/user-config.py
else
echo "WITH_BF_${UWORD}=0" | tr '[:lower:]' '[:upper:]' \
>> "${S}"/user-config.py
fi
}
src_unpack() {
if [[ ${PV} == *9999 ]] ; then
subversion_fetch
if use contrib; then
S="${S}"/release/scripts/addons_contrib subversion_fetch \
"https://svn.blender.org/svnroot/bf-extensions/contrib/py/scripts/addons/"
fi
else
unpack ${A}
fi
}
pkg_setup() {
enable_openmp=0
if use openmp; then
if tc-has-openmp; then
enable_openmp=1
else
ewarn "You are using gcc built without 'openmp' USE."
ewarn "Switch CXX to an OpenMP capable compiler."
die "Need openmp"
fi
fi
python_set_active_version 3
}
src_prepare() {
epatch "${FILESDIR}"/${P}-desktop.patch
# TODO: write a proper Makefile to replace the borked bmake script
epatch "${FILESDIR}"/${PN}-${SLOT}-bmake.patch
chmod 755 "${WORKDIR}"/${P}/release/plugins/bmake
# OpenJPEG
einfo "Removing bundled OpenJPEG ..."
rm -r extern/libopenjpeg
epatch "${FILESDIR}"/${PN}-${SLOT}-openjpeg.patch
# Glew
einfo "Removing bundled Glew ..."
rm -r extern/glew
epatch "${FILESDIR}"/${P}-glew.patch
# Eigen3
einfo "Removing bundled Eigen3 ..."
rm -r extern/Eigen3
epatch "${FILESDIR}"/${P}-eigen.patch
# Bullet2
einfo "Removing bundled Bullet2 ..."
rm -r extern/bullet2
epatch "${FILESDIR}"/${PN}-${SLOT}-bullet.patch
# Linux 3.x (bug #381099)
epatch "${FILESDIR}"/${PN}-${SLOT}-linux-3.patch
epatch "${FILESDIR}"/${PN}-${SLOT}-libav-0.7.patch
epatch "${FILESDIR}"/${P}-CVE-2009-3850-v3.patch
epatch "${FILESDIR}"/${P}-enable_site_module.patch
}
src_configure() {
# add system openjpeg into Scons build options.
cat <<- EOF >> "${S}"/user-config.py
BF_OPENJPEG="/usr"
BF_OPENJPEG_INC="/usr/include"
BF_OPENJPEG_LIB="openjpeg"
EOF
# FIX: littlecms includes path aren't specified
if use lcms; then
cat <<- EOF >> "${S}"/user-config.py
BF_LCMS_INC="/usr/include/"
BF_LCMS_LIB="lcms"
BF_LCMS_LIBPATH="/usr/lib/"
EOF
fi
# add system sci-physic/bullet into Scons build options.
cat <<- EOF >> "${S}"/user-config.py
WITH_BF_BULLET=1
BF_BULLET="/usr/include"
BF_BULLET_INC="/usr/include/bullet /usr/include/bullet/BulletCollision /usr/include/bullet/BulletDynamics /usr/include/bullet/LinearMath /usr/include/bullet/BulletSoftBody"
BF_BULLET_LIB="BulletSoftBody BulletDynamics BulletCollision LinearMath"
EOF
#add iconv into Scons build options.
if use !elibc_glibc && use !elibc_uclibc && use iconv; then
cat <<- EOF >> "${S}"/user-config.py
WITH_BF_ICONV=1
BF_ICONV="/usr"
EOF
fi
# configure internationalization only if LINGUAS have more
# languages than 'en', otherwise must be disabled
[[ -z ${LINGUAS} ]] || [[ ${LINGUAS} == "en" ]] && echo "WITH_BF_INTERNATIONAL=0" >> "${S}"/user-config.py
# configure Elbeem fluid system
use elbeem || echo "BF_NO_ELBEEM=1" >> "${S}"/user-config.py
# configure Tweak Mode
use tweak-mode && echo "BF_TWEAK_MODE=1" >> "${S}"/user-config.py
# FIX: Game Engine module needs to be active to build the Blender Player
if ! use game-engine && use player; then
elog "Forcing Game Engine [+game-engine] as required by Blender Player [+player]"
echo "WITH_BF_GAMEENGINE=1" >> "${S}"/user-config.py
else
blend_with game-engine gameengine
fi
# set CFLAGS used in /etc/make.conf correctly
echo "CFLAGS=[`for i in ${CFLAGS[@]}; do printf "%s \'$i"\',; done`] " \
| sed -e "s:,]: ]:" >> "${S}"/user-config.py
# set CXXFLAGS used in /etc/make.conf correctly
local FILTERED_CXXFLAGS="`for i in ${CXXFLAGS[@]}; do printf "%s \'$i"\',; done`"
echo "CXXFLAGS=[${FILTERED_CXXFLAGS}]" | sed -e "s:,]: ]:" >> "${S}"/user-config.py
echo "BGE_CXXFLAGS=[${FILTERED_CXXFLAGS}]" | sed -e "s:,]: ]:" >> "${S}"/user-config.py
# reset general options passed to the C/C++ compilers (useless hardcoded flags)
# FIX: forcing '-funsigned-char' fixes an anti-aliasing issue with menu
# shadows, see bug #276338 for reference
echo "CCFLAGS= ['-funsigned-char', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64']" >> "${S}"/user-config.py
# set LDFLAGS used in /etc/make.conf correctly
local FILTERED_LDFLAGS="`for i in ${LDFLAGS[@]}; do printf "%s \'$i"\',; done`"
echo "LINKFLAGS=[${FILTERED_LDFLAGS}]" | sed -e "s:,]: ]:" >> "${S}"/user-config.py
echo "PLATFORM_LINKFLAGS=[${FILTERED_LDFLAGS}]" | sed -e "s:,]: ]:" >> "${S}"/user-config.py
# reset REL_* variables (useless hardcoded flags)
cat <<- EOF >> "${S}"/user-config.py
REL_CFLAGS=[]
REL_CXXFLAGS=[]
REL_CCFLAGS=[]
EOF
# reset warning flags (useless for NON blender developers)
cat <<- EOF >> "${S}"/user-config.py
C_WARN =[ '-w', '-g0' ]
CC_WARN =[ '-w', '-g0' ]
CXX_WARN=[ '-w', '-g0' ]
EOF
# detecting -j value from MAKEOPTS
local NUMJOBS="$( echo "${MAKEOPTS}" | sed -ne 's,.*-j\([[:digit:]]\+\).*,\1,p' )"
[[ -z "${NUMJOBS}" ]] && NUMJOBS=1 # resetting to -j1 for empty MAKEOPTS
# generic settings which differ from the defaults from linux2-config.py
cat <<- EOF >> "${S}"/user-config.py
BF_OPENGL_LIB='GL GLU X11 Xi GLEW'
BF_INSTALLDIR="../install"
WITH_PYTHON_SECURITY=1
WITHOUT_BF_PYTHON_INSTALL=1
BF_PYTHON="/usr"
BF_PYTHON_VERSION="3.2"
BF_PYTHON_ABI_FLAGS=""
BF_BUILDINFO=0
BF_QUIET=1
BF_NUMJOBS=${NUMJOBS}
BF_LINE_OVERWRITE=0
WITH_BF_FHS=1
WITH_BF_BINRELOC=0
WITH_BF_STATICOPENGL=0
WITH_BF_OPENMP=${enable_openmp}
EOF
# configure WITH_BF* Scons build options
for arg in \
'sdl' \
'apidoc docs' \
'lcms' \
'jack' \
'sndfile' \
'openexr' \
'dds' \
'fftw fftw3' \
'jpeg2k openjpeg' \
'openal'\
'ffmpeg' \
'ffmpeg ogg' \
'player' \
'sse rayoptimization' \
'redcode' \
'zlib' \
'3dmouse' ; do
blend_with ${arg}
done
# enable debugging/testing support
use debug && echo "BF_DEBUG=1" >> "${S}"/user-config.py
use test && echo "BF_UNIT_TEST=1" >> "${S}"/user-config.py
# enables Cycles render engine
if use cycles; then
cat <<- EOF >> "${S}"/user-config.py
WITH_BF_CYCLES=1
WITH_BF_OIIO=1
BF_OIIO="/usr"
BF_OIIO_INC="/usr/include"
BF_OIIO_LIB="OpenImageIO"
WITH_BF_BOOST=1
BF_BOOST="/usr"
BF_BOOST_INC="/usr/include/boost"
EOF
fi
}
src_compile() {
escons || die \
'!!! Please add "${S}/scons.config" when filing bugs reports \
to bugs.gentoo.org'
einfo "Building plugins ..."
# FIX: plugins are built without respecting user's LDFLAGS
emake \
CFLAGS="${CFLAGS} -fPIC" \
LDFLAGS="$(raw-ldflags) -Bshareable" \
-C release/plugins
}
src_install() {
# creating binary wrapper
cat <<- EOF >> "${WORKDIR}/install/blender-${PV}"
#!/bin/sh
# stop this script if the local blender path is a symlink
if [ -L \${HOME}/.blender ]; then
echo "Detected a symbolic link for \${HOME}/.blender"
echo "Sorry, to avoid dangerous situations, the Blender binary can"
echo "not be started until you have removed the symbolic link:"
echo " # rm -i \${HOME}/.blender"
exit 1
fi
export BLENDER_SYSTEM_SCRIPTS="/usr/share/blender/${PV}/scripts"
export BLENDER_SYSTEM_DATAFILES="/usr/share/blender/${PV}/datafiles"
export BLENDER_SYSTEM_PLUGINS="/usr/lib/blender/${PV}/plugins"
exec /usr/bin/blender-bin-${PV} \$*
EOF
# install binaries
exeinto /usr/bin/
cp "${WORKDIR}/install/blender" "${WORKDIR}/install/blender-bin-${PV}"
doexe "${WORKDIR}/install/blender-bin-${PV}"
doexe "${WORKDIR}/install/blender-${PV}"
if use player; then
cp "${WORKDIR}/install/blenderplayer" \
"${WORKDIR}/install/blenderplayer-${PV}"
doexe "${WORKDIR}/install/blenderplayer-${PV}"
fi
# install plugins
exeinto /usr/$(get_libdir)/${PN}/${PV}/plugins/texture
doexe "${WORKDIR}"/${P}/release/plugins/texture/*.so
exeinto /usr/$(get_libdir)/${PN}/${PV}/plugins/sequences
doexe "${WORKDIR}"/${P}/release/plugins/sequence/*.so
insinto /usr/include/${PN}/${PV}
doins "${WORKDIR}"/${P}/source/blender/blenpluginapi/*.h
insinto /usr/share/${PN}/${PV}/scripts
use contrib && doins -r "${WORKDIR}"/${P}/release/scripts/addons_contrib
# install desktop file
insinto /usr/share/pixmaps
cp release/freedesktop/icons/scalable/apps/blender.svg \
release/freedesktop/icons/scalable/apps/blender-${PV}.svg
doins release/freedesktop/icons/scalable/apps/blender-${PV}.svg
insinto /usr/share/applications
cp release/freedesktop/blender.desktop \
release/freedesktop/blender-${PV}.desktop
doins release/freedesktop/blender-${PV}.desktop
newins "${FILESDIR}"/${P}-insecure.desktop ${P}-insecure.desktop
# install docs
doman "${WORKDIR}"/${P}/doc/manpage/blender.1
use doc && dodoc -r "${WORKDIR}"/${P}/doc/guides/*
if use apidoc; then
einfo "Generating (BGE) Blender Game Engine API docs ..."
epydoc source/gameengine/PyDoc/*.py -v \
-o doc/BGE_API \
--quiet --quiet --quiet \
--simple-term \
--url "http://www.blender.org" \
--top API_intro \
--name "Blender GameEngine" \
--no-private --no-sourcecode \
--inheritance=included \
--graph=all \
--dotpath /usr/bin/dot \
|| die "epydoc failed."
docinto "API/gameengine"
dohtml -r "${WORKDIR}"/${P}/doc/BGE_API/*
#einfo "Generating (BPY) Blender Python API docs ..."
"${D}"/usr/bin/blender-bin-${PV} --background --python doc/python_api/sphinx_doc_gen.py || die "blender failed."
pushd doc/python_api > /dev/null
sphinx-build sphinx-in BPY_API || die "sphinx failed."
popd > /dev/null
docinto "API/python"
dohtml -r doc/python_api/BPY_API/*
einfo "Generating Blender C/C++ API docs ..."
pushd "${WORKDIR}"/${P}/doc/doxygen > /dev/null
doxygen -u Doxyfile
doxygen || die "doxygen failed to build API docs."
docinto "API/blender"
dohtml -r html/*
popd > /dev/null
fi
# final cleanup
rm -r "${WORKDIR}"/install/{Python-license.txt,icons,GPL-license.txt,copyright.txt}
# installing blender
insinto /usr/share/${PN}/${PV}
doins -r "${WORKDIR}"/install/${PV}/*
# FIX: making all python scripts readable only by group 'users',
# so nobody can modify scripts apart root user, but python
# cache (*.pyc) can be written and shared across the users.
# chown root:users -R "${D}/usr/share/${PN}/${SLOT}/scripts" || die
# chmod 755 -R "${D}/usr/share/${PN}/${SLOT}/scripts" || die
}
pkg_postinst() {
echo
elog "Blender uses python integration. As such, may have some"
elog "inherit risks with running unknown python scripting."
elog
elog "It is recommended to change your blender temp directory"
elog "from /tmp to /home/user/tmp or another tmp file under your"
elog "home directory. This can be done by starting blender, then"
elog "dragging the main menu down do display all paths."
elog
elog "Blender has its own internal rendering engine but you"
elog "can export to external renderers for image computation"
elog "like: YafRay[1], sunflow[2], PovRay[3] and luxrender[4]"
elog
elog "If you need one of them just emerge it:"
elog " [1] emerge -av media-gfx/yafray"
elog " [2] emerge -av media-gfx/sunflow"
elog " [3] emerge -av media-gfx/povray"
elog " [4] emerge -av media-gfx/luxrender"
elog
elog "When setting the Blender paths with the User Preferences"
elog "dialog box, remember to NOT declare your home's paths as:"
elog "~/.blender, but as: /home/user/.blender; in other words,"
elog "DO NOT USE the tilde inside the paths, as Blender is not"
elog "able to handle it, ignoring your customizations."
}
|