Package hc-httpcore: Specfile

BuildRequires: /proc
BuildRequires: jpackage-compat
# Copyright (c) 2000-2010, 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 namedversion %{version}
%define sname httpcore

Name:           hc-httpcore
Version:        4.1
Release:        alt1_1jpp6
Epoch:          0
Summary:        HTTPCore components
License:        ASL 2.0
Url:            http://hc.apache.org/
Group:          Development/Java
# svn export http://svn.apache.org/repos/asf/httpcomponents/httpcore/tags/4.1/ hc-httpcore-4.1 && tar cjf hc-httpcore-4.1.tar.bz2 hc-httpcore-4.1
# Exported revision 1041694.
Source0:        %{name}-%{namedversion}.tar.bz2
Source1:        %{name}-settings.xml
Source2:        %{name}-jpp-depmap.xml
Patch0:         hc-httpcore-no-clover.patch
Provides:       jakarta-httpcore = %{epoch}:%{version}-%{release}
Obsoletes:      jakarta-httpcore < %{epoch}:%{version}-%{release}
Requires(post): jpackage-utils >= 0:1.7.3
Requires(postun): jpackage-utils >= 0:1.7.3
Requires: jpackage-utils
BuildRequires: apache-commons-parent
BuildRequires: apache-jar-resource-bundle >= 0:1.3
BuildRequires: jpackage-utils >= 0:1.7.3
BuildRequires: ant >= 0:1.6.5
BuildRequires: docbkx
#BuildRequires:  docbook-xml >= 0:4.4
BuildRequires: felix-maven2
BuildRequires: hc-project >= 0:4.1.1
BuildRequires: junit >= 0:3.8.2
BuildRequires: junit4
BuildRequires: maven2 >= 2.0.7
BuildRequires: maven2-plugin-antrun
BuildRequires: maven2-plugin-assembly
BuildRequires: maven2-plugin-compiler
BuildRequires: maven2-plugin-install
BuildRequires: maven2-plugin-jar
BuildRequires: maven2-plugin-javadoc
BuildRequires: maven2-plugin-remote-resources
BuildRequires: maven2-plugin-release
BuildRequires: maven2-plugin-resources
BuildRequires: maven2-plugin-site
BuildRequires: maven2-plugin-source
BuildRequires: maven-release
BuildRequires: maven-surefire-maven-plugin
BuildRequires: maven-surefire-provider-junit4
BuildArch:      noarch
Source44: import.info

%description
HttpCore components implement the most fundamental aspects 
of the HTTP protocol that are nonetheless sufficient to 
develop full-featured client-side and server-side HTTP 
services with a minimal footprint.

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

%description javadoc
%{summary}.

%prep
%setup -q -n %{name}-%{namedversion}
%patch0 -p0 -b .sav0
cp -p %{SOURCE1} settings.xml

sed -i -e "s|<url>__JPP_URL_PLACEHOLDER__</url>|<url>file://`pwd`/.m2/repository</url>|g" settings.xml
sed -i -e "s|<url>__JAVADIR_PLACEHOLDER__</url>|<url>file://`pwd`/external_repo</url>|g" settings.xml
sed -i -e "s|<url>__MAVENREPO_DIR_PLACEHOLDER__</url>|<url>file://`pwd`/.m2/repository</url>|g" settings.xml
sed -i -e "s|<url>__MAVENDIR_PLUGIN_PLACEHOLDER__</url>|<url>file:///usr/share/maven2/plugins</url>|g" settings.xml
sed -i -e "s|<url>__ECLIPSEDIR_PLUGIN_PLACEHOLDER__</url>|<url>file:///usr/share/eclipse/plugins</url>|g" settings.xml

mkdir external_repo
ln -s %{_javadir} external_repo/JPP

%build
%{_bindir}/mvn-jpp \
        -e \
        -s $(pwd)/settings.xml \
        -Dmaven.test.failure.ignore=true \
        -Dmaven2.jpp.depmap.file=%{SOURCE2} \
        -Dmaven.repo.local=$MAVEN_REPO_LOCAL \
        -Daggregate=true \
        install javadoc:javadoc

%install

# jars
mkdir -p %{buildroot}%{_javadir}/httpcomponents
cp -p httpcore/target/%{sname}-%{namedversion}.jar %{buildroot}%{_javadir}/httpcomponents/%{sname}-%{version}.jar
cp -p httpcore/target/%{sname}-%{namedversion}-sources.jar %{buildroot}%{_javadir}/httpcomponents/%{sname}-sources-%{version}.jar
cp -p httpcore-nio/target/%{sname}-nio-%{namedversion}.jar %{buildroot}%{_javadir}/httpcomponents/%{sname}-nio-%{version}.jar
cp -p httpcore-nio/target/%{sname}-nio-%{namedversion}-sources.jar %{buildroot}%{_javadir}/httpcomponents/%{sname}-nio-sources-%{version}.jar
(cd %{buildroot}%{_javadir} && ln -s httpcomponents/httpcore-%{version}.jar jakarta-httpcore-%{version}.jar && ln -s httpcomponents/httpcore-nio-%{version}.jar jakarta-httpcore-nio-%{version}.jar)
(cd %{buildroot}%{_javadir}/httpcomponents && ln -s httpcore-nio-%{version}.jar httpcore-niossl-%{version}.jar)
(cd %{buildroot}%{_javadir} && for jar in *-%{version}.jar; do ln -s ${jar} `echo $jar | sed  "s|-%{version}||g"`; done)
(cd %{buildroot}%{_javadir}/httpcomponents && for jar in *-%{version}.jar; do ln -s ${jar} `echo $jar | sed  "s|-%{version}||g"`; done)

# poms
mkdir -p %{buildroot}%{_datadir}/maven2/poms
cp -p pom.xml %{buildroot}%{_datadir}/maven2/poms/JPP.httpcomponents-core.pom
%add_to_maven_depmap org.apache.httpcomponents httpcomponents-core %{namedversion} JPP/httpcomponents core
cp -p httpcore/pom.xml %{buildroot}%{_datadir}/maven2/poms/JPP.httpcomponents-httpcore.pom
%add_to_maven_depmap org.apache.httpcomponents httpcore %{namedversion} JPP/httpcomponents httpcore
cp -p httpcore-nio/pom.xml %{buildroot}%{_datadir}/maven2/poms/JPP.httpcomponents-httpcore-nio.pom
%add_to_maven_depmap org.apache.httpcomponents httpcore-nio %{namedversion} JPP/httpcomponents httpcore-nio
cp -p httpcore-nio/pom.xml %{buildroot}%{_datadir}/maven2/poms/JPP.httpcomponents-httpcore-niossl.pom
%add_to_maven_depmap org.apache.httpcomponents httpcore-niossl %{namedversion} JPP/httpcomponents httpcore-nio

# javadoc
mkdir -p %{buildroot}%{_javadocdir}/%{name}-%{version}
cp -pr target/site/apidocs/* %{buildroot}%{_javadocdir}/%{name}-%{version}
ln -s %{name}-%{version} %{buildroot}%{_javadocdir}/%{name}

%files
%{_javadir}*/jakarta-httpcore-%{version}.jar
%{_javadir}*/jakarta-httpcore.jar
%{_javadir}*/jakarta-httpcore-nio-%{version}.jar
%{_javadir}*/jakarta-httpcore-nio.jar
%dir %{_javadir}*/httpcomponents
%{_javadir}*/httpcomponents/%{sname}-%{version}.jar
%{_javadir}*/httpcomponents/%{sname}.jar
%{_javadir}*/httpcomponents/%{sname}-nio-%{version}.jar
%{_javadir}*/httpcomponents/%{sname}-nio.jar
%{_javadir}*/httpcomponents/%{sname}-sources-%{version}.jar
%{_javadir}*/httpcomponents/%{sname}-sources.jar
%{_javadir}*/httpcomponents/%{sname}-nio-sources-%{version}.jar
%{_javadir}*/httpcomponents/%{sname}-nio-sources.jar
%{_javadir}*/httpcomponents/httpcore-nio-%{version}.jar
%{_javadir}*/httpcomponents/httpcore-nio.jar
%{_javadir}*/httpcomponents/httpcore-niossl-%{version}.jar
%{_javadir}*/httpcomponents/httpcore-niossl.jar
%{_datadir}/maven2/poms/JPP.httpcomponents-core.pom
%{_datadir}/maven2/poms/JPP.httpcomponents-httpcore.pom
%{_datadir}/maven2/poms/JPP.httpcomponents-httpcore-nio.pom
%{_datadir}/maven2/poms/JPP.httpcomponents-httpcore-niossl.pom
%{_mavendepmapfragdir}/%{name}

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

%changelog
* Fri Feb 25 2011 Igor Vlasenko <viy@altlinux.ru> 0:4.1-alt1_1jpp6
- new version

* Fri Oct 29 2010 Igor Vlasenko <viy@altlinux.ru> 0:4.0-alt2_1jpp5
- fixed build

* Mon Mar 30 2009 Igor Vlasenko <viy@altlinux.ru> 0:4.0-alt1_1jpp5
- new jpp release

* Tue Mar 03 2009 Igor Vlasenko <viy@altlinux.ru> 0:4.0-alt1_0.a5.1jpp5
- first build