Blob Blame History Raw
%global	commit0 07e6dfe3237c7316b433597a6e36fda6c81e2ad4
%global	commit1 464135af684ba94ac1e62b1346996ca44f1f68b1
%global	shortcommit0 %(c=%{commit0}; echo ${c:0:7})
%global	shortcommit1 %(c=%{commit1}; echo ${c:0:7})
%global	date 20170221
%global	yname yafaray
%global	alphatag beta

%{!?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+
Summary:	A free open-source ray-tracing render engine
Version:	3.2.0
URL:		http://www.yafray.org/
Release:	0.5%{?date:.%{date}git}%{?dist}

# Comment source release and use git snapshot instead as suggested by upstream
# https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/ZQTGNFJFTXHWWPYED44NVK3PLCUTGG6B/
#Source0:	https://github.com/%%{name}/Core/archive/v%%{version}-%%{alphatag}/Core-%%{version}-%%{alphatag}.tar.gz

%{?shortcommit0:
Source0:	https://github.com/%{name}/Core/archive/%{commit0}.tar.gz#/Core-%{shortcommit0}.tar.gz}
%{!?shortcommit0:
Source0:	https://github.com/%{name}/Core/archive/v%{version}.tar.gz#/Core-%{version}.tar.gz}

%{?shortcommit1:
Source1:	https://github.com/%{name}/Blender-Exporter/archive/%{commit1}.tar.gz#/Blender-Exporter-%{shortcommit1}.tar.gz}
%{!?shortcommit1:
Source1:	https://github.com/%{name}/Blender-Exporter/archive/v%{version}.tar.gz#/Blender-Exporter-%{version}.tar.gz}

Source2:	yafaray-blender.metainfo.xml

BuildRequires:	blender-rpm-macros
BuildRequires:	boost-devel
BuildRequires:	cmake
BuildRequires:	gcc-c++
BuildRequires:	git
BuildRequires:	freetype-devel
BuildRequires:	libappstream-glib
BuildRequires:	libjpeg-devel 
BuildRequires:	libpng-devel
BuildRequires:	libtiff-devel
BuildRequires:	libxml2-devel 
BuildRequires:	opencv-devel
BuildRequires:	OpenEXR-devel >= 1.2 
BuildRequires:	python3-devel
BuildRequires:	qt-devel
BuildRequires:	swig
BuildRequires:	zlib-devel 

Requires:	%{name}%{?_isa} = %{version}-%{release}
# Set exclusive arch
# https://koji.fedoraproject.org/koji/taskinfo?taskID=17920427
ExclusiveArch:	%{ix86} x86_64
%description
YafaRay is a free open-source ray-tracing render engine. 
Ray-tracing 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 ray-tracing capabilities "on demand". 
Blender 3D is the host application of YafaRay.

%package	devel
Summary:	Development files for %{name}
Requires:	%{name}%{?_isa} = %{version}-%{release}

%description	devel
The %{name}-devel package contains libraries and header files for
 applications that use %{name}.

%package	blender
Summary:	Blender integration scripts%{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
%autosetup -D -n Core-%{commit0}
%autosetup -D -T -a 1 -n Core-%{commit0}

sed -i -e 's|set(YAF_LIB_DIR lib)|set(YAF_LIB_DIR %{_lib})|g' CMakeLists.txt
sed -i -e 's|set(YAF_TARGET_TYPE ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib RUNTIME)|\
    set(YAF_TARGET_TYPE ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/%{_lib} RUNTIME)|g' CMakeLists.txt

# Set proper permission per packaging guideline
find . -name "*.h" -exec chmod 644 {} \;
find . -name "*.c" -exec chmod 644 {} \;
find . -name "*.cc" -exec chmod 644 {} \;

%build
%cmake \
	-DBLENDER_ADDON:BOOL=false \
	-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true \
	-DCMAKE_SKIP_RPATH:BOOL=true \
	-DDEBUG_BUILD=ON \
	-DUSER_DBGFLAGS="%{optflags}" \
	 .
%make_build VERBOSE=1

%install
%make_install VERBOSE=1

# Let RPM pick docs in the file section
rm -fr %{buildroot}%{_docdir}/%{yname}

mkdir -p %{buildroot}%{blender_addons}/%{yname}
#mkdir -p %%{buildroot}%%{blender_presets}/%%{yname}
cp -pr Blender-Exporter-%{commit1}/{__init__*,io,prop,ui} \
  %{buildroot}%{blender_addons}/%{yname}
#
#cp -pr Blender-Exporter-%%{commit1}/presets \
#  %%{buildroot}%%{blender_presets}/%%{yname}

# AppData
install -p -m 644 -D %{SOURCE2} %{buildroot}%{_datadir}/metainfo/%{yname}-blender.metainfo.xml

%check
appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/metainfo/%{yname}-blender.metainfo.xml

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%files
%license LICENSES
%doc AUTHORS CHANGELOG README
%{_bindir}/%{yname}-xml
%{_datadir}/%{yname}/*

%files devel
%{_includedir}/%{yname}/
%{_libdir}/%{yname}-plugins
%{_libdir}/*.so
%{?with_qt:%{_libdir}/libyafarayqt.so}

%files blender
%{_datadir}/metainfo/%{yname}-blender.metainfo.xml
%{blender_addons}/%{yname}

%changelog
* Wed Feb 22 2017 Luya Tshimbalanga <luya_tfz@thefinalzone.net> - 3.2.0-0.5.20170221git
- Latest git snapshot

* Fri Feb 17 2017 Luya Tshimbalanga <luya_tfz@thefinalzone.net> - 3.2.0-0.4.20170217git
- Latest git snapshot
- Fix spelling to adhere US spelling guideine
- Fix license
- Fix mixed use of spaces and tab errors
- Set source files non executables

* Mon Feb 13 2017 Luya Tshimbalanga <luya_tfz@thefinalzone.net> - 3.2.0-0.3.20170212git
- Add conditional statement for release line
- Align description to 80 columns as possible
- Disable rpath per Fedora packaging guideline
- Let RPM pick docs in the file section
- Add missing requirement libappstream-glib
- Temporarily disable preset in yafaray-blender

* Sun Feb 12 2017 Luya Tshimbalanga <luya_tfz@thefinalzone.net> - 3.2.0-0.2.20170212git
- Latest git snapshot
- Add libtiff dependency
- Use versioning from Fedora packaging guideline
- Define sources url

* Wed Feb 08 2017 Luya Tshimbalanga <luya_tfz@thefinalzone.net> - 3.2.0-0.1.20170131git
- Move appdata to its own file
- Latest git snapshot
- Use POSITION_INDEPENDENT_CODE to prevent compilation error
- Fix library path

* Thu Jan 12 2017 Luya Tshimbalanga <luya_tfz@thefinalzone.net> - 3.1.1-0.2.beta
- Fixed changelog by including missing upstream update info
- Fixed url for the sources
- Added requirement for base package
- Fix lib sharing, relic for legacy method
- Further cleaned up spec

* Thu Sep 22 2016 Luya Tshimbalanga <luya@fedoraproject.org> - 3.0.0-0.1.beta
- Update to 3.1.1-beta

* Sat Jul 16 2016 Luya Tshimbalanga <luya@fedoraproject.org> - 3.0.0-0.1.beta
- Update to 3.0.0-beta
- Cleaned up spec file
- Dropped scons as dependency

* Tue Mar 08 2016 Yaakov Selkowitz <yselkowi@redhat.com> - 0.1.1-14
- Fix FTBFS with GCC 6 (#1307303)

* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.1-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Jun 16 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.1.1-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Fri Aug 15 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.1.1-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Fri Jun 06 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.1.1-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Wed Nov 27 2013 Rex Dieter <rdieter@fedoraproject.org> - 0.1.1-10
- rebuild (openexr)

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.1.1-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Sun Mar 10 2013 Rex Dieter <rdieter@fedoraproject.org> - 0.1.1-8
- rebuild (OpenEXR)

* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.1.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild