Name:                relaxngcc
Version:             1.12
Release:             1
Summary:             RELAX NG Compiler Compiler
License:             ASL 1.1
Url:                 http://relaxngcc.sourceforge.net/en/index.htm
Source0:             http://prdownloads.sourceforge.net/relaxngcc/relaxngcc-20031218.zip
Source1:             relaxngcc-build.xml
BuildRequires:       ant java-devel javacc jpackage-utils msv-msv msv-xsdlib relaxngDatatype
BuildRequires:       isorelax xerces-j2 xml-commons-apis dos2unix
Requires:            msv-msv msv-xsdlib relaxngDatatype isorelax xerces-j2 xml-commons-apis
BuildArch:           noarch
%description
RelaxNGCC is a tool for generating Java source code from a given RELAX NG
grammar. By embedding code fragments in the grammar like yacc or JavaCC, you can
take appropriate actions while parsing valid XML documents against the grammar.

%package help
Summary:             Javadoc for %{name}
%description help
This package contains javadoc for %{name}.

%prep
%setup -q -n relaxngcc-20031218
find . -name '*.class' -delete
find . -name '*.jar' -delete
rm src/relaxngcc/javabody/*.java
rm src/relaxngcc/maven/ChildAntProjectTag.java
find . -type f -exec dos2unix {} \;
sources='
src/relaxngcc/builder/SwitchBlockInfo.java
'
for source in ${sources}
do
  native2ascii -encoding UTF8 ${source} ${source}
done

%build
mkdir lib
build-jar-repository -p lib \
  msv-msv msv-xsdlib relaxngDatatype isorelax javacc
cp %{SOURCE1} build.xml
ant jar javadoc

%install
mkdir -p %{buildroot}%{_javadir}
install -pm 644 relaxngcc.jar %{buildroot}%{_javadir}/%{name}.jar
mkdir -p %{buildroot}%{_javadocdir}/%{name}
cp -pr javadoc/* %{buildroot}%{_javadocdir}/%{name}/.

%files
%{_javadir}/*
%doc src/HOWTO-readAutomata.txt LICENSE.txt readme.txt
%doc doc/*

%files help
%{_javadocdir}/*
%doc LICENSE.txt

%changelog
* Thu Jul 23 2020 Jeffery.Gao <gaojianxing@huawei.com> - 1.12-1
- Package init
