File java3d.spec of Package java3d

#
# spec file for package java3d
#
# Copyright (c) 2016 SUSE LINUX 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 java_version %(java --version|head -1|sed 's/^openjdk \\([0-9]*\\)\\.[.0-9]* ..*/\\1/')

Summary:        Java 3D API
License:        GPL-2.0
Group:          Development/Libraries/Java
Url:            http://java3d.java.net/
Name:           java3d
Version:        1.5.2
Release:        0
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
ExcludeArch:    aarch64 %arm ppc64le

Source0:        vecmath-%{version}.tar.bz2
Source1:        j3d-core-%{version}.tar.bz2
Source2:        j3d-core-utils-%{version}.tar.bz2
Patch0:         build-with-optflags.patch
Patch1:         fix-crash-on-multimonitor.patch
# patches from https://salsa.debian.org/java-team/java3d
Patch100:       typedef.patch
Patch101:       01_fix_powerpc_ftbfs.patch
Patch102:       02_fix_generic_ftbfs.patch
Patch103:       04_no_maxmemory.patch
Patch104:       05_pic_amd64.patch
Patch105:       05_pic_i586.patch
Patch106:       06_java-compat.patch
Patch107:       07_java9_compatibility.patch
Patch108:       08_java10_compatibility.patch
Patch109:       09_java11_compatibility.patch
Patch110:       10_use_gcc_for_linking.patch

Patch200:       java3d-ppc64.patch
Patch201:       no-source-1.5.patch

BuildRequires:  Mesa-devel
BuildRequires:  ant
BuildRequires:  gcc
BuildRequires:  java-devel >= 1.5
BuildRequires:  libnsl-devel
BuildRequires:  pkgconfig(xt)
BuildRequires:  pkgconfig(xext)

Requires:       java >= 1.5

%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:        Javadoc for java3d
Group:          Documentation/HTML

%description javadoc
Javadoc documentation for java3d.

%prep
%setup -q -T -c -n %{name} -a 0 -a 1 -a 2
%patch0 -p1
%patch1 -p1

%patch100 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1
%patch104 -p1
%patch105 -p1
%patch106 -p1
%patch107 -p1
%if 0%{?java_version} >= 10
%patch108 -p1
%endif
%if 0%{?java_version} >= 11
%patch109 -p1
%endif
%patch110 -p1

%patch200 -p1
%if 0%{?suse_version} >= 1500
%patch201 -p1
%endif

%build
pushd vecmath
  %ant jar
popd

pushd j3d-core
  # to avoid Out of heap memory on "small" machines ...
  export ANT_OPTS=-Xmx256m
  %ant \
    -Dbuild.type=fcs \
    -Dbuild.cflags="%{optflags}" \
%if 0%{?suse_version} >= 1500
    -DjavahBuild.notRequired=true \
%endif
    jar docs-public
popd

%install
install -dm 755 %{buildroot}%{_javadir}/%{name}
install -dm 755 %{buildroot}%{_libdir}
install -dm 755 %{buildroot}%{_javadocdir}/%{name}-%{version}

# jars
install -m 644 vecmath/build/opt/lib/ext/vecmath.jar \
	%{buildroot}%{_javadir}/%{name}
install -m 644 j3d-core/build/default/opt/lib/ext/*.jar \
	%{buildroot}%{_javadir}/%{name}

# libs
install -m 644 j3d-core/build/default/opt/native/*.so \
	%{buildroot}%{_libdir}

# javadoc
cp -av j3d-core/build/*/javadocs/docs-public/* \
	%{buildroot}%{_javadocdir}/%{name}-%{version}

ln -s %{name}-%{version} %{buildroot}%{_javadocdir}/%{name} # ghost symlink

%post javadoc
rm -f %{_javadocdir}/%{name}
ln -s %{name}-%{version} %{_javadocdir}/%{name}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%doc j3d-core/*.txt
%doc j3d-core/*.html
%doc j3d-core/docs

%dir %{_javadir}/%{name}
%{_javadir}/%{name}/*.jar
%{_libdir}/lib*.so

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

%changelog