File luxrender.spec of Package luxrender

#
# spec file for package luxrender
#
# Copyright (c) 2015 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/
#


%define hash0 dfd211d6faa0
%define hash1 7c7127ee1fa4
%if 0%{?suse_version} >= 1140
%define _use_internal_dependency_generator 0
%define __find_requires %{wx_requires}
%endif
Name:           luxrender
Version:        1.4.0
Release:        0
Summary:        Lux Renderer, an unbiased rendering system
License:        GPL-3.0
Group:          Productivity/Graphics/3D Editors
Url:            http://www.luxrender.net
Source0:        %{name}-lux-%{hash0}.tar.bz2
Source1:        %{name}-luxrays-%{hash1}.tar.bz2
Patch0:         suse.patch
BuildRequires:  Mesa-devel
BuildRequires:  OpenEXR-devel
BuildRequires:  OpenImageIO-devel
BuildRequires:  bison
BuildRequires:  boost-devel
BuildRequires:  cmake
BuildRequires:  desktop-file-utils
BuildRequires:  doxygen
BuildRequires:  fftw3-devel
BuildRequires:  flex
BuildRequires:  freeglut-devel
BuildRequires:  gcc
BuildRequires:  gcc-c++
BuildRequires:  glew-devel
BuildRequires:  glibc-devel
BuildRequires:  ilmbase-devel
BuildRequires:  libfreeimage-devel
BuildRequires:  libjpeg-devel
BuildRequires:  libpng-devel
BuildRequires:  libqt4-devel
BuildRequires:  libtiff-devel
BuildRequires:  openexr-devel
BuildRequires:  python-devel
BuildRequires:  wxWidgets-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
LuxRender is a rendering system for physically correct image synthesis.

%package 		devel
Summary:        Development files for Lux Renderer, an unbiased rendering system
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}

%description 	devel
LuxRender is a rendering system for physically correct image synthesis.

%prep
%setup -q -n %{name}-lux-%{hash0}
%setup -q -D -T -a 1 -n %{name}-lux-%{hash0}

%patch0 -p1

# Do not compile in DATE and TIME
BUILD_TIME=$(LC_ALL=C date -ur %{_sourcedir}/%{name}.changes +'%H:%M')
BUILD_DATE=$(LC_ALL=C date -ur %{_sourcedir}/%{name}.changes +'%b %d %Y')
sed -i "s/__TIME__/\"$BUILD_TIME\"/" $(grep -rl '__TIME__')
sed -i "s/__DATE__/\"$BUILD_DATE\"/" $(grep -rl '__DATE__')

%build
# Build luxrays
pushd %{name}-luxrays-%{hash1}
%cmake \
	-DLUXRAYS_DISABLE_OPENCL=ON 

make %{?_smp_mflags}
popd

# Build lux
%cmake \
    -DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS -pthread" \
	-DLUXCORE_INCLUDE_DIRS=%{_builddir}/%{name}-lux-%{hash0}/%{name}-luxrays-%{hash1}/include \
	-DLUXCORE_LIBRARY=%{_builddir}/%{name}-lux-%{hash0}/%{name}-luxrays-%{hash1}/build/lib/libluxcore.a \
  	-DLUXRAYS_INCLUDE_DIRS=%{_builddir}/%{name}-lux-%{hash0}/%{name}-luxrays-%{hash1}/include \
 	-DLUXRAYS_LIBRARY=%{_builddir}/%{name}-lux-%{hash0}/%{name}-luxrays-%{hash1}/build/lib/libluxrays.a \
  	-DSLG_INCLUDE_DIRS=%{_builddir}/%{name}-lux-%{hash0}/%{name}-luxrays-%{hash1}/include \
  	-DSLG_LIBRARY=%{_builddir}/%{name}-lux-%{hash0}/%{name}-luxrays-%{hash1}/build/lib/libsmallluxgpu.a \
  	-DLUXRAYS_DISABLE_OPENCL=ON

# Remove %%{?_smp_mflags} to avoid compilation errors
make -j1

%install
pushd build
%make_install
popd

# Fix executable-docs
find . \
-name \*.txt -type f -executable -exec chmod 644 {} \; || :

%post
/sbin/ldconfig
%desktop_database_post

%postun
/sbin/ldconfig
%desktop_database_postun

%files
%defattr(-,root,root,-)
%doc AUTHORS.txt COPYING.txt
%{_bindir}/luxmerger
#%{_bindir}/luxrenderwx
%{_bindir}/luxconsole
%{_bindir}/luxrender
%{_datadir}/pixmaps/luxrender.svg
%{_datadir}/applications/luxrender.desktop
%{_libdir}/liblux.so

%files devel
%defattr(-, root, root)
%{_includedir}/%{name}

%changelog
openSUSE Build Service is sponsored by