antlr/antlr.spec

350 lines
10 KiB
RPMSpec
Raw Permalink Normal View History

%define repodir %{_javadir}/repository.jboss.com/antlr/2.7.6-brew
%define repodirlib %{repodir}/lib
%define repodirsrc %{repodir}/src
Name: antlr
Version: 2.7.7
Release: 9mamba
Summary: ANother Tool for Language Recognition
Group: Development/Tools
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: http://antlr.org/
Source0: http://www.antlr2.org/download/antlr-%{version}.tar.gz
Source1: antlr-2.7.7-build.xml
#http://www.antlr.org/share/1069557132934/makefile.gcj
#Source2: makefile.gcj
Source3: http://www.ibiblio.org/maven/antlr/poms/antlr-%{version}.pom
Source4: java-component-info3.xml
Patch0: antlr-2.7.5-gcc4.patch
Patch1: antlr-2.7.7-includestrings.patch
# requires jedit
Patch2: antlr-2.7.7-jedit.patch
Patch3: antlr-2.7.7-newgcc.patch
License: Public Domain
## AUTOBUILDREQ-BEGIN
## AUTOBUILDREQ-END
BuildRequires: apache-ant
BuildRequires: doxygen
BuildRequires: graphviz
BuildRequires: jpackage-utils
BuildRequires: libpython-devel
BuildRequires: mono-core
BuildRequires: mono-winforms
#BuildRequires: java-gcj-compat
#BuildRequires: gcc-java
#BuildRequires: java-gcj-compat
#BuildRequires: libgcj4-devel
#BuildRequires: /usr/bin/javadoc
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description
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 Java, C#, C++, or Python actions. ANTLR provides excellent support for tree construction, tree walking, and translation.
%package manual
Group: Development/Tools
Summary: Manual for %{name}
%description manual
ANother Tool for Language Recognition.
This package contains documentation for %{name}.
%package javadoc
Group: Documentation
Summary: Javadoc for %{name}
%description javadoc
ANother Tool for Language Recognition.
This package contains javadoc for %{name}.
%package C++
Group: Development/Libraries
Summary: C++ run-time support for ANTLR-generated parsers
%description C++
ANother Tool for Language Recognition.
This package contains C++ run-time support for ANTLR-generated parsers
%package C++-doc
Group: Documentation
Summary: Development documentation for the C++ bindings for ANTLR-generated parsers
%description C++-doc
ANother Tool for Language Recognition.
This package contains development documentation for the C++ bindings for ANTLR-generated parsers
%package -n python-antlr
Group: Development/Libraries/Python
Summary: Python run-time support for ANTLR-generated parsers
%description -n python-antlr
ANother Tool for Language Recognition.
This package contains Python run-time support for ANTLR-generated parsers
%package repolib
Group: Development/Libraries/Java
Summary: Artifacts to be uploaded to a repository library
%description repolib
ANother Tool for Language Recognition.
This package contains artifacts to be uploaded to a repository library.
This package is not meant to be installed but so its contents can be extracted through rpm2cpio.
%package sharp
Group: Development/Libraries
Summary: C# run-time support for ANTLR-generated parsers
%description sharp
ANother Tool for Language Recognition.
This package contains C# run-time support for ANTLR-generated parsers
%package gcj
Summary: GCJ %{name} support
Group: System/Libraries/Java
Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release}
Requires: java-gcj-compat
Requires: jpackage-utils
%description gcj
%{name} - ANother Tool for Language Recognition.
This package contains GCJ %{name} support.
%prep
%setup -q
#-D -T
#:<< ____EOF
#%patch0 -p1
#%patch1 -p1
#%patch2 -p1
%patch3 -p1
find . -type f -name "*.class" -exec rm -f {} \;
for j in $(find -name "*.jar"); do
mv $j $j.no
done
cp -p %{S:1} build.xml
sed -i 's/\r//' LICENSE.txt
%{__perl} -pi -e 's|"doc/|"%{_docdir}/%{name}-manual-%{version}/|g' install.html
for p in $(find . -name "*.py"); do
sed -i 's|#!/usr/bin/python|#!%{__python}|' $p
sed -i 's|#!/usr/bin/env python|#!%{__python}|' $p
sed -i 's|#!python|#!%{__python}|' $p
sed -i 's|#!/usr/local/bin/python2.1|#!%{__python}|' $p
sed -i 's|#!/usr/local/bin/python|#!%{__python}|' $p
done
sed -i 's|#!/usr/bin/env python|#!%{__python}|' scripts/pyinst.sh.in
%patch2 -p1
%build
export JAVA_HOME=%{java_home}
ant -Dj2se.apidoc=%{_javadocdir}/java
cp work/lib/antlr.jar .
export CLASSPATH=.
%configure \
--disable-examples \
--with-bootclasspath=$JAVA_HOME/jre/lib/rt.jar \
--with-java=$JAVA_HOME/bin/java \
--with-javac=$JAVA_HOME/bin/javac \
--with-jar=$JAVA_HOME/bin/jar \
--with-python=%{__python}
rm antlr.jar
make CXXFLAGS="${CXXFLAGS:-%optflags} -fPIC"
%ifnarch arm
pushd lib/cpp
doxygen doxygen.cfg
find gen_doc -type f -exec chmod 0644 {} \;
popd
%endif
#cd lib/python
# %{__python} setup.py build
#cd ../../
%install
[ "%{buildroot}" != / ] && rm -rf %{buildroot}
%makeoldinstall
mkdir -p %{buildroot}%{_javadir}
mkdir -p %{buildroot}%{_datadir}/maven2/poms
install -pm 644 work/lib/antlr.jar \
%{buildroot}%{_javadir}/antlr-%{version}.jar
#cd lib/python
# %{__python} setup.py install -O1 --skip-build --root %{buildroot}
#cd ../..
rm -rf %{buildroot}%{_libdir}/antlr.jar
ln -sf ../share/java/antlr-%{version}.jar %{buildroot}%{_libdir}/antlr.jar
%{_bindir}/aot-compile-rpm
(
cd %{buildroot}%{_javadir}/
for jar in *-%{version}.jar; do
ln -sf ${jar} `echo $jar| sed "s|-%{version}||g"`
done
)
install -m 644 %{SOURCE3} %{buildroot}%{_datadir}/maven2/poms/JPP-antlr.pom
%add_to_maven_depmap antlr antlr %{version} JPP antlr
mkdir -p %{buildroot}%{_javadocdir}/antlr-%{version}
cp -pr work/api/* %{buildroot}%{_javadocdir}/antlr-%{version}
ln -s antlr-%{version} %{buildroot}%{_javadocdir}/antlr
rm -rf %{buildroot}%{_docdir}/
rm doc/{Makefile,Makefile.in}
chmod 0644 doc/*
mkdir -p %{buildroot}%{_datadir}/jedit/modes
cp -p extras/antlr-jedit.xml %{buildroot}%{_datadir}/jedit/modes/antlr.xml
mkdir -p %{buildroot}%{repodir}
mkdir -p %{buildroot}%{repodirlib}
install -p -m 644 %{SOURCE4} %{buildroot}%{repodir}/component-info.xml
tag=`echo %{name}-%{version}-%{release} | sed 's|\.|_|g'`
sed -i "s/@TAG@/$tag/g" %{buildroot}%{repodir}/component-info.xml
sed -i "s/@NAME@/antlr-component-info/g" %{buildroot}%{repodir}/component-info.xml
sed -i "s/@ID@/antlr/g" %{buildroot}%{repodir}/component-info.xml
sed -i "s/@VERSION@/%{version}%{rel}-brew/g" %{buildroot}%{repodir}/component-info.xml
sed -i "s/@LICENSE@/antlr/g" %{buildroot}%{repodir}/component-info.xml
sed -i "s|@PROJECTHOME@|%{url}|g" %{buildroot}%{repodir}/component-info.xml
sed -i "s/@DESCRIPTION@/ANother Tool for Language Recognition/g" %{buildroot}%{repodir}/component-info.xml
sed -i "s/@ARTIFACTID@/antlr.jar/g" %{buildroot}%{repodir}/component-info.xml
sed -i "s/@INCLUDEINPUT@/antlr.jar/g" %{buildroot}%{repodir}/component-info.xml
mkdir -p %{buildroot}%{repodirsrc}
install -pm 644 %{PATCH0} %{buildroot}%{repodirsrc}
install -pm 644 %{PATCH1} %{buildroot}%{repodirsrc}
install -pm 644 %{PATCH2} %{buildroot}%{repodirsrc}
install -pm 644 %{PATCH3} %{buildroot}%{repodirsrc}
cp %{SOURCE0} %{buildroot}%{repodirsrc}
cp %{SOURCE1} %{buildroot}%{repodirsrc}
cp -p %{buildroot}%{_javadir}/antlr-%{version}.jar %{buildroot}%{repodirlib}/antlr.jar
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%post
%update_maven_depmap
%postun
%update_maven_depmap
%files
%defattr(-,root,root)
%{_bindir}/antlr
%{_javadir}/antlr-%{version}.jar
%{_javadir}/antlr.jar
%{_libdir}/antlr.jar
%dir %{_datadir}/antlr-%{version}/
%{_datadir}/antlr-%{version}/antlr-mode.el
%{_datadir}/antlr-%{version}/antlr.jar
%{_datadir}/antlr-%{version}/antlr-jedit.xml
%{_datadir}/jedit/modes/antlr.xml
%{_datadir}/maven2/poms
%{_mavendepmapfragdir}
%doc LICENSE.txt README.txt
%post gcj
/sbin/ldconfig
if [ -x %{_bindir}/rebuild-gcj-db ]; then
%{_bindir}/rebuild-gcj-db
fi
%postun gcj
/sbin/ldconfig
if [ -x %{_bindir}/rebuild-gcj-db ]; then
%{_bindir}/rebuild-gcj-db
fi
%files gcj
%defattr(-,root,root)
%{_libdir}/gcj/antlr/antlr*.jar.db
%{_libdir}/gcj/antlr/antlr*.jar.so
%files manual
%defattr(-,root,root)
%doc doc
%files C++
%defattr(-,root,root)
%{_bindir}/antlr-config
%dir %{_includedir}/antlr
%{_includedir}/antlr/*.hpp
%{_libdir}/libantlr.a
%if "%{stage1}" != "1"
%files C++-doc
%defattr(-,root,root)
%doc lib/cpp/gen_doc/html/
%endif
%files -n python-antlr
%defattr(-,root,root)
%{_libdir}/antlr.py
%{_sbindir}/pyantlr.sh
%{_datadir}/antlr-%{version}/*.py
#%dir %{python_sitearch}/antlr
#%{python_sitearch}/antlr/*.py*
#%{python_sitearch}/antlr-*-py%{python_version}.egg-info
%files sharp
%defattr(-,root,root)
%{_libdir}/antlr.astframe.dll
%{_libdir}/antlr.runtime.dll
%{_datadir}/antlr-%{version}/antlr.*.dll
%files javadoc
%defattr(-,root,root)
%{_javadocdir}/antlr-%{version}
%{_javadocdir}/antlr
%files repolib
%defattr(-,root,root)
%{repodir}
%changelog
* Fri Feb 25 2011 gil <puntogil@libero.it> 2.7.7-9mamba
- rebuilt with java-gcj-compat 1.0.80-20mamba support
* Thu Nov 25 2010 gil <puntogil@libero.it> 2.7.7-8mamba
- rebuilt devel
* Sun Aug 29 2010 gil <puntogil@libero.it> 2.7.7-7mamba
- added new sub package: C++ C++-doc python-antlr sharp
* Thu Nov 12 2009 gil <puntogil@libero.it> 2.7.7-6mamba
- new sub package antlr-repolib
* Sat Sep 05 2009 gil <puntogil@libero.it> 2.7.7-5mamba
- rebuilt
* Sat May 30 2009 gil <puntogil@libero.it> 2.7.7-4mamba
- add maven2 pom
* Sat May 30 2009 gil <puntogil@libero.it> 2.7.7-3mamba
- linked jar files in %{_libdir}
* Wed Mar 11 2009 gil <puntogil@libero.it> 2.7.7-2mamba
- moved the jar files in %{_javadir}
* Fri Feb 20 2009 gil <puntogil@libero.it> 2.7.7-1mamba
- update to 2.7.7
- added packages: manual, javadoc
- added mono support
- added http://www.jedit.org/ support
* Wed Aug 17 2005 Silvan Calarco <silvan.calarco@mambasoft.it> 2.7.5-1qilnx
- package created by autospec