javacc/javacc.spec

161 lines
4.3 KiB
RPMSpec
Raw Permalink Normal View History

%define bootstrap 0
%define javahome %{_jvmdir}/jdk
Name: javacc
Version: 5.0
Release: 4mamba
Summary: JavaCC is a parser/scanner generator for java
Group: Development/Tools
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: https://javacc.dev.java.net/
Source0: https://javacc.dev.java.net/files/documents/17/142527/javacc-%{version}src.tar.gz
# files bin
# http://www.jpackage.org/cgi-bin/viewvc.cgi/rpms/free/javacc3/
Source1: javacc.sh
Source2: jjdoc
Source3: jjtree
Source5: javacc-%{version}.jar
Patch0: javacc-5.0-parser-build_xml.patch
License: BSD
BuildRequires: apache-ant
BuildRequires: java-junit3
BuildRequires: jpackage-utils
Requires: jpackage-utils
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description
Java Compiler Compiler (JavaCC) is the most popular parser generator for use with Java applications. A parser generator is a tool that reads a grammar specification and converts it to a Java program that can recognize matches to the grammar. In addition to the parser generator itself, JavaCC provides other standard capabilities related to parser generation such as tree building (via a tool called JJTree included with JavaCC), actions, debugging, etc.
%package demo
Group: Documentation
Summary: Examples for %{name}
%description demo
JavaCC is a parser/scanner generator for java.
This package contains examples for %{name}
%package manual
Group: Documentation
Summary: Manual for %{name}
%description manual
JavaCC is a parser/scanner generator for java.
This package contains manual for %{name}.
%prep
%setup -q -n %{name}
cp %{SOURCE1} bin/javacc
cp %{SOURCE2} bin/jjdoc
cp %{SOURCE3} bin/jjtree
for j in $(find . -name "*.jar"); do
mv $j ${j}.no
done
%patch0
%if %bootstrap
mv bootstrap/javacc.jar.no bootstrap/javacc.jar
%else
# ln -sf $(build-classpath javacc) bootstrap/javacc.jar
cp -p %{SOURCE5} bootstrap/javacc.jar
%endif
for j in $(find . -name "*.class"); do
rm -rf $j
done
ln -sf %{_javadir}/junit381.jar lib/junit3.8.1/junit.jar
%build
export JAVA_HOME=%javahome
# use %{SOURCE5} to generate some required source java files.
# after these source files are generated we remove the
# bootstrap jar and build the binary from source.
ant -f src/org/javacc/parser/build.xml parser-files
ant -f src/org/javacc/jjtree/build.xml tree-files
for j in $(find . -name "*.jar"); do
rm -rf $j
done
export CLASSPATH=$(build-classpath junit)
ant jar
%if %bootstrap
cp bin/lib/javacc.jar %{_sourcedir}/javacc-%{version}.jar
%endif
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
mkdir -p %{buildroot}%{_javadir}
install -pm 644 bin/lib/javacc.jar %{buildroot}%{_javadir}/javacc-%{version}.jar
ln -s javacc-%{version}.jar %{buildroot}%{_javadir}/javacc.jar
mkdir -p %{buildroot}%{_mavenpomdir}
sed -i "s|<version>4.2</version>|%{version}|" pom.xml
sed -i "s|<modelVersion>5.0.0</modelVersion>|<modelVersion>4.0.0</modelVersion>|" pom.xml
install -pm 644 pom.xml %{buildroot}%{_mavenpomdir}/JPP-javacc.pom
%add_to_maven_depmap net.java.dev.javacc javacc %{version} JPP javacc
mkdir -p %{buildroot}%{_bindir}
install -m 755 bin/{javacc,jjdoc,jjtree} %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_datadir}/javacc
cp -pr examples %{buildroot}%{_datadir}/javacc
#%{_bindir}/aot-compile-rpm
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%post
%update_maven_depmap
%postun
%update_maven_depmap
%files
%defattr(-,root,root)
%attr(0755,root,root) %{_bindir}/javacc
%attr(0755,root,root) %{_bindir}/jjdoc
%attr(0755,root,root) %{_bindir}/jjtree
%{_javadir}/javacc-%{version}.jar
%{_javadir}/javacc.jar
%{_mavenpomdir}/*
%{_mavendepmapfragdir}/*
%doc LICENSE README
%files demo
%defattr(-,root,root)
%{_datadir}/javacc
%files manual
%defattr(-,root,root)
%doc www/*
%changelog
* Fri Mar 25 2011 gil <puntogil@libero.it> 5.0-4mamba
- rebuilt with java-gcj-compat support
* Sun Nov 07 2010 gil <puntogil@libero.it> 5.0-3mamba
- rebuilt devel
* Sat Apr 17 2010 gil <puntogil@libero.it> 5.0-2mamba
- rebuilt with system javacc.jar
* Sat Apr 17 2010 gil <puntogil@libero.it> 5.0-1mamba
- update to 5.0
- added maven pom
- bootstrap
* Thu Feb 26 2009 gil <puntogil@libero.it> 4.2-1mamba
- package created by autospec