%global oname threeten
%global pomversion 0.6.3
Name:                time-api
Version:             0.6.4
Release:             1
Summary:             JSR-310 - Date and Time API
License:             BSD and GPLv2+ and Public Domain
URL:                 http://threeten.github.com/
Source0:             https://github.com/ThreeTen/threeten/archive/v%{version}.tar.gz
Source1:             https://www.datanucleus.org/downloads/maven2/javax/time/%{name}/%{pomversion}/%{name}-%{pomversion}.pom
Patch0:              %{name}-0.6.4-dont-compile-openjdk-classes.patch

BuildRequires:       java-devel jpackage-utils javapackages-tools maven-local
BuildRequires:       ant emma testng
Requires:            jpackage-utils
BuildArch:           noarch
Provides:            bundled(openjdk8-javax-time) = %{version}-%{release}

%description
This JSR will provide a new and improved date and
time API for Java.

%package javadoc
Summary:             Javadoc for %{name}
%description javadoc
This package contains javadoc for %{name}.

%prep
%setup -q -n %{oname}-%{version}
sed -i 's|src="${maven.ibiblio.url}/@{group}/@{artifact}/@{version}/@{artifact}-@{version}@{variant}.jar"|src="file:///usr/share/java/@{artifact}.jar"|' build.xml
%patch0 -p0
cp -p %{SOURCE1} pom.xml
sed -i "s|%{pomversion}|%{version}|" pom.xml
sed -i 's/\r//' COPYRIGHT-ASSIGN.txt LICENSE.txt LICENSE_OpenJDK.txt LICENSE_Oracle.txt \
 OpenJDKChallenge.txt README.txt RELEASE-NOTES.txt TODO.txt

%build
%mvn_build -f

%install
%mvn_install
mkdir -p %{buildroot}%{_javadir}/javax.time
ln -sf %{_javadir}/%{name}/%{name}.jar %{buildroot}%{_javadir}/javax.time/

%files -f .mfiles
%{_javadir}/javax.time/%{name}.jar
%doc COPYRIGHT-ASSIGN.txt LICENSE.txt LICENSE_OpenJDK.txt LICENSE_Oracle.txt
%doc OpenJDKChallenge.txt README.txt RELEASE-NOTES.txt TODO.txt

%files javadoc -f .mfiles-javadoc
%doc COPYRIGHT-ASSIGN.txt LICENSE.txt LICENSE_OpenJDK.txt LICENSE_Oracle.txt

%changelog
* Mon Aug 17 2020 maminjie <maminjie1@huawei.com> - 0.6.4-1
- package init
