%define date 20090512
%define yname yafaray
%bcond_without qt
%bcond_with snap
%{!?python_sitearch:%global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
# we don't want to provide private python extension libs
%{?filter_setup:%filter_provides_in %{python_sitearch}/.*\.so$ %filter_setup}
Name: YafaRay
License: LGPLv2.1
Summary: A free open-source raytracing render engine
Version: 0.1.1
URL: http://www.yafray.org/
Group: Applications/Multimedia
%if %{with snap}
Release: 0.2.svn.%{date}%{?dist}
Source0: %{yname}-%{date}.tar.gz
Source1: python-%{date}.tar.gz
Source2: README.Fedora
Source3: yafaray-snapshot.sh
%else
Release: 4%{?dist}
Source0: http://static.yafaray.org/sources/%{name}.%{version}.zip
Source1: http://static.yafaray.org/sources/%{name}-blender.%{version}.zip
Source2: README.Fedora
%endiff
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: scons >= 0.97
BuildRequires: freetype-devel
BuildRequires: libjpeg-devel
BuildRequires: libpng-devel
BuildRequires: libxml2-devel
BuildRequires: python-devel
BuildRequires: swig
%{?with_qt:BuildRequires: qt4-devel}
BuildRequires: zlib-devel
BuildRequires: OpenEXR-devel >= 1.2
#Introduced in F-15, Can be dropped by F-17
Obsoletes: yafray < 0.1.0
Provides: yafray = %{version}-%{release}
Obsoletes: %{yname} < 0.1.1-4
Provides: %{yname} = %{version}-%{release}
%description
YafaRay is a free open-source raytracing render engine.
Raytracing is a rendering technique for generating
realistic images by tracing the path of light through a 3D scene.
A render engine consists of a "faceless" computer program that interacts
with a host 3D application to provide very specific raytracing capabilities
"on demand". Blender 3D is the host application of YafaRay.
%package blender
Summary: Blender integration scripts
Group: Applications/Multimedia
Requires: %{name} = %{version}-%{release}
Requires: blender
Obsoletes: %{yname}-blender < 0.1.1-4
Provides: %{yname}-blender = %{version}-%{release}
%description blender
YafRay uses a python-coded settings interface to set
lighting and rendering parameters. This settings interface
is launched by an entry automatically added to the Blender Render menu.
%prep
%if %{with snap}
%setup -q -n %{yname}-%{date}
%setup -q -D -T -a 1 -n %{yname}-%{date}
%else
%setup -q -n %{yname}
%setup -q -D -T -a 1 -n %{yname}
%endif
sed -i -e"s,/lib',/%{_lib}',g" config/linux2-config.py
sed -i -e"s,/lib/,/%{_lib}/,g" config/linux2-config.py
%if %{with qt}
sed -i -e"s,WITH_YF_QT='false',WITH_YF_QT='true',g" config/linux2-config.py
%endif
cat << EOF >> config/linux2-config.py
YF_QTDIR = '%{_libdir}/qt4'
# unversioned SO is correct by itself when the said shared object is
# meant to be dlopen at runtime, instead of being linked at build time.
#YF_SHLINKFLAGS = "-Wl,-soname,libyafaraycore.so.1"
EOF
sed -i -e"s|REL_CCFLAGS = '-O3 -ffast-math'|REL_CCFLAGS = '-ffast-math %{optflags}'|g" config/linux2-config.py
# fixes %%{buildroot} in libyafaraycore.so
sed -i -e"s,\$YF_LIBOUT,%{_libdir},g" tools/writeconfig.py
sed -i -e"s,\$YF_PLUGINPATH,%{_libdir}/%{yname},g" tools/writeconfig.py
%{__install} -pm644 %{SOURCE2} ./
%build
scons build
scons swig
%install
rm -rf %{buildroot}
scons PREFIX=%{buildroot}%{_prefix} install
mkdir -p %{buildroot}%{_datadir}/blender/scripts
mkdir -p %{buildroot}%{python_sitearch}
%if %{with snap}
pushd %{_builddir}/%{yname}-%{date}
cp -p bindings/python/yaf*.py \
%{buildroot}%{_datadir}/blender/scripts
cp -p bindings/python/_yaf*.so \
%{buildroot}%{python_sitearch}
cp -p python-%{date}/yaf*.py \
%{buildroot}%{_datadir}/blender/scripts
cp -p %{SOURCE3} .
%else
pushd %{_builddir}/%{yname}
cp -p bindings/python/yaf*.py \
%{buildroot}%{_datadir}/blender/scripts
cp -p bindings/python/_yaf*.so \
%{buildroot}%{python_sitearch}
cp -p %{yname}-blender/yaf*.py \
%{buildroot}%{_datadir}/blender/scripts
%endif
popd
%clean
rm -rf %{buildroot}
%files
%defattr(-, root, root)
%doc CODING LICENSE INSTALL
%{_bindir}/%{yname}-xml
%{_libdir}/%{yname}/*.so
%{_libdir}/libyafaraycore.so
%files blender
%defattr(-, root, root)
%if %{with snap}
%doc yafaray-snapshot.sh
%endif
%doc README.Fedora
%{_datadir}/blender/scripts/*
%{?with_qt:%{_libdir}/libyafarayqt.so}
%{_libdir}/libyafarayplugin.so
%{python_sitearch}/_yaf*.so
%changelog
* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.1.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Tue Jan 25 2011 Paulo Roma <roma@lcg.ufrj.br> 0.1.1-4
- Fixed Obsoletes clause for yafaray.
* Fri Jan 21 2011 Paulo Roma <roma@lcg.ufrj.br> 0.1.1-3
- Changed package name to YafaRay.
- Providing README.Fedora
* Thu Nov 04 2010 Paulo Roma <roma@lcg.ufrj.br> 0.1.1-2
- Conditionally building with qt support.
- Fixed URL and license.
* Sat Aug 29 2009 Paulo Roma <roma@lcg.ufrj.br> 0.1.1-1
- Updated 0.1.1
* Sat May 23 2009 Paulo Roma <roma@lcg.ufrj.br> 0.1.0.315-1
- Updated 0.1.0.315
* Tue May 12 2009 Paulo Roma <roma@lcg.ufrj.br> 0.1.0-1
- Built official 0.1.0 (305) version.
* Tue May 12 2009 Paulo Roma <roma@lcg.ufrj.br> 0.1.0-0.1.svn.20090512
- Built revision 315.
* Sat Apr 11 2009 Paulo Roma <roma@lcg.ufrj.br> 0.1.0-0.1.svn.20090411
- Built revision 300.
* Mon Jan 26 2009 Paulo Roma <roma@lcg.ufrj.br> 0.1.0-0.1.svn.20090126
- Built revision 299.
* Tue Nov 11 2008 Paulo Roma <roma@lcg.ufrj.br> 0.1.0-0.1.svn.20081031
- Installing _yaf*.so in %%{python_sitearch}
- Using %%{snv}.%%{date} for release.
- Using %%{optflags}.
* Thu Oct 23 2008 Paulo Roma <roma@lcg.ufrj.br> 0.1.0-5
- Built revision 287.
- Replaced BR libxml-devel for libxml2-devel.
- Using %%{buildroot} in the comment in the %%prep section.
- Included yafaray-snapshot.sh
* Sun Oct 19 2008 Paulo Roma <roma@lcg.ufrj.br> 0.1.0-4
- Created blender integration package.
- svn co https://ssl.little-isp.de/svn/lynx/yafaray/blender/python
* Wed Oct 15 2008 Paulo Roma <roma@lcg.ufrj.br> 0.1.0-3
- Built revision 286.
- Adapted spec file.
- svn co https://ssl.little-isp.de/svn/lynx/yafaray/mainline/ yafaray
* Sun Feb 04 2007 Paulo Roma <roma@lcg.ufrj.br> 0.0.9-2
- Rebuilt for Fedora 6
- Updated to 0.0.9
* Wed Jan 25 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
* Mon Sep 19 2005 - pnemec@suse.cz
- fixed wrong return value in tiangletools.cc
* Tue Jul 26 2005 - sbrabec@suse.cz
- Updated to version 0.0.8.
* Mon May 16 2005 - pmladek@suse.cz
- fixed to build with gcc4 on 64-bit architectures
* Thu Aug 26 2004 - kukuk@suse.de
- Fix building on lib64 archs
* Wed Aug 25 2004 - sbrabec@suse.cz
- New SuSE package, version 0.0.7.