# Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI="2" NEED_PYTHON="3.1" inherit subversion eutils python IUSE="+game-engine player +elbeem +openexr ffmpeg jpeg2k openal openmp verse \ +dds debug doc fftw jack apidoc sndfile lcms tweak-mode" 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/" ESVN_REPO_URI="https://svn.blender.org/svnroot/bf-blender/trunk/blender" SLOT="0" LICENSE="|| ( GPL-2 BL )" KEYWORDS="" RDEPEND="media-libs/jpeg media-libs/libpng media-libs/libsdl x11-libs/libXi x11-libs/libX11 sys-libs/zlib media-libs/tiff media-libs/libsamplerate virtual/opengl >=media-libs/freetype-2.0 virtual/libintl virtual/libiconv media-libs/glew game-engine? ( media-libs/libsdl[audio,joystick] ) openexr? ( media-libs/openexr ) ffmpeg? ( >=media-video/ffmpeg-0.5[x264,xvid,mp3,encode,theora] jpeg2k? ( >=media-video/ffmpeg-0.5[x264,xvid,mp3,encode,theora,jpeg2k] ) ) openal? ( >=media-libs/openal-1.6.372 ) web? ( >=net-libs/xulrunner-1.9.0.10:1.9 ) fftw? ( sci-libs/fftw:3.0 ) jack? ( media-sound/jack-audio-connection-kit ) sndfile? ( media-libs/libsndfile ) lcms? ( media-libs/lcms )" DEPEND=">=sys-devel/gcc-4.3.2[openmp?] apidoc? ( dev-python/epydoc >=app-doc/doxygen-1.5.7[-nodot] ) x11-base/xorg-server ${RDEPEND}" S="${WORKDIR}/${PN}" blend_with() { local UWORD="$2" if [ -z "${UWORD}" ]; then UWORD="$1" fi if useq $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_prepare() { #epatch "${FILESDIR}"/${PN}-2.5-CVE-2008-1103.patch #epatch "${FILESDIR}"/${PN}-2.5-CVE-2008-4863.patch #epatch "${FILESDIR}"/${PN}-2.49a-sys-openjpeg.patch epatch "${FILESDIR}"/${PN}-desktop.patch epatch "${FILESDIR}"/${PN}-2.5-doxygen.patch # OpenJPEG einfo "Removing bundled OpenJPEG ..." rm -r extern/libopenjpeg # FFmpeg einfo "Removing bundled FFmpeg ..." rm -r extern/ffmpeg einfo "Removing bundled Glew ..." rm -r extern/glew epatch "${FILESDIR}"/${PN}-2.5-glew.patch einfo "Removing bundled LAME ..." rm -r extern/libmp3lame einfo "Removing bundled x264 ..." rm -r extern/x264 einfo "Removing bundled Xvid ..." rm -r extern/xvidcore #einfo "Removing bundled LZMA ..." #rm -r extern/lzma #einfo "Removing binreloc ..." #rm -r extern/binreloc } src_configure() { # add ffmpeg info to the scons build info and enable # ogg vorbis/theora support if use ffmpeg; then cat <<- EOF >> "${S}"/user-config.py BF_FFMPEG="/usr" BF_FFMPEG_LIB="avformat avcodec swscale avutil avdevice" WITH_BF_OGG = True EOF fi # set python version to current version in use # python_version # cat <<- EOF >> "${S}"/user-config.py # WITH_BF_STATICPYTHON = False # BF_PYTHON_INC="/usr/include/python3.1" # BF_PYTHON_BINARY="/usr/bin/python3.1" # BF_PYTHON_LIB="python3.1" # EOF # add system openjpeg into scons build. cat <<- EOF >> "${S}"/user-config.py BF_OPENJPEG = "/usr" BF_OPENJPEG_INC = "/usr/include" BF_OPENJPEG_LIB = "openjpeg" EOF # enabling internationalization only if LINGUAS have more # lang than 'en', otherwise must be disabled if [[ -z ${LINGUAS} ]] || [[ ${LINGUAS} == "en" ]]; then cat <<- EOF >> "${S}"/user-config.py WITH_BF_INTERNATIONAL = False EOF fi # enabling Elbeem fluid system if ! use elbeem; then cat <<- EOF >> "${S}"/user-config.py BF_NO_ELBEEM = True EOF 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 echo "CXXFLAGS= [`for i in ${CXXFLAGS[@]}; do printf "%s \'$i"\',; done`]" \ | sed -e "s:,]: ]:" >> "${S}"/user-config.py echo "LINKFLAGS= [`for i in ${LDFLAGS[@]}; do printf "%s \'$i"\',; done`]" \ | sed -e "s:,]: ]:" >> "${S}"/user-config.py # tweak mode if use tweak-mode; then cat <<- EOF >> "${S}"/user-config.py BF_TWEAK_MODE = True EOF fi # generic setting which differ from the defaults local NUMJOBS="$( echo "${MAKEOPTS}" | sed -ne 's,.*-j\([[:digit:]]\+\).*,\1,p' )" cat <<- EOF >> "${S}"/user-config.py WITH_BF_BINRELOC = False WITHOUT_BF_PYTHON_INSTALL = True BF_QUIET = True BF_NUMJOBS = ${NUMJOBS} EOF # configure for arg in \ 'apidoc docs' \ 'lcms' \ 'jack' \ 'sndfile' \ 'openexr' \ 'dds' \ 'fftw fftw3' \ 'jpeg2k openjpeg' \ 'openal'\ 'ffmpeg' \ 'player' \ 'game-engine gameengine' \ 'openmp' \ 'verse' ; do blend_with ${arg} done } src_compile() { scons || die \ '!!! Please add "${S}/scons.config" when filing bugs reports \ to bugs.gentoo.org' cd "${WORKDIR}"/install/linux2/plugins chmod 755 bmake emake || die } src_install() { # install binaries exeinto /usr/bin/ mv "${WORKDIR}"/install/linux2/blender "${WORKDIR}"/install/linux2/blender-bin doexe "${WORKDIR}"/install/linux2/blender-bin doexe "${FILESDIR}"/blender use player && doexe "${WORKDIR}"/install/linux2/blenderplayer use verse && doexe "${WORKDIR}"/install/linux2/verse_server # install plugins exeinto /usr/$(get_libdir)/${PN}/textures doexe "${WORKDIR}"/install/linux2/plugins/texture/*.so exeinto /usr/$(get_libdir)/${PN}/sequences doexe "${WORKDIR}"/install/linux2/plugins/sequence/*.so insinto /usr/include/${PN} doins "${WORKDIR}"/install/linux2/plugins/include/*.h # install I18N if [[ ${LINGUAS} != "en" && -n ${LINGUAS} ]]; then rm "${WORKDIR}"/install/linux2/.blender/.Blanguages \ || die "file .Blanguages do not exists" echo "English:en_US" > "${WORKDIR}"/install/linux2/.blender/.Blanguages insinto /usr/share/locale for LANG in ${LINGUAS}; do [[ ${LANG} == "en" ]] && continue # installing locale doins -r "${WORKDIR}/install/linux2/.blender/locale/${LANG}" || die "failed '${LANG}' locale installation" # populating file .Blanguages with only the locales choiced by the # user through LINGUAS local I18N case "${LANG}" in ja) I18N="Japanese:ja_JP" ;; nl) I18N="Dutch:nl_NL" ;; it) I18N="Italian:it_IT" ;; de) I18N="German:de_DE" ;; fi) I18N="Finnish:fi_FI" ;; sv) I18N="Swedish:sv_SE" ;; fr) I18N="French:fr_FR" ;; es) I18n="Spanish:es_ES" ;; ca) I18N="Catalan:ca_ES" ;; cs) I18N="Czech:cs_CZ" ;; pt_BR) I18N="Brazilian Portuguese:pt_BR" ;; zh_CN) I18N="Simplified Chinese:zh_CN" ;; ru) I18N="Russian:ru_RU" ;; hr) I18N="Croatian:hr_HR" ;; sr) I18N="Serbian:sr" ;; uk) I18N="Ukrainian:uk_UA" ;; pl) I18N="Polish:pl_PL" ;; ro) I18N="Romanian:ro" ;; ar) I18N="Arabic:ar" ;; bg) I18N="Bulgarian:bg" ;; el) I18N="Greek:el" ;; ko) I18N="Korean:ko" ;; esac echo "${I18N}" >> "${WORKDIR}"/install/linux2/.blender/.Blanguages done # install .Blanguages insinto /usr/share/${PN} doins "${WORKDIR}"/install/linux2/.blender/.Blanguages fi # install fonts doins "${WORKDIR}"/install/linux2/.blender/.bfont.ttf doins release/VERSION # install scripts insinto /usr/share/${PN} doins -r "${WORKDIR}"/install/linux2/.blender/scripts doins -r "${WORKDIR}"/install/linux2/.blender/io doins -r "${WORKDIR}"/install/linux2/.blender/ui # FIX: making all python scripts readable only by group 'users' # (nobody can modify scripts apart root user) chown root:users -R \ "${D}/usr/share/${PN}/scripts" \ "${D}/usr/share/${PN}/io" \ "${D}/usr/share/${PN}/ui" chmod 750 -R \ "${D}/usr/share/${PN}/scripts" \ "${D}/usr/share/${PN}/io" \ "${D}/usr/share/${PN}/ui" # FIX: bpydata/ and bpymodules/ dirs must have write perms for group 'users' chmod 770 "${D}/usr/share/${PN}/scripts/bpydata" chmod 770 "${D}/usr/share/${PN}/scripts/bpydata/config" chmod 770 "${D}/usr/share/${PN}/scripts/bpymodules" # install desktop file insinto /usr/share/pixmaps doins release/freedesktop/icons/scalable/blender.svg insinto /usr/share/applications doins release/freedesktop/blender.desktop # install docs dodoc README use doc && dodoc release/text/BlenderQuickStart.pdf if use apidoc; then einfo "Generating Blender BGE API docs ..." docinto "API/BGE_API" dohtml -r "${WORKDIR}"/install/doc/BGE_API/* einfo "Generating Blender BPY API docs ..." epydoc source/blender/python/doc/*.py -v \ -o doc/BPY_API \ --quiet --quiet --quiet \ --simple-term \ --inheritance=included \ --graph=all \ --dotpath /usr/bin/dot \ || die "epydoc failed." docinto "API/python" dohtml -r doc/BPY_API/* einfo "Generating Blender C/C++ API docs ..." pushd "${S}"/doc > /dev/null doxygen -u Doxyfile doxygen || die "doxygen failed to build API docs." docinto "API/blender" dohtml -r html/* popd > /dev/null fi } pkg_preinst() { if [ -h "${ROOT}/usr/$(get_libdir)/blender/plugins/include" ]; then rm -r "${ROOT}"/usr/$(get_libdir)/blender/plugins/include fi } pkg_postinst() { echo elog "Blender uses python integration. As such, may have some" elog "inherit risks with running unknown python scripting." elog elog "CVE-2008-1103-1.patch has been removed as it interferes" elog "with autosave undo features. Up stream blender coders" elog "have not addressed the CVE issue as the status is still" elog "a CANDIDATE and not CONFIRMED." elog elog "CVE-2008-4863.patch has been remove as it interferes" elog "with the load of bpy_ops.py and all the UI python" elog "scripts." 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." }