SHA256
1
0
forked from pool/antlr
antlr/antlr.spec

208 lines
6.9 KiB
RPMSpec

#
# spec file for package antlr
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define section free
Name: antlr
Version: 2.7.7
Release: 0
Summary: Another Tool for Language Recognition
License: GPL-2.0+ and SUSE-Public-Domain and MIT
Group: Development/Tools/Other
Url: http://www.antlr.org/
Source0: antlr-%{version}.tar.bz2
Source1: %{name}-build.xml
Source2: %{name}-script
Source3: makefile.gcj
Source1000: antlr-rpmlintrc
Patch0: %{name}-jedit.patch
Patch1: gcc45fix.diff
Patch2: fix-docpath.diff
BuildRequires: ant
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: javapackages-tools
BuildRequires: xml-commons-apis
Requires: %{name}-java
Provides: %{name}-bootstrap = %{version}
Obsoletes: %{name}-bootstrap < %{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%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 java
Summary: ANother Tool for Language Recognition (Manual)
Group: Development/Tools/Other
Requires: java >= 1.6.0
BuildArch: noarch
%description java
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 provides the Java runtime for antlr
%package manual
Summary: ANother Tool for Language Recognition (Manual)
Group: Development/Tools/Other
BuildArch: noarch
%description manual
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 provides the manual and examples for antlr.
%package javadoc
Summary: ANother Tool for Language Recognition (Java Documentation)
Group: Development/Tools/Other
BuildArch: noarch
%description javadoc
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 provides the Javadoc for antlr.
%package devel
Summary: ANother Tool for Language Recognition (c++ runtime)
Group: Development/Tools/Other
Requires: antlr
%description 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 provides the C++ runtime (libantlr.a) and a headers files
of antlr
%package -n python-%{name}
Summary: ANother Tool for Language Recognition (python runtime)
Group: Development/Tools/Other
Requires: antlr
%description -n python-%{name}
Python support for generating your Lexers, Parsers and TreeParsers in Python.
This feature extends the benefits of ANTLR's predicated-LL(k) parsing
technology to the Python language and platform.
ANTLR Python support was contributed (and is to be maintained) by Wolfgang
Haefelinger and Marq Kole.
%prep
%setup -q
# remove all binary libs
find . -name "*.jar" -exec rm -f {} \;
%patch0
cp -p %{SOURCE1} build.xml
#Fix the source so that it compiles with GCC 4.5
%patch1 -p1
#Ensure that the manuals are installed in the correct openSUSE docpath
%patch2
# check for license problematic files:
find | grep "\(ShowString.java$\|StreamConverter.java$\)" && exit 42
%build
ant \
-Dj2se.apidoc=%{_javadocdir}/java \
-Dant.build.javac.source=1.5 -Dant.build.javac.target=1.5
%configure
make -j1
%py_compile lib/python/antlr
%install
#### jars ###
install -d -m 0755 %{buildroot}%{_javadir}
cp -a work/lib/%{name}.jar %{buildroot}%{_javadir}/%{name}-%{version}.jar
(cd %{buildroot}%{_javadir} && for jar in *-%{version}.jar; do ln -s -f ${jar} `echo $jar| sed "s|-%{version}||g"`; done)
# compat symlink
install -d -m 0755 %{buildroot}%{_datadir}/%{name}-%{version}/
ln -s -f %{_javadir}/%{name}-%{version}.jar %{buildroot}%{_datadir}/%{name}-%{version}/%{name}.jar
### scripts ###
install -d -m 0755 %{buildroot}%{_bindir}/
install -m 0755 %{SOURCE2} %{buildroot}%{_bindir}/%{name}
install -m 0755 scripts/%{name}-config %{buildroot}%{_bindir}/
### javadoc ###
install -d -m 0755 %{buildroot}%{_javadocdir}/%{name}
cp -ar work/api/* %{buildroot}%{_javadocdir}/%{name}
### python runtime ###
install -d -m 0755 %{buildroot}%{py_sitedir}/%{name}
cp -a lib/python/antlr/* %{buildroot}%{py_sitedir}/%{name}
# compat symlink
ln -s -f %{py_sitedir}/%{name}/*.py %{buildroot}%{_datadir}/%{name}-%{version}/
ln -s -f %{py_sitedir}/%{name}/*.pyc %{buildroot}%{_datadir}/%{name}-%{version}/
### cpp runtime ###
install -m 0644 lib/cpp/src/lib%{name}.a %{buildroot}%{_libdir}
install -d -m 0755 %{buildroot}%{_includedir}/%{name}
install -m 0644 lib/cpp/%{name}/*hpp %{buildroot}%{_includedir}/%{name}
### find duplicates ###
find examples -type f | xargs chmod 0644
%fdupes -s examples
%files
%defattr(0644,root,root,0755)
%doc LICENSE.txt README.txt CHANGES.txt
%dir %{_datadir}/%{name}-%{version}
%defattr(0755,root,root,0755)
%{_bindir}/antlr
%{_bindir}/antlr-config
%files java
%defattr(0644,root,root,0755)
%dir %{_datadir}/%{name}-%{version}
%{_datadir}/%{name}-%{version}/*jar
%{_javadir}/%{name}*.jar
%files manual
%defattr(0644,root,root,0755)
%doc doc examples
%files javadoc
%defattr(0644,root,root,0755)
%doc %{_javadocdir}/%{name}
%files devel
%defattr(0644,root,root,0755)
%attr(755,root,root) %{_libdir}/libantlr.a
%{_includedir}/%{name}
%files -n python-%{name}
%defattr(-,root,root)
%dir %{_datadir}/%{name}-%{version}
%{_datadir}/%{name}-%{version}/*py
%{_datadir}/%{name}-%{version}/*pyc
%{py_sitedir}/%{name}
%changelog