add blender-2.54_beta
[shuber-gentoo-overlay.git] / media-gfx / blender / blender-2.54_beta.ebuild
1 # Copyright 1999-2010 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/media-gfx/blender/blender-2.49b.ebuild,v 1.3 2010/05/31 15:02:53 arfrever Exp $
4
5 EAPI=2
6
7 inherit multilib eutils python
8
9 IUSE="blender-game ffmpeg nls ogg openmp verse openal"
10
11 DESCRIPTION="3D Creation/Animation/Publishing System"
12 HOMEPAGE="http://www.blender.org/"
13 MY_P=${P//_/-}
14 SRC_URI="http://download.blender.org/source/${MY_P}.tar.gz"
15 S="${S%_beta}"-beta
16
17 SLOT="0"
18 LICENSE="|| ( GPL-2 BL BSD )"
19 KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
20
21 RDEPEND="ffmpeg? ( >=media-video/ffmpeg-0.5[encode,theora] )
22 media-libs/jpeg
23 media-libs/openjpeg
24 media-libs/tiff
25 >=dev-lang/python-2.5
26 nls? ( >=media-libs/freetype-2.0
27 virtual/libintl
28 >=media-libs/ftgl-2.1 )
29 openal? ( >=media-libs/openal-1.6.372
30 >=media-libs/freealut-1.1.0-r1 )
31 media-libs/openexr
32 media-libs/libpng
33 blender-game? ( >=media-libs/libsdl-1.2[joystick] )
34 >=media-libs/libsdl-1.2
35 ogg? ( media-libs/libogg )
36 virtual/opengl"
37
38 DEPEND=">=dev-util/scons-0.98
39 sys-devel/gcc[openmp?]
40 x11-base/xorg-server
41 ${RDEPEND}"
42
43
44 blend_with() {
45 local UWORD="$2"
46 if [ -z "${UWORD}" ]; then
47 UWORD="$1"
48 fi
49 if useq $1; then
50 echo "WITH_BF_${UWORD}=1" | tr '[:lower:]' '[:upper:]' \
51 >> "${S}"/user-config.py
52 else
53 echo "WITH_BF_${UWORD}=0" | tr '[:lower:]' '[:upper:]' \
54 >> "${S}"/user-config.py
55 fi
56 }
57
58 src_prepare() {
59 rm -f "${S}/release/scripts/bpymodules/"*.pyc
60 }
61
62 src_configure() {
63
64 # add ffmpeg info to the scons build info
65 # cat <<- EOF >> "${S}"/user-config.py
66 # BF_FFMPEG="/usr"
67 # BF_FFMPEG_LIB="avdevice avformat avcodec swscale avutil"
68 # EOF
69
70 # set python version to current version in use
71 # cat <<- EOF >> "${S}"/user-config.py
72 # BF_PYTHON_VERSION="$(python_get_version)"
73 # BF_PYTHON_INC="$(python_get_includedir)"
74 # BF_PYTHON_BINARY="$(PYTHON -a)"
75 # BF_PYTHON_LIB="python$(python_get_version)"
76 # EOF
77
78 # add system openjpeg into scons build.
79 # cat <<- EOF >> "${S}"/user-config.py
80 # BF_OPENJPEG = "/usr"
81 # BF_OPENJPEG_INC = "/usr/include"
82 # BF_OPENJPEG_LIB = "openjpeg"
83 # EOF
84
85 #set CFLAGS used in /etc/make.conf correctly
86
87 echo "CFLAGS= [`for i in ${CFLAGS[@]}; do printf "%s \'$i"\',; done`] " \
88 | sed -e "s:,]: ]:" >> "${S}"/user-config.py
89
90 echo "CXXFLAGS= [`for i in ${CFLAGS[@]}; do printf "%s \'$i"\',; done`]" \
91 | sed -e "s:,]: ]:" >> "${S}"/user-config.py
92
93 # check for blender-game USE flag.
94 # blender-game will merge with blenderplayer.
95
96 for arg in \
97 'openal'\
98 'ffmpeg' \
99 'blender-game player' \
100 'blender-game gameengine' \
101 'nls international' \
102 'ogg' \
103 'openmp' \
104 'verse' ; do
105 blend_with ${arg}
106 done
107 }
108
109 src_compile() {
110 # scons uses -l differently -> remove it
111 scons ${MAKEOPTS/-l[0-9]} || die \
112 '!!! Please add "${S}/scons.config" when filing bugs reports \
113 to bugs.gentoo.org'
114
115 cd "${WORKDIR}"/install/linux2/plugins
116 chmod 755 bmake
117 emake || die
118 }
119
120 src_install() {
121
122 PVshort="${PV%_beta}"
123
124 exeinto /usr/bin/
125 doexe "${WORKDIR}"/install/linux2/blender
126 use blender-game && doexe "${WORKDIR}"/install/linux2/blenderplayer
127
128 dodir /usr/share/${PN}
129
130 exeinto /usr/$(get_libdir)/${PN}/textures
131 doexe "${WORKDIR}"/install/linux2/plugins/texture/*.so
132 exeinto /usr/$(get_libdir)/${PN}/sequences
133 doexe "${WORKDIR}"/install/linux2/plugins/sequence/*.so
134 insinto /usr/include/${PN}
135 doins "${WORKDIR}"/install/linux2/plugins/include/*.h
136
137 insinto /usr/share/${PN}
138 doins -r "${WORKDIR}"/install/linux2/${PVshort}/scripts
139
140 insinto /usr/share/pixmaps
141 doins "${WORKDIR}"/install/linux2/icons/scalable/blender.svg
142 insinto /usr/share/applications
143 doins "${WORKDIR}"/blender-2.54-beta/release/freedesktop/blender.desktop
144
145 dodoc "${WORKDIR}"/install/linux2/readme.html
146
147 insinto /etc/env.d
148 doins "${FILESDIR}/20${PN}"
149 }
150
151 pkg_preinst(){
152 if [ -h "${ROOT}/usr/$(get_libdir)/blender/plugins/include" ];
153 then
154 rm -f "${ROOT}"/usr/$(get_libdir)/blender/plugins/include
155 fi
156 }
157
158 pkg_postinst(){
159 env-update
160
161 elog "blender uses python integration. As such, may have some"
162 elog "inherit risks with running unknown python scripting."
163 elog " "
164 elog "CVE-2008-1103-1.patch has been removed as it interferes"
165 elog "with autosave undo features. Up stream blender coders"
166 elog "have not addressed the CVE issue as the status is still"
167 elog "a CANDIDATE and not CONFIRMED."
168 elog " "
169 elog "It is recommended to change your blender temp directory"
170 elog "from /tmp to ~tmp or another tmp file under your home"
171 elog "directory. This can be done by starting blender, then"
172 elog "dragging the main menu down do display all paths."
173 }