%define section free
%define native %{?_with_native:1}%{!?_without_native:0}
%define build_jedit %{?_with_jedit:1}%{!?_without_jedit:0}
Summary: ANother Tool for Language Recognition
Name: antlr
Version: 2.7.4
Release: 2jpp_5fc
Epoch: 0
License: Public Domain
URL: http://www.antlr.org/
Group: Development/Code Generators
Source0: antlr-2.7.4-RHCLEAN.tar.bz2
Source1: %{name}-build.xml
Source2: %{name}-script
Source3: http://www.antlr.org/share/1069557132934/makefile.gcj
Patch0: %{name}-jedit.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
%if %{native}
BuildRequires: %{_bindir}/gcj, %{__make}
%else
BuildArch: noarch
BuildRequires: ant
BuildRequires: %{__perl}, java-javadoc
Requires: jpackage-utils
Requires(post): %{_sbindir}/update-alternatives
Requires(postun): %{_sbindir}/update-alternatives
%endif
%description
ANTLR, ANother Tool for Language Recognition, (formerly PCCTS) is a
language tool that provides a framework for constructing recognizers,
compilers, and translators from grammatical descriptions containing
C++ or Java actions [You can use PCCTS 1.xx to generate C-based
parsers].
%package native
Group: Development/Code Generators
Summary: ANother Tool for Language Recognition (native version)
Requires(post): %{_sbindir}/update-alternatives
Requires(postun): %{_sbindir}/update-alternatives
%description native
ANTLR, ANother Tool for Language Recognition, (formerly PCCTS) is a
language tool that provides a framework for constructing recognizers,
compilers, and translators from grammatical descriptions containing
C++ or Java actions [You can use PCCTS 1.xx to generate C-based
parsers]. This package includes the native version of the antlr tool.
%package manual
Group: Development/Code Generators
Summary: Manual for %{name}
%description manual
Documentation for %{name}.
%package javadoc
Group: Development/Documentation
Summary: Javadoc for %{name}
%description javadoc
Javadoc for %{name}.
%if %{build_jedit}
%package jedit
Group: Text Editors
Summary: ANTLR mode for jEdit
Requires: jedit >= 0:4.1
%description jedit
ANTLR mode for jEdit. To enable this mode, insert the following into your
%{_datadir}/jedit/modes/catalog:
%endif
%prep
%setup -q
# remove all binary libs
find . -name "*.jar" -exec rm -f {} \;
%if !%{native}
%patch0 -p0
cp -p %{SOURCE1} build.xml
# fixup paths to manual
%{__perl} -pi -e 's|"doc/|"%{_docdir}/%{name}-manual-%{version}/|g' \
install.html
%endif
%build
%if %{native}
%{__make} -f %{SOURCE3} COMPOPTS="$RPM_OPT_FLAGS"
%else
ant -Dj2se.apidoc=%{_javadocdir}/java
%endif
%install
rm -rf $RPM_BUILD_ROOT
install -dm 755 $RPM_BUILD_ROOT%{_bindir}
touch $RPM_BUILD_ROOT%{_bindir}/antlr # for %%ghost
%if %{native}
install -pm 755 cantlr $RPM_BUILD_ROOT%{_bindir}/antlr-native
%else
# jars
mkdir -p $RPM_BUILD_ROOT%{_javadir}
cp -p work/lib/%{name}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-%{version}.jar
(cd $RPM_BUILD_ROOT%{_javadir} && for jar in *-%{version}.jar; do ln -sf ${jar} `echo $jar| sed "s|-%{version}||g"`; done)
# script
cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_bindir}/antlr-java
# javadoc
mkdir -p $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
cp -pr work/api/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_javadocdir}/%{name}
# jedit mode
%if %{build_jedit}
mkdir -p $RPM_BUILD_ROOT%{_datadir}/jedit/modes
cp -p extras/antlr-jedit.xml $RPM_BUILD_ROOT%{_datadir}/jedit/modes/antlr.xml
%endif
%endif
%clean
rm -rf $RPM_BUILD_ROOT
%post
%{_sbindir}/update-alternatives --install %{_bindir}/antlr \
%{name} %{_bindir}/antlr-java 10
%postun
if [ $1 -eq 0 ] ; then
%{_sbindir}/update-alternatives --remove %{name} %{_bindir}/antlr-java
fi
%if %{native}
%post native
%{_sbindir}/update-alternatives --install %{_bindir}/antlr \
%{name} %{_bindir}/antlr-native 20
%postun native
if [ $1 -eq 0 ] ; then
%{_sbindir}/update-alternatives --remove %{name} %{_bindir}/antlr-native
fi
%endif
%post javadoc
rm -f %{_javadocdir}/%{name}
ln -s %{name}-%{version} %{_javadocdir}/%{name}
%if %{native}
%files native
%defattr(0644,root,root,0755)
%doc install.html LICENSE.txt
%defattr(0755,root,root,0755)
%ghost %{_bindir}/antlr
%{_bindir}/antlr-native
%else
%files
%defattr(0644,root,root,0755)
%doc install.html LICENSE.txt
%{_javadir}/%{name}*.jar
%defattr(0755,root,root,0755)
%ghost %{_bindir}/antlr
%{_bindir}/antlr-java
%files manual
%defattr(0644,root,root,0755)
%doc doc/*
%files javadoc
%defattr(0644,root,root,0755)
%doc %{_javadocdir}/%{name}-%{version}
%ghost %doc %{_javadocdir}/%{name}
%if %{build_jedit}
%files jedit
%defattr(0644,root,root,0755)
%{_datadir}/jedit/modes/*
%endif
%endif
%changelog
* Wed Dec 21 2005 Jesse Keating - 0:2.7.4-2jpp_5fc
- rebuilt for new gcj
* Tue Dec 13 2005 Jesse Keating
- rebuilt for new gcj
* Fri Dec 09 2005 Jesse Keating
- rebuilt
* Mon Nov 28 2005 Vadim Nasardinov - 0:2.7.4-2jpp_4fc
- Reverted the previous change.
* Mon Nov 7 2005 Vadim Nasardinov - 0:2.7.4-2jpp_3fc
- BZ 172456: Added /usr/lib/libantlr.a and /usr/include/antlr/*.hpp
* Tue Jun 21 2005 Gary Benson - 0:2.7.4-2jpp_2fc
- Remove jarfile from the tarball.
- Remove now-unnecessary workaround for #144775.
* Tue Jan 11 2005 Gary Benson - 0:2.7.4-2jpp_1fc
- Sync with RHAPS.
* Mon Nov 15 2004 Fernando Nasser - 0:2.7.4-2jpp_1rh
- Merge with upstream for upgrade
* Fri Nov 12 2004 Gary Benson - 0:2.7.2-3jpp_3fc
- Omit the jedit subpackage to fix dependencies.
* Thu Nov 4 2004 Gary Benson - 0:2.7.2-3jpp_2fc
- Build into Fedora.
* Fri Aug 20 2004 Ralph Apel - 0:2.7.4-2jpp
- Build with ant-1.6.2.
- Made native scripts conditional
* Tue May 18 2004 Ville Skyttä - 0:2.7.4-1jpp
- Update to 2.7.4.
* Fri Apr 2 2004 Ville Skyttä - 0:2.7.3-2jpp
- Create alternatives also on upgrades.
* Wed Mar 31 2004 Ville Skyttä - 0:2.7.3-1jpp
- Update to 2.7.3.
- Include gcj build option and a native subpackage, build using
"--with native" to get that.
- Add %{_bindir}/antlr alternative.
* Thu Mar 4 2004 Frank Ch. Eigler - 0:2.7.2-3jpp
- Add non-versioned javadoc dir symlink.
- Crosslink with local J2SE javadocs.
- Spec cleanups, change to UTF-8.
* Sun Mar 30 2003 Ville Skyttä - 0:2.7.2-2jpp
- Rebuild for JPackage 1.5.
* Sat Mar 1 2003 Ville Skyttä - 2.7.2-1jpp
- Update to 2.7.2.
- Include antlr script and jEdit mode (see antlr-jedit RPM description).
- Use sed instead of bash 2 extension when symlinking jars during build.
* Tue May 07 2002 Guillaume Rousse 2.7.1-8jpp
- really section macro
- hardcoded distribution and vendor tag
- group tag again
* Thu May 2 2002 Guillaume Rousse 2.7.1-7jpp
- distribution tag
- group tag
- section macro
* Fri Jan 18 2002 Guillaume Rousse 2.7.1-6jpp
- versioned dir for javadoc
- no dependencies for manual and javadoc packages
- additional sources in individual archives
* Sat Dec 1 2001 Guillaume Rousse 2.7.1-5jpp
- javadoc in javadoc package
* Wed Nov 21 2001 Christian Zoffoli 2.7.1-4jpp
- removed packager tag
- new jpp extension
* Sat Oct 6 2001 Guillaume Rousse 2.7.1-3jpp
- used a build file instead of makefile
- build classes instead of blindly jared them !
- used original tarball
- corrected license spelling
* Sun Sep 30 2001 Guillaume Rousse 2.7.1-2jpp
- first unified release
- s/jPackage/JPackage
* Tue Aug 28 2001 Guillaume Rousse 2.7.1-1mdk
- first Mandrake release