From 128afbd32e6f042b17500675b2115f4268eabded Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milo=C5=A1=20Jakub=C3=AD=C4=8Dek?= Date: Wed, 28 Apr 2010 16:28:42 +0000 Subject: [PATCH] - Drop native build, alternatives, jedit, gcj bits and other jpackage crap - Disable debuginfo since we have only a static library. - Use %%global everywhere - Split the C++ bindings into a separate -C++ subpackage - Use -tool subpackage with Provide: antlr to make it possible to be noarch - Use sed instead of perl => drop BR: perl --- antlr-jedit.patch | 33 ----- antlr.spec | 299 ++++++++++++---------------------------------- makefile.gcj | 203 ------------------------------- 3 files changed, 75 insertions(+), 460 deletions(-) delete mode 100644 antlr-jedit.patch delete mode 100644 makefile.gcj diff --git a/antlr-jedit.patch b/antlr-jedit.patch deleted file mode 100644 index 9545750..0000000 --- a/antlr-jedit.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- extras/antlr-jedit.xml~ 2003-03-01 23:28:04.000000000 +0200 -+++ extras/antlr-jedit.xml 2003-03-01 23:38:17.000000000 +0200 -@@ -16,9 +16,6 @@ - - - -- -- -- - - - -@@ -97,9 +94,7 @@ - - - -- -- -- -+ - - /**/ - -@@ -149,9 +144,6 @@ - - - -- -- -- - - { - diff --git a/antlr.spec b/antlr.spec index 46265b4..142cbe1 100644 --- a/antlr.spec +++ b/antlr.spec @@ -1,78 +1,32 @@ -# 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. -# +%global debug_package %{nil} +# since we have only a static library -%global gcj_support 0 -%global build_jedit %{?_with_jedit:1}%{!?_with_jedit:0} - -%global section free -%global native %{?_with_native:1}%{!?_with_native:0} - -Summary: ANother Tool for Language Recognition -Name: antlr -Version: 2.7.7 -Release: 8%{?dist} -Epoch: 0 -License: Public Domain -URL: http://www.antlr.org/ -Group: Development/Code Generators +Summary: ANother Tool for Language Recognition +Name: antlr +Version: 2.7.7 +Release: 9%{?dist} +Epoch: 0 +License: Public Domain +URL: http://www.antlr.org/ +Group: Development/Tools #http://www.antlr.org/download/antlr-%{version}.tar.gz -Source0: antlr-%{version}-RHCLEAN.tar.gz -Source1: %{name}-build.xml -Source2: %{name}-script -#http://www.antlr.org/share/1069557132934/makefile.gcj -Source3: makefile.gcj -Patch0: %{name}-jedit.patch -Patch1: %{name}-%{version}-newgcc.patch -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot +Source0: antlr-%{version}-RHCLEAN.tar.gz +Source1: %{name}-build.xml +Source2: %{name}-script +Patch1: %{name}-%{version}-newgcc.patch +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot -%if %{native} -BuildRequires: %{_bindir}/gcj, %{__make} -%else -BuildRequires: ant - -%ifnarch s390 s390x ppc64 sparc64 -BuildRequires: mono-core -BuildRequires: mono-winforms +%ifnarch sparc64 +BuildRequires: mono-core +BuildRequires: mono-winforms %endif +BuildRequires: ant +BuildRequires: java-javadoc +BuildRequires: jpackage-utils +BuildRequires: java-devel -BuildRequires: %{__perl}, java-javadoc -Requires: jpackage-utils -Requires(post): %{_sbindir}/update-alternatives -Requires(postun): %{_sbindir}/update-alternatives -%endif - -%if %{gcj_support} -BuildRequires: java-gcj-compat-devel -Requires(post): java-gcj-compat -Requires(postun): java-gcj-compat -%endif +Requires: jpackage-utils +Requires: java %description ANTLR, ANother Tool for Language Recognition, (formerly PCCTS) is a @@ -81,180 +35,89 @@ 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 +%package tool +Group: Development/Tools +Summary: ANother Tool for Language Recognition +Provides: %{name} = %{version}-%{release} +BuildArch: noarch -%if %{gcj_support} -BuildRequires: java-gcj-compat-devel -Requires(post): java-gcj-compat -Requires(postun): java-gcj-compat -%endif - -%description native +%description tool 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. +parsers]. -%package manual -Group: Development/Code Generators -Summary: Manual for %{name} +%package manual +Group: Development/Tools +Summary: Manual for %{name} +BuildArch: noarch -%description manual +%description manual Documentation for %{name}. -%package javadoc -Group: Development/Documentation -Summary: Javadoc for %{name} -Requires(post): /bin/rm,/bin/ln -Requires(postun): /bin/rm +%package javadoc +Group: Documentation +Summary: Javadoc for %{name} +BuildArch: noarch -%description javadoc +%description javadoc Javadoc for %{name}. -%if %{build_jedit} -%package jedit -Group: Text Editors -Summary: ANTLR mode for jEdit -Requires: jedit >= 0:4.1 +%package C++ +Group: Development/Libraries +Summary: C++ bindings for antlr2 generated parsers +Provides: antlr-static = %{version}-%{release} -%description jedit -ANTLR mode for jEdit. To enable this mode, insert the following into your -%{_datadir}/jedit/modes/catalog: - - -%endif +%description C++ +This package provides a static C++ library for parsers generated by ANTLR2. %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 %patch1 %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 CXXFLAGS="${CXXFLAGS} -fPIC" +make CXXFLAGS="${CXXFLAGS} -fPIC" DEBUG=1 verbose=1 find . -type f > /tmp/antlr.filelist -rm antlr.jar # no longer needed -%endif +rm antlr.jar # no longer needed %install rm -rf $RPM_BUILD_ROOT +%global headers %{_includedir}/%{name} +mkdir -p $RPM_BUILD_ROOT{%{headers},%{_libdir},%{_bindir}} -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 +install -p -m 755 %{SOURCE2} $RPM_BUILD_ROOT%{_bindir}/antlr # 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} +install -p -m 644 lib/cpp/antlr/*.hpp $RPM_BUILD_ROOT%{headers} +install -p -m 644 lib/cpp/src/libantlr.a $RPM_BUILD_ROOT%{_libdir} +install -p -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 -%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 - - -%if %{gcj_support} -%{_bindir}/aot-compile-rpm -%endif - %clean rm -rf $RPM_BUILD_ROOT - -%post -%{_sbindir}/update-alternatives --install %{_bindir}/antlr \ - %{name} %{_bindir}/antlr-java 10 - -%if %{gcj_support} -if [ -x %{_bindir}/rebuild-gcj-db ] -then - %{_bindir}/rebuild-gcj-db -fi -%endif - -%postun -if [ $1 -eq 0 ] ; then - %{_sbindir}/update-alternatives --remove %{name} %{_bindir}/antlr-java -fi - -%if %{native} -%if %{gcj_support} -if [ -x %{_bindir}/rebuild-gcj-db ] -then - %{_bindir}/rebuild-gcj-db -fi -%endif - -%post native -%{_sbindir}/update-alternatives --install %{_bindir}/antlr \ - %{name} %{_bindir}/antlr-native 20 - -%if %{gcj_support} -if [ -x %{_bindir}/rebuild-gcj-db ] -then - %{_bindir}/rebuild-gcj-db -fi -%endif - -%postun native -if [ $1 -eq 0 ] ; then - %{_sbindir}/update-alternatives --remove %{name} %{_bindir}/antlr-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} @@ -264,48 +127,36 @@ if [ $1 -eq 0 ]; then %{__rm} -f %{_javadocdir}/%{name} fi -%if %{native} -%files native -%defattr(0644,root,root,0755) -%doc INSTALL.txt LICENSE.txt -%defattr(0755,root,root,0755) -%ghost %{_bindir}/antlr -%{_bindir}/antlr-native - -%else -%files -%defattr(0644,root,root,0755) +%files tool +%defattr(-,root,root,-) %doc INSTALL.txt LICENSE.txt %{_javadir}/%{name}*.jar +%{_bindir}/antlr-config +%{_bindir}/antlr + +%files C++ +%defattr(-,root,root,-) %{headers} %{_libdir}/libantlr.a -%defattr(0755,root,root,0755) -%ghost %{_bindir}/antlr -%{_bindir}/antlr-config -%{_bindir}/antlr-java - -%if %{gcj_support} -%attr(-,root,root) %{_libdir}/gcj/%{name} -%endif %files manual -%defattr(0644,root,root,0755) +%defattr(-,root,root,-) %doc doc/* %files javadoc -%defattr(0644,root,root,0755) +%defattr(-,root,root,-) %doc %{_javadocdir}/%{name}-%{version} -%ghost %doc %{_javadocdir}/%{name} - -%if %{build_jedit} -%files jedit -%defattr(0644,root,root,0755) -%{_datadir}/jedit/modes/* -%endif -%endif - +%doc %{_javadocdir}/%{name} %changelog +* Tue Apr 27 2010 Miloš Jakubíček - 0:2.7.7-9 +- Drop native build, alternatives, jedit, gcj bits and other jpackage crap +- Disable debuginfo since we have only a static library. +- Use %%global everywhere +- Split the C++ bindings into a separate -C++ subpackage +- Use -tool subpackage with Provide: antlr to make it possible to be noarch +- Use sed instead of perl => drop BR: perl + * Tue Apr 20 2010 Orion Poplawski 0:2.7.7-8 - Cannot be noarch @@ -370,7 +221,7 @@ fi * Wed Jul 19 2006 Deepak Bhole = 0:2.7.6-3jpp_2fc - From gbenson@redhat: -- Omit the jedit subpackage to fix dependencies. +- Omit the jedit subpackage to fix dependencies. * Wed Jul 19 2006 Deepak Bhole = 0:2.7.6-3jpp_1fc - Added conditional native compilation. @@ -395,7 +246,7 @@ fi - Update to 2.7.3. - Include gcj build option and a native subpackage, build using "--with native" to get that. -- Add %{_bindir}/antlr alternative. +- Add %%{_bindir}/antlr alternative. * Mon Dec 15 2003 Ville Skyttä - 0:2.7.2-3jpp - Add non-versioned javadoc dir symlink. diff --git a/makefile.gcj b/makefile.gcj deleted file mode 100644 index d7ca46d..0000000 --- a/makefile.gcj +++ /dev/null @@ -1,203 +0,0 @@ -# Use this file to compile the antlr tool in a static executable using the -# GNU gcj compiler. -# Author: Luca Di Gaspero (luca.digaspero@diegm.uniud.it) -# http://www.diegm.uniud.it/digaspero/ -# Usage: make -f makefile.gcj -GCJ = gcj -COMPOPTS = -O3 -SOURCES=antlr/ActionElement.java \ - antlr/actions/cpp/ActionLexer.java \ - antlr/actions/cpp/ActionLexerTokenTypes.java \ - antlr/actions/java/ActionLexer.java \ - antlr/actions/java/ActionLexerTokenTypes.java \ - antlr/ActionTransInfo.java \ - antlr/Alternative.java \ - antlr/AlternativeBlock.java \ - antlr/AlternativeElement.java \ - antlr/ANTLRError.java \ - antlr/ANTLRException.java \ - antlr/ANTLRGrammarParseBehavior.java \ - antlr/ANTLRHashString.java \ - antlr/ANTLRLexer.java \ - antlr/ANTLRParser.java \ - antlr/ANTLRStringBuffer.java \ - antlr/ANTLRTokdefLexer.java \ - antlr/ANTLRTokdefParser.java \ - antlr/ANTLRTokdefParserTokenTypes.java \ - antlr/ANTLRTokenTypes.java \ - antlr/ASTFactory.java \ - antlr/ASTIterator.java \ - antlr/ASTNULLType.java \ - antlr/ASTPair.java \ - antlr/ASTVisitor.java \ - antlr/BaseAST.java \ - antlr/BlockContext.java \ - antlr/BlockEndElement.java \ - antlr/BlockWithImpliedExitPath.java \ - antlr/ByteBuffer.java \ - antlr/CharBuffer.java \ - antlr/CharFormatter.java \ - antlr/CharLiteralElement.java \ - antlr/CharQueue.java \ - antlr/CharRangeElement.java \ - antlr/CharScanner.java \ - antlr/CharStreamException.java \ - antlr/CharStreamIOException.java \ - antlr/CodeGenerator.java \ - antlr/collections/AST.java \ - antlr/collections/ASTEnumeration.java \ - antlr/collections/Enumerator.java \ - antlr/collections/impl/ASTArray.java \ - antlr/collections/impl/ASTEnumerator.java \ - antlr/collections/impl/BitSet.java \ - antlr/collections/impl/IndexedVector.java \ - antlr/collections/impl/IntRange.java \ - antlr/collections/impl/LLCell.java \ - antlr/collections/impl/LLEnumeration.java \ - antlr/collections/impl/LList.java \ - antlr/collections/impl/Vector.java \ - antlr/collections/impl/VectorEnumeration.java \ - antlr/collections/impl/VectorEnumerator.java \ - antlr/collections/List.java \ - antlr/collections/Stack.java \ - antlr/CommonAST.java \ - antlr/CommonASTWithHiddenTokens.java \ - antlr/CommonHiddenStreamToken.java \ - antlr/CommonToken.java \ - antlr/CppBlockFinishingInfo.java \ - antlr/CppCharFormatter.java \ - antlr/CppCodeGenerator.java \ - antlr/debug/DebuggingCharScanner.java \ - antlr/debug/DebuggingInputBuffer.java \ - antlr/debug/DebuggingParser.java \ - antlr/debug/Event.java \ - antlr/debug/GuessingEvent.java \ - antlr/debug/InputBufferAdapter.java \ - antlr/debug/InputBufferEvent.java \ - antlr/debug/InputBufferEventSupport.java \ - antlr/debug/InputBufferListener.java \ - antlr/debug/InputBufferReporter.java \ - antlr/debug/ListenerBase.java \ - antlr/debug/LLkDebuggingParser.java \ - antlr/debug/MessageAdapter.java \ - antlr/debug/MessageEvent.java \ - antlr/debug/MessageListener.java \ - antlr/debug/NewLineEvent.java \ - antlr/debug/NewLineListener.java \ - antlr/debug/ParserAdapter.java \ - antlr/debug/ParserController.java \ - antlr/debug/ParserEventSupport.java \ - antlr/debug/ParserListener.java \ - antlr/debug/ParserMatchAdapter.java \ - antlr/debug/ParserMatchEvent.java \ - antlr/debug/ParserMatchListener.java \ - antlr/debug/ParserReporter.java \ - antlr/debug/ParserTokenAdapter.java \ - antlr/debug/ParserTokenEvent.java \ - antlr/debug/ParserTokenListener.java \ - antlr/debug/SemanticPredicateAdapter.java \ - antlr/debug/SemanticPredicateEvent.java \ - antlr/debug/SemanticPredicateListener.java \ - antlr/debug/SyntacticPredicateAdapter.java \ - antlr/debug/SyntacticPredicateEvent.java \ - antlr/debug/SyntacticPredicateListener.java \ - antlr/debug/TraceAdapter.java \ - antlr/debug/TraceEvent.java \ - antlr/debug/TraceListener.java \ - antlr/debug/Tracer.java \ - antlr/DefaultFileLineFormatter.java \ - antlr/DefaultToolErrorHandler.java \ - antlr/DefineGrammarSymbols.java \ - antlr/DiagnosticCodeGenerator.java \ - antlr/DocBookCodeGenerator.java \ - antlr/DumpASTVisitor.java \ - antlr/ExceptionHandler.java \ - antlr/ExceptionSpec.java \ - antlr/FileCopyException.java \ - antlr/FileLineFormatter.java \ - antlr/Grammar.java \ - antlr/GrammarAnalyzer.java \ - antlr/GrammarAtom.java \ - antlr/GrammarElement.java \ - antlr/GrammarSymbol.java \ - antlr/HTMLCodeGenerator.java \ - antlr/ImportVocabTokenManager.java \ - antlr/InputBuffer.java \ - antlr/JavaBlockFinishingInfo.java \ - antlr/JavaCharFormatter.java \ - antlr/JavaCodeGenerator.java \ - antlr/LexerGrammar.java \ - antlr/LexerSharedInputState.java \ - antlr/LLkAnalyzer.java \ - antlr/LLkGrammarAnalyzer.java \ - antlr/LLkParser.java \ - antlr/Lookahead.java \ - antlr/MakeGrammar.java \ - antlr/MismatchedCharException.java \ - antlr/MismatchedTokenException.java \ - antlr/NameSpace.java \ - antlr/NoViableAltException.java \ - antlr/NoViableAltForCharException.java \ - antlr/OneOrMoreBlock.java \ - antlr/Parser.java \ - antlr/ParserGrammar.java \ - antlr/ParserSharedInputState.java \ - antlr/preprocessor/Grammar.java \ - antlr/preprocessor/GrammarFile.java \ - antlr/preprocessor/Hierarchy.java \ - antlr/preprocessor/Option.java \ - antlr/preprocessor/Preprocessor.java \ - antlr/preprocessor/PreprocessorLexer.java \ - antlr/preprocessor/PreprocessorTokenTypes.java \ - antlr/preprocessor/Rule.java \ - antlr/preprocessor/Tool.java \ - antlr/PreservingFileWriter.java \ - antlr/RecognitionException.java \ - antlr/RuleBlock.java \ - antlr/RuleEndElement.java \ - antlr/RuleRefElement.java \ - antlr/RuleSymbol.java \ - antlr/SemanticException.java \ - antlr/SimpleTokenManager.java \ - antlr/StringLiteralElement.java \ - antlr/StringLiteralSymbol.java \ - antlr/StringUtils.java \ - antlr/SynPredBlock.java \ - antlr/Token.java \ - antlr/TokenBuffer.java \ - antlr/TokenManager.java \ - antlr/TokenQueue.java \ - antlr/TokenRangeElement.java \ - antlr/TokenRefElement.java \ - antlr/TokenStream.java \ - antlr/TokenStreamBasicFilter.java \ - antlr/TokenStreamException.java \ - antlr/TokenStreamHiddenTokenFilter.java \ - antlr/TokenStreamIOException.java \ - antlr/TokenStreamRecognitionException.java \ - antlr/TokenStreamRetryException.java \ - antlr/TokenStreamSelector.java \ - antlr/TokenSymbol.java \ - antlr/Tool.java \ - antlr/ToolErrorHandler.java \ - antlr/TreeBlockContext.java \ - antlr/TreeElement.java \ - antlr/TreeParser.java \ - antlr/TreeParserSharedInputState.java \ - antlr/TreeSpecifierNode.java \ - antlr/TreeWalkerGrammar.java \ - antlr/Version.java \ - antlr/WildcardElement.java \ - antlr/ZeroOrMoreBlock.java -OBJFILES = $(SOURCES:%.java=%.o) - -all: cantlr - -cantlr: $(OBJFILES) - $(GCJ) --main=antlr.Tool $(OBJFILES) -o $@ - -%.o:%.java - $(GCJ) $(COMPOPTS) -c -o $@ $< - -clean: - rm -f $(OBJFILES)