Пакет sun-fi: Specfile

Packager: Igor Vlasenko <viy@altlinux.ru>
BuildRequires: /proc
BuildRequires: jpackage-compat
# Copyright (c) 2000-2008, 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.
#

# FIXME: (dwalluck): requires jpp17 bootstrap maven-wagon, maven-doxia, naven2

%define gcj_support 0

%define with_repolib %{?_with_repolib:1}%{!?_with_repolib:0}
%define without_repolib %{!?_with_repolib:1}%{?_with_repolib:0}

%define _with_repolib 1
%define repodir %{_javadir}/repository.jboss.com/sun-fi/%{version}-brew
%define repodirlib %{repodir}/lib
%define repodirsrc %{repodir}/src


Name:           sun-fi
Version:        1.2.2
Release:	alt1_3jpp5
Epoch:          0
Summary:        Fast Infoset
License:        ASL 2.0
URL:            https://fi.dev.java.net/
# cvs -d :pserver:guest@cvs.dev.java.net:/cvs export -r jaxws211-fcs -d sun-fi-1.2.2 fi/FastInfoset
# mkdir sun-fi-1.2.2/FastInfosetUtilities
# cd sun-fi-1.2.2
# cvs -d :pserver:guest@cvs.dev.java.net:/cvs export -D 20061004 -d FastInfosetUtilities fi/FastInfosetUtilities
# cd ..
# tar czf sun-fi-1.2.2.tar.gz sun-fi-1.2.2
Source0:        sun-fi-1.2.2.tar.gz
Source1:        FastInfoset-1.2.2.pom
Source2:        FastInfosetUtilities-1.2.2.pom
Source3:        sun-fi-component-info.xml
Patch0:         sun-fi-1.2.2-build-without-nb.patch
Group:          Development/Java
Provides:       FastInfoset = %{epoch}:%{version}-%{release}
Provides:       FastInfosetUtilities = %{epoch}:%{version}-%{release}
Requires: stax_1_0_api
Requires: stax-ex
Requires: sun-xmlstreambuffer
Requires: sun-xsom
BuildRequires: jpackage-utils >= 0:1.7.4
BuildRequires: javatools-package-rename-task
BuildRequires: ant >= 0:1.6.5
BuildRequires: ant-junit
BuildRequires: junit
BuildRequires: relaxngDatatype
BuildRequires: stax_1_0_api
BuildRequires: stax-ex
BuildRequires: sun-xmlstreambuffer
BuildRequires: sun-xsom
%if %{gcj_support}
BuildRequires: java-gcj-compat-devel
%else
BuildArch:      noarch
%endif

%description
Fast Infoset Project, an Open Source implementation of the 
Fast Infoset Standard for Binary XML.
Fast Infoset specifies a standardized binary encoding for 
the XML Information Set. An XML infoset (such as a DOM tree, 
StAX events or SAX events in programmatic representations) 
may be serialized to an XML 1.x document or, as specified by 
the Fast Infoset standard, may be serialized to a fast 
infoset document. Fast infoset documents are generally 
smaller in size and faster to parse and serialize than 
equivalent XML documents.

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

%description javadoc
%{summary}.

%if %{with_repolib}
%package repolib
Summary:         Artifacts to be uploaded to a repository library
Group:           Development/Java

%description repolib
Artifacts to be uploaded to a repository library.
This package is not meant to be installed but so its contents
can be extracted through rpm2cpio.
%endif

%prep
%setup -q 
# remove all binary libs
find . -type f -name "*.jar" | xargs -t rm
%patch0 -p0

%build
export CLASSPATH=
export OPT_JAR_LIST="junit ant/ant-junit"

ln -s $(build-classpath junit) lib/junit.jar
ln -s $(build-classpath stax_1_0_api) lib/jsr173_api.jar
ln -s $(build-classpath javatools-package-rename-task) tools/lib/package-rename-task.jar

# Run to create java2 sources (need java5)
ant -f j2se-integration.xml
ant -f build-without-nb.xml dist test doc

export CLASSPATH=`pwd`/dist/FastInfoset.jar
pushd FastInfosetUtilities
ln -s $(build-classpath stax_1_0_api) lib/jsr173_api.jar
ln -s $(build-classpath relaxngDatatype) lib/relaxngDatatype.jar
ln -s $(build-classpath stax-ex) lib/stax-ex.jar
ln -s $(build-classpath sun-xmlstreambuffer) lib/streambuffer.jar
ln -s $(build-classpath sun-xsom/xsom) lib/xsom.jar

ant -f build-without-nb.xml dist doc
popd

%install

# jars
install -d -m 755 $RPM_BUILD_ROOT%{_javadir}
install -m 644 dist/FastInfoset.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-%{version}.jar
ln -s %{name}-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/FastInfoset-%{version}.jar

pushd FastInfosetUtilities
install -m 644 dist/FastInfosetUtilities.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-utilities-%{version}.jar
ln -s %{name}-utilities-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/FastInfosetUtilities-%{version}.jar
popd

(cd $RPM_BUILD_ROOT%{_javadir} && for jar in *-%{version}*.jar; do ln -sf ${jar} `echo $jar| sed "s|-%{version}||g"`; done)

# poms
%add_to_maven_depmap com.sun.xml.fastinfoset FastInfoset %{version} JPP %{name}
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/maven2/poms
install -pm 644 %{SOURCE1} \
    $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP.%{name}.pom

%add_to_maven_depmap com.sun.xml.fastinfoset FastInfosetUtilities %{version} JPP %{name}-utilities
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/maven2/poms
install -pm 644 %{SOURCE2} \
    $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP.%{name}-utilities.pom

# javadoc
install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
cp -pr dist/javadoc/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_javadocdir}/%{name}
ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_javadocdir}/FastInfoset-%{version}
ln -s FastInfoset-%{version} $RPM_BUILD_ROOT%{_javadocdir}/FastInfoset

install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name}-utilities-%{version}
pushd FastInfosetUtilities
cp -pr dist/javadoc/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-utilities-%{version}
popd
ln -s %{name}-utilities-%{version} $RPM_BUILD_ROOT%{_javadocdir}/%{name}-utilities
ln -s %{name}-utilities-%{version} $RPM_BUILD_ROOT%{_javadocdir}/FastInfosetUtilities-%{version}
ln -s FastInfosetUtilities-%{version} $RPM_BUILD_ROOT%{_javadocdir}/FastInfosetUtilities

%if %{with_repolib}
        install -d -m 755 $RPM_BUILD_ROOT%{repodir}
        install -d -m 755 $RPM_BUILD_ROOT%{repodirlib}
        install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT%{repodir}/component-info.xml
        tag=`echo %{name}-%{version}-%{release} | sed 's|\.|_|g'`
        sed -i "s/@TAG@/$tag/g" $RPM_BUILD_ROOT%{repodir}/component-info.xml
        sed -i "s/@VERSION@/%{version}-brew/g" $RPM_BUILD_ROOT%{repodir}/component-info.xml
        install -d -m 755 $RPM_BUILD_ROOT%{repodirsrc}
        install -p -m 644 %{PATCH0} $RPM_BUILD_ROOT%{repodirsrc}
        install -p -m 644 %{SOURCE0} $RPM_BUILD_ROOT%{repodirsrc}
        cp -p $RPM_BUILD_ROOT%{_javadir}/FastInfoset.jar $RPM_BUILD_ROOT%{repodirlib}/FastInfoset.jar
        cp -p $RPM_BUILD_ROOT%{_javadir}/FastInfosetUtilities.jar $RPM_BUILD_ROOT%{repodirlib}/FastInfosetUtilities.jar
%endif

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

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

%files javadoc
%{_javadocdir}/%{name}-%{version}
%{_javadocdir}/%{name}
%{_javadocdir}/%{name}-utilities-%{version}
%{_javadocdir}/%{name}-utilities
%{_javadocdir}/FastInfoset-%{version}
%{_javadocdir}/FastInfoset
%{_javadocdir}/FastInfosetUtilities-%{version}
%{_javadocdir}/FastInfosetUtilities

%if %{with_repolib}
%files repolib
%{_javadir}/repository.jboss.com
%endif

%changelog
* Mon Feb 22 2010 Igor Vlasenko <viy@altlinux.ru> 0:1.2.2-alt1_3jpp5
- use default jpp profile

* Sat Sep 06 2008 Igor Vlasenko <viy@altlinux.ru> 0:1.2.2-alt1_2jpp5
- converted from JPackage by jppimport script

* Sat Dec 22 2007 Igor Vlasenko <viy@altlinux.ru> 0:1.2.1-alt1_1jpp1.7
- converted from JPackage by jppimport script