e5cca7
%global debug_package %{nil}
e5cca7
# since we have only a static library
e5cca7
e5cca7
Summary:		ANother Tool for Language Recognition
e5cca7
Name:			antlr
e5cca7
Version:		2.7.7
e5cca7
Release:		30%{?dist}
e5cca7
Epoch:			0
e5cca7
License:		Public Domain
e5cca7
URL:			http://www.antlr.org/
e5cca7
Group:			Development/Tools
e5cca7
Source0:		http://www.antlr2.org/download/antlr-%{version}.tar.gz
e5cca7
Source1:		%{name}-build.xml
e5cca7
Source2:		%{name}-script
e5cca7
Source3:                http://repo2.maven.org/maven2/%{name}/%{name}/%{version}/%{name}-%{version}.pom
e5cca7
Patch1:			%{name}-%{version}-newgcc.patch
e5cca7
# see BZ#848662
e5cca7
Patch2:			antlr-examples-license.patch
e5cca7
BuildRoot:		%{_tmppath}/%{name}-%{version}-%{release}-buildroot
e5cca7
e5cca7
%ifarch %ix86 x86_64 ia64 armv4l sparcv9 alpha s390x ppc ppc64
e5cca7
%if ! 0%{?rhel} >= 6
e5cca7
BuildRequires:	mono-core
e5cca7
BuildRequires:	mono-winforms
e5cca7
%endif
e5cca7
%endif
e5cca7
BuildRequires:	ant
e5cca7
BuildRequires:	java-javadoc
e5cca7
BuildRequires:	jpackage-utils
e5cca7
BuildRequires:	java-devel >= 1:1.7.0
e5cca7
e5cca7
Requires:		jpackage-utils
e5cca7
Requires:		java >= 1:1.7.0
e5cca7
e5cca7
%description
e5cca7
ANTLR, ANother Tool for Language Recognition, (formerly PCCTS) is a
e5cca7
language tool that provides a framework for constructing recognizers,
e5cca7
compilers, and translators from grammatical descriptions containing
e5cca7
C++ or Java actions [You can use PCCTS 1.xx to generate C-based
e5cca7
parsers].
e5cca7
e5cca7
%package			tool
e5cca7
Group:				Development/Tools
e5cca7
Summary:			ANother Tool for Language Recognition
e5cca7
Provides:			%{name} = %{version}-%{release}
e5cca7
Obsoletes:			%{name} < %{version}-%{release}
e5cca7
Requires:			jpackage-utils
e5cca7
Requires:			java >= 1:1.7.0
e5cca7
BuildArch:			noarch
e5cca7
e5cca7
%description	tool
e5cca7
ANTLR, ANother Tool for Language Recognition, (formerly PCCTS) is a
e5cca7
language tool that provides a framework for constructing recognizers,
e5cca7
compilers, and translators from grammatical descriptions containing
e5cca7
C++ or Java actions [You can use PCCTS 1.xx to generate C-based
e5cca7
parsers].
e5cca7
e5cca7
%package		manual
e5cca7
Group:			Development/Tools
e5cca7
Summary:		Manual for %{name}
e5cca7
BuildArch:		noarch
e5cca7
e5cca7
%description	manual
e5cca7
Documentation for %{name}.
e5cca7
e5cca7
%package		javadoc
e5cca7
Group:			Documentation
e5cca7
Summary:		Javadoc for %{name}
e5cca7
BuildArch:		noarch
e5cca7
e5cca7
%description	javadoc
e5cca7
Javadoc for %{name}.
e5cca7
e5cca7
%package		C++
e5cca7
Group:			Development/Libraries
e5cca7
Summary:		C++ bindings for antlr2 generated parsers
e5cca7
Provides:		antlr-static = %{version}-%{release}
e5cca7
e5cca7
%description	C++
e5cca7
This package provides a static C++ library for parsers generated by ANTLR2.
e5cca7
e5cca7
%package		C++-doc
e5cca7
Group:			Documentation
e5cca7
Summary:		Documentation for C++ bindings for antlr2 generated parsers
e5cca7
BuildRequires:	doxygen
e5cca7
BuildArch:		noarch
e5cca7
e5cca7
%description	C++-doc
e5cca7
This package contains the documentation for the C++ bindings for parsers
e5cca7
generated by ANTLR2.
e5cca7
e5cca7
%package		python
e5cca7
Group:			Development/Libraries
e5cca7
Summary:		Python runtime support for ANTLR-generated parsers
e5cca7
BuildRequires:	python2-devel
e5cca7
BuildRequires:	python-setuptools-devel
e5cca7
BuildArch:		noarch
e5cca7
e5cca7
%description	python
e5cca7
Python runtime support for ANTLR-generated parsers
e5cca7
e5cca7
%prep
e5cca7
%setup -q
e5cca7
# remove all binary libs
e5cca7
find . -name "*.jar" -exec rm -f {} \;
e5cca7
cp -p %{SOURCE1} build.xml
e5cca7
%patch1
e5cca7
%patch2 -p1
e5cca7
# CRLF->LF
e5cca7
sed -i 's/\r//' LICENSE.txt
e5cca7
e5cca7
%build
e5cca7
ant -Dj2se.apidoc=%{_javadocdir}/java
e5cca7
cp work/lib/antlr.jar .  # make expects to find it here
e5cca7
export CLASSPATH=.
e5cca7
%configure --without-examples
e5cca7
make CXXFLAGS="${CXXFLAGS} -fPIC" DEBUG=1 verbose=1
e5cca7
rm antlr.jar			 # no longer needed
e5cca7
e5cca7
# fix doc permissions and remove Makefiles
e5cca7
rm doc/{Makefile,Makefile.in}
e5cca7
chmod 0644 doc/*
e5cca7
e5cca7
# generate doxygen docs for C++ bindings
e5cca7
pushd lib/cpp
e5cca7
	doxygen doxygen.cfg
e5cca7
	find gen_doc -type f -exec chmod 0644 {} \;
e5cca7
popd
e5cca7
e5cca7
# build python
e5cca7
cd lib/python
e5cca7
%{__python} setup.py build
e5cca7
cd ../../
e5cca7
e5cca7
%install
e5cca7
rm -rf $RPM_BUILD_ROOT
e5cca7
mkdir -p $RPM_BUILD_ROOT{%{_includedir}/%{name},%{_libdir},%{_bindir}}
e5cca7
e5cca7
# jars
e5cca7
mkdir -p $RPM_BUILD_ROOT%{_javadir}
e5cca7
cp -p work/lib/%{name}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-%{version}.jar
e5cca7
(cd $RPM_BUILD_ROOT%{_javadir} && for jar in *-%{version}.jar; do ln -sf ${jar} `echo $jar| sed "s|-%{version}||g"`; done)
e5cca7
e5cca7
# script
e5cca7
install -p -m 755 %{SOURCE2} $RPM_BUILD_ROOT%{_bindir}/antlr
e5cca7
e5cca7
# C++ lib and headers
e5cca7
e5cca7
install -p -m 644 lib/cpp/antlr/*.hpp $RPM_BUILD_ROOT%{_includedir}/%{name}
e5cca7
install -p -m 644 lib/cpp/src/libantlr.a $RPM_BUILD_ROOT%{_libdir}
e5cca7
e5cca7
# javadoc
e5cca7
mkdir -p $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
e5cca7
cp -pr work/api/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
e5cca7
ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_javadocdir}/%{name}
e5cca7
e5cca7
# python
e5cca7
cd lib/python
e5cca7
%{__python} setup.py install -O1 --skip-build --root %{buildroot}
e5cca7
cd ../..
e5cca7
e5cca7
# POM and depmap
e5cca7
install -d -m 755 $RPM_BUILD_ROOT%{_mavenpomdir}
e5cca7
install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT%{_mavenpomdir}/JPP-%{name}.pom
e5cca7
%add_maven_depmap -a antlr:antlrall
e5cca7
e5cca7
%clean
e5cca7
rm -rf $RPM_BUILD_ROOT
e5cca7
e5cca7
%files tool
e5cca7
%defattr(-,root,root,-)
e5cca7
%doc LICENSE.txt
e5cca7
%{_javadir}/%{name}*.jar
e5cca7
%{_bindir}/antlr
e5cca7
%{_mavenpomdir}/JPP-%{name}.pom
e5cca7
%{_mavendepmapfragdir}/%{name}
e5cca7
e5cca7
# this is actually a development package for the C++ target
e5cca7
# as we ship only a static library, it doesn't make sense
e5cca7
# to have a separate -devel package for the headers
e5cca7
%files C++
e5cca7
%defattr(-,root,root,-)
e5cca7
%{_includedir}/%{name}
e5cca7
%{_libdir}/libantlr.a
e5cca7
e5cca7
%files C++-doc
e5cca7
%defattr(-,root,root,-)
e5cca7
%doc lib/cpp/gen_doc/html/
e5cca7
e5cca7
%files manual
e5cca7
%defattr(-,root,root,-)
e5cca7
%doc doc/*
e5cca7
e5cca7
%files javadoc
e5cca7
%defattr(-,root,root,-)
e5cca7
%doc %{_javadocdir}/%{name}-%{version}
e5cca7
%doc %{_javadocdir}/%{name}
e5cca7
e5cca7
%files python
e5cca7
%defattr(-,root,root,-)
e5cca7
%{python_sitelib}/antlr/*
e5cca7
%{python_sitelib}/antlr-*
e5cca7
e5cca7
%changelog
e5cca7
* Fri Mar 14 2014 Mikolaj Izdebski <mizdebsk@redhat.com> - 0:2.7.7-30
e5cca7
- Don't install antlr-config script
e5cca7
- Resolves: rhbz#1076406
e5cca7
e5cca7
* Fri Jan 24 2014 Daniel Mach <dmach@redhat.com> - 02.7.7-29
e5cca7
- Mass rebuild 2014-01-24
e5cca7
e5cca7
* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 02.7.7-28
e5cca7
- Mass rebuild 2013-12-27
e5cca7
e5cca7
* Fri Jun 28 2013 Mikolaj Izdebski <mizdebsk@redhat.com> - 0:2.7.7-27
e5cca7
- Rebuild to regenerate API documentation
e5cca7
- Resolves: CVE-2013-1571
e5cca7
e5cca7
* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0:2.7.7-26
e5cca7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
e5cca7
e5cca7
* Sun Nov 25 2012 Mikolaj Izdebski <mizdebsk@redhat.com> - 0:2.7.7-25
e5cca7
- Move maven files from C++ to tool subpackage, resolves: rhbz#879885
e5cca7
e5cca7
* Thu Nov  1 2012 Mikolaj Izdebski <mizdebsk@redhat.com> - 0:2.7.7-24
e5cca7
- Add maven POM
e5cca7
e5cca7
* Sat Aug 18 2012 Miloš Jakubíček <xjakub@fi.muni.cz> - 0:2.7.7-23
e5cca7
- Add patch updating license on ShowString.java and StreamConverter.java
e5cca7
  examples (thanks to Tom Callaway, see BZ#848662)
e5cca7
e5cca7
* Wed Jul 18 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0:2.7.7-22
e5cca7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
e5cca7
e5cca7
* Wed Feb 01 2012 Jaroslav Reznik <jreznik@redhat.com> 0:2.7.7-21
e5cca7
- wrong version for jpackage-utils
e5cca7
e5cca7
* Wed Feb 01 2012 Jaroslav Reznik <jreznik@redhat.com> 0:2.7.7-20
e5cca7
- Versioned Java (build)/requires for -tool too
e5cca7
e5cca7
* Mon Jan 30 2012 Jaroslav Reznik <jreznik@redhat.com> 0:2.7.7-19
e5cca7
- Versioned Java (build)/requires
e5cca7
e5cca7
* Fri Jan 27 2012 Alexander Kurtakov <akurtako@redhat.com> 0:2.7.7-18
e5cca7
- Disable c# part for rhel builds.
e5cca7
e5cca7
* Thu Jan 12 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0:2.7.7-17
e5cca7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
e5cca7
e5cca7
* Fri Mar 25 2011 Miloš Jakubíček <xjakub@fi.muni.cz> - 0:2.7.7-16
e5cca7
- Fixed wrong Obsoletes: antlr on antlr-tool (fix #689703)
e5cca7
e5cca7
* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0:2.7.7-15
e5cca7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
e5cca7
e5cca7
* Mon Feb 07 2011 Miloš Jakubíček <xjakub@fi.muni.cz> - 0:2.7.7-14
e5cca7
- Remove INSTALL.txt (fix BZ#661626)
e5cca7
- add python subpackage (fix BZ#505312)
e5cca7
e5cca7
* Mon Feb 07 2011 Miloš Jakubíček <xjakub@fi.muni.cz> - 0:2.7.7-13
e5cca7
- Added missing Obsoletes: antlr on antlr-tool (fix BZ#603466)
e5cca7
e5cca7
* Mon Dec 13 2010 Dan Horák <dan[at]danny.cz> - 0:2.7.7-12
e5cca7
- sync the architecture list in BR with the mono package
e5cca7
e5cca7
* Tue Nov 23 2010 Rex Dieter <rdieter@fedoraproject.org> - 0:2.7.7-11
e5cca7
- -tool: +Requires: java jpackage-utils (#595504)
e5cca7
e5cca7
* Thu Apr 29 2010 Miloš Jakubíček <xjakub@fi.muni.cz> - 0:2.7.7-10
e5cca7
- Use original upstream tarball, prebuilt jars are anyway removed in %%prep
e5cca7
- Don't overuse macros
e5cca7
- Added explanation about headers in the C++ subpackage
e5cca7
- Remove unnecessary Makefile and Makefile.in from %%docs, permissions fixed
e5cca7
- Added doxygen docs for C++ as a -C++-doc subpackage
e5cca7
- antlr-config moved into the C++ subpackage
e5cca7
- Removed %%post and %%postun javadoc relicts from JPackage
e5cca7
e5cca7
* Tue Apr 27 2010 Miloš Jakubíček <xjakub@fi.muni.cz> - 0:2.7.7-9
e5cca7
- Drop native build, alternatives, jedit, gcj bits and other jpackage crap
e5cca7
- Disable debuginfo since we have only a static library.
e5cca7
- Use %%global everywhere
e5cca7
- Split the C++ bindings into a separate -C++ subpackage
e5cca7
- Use -tool subpackage with Provide: antlr to make it possible to be noarch
e5cca7
- Use sed instead of perl => drop BR: perl
e5cca7
e5cca7
* Tue Apr 20 2010 Orion Poplawski <orion@cora.nwra.com> 0:2.7.7-8
e5cca7
- Cannot be noarch
e5cca7
e5cca7
* Wed Apr 7 2010 Alexander Kurtakov <akurtako@redhat.com> 0:2.7.7-7
e5cca7
- Disable gcj.
e5cca7
- Use %%global.
e5cca7
e5cca7
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0:2.7.7-6
e5cca7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
e5cca7
e5cca7
* Fri Mar 20 2009 Deepak Bhole <dbhole@redhat.com> - 0:2.7.7-5
e5cca7
- Include cstdio in CharScanner.hpp (needed to build with GCC 4.4)
e5cca7
- Merge changes from includestrings patch into the above one
e5cca7
e5cca7
* Mon Feb 23 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0:2.7.7-4
e5cca7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
e5cca7
e5cca7
* Fri Jan 09 2009 Dennis Gilmore <dennis@ausil.us> 2.7.7-3
e5cca7
- exlcude using mono on sparc64
e5cca7
e5cca7
* Wed Jul  9 2008 Tom "spot" Callaway <tcallawa@redhat.com> 2.7.7-2
e5cca7
- drop repotag
e5cca7
e5cca7
* Wed Feb 27 2008 Deepak Bhole <dbhole@redhat.com> - 0:2.7.7-1jpp.7
e5cca7
- Add strings inclusion (for GCC 4.3)
e5cca7
e5cca7
* Mon Sep 24 2007 Deepak Bhole <dbhole@redhat.com> - 0:2.7.7-1jpp.6
e5cca7
- Resolve bz# 242305: Remove libantlr-pic.a, and compile libantlr.a with fPIC
e5cca7
e5cca7
* Wed Aug 29 2007 Fedora Release Engineering <rel-eng at fedoraproject dot org> - 2.7.7-1jpp.5
e5cca7
- Rebuild for selinux ppc32 issue.
e5cca7
e5cca7
* Tue Jun 12 2007 Deepak Bhole <dbhole@redhat.com> 2.7.7-1jpp.4.fc8
e5cca7
- Added a PIC compiled archive (bz# 242305)
e5cca7
e5cca7
* Thu Jun 07 2007 Deepak Bhole <dbhole@redhat.com> 2.7.7-1jpp.3
e5cca7
- Applied patch to fix conditionals (from skasal at redhat dot com)
e5cca7
e5cca7
* Mon Mar 26 2007 Deepak Bhole <dbhole@redhat.com> 2.7.7-1jpp.2
e5cca7
- Added unowned dir to files list
e5cca7
e5cca7
* Fri Jan 19 2007 Deepak Bhole <dbhole@redhat.com> 0:2.7.7-1jpp.1
e5cca7
- Upgrade to 2.7.7
e5cca7
- Resolve 172456 with patches from Vadim Nasardinov and Radu Greab
e5cca7
e5cca7
* Thu Aug 03 2006 Deepak Bhole <dbhole@redhat.com> = 0:2.7.6-4jpp.2
e5cca7
- Add missing postun for javadoc.
e5cca7
e5cca7
* Thu Aug 03 2006 Deepak Bhole <dbhole@redhat.com> = 0:2.7.6-4jpp.1
e5cca7
- Add missing requirements.
e5cca7
e5cca7
* Sat Jul 22 2006 Thomas Fitzsimmons <fitzsim@redhat.com> - 0:2.7.6-3jpp_5fc
e5cca7
- Unstub docs.
e5cca7
e5cca7
* Sat Jul 22 2006 Jakub Jelinek <jakub@redhat.com> - 0:2.7.6-3jpp_4fc
e5cca7
- Remove hack-libgcj requirement.
e5cca7
e5cca7
* Fri Jul 21 2006 Thomas Fitzsimmons <fitzsim@redhat.com> - 0:2.7.6-3jpp_3fc
e5cca7
- Stub docs. (dist-fc6-java)
e5cca7
- Require hack-libgcj for build. (dist-fc6-java)
e5cca7
- Bump release number.
e5cca7
e5cca7
* Wed Jul 19 2006 Deepak Bhole <dbhole@redhat.com> = 0:2.7.6-3jpp_2fc
e5cca7
- From gbenson@redhat:
e5cca7
- Omit the jedit subpackage to fix dependencies. 
e5cca7
e5cca7
* Wed Jul 19 2006 Deepak Bhole <dbhole@redhat.com> = 0:2.7.6-3jpp_1fc
e5cca7
- Added conditional native compilation.
e5cca7
e5cca7
* Fri Jan 13 2006 Fernando Nasser <fnasser@redhat.com> - 0:2.7.6-2jpp
e5cca7
- First JPP 1.7 build
e5cca7
e5cca7
* Fri Jan 13 2006 Fernando Nasser <fnasser@redhat.com> - 0:2.7.6-1jpp
e5cca7
- Update to 2.7.6.
e5cca7
e5cca7
* Fri Aug 20 2004 Ralph Apel <r.apel at r-apel.de> - 0:2.7.4-2jpp
e5cca7
- Build with ant-1.6.2.
e5cca7
- Made native scripts conditional
e5cca7
e5cca7
* Tue May 18 2004 Ville Skyttä <ville.skytta at iki.fi> - 0:2.7.4-1jpp
e5cca7
- Update to 2.7.4.
e5cca7
e5cca7
* Fri Apr  2 2004 Ville Skyttä <ville.skytta at iki.fi> - 0:2.7.3-2jpp
e5cca7
- Create alternatives also on upgrades.
e5cca7
e5cca7
* Wed Mar 31 2004 Ville Skyttä <ville.skytta at iki.fi> - 0:2.7.3-1jpp
e5cca7
- Update to 2.7.3.
e5cca7
- Include gcj build option and a native subpackage, build using
e5cca7
  "--with native" to get that.
e5cca7
- Add %%{_bindir}/antlr alternative.
e5cca7
e5cca7
* Mon Dec 15 2003 Ville Skyttä <ville.skytta at iki.fi> - 0:2.7.2-3jpp
e5cca7
- Add non-versioned javadoc dir symlink.
e5cca7
- Crosslink with local J2SE javadocs.
e5cca7
- Spec cleanups, change to UTF-8.
e5cca7
e5cca7
* Sun Mar 30 2003 Ville Skyttä <ville.skytta at iki.fi> - 0:2.7.2-2jpp
e5cca7
- Rebuild for JPackage 1.5.
e5cca7
e5cca7
* Sat Mar  1 2003 Ville Skyttä <ville.skytta at iki.fi> - 2.7.2-1jpp
e5cca7
- Update to 2.7.2.
e5cca7
- Include antlr script and jEdit mode (see antlr-jedit RPM description).
e5cca7
- Use sed instead of bash 2 extension when symlinking jars during build.
e5cca7
e5cca7
* Tue May 07 2002 Guillaume Rousse <guillomovitch@users.sourceforge.net> 2.7.1-8jpp
e5cca7
- really section macro
e5cca7
- hardcoded distribution and vendor tag
e5cca7
- group tag again
e5cca7
e5cca7
* Thu May 2 2002 Guillaume Rousse <guillomovitch@users.sourceforge.net> 2.7.1-7jpp
e5cca7
- distribution tag
e5cca7
- group tag
e5cca7
- section macro
e5cca7
e5cca7
* Fri Jan 18 2002 Guillaume Rousse <guillomovitch@users.sourceforge.net> 2.7.1-6jpp
e5cca7
- versioned dir for javadoc
e5cca7
- no dependencies for manual and javadoc packages
e5cca7
- additional sources in individual archives
e5cca7
e5cca7
* Sat Dec 1 2001 Guillaume Rousse <guillomovitch@users.sourceforge.net> 2.7.1-5jpp
e5cca7
- javadoc in javadoc package
e5cca7
e5cca7
* Wed Nov 21 2001 Christian Zoffoli <czoffoli@littlepenguin.org> 2.7.1-4jpp
e5cca7
- removed packager tag
e5cca7
- new jpp extension
e5cca7
e5cca7
* Sat Oct 6 2001 Guillaume Rousse <guillomovitch@users.sourceforge.net> 2.7.1-3jpp
e5cca7
- used a build file instead of makefile
e5cca7
- build classes instead of blindly jared them !
e5cca7
- used original tarball
e5cca7
- corrected license spelling
e5cca7
e5cca7
* Sun Sep 30 2001 Guillaume Rousse <guillomovitch@users.sourceforge.net> 2.7.1-2jpp
e5cca7
- first unified release
e5cca7
- s/jPackage/JPackage
e5cca7
e5cca7
* Tue Aug 28 2001 Guillaume Rousse <guillomovitch@users.sourceforge.net> 2.7.1-1mdk
e5cca7
- first Mandrake release