Name:                je
Version:             6.3.8
Release:             1
Summary:             Berkeley DB Java Edition
License:             AGPLv3 and BSD
URL:                 http://www.oracle.com/us/products/database/berkeley-db/je/overview/index.html
Source0:             http://download.oracle.com/berkeley-db/je-%{version}.tar.gz
Source1:             http://download.oracle.com/maven/com/sleepycat/je/%{version}/je-%{version}.pom
Patch0:              je-6.3.8-build.patch
Patch1:              je-6.3.8-use-system-asm.patch
BuildRequires:       ant ant-junit hamcrest-core hostname java-javadoc javapackages-local
BuildRequires:       jboss-connector-1.6-api jboss-ejb-3.1-api junit mvn(org.ow2.asm:asm)
BuildArch:           noarch
%description
Berkeley DB Java Edition is a high performance, transactional storage
engine written entirely in Java. Like the highly successful Berkeley DB
product, Berkeley DB Java Edition executes in the address space of the
application, without the overhead of client/server communication. It
stores data in the application's native format, so no run-time data
translation is required. Berkeley DB Java Edition supports full ACID
transactions and recovery. It provides an easy-to-use, programmatic
interface, allowing developers to store and retrieve information
quickly, simply and reliably.

%package examples
Summary:             Examples for je
Requires:            je = %{version}-%{release}
%description examples
This package contains examples for je.

%package javadoc
Summary:             Javadoc for je
%description javadoc
This package contains javadoc for je.

%package examples-javadoc
Summary:             Javadoc for je-examples
Requires:            je-javadoc = %{version}-%{release}
%description examples-javadoc
This package contains javadoc for je-examples.

%prep
%setup -q
find  -name "*.jar" -delete
find  -name "*.class" -delete
rm -Rf docs/*
rm -Rf lib
%patch0 -p1
cp -p %{SOURCE1} pom.xml
%patch1 -p1
rm -rf src/com/sleepycat/asm
%mvn_file com.sleepycat:je je

%build
ant \
 -Dj2ee.jarfile="$(build-classpath jboss-connector-1.6-api):$(build-classpath jboss-ejb-3.1-api)" \
 -Djdk6.home=%{_jvmdir}/java \
 -Dant.library.dir=%{_javadir} \
 jar javadoc compile-examples
cd build/classes
%jar -cf ../../je-examples.jar collections je jmx persist

%install
%mvn_artifact pom.xml build/lib/je.jar
%mvn_install -J docs/java
install -pm 644 je-examples.jar %{buildroot}%{_javadir}/je-examples.jar
cp -a docs/examples %{buildroot}%{_javadocdir}/je-examples

%files -f .mfiles
%doc README
%license LICENSE

%files javadoc -f .mfiles-javadoc
%license LICENSE

%files examples
%{_javadir}/je-examples.jar
%license LICENSE

%files examples-javadoc
%{_javadocdir}/je-examples
%license LICENSE

%changelog
* Fri Aug 21 2020 yaokai <yaokai13@huawei.com> - 6.3.8-1
- Package init
