File blender.spec of Package blender
#
# spec file for package blender
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
%global __python3 /usr/bin/python3
#%%global py3_ver %%(python3 -c "import sys; v=sys.version_info[:2]; print('%%d.%%d'%%v)" 2>/dev/null || echo PYTHON-NOT-FOUND)
%global nodot3_ver %(python3 -c "import sys; v=sys.version_info[:2]; print('%%d%%d'%%v)" 2>/dev/null || echo PYTHON-NOT-FOUND)
%global python3_prefix %(python3 -c "import sys; print(sys.prefix)" 2>/dev/null || echo PYTHON-NOT-FOUND)
%global python3_libdir %{python3_prefix}/%{_lib}/python%{py3_ver}%{py3_abi_kind}
#%%global python3_incdir %%{py3_incdir}%%{py3_abi_kind}
%global python3_incdir %{python3_prefix}/include/python%{py3_ver}%{py3_abi_kind}
#%%global python3_sitedir %%{python3_libdir}/site-packages
#%%global python3_sitelib %%(python3 -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())" 2>/dev/null || echo PYTHON-NOT-FOUND)
# end python3 macros
#Redefine _docdir macro for fedora
%define _docdir %{_datadir}/doc/packages
%define collada 1
%define wplayer 1
# Use rpmbuild -D 'DISTRIBUTABLE 0' to build original code.
%define DISTRIBUTABLE 1
%if 0%{?fedora}
BuildRequires: gettext libX11-devel libXi-devel mesa-libGLw-devel pkgconfig xorg-x11-proto-devel
BuildRequires: expat-devel fftw-devel freetype-devel gcc-c++ libstdc++-devel python3-devel
%else
Recommends: blender-doc
BuildRequires: python3-devel
BuildRequires: MesaGLw-devel pkg-config xorg-x11
BuildRequires: gettext-tools libexpat-devel update-desktop-files
%endif
# libquicktime-devel
BuildRequires: hicolor-icon-theme libao-devel libdrm-devel libpng-devel libtiff-devel libvorbis-devel ruby-devel
BuildRequires: fftw3-devel gcc-c++ glew-devel libtool openssl-devel pcre-devel xorg-x11-devel
BuildRequires: desktop-file-utils libsamplerate-devel libsndfile-devel libxml2-devel shared-mime-info yasm yasm-devel
BuildRequires: OpenEXR-devel cmake epydoc fdupes graphviz jack-audio-connection-kit-devel liblcms-devel openssl-devel
BuildRequires: SDL-devel doxygen help2man lzo-devel openal-soft-devel perl-Text-Iconv ruby xz xz-devel
%if 0%{?fedora} >= 14 || 0%{suse_version} >= 1140
BuildRequires: libjpeg62-devel
%else
BuildRequires: libjpeg-devel
%endif
%if 0%{?collada} == 1
BuildRequires: openCOLLADA-devel >= svn838
%endif
BuildRequires: graphviz liblcms-devel
%if %DISTRIBUTABLE <= 0
BuildRequires: ffmpeg-devel
%endif
# See bnc#713346
Requires: python3-xml
Name: blender
License: GPLv2+
Group: Productivity/Graphics/3D Editors
Summary: A 3D Modelling And Rendering Package
Version: 2.59
Release: 1
Url: http://www.blender.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source0: %{name}-%{version}.tar.bz2
Source1: Changes.txt
Source2: geeko.blend
Source3: geeko.README
Source4: blender-sample
Source5: blenderplayer.1
Source6: blender.xpm
Source7: x-blend.desktop
Patch0: blender-2.48-python64.patch
Patch1: blender-2.48-undefine-operation.patch
# Patch submitted upstream - Blender Patches item #19234,
Patch2: blender-2.50-uninit-var.patch
Patch3: blender-2.55-gcc46fix.patch
Patch4: blender-2.56-gcc46.patch
# libOpenCOLLADA0 no longer provides libbuffer, libftoa and libUTF this patch fixes the build
Patch5: blender-2.57b-nobuffer_ftoa_utf_link.patch
# The collada include and library paths were hard coded into CMakeLists.txt and incorrect, this patch fixes the issue.
Patch9: blender-2.59-colladainclude.patch
%if 0%{?nodot3_ver} <= 031
# FIXME The following three patches revert blender to build with python 3.1
Patch6: blender-2.56-svn35386.patch
Patch7: blender-2.56-svn35395.patch
Patch8: blender-2.57b-PYC_INTERPRETER_ACTIVE.patch
Requires: python(abi) = 3.1
%else
Requires: python(abi) = 3.2
%endif
%if %DISTRIBUTABLE == 1
# Patch is needed due to the purging of everything mpeg
Patch10: blender-2.55-blenkernel.patch
%endif
%description
Blender is a 3D modelling and rendering package. It is the in-house
software of a high quality animation studio, Blender has proven to
be an extremely fast and versatile design instrument. The software
has a personal touch, offering a unique approach to the world of
Three Dimensions. Use Blender to create TV commercials, to make
technical visualizations, business graphics, to do some morphing,
or design user interfaces. You can easy build and manage complex
environments. The renderer is versatile and extremely fast. All
basic animation principles (curves & keys) are well implemented.It
includes tools for modeling, sculpting, texturing (painting,
node-based shader materials, or UV mapped), UV mapping, rigging and
constraints, weight painting, particle systems, simulation (fluids,
physics, and soft body dynamics and an external crowd simulator),
rendering, node-based compositing, and non linear video editing,
as well as an integrated game engine for real-time interactive 3D
and game creation and playback with cross-platform compatibility.
http://www.blender.org
%package doc
Summary: Documentation for blender
License: GPL v2 or later
Group: Documentation/HTML
BuildArch: noarch
%description doc
Being the in-house software of a high quality animation studio, Blender
has proven to be an extremely fast and versatile design instrument. The
software has a personal touch, offering a unique approach to the world
of Three Dimensions. Use Blender to create TV commercials, to make
technical visualizations, business graphics, to do some morphing, or
design user interfaces.
This package includes API documentation and example plugin programs.
%package devel
Summary: Include files for blender plugin development
License: GPL v2 or later
Group: Development/Libraries/C and C++
Requires: %{name} = %{version}
%if 0%{?suse_version}
Recommends: blender-doc
%endif
%description devel
This package provides the include files necessary to develop and
build plugins for Blender.
%prep
%setup -q
# This removes the error with python 3.1 python3-config --abiflags
#%%if 0%%{?nodot3_ver} <= 031
#%%global py3_abi_kind $NULL
#%%else
%global py3_abi_kind %(python3-config --abiflags)
#%%endif
%patch0
%patch1
%patch2
%patch3
%patch4
%patch5
%patch9
%if 0%{nodot3_ver} <= 031
%patch6
%patch7
%patch8
%endif
%if %DISTRIBUTABLE == 1
%patch10
rm -rf release/scripts/presets/ffmpeg intern/audaspace/ffmpeg
for i in $(find ./ -name '*mpeg*'); do rm -rf ${i}; done
%endif
%define buildir %{_builddir}/%{name}/%{version}
echo %{buildir}
echo "python3 nodotver = %{?nodot3_ver}"
echo "py3_version = %{?py3_ver}"
echo "python3_prefix = %{?python3_prefix}"
echo "python3_libdir = %{?python3_libdir}"
echo "python3_incdir = %{?python3_incdir}"
echo "py3_incdir = %{?py3_incdir}"
echo "python3_sitearch = %{?python3_sitearch}"
echo "python3_sitelib = %{?python3_sitelib}"
%build
export CFLAGS="$RPM_OPT_FLAGS -pipe -fPIC -funsigned-char -fno-strict-aliasing -g -ggdb"
export CXXFLAGS=$CFLAGS
export BF_TIFF_LIB="%{_libdir}/libtiff.so"
export BF_TIFF_INC="%{_includedir}"
export BF_GETTEXT_LIBPATH="%{_libdir}"
#WITH_INTERNATIONAL
mkdir -p Build
pushd Build
# -DPYTHON_LIB=%%{_libdir}/libpython3.1.so \
# mark_as_advanced(GLEW_LIBRARY)
# mark_as_advanced(GLEW_INCLUDE_PATH)
cmake ../ \
-G"Unix Makefiles" \
-DWITH_FFTW3:BOOL=on \
-DWITH_JACK:BOOL=on \
-DWITH_CODEC_SNDFILE:BOOL=on \
-DWITH_IMAGE_OPENJPEG:BOOL=off \
-DWITH_INSTALL_PORTABLE:BOOL=off \
-DWITH_BUILTIN_GLEW:BOOL=off \
%if %{collada} == 1
-DWITH_OPENCOLLADA:BOOL=on \
-DOPENCOLLADA=%{_prefix} \
-DOPENCOLLADA_LIB:STRING=%{_libdir} \
-DOPENCOLLADA_INC=%{_includedir} \
-DOPENCOLLADA_INCLUDE_DIR:STRING=%{_includedir} \
%else
-DWITH_OPENCOLLADA:BOOL=off \
%endif
-DPYTHON_VERSION=%{py3_ver} \
-DPYTHON_LIBPATH=%{_libdir} \
-DPYTHON_LIBRARY=%{_libdir}/libpython%{py3_ver}%{py3_abi_kind}.so \
-DPYTHON_INCLUDE_DIRS=%{python3_incdir} \
-DPYTHON_INCLUDE_DIR=%{python3_incdir} \
-DWITH_PYTHON_INSTALL:BOOL=off \
-DWITH_PYTHON:BOOL=on \
-DWITH_IMAGE_OPENJPEG:BOOL=off \
-DWITH_GAMEENGINE:BOOL=on \
%if %DISTRIBUTABLE == 1
-DWITH_CODEC_FFMPEG:BOOL=off \
%else
-DWITH_CODEC_FFMPEG:BOOL=on \
%endif
-DCMAKE_VERBOSE_MAKEFILE:BOOL=on \
%if %wplayer == 1
-DWITH_PLAYER:BOOL=on \
%else
-DWITH_PLAYER:BOOL=off \
%endif
-DCMAKE_INSTALL_PREFIX:PATH=%{_prefix}
%__make %{?jobs:-j%{jobs}}
popd
# -e 'CFLAGS="$CFLAGS `python3-config --includes` CXXFLAGS=$CFLAGS'
%install
export blender_version=$(grep BLENDER_VERSION source/blender/blenkernel/BKE_blender.h | tr -dc 0-9)
export blender_version=$(expr $blender_version / 100).$(expr $blender_version % 100)
%define rlversion %(echo $blender_version)
echo "release version = $blender_version"
echo "rlversion is %{?rlversion}"
# make install
pushd Build
make DESTDIR=%{?buildroot} install
popd
echo %{rlversion}
# Factory is now of the opinion that every /usr/bin file needs a man page,
%if %wplayer == 1
# Generate man page with help2man
pushd %{buildroot}%{_mandir}/man1
cp -v %{buildroot}%{_bindir}/blenderplayer ./
help2man \
--version-string="%{version}" \
--help-option="-h" -n "a utility for previewing .blend files" \
-s 1 -m "User Commands" -S "Stichting Blender Foundation" -N -o blenderplayer.1 ./'blenderplayer -h ""'
rm blenderplayer
popd
#cp -v %%{S:5} %%{buildroot}%%{_mandir}/man1
%endif
# Fix any .py files with shebangs and wrong permissions.
if test -z `find %{buildroot} -name *.py -perm 0644 -print0|xargs -0r grep -l '#!'`; \
then break;
else chmod -f 0755 `find %{buildroot} -name *.py -perm 0644 -print0|xargs -0r grep -l '#!'`; \
fi
# Copy text files to correct place.
mkdir -p %{buildroot}%{_docdir}
mv %{buildroot}%{_datadir}/doc/%{name} %{buildroot}%{_docdir}
# install blender sample.
install -D -m 0644 %{S:2} %{buildroot}%{_docdir}/%{name}/
install -D -m 0644 %{S:3} %{buildroot}%{_docdir}/%{name}/
install -D -m 0755 %{S:4} %{buildroot}%{_bindir}/
# Add Changes.txt
cp -v %{S:1} %{buildroot}%{_docdir}/%{name}/
# Doxygen is broken in 11.3 see bnc # 650330
pushd doc/doxygen
#if test `doxygen --version` = 1.6.3; \
#then \
# Build documentation until the script is fixed
doxygen -u Doxyfile
doxygen Doxyfile
cp -r * %{buildroot}%{_docdir}/%{name}/; \
#fi
rm -rf %{buildroot}%{_docdir}/%{name}/Doxy* %{buildroot}%{_docdir}/%{name}/doxy* %{buildroot}%{_docdir}/%{name}/python_api \
%{buildroot}%{_docdir}/%{name}/manpage; \
popd
# blender-devel stuff soon depreciated.
mkdir -p %{buildroot}%{_includedir}/%{name}
cp -pr source/blender/blenpluginapi/* %{buildroot}%{_includedir}/%{name}/
rm -f %{buildroot}%{_includedir}/%{name}/blenpluginapi
# Add more icons.
mkdir -p %{buildroot}%{_datadir}/pixmaps/
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/16x16/apps/
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/22x22/apps/
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/32x32/apps/
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/24x24/apps/
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/48x48/apps/
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/256x256/apps/
cp -vp release/freedesktop/icons/24x24/apps/blender.png %{buildroot}%{_datadir}/icons/hicolor/24x24/apps/
cp -vp release/freedesktop/icons/48x48/apps/blender.png %{buildroot}%{_datadir}/icons/hicolor/48x48/apps/
cp -vp release/freedesktop/icons/256x256/apps/blender.png %{buildroot}%{_datadir}/icons/hicolor/256x256/apps/
cp -vp release/freedesktop/icons/32x32/apps/blender.png %{buildroot}%{_datadir}/icons/hicolor/32x32/apps/
cp -vp release/freedesktop/icons/16x16/apps/blender.png %{buildroot}%{_datadir}/icons/hicolor/16x16/apps/
cp -vp release/freedesktop/icons/22x22/apps/blender.png %{buildroot}%{_datadir}/icons/hicolor/22x22/apps/
pushd %{buildroot}%{_datadir}/pixmaps/
ln -s ../icons/hicolor/32x32/apps/blender.png blender.png
popd
# Install s6=blender.xpm and s11=v-2.55
%__install -D -m 0644 %{S:6} %{buildroot}%{_datadir}/pixmaps/
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/
cp -p release/freedesktop/icons/scalable/apps/blender.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/
#pushd %%{buildroot}%%{_datadir}/icons/hicolor/scalable/apps/
#ln -s ../../../../pixmaps/blender.svg %%{buildroot}%%{_datadir}/icons/hicolor/scalable/apps/blender.svg
#popd
# Install s6=blender.xpm
%__install -D -m 0644 %{S:6} %{buildroot}%{_datadir}/pixmaps/
rm -f %{buildroot}%{_includedir}/%{name}/CMakeLists.txt %{buildroot}%{_includedir}/%{name}/SConscript %{buildroot}%{_includedir}/%{name}/intern/Makefile \
%{buildroot}%{_includedir}/%{name}/intern/pluginapi.c %{buildroot}%{_includedir}/%{name}/Makefile
# x-blend.desktop
%if 0%{?suse_version}
install -D -m 0644 "%{S:7}" "%{buildroot}%{_datadir}/applications/x-blend.desktop"
%suse_update_desktop_file %{buildroot}/%{_datadir}/applications/x-blend.desktop
# blender.desktop
%suse_update_desktop_file -i "%{name}"
%else
%if 0%{?fedora}
# Install the .desktop file the Fedora way
desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{S:7}
# Validate blender.desktop
desktop-file-validate %{buildroot}%{_datadir}/applications/blender.desktop
%endif
%endif
# Remove devel files from package
find %{buildroot}%{_datadir}/%{name}/ -name '*.c' -delete -print
find %{buildroot}%{_datadir}/%{name}/ -name 'bmake' -delete -print
# Remove executables from buildroot/_docdir}/name
if test -z `find %{buildroot}%{_docdir}/%{name} -name *.py -perm 0755 -print0|xargs -0r grep -l '#!'`; \
then break;
else chmod -f 0644 `find %{buildroot}%{_docdir}/%{name} -name *.py -perm 0755 -print0|xargs -0r grep -l '#!'`; \
fi
# Fedora 13 chokes on find_lang find errors
%if 0%{?fedora} >= 14 || 0%{?suse_version}
%find_lang %{name}
%endif
# fdupes macro isn't defined in fedora.
_target=""; \
_symlinks=1; \
fdupes -q -n -r %{buildroot}%{_datadir} | \
while read _file; do \
if test -z "$_target" ; then \
_target="$_file"; \
else \
if test -z "$_file" ; then \
_target=""; \
continue ; \
fi ; \
if test "$_symlinks" = 1; then \
ln -sf "${_target#%{buildroot}}" "$_file"; \
else \
ln -f "$_target" "$_file"; \
fi ; \
fi ; \
done
%post
update-desktop-database &> /dev/null || :
/usr/bin/update-mime-database "%{_datadir}/mime" &>/dev/null || :
%if 0%{?fedora}
touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
%endif
%postun
update-desktop-database &> /dev/null || :
/usr/bin/update-mime-database "%{_datadir}/mime" &>/dev/null || :
%if 0%{?fedora}
if [ $1 -eq 0 ] ; then
touch --no-create %{_datadir}/icons/hicolor &>/dev/null
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%posttrans
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%endif
%clean
%__rm -rf "%{buildroot}"
%files -f %{name}.lang
%defattr(-,root,root)
%{_bindir}/blender
%{_bindir}/blender-thumbnailer.py
%{_bindir}/blender-sample
%{_docdir}/%{name}/geeko.*
%{_docdir}/%{name}/Changes.txt
%if %wplayer == 1
%{_bindir}/blenderplayer
%{_mandir}/man1/blenderplayer.1.gz
%endif
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/%{rlversion}
%{_datadir}/%{name}/%{rlversion}/*
%{_mandir}/man1/blender.1.gz
%{_datadir}/applications/blender.desktop
%{_datadir}/applications/x-blend.desktop
%{_datadir}/pixmaps/blender.xpm
%{_datadir}/icons/hicolor/16x16/apps/blender.png
%{_datadir}/icons/hicolor/22x22/apps/blender.png
%{_datadir}/icons/hicolor/32x32/apps/blender.png
%{_datadir}/icons/hicolor/scalable/apps/blender.svg
%{_datadir}/icons/hicolor/24x24/apps/blender.png
%{_datadir}/icons/hicolor/256x256/apps/blender.png
%{_datadir}/icons/hicolor/48x48/apps/blender.png
%{_datadir}/pixmaps/blender.png
%files doc
%defattr(-,root,root)
%dir %{_docdir}/%{name}/
%doc %{_docdir}/%{name}/*
%exclude %{_docdir}/%{name}/geeko.*
%exclude %{_docdir}/%{name}/Changes.txt
%files devel
%defattr(-,root,root)
%dir %{_includedir}/%{name}/
%{_includedir}/%{name}/*.h
%{_includedir}/%{name}/*.DEF
%changelog