%description -n ceph-test
This package contains Ceph benchmarks and test tools.
-# Enable building of debug package on distributions that don't automatically
-# build it.
+%package -n libcephfs-jni
+Summary: Java Native Interface library for CephFS Java bindings.
+Group: System Environment/Libraries
+License: LGPL-2.0
+Requires: java
+Requires: libcephfs1 = %{version}-%{release}
+BuildRequires: java-devel
+%description -n libcephfs-jni
+This package contains the Java Native Interface library for CephFS Java
+bindings.
+
+%package -n libcephfs-java
+Summary: Java libraries for the Ceph File System.
+Group: System Environment/Libraries
+License: LGPL-2.0
+Requires: java
+Requires: libcephfs-jni = %{version}-%{release}-
+BuildRequires: java-devel
+%description -n libcephfs-java
+This package contains the Java libraries for the Ceph File System.
%if (0%{?centos} || 0%{?opensuse} || 0%{?suse_version})
%debug_package
%setup -q
%build
+# Find jni.h
+for i in -I/usr/lib/jvm/java/include{,/linux}; do
+ java_inc="$java_inc $i"
+done
+
./autogen.sh
MY_CONF_OPT=""
# be explicit about --with/without-tcmalloc because the
# autoconf default differs from what's needed for rpm
-%{configure} --prefix=/usr \
+%{configure} CPPFLAGS="$java_inc" \
+ --prefix=/usr \
--sbindir=/sbin \
--localstatedir=/var \
--sysconfdir=/etc \
--without-cryptopp \
--with-rest-bench \
--with-debug \
+ --enable-cephfs-java \
$MY_CONF_OPT \
%{?_with_ocf} \
%{?with_tcmalloc:--with-tcmalloc} %{!?with_tcmalloc:--without-tcmalloc} \
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/ceph/
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/ceph/
+# Relocate java packages to expected locations in buildroot.
+mkdir -p $RPM_BUILD_ROOT/usr/lib/jni
+mv $RPM_BUILD_ROOT/usr/lib64/libcephfs_jni.so* $RPM_BUILD_ROOT/usr/lib/jni/.
+mkdir -p $RPM_BUILD_ROOT/usr/share/java
+mv $RPM_BUILD_ROOT/usr/lib64/libcephfs.jar $RPM_BUILD_ROOT/usr/share/java/.
+mv $RPM_BUILD_ROOT/usr/lib64/libcephfs-test.jar $RPM_BUILD_ROOT/usr/share/java/.
+
%clean
rm -rf $RPM_BUILD_ROOT
%{_bindir}/tpbench
%{_bindir}/xattr_bench
+%files -n libcephfs-jni
+%defattr(-,root,root,-)
+/usr/lib/jni/libcephfs_jni.so*
+
+%files -n libcephfs-java
+%defattr(-,root,root,-)
+/usr/share/java/libcephfs.jar
+/usr/share/java/libcephfs-test.jar
+
%changelog