Name:                saxpath
Version:             1.0
Release:             1
Summary:             Simple API for XPath
License:             Saxpath
URL:                 http://sourceforge.net/projects/saxpath/
Source0:             http://downloads.sourceforge.net/saxpath/saxpath-1.0.tar.gz
#https://repo1.maven.org/maven2/saxpath/saxpath/1.0-FCS/saxpath-1.0-FCS.pom
Source1:             %{name}-%{version}.pom
#https://spdx.org/licenses/Saxpath.html
Source2:             LICENSE
BuildArch:           noarch

BuildRequires:       ant ant-junit javapackages-local
Requires:            jpackage-utils

%description
The SAXPath project is a Simple API for XPath. SAXPath is analogous to SAX
in that the API abstracts away the details of parsing and provides a simple
event based callback interface.

%package javadoc
Summary:             API documentation for %{name}

%description javadoc
This package contains %{summary}.

%prep
%setup -q -n %{name}-%{version}-FCS

find -name \*.jar -delete

cp %{SOURCE2} .

%build
mkdir src/conf
touch src/conf/MANIFEST.MF

ant

# fix rpmlint warings: saxpath-javadoc.noarch: W: wrong-file-end-of-line-encoding /usr/share/javadoc/saxpath/**/*.css
for file in `find build/doc -type f | grep .css`; do
    sed -i 's/\r//g' $file
done

%install
install -d -m 755 %{buildroot}/%{_javadir}
install -d -m 755 %{buildroot}/%{_mavenpomdir}
install -d -m 755 %{buildroot}/%{_javadocdir}/%{name}

install -p -m 644 build/%{name}.jar %{buildroot}/%{_javadir}/
install -p -m 644 %{SOURCE1} %{buildroot}/%{_mavenpomdir}/JPP-%{name}.pom
%add_maven_depmap
cp -a build/doc/* %{buildroot}/%{_javadocdir}/%{name}/

%check
ant test

%files -f .mfiles
%doc LICENSE

%files javadoc
%doc LICENSE
%{_javadocdir}/*


%changelog
* Sat Aug 15 2020 wangxiao <wangxiao65@huawei.com> - 1.0-1
- package init
