diff --git a/antlr-2.7.7-newgcc.patch b/antlr-2.7.7-newgcc.patch new file mode 100644 index 0000000..c501bd0 --- /dev/null +++ b/antlr-2.7.7-newgcc.patch @@ -0,0 +1,12 @@ +diff -up ./lib/cpp/antlr/CharScanner.hpp.sav ./lib/cpp/antlr/CharScanner.hpp +--- ./lib/cpp/antlr/CharScanner.hpp.sav 2009-03-20 14:42:43.000000000 -0400 ++++ ./lib/cpp/antlr/CharScanner.hpp 2009-03-20 14:43:29.000000000 -0400 +@@ -11,6 +11,8 @@ + #include + + #include ++#include ++#include + + #ifdef HAS_NOT_CCTYPE_H + #include diff --git a/antlr-2.7.7.pom b/antlr-2.7.7.pom new file mode 100644 index 0000000..354e82d --- /dev/null +++ b/antlr-2.7.7.pom @@ -0,0 +1,22 @@ + + 4.0.0 + antlr + antlr + jar + 2.7.7 + AntLR Parser Generator + + A framework for constructing recognizers, compilers, + and translators from grammatical descriptions containing + Java, C#, C++, or Python actions. + + http://www.antlr.org/ + + + BSD License + http://www.antlr.org/license.html + repo + + + + diff --git a/antlr-2.7.7.tar.gz b/antlr-2.7.7.tar.gz new file mode 100644 index 0000000..e06850c Binary files /dev/null and b/antlr-2.7.7.tar.gz differ diff --git a/antlr-build.xml b/antlr-build.xml new file mode 100644 index 0000000..d280255 --- /dev/null +++ b/antlr-build.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/antlr-examples-license.patch b/antlr-examples-license.patch new file mode 100644 index 0000000..14dda64 --- /dev/null +++ b/antlr-examples-license.patch @@ -0,0 +1,98 @@ +diff -up antlr-2.7.7/examples/java/unicode.IDENTs/ShowString.java.licensefix antlr-2.7.7/examples/java/unicode.IDENTs/ShowString.java +--- antlr-2.7.7/examples/java/unicode.IDENTs/ShowString.java.licensefix 2012-08-16 10:16:12.157567962 -0400 ++++ antlr-2.7.7/examples/java/unicode.IDENTs/ShowString.java 2012-08-16 10:17:46.425574161 -0400 +@@ -1,19 +1,33 @@ + + /* +- * Copyright (c) 1995-1998 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved. + * +- * Permission to use, copy, modify, and distribute this software +- * and its documentation for NON-COMMERCIAL purposes and without +- * fee is hereby granted provided that this copyright notice +- * appears in all copies. Please refer to the file "copyright.html" +- * for further important copyright and licensing information. ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: + * +- * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF +- * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +- * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +- * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR +- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR +- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. ++ * - Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * ++ * - Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * ++ * - Neither the name of Oracle or the names of its ++ * contributors may be used to endorse or promote products derived ++ * from this software without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS ++ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, ++ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR ++ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + import java.awt.*; +diff -up antlr-2.7.7/examples/java/unicode.IDENTs/StreamConverter.java.licensefix antlr-2.7.7/examples/java/unicode.IDENTs/StreamConverter.java +--- antlr-2.7.7/examples/java/unicode.IDENTs/StreamConverter.java.licensefix 2012-08-16 10:18:24.649576674 -0400 ++++ antlr-2.7.7/examples/java/unicode.IDENTs/StreamConverter.java 2012-08-16 10:18:49.002578275 -0400 +@@ -1,19 +1,33 @@ + + /* +- * Copyright (c) 1995-1998 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved. + * +- * Permission to use, copy, modify, and distribute this software +- * and its documentation for NON-COMMERCIAL purposes and without +- * fee is hereby granted provided that this copyright notice +- * appears in all copies. Please refer to the file "copyright.html" +- * for further important copyright and licensing information. ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: + * +- * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF +- * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +- * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +- * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR +- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR +- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. ++ * - Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * ++ * - Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * ++ * - Neither the name of Oracle or the names of its ++ * contributors may be used to endorse or promote products derived ++ * from this software without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS ++ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, ++ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR ++ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + import java.io.*; diff --git a/antlr-script b/antlr-script new file mode 100644 index 0000000..6389106 --- /dev/null +++ b/antlr-script @@ -0,0 +1,25 @@ +#!/bin/sh +# +# antlr 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 functions library, aborting" + exit 1 +fi + +# Configuration +MAIN_CLASS="antlr.Tool" +BASE_FLAGS="" +BASE_JARS="antlr.jar" + +# Set parameters +set_jvm +set_classpath $BASE_JARS +set_flags $BASE_FLAGS + +# Let's start +run "$@" diff --git a/antlr.spec b/antlr.spec new file mode 100644 index 0000000..ec5ee4d --- /dev/null +++ b/antlr.spec @@ -0,0 +1,128 @@ +%global debug_package %{nil} + +Name: antlr +Version: 2.7.7 +Release: 58 +Summary: A parser generator that uses LL(*) for parsing +Epoch: 0 +License: ANTLR-PD +URL: http://www.antlr2.org/ +Source0: https://www.antlr2.org/download/antlr-2.7.7.tar.gz +Source1: %{name}-build.xml +Source2: %{name}-script +Source3: http://repo2.maven.org/maven2/antlr/antlr/%{version}/%{name}-%{version}.pom +Patch0001: antlr-2.7.7-newgcc.patch +Patch0002: antlr-examples-license.patch + +BuildRequires: gcc-c++ make ant java-devel >= 1:1.7.0 java-javadoc javapackages-local +BuildRequires: doxygen graphviz python2-devel python2-setuptools + +%description +ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, +processing, executing, or translating structured text or binary files. + +%package tool +Summary: A parser generator that uses LL(*) for parsing +Provides: %{name} = %{version}-%{release} +BuildArch: noarch + +%description tool +ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, +processing, executing, or translating structured text or binary files. + +%package help +Summary: Help document for antlr +Provides: %{name}-manual = %{epoch}:%{version}-%{release} %{name}-javadoc = %{epoch}:%{version}-%{release} +Obsoletes: %{name}-manual < %{epoch}:%{version}-%{release} %{name}-javadoc < %{epoch}:%{version}-%{release} +BuildArch: noarch + +%description help +Help document for antlr. + +%package C++ +Summary: C++ library for antlr generated parsers +Provides: antlr-static = %{version}-%{release} + +%description C++ +This package provides a static C++ library for parsers. + +%package C++-doc +Summary: Documentation for C++ library +BuildArch: noarch + +%description C++-doc +This package contains the documentation for C++ library. + +%package -n python2-antlr +Summary: Python Code Generator for ANTLR +%{?python_provide:%python_provide python2-%{name}} +Provides: %{name}-python = %{version}-%{release} +Obsoletes: %{name}-python < 2.7.7-48 +BuildArch: noarch + +%description -n python2-antlr +Generate Lexers, Parsers and TreeParsers in Python. + +%prep +%autosetup -n %{name}-%{version} -p1 +find . -name "*.jar" -exec rm -f {} \; +cp -p %{SOURCE1} build.xml +sed -i 's/\r//' LICENSE.txt + +%mvn_file antlr:antlr antlr + +%build +ant -Dj2se.apidoc=%{_javadocdir}/java +cp work/lib/antlr.jar . +export CLASSPATH=. +%configure --without-examples +make CXXFLAGS="${CXXFLAGS} -fPIC" DEBUG=1 verbose=1 +rm antlr.jar doc/{Makefile,Makefile.in} +chmod 0644 doc/* + +cd lib/cpp + doxygen doxygen.cfg + find gen_doc -type f -exec chmod 0644 {} \; +cd - + +cd lib/python +%py2_build +cd ../../ + +%install +%mvn_artifact %{SOURCE3} work/lib/%{name}.jar +%mvn_alias %{name}:%{name} %{name}:%{name}all +%mvn_install -J work/api + +install -Dp -m755 %{SOURCE2} $RPM_BUILD_ROOT%{_bindir}/antlr +install -d $RPM_BUILD_ROOT%{_includedir}/%{name} +install -p -m644 lib/cpp/antlr/*.hpp $RPM_BUILD_ROOT%{_includedir}/%{name} +install -Dp -m644 lib/cpp/src/libantlr.a $RPM_BUILD_ROOT%{_libdir}/libantlr.a +install -p -m755 scripts/antlr-config $RPM_BUILD_ROOT%{_bindir}/antlr-config + +cd lib/python +%py2_install +cd ../.. + +%files tool -f .mfiles +%license LICENSE.txt +%{_bindir}/antlr + +%files C++ +%{_includedir}/%{name} +%{_libdir}/libantlr.a +%{_bindir}/antlr-config + +%files C++-doc +%doc lib/cpp/gen_doc/html/ + +%files help -f .mfiles-javadoc +%doc doc/* + +%files -n python2-%{name} +%{python2_sitelib}/antlr/* +%{python2_sitelib}/antlr-* + +%changelog +* Tue Jan 21 2020 chenli - 2.7.7-58 +- Package init