File apache-ivy.spec of Package apache-ivy

#
# spec file for package apache-ivy
#
# 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/
#


Name:           apache-ivy
Version:        2.3.0
Release:        1%{?dist}
Summary:        Java-based dependency manager
License:        Apache-2.0
Group:          Development/Tools/Building

Url:            http://ant.apache.org/ivy/
Source0:        %{name}-%{version}-src.tar.gz
Source1:        ivy.1
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

Provides:       ivy = %{version}-%{release}

BuildRequires:  ant
BuildRequires:  ant-nodeps
%if 0%{?suse_version}
BuildRequires:  jakarta-commons-httpclient3
%else
BuildRequires:  commons-httpclient
%endif
BuildRequires:  bouncycastle
BuildRequires:  java-devel >= 1.5
BuildRequires:  javapackages-tools
BuildRequires:  jsch
BuildRequires:  oro
Requires:       javapackages-tools

%description
Apache Ivy is a tool for managing (recording, tracking, resolving and
reporting) project dependencies.  It is designed as process agnostic and is
not tied to any methodology or structure. while available as a standalone
tool, Apache Ivy works particularly well with Apache Ant providing a number
of powerful Ant tasks ranging from dependency resolution to dependency
reporting and publication.


%package javadoc
Summary:        API Documentation for ivy
Group:          Development/Tools/Building
Requires:       %{name} = %{version}-%{release}

%description javadoc
JavaDoc documentation for %{name}


%prep
%setup -q

# Fix messed-up encodings
for F in RELEASE_NOTES README LICENSE NOTICE CHANGES.txt
do
        sed 's/\r//' $F |iconv -f iso8859-1 -t utf8 >$F.utf8
        touch -r $F $F.utf8
        mv $F.utf8 $F
done

#TODO: return back when bouncycastle-pgp will be available
rm -fr src/java/org/apache/ivy/plugins/signer/bouncycastle

%build
# Remove prebuilt documentation
rm -rf doc build/doc

# How to properly disable a plugin?
# we disable vfs plugin since commons-vfs is not available
rm -rf src/java/org/apache/ivy/plugins/repository/vfs \
        src/java/org/apache/ivy/plugins/resolver/VfsResolver.java
sed '/vfs.*=.*org.apache.ivy.plugins.resolver.VfsResolver/d' -i \
        src/java/org/apache/ivy/core/settings/typedef.properties

# Craft class path
mkdir -p lib
build-jar-repository lib ant ant/ant-nodeps oro jsch \
%if 0%{?suse_version}
jakarta-commons-httpclient3
%else
commons-httpclient
%endif

# Build
ant -Dtarget.ivy.version=%{version} /localivy /offline jar javadoc

%install
# Code
install -d $RPM_BUILD_ROOT%{_javadir}
install -p -m644 build/artifact/jars/ivy.jar $RPM_BUILD_ROOT%{_javadir}/ivy-%{version}.jar
ln -sf ivy-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/ivy.jar

# API Documentation
install -d $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
cp -rp build/doc/reports/api/. $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}

# Command line script
MAIN_CLASS=`sed -rn 's/^Main-Class: (.*)$/\1/gp' META-INF/MANIFEST.MF | tr -d '\r'`
%if 0%{?suse_version}
%jpackage_script "${MAIN_CLASS}" "" "" ant:ant/ant-nodeps:ivy:oro:jsch:jakarta-commons-httpclient3 ivy
%else
%jpackage_script "${MAIN_CLASS}" "" "" ant:ant/ant-nodeps:ivy:oro:jsch:commons-httpclient ivy
%endif

# Man page
install -d ${RPM_BUILD_ROOT}%{_mandir}/man1
install %{SOURCE1} ${RPM_BUILD_ROOT}%{_mandir}/man1/ivy.1

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%{_javadir}/*
%doc RELEASE_NOTES CHANGES.txt LICENSE NOTICE README
%attr(755,root,root) %{_bindir}/*
%attr(644,root,root) %{_mandir}/man1/*

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

%changelog
openSUSE Build Service is sponsored by