%define blenderlib %{_datadir}/blender
%define plugins %{_libdir}/blender/plugins
Summary:       3D modeling, animation, rendering and post-production.
Summary(ja):   3D モデリング、アニメーション、レンダリング、ポストプロダクション
Name:           blender
Version:        2.49b
Release:        1%{?_dist_release}
Group:          Applications/Multimedia
License:        GPL
URL:            http://www.blender.org/
Source0:        http://download.blender.org/source/blender-%{version}.tar.gz
Source1:        http://bane.servebeer.com/programming/blender/import-3ds-0.92.py
Source2:        http://bane.servebeer.com/programming/blender/export-3ds-0.72.py
Source3:        blender.png
Source4:        blender.desktop
Source5:        blender.xml

Patch1: blender-2.49-scons.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-root
BuildRequires:  desktop-file-utils
BuildRequires:  esound-devel
BuildRequires:  glut-devel 
BuildRequires:  gettext-devel
BuildRequires:  libjpeg-devel 
BuildRequires:  libogg-devel
BuildRequires:  libpng-devel 
BuildRequires:  libtiff-devel 
BuildRequires:  libtool
BuildRequires:  libvorbis-devel
BuildRequires:  freealut-devel
BuildRequires:  openssl-devel
BuildRequires:  python-devel
BuildRequires:  scons
BuildRequires:  SDL-devel
BuildRequires:  zlib-devel 
BuildRequires:  libXi-devel
BuildRequires:  xorg-x11-proto-devel
BuildRequires:  mesa-libGL-devel
BuildRequires:  mesa-libGLU-devel
BuildRequires:  freetype-devel
BuildRequires:  OpenEXR-devel
BuildRequires:  glew-devel
BuildRequires:  freetype2-devel

Requires(post): desktop-file-utils
Requires(post): shared-mime-info
Requires(postun): desktop-file-utils
Requires(postun): shared-mime-info


%description
Blender is an integrated suite of tools enabling the creation of a broad
range of 3D content. It offers full functionality for modelling, rendering,
animation, post-production, creation and playback of interactive 3D content
with the singular benefits of cross-platform operability.

Aimed at media professionals and artists, Blender can be used to create 3D
visualizations, stills as well as broadcast quality video, while the
incorporation of a real-time 3D engine allows for the creation of 3D
interactive content for stand-alone playback.

%description -l ja
Blender は、幅広い 3D コンテンツの製作を可能にする統合ソフトウェアです。
Blender は、モデリング、レンダリング、アニメーション、ポストプロダクション、
インタラクティブな 3D コンテンツの製作と再生といった全機能を、複数の OS への
対応という他には類のない利点と共に提供しています。

Blender は、メディアの専門家や達人もターゲットにしているので、3D の視覚化や、
良質なテレビ放送映像や静止画像の作成にも使用できます。さらに、リアルタイム
3D エンジンを統合したことにより、スタンドアロン再生用のインタラクティブな
3D コンテンツの製作も可能です。

%prep
%setup -q -n %{name}-%{version}
#%patch1 -p1 -b .scons

%build
cat > user-config.py <<EOF
WITH_BF_OPENAL = 'false'
#BF_OPENAL = '%{_prefix}'
#BF_OPENAL_INC = '%{_includedir}/AL'
#BF_OPENAL_LIB = '%{_libdir}'
WITH_BF_FFMPEG = 'false'
BF_PYTHON = '%{_prefix}'
BF_PYTHON_INC = '%{_includedir}/python%{pyver}'
BF_PYTHON_LIB = 'python%{pyver}'
BF_OPENEXR_INC = '%{_includedir}/OpenEXR'
BF_GETTEXT = '%{_prefix}'
BF_GETTEXT_INC = '%{_includedir}'
BF_GETTEXT_LIB = 'gettextlib'
BF_BUILDDIR = './builddir'
BF_INSTALLDIR='./installdir'
EOF

## don't use parallel build
#scons -i -k %{?_smp_mflags} BF_QUIET=0
scons BF_QUIET=0

install -d release/plugins/include
install -m 644 source/blender/blenpluginapi/*.h release/plugins/include
chmod +x release/plugins/bmake
make -C release/plugins/


%install
rm -rf ${RPM_BUILD_ROOT}

mkdir -p ${RPM_BUILD_ROOT}%{_bindir}
install -D -m 755 ./builddir/bin/blender ${RPM_BUILD_ROOT}/%{_bindir}/blender
install -D -m 755 ./builddir/bin/blenderplayer ${RPM_BUILD_ROOT}/%{_bindir}/blenderplayer

mkdir -p ${RPM_BUILD_ROOT}/%{_datadir}
pushd bin/.blender/locale
rm -rf $(find -name '.svn' -print)
popd
cp -a bin/.blender/locale ${RPM_BUILD_ROOT}/%{_datadir}
install -p -D -m0644 %{SOURCE3} ${RPM_BUILD_ROOT}%{_datadir}/pixmaps/blender.png
install -p -D -m0644 %{SOURCE5} ${RPM_BUILD_ROOT}%{_datadir}/mime/packages/blender.xml

mkdir -p ${RPM_BUILD_ROOT}%{blenderlib}/scripts/
install -p -D -m0644 release/scripts/*.py ${RPM_BUILD_ROOT}%{blenderlib}/scripts/
install -m 644 release/VERSION ${RPM_BUILD_ROOT}/%{blenderlib}
install -m 644 bin/.blender/.Blanguages ${RPM_BUILD_ROOT}/%{blenderlib}
install -m 644 bin/.blender/.bfont.ttf ${RPM_BUILD_ROOT}/%{blenderlib}
install -p -D -m0644 %{SOURCE1} ${RPM_BUILD_ROOT}%{blenderlib}/scripts/import-3ds-0.7.py
install -p -D -m0644 %{SOURCE2} ${RPM_BUILD_ROOT}%{blenderlib}/scripts/export-3ds-0.71.py

install -d ${RPM_BUILD_ROOT}/%{plugins}/sequence
install -d ${RPM_BUILD_ROOT}/%{plugins}/texture
install -m 644 release/plugins/sequence/*.so ${RPM_BUILD_ROOT}/%{plugins}/sequence
install -m 655 release/plugins/texture/*.so ${RPM_BUILD_ROOT}/%{plugins}/texture

desktop-file-install --vendor "" --dir ${RPM_BUILD_ROOT}%{_datadir}/applications %{SOURCE4}

%find_lang %name


%clean
rm -rf ${RPM_BUILD_ROOT}


%post
update-mime-database %{_datadir}/mime > /dev/null 2>&1 || : 
update-desktop-database %{_datadir}/applications > /dev/null 2>&1 || :


%postun
update-mime-database %{_datadir}/mime > /dev/null 2>&1 || : 
update-desktop-database %{_datadir}/applications > /dev/null 2>&1 || :


%files -f %name.lang
%defattr(-,root,root,-)
%doc COPYING README doc/python-dev-guide.txt doc/GPL-license.txt doc/bf-members.txt
%{_bindir}/*
%{_libdir}/blender/
%{blenderlib}/
%{_datadir}/applications/blender.desktop
%{_datadir}/pixmaps/*.png
%{_datadir}/mime/packages/blender.xml


%changelog
* Thu Dec 30 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.49b-1
- new upstream release
- add BuildRequires: freetype2-devel

* Sat Nov 13 2010 Shu KONNO <owa@bg.wakwak.com> 2.49-2
- rebuilt with gettext-0.18

* Wed May 05 2010 Shu KONNO <owa@bg.wakwak.com> 2.49-1
- updated blender to 2.49
- applied new versioning policy, and spec in utf-8
- built without smp option
- disable OpenAL, FFMPEG at user-config.py
- added BR: libXi-devel xorg-x11-proto-devel mesa-libGL-devel mesa-libGLU-devel
- added BR: freetype-devel OpenEXR-devel glew-devel

* Mon Jan 02 2006 IKEDA Katsumi <ikeda@webmasters.gr.jp> 2.40-0vl2
- new upstream release.

* Sat Oct 22 2005 Daisuke SUZUKI <daisuke@linux.or.jp> 2.35-0vl1
- initial build for Vine Linux

* Mon Nov 15 2004 Phillip Compton <pcompton[AT]proteinmedia.com> 2.35-1
- 2.35.

* Thu Nov 11 2004 Phillip Compton <pcompton[AT]proteinmedia.com> 2.34-0.fdr.3
- Mime-type corrections for FC3.
- Dropped redundent BR XFree86-devel.

* Thu Aug 05 2004 Phillip Compton <pcompton[AT]proteinmedia.com> 0:2.34-0.fdr.2
- blender.applications file.
- blender.xml file.
- post/postun update-mime-database.

* Thu Aug 05 2004 Phillip Compton <pcompton[AT]proteinmedia.com> 0:2.34-0.fdr.1
- Updated to 2.34.

* Thu Aug 05 2004 Phillip Compton <pcompton[AT]proteinmedia.com> 0:2.33-0.fdr.2.a
- Include 3ds import/export scripts.
- Added mime info.
- Added mime icon (from yattacier theme).

* Wed Aug 04 2004 Phillip Compton <pcompton[AT]proteinmedia.com> 0:2.33-0.fdr.1.a
- 2.33a.
- Now building with scons.

* Tue Feb 10 2004 Phillip Compton <pcompton[AT]proteinmedia.com> 0:2.32-0.fdr.2
- Now including scripts.

* Thu Feb 05 2004 Phillip Compton <pcompton[AT]proteinmedia.com> 0:2.32-0.fdr.1
- Updated to 2.32.

* Sun Jan 11 2004 Phillip Compton <pcompton[AT]proteinmedia.com> 0:2.31-0.fdr.3.a
- --enable-openal.
- --disable-rpath.
- remove --enable-international.
- modify .desktop to execute with -w.

* Thu Dec 04 2003 Phillip Compton <pcompton[AT]proteinmedia.com> 0:2.31-0.fdr.2.a
- Updated to 2.31a.

* Sun Nov 30 2003 Phillip Compton <pcompton[AT]proteinmedia.com> 0:2.31-0.fdr.1
- Updated to 2.31.
- enable-international.

* Tue Nov 18 2003 Phillip Compton <pcompton[AT]proteinmedia.com> 0:2.30-0.fdr.1
- Updated to 2.30. 

* Fri Oct 10 2003 Phillip Compton <pcompton[AT]proteinmedia.com> 0:2.28-0.fdr.5.c
- Updated to 2.28c.

* Tue Oct 07 2003 Phillip Compton <pcompton[AT]proteinmedia.com> 0:2.28-0.fdr.4.a
- Removed BuildReq smpeg-devel

* Mon Sep 15 2003 Phillip Compton <pcompton[AT]proteinmedia.com> 0:2.28-0.fdr.3.a
- Moved 'a' out of version according to naming guidelines.

* Fri Sep 12 2003 Phillip Compton <pcompton[AT]proteinmedia.com> 0:2.28a-0.fdr.2
- changed file permission on tarball.
- dropped redundant messages about aclocal, etc.
- configure --disable-shared.
- automake --foreign.
- added doc/python-dev-guide.txt doc/GPL-license.txt doc/bf-members.txt to %%doc.

* Wed Sep 10 2003 Phillip Compton <pcompton[AT]proteinmedia.com> 0:2.28a-0.fdr.1
- Updated to 2.28a.

* Wed Aug 13 2003 Phillip Compton <pcompton[AT]proteinmedia.com> 0:2.28-0.fdr.2
- New Icon.

* Thu Jul 24 2003 Phillip Compton <pcompton[AT]proteinmedia.com> 0:2.28-0.fdr.1
- Updated to 2.28.
- BuildReq libvorbis-devel.
- BuildReq smpeg-devel.
- BuildReq esound-devel.
- BuildReq libogg-devel.
- BuildReq vorbis-tools.
- BuildReq openal-devel
- BuildReq libtool

* Mon May 26 2003 Phillip Compton <pcompton[AT]proteinmedia.com> 0:2.27-0.fdr.2
- Removed post/postun ldconfig.
- Added autoconf workaround.

* Mon May 19 2003 Phillip Compton <pcompton[AT]proteinmedia.com> 0:2.27-0.fdr.1
- Updated to 2.27.
- Removed devel package.

* Wed Apr 09 2003 Phillip Compton <pcompton[AT]proteinmedia.com> 0:2.26-0.fdr.9
- Corrected devel Group.

* Tue Apr 01 2003 Phillip Compton <pcompton[AT]proteinmedia.com> 0:2.26-0.fdr.8
- Added desktop-file-utils to BuildRequires.
- Changed category to X-Fedora-Extra.

* Mon Mar 31 2003 Phillip Compton <pcompton[AT]proteinmedia.com> 0:2.26-0.fdr.7
- Added Missing BuildRequires.

* Sun Mar 30 2003 Phillip Compton <pcompton[AT]proteinmedia.com> 0:2.26-0.fdr.6
- Cleaned up BuildRequires.
- Added Epoch:0.

* Sat Mar 22 2003 Phillip Compton <pcompton[AT]proteinmedia.com> 2.26-0.fdr.5
- Spec file cleanup.

* Sat Mar 08 2003 Phillip Compton <pcompton[AT]proteinmedia.com> 2.26-1.fdr.4
- Spec file cleanup.

* Wed Feb 26 2003 Phillip Compton <pcompton[AT]proteinmedia.com> 2.26-1.fedora.3
- Spec file cleanup.

* Thu Feb 20 2003 Warren Togami
- Add BuildRequires python-devel

* Wed Feb 19 2003 Phillip Compton
- Initial RPM release.
