Name:           xml-commons-apis
Version:        1.4.01
Release:        30
Summary:        APIs for XML related code
License:        ASL 2.0 and W3C and Public Domain
URL:            http://xml.apache.org/commons/
BuildArch:      noarch
#Published tarball doesn't include some files
#svn export http://svn.apache.org/repos/asf/xerces/xml-commons/tags/xml-commons-external-1_4_01/java/external/
# tar czf xml-commons-external-1.4.01-src.tar.gz external
Source0:        xml-commons-external-1.4.01-src.tar.gz
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:  javapackages-local ant apache-parent
Provides:       xml-commons = %{version}-%{release} xml-commons-jaxp-1.3-apis = %{version}-%{release}
Provides:       %{name}-javadoc = %{version}-%{release}
Obsoletes:      %{name}-javadoc < %{version}-%{release}

%description
xml-commons-apis is designed to organize and have common packaging for the various externally-defined \
standards code relating to XML - things like the DOM, SAX, and JAXP interfaces.

%package        help
Summary:        Documents for %{name}
Buildarch:      noarch
Requires:       man info
Provides:       %{name}-manual = %{version}-%{release}
Obsoletes:      %{name}-manual < %{version}-%{release}

%description help
Man pages and other related documents for %{name}. 

%prep
%autosetup -n external
find -name '*.class' -exec rm -f '{}' \;
find -name '*.jar' -exec rm -f '{}' \;

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

cp %{SOURCE3} %{SOURCE4} .
sed -i '/distributionManagement/,/\/distributionManagement/ {d}' *.pom

%mvn_file :xml-apis xml-commons-apis jaxp13 jaxp xml-commons-jaxp-1.3-APIs
%mvn_file :xml-apis-ext xml-commons-apis-ext
%mvn_alias :xml-apis-ext xerces:dom3-xml-apis

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

jar ufm build/xml-apis.jar %{SOURCE1}
jar ufm build/xml-apis-ext.jar %{SOURCE2}

%mvn_artifact xml-apis-[0-9]*.pom build/xml-apis.jar
%mvn_artifact xml-apis-ext*.pom build/xml-apis-ext.jar

%install
%mvn_install -J build/docs/javadoc
sed -i 's/[0-9a-f]\{8\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{12\}/\
    f2f42549-cfab-4d71-be48-5e9f9a41e5f5/g' $(find %{_buildrootdir} -name xml-commons-apis.xml)
rm -rf build/docs/javadoc

%files -f .mfiles
%defattr(-,root,root)
%doc NOTICE README.dom.txt README.sax.txt
%license LICENSE LICENSE.sac.html LICENSE.sax.txt LICENSE.dom-documentation.txt 
%license LICENSE.dom-software.txt
%{_javadir}/*
%{_javadocdir}/*

%files help
%defattr(-,root,root)
%doc README-sax build/docs/*

%changelog
* Wed Feb 25 2026 wangkai <13474090681@163.com> - 1.4.01-30
- Adapting to ant upgrade

* Tue Mar 3 2020 zhouyihang <zhouyihang1@huawei.com> - 1.4.01-29
- Package init