- sync with F13 and devel (update to 3.2)

This commit is contained in:
Miloš Jakubíček 2010-03-02 11:39:44 +00:00
parent 8c4fad3fcc
commit 3d81baa9d1
6 changed files with 421 additions and 75 deletions

View File

@ -1,23 +0,0 @@
#!/usr/bin/python
# Clean out files which look to have been generated by antlr
# Author: Colin Walters <walters@verbum.org>
# This file is hereby placed into the public domain.
import os,sys,re
_antlr_compiled_re = re.compile(r'// \$ANTLR.*:.*->.*\$$')
def clean_antlr_generated(basedir):
for (dpath,subdirs,fnames) in os.walk(basedir):
for fname in fnames:
fpath = os.path.join(dpath, fname)
f = open(fpath)
first = f.readline()
f.close()
if _antlr_compiled_re.match(first):
print "Deleting antlr-compiled %s" % (fpath,)
os.unlink(fpath)
if __name__ == '__main__':
basedir = sys.argv[1]
clean_antlr_generated(basedir)

94
antlr-pom.patch Normal file
View File

@ -0,0 +1,94 @@
--- gunit/pom.xml.orig 2010-01-29 02:12:43.000000000 +0100
+++ gunit/pom.xml 2010-01-29 02:12:54.000000000 +0100
@@ -142,16 +142,6 @@
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>findbugs-maven-plugin</artifactId>
- <configuration>
- <findbugsXmlOutput>true</findbugsXmlOutput>
- <findbugsXmlWithMessages>true</findbugsXmlWithMessages>
- <xmlOutput>true</xmlOutput>
- </configuration>
- </plugin>
-
</plugins>
<extensions>
--- runtime/Java/pom.xml.orig 2010-01-29 02:13:13.000000000 +0100
+++ runtime/Java/pom.xml 2010-01-29 02:13:21.000000000 +0100
@@ -104,15 +104,6 @@
</configuration>
</plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>findbugs-maven-plugin</artifactId>
- <configuration>
- <findbugsXmlOutput>true</findbugsXmlOutput>
- <findbugsXmlWithMessages>true</findbugsXmlWithMessages>
- <xmlOutput>true</xmlOutput>
- </configuration>
- </plugin>
</plugins>
</build>
--- tool/pom.xml.orig 2009-09-23 20:50:28.000000000 +0200
+++ tool/pom.xml 2010-02-01 13:01:08.000000000 +0100
@@ -75,8 +82,7 @@
</plugin>
<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>antlr-maven-plugin</artifactId>
+ <artifactId>maven-antlr-plugin</artifactId>
<configuration>
<sourceDirectory>src/main/antlr2/org/antlr/grammar/v2</sourceDirectory>
<grammars>antlr.g codegen.g, antlr.print.g, assign.types.g, buildnfa.g, define.g</grammars>
--- pom.xml.orig 2009-09-23 20:46:18.000000000 +0200
+++ pom.xml 2010-02-01 13:45:20.000000000 +0100
@@ -146,25 +154,6 @@
<plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>buildnumber-maven-plugin</artifactId>
- <configuration>
- <format>{0,date,MMM dd, yyyy} {0,time,kk:mm:ss}</format>
- <items>
- <item>timestamp</item>
- </items>
- </configuration>
- <executions>
- <execution>
- <phase>validate</phase>
- <goals>
- <goal>create</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
@@ -179,16 +168,6 @@
</plugin>
<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>findbugs-maven-plugin</artifactId>
- <configuration>
- <findbugsXmlOutput>true</findbugsXmlOutput>
- <findbugsXmlWithMessages>true</findbugsXmlWithMessages>
- <xmlOutput>true</xmlOutput>
- </configuration>
- </plugin>
-
- <plugin>
<!--

2
antlr3
View File

@ -14,7 +14,7 @@ fi
# Configuration
MAIN_CLASS="org.antlr.Tool"
BASE_FLAGS=""
BASE_JARS="antlr.jar stringtemplate.jar antlr3.jar"
BASE_JARS="antlr.jar stringtemplate.jar antlr3.jar antlr3-runtime.jar"
# Set parameters
set_jvm

View File

@ -1,28 +1,53 @@
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
Summary: ANother Tool for Language Recognition
Name: antlr3
Version: 3.1.1
Release: 8%{?dist}
URL: http://www.antlr.org/
Source0: http://www.antlr.org/download/antlr-3.1.1.tar.gz
# Utility file, in conversation with upstream about this
Source1: antlr-clean-generated
Source2: antlr3
License: BSD
Group: Development/Libraries
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: java-devel >= 1:1.6.0
# For cleaner script
BuildRequires: python
BuildRequires: ant, stringtemplate, ant-antlr, ant-junit
# The build.xml uses this to version the jar
BuildRequires: bcel
BuildRequires: jpackage-utils
Requires: jpackage-utils
Requires: antlr
Requires: stringtemplate
%global with_bootstrap 1
%global antlr_version 3.2
%global python_runtime_version 3.1.2
%global javascript_runtime_version 3.1
Summary: ANother Tool for Language Recognition
Name: antlr3
Version: %{antlr_version}
Release: 2%{?dist}
URL: http://www.antlr.org/
Source0: http://www.antlr.org/download/antlr-%{antlr_version}.tar.gz
Source1: http://www.antlr.org/download/C/libantlr3c-%{antlr_version}.tar.gz
Source2: http://www.antlr.org/download/Python/antlr_python_runtime-%{python_runtime_version}.tar.gz
Source3: http://www.antlr.org/download/antlr-javascript-runtime-%{javascript_runtime_version}.zip
Source5: antlr3
%if %{with_bootstrap}
Source6: settings.xml
Source7: http://www.antlr.org/download/antlr-%{antlr_version}.jar
Source8: http://mirrors.ibiblio.org/pub/mirrors/maven2/org/antlr/antlr3-maven-plugin/%{antlr_version}/antlr3-maven-plugin-%{antlr_version}.jar
%endif
# No buildnumber and findbugs:
Patch0: antlr-pom.patch
License: BSD
Group: Development/Libraries
BuildRoot: %{_tmppath}/%{name}-%{antlr_version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: java-devel >= 1:1.6.0
BuildRequires: jpackage-utils
BuildRequires: maven2
BuildRequires: maven2-plugin-resources
BuildRequires: maven2-plugin-compiler
BuildRequires: maven2-plugin-jar
BuildRequires: maven2-plugin-install
BuildRequires: maven2-plugin-assembly
BuildRequires: maven2-plugin-antlr
BuildRequires: maven2-plugin-plugin
BuildRequires: maven2-plugin-site
BuildRequires: maven2-plugin-project-info-reports
BuildRequires: maven-surefire-maven-plugin
BuildRequires: maven-shared-reporting-impl
BuildRequires: maven-surefire-provider-junit4
BuildRequires: junit4
BuildRequires: tomcat5-servlet-2.4-api
BuildRequires: tomcat5
BuildRequires: stringtemplate >= 3.2
%if ! %{with_bootstrap}
BuildRequires: antlr3 >= 3.2
%endif
%description
ANother Tool for Language Recognition, is a language tool
@ -30,56 +55,254 @@ that provides a framework for constructing recognizers,
interpreters, compilers, and translators from grammatical
descriptions containing actions in a variety of target languages.
%package python
Group: Development/Libraries
Summary: Python runtime support for ANTLR-generated parsers
BuildRequires: python-devel
BuildRequires: python-setuptools-devel
BuildArch: noarch
%package tool
Group: Development/Libraries
Summary: ANother Tool for Language Recognition
BuildArch: noarch
Requires: jpackage-utils
Requires: java >= 1:1.6.0
Provides: %{name} = %{antlr_version}-%{release}
Obsoletes: %{name} < %{antlr_version}-%{release}
Requires: %{name}-java = %{antlr_version}-%{release}
Requires: antlr
Requires: stringtemplate >= 3.2
%description python
Python runtime support for ANTLR-generated parsers
%description tool
ANother Tool for Language Recognition, is a language tool
that provides a framework for constructing recognizers,
interpreters, compilers, and translators from grammatical
descriptions containing actions in a variety of target languages.
%package gunit
Group: Development/Libraries
Summary: Gunit is a unit testing framework for ANTLR grammars
BuildArch: noarch
Requires: jpackage-utils
Requires: java >= 1:1.6.0
%description gunit
This package provides support for Gunit, a unit testing framework
for ANTLR grammars.
%package java
Group: Development/Libraries
Summary: Java run-time support for ANTLR-generated parsers
BuildArch: noarch
Requires: jpackage-utils
Requires: java >= 1:1.6.0
%description java
Java run-time support for ANTLR-generated parsers
%package javascript
Group: Development/Libraries
Summary: Javascript run-time support for ANTLR-generated parsers
Version: %{javascript_runtime_version}
BuildArch: noarch
%description javascript
Javascript run-time support for ANTLR-generated parsers
%package C
Group: Development/Libraries
Summary: C run-time support for ANTLR-generated parsers
%description C
C run-time support for ANTLR-generated parsers
%package C-docs
Group: Documentation
Summary: API documentation for the C run-time support for ANTLR-generated parsers
BuildArch: noarch
BuildRequires: graphviz
BuildRequires: doxygen
Requires: %{name}-C = %{antlr_version}-%{release}
%description C-docs
This package contains doxygen documentation with instruction
on how to use the C target in ANTLR and complete API description of the
C run-time support for ANTLR-generated parsers.
%package python
Group: Development/Libraries
Summary: Python run-time support for ANTLR-generated parsers
BuildRequires: python-devel
BuildRequires: python-setuptools-devel
BuildArch: noarch
Version: %{python_runtime_version}
%description python
Python run-time support for ANTLR-generated parsers
%prep
%setup -q -n antlr-%{version}
%setup -q -n antlr-%{antlr_version} -a 1 -a 2 -a 3
%patch0 -b .orig
%if %{with_bootstrap}
cp %{SOURCE6} settings.xml
%endif
%build
rm -f lib/*.jar
build-jar-repository -s -p lib stringtemplate bcel
# Clean out generated files upstream includes
%{__python} %{SOURCE1} .
# Build
ant
export MAVEN_REPO_LOCAL=$(pwd)/.m2/repository
sed -i "s,\${buildNumber},`cat %{_sysconfdir}/fedora-release` `date`," tool/src/main/resources/org/antlr/antlr.properties
# remove corrupted files:
rm antlr3-maven-plugin/src/main/java/org/antlr/mojo/antlr3/._*
rm gunit-maven-plugin/src/main/java/org/antlr/mojo/antlr3/._GUnitExecuteMojo.java
%if %{with_bootstrap}
# we need antlr3-maven-plugin in place
sed -i -e \
"s|<url>__JPP_URL_PLACEHOLDER__</url>|<url>file://`pwd`/.m2/repository</url>|g" \
settings.xml
sed -i -e \
"s|<url>__JAVADIR_PLACEHOLDER__</url>|<url>file://`pwd`/external_repo</url>|g" \
settings.xml
sed -i -e \
"s|<url>__MAVENREPO_DIR_PLACEHOLDER__</url>|<url>file://`pwd`/.m2/repository</url>|g" \
settings.xml
sed -i -e \
"s|<url>__MAVENDIR_PLUGIN_PLACEHOLDER__</url>|<url>file:///usr/share/maven2/plugins</url>|g" \
settings.xml
mkdir -p $MAVEN_REPO_LOCAL/JPP/maven2/default_poms/
mkdir -p $MAVEN_REPO_LOCAL/org.antlr/
cp antlr3-maven-plugin/pom.xml $MAVEN_REPO_LOCAL/JPP/maven2/default_poms/org.antlr-antlr3-maven-plugin.pom
# install prebuilt antlr and antlr3-maven-plugin into repository
cp %{SOURCE7} $MAVEN_REPO_LOCAL/org.antlr/antlr.jar
cp %{SOURCE8} $MAVEN_REPO_LOCAL/org.antlr/antlr3-maven-plugin.jar
%endif
# Build antlr
%if %{with_bootstrap}
mvn-jpp -s $(pwd)/settings.xml -Dmaven.repo.local=$MAVEN_REPO_LOCAL -Dmaven.test.skip=true install
%else
mvn-jpp -Dmaven.repo.local=$MAVEN_REPO_LOCAL -Dmaven.test.skip=true install
%endif
# Build the python runtime
cd runtime/Python
pushd antlr_python_runtime-%{python_runtime_version}
%{__python} setup.py build
cd ../..
popd
# Build the C runtime
pushd libantlr3c-%{antlr_version}
%configure --disable-abiflags --enable-debuginfo
sed -i "s/CFLAGS = .*/CFLAGS = $RPM_OPT_FLAGS/" Makefile
make %{?_smp_mflags}
doxygen -u # update doxygen configuration file
doxygen # build doxygen documentation
popd
%install
rm -rf $RPM_BUILD_ROOT
install -D build/antlr.jar $RPM_BUILD_ROOT%{_datadir}/java/antlr3.jar
install -D -m 0755 %{SOURCE2} $RPM_BUILD_ROOT%{_bindir}/antlr3
mkdir -p $RPM_BUILD_ROOT{%{_javadir},%{_mavenpomdir},%{_bindir},%{_datadir}/antlr,%{_mandir}}
cd runtime/Python
# install maven POMs
install -pm 644 tool/pom.xml $RPM_BUILD_ROOT/%{_mavenpomdir}/JPP-antlr.pom
install -pm 644 antlr3-maven-plugin/pom.xml $RPM_BUILD_ROOT/%{_mavenpomdir}/JPP-antlr3-maven-plugin.pom
install -pm 644 gunit-maven-plugin/pom.xml $RPM_BUILD_ROOT/%{_mavenpomdir}/JPP-maven-gunit-plugin.pom
%add_to_maven_depmap org.antlr antlr %{antlr_version} JPP antlr3
%add_to_maven_depmap org.antlr antlr3-maven-plugin %{antlr_version} JPP antlr3-maven-plugin
%add_to_maven_depmap org.antlr maven-gunit-plugin %{antlr_version} JPP maven-gunit-plugin
# install jars
install -m 644 runtime/Java/target/antlr-runtime-%{antlr_version}.jar \
tool/target/antlr-%{antlr_version}.jar antlr3-maven-plugin/target/antlr3-maven-plugin-%{antlr_version}.jar \
gunit/target/gunit-%{antlr_version}.jar gunit-maven-plugin/target/maven-gunit-plugin-%{antlr_version}.jar \
$RPM_BUILD_ROOT%{_datadir}/java/
pushd $RPM_BUILD_ROOT%{_datadir}/java
ln -s antlr-%{antlr_version}.jar antlr3.jar
ln -s antlr3-maven-plugin-%{antlr_version}.jar antlr3-maven-plugin.jar
ln -s antlr-runtime-%{antlr_version}.jar antlr3-runtime.jar
popd
# install wrapper script
install -m 755 %{SOURCE5} $RPM_BUILD_ROOT%{_bindir}/antlr3
# install python runtime
pushd antlr_python_runtime-%{python_runtime_version}
%{__python} setup.py install -O1 --skip-build --root %{buildroot}
cd ../..
popd
# install C runtime
pushd libantlr3c-%{antlr_version}
make DESTDIR=$RPM_BUILD_ROOT install
rm $RPM_BUILD_ROOT%{_libdir}/libantlr3c.{a,la}
gzip api/man/man3/*
mv api/man/man3 $RPM_BUILD_ROOT%{_mandir}/
rmdir api/man
popd
# install javascript runtime
pushd antlr-javascript-runtime-%{javascript_runtime_version}
install -pm 644 *.js $RPM_BUILD_ROOT%{_datadir}/antlr/
popd
%post gunit
%update_maven_depmap
%postun gunit
%update_maven_depmap
%post tool
%update_maven_depmap
%postun tool
%update_maven_depmap
%post C -p /sbin/ldconfig
%postun C -p /sbin/ldconfig
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%doc README.txt LICENSE.txt
%{_datadir}/java/*.jar
%files tool
%defattr(-,root,root,-)
%doc tool/{README.txt,LICENSE.txt,CHANGES.txt}
%{_javadir}/*.jar
%{_bindir}/antlr3
%{_mavenpomdir}/JPP-antlr3-maven-plugin.pom
%{_mavenpomdir}/JPP-antlr.pom
%config %{_mavendepmapfragdir}/antlr3
%files python
%defattr(0644,root,root,0755)
%defattr(0644,root,root,-)
%{python_sitelib}/antlr3/*
%{python_sitelib}/antlr_python_runtime-*
%files C
%defattr(-,root,root,-)
%{_includedir}/antlr3*
%{_libdir}/*
%{_mandir}/man3/*
%files C-docs
%defattr(-,root,root,-)
%doc libantlr3c-%{antlr_version}/api/
%files java
%defattr(-,root,root,-)
%{_javadir}/antlr-runtime-%{antlr_version}.jar
%files javascript
%defattr(-,root,root,-)
%{_datadir}/antlr/
%files gunit
%defattr(-,root,root,-)
%{_javadir}/*gunit*.jar
%{_mavenpomdir}/JPP-maven-gunit-plugin.pom
%changelog
* Sun Jan 31 2010 Milos Jakubicek <xjakub@fi.muni.cz> - 3.2-2
- Build the doxygen documentation for the C target in a C-docs subpackage
- BuildRequires/Requires cleanup across subpackages
* Sat Jan 30 2010 Milos Jakubicek <xjakub@fi.muni.cz> - 3.2-1
- Update to 3.2, bootstrap build.
- Build bindings for C and JavaScript as well as gunit and maven plugin.
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.1-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

47
settings.xml Normal file
View File

@ -0,0 +1,47 @@
<settings>
<profiles>
<profile>
<id>JPP</id>
<repositories>
<repository>
<id>internal</id>
<layout>jpp</layout>
<url>__JPP_URL_PLACEHOLDER__</url>
</repository>
<repository>
<id>external</id>
<layout>jpp</layout>
<url>__JAVADIR_PLACEHOLDER__</url>
</repository>
<repository>
<id>local</id>
<layout>jpp</layout>
<url>__MAVENREPO_DIR_PLACEHOLDER__</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>plugins-internal</id>
<name>plugins-internal</name>
<layout>jpp</layout>
<url>__JPP_URL_PLACEHOLDER__</url>
</pluginRepository>
<pluginRepository>
<id>plugins-external</id>
<name>plugins-external</name>
<layout>jpp</layout>
<url>__JAVADIR_PLACEHOLDER__</url>
</pluginRepository>
<pluginRepository>
<id>plugins-maven</id>
<name>plugins-maven</name>
<layout>jpp</layout>
<url>__MAVENDIR_PLUGIN_PLACEHOLDER__</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>JPP</activeProfile>
</activeProfiles>
</settings>

View File

@ -1 +1,6 @@
c9fb696a18126a4d633aedcd96d9822a antlr-3.1.1.tar.gz
9074e3218a14654148392edff055e0d8 antlr-3.2.tar.gz
674646e1d1bf5c6015435480cead725a libantlr3c-3.2.tar.gz
5f58e5f8c8a052225d57d518d77742fc antlr-javascript-runtime-3.1.zip
1a96b0d5d18574589f9c498445f4e47c antlr_python_runtime-3.1.2.tar.gz
b5e66bec4b95d5af7363906a5f3d27a8 antlr3-maven-plugin-3.2.jar
ee7dc3fb20cf3e9efd871e297c0d532b antlr-3.2.jar