diff --git a/README.md b/README.md index 4eb43a0..a42cb44 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ # javacc +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. + diff --git a/javacc-5.0-parser-build_xml.patch b/javacc-5.0-parser-build_xml.patch new file mode 100644 index 0000000..cea8efe --- /dev/null +++ b/javacc-5.0-parser-build_xml.patch @@ -0,0 +1,11 @@ +--- src/org/javacc/parser/build.xml 2008-10-30 00:29:16.000000000 +0100 ++++ src/org/javacc/parser/build.xml-gil 2010-04-17 17:42:36.000000000 +0200 +@@ -52,7 +52,7 @@ + + + diff --git a/javacc.sh b/javacc.sh new file mode 100644 index 0000000..5031f86 --- /dev/null +++ b/javacc.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# +# JavaCC script +# JPackage Project + +# Source functions library +if [ -f /usr/share/java-utils/java-functions ] ; then + . /usr/share/java-utils/java-functions +else + echo "Can't find function library, aborting" + exit 1 +fi + +# Configuration +MAIN_CLASS=javacc +BASE_JARS="javacc.jar" + +# Set parameters +set_jvm +set_classpath $BASE_JARS +set_flags $BASE_FLAGS +set_options $BASE_OPTIONS + +# Let's start +run "$@" diff --git a/javacc.spec b/javacc.spec new file mode 100644 index 0000000..ffe0a51 --- /dev/null +++ b/javacc.spec @@ -0,0 +1,160 @@ +%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 +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|4.2|%{version}|" pom.xml +sed -i "s|5.0.0|4.0.0|" 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 5.0-4mamba +- rebuilt with java-gcj-compat support + +* Sun Nov 07 2010 gil 5.0-3mamba +- rebuilt devel + +* Sat Apr 17 2010 gil 5.0-2mamba +- rebuilt with system javacc.jar + +* Sat Apr 17 2010 gil 5.0-1mamba +- update to 5.0 +- added maven pom +- bootstrap + +* Thu Feb 26 2009 gil 4.2-1mamba +- package created by autospec diff --git a/jjdoc b/jjdoc new file mode 100644 index 0000000..bc9aa0f --- /dev/null +++ b/jjdoc @@ -0,0 +1,25 @@ +#!/bin/sh +# +# JJDoc script +# JPackage Project + +# Source functions library +if [ -f /usr/share/java-utils/java-functions ] ; then + . /usr/share/java-utils/java-functions +else + echo "Can't find function library, aborting" + exit 1 +fi + +# Configuration +MAIN_CLASS=jjdoc +BASE_JARS="javacc.jar" + +# Set parameters +set_jvm +set_classpath $BASE_JARS +set_flags $BASE_FLAGS +set_options $BASE_OPTIONS + +# Let's start +run "$@" diff --git a/jjtree b/jjtree new file mode 100644 index 0000000..bfe4db3 --- /dev/null +++ b/jjtree @@ -0,0 +1,25 @@ +#!/bin/sh +# +# JJTree script +# JPackage Project + +# Source functions library +if [ -f /usr/share/java-utils/java-functions ] ; then + . /usr/share/java-utils/java-functions +else + echo "Can't find function library, aborting" + exit 1 +fi + +# Configuration +MAIN_CLASS=jjtree +BASE_JARS="javacc.jar" + +# Set parameters +set_jvm +set_classpath $BASE_JARS +set_flags $BASE_FLAGS +set_options $BASE_OPTIONS + +# Let's start +run "$@"