# TODO:
# - add python bcond
# - package the Emacs and Jedit modes
+# %{_datadir}/%{name}-%{version}/antlr-jedit.xml
+# %{_datadir}/%{name}-%{version}/antlr-mode.el
+#
+# NOTE:
+# - next version is packaged as antlr3.spec. Please, do not upgrade this spec
+# to 3.
#
# Conditional build:
-%bcond_without gcj # use javac instead of GCJ
+%bcond_with gcj # use GCJ instead of javac
%bcond_without dotnet # don't build .NET modules
%bcond_without java # don't build Java at all
#
%{?with_dotnet:%include /usr/lib/rpm/macros.mono}
#
+%ifarch x32
+%undefine with_dotnet
+%endif
+#
Summary: ANother Tool for Language Recognition
Summary(pl.UTF-8): Jeszcze jedno narzędzie do rozpoznawania języka
Name: antlr
Version: 2.7.7
-Release: 3
+Release: 14
License: Public Domain
Group: Development/Tools
-Source0: http://www.antlr.org/download/%{name}-%{version}.tar.gz
+Source0: http://www.antlr2.org/download/%{name}-%{version}.tar.gz
# Source0-md5: 01cc9a2a454dd33dcd8c856ec89af090
Patch0: %{name}-DESTDIR.patch
-URL: http://www.antlr.org/
+Patch1: %{name}-strcasecmp.patch
+Patch2: %{name}-gentoo.patch
+URL: http://www.antlr2.org/
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libstdc++-devel
BuildRequires: sed >= 4.0
%if %{with java}
%if %{with gcj}
-BuildRequires: gcc-java >= 5:4.0.0
-BuildRequires: jar
-Requires: /usr/bin/gij
+BuildRequires: java-gcj-compat-devel
%else
BuildRequires: jar
BuildRequires: jdk
Requires: jpackage-utils
%endif
+Requires: jre
%endif
Conflicts: pccts < 1.33MR33-6
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%prep
%setup -q
%patch0 -p1
+%patch1 -p1
+%patch2 -p1
%build
cp -f /usr/share/automake/config.sub scripts
%{__autoconf}
%configure \
- --enable-cxx \
- %{?with_dotnet:--enable-csharp} \
+ %{?with_dotnet:CSHARPC=/usr/bin/mcs --enable-csharp} \
%{!?with_dotnet:--disable-csharp} \
- %{!?with_gcj:CLASSPATH=`pwd` --with-java=java --with-javac=javac --with-jar=jar} \
+ --enable-cxx \
+ %{?with_java:CLASSPATH=`pwd` --with-java=java --with-javac=javac --with-jar=jar} \
%{!?with_java:--disable-java} \
- %{?with_gcj:--with-java=gij --with-javac=gcj --with-jar=jar}
CXXFLAGS="%{rpmcxxflags}" \
%{__make}
%{__make} install \
DESTDIR=$RPM_BUILD_ROOT
+%{__mv} $RPM_BUILD_ROOT%{_datadir}/%{name}-%{version}/*.py \
+ $RPM_BUILD_ROOT%{py_sitescriptdir}/%{name}
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/antlr.py
+%py_comp $RPM_BUILD_ROOT%{py_sitescriptdir}/%{name}
+%py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir}/%{name}
+# module installer
+%{__rm} $RPM_BUILD_ROOT%{_sbindir}/pyantlr.sh
+
%if %{with java}
-install $RPM_BUILD_ROOT%{_datadir}/%{name}-%{version}/antlr.jar \
+%{__mv} $RPM_BUILD_ROOT%{_datadir}/%{name}-%{version}/antlr.jar \
$RPM_BUILD_ROOT%{_javadir}
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/antlr.jar
%endif
-install $RPM_BUILD_ROOT%{_datadir}/%{name}-%{version}/*.py \
- $RPM_BUILD_ROOT%{py_sitescriptdir}/%{name}
+%{__sed} -i -e "s,ANTLR_JAR=.*,ANTLR_JAR=\"%{_javadir}/antlr.jar\",g" $RPM_BUILD_ROOT%{_bindir}/antlr
+
+%if %{with dotnet}
+%{__mv} $RPM_BUILD_ROOT%{_datadir}/%{name}-%{version}/*.dll $RPM_BUILD_ROOT%{_prefix}/lib/mono/%{name}
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/antlr.*.dll
+%endif
+
cp -Rf examples/{cpp,csharp,java,python} \
$RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
find $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} -name Makefile -exec rm -f {} \;
-%{?with_dotnet:install lib/*.dll $RPM_BUILD_ROOT%{_prefix}/lib/mono/%{name}}
-
-%py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir}/%{name}
-%py_comp $RPM_BUILD_ROOT%{py_sitescriptdir}/%{name}
-rm $RPM_BUILD_ROOT%{py_sitescriptdir}/%{name}/*.py
-
-%{__sed} -i -e "s,ANTLR_JAR=.*,ANTLR_JAR=\"%{_javadir}/antlr.jar\",g" $RPM_BUILD_ROOT%{_bindir}/antlr
+%{__rm} -r $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
-%doc doc/*
+%doc doc/*.{html,gif,jpg}
%attr(755,root,root) %{_bindir}/antlr
%attr(755,root,root) %{_bindir}/antlr-config
%{_includedir}/%{name}
%{_libdir}/libantlr.a
-# Dont separate it, antlr binary wont work without it
+# Don't separate it, antlr binary won't work without it
%if %{with java}
-%{_javadir}/*.jar
+%{_javadir}/antlr.jar
%endif
%if %{with dotnet}
%files -n dotnet-antlr
%defattr(644,root,root,755)
%dir %{_prefix}/lib/mono/%{name}
-%{_prefix}/lib/mono/%{name}/*.dll
+%{_prefix}/lib/mono/%{name}/antlr.astframe.dll
+%{_prefix}/lib/mono/%{name}/antlr.runtime.dll
%endif
%files -n python-antlr