File java3d.spec of Package java-3d

#
# spec file for package java-3d
#
# Copyright (c) 2012 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:           java-3d
Version:        1.5.2
Release:        0
License:        GPL-2.0-with-classpath-exception
Summary:        Java 3D API
Url:            http://java3d.java.net/
Group:          Development/Libraries/Java
# mkdir java3d-1.5.2
# cd java3d-1.5.2
# svn checkout https://svn.java.net/svn/vecmath~svn/tags/rel-1_5_2-fcs vecmath
# svn checkout https://svn.java.net/svn/j3d-core-utils~svn/tags/rel-1_5_2-fcs j3d-core-utils
# svn checkout https://svn.java.net/svn/j3d-core~svn/tags/rel-1_5_2-fcs j3d-core
# find vecmath/ -name .svn -type d | xargs rm -rf
# find j3d-core-utils/ -name .svn -type d | xargs rm -rf
# find j3d-core/ -name .svn -type d | xargs rm -rf
# cd ..
# tar jcf java3d-1.5.2.tar.bz2 java3d-1.5.2/
Source0:        java3d-%{version}.tar.bz2
# PATCH-FIX-OPENSUSE java-7_fix.patch asterios.dramis@gmail.com -- Fix compilation with java-7
Patch0:         java-7_fix.patch
%if 0%{?suse_version} > 1210
BuildRequires:  Mesa-libGL-devel
%else
BuildRequires:  Mesa-devel
%endif
BuildRequires:  ant
%if 0%{?suse_version} && 0%{?suse_version} < 1210
BuildRequires:  ant-nodeps
%endif
BuildRequires:  fdupes
BuildRequires:  java-devel
BuildRequires:  jpackage-utils
%if 0%{?suse_version} > 1210
BuildRequires:  libX11-devel
BuildRequires:  libXt-devel
%else
BuildRequires:  xorg-x11-devel
%endif
Requires:       java
Requires:       jpackage-utils
Conflicts:		java3d
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
The Java 3D API provides a set of object-oriented interfaces that support a
simple, high-level programming model you can use to build, render, and control
the behavior of 3D objects and visual environments. With the Java 3D API, you
can incorporate high quality, scalable, platform-independent 3D graphics into
applications and vecmath applets based on Java technology.

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

%description javadoc
This package contains the API documentation for java3d.

%prep
%setup -q -n java3d-%{version}
%if 0%{?suse_version} > 1210
%patch0 -p1
%endif

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

%build
cd vecmath
%{ant} jar-opt
export ANT_OPTS="-Xmx256m"
%{ant} docs
cd ..

cd j3d-core
%{ant} compile-opt
%{ant} jar-opt
export ANT_OPTS="-Xmx256m"
%{ant} docs
cd ..

%install
mkdir -p %{buildroot}%{_libdir}
mkdir -p %{buildroot}%{_javadir}/%{name}
mkdir -p %{buildroot}%{_javadocdir}/%{name}-%{version}

%if 0%{?suse_version} < 1320
# library
install -pm 0755 j3d-core/build/linux-*/opt/lib/*/libj3dcore-ogl.so %{buildroot}%{_libdir}
%endif

# jars
install -pm 0644 j3d-core/build/linux-*/opt/lib/ext/j3dcore.jar %{buildroot}%{_javadir}/%{name}/j3dcore-%{version}.jar
install -pm 0644 j3d-core/build/linux-*/opt/lib/ext/j3dutils.jar %{buildroot}%{_javadir}/%{name}/j3dutils-%{version}.jar
install -pm 0644 vecmath/build/opt/lib/ext/vecmath.jar %{buildroot}%{_javadir}/%{name}/vecmath-%{version}.jar

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

# javadoc
cp -a j3d-core/build/linux-*/javadocs/ %{buildroot}%{_javadocdir}/%{name}-%{version}/j3dcore
cp -a vecmath/build/javadocs/ %{buildroot}%{_javadocdir}/%{name}-%{version}/vecmath

# Manually install doc files
mkdir -p %{buildroot}%{_docdir}/java3d/j3d-core
mkdir -p %{buildroot}%{_docdir}/java3d/j3d-core-utils
mkdir -p %{buildroot}%{_docdir}/java3d/vecmath
cd j3d-core
cp -a COPYRIGHT.txt LICENSE* README-FIRST.txt THIRDPARTY-LICENSE-*.txt docs/ release-info/fcs-1_5_2/ %{buildroot}%{_docdir}/java3d/j3d-core/
cd ../j3d-core-utils
cp -a COPYRIGHT.txt LICENSE.txt README-FIRST.txt THIRDPARTY-LICENSE-*.txt %{buildroot}%{_docdir}/java3d/j3d-core-utils/
cd ../vecmath
cp -a COPYRIGHT.txt LICENSE* README-FIRST.txt docs/ %{buildroot}%{_docdir}/java3d/vecmath/
cd ..

%fdupes -s %{buildroot}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%doc %{_docdir}/java3d
%if 0%{?suse_version} < 1320
%{_libdir}/libj3dcore-ogl.so
%endif
%{_javadir}/%{name}/

%files javadoc
%defattr(-,root,root,-)
%doc %{_javadocdir}/%{name}-%{version}/

%changelog
openSUSE Build Service is sponsored by