File xml-commons-apis.spec of Package xml-commons-apis

#
# spec file for package xml-commons-apis
#
# Copyright (c) 2024 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


Name:           xml-commons-apis
Version:        1.4.01
Release:        0
Summary:        APIs for DOM, SAX, and JAXP
License:        Apache-2.0 AND W3C AND SUSE-Public-Domain
Group:          Development/Libraries/Java
URL:            https://xml.apache.org/commons/
# From source control because the published tarball doesn't include some docs:
#   svn export http://svn.apache.org/repos/asf/xerces/xml-commons/tags/xml-commons-external-1_4_01/java/external
#   tar cJf xml-commons-external-1.4.01-src.tar.xz external
Source0:        xml-commons-external-1.4.01-src.tar.xz
Source1:        %{name}-MANIFEST.MF
Source2:        %{name}-ext-MANIFEST.MF
Source3:        https://repo1.maven.org/maven2/xml-apis/xml-apis/2.0.2/xml-apis-2.0.2.pom
Source4:        https://repo1.maven.org/maven2/xml-apis/xml-apis-ext/1.3.04/xml-apis-ext-1.3.04.pom
BuildRequires:  ant
BuildRequires:  fdupes
BuildRequires:  java-devel >= 1.8
BuildRequires:  javapackages-local >= 6
BuildRequires:  xz
#!BuildIgnore:  xerces-j2
#!BuildIgnore:  xml-apis
#!BuildIgnore:  xml-resolver
Conflicts:      xml-commons-apis-bootstrap
Provides:       xerces-j2-xml-apis
Provides:       xml-apis = %{version}-%{release}
Provides:       xml-commons-jaxp-1.1-apis
Provides:       xml-commons-jaxp-1.2-apis
Provides:       xml-commons-jaxp-1.3-apis
Provides:       xml-commons-jaxp-1.4-apis
Obsoletes:      xerces-j2-xml-apis
Obsoletes:      xml-commons-jaxp-1.1-apis
Obsoletes:      xml-commons-jaxp-1.2-apis
Obsoletes:      xml-commons-jaxp-1.3-apis
Obsoletes:      xml-commons-jaxp-1.4-apis
BuildArch:      noarch

%description
xml-commons-apis is designed to organize and have common packaging for
the various externally-defined standard interfaces for XML. This
includes the DOM, SAX, and JAXP.

%package manual
Summary:        Manual for %{name}
Group:          Documentation/HTML

%description manual
%{summary}.

%package javadoc
Summary:        Javadoc for %{name}
Group:          Documentation/HTML

%description javadoc
%{summary}.

%prep
%setup -q -n external
# Make sure upstream hasn't sneaked in any jars we don't know about
find "(" -name "*.class" -o -name "*.jar" ")" -delete

# Fix file encodings
iconv -f iso8859-1 -t utf-8 LICENSE.dom-documentation.txt > \
  LICENSE.dom-doc.temp && mv -f LICENSE.dom-doc.temp LICENSE.dom-documentation.txt
iconv -f iso8859-1 -t utf-8 LICENSE.dom-software.txt > \
  LICENSE.dom-sof.temp && mv -f LICENSE.dom-sof.temp LICENSE.dom-software.txt

%build
ant -Dant.build.javac.source=8 -Dant.build.javac.target=8 jar javadoc

# inject OSGi manifests
jar \
%if %{?pkg_vcmp:%pkg_vcmp java-devel >= 17}%{!?pkg_vcmp:0}
    --date="$(date -u -d @${SOURCE_DATE_EPOCH:-$(date +%%s)} +%%Y-%%m-%%dT%%H:%%M:%%SZ)" \
%endif
    --update --file=build/xml-apis.jar --manifest=%{SOURCE1}
jar \
%if %{?pkg_vcmp:%pkg_vcmp java-devel >= 17}%{!?pkg_vcmp:0}
    --date="$(date -u -d @${SOURCE_DATE_EPOCH:-$(date +%%s)} +%%Y-%%m-%%dT%%H:%%M:%%SZ)" \
%endif
    --update --file=build/xml-apis-ext.jar --manifest=%{SOURCE2}

%install
# jar
install -d -m 0755 %{buildroot}%{_javadir}
install -pm 644 build/xml-apis.jar %{buildroot}%{_javadir}/xml-commons-apis.jar
pushd %{buildroot}%{_javadir}
  for i in \
    jaxp jaxp11 jaxp12 jaxp13 jaxp14 dom3 xerces-j2-xml-apis \
	xml-commons-jaxp-1.4-apis xml-commons-jaxp-1.3-apis \
	xml-commons-jaxp-1.2-apis xml-commons-jaxp-1.1-apis \
	xml-apis; do
    ln -s xml-commons-apis.jar ${i}.jar
  done
popd
install -pm 644 build/xml-apis-ext.jar %{buildroot}%{_javadir}/xml-commons-apis-ext.jar
pushd %{buildroot}%{_javadir}
  for i in xml-commons-jaxp-1.3-apis-ext xml-commons-jaxp-1.4-apis-ext; do
    ln -s xml-commons-apis-ext.jar ${i}.jar
  done
popd

# pom
install -d -m 0755 %{buildroot}%{_mavenpomdir}
%{mvn_install_pom} %{SOURCE3} %{buildroot}%{_mavenpomdir}/xml-commons-apis.pom
%add_maven_depmap xml-commons-apis.pom xml-commons-apis.jar
%{mvn_install_pom} %{SOURCE4} %{buildroot}%{_mavenpomdir}/xml-commons-apis-ext.pom
%add_maven_depmap xml-commons-apis-ext.pom xml-commons-apis-ext.jar -a xerces:dom3-xml-apis

# javadoc
install -d -m 0755 %{buildroot}%{_javadocdir}/%{name}
cp -a build/docs/javadoc/* %{buildroot}%{_javadocdir}/%{name}
%fdupes -s %{buildroot}%{_javadocdir}

# prevent apis javadoc from being included in doc
rm -rf build/docs/javadoc
%fdupes -s build/docs/

%files -f .mfiles
%license LICENSE LICENSE.dom-documentation.txt LICENSE.dom-software.txt LICENSE.sac.html LICENSE.sax.txt
%doc NOTICE README.dom.txt README-sax README.sax.txt
%{_javadir}/*

%files manual
%doc build/docs/*

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

%changelog
openSUSE Build Service is sponsored by