File xerces-j2.spec of Package xerces-j2

#
# spec file for package xerces-j2
#
# Copyright (c) 2017 SUSE LINUX 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 cvs_version	2_11_0
Name:           xerces-j2
Version:        2.11.0
Release:        0
Summary:        Java XML parser
License:        Apache-2.0
Group:          Development/Libraries/Java
Url:            http://xml.apache.org/xerces2-j/
Source0:        http://www.eu.apache.org/dist/xerces/j/source/Xerces-J-src.%{version}.tar.gz
Source1:        http://www.eu.apache.org/dist/xerces/j/source/Xerces-J-tools.%{version}.tar.gz
Source2:        %{name}-version.sh
Source3:        %{name}-version.1
Source4:        %{name}-constants.sh
Source5:        %{name}-constants.1
# PATCH-FIX-UPSTREAM bnc#814241 XERCESJ-1616
Patch0:         arrays-doubling.patch
Patch1:         scan-pseudo-attribute.patch
Patch2:         xerces-2_11_0-jdk7.patch
BuildRequires:  dos2unix
BuildRequires:  java-devel >= 1.6
BuildRequires:  javapackages-tools
BuildRequires:  unzip
Requires(post): update-alternatives
Requires(pre):  update-alternatives
Provides:       jaxp_parser_impl
BuildArch:      noarch

%description
Welcome to the future! Xerces2 is the next generation of high
performance, fully compliant XML parsers in the Apache Xerces family.
This new version of Xerces introduces the Xerces Native Interface
(XNI), a complete framework for building parser components and
configurations that is extremely modular and easy to program.

The Apache Xerces2 parser is the reference implementation of XNI but
other parser components, configurations, and parsers can be written
using the Xerces Native Interface. For complete design and
implementation documents, refer to the XNI Manual.

Xerces 2 is a fully conforming XML Schema processor. For more
information, refer to the XML Schema page.

Xerces 2 also provides a partial implementation of Document Object
Model Level 3 Core, Load and Save and Abstract Schemas [deprecated]
Working Drafts. For more information, refer to the DOM Level 3
Implementation page.

%package        demo
Summary:        Demonstration and sample files for xerces-j2
Group:          Development/Libraries/Java
Requires:       %{name} = %{version}

%description    demo
Welcome to the future! Xerces2 is the next generation of high
performance, fully compliant XML parsers in the Apache Xerces family.
This new version of Xerces introduces the Xerces Native Interface
(XNI), a complete framework for building parser components and
configurations that is extremely modular and easy to program.

The Apache Xerces2 parser is the reference implementation of XNI but
other parser components, configurations, and parsers can be written
using the Xerces Native Interface. For complete design and
implementation documents, refer to the XNI Manual.

Xerces 2 is a fully conforming XML Schema processor. For more
information, refer to the XML Schema page.

Xerces 2 also provides a partial implementation of Document Object
Model Level 3 Core, Load and Save and Abstract Schemas [deprecated]
Working Drafts. For more information, refer to the DOM Level 3
Implementation page.

This package contains demonstration and sample files for Xerces2.

%package        scripts
Summary:        Additional utility scripts for xerces-j2
Group:          Development/Libraries/Java
Requires:       %{name} = %{version}

%description    scripts
Welcome to the future! Xerces2 is the next generation of high
performance, fully compliant XML parsers in the Apache Xerces family.
This new version of Xerces introduces the Xerces Native Interface
(XNI), a complete framework for building parser components and
configurations that is extremely modular and easy to program.

The Apache Xerces2 parser is the reference implementation of XNI but
other parser components, configurations, and parsers can be written
using the Xerces Native Interface. For complete design and
implementation documents, refer to the XNI Manual.

Xerces 2 is a fully conforming XML Schema processor. For more
information, refer to the XML Schema page.

Xerces 2 also provides a partial implementation of Document Object
Model Level 3 Core, Load and Save and Abstract Schemas [deprecated]
Working Drafts. For more information, refer to the DOM Level 3
Implementation page.

This package contains additional utility scripts for Xerces2.

%package        xml-resolver
Summary:        Resolver subproject of xml-commons
Group:          Development/Libraries/Java
Requires(post): update-alternatives
Requires(pre):  update-alternatives
Provides:       xml-commons-resolver

%description    xml-resolver
xml-commons is focused on common code and guidelines for xml projects.
The first focus will be to organize and have common packaging for the
various externally-defined standards code relating to XML - things like
the DOM, SAX, and JAXP interfaces.

This package contains the resolver subproject of xml-commons.

%package        xml-apis
Summary:        APIs subproject of xml-commons
Group:          Development/Libraries/Java
Requires(post): update-alternatives
Requires(pre):  update-alternatives
Provides:       xml-commons-apis

%description    xml-apis
xml-commons is focused on common code and guidelines for xml projects.
Its first focus will be to organize and have common packaging for the
various externally-defined standards code relating to XML - things like
the DOM, SAX, and JAXP interfaces. As the xml-commons community forms,
we also hope to serve as a holding area for other common xml-related
utilities and code, and to help promulgate common packaging, testing,
documentation, and other guidelines across all xml.apache.org
subprojects.

This package contains the APIs subproject of xml-commons.

%prep
%setup -q -n xerces-%{cvs_version}
%setup -q -T -a 1 -D -n xerces-%{cvs_version}
%setup -q -T -D -n xerces-%{cvs_version}

find -type f -print |xargs -i dos2unix {}
%patch0 -p1
%patch1 -p1
%patch2 -p1

echo 'javac.target=1.6' > build.properties
echo 'javac.source=1.6' >> build.properties

sed -i 's/\r//' LICENSE README NOTICE build.sh

%build
## this uses the ant.jar provided by the xerces packages. Tough luck,
# jpackage bootstrap has to start somewhere. It is not installed,
# though.
export GC_MAXIMUM_HEAP_SIZE="134217728"
export CLASSPATH=$CLASSPATH:$(build-classpath antlr-bootstrap)
sh build.sh jars
#ant tests test

%install
# jars
mkdir -p %{buildroot}%{_javadir}
cp -p build/xercesImpl.jar %{buildroot}%{_javadir}/%{name}-%{version}.jar
cp -p build/resolver.jar   %{buildroot}%{_javadir}/%{name}-%{version}-xml-resolver.jar
cp -p build/xml-apis.jar   %{buildroot}%{_javadir}/%{name}-%{version}-xml-apis.jar
(cd %{buildroot}%{_javadir} && for jar in *-%{version}*.jar; do ln -sf ${jar} `echo $jar| sed "s|-%{version}||g"`; done)
# scripts
mkdir -p %{buildroot}%{_bindir}
install -p -m 755 %{SOURCE2} %{buildroot}%{_bindir}/%{name}-version
install -p -m 755 %{SOURCE4} %{buildroot}%{_bindir}/%{name}-constants
# mans
install -d -m 755 %{buildroot}%{_mandir}/man1
install -p -m 644 %{SOURCE3} %{buildroot}%{_mandir}/man1
install -p -m 644 %{SOURCE5} %{buildroot}%{_mandir}/man1
# demo
mkdir -p %{buildroot}%{_datadir}/%{name}
cp -p build/xercesSamples.jar \
  %{buildroot}%{_datadir}/%{name}/%{name}-samples.jar
cp -pr data %{buildroot}%{_datadir}/%{name}

# alternatives
mkdir -p %{buildroot}%{_sysconfdir}/alternatives/
ln -sf %{_sysconfdir}/alternatives/jaxp_parser_impl.jar %{buildroot}%{_javadir}/jaxp_parser_impl.jar
ln -sf %{_sysconfdir}/alternatives/xml-commons-apis.jar %{buildroot}%{_javadir}/xml-commons-apis.jar
ln -sf %{_sysconfdir}/alternatives/xml-commons-resolver.jar %{buildroot}%{_javadir}/xml-commons-resolver.jar

%post
%{_sbindir}/update-alternatives --install %{_javadir}/jaxp_parser_impl.jar jaxp_parser_impl  %{_javadir}/%{name}.jar 23
%{_sbindir}/update-alternatives --auto jaxp_parser_impl

%post xml-apis
%{_sbindir}/update-alternatives --install %{_javadir}/xml-commons-apis.jar         xml-commons-apis          %{_javadir}/%{name}-xml-apis.jar 1
%{_sbindir}/update-alternatives --auto xml-commons-apis

%post xml-resolver
%{_sbindir}/update-alternatives --install %{_javadir}/xml-commons-resolver.jar     xml-commons-resolver      %{_javadir}/%{name}-xml-resolver.jar 1
%{_sbindir}/update-alternatives --auto xml-commons-resolver

%preun
if [ $1 = 0 ] ; then
  %{_sbindir}/update-alternatives --remove jaxp_parser_impl        %{_javadir}/%{name}.jar
fi

%preun xml-apis
if [ $1 = 0 ] ; then
  %{_sbindir}/update-alternatives --remove xml-commons-apis        %{_javadir}/%{name}-xml-apis.jar
fi

%preun xml-resolver
if [ $1 = 0 ] ; then
  %{_sbindir}/update-alternatives --remove xml-commons-resolver    %{_javadir}/%{name}-xml-commons-resolver.jar
fi

%files
%doc LICENSE README
%{_javadir}/%{name}-%{version}.jar
%{_javadir}/%{name}.jar
%{_javadir}/jaxp_parser_impl.jar
%ghost %{_sysconfdir}/alternatives/jaxp_parser_impl.jar

%files xml-apis
%{_javadir}/%{name}-%{version}-xml-apis.jar
%{_javadir}/%{name}-xml-apis.jar
%{_javadir}/xml-commons-apis.jar
%ghost %{_sysconfdir}/alternatives/xml-commons-apis.jar

%files xml-resolver
%{_javadir}/%{name}-%{version}-xml-resolver.jar
%{_javadir}/%{name}-xml-resolver.jar
%{_javadir}/xml-commons-resolver.jar
%ghost %{_sysconfdir}/alternatives/xml-commons-resolver.jar

%files demo
%{_datadir}/%{name}

%files scripts
%{_bindir}/*
%{_mandir}/man1/*

%changelog
openSUSE Build Service is sponsored by