SHA256
1
0
forked from pool/jflex
jflex/jflex.spec
2013-12-02 12:44:35 +00:00

169 lines
4.9 KiB
RPMSpec

#
# spec file for package jflex
#
# Copyright (c) 2013 SUSE LINUX Products 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 with() %{expand:%%{?with_%{1}:1}%%{!?with_%{1}:0}}
%define without() %{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}}
%define bcond_with() %{expand:%%{?_with_%{1}:%%global with_%{1} 1}}
%define bcond_without() %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}}
%define _without_bootstrap 1
%bcond_with bootstrap
%define section free
Name: jflex
# This line is not a comment, please do not remove it!
#%(sh %{_sourcedir}/jpackage-bootstrap-prepare.sh %{_sourcedir} %{name})
Version: 1.4.3
Release: 0
Summary: Lexical Analyzer Generator for Java
License: GPL-2.0+
Group: Development/Libraries/Java
Url: http://www.jflex.de/
Source0: http://www.jflex.de/jflex-%{version}.tar.bz2
Source1: jflex.script
Patch0: jflex-javac-no-target.patch
Patch1: jflex-no-cup-no-jflex.patch
Patch2: jflex-classpath.patch
Patch3: jflex-lex-scan.patch
Patch4: jflex-byaccj-utl.patch
#PATCH-FIX-OPENSUSE: make AllTests.main empty, code was not compatible with junit 4
Patch5: jflex-junit4.patch
Requires: java_cup
Requires: javapackages-tools
BuildRequires: ant
BuildRequires: java-cup-bootstrap
%if %without bootstrap
BuildRequires: jflex-bootstrap
BuildRequires: junit
Conflicts: jflex-bootstrap
%else
Conflicts: jflex
%endif
BuildRequires: java-1_5_0-gcj-compat-devel
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
JFlex is a lexical analyzer generator for Java written in Java. It is
also a rewrite of the very useful tool JLex which was developed by
Elliot Berk at Princeton University. As Vern Paxson states for his C/C++
tool flex: they do not share any code though.
Design goals The main design goals of JFlex are:
* Full unicode support
* Fast generated scanners
* Fast scanner generation
* Convenient specification syntax
* Platform independence
* JLex compatibility
%if %without bootstrap
%package doc
Summary: Documentation and examples for %{name}
Group: Development/Libraries/Java
%description doc
JFlex is a lexical analyzer generator for Java written in Java. It is
also a rewrite of the very useful tool JLex which was developed by
Elliot Berk at Princeton University. As Vern Paxson states for his C/C++
tool flex: they do not share any code though.
Design goals The main design goals of JFlex are:
* Full unicode support
* Fast generated scanners
* Fast scanner generation
* Convenient specification syntax
* Platform independence
* JLex compatibility
This package contains documentation and examples for %{name}
%endif
%prep
%setup -q -n jflex-%{version}
%{__perl} -pi -e 's/\r$//g' examples/standalone/sample.inp
%{__rm} -rf src/java_cup
find . -name '*.jar' | xargs -t %{__rm}
%if %without bootstrap
export CLASSPATH=$(build-classpath java-cup java-cup-runtime junit jflex)
export OPT_JAR_LIST=:
pushd src
%ant realclean
%ant jflex
popd
%endif
%patch0 -p1
%if %with bootstrap
%patch1 -p1
echo `pwd`
rm -rf src/JFlex/tests
%else # with bootstrap
# You must use Re jflex.spec and have a java-cup and jflex installed
%patch2 -p1
#%patch3 -p1
%patch4 -p1
%endif
%patch5 -p1
%build
pushd src
%if %without bootstrap
export CLASSPATH=$(build-classpath java-cup java-cup-runtime junit jflex antlr-bootstrap)
%else
export CLASSPATH=$(build-classpath java-cup java-cup-runtime junit antlr-bootstrap)
%endif
export OPT_JAR_LIST=:
echo `pwd`
%ant jar
popd
%install
# jar
%{__mkdir_p} %{buildroot}%{_javadir}
%{__cp} -a lib/JFlex.jar %{buildroot}%{_javadir}/jflex-%{version}.jar
(cd %{buildroot}%{_javadir} && for jar in *-%{version}*; do %{__ln_s} ${jar} `echo $jar| sed "s|-%{version}||g"`; done)
# compatibility symlink
(cd %{buildroot}%{_javadir} && %{__ln_s} jflex.jar JFlex.jar)
%{__mkdir_p} %{buildroot}%{_bindir}
%{__install} -p -m 0755 %{SOURCE1} %{buildroot}%{_bindir}/jflex
%files
%defattr(0644,root,root,0755)
%doc COPYRIGHT src/README src/changelog
%attr(0755,root,root) %{_bindir}/jflex
%{_javadir}/jflex.jar
%{_javadir}/jflex-%{version}.jar
%{_javadir}/JFlex.jar
%if %without bootstrap
%files doc
%defattr(0644,root,root,0755)
%doc examples doc
%endif
%changelog