BuildRequires: gcc-c++ %def_without jedit BuildRequires: /proc BuildRequires: jpackage-1.4-compat # Copyright (c) 2000-2005, JPackage Project # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. 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. # 3. Neither the name of the JPackage Project nor 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. # %define gcj_support 0 %define native %{?_with_native:1}%{!?_without_native:0} Summary: ANother Tool for Language Recognition Name: antlr Version: 2.7.7 Release: alt4_1jpp1.7 Epoch: 0 License: Public Domain URL: http://www.antlr.org/ Group: Development/Java #http://www.antlr.org/download/antlr-%{version}.tar.gz Source0: antlr-%{version}.tar.gz Source1: %{name}-build.xml Source2: %{name}-script #http://www.antlr.org/share/1069557132934/makefile.gcj Source3: makefile.gcj Patch0: %{name}-jedit.patch %if %{native} BuildRequires: %{_bindir}/gcj %else %if ! %{gcj_support} ##BuildArch: noarch %endif BuildRequires: ant BuildRequires: mono BuildRequires: mono-winforms BuildRequires: %{__perl} java-javadoc Requires: jpackage-utils Requires(post): alternatives >= 0:0.2.0-alt0.12 Requires(postun): alternatives >= 0:0.2.0-alt0.12 %endif %if %{gcj_support} BuildRequires: java-gcj-compat-devel Requires(post): java-gcj-compat Requires(postun): java-gcj-compat %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/Java Summary: ANother Tool for Language Recognition (native version) Requires(post): alternatives >= 0:0.2.0-alt0.12 Requires(postun): alternatives >= 0:0.2.0-alt0.12 %if %{gcj_support} BuildRequires: java-gcj-compat-devel Requires(post): java-gcj-compat Requires(postun): java-gcj-compat %endif %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 native-devel # antlr.a vs antlr.so; Conflicts: kde4sdk-libs Group: Development/C++ Summary: ANother Tool for Language Recognition (native version) %description native-devel 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 headers and static library for native version of the antlr tool. %package manual Group: Development/Java Summary: Manual for %{name} %description manual Documentation for %{name}. %package javadoc Group: Development/Documentation Summary: Javadoc for %{name} %description javadoc Javadoc for %{name}. %if_with jedit %package jedit Group: Editors Summary: ANTLR mode for jEdit Requires: jedit >= 0:4.1 %endif #jedit %if_with jedit %description jedit ANTLR mode for jEdit. To enable this mode, insert the following into your %{_datadir}/jedit/modes/catalog: <MODE NAME="antlr" FILE="antlr.xml" FILE_NAME_GLOB="*.g"/> %endif #jedit %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 cp work/lib/antlr.jar . # make expects to find it here export CLASSPATH=. %configure --without-examples make find . -type f > /tmp/antlr.filelist rm antlr.jar # no longer needed %endif %install 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 # C++ lib and headers, antlr-config %define headers %{_includedir}/%{name} mkdir -p $RPM_BUILD_ROOT{%{headers},%{_libdir}} install -m 644 lib/cpp/antlr/*.hpp $RPM_BUILD_ROOT%{headers} install -m 644 lib/cpp/src/libantlr.a $RPM_BUILD_ROOT%{_libdir} install -m 755 scripts/antlr-config $RPM_BUILD_ROOT%{_bindir} # 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 mkdir -p $RPM_BUILD_ROOT%{_datadir}/jedit/modes cp -p extras/antlr-jedit.xml $RPM_BUILD_ROOT%{_datadir}/jedit/modes/antlr.xml %endif %if %{gcj_support} %{_bindir}/aot-compile-rpm %endif install -d $RPM_BUILD_ROOT/%_altdir; cat >$RPM_BUILD_ROOT/%_altdir/%{name}_%{name}<<EOF %{_bindir}/antlr %{_bindir}/antlr-java 10 EOF install -d $RPM_BUILD_ROOT/%_altdir; cat >$RPM_BUILD_ROOT/%_altdir/%{name}_%{name}-native<<EOF %{_bindir}/antlr %{_bindir}/antlr-native 20 EOF chmod 755 $RPM_BUILD_ROOT%{_bindir}/* %post %register_alternatives %{name}_%{name} %if %{gcj_support} if [ -x %{_bindir}/rebuild-gcj-db ] then %{_bindir}/rebuild-gcj-db fi %endif %postun if [ $1 -eq 0 ] ; then %unregister_alternatives %{name}_%{name} fi %if %{native} %if %{gcj_support} if [ -x %{_bindir}/rebuild-gcj-db ] then %{_bindir}/rebuild-gcj-db fi %endif %post native %register_alternatives %{name}_%{name}-native %if %{gcj_support} if [ -x %{_bindir}/rebuild-gcj-db ] then %{_bindir}/rebuild-gcj-db fi %endif %postun native if [ $1 -eq 0 ] ; then %unregister_alternatives %{name}_%{name}-native fi %endif %if %{gcj_support} if [ -x %{_bindir}/rebuild-gcj-db ] then %{_bindir}/rebuild-gcj-db fi %endif %post javadoc rm -f %{_javadocdir}/%{name} ln -s %{name}-%{version} %{_javadocdir}/%{name} %postun javadoc if [ $1 -eq 0 ]; then %{__rm} -f %{_javadocdir}/%{name} fi %if %{native} %files native %_altdir/%{name}_%{name}-native %doc INSTALL.txt LICENSE.txt #%defattr(0755,root,root,0755) #%ghost %{_bindir}/antlr %{_bindir}/antlr-native %else %files native-devel %{headers}/*.hpp %{_libdir}/libantlr.a %files %_altdir/%{name}_%{name} %doc INSTALL.txt LICENSE.txt %{_javadir}/%{name}*.jar #%{headers}/*.hpp #%{_libdir}/libantlr.a #%defattr(0755,root,root,0755) #%ghost %{_bindir}/antlr %{_bindir}/antlr-config %{_bindir}/antlr-java %if %{gcj_support} #%{_libdir}/gcj/%{name} %endif %files manual %doc doc/* %files javadoc %doc %{_javadocdir}/%{name}-%{version} %ghost %doc %{_javadocdir}/%{name} %if_with jedit %files jedit %{_datadir}/jedit/modes/* %endif %endif #jedit %changelog * Mon Apr 21 2008 Igor Vlasenko <viy@altlinux.ru> 0:2.7.7-alt4_1jpp1.7 - added conflict for .so * Sat Apr 12 2008 Igor Vlasenko <viy@altlinux.ru> 0:2.7.7-alt3_1jpp1.7 - fixed script permissions * Thu Aug 02 2007 Igor Vlasenko <viy@altlinux.ru> 0:2.7.7-alt2_1jpp1.7 - converted from JPackage by jppimport script * Thu Aug 02 2007 Igor Vlasenko <viy@altlinux.ru> 0:2.7.7-alt1_1jpp1.7 - converted from JPackage by jppimport script * Sat Mar 04 2006 Mikhail Zabaluev <mhz@altlinux.ru> 2.7.6-alt1 - 2.7.6 - Added README.txt to the docs list - Set source and target compiler attributes * Tue Feb 01 2005 Mikhail Zabaluev <mhz@altlinux.ru> 2.7.5-alt1 - New upstream release - Converted to rpm-build-java macros * Mon Jun 07 2004 Mikhail Zabaluev <mhz@altlinux.ru> 2.7.4-alt1 - New upstream release * Sat Apr 17 2004 Mikhail Zabaluev <mhz@altlinux.ru> 2.7.3-alt1 - New upstream release * Wed Sep 10 2003 Mikhail Zabaluev <mhz@altlinux.ru> 2.7.2-alt1 - Ported to ALT Linux from JPackage 2.7.2-2jpp