+#
+# Conditional build:
+%bcond_without gtk # GTK+ 3 based GUI
+%bcond_without java # JNI bindings
+#
Summary: Software Token for Linux/UNIX
Summary(pl.UTF-8): Token programowy dla systemów Linux/UNIX
Name: stoken
-Version: 0.2
-Release: 2
+Version: 0.91
+Release: 1
License: LGPL v2.1+
Group: Libraries
Source0: http://downloads.sourceforge.net/stoken/%{name}-%{version}.tar.gz
-# Source0-md5: d815783d7198f1181c1a72e3d730d367
+# Source0-md5: 584432f22032f0a8a719272fa2329bcd
+Patch0: %{name}-sh.patch
URL: http://stoken.sourceforge.net/
-BuildRequires: gtk+2-devel >= 2.0
+%{?with_java:BuildRequires: ant}
+BuildRequires: autoconf >= 2.61
+BuildRequires: automake >= 1:1.11
+%{?with_gtk:BuildRequires: gtk+3-devel >= 3.0}
+%{?with_java:BuildRequires: jdk}
BuildRequires: libtomcrypt-devel
+BuildRequires: libtool >= 2:2
+BuildRequires: libxml2-devel >= 2
BuildRequires: pkgconfig >= 1:0.27
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description static -l pl.UTF-8
Statyczna biblioteka stoken.
+%package -n java-stoken
+Summary: JNI interface for stoken library
+Summary(pl.UTF-8): Interfejs JNI do biblioteki stoken
+License: BSD
+Group: Libraries/Java
+Requires: %{name} = %{version}-%{release}
+
+%description -n java-stoken
+JNI interface for stoken library.
+
+%description -n java-stoken -l pl.UTF-8
+Interfejs JNI do biblioteki stoken.
+
%prep
%setup -q
+%patch0 -p1
%build
-%configure
+%{__libtoolize}
+%{__aclocal} -I m4
+%{__autoconf}
+%{__autoheader}
+%{__automake}
+%configure \
+ --disable-silent-rules \
+ %{!?with_gtk:--without-gtk} \
+ %{?with_java:--with-java}
%{__make}
+%if %{with java}
+cd java
+install -d dist
+%ant
+%endif
+
%install
rm -rf $RPM_BUILD_ROOT
# obsoleted by pkg-config
%{__rm} $RPM_BUILD_ROOT%{_libdir}/libstoken.la
+%if %{with java}
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/libstoken-wrapper.{la,a}
+install -D java/dist/stoken-wrapper.jar $RPM_BUILD_ROOT%{_javadir}/stoken-wrapper.jar
+%endif
+
%clean
rm -rf $RPM_BUILD_ROOT
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
+%post -n java-stoken -p /sbin/ldconfig
+%postun -n java-stoken -p /sbin/ldconfig
+
%files
%defattr(644,root,root,755)
-%doc README TODO
+%doc CHANGES README.md TODO
%attr(755,root,root) %{_bindir}/stoken
%attr(755,root,root) %{_libdir}/libstoken.so.*.*.*
%attr(755,root,root) %ghost %{_libdir}/libstoken.so.1
%{_mandir}/man1/stoken.1*
+%if %{with gtk}
%files gui
%defattr(644,root,root,755)
%attr(755,root,root) %{_bindir}/stoken-gui
+%{_datadir}/stoken
%{_desktopdir}/stoken-gui.desktop
+%{_desktopdir}/stoken-gui-small.desktop
%{_pixmapsdir}/stoken-gui.png
%{_mandir}/man1/stoken-gui.1*
+%endif
%files devel
%defattr(644,root,root,755)
%files static
%defattr(644,root,root,755)
%{_libdir}/libstoken.a
+
+%if %{with java}
+%files -n java-stoken
+%defattr(644,root,root,755)
+%doc java/src/com/example/LibTest.java
+%attr(755,root,root) %{_libdir}/libstoken-wrapper.so.*.*.*
+%attr(755,root,root) %ghost %{_libdir}/libstoken-wrapper.so.0
+%attr(755,root,root) %{_libdir}/libstoken-wrapper.so
+%{_javadir}/stoken-wrapper.jar
+%endif