Пакет p2psockets: Specfile

Packager: Igor Vlasenko <viy@altlinux.ru>
BuildRequires: /proc
BuildRequires: jpackage-compat
# Copyright (c) 2000-2009, JPackage Project
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the
#    distribution.
# 3. Neither the name of the JPackage Project nor the names of its
#    contributors may be used to endorse or promote products derived
#    from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

%define gcj_support 0



Name:           p2psockets
Summary:        A reimplementation of standard Java sockets on top of JXTA
Url:            http://p2psockets.jxta.org/
Version:        1.1.4
Release:        alt2_4jpp5
Epoch:          0
License:        Apache 1.1 -style License
Group:          Development/Java
Source0:        http://p2psockets.jxta.org/releases/unstable/p2psockets-1_1_4.zip
Source1:        jxta_license.txt
Source2:        p2psockets-core-1.1.4.pom
Patch0:         p2psockets-1_2-build_xml.patch
Patch1:         p2psockets-1_1_4-build.patch

BuildRequires: jpackage-utils >= 0:1.7.5
BuildRequires: ant >= 0:1.6
BuildRequires: ant-contrib
BuildRequires: junit

BuildRequires: bouncycastle
BuildRequires: cryptix
BuildRequires: cryptix-asn1
BuildRequires: gnu-regexp
BuildRequires: jakarta-commons-httpclient
BuildRequires: jakarta-commons-logging
BuildRequires: jaxen
BuildRequires: jdom
BuildRequires: jetty5
BuildRequires: jxta
BuildRequires: mx4j
BuildRequires: log4j
BuildRequires: servlet_2_4_api
BuildRequires: tomcat5-jasper
BuildRequires: xerces-j2
BuildRequires: xmlrpc2
BuildRequires: xml-commons-jaxp-1.3-apis
Requires: bouncycastle
Requires: cryptix
Requires: cryptix-asn1
Requires: gnu-regexp
Requires: jakarta-commons-httpclient
Requires: jakarta-commons-logging
Requires: jaxen
Requires: jdom
Requires: jetty5
Requires: jxta
Requires: mx4j
Requires: log4j
Requires: servlet_2_4_api
Requires: tomcat5-jasper
Requires: xerces-j2
Requires: xmlrpc2
Requires: xml-commons-jaxp-1.3-apis

Requires(post): jpackage-utils >= 0:1.7.5
Requires(postun): jpackage-utils >= 0:1.7.5

%if %{gcj_support}
BuildRequires: java-gcj-compat-devel
Requires(post): java-gcj-compat
Requires(postun): java-gcj-compat
%endif
%if ! %{gcj_support}
BuildArch:      noarch
%endif

%description
P2P Sockets makes it easy to write peer-to-peer 
applications based on JXTA. P2P Sockets allows 
programmers to gain much of the power of JXTA, such 
as NAT and firewall traversal, without being exposed 
to its complexity. It does this through ports of 
popular software projects, such as a web server and 
web services stack, to work on the JXTA peer-to-peer 
network. This includes a web server (Jetty) that can 
receive requests and serve content over the peer-to-peer 
network; a servlet and JSP engine (Jetty and Jasper) that 
allows existing servlets and JSPs to serve P2P clients; 
an XML-RPC client and server (Apache XML-RPC) for 
accessing and exposing P2P XML-RPC endpoints; an HTTP/1.1 
client (Apache Commons HTTP-Client) that can access P2P 
web servers; a gateway (Smart Cache) to make it possible 
for existing browsers to access P2P web sites; and a 
WikiWiki (JSPWiki) that can be used to host WikiWikis on 
your local machine that other peers can access and edit 
through the P2P network. P2P Sockets also introduces 
implementations of java.net.Socket and 
java.net.ServerSocket that can work on the JXTA network 
as well as a simple, light-weight, distributed, 
human-friendly, and non-secure DNS system. 


%package javadoc
Summary:        Javadoc for %{name}
Group:          Development/Documentation
BuildArch: noarch

%description javadoc
%{summary}.

%package manual
Summary:        Documents for %{name}
Group:          Development/Documentation
BuildArch: noarch

%description manual
%{summary}.

%prep
%setup -q -n %{name}
chmod -R go=u-w *
cp %{SOURCE1} jxta_license.txt
find . -name "*.jar" -exec rm {} \;

%patch0 -b .sav0
%patch1 -b .sav1

%build
pushd lib
ln -sf $(build-classpath ant-contrib) .
ln -sf $(build-classpath ant) .
ln -sf $(build-classpath xmlrpc2) .
#ln -sf $(build-classpath bouncycastle/bcprov) .
ln -sf $(build-classpath bcprov) .
ln -sf $(build-classpath commons-httpclient) .
ln -sf $(build-classpath commons-logging) .
ln -sf $(build-classpath cryptix) .
ln -sf $(build-classpath cryptix-asn1) .
ln -sf $(build-classpath gnu.regexp) .
ln -sf $(build-classpath jasper5-compiler) .
ln -sf $(build-classpath jasper5-runtime) .
ln -sf $(build-classpath servlet_2_4_api) .
ln -sf $(build-classpath jaxen) .
ln -sf $(build-classpath jsse) .
ln -sf $(build-classpath jdom) .
ln -sf $(build-classpath mx4j/mx4j) .
ln -sf $(build-classpath mx4j/mx4j-tools) .
#jnet.jar
#jogg-0.0.5.jar
#jorbis-0.0.12.jar
ln -sf $(build-classpath junit) .
#jxtacms.jar
ln -sf $(build-classpath jxtaSwing) .
ln -sf $(build-classpath jxtaext) .
ln -sf $(build-classpath jxta) .
#jxtaptls.jar
#jxtasecurity.jar
#jxtashell.jar
ln -sf $(build-classpath log4j) .
ln -sf $(build-classpath jetty5/jetty5) .
#p2psockets-ant-custom.jar
ln -sf $(build-classpath xerces-j2) .
ln -sf $(build-classpath xml-commons-jaxp-1.3-apis) .
popd
export p2psockets_home=$(pwd)
export OPT_JAR_LIST="ant-contrib"
ant -Dant.build.javac.source=1.4 -Dant.build.javac.target=1.4 build jar javadoc 


%install
# jars
install -d -m 755 $RPM_BUILD_ROOT%{_javadir}/%{name}
install -m 644 dist/lib/%{name}-apache-httpclient.jar \
   $RPM_BUILD_ROOT%{_javadir}/%{name}/%{name}-apache-httpclient-%{version}.jar
install -m 644 dist/lib/%{name}-apache-xmlrpc.jar \
   $RPM_BUILD_ROOT%{_javadir}/%{name}/%{name}-apache-xmlrpc-%{version}.jar
install -m 644 dist/lib/%{name}-core.jar \
   $RPM_BUILD_ROOT%{_javadir}/%{name}/%{name}-core-%{version}.jar
install -m 644 dist/lib/%{name}-examples.jar \
   $RPM_BUILD_ROOT%{_javadir}/%{name}/%{name}-examples-%{version}.jar
install -m 644 dist/lib/%{name}-jetty.jar \
   $RPM_BUILD_ROOT%{_javadir}/%{name}/%{name}-jetty-%{version}.jar
install -m 644 dist/lib/%{name}-scache.jar \
   $RPM_BUILD_ROOT%{_javadir}/%{name}/%{name}-scache-%{version}.jar
install -m 644 dist/lib/%{name}-tests.jar \
   $RPM_BUILD_ROOT%{_javadir}/%{name}/%{name}-tests-%{version}.jar
(cd $RPM_BUILD_ROOT%{_javadir}/%{name} && for jar in %{name}-*-%{version}*; do ln -sf ${jar} `echo $jar| sed  "s|%{name}-||g"`; done)
(cd $RPM_BUILD_ROOT%{_javadir}/%{name} && for jar in *-%{version}*; do ln -sf ${jar} `echo $jar| sed  "s|-%{version}||g"`; done)

install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/%{name}
install -m 644 jxta_license.txt $RPM_BUILD_ROOT%{_datadir}/%{name}

install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/maven2/poms
install -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP.%{name}-%{name}-core.pom
%add_to_maven_depmap %{name} %{name}-core %{version} JPP/%{name} %{name}-core

# javadoc
install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
cp -pr www/docs/javadoc/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_javadocdir}/%{name} # ghost symlink
rm -rf www/docs/javadoc

# manual
install -d -m 755 $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
cp -pr www/docs/* $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}

%if %{gcj_support}
%{_bindir}/aot-compile-rpm
%endif

%files
%{_javadir}/*
%{_datadir}/%{name}
%{_datadir}/maven2/poms/*
%{_mavendepmapfragdir}/*
%if %{gcj_support}
%dir %{_libdir}/gcj/%{name}
%{_libdir}/gcj/%{name}/*-%{version}.jar.*
%{_libdir}/debug%{_libdir}/gcj/%{name}/*-%{version}.jar.*
%endif

%files javadoc
%doc %{_javadocdir}/%{name}-%{version}
%doc %{_javadocdir}/%{name}

%files manual
%{_docdir}/%{name}-%{version}

%changelog
* Sat Mar 06 2010 Igor Vlasenko <viy@altlinux.ru> 0:1.1.4-alt2_4jpp5
- new jpp release

* Sat Oct 18 2008 Igor Vlasenko <viy@altlinux.ru> 0:1.1.4-alt2_3jpp5
- fixed build with java 5

* Mon May 26 2008 Igor Vlasenko <viy@altlinux.ru> 0:1.1.4-alt1_3jpp1.7
- updated to new jpackage release

* Wed Nov 28 2007 Igor Vlasenko <viy@altlinux.ru> 0:1.1.4-alt1_2jpp1.7
- converted from JPackage by jppimport script