LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File sunflow.spec of Package sunflow (Project home:adra)

#
# spec file for package sunflow
#
# Copyright (c) 2017 Asterios Dramis <asterios.dramis@gmail.com>.
#
# 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.


Name:           sunflow
Version:        0.07.2.svn396
Release:        0
Summary:        Rendering System for Photo-realistic Image Synthesis
License:        MIT AND GPL-2.0+
Group:          Productivity/Graphics/Visualization/Raytracers
URL:            http://sunflow.sourceforge.net/
# mkdir sunflow-0.07.2.svn396
# cd sunflow-0.07.2.svn396
# svn checkout -r 396 https://sunflow.svn.sourceforge.net/svnroot/sunflow/trunk .
# find . -name .svn -type d | xargs rm -rf
# cd ..
# tar jcf sunflow-0.07.2.svn396.tar.bz2 sunflow-0.07.2.svn396/
Source0:        %{name}-%{version}.tar.bz2
Source1:        %{name}.desktop
Source2:        %{name}.png
# PATCH-FIX-OPENSUSE 10_to_use_system_janino asterios.dramis@gmail.com -- Replace removed janino.jar with system janino (taken from Debian)
Patch0:         10_to_use_system_janino
# PATCH-FIX-OPENSUSE sunflow_SweetHome3D.patch asterios.dramis@gmail.com -- Changes needed by SweetHome3D (taken from SweetHome3D upstream tarball, version 3.4)
Patch1:         sunflow_SweetHome3D.patch
# PATCH-FIX-OPENSUSE no_build_time.patch asterios.dramis@gmail.com -- Remove build time references from javadoc, so build-compare can do its work
Patch2:         no_build_time.patch
BuildRequires:  ant
BuildRequires:  desktop-file-utils
BuildRequires:  fdupes
BuildRequires:  janino
BuildRequires:  java-devel
BuildRequires:  jpackage-utils
Requires:       java
Requires:       jpackage-utils
BuildArch:      noarch

%description
Sunflow is an open source rendering system for photo-realistic image synthesis.
It is written in Java and built around a flexible ray tracing core and an
extensible object-oriented design.

%package javadoc
Summary:        Javadocs for sunflow
Group:          Documentation/HTML
Requires:       %{name} = %{version}

%description javadoc
This package contains the API Documentation for sunflow.

%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2

# Fix rpmlint warning "wrong-script-end-of-line-encoding"
sed -i 's/\r$//' exporters/blender/sunflow_export.py

# Fix rpmlint warning "wrong-file-end-of-line-encoding"
sed -i 's/\r$//' CHANGELOG
sed -i 's/\r$//' LICENSE
sed -i 's/\r$//' README

# Remove all third party jars
find . -iname '*.jar' | xargs rm -rf

# Fix compilation (update values for source and target)
sed -i 's/name="sunflow.jdk.level" value="5"/name="sunflow.jdk.level" value="6"/' build.xml

%build
%{ant} jars
%{ant} javadoc

%install
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_datadir}/blender/scripts
mkdir -p %{buildroot}%{_javadir}
mkdir -p %{buildroot}%{_javadocdir}

# jar
install -pm 0644 release/sunflow.jar %{buildroot}%{_javadir}/sunflow-%{version}.jar

# Make name of jar version agnostic
(cd %{buildroot}%{_javadir} && for jar in *-%{version}*; do ln -sf ${jar} ${jar/-%{version}/}; done)

# blender exporter
install -pm 0644 exporters/blender/sunflow_export.py %{buildroot}%{_datadir}/blender/scripts/

# javadoc
cp -a release/javadoc/ %{buildroot}%{_javadocdir}/sunflow-%{version}

# startscript
cat > "%{buildroot}%{_bindir}/sunflow.sh" << EOF
#!/bin/sh

exec java -jar %{_javadir}/sunflow.jar ${@}
EOF

chmod 755 %{buildroot}%{_bindir}/sunflow.sh

# Install desktop file and icon
%if 0%{?suse_version} > 1210
desktop-file-install %{SOURCE1}
%else
desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE1}
%endif
install -Dpm 0644 %{SOURCE2} %{buildroot}%{_datadir}/pixmaps/sunflow.png

%fdupes -s %{buildroot}%{_javadocdir}

%files
%doc CHANGELOG LICENSE README
%{_bindir}/sunflow.sh
%{_datadir}/applications/sunflow.desktop
%dir %{_datadir}/blender
%dir %{_datadir}/blender/scripts
%{_datadir}/blender/scripts/sunflow_export.py
%{_javadir}/sunflow*.jar
%{_datadir}/pixmaps/sunflow.png

%files javadoc
%doc %{_javadocdir}/sunflow-%{version}/

%changelog