File puretls.spec of Package puretls

#
# spec file for package puretls (Version 0.9)
#
# Copyright (c) 2009 SUSE LINUX Products 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/
#

# norootforbuild


Name:           puretls
BuildRequires:  ant cryptix-asn1 gnu-getopt java2-devel-packages xml-commons-apis
%define name		puretls
%define rversion	0.9
%define beta		b5
%define release		0.%{beta}.2jpp
%define section		free
Version:        0.9
Release:        277
Summary:        Java implementation of SSLv3 and TLSv1
License:        BSD 3-Clause
Group:          Development/Libraries/Java
Source0:        %{name}-%{rversion}%{beta}.tar.bz2
Patch150:       java150_build.patch
Url:            http://www.rtfm.com/puretls
Requires:       cryptix
Requires:       cryptix-asn1
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
PureTLS is a free Java-only implementation of the SSLv3 and TLSv1
(RFC2246) protocols. PureTLS was developed by Eric Rescorla for
Claymore Systems, Inc, but is being distributed for free because we
believe that basic network security is a public good and should be a
commodity.



%package javadoc
License:        BSD 3-Clause
PreReq:         coreutils
Group:          Development/Libraries/Java
Summary:        Javadoc for puretls

%description javadoc
This package contains the javadoc documentation for PureTLS.

PureTLS is a free Java-only implementation of the SSLv3 and TLSv1
(RFC2246) protocols. PureTLS was developed by Eric Rescorla for
Claymore Systems, Inc, but is being distributed for free because we
believe that basic network security is a public good and should be a
commodity.



%package demo
License:        BSD 3-Clause
Group:          Development/Libraries/Java
Summary:        Demonstration and samples for puretls
Requires:       %{name}

%description demo
This package contains demonstration and sample files for PureTLS.

PureTLS is a free Java-only implementation of the SSLv3 and TLSv1
(RFC2246) protocols. PureTLS was developed by Eric Rescorla for
Claymore Systems, Inc, but is being distributed for free because we
believe that basic network security is a public good and should be a
commodity.



%prep
%setup -q -n %{name}-%{rversion}%{beta}
# fix perl location
find . -type f |
    xargs grep -l "/usr/local/bin/perl5" | \
    xargs perl -pi -e "s|/usr/local/bin/perl5|%{_bindir}/perl|g;"
find . -type f |
    xargs grep -l "/usr/local/bin/perl" | \
    xargs perl -pi -e "s|/usr/local/bin/perl|%{_bindir}/perl|g;"
# remove all binary libs
find . -name "*.jar" -exec rm -f {} \;
find . -name "*.class" -exec rm -f {} \;
%patch150 -p1

%build
mkdir dist
for javaver in 1.4 ; do
	export JAVA_HOME=$(find /usr/lib/jvm -name "java-$javaver*" -type d | sort | tail -1)
	export CLASSPATH=$(build-classpath cryptix cryptix-asn1 gnu.getopt)
	ant -Djdk.version=$javaver clean compile
        mv build/%{name}.jar dist/%{name}$javaver.jar
done
ant javadoc

%install
# jars
install -d -m 755 $RPM_BUILD_ROOT%{_javadir}
install -d -m 755 $RPM_BUILD_ROOT%{_javadir}-ext
install -m 644 dist/%{name}1.4.jar $RPM_BUILD_ROOT%{_javadir}-ext/%{name}1.4-%{version}.%{beta}.jar
%add_jvm_extension %{name}1.4-%{version}.%{beta} %{name} 1.4.0 1.4.1 1.4.2 1.5.0
%add_jvm_extension %{name}1.4-%{version}.%{beta} %{name}-%{version}.%{beta} 1.4.0 1.4.1 1.4.2 1.5.0
# javadoc
install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
cp -r build/doc/api/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
# data
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/%{name}
install -m 644 build/%{name}demo.jar $RPM_BUILD_ROOT%{_datadir}/%{name}/%{name}-demo.jar
install -m 644 *.pem $RPM_BUILD_ROOT%{_datadir}/%{name}
install -m 755 test.pl $RPM_BUILD_ROOT%{_datadir}/%{name}

%clean
rm -rf $RPM_BUILD_ROOT

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

%postun javadoc
if [ "$1" = "0" ]; then
  rm -f %{_javadocdir}/%{name}
fi

%files
%defattr(-,root,root)
%doc ChangeLog COPYRIGHT INSTALL LICENSE README
#%dir %{_javadir}/java-1.50
%{_javadir}-*/*.jar

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

%files demo
%defattr(-,root,root)
%{_datadir}/%{name}

%changelog
* Mon Sep 25 2006 dbornkessel@suse.de
- fixes necessary to compile with Java 1.5.0
        - set source="1.4" and target="1.4" for ant "javac" tasks
        - set source="1.4" for ant "javadoc" tasks
* Wed Sep 20 2006 dbornkessel@suse.de
- update to 0.9b5
- added 1.5.0 links
* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Thu Aug 04 2005 jsmeix@suse.de
- Fix the "fix perl location" ( /%%{_bindir} -> %%{_bindir} ).
  Otherwise puretls-demo requires //usr/bin/perl (bug 100612).
* Fri Jul 29 2005 jsmeix@suse.de
- Adjustments in the spec file.
* Tue Jul 26 2005 ro@suse.de
- fix typo in specfile
* Mon Jul 18 2005 jsmeix@suse.de
- Current version 0.9 from JPackage.org
* Thu Sep 16 2004 skh@suse.de
- Fix prerequires of javadoc subpackage
* Wed Sep 08 2004 skh@suse.de
- Fix regexp to correct perl location in scripts in %%prep
* Sat Sep 04 2004 skh@suse.de
- fixed neededforbuild (gnu.getopt -> gnu-getopt)
* Thu Sep 02 2004 skh@suse.de
- Initial package created with version 0.9 (JPackage 1.5)
openSUSE Build Service is sponsored by