packages java-bouncycastle.spec
      Pages: < 1 >  DOWNLOAD      
%define        pkg_version      145
Name:          java-bouncycastle
Version:       1.45
Release:       3mamba
Summary:       Bouncy Castle Crypto Package for Java 1.6
Group:         System/Libraries/Java
Vendor:        openmamba
Distribution:  openmamba
Packager:      Silvan Calarco <silvan.calarco@...>
URL:           http://www.bouncycastle.org/java.html
Source0:       http://downloads.bouncycastle.org/java/crypto-%{pkg_version}.tar.gz
Source1:       http://repo2.maven.org/maven2/org/bouncycastle/bcprov-jdk16/%{version}/bcprov-jdk16-%{version}.pom
Source2:       http://repo2.maven.org/maven2/org/bouncycastle/bcmail-jdk16/%{version}/bcmail-jdk16-%{version}.pom
Source3:       http://repo2.maven.org/maven2/org/bouncycastle/bcpg-jdk16/%{version}/bcpg-jdk16-%{version}.pom
Source4:       http://repo2.maven.org/maven2/org/bouncycastle/bctsp-jdk16/%{version}/bctsp-jdk16-%{version}.pom
Source5:       http://repo2.maven.org/maven2/org/bouncycastle/bcprov-ext-jdk16/%{version}/bcprov-ext-jdk16-%{version}.pom
Patch0:        java-bouncycastle-1.45-build1-6.patch
Patch1:        java-bouncycastle-1.45-build1-5.patch
Patch2:        java-bouncycastle-1.45-build1-4.patch
License:       Apache Software License Version 1.1, MIT, X11
BuildRequires: apache-ant
BuildRequires: apache-ant-junit
%if "%{stage1}" != "1"
BuildRequires: apache-geronimo-1.2-specs
BuildRequires: java-jcoverage
BuildRequires: java-pack200-ant-task
%else
BuildRequires: java-glassfish-javamail
%endif
BuildRequires: java-junit3
BuildRequires: jpackage-utils
%if "%{stage1}" != "1"
Requires:      apache-geronimo-1.2-specs
%else
Requires:      java-glassfish-javamail
%endif
Provides:      jce = 1.6.0.0
Obsoletes:     java-bouncycastle143
Provides:      java-bouncycastle143
Obsoletes:     java-bouncycastle145
Provides:      java-bouncycastle145
Obsoletes:     java-bouncycastle-bcpg
Provides:      java-bouncycastle-bcpg
Obsoletes:     java-bouncycastle-bctsp
Provides:      java-bouncycastle-bctsp
Obsoletes:     java-bouncycastle-crypto
Provides:      java-bouncycastle-crypto
Obsoletes:     java-bouncycastle-mail
Provides:      java-bouncycastle-mail
BuildRoot:     %{_tmppath}/%{name}-%{version}-root

%description
The Bouncy Castle Crypto APIs for Java consist of the following:

* A lightweight cryptography API.
* A provider for the Java Cryptography Extension and the Java Cryptography Architecture.
* A clean room implementation of the JCE 1.2.1.
* A library for reading and writing encoded ASN.1 objects.
* A lightweight client-side TLS API.
* Generators for Version 1 and Version 3 X.509 certificates, Version 2 CRLs, and PKCS12 files.
* Generators for Version 2 X.509 attribute certificates.
* Generators/Processors for S/MIME and CMS (PKCS7/RFC 3852).
* Generators/Processors for OCSP (RFC 2560).
* Generators/Processors for TSP (RFC 3161).
* Generators/Processors for OpenPGP (RFC 2440).
* A signed jar version suitable for JDK 1.4-1.6 and the Sun JCE.

The lightweight API works with everything from the J2ME to the JDK 1.6.

%package javadoc
Group:          Documentation
Summary:        Java 1.6 javadoc for %{name}

%description javadoc
Bouncy Castle Crypto Package for Java 1.6.

This package contains javadoc for %{name}.

%prep
%setup -q -c -n bouncycastle-%{version}

%if "%{stage1}" != "1"
for j in $(find . -name "*.jar"); do
	mv $j ${j}.no
done

#mv crypto-%{pkg_version}/lib/Pack200Task.jar.no crypto-%{pkg_version}/lib/Pack200Task.jar
ln -sf $(build-classpath pack200task) crypto-%{pkg_version}/lib/Pack200Task.jar
%endif

%patch0
%patch1
%patch2

%build
pushd crypto-%{pkg_version}

	export JAVA_HOME=%{_jvmdir}/jdk
	%if "%{stage1}" != "1"
   	export CLASSPATH=$(build-classpath jcoverage junit-3.8.2 geronimo/activation-1.0.2-api geronimo/javamail-1.4-api ant/ant-junit)
    %else
   	export CLASSPATH=$(build-classpath ant/ant-junit junit-3.8.2 glassfish-javamail/javamail)
	%endif
	ant -buildfile jdk16.xml \
		-Dbc.javac.source=1.5 \
		-Dbc.javac.target=1.5 \
		-Dencoding=cp1252 \
		-Djunit.jar=$(build-classpath junit-3.8.2) \
%if "%{stage1}" != "1"
		-Dactivation.jar=$(build-classpath geronimo/activation-1.0.2-api) \
		-Dmail.jar=$(build-classpath geronimo/javamail-1.4-api) \
		-Dmailapi.jar=$(build-classpath geronimo/javamail-1.4-api) \
%else
		-Dmail.jar=$(build-classpath glassfish-javamail/javamail) \
		-Dmailapi.jar=$(build-classpath glassfish-javamail/javamail) \
%endif
		-Drelease.suffix=%{version} \
		build-provider build build-test
# test-lw

	export CLASSPATH=$CLASSPATH
	ant -buildfile bc-build.xml \
		-Dbc.javac.source=1.5 \
		-Dbc.javac.target=1.5 \
		-Dsrc.dir=src \
		-Dtarget.prefix=jdk1.6 \
		-Dartifacts.dir=$PWD/build/artifacts/jdk1.6 \
		-Dencoding=cp1252 \
		-Djunit.jar=$(build-classpath junit381) \
%if "%{stage1}" != "1"
		-Dactivation.jar=$(build-classpath geronimo/activation-1.0.2-api) \
		-Dmail.jar=$(build-classpath geronimo/javamail-1.4-api) \
		-Dmailapi.jar=$(build-classpath geronimo/javamail-1.4-api) \
%else
   	    -Dmail.jar=$(build-classpath glassfish-javamail/mailapi) \
   	    -Dmailapi.jar=$(build-classpath glassfish-javamail/mailapi) \
%endif
		-Drelease.suffix=%{version} \
		build-jce
# javadoc-jce
popd

%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"

mkdir -p %{buildroot}%{_javadir}/gcj-endorsed
mkdir -p %{buildroot}%{_javadir}-{ext,1.6.0}

pushd crypto-%{pkg_version}/build/artifacts/jdk1.6/jars
	for jar in {bcmail,bcpg,bcprov,bcprov-ext,bctest,bctsp}-jdk16-%{version}.jar; do
		jard=$(echo $jar | sed s/-jdk16//g)
		install -pm 644 $jar %{buildroot}%{_javadir}/$jard
	done
	install -pm 644 jce-jdk1.6-%{version}.jar %{buildroot}%{_javadir}/bcjce-%{version}.jar
	install -pm 644 jce-ext-jdk1.6-%{version}.jar %{buildroot}%{_javadir}/bcjce-ext-%{version}.jar
popd

install -dm 755 %{buildroot}%{_sysconfdir}/java/security/security.d
touch %{buildroot}%{_sysconfdir}/java/security/security.d/2000-org.bouncycastle.jce.provider.BouncyCastleProvider

pushd %{buildroot}%{_javadir}-ext/
	ln -sf ../java/bcprov-ext-%{version}.jar bcprov-ext-%{version}.jar
popd

pushd %{buildroot}%{_javadir}/gcj-endorsed 
      	ln -sf ../bcprov-%{version}.jar bcprov-%{version}.jar
popd

(
	cd %{buildroot}%{_javadir}
	for jar in *-%{version}.jar; do 
		ln -sf ${jar} $(echo $jar| sed  -e "s|-%{version}||g")
	done
	for jar in *.jar; do 
		ln -sf ../java/${jar} %{buildroot}%{_javadir}-1.6.0/${jar}
	done
)

mkdir -p %{buildroot}%{_mavenpomdir}
install -pm 644 %{SOURCE1} %{buildroot}%{_mavenpomdir}/JPP-bcprov.pom
%add_to_maven_depmap org.bouncycastle bcprov-jdk16 %{version} JPP bcprov
install -pm 644 %{SOURCE2} %{buildroot}%{_mavenpomdir}/JPP-bcprov.pom
%add_to_maven_depmap org.bouncycastle bcmail-jdk16 %{version} JPP bcmail
install -pm 644 %{SOURCE3} %{buildroot}%{_mavenpomdir}/JPP-bcpg.pom
%add_to_maven_depmap org.bouncycastle bcpg-jdk16 %{version} JPP bcpg
install -pm 644 %{SOURCE4} %{buildroot}%{_mavenpomdir}/JPP-bctsp.pom
%add_to_maven_depmap org.bouncycastle bctsp-jdk16 %{version} JPP bctsp
install -pm 644 %{SOURCE5} %{buildroot}%{_mavenpomdir}/JPP-bcprov-ext.pom
%add_to_maven_depmap org.bouncycastle bcprov-ext-jdk16 %{version} JPP bcprov-ext

pushd crypto-%{pkg_version}/build/artifacts/jdk1.6
	mkdir -p %{buildroot}%{_javadocdir}/bouncycastle-%{version}
	cp -pr javadoc/* %{buildroot}%{_javadocdir}/bouncycastle-%{version}
	ln -sf bouncycastle-%{version} %{buildroot}%{_javadocdir}/bouncycastle
popd

%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"

%post
# TODO
#{
#[ -f "/usr/lib/security/classpath.security" ] || continue
#
#sed -i '/^security\.provider\./d' "/usr/lib/security/classpath.security"
#count=0
#for provider in $(ls /etc/java/security/security.d)
#do
#	count=$((count + 1))
#	echo "security.provider.${count}=${provider#*-}" >> "/usr/lib/security/classpath.security"
#done
#} || :
%update_maven_depmap

%postun
# TODO
#if [ $1 -eq 0 ] ; then
#{
#[ -f "/usr/lib/security/classpath.security" ] || continue
#
#sed -i '/^security\.provider\./d' "/usr/lib/security/classpath.security"
#
#count=0
#for provider in $(ls /etc/java/security/security.d)
#do
#	count=$((count + 1))
#	echo "security.provider.${count}=${provider#*-}" >> "/usr/lib/security/classpath.security"
#done
#} || :
#fi
%update_maven_depmap

%files
%defattr(-,root,root)
%{_sysconfdir}/java/security/security.d/2000-org.bouncycastle.jce.provider.BouncyCastleProvider
%{_javadir}/bcmail-%{version}.jar
%{_javadir}/bcmail.jar
%{_javadir}/bcpg-%{version}.jar
%{_javadir}/bcpg.jar
%{_javadir}/bcprov-%{version}.jar
%{_javadir}/bcprov.jar
%{_javadir}/bcprov-ext-%{version}.jar
%{_javadir}/bcprov-ext.jar
%{_javadir}/bctest-%{version}.jar
%{_javadir}/bctest.jar
%{_javadir}/bctsp-%{version}.jar
%{_javadir}/bctsp.jar
%{_javadir}/bcjce-%{version}.jar
%{_javadir}/bcjce.jar
%{_javadir}/bcjce-ext-%{version}.jar
%{_javadir}/bcjce-ext.jar
%{_javadir}-1.6.0/
%{_javadir}-ext/
%{_javadir}/gcj-endorsed
%{_mavenpomdir}
%{_mavendepmapfragdir}
%doc crypto-%{pkg_version}/build/artifacts/jdk1.6/lcrypto-jdk16-%{version}/*.html

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

%changelog
* Thu Nov 25 2010 gil <puntogil@...> 1.45-3mamba
- rebuilt devel
- add system java-pack200-ant-task support

* Wed Mar 03 2010 gil <puntogil@...> 1.45-2mamba
- added %%post %%postun script
- renamed %{name}
- added maven poms

* Thu Feb 25 2010 gil <puntogil@...> 1.45-1mamba
- update to 1.45
- renamed for legacy %{name}145
- added java-jcoverage support

* Sat Jul 11 2009 gil <puntogil@...> 1.43-1mamba
- update to 1.43
- renamed for legacy %{name}143

* Fri Apr 03 2009 gil <puntogil@...> 1.42-1mamba
- Initial package