!1 init package

Merge pull request !1 from chenholmes/cl
This commit is contained in:
openeuler-ci-bot 2020-02-14 15:18:35 +08:00 committed by Gitee
commit a073e1d4f4
7 changed files with 357 additions and 0 deletions

12
antlr-2.7.7-newgcc.patch Normal file
View File

@ -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 <antlr/config.hpp>
#include <map>
+#include <strings.h>
+#include <cstdio>
#ifdef HAS_NOT_CCTYPE_H
#include <ctype.h>

22
antlr-2.7.7.pom Normal file
View File

@ -0,0 +1,22 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
<packaging>jar</packaging>
<version>2.7.7</version>
<name>AntLR Parser Generator</name>
<description>
A framework for constructing recognizers, compilers,
and translators from grammatical descriptions containing
Java, C#, C++, or Python actions.
</description>
<url>http://www.antlr.org/</url>
<licenses>
<license>
<name>BSD License</name>
<url>http://www.antlr.org/license.html</url>
<distribution>repo</distribution>
</license>
</licenses>
<dependencies/>
</project>

BIN
antlr-2.7.7.tar.gz Normal file

Binary file not shown.

72
antlr-build.xml Normal file
View File

@ -0,0 +1,72 @@
<!-- simple generic build file -->
<project name="antlr" default="all" basedir=".">
<!-- Properties -->
<property name="name" value="antlr"/>
<property name="src" value="src"/>
<property name="build" value="work"/>
<property name="build.classes" value="${build}/classes"/>
<property name="build.doc" value="${build}/api"/>
<property name="build.lib" value="${build}/lib"/>
<property name="packagenames" value="antlr.*"/>
<property name="j2se.apidoc" value="http://java.sun.com/j2se/1.4/docs/api/"/>
<!-- Targets -->
<!-- Prepare build directories -->
<target name="prepare">
<mkdir dir="${src}"/>
<mkdir dir="${build}"/>
<mkdir dir="${build.classes}"/>
<mkdir dir="${build.lib}"/>
<mkdir dir="${build.doc}"/>
<copy todir="${src}/antlr">
<fileset dir="antlr"/>
</copy>
</target>
<!-- Kill all the created directories -->
<target name="clean">
<delete dir="${build}"/>
<delete dir="${src}"/>
</target>
<!-- Build classes -->
<target name="classes" depends="prepare">
<javac srcdir="${src}" destdir="${build.classes}"
debug="off" optimize="on" deprecation="on"/>
</target>
<!-- Build jar archives -->
<target name="jar" depends="classes">
<jar jarfile="${build.lib}/${name}.jar" basedir="${build.classes}"
index="true">
<manifest>
<attribute name="Main-Class" value="antlr.Tool"/>
</manifest>
</jar>
</target>
<!-- Build the full JavaDocs -->
<target name="javadoc" depends="prepare">
<javadoc sourcepath="${src}"
destdir="${build.doc}"
doctitle="${name} Javadoc"
windowtitle="${name} Javadoc"
package="true"
author="true"
version="true"
packagenames="${packagenames}"
splitindex="true"
use="true"
additionalparam="-Xdoclint:none">
<link href="${j2se.apidoc}"/>
</javadoc>
</target>
<!-- Build everything -->
<target name="all" depends="jar,javadoc"/>
</project>

View File

@ -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.*;

25
antlr-script Normal file
View File

@ -0,0 +1,25 @@
#!/bin/sh
#
# antlr script
# JPackage Project <http://www.jpackage.org/>
# 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 "$@"

128
antlr.spec Normal file
View File

@ -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 <chenli147@huawei.com> - 2.7.7-58
- Package init