File jakarta-commons-net.spec of Package jakarta-commons-net

#
# spec file for package jakarta-commons-net
#
# Copyright (c) 2013 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/
#


%define _without_maven 1
%define with_maven %{!?_without_maven:1}%{?_without_maven:0}
%define without_maven %{?_without_maven:1}%{!?_without_maven:0}
%define without_tests 1
%define base_name       net
%define short_name      commons-%{base_name}
%define section         free

Name:           jakarta-commons-net
Version:        1.4.1
Release:        0
Summary:        Jakarta Commons Net Package
License:        Apache-2.0
Group:          Development/Libraries/Java
Url:            http://commons.apache.org/commons-net/
Source0:        http://www.apache.org/dist/jakarta/commons/net/source/commons-net-1.4.1-src.tar.bz2
Source1:        pom-maven2jpp-depcat.xsl
Source2:        pom-maven2jpp-newdepmap.xsl
Source3:        pom-maven2jpp-mapdeps.xsl
Source4:        commons-net-1.4.1-jpp-depmap.xml
Source5:        commons-build.tar.gz
Source6:        commons-net-1.4.1.pom
Patch0:         %{name}-crosslink.patch
Patch1:         %{short_name}-%{version}-project_xml.patch
Patch2:         %{short_name}-%{version}-project_properties.patch
#PATCH-FIX-UPSTREAM: bnc#749895
#http://svn-master.apache.org/viewvc?view=revision&revision=1294922
Patch3:         commons-net-ftp-leap-year-parsing.patch
BuildRequires:  ant >= 1.6
BuildRequires:  javapackages-tools
%if ! %{without_tests}
BuildRequires:  ant-junit >= 1.6
BuildRequires:  junit >= 3.8.1
%endif
BuildRequires:  java-devel
BuildRequires:  java-javadoc >= 1.6.0
BuildRequires:  oro
%if %{with_maven}
BuildRequires:  maven >= 1.1
BuildRequires:  maven-plugin-changes
BuildRequires:  maven-plugin-checkstyle
BuildRequires:  maven-plugin-jcoverage
BuildRequires:  maven-plugin-jdepend
BuildRequires:  maven-plugin-jxr
BuildRequires:  maven-plugin-license
BuildRequires:  maven-plugin-tasklist
BuildRequires:  maven-plugin-test
BuildRequires:  maven-plugin-xdoc
BuildRequires:  maven-plugins-base
BuildRequires:  saxon9
BuildRequires:  saxon9-scripts
%endif
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       oro >= 2.0.8
Provides:       %{short_name} = %{version}-%{release}
Obsoletes:      %{short_name} < %{version}-%{release}
Requires(post):    javapackages-tools
Requires(postun):  javapackages-tools

%description
This is an Internet protocol suite Java library originally developed by
ORO, Inc.  This version supports Finger, Whois, TFTP, Telnet, POP3,
FTP, NNTP, SMTP, and some miscellaneous protocols like Time and Echo as
well as BSD R command support. The purpose of the library is to provide
fundamental protocol access, not higher-level abstractions.



%package javadoc
Summary:        Jakarta Commons Net Package
Group:          Development/Libraries/Java
Requires(post):   /bin/rm,/bin/ln
Requires(postun): /bin/rm

%description javadoc
This is an Internet protocol suite Java library originally developed by
ORO, Inc.  This version supports Finger, Whois, TFTP, Telnet, POP3,
FTP, NNTP, SMTP, and some miscellaneous protocols like Time and Echo as
well as BSD R command support. The purpose of the library is to provide
fundamental protocol access, not higher-level abstractions.



%if %{with_maven}

%package manual
Summary:        Jakarta Commons Net Package
Group:          Development/Libraries/Java

%description manual
This is an Internet protocol suite Java library originally developed by
ORO, Inc.  This version supports Finger, Whois, TFTP, Telnet, POP3,
FTP, NNTP, SMTP, and some miscellaneous protocols like Time and Echo as
well as BSD R command support. The purpose of the library is to provide
fundamental protocol access, not higher-level abstractions.



%endif

%prep
%setup -q -n %{short_name}-%{version}
gzip -dc %{SOURCE5} | tar xf -
%patch0 -b .sav
%patch1 -b .sav
%patch2 -b .sav
%patch3 -p0
# remove all binary libs
find . -name "*.jar" -exec rm -f {} \;

%build
%if %{with_maven}
export DEPCAT=$(pwd)/commons-net-1.4.1-depcat.new.xml
echo '<?xml version="1.0" standalone="yes"?>' > $DEPCAT
echo '<depset>' >> $DEPCAT
for p in $(find . -name project.xml); do
    pushd $(dirname $p)
    /usr/bin/saxon9 project.xml %{SOURCE1} >> $DEPCAT
    popd
done
echo >> $DEPCAT
echo '</depset>' >> $DEPCAT
/usr/bin/saxon9 $DEPCAT %{SOURCE2} > commons-net-1.4.1-depmap.new.xml
for p in $(find . -name project.xml); do
    pushd $(dirname $p)
    cp project.xml project.xml.orig
    /usr/bin/saxon9 -o project.xml project.xml.orig %{SOURCE3} map=%{SOURCE4}
    popd
done
export MAVEN_HOME_LOCAL=$(pwd)/.maven
#        -Dmaven.test.failure.ignore=true \
maven -e \
        -Dmaven.repo.remote=file:/usr/share/maven/repository \
        -Dmaven.home.local=${MAVEN_HOME_LOCAL} \
        jar:jar javadoc:generate site
%else
mkdir -p target/lib
ln -s %{_javadir}/oro.jar target/lib
ln -s %{_javadir}/junit.jar target/lib
%if %{without_tests}
ant -Dnoget=true -Dfinal.name=commons-net-%{version} -Dj2se.api=%{_javadocdir}/java jar javadoc
%else
export OPT_JAR_LIST="ant/ant-junit junit"
ant -Dnoget=true -Dfinal.name=commons-net-%{version} -Dj2se.api=%{_javadocdir}/java jar test javadoc
%endif
%endif

%install
# jars
install -d -m 755 %{buildroot}%{_javadir}
install -m 644 target/%{short_name}-%{version}.jar %{buildroot}%{_javadir}/%{name}.jar
(cd %{buildroot}%{_javadir} && for jar in jakarta-*; do ln -sf ${jar} `echo $jar| sed  "s|jakarta-||g"`; done)

# pom
install -d -m 755 %{buildroot}%{_mavenpomdir}
install -pm 644 %{SOURCE6} \
    %{buildroot}%{_mavenpomdir}/JPP-%{name}.pom
%add_maven_depmap

# javadoc
install -d -m 755 %{buildroot}%{_javadocdir}/%{name}
%if %{with_maven}
cp -pr target/docs/apidocs/* %{buildroot}%{_javadocdir}/%{name}-%{version}
%else
cp -pr dist/docs/api/* %{buildroot}%{_javadocdir}/%{name}
%endif
#rm -rf target/docs/apidocs
# manual
%if %{with_maven}
install -d -m 755 %{buildroot}%{_docdir}/%{name}-%{version}
install -d -m 755 %{buildroot}%{_docdir}/%{name}-%{version}/site
cp -pr target/docs/* %{buildroot}%{_docdir}/%{name}-%{version}/site
%endif

%files
%defattr(0644,root,root,0755)
%doc LICENSE.txt
%{_javadir}/*
%{_mavenpomdir}/*
%config %{_mavendepmapfragdir}

%files javadoc
%defattr(0644,root,root,0755)
%{_javadocdir}/%{name}

%if %{with_maven}
%files manual
%defattr(0644,root,root,0755)
%doc %{_docdir}/%{name}-%{version}/site
%endif

%changelog
openSUSE Build Service is sponsored by