File gnu-regexp.spec of Package gnu-regexp

#
# spec file for package gnu-regexp (Version 1.1.4)
#
# Copyright (c) 2009 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/
#

# norootforbuild
# icecream 0


Name:           gnu-regexp
BuildRequires:  ant gnu-getopt java2-devel-packages xml-commons-apis
%define section free
Version:        1.1.4
Release:        267
Summary:        Java NFA regular expression engine
License:        LGPL-2.1+
Source0:        ftp://ftp.tralfamadore.com/pub/java/gnu.regexp-1.1.4.tar.gz
Source1:        %{name}.build.xml
Url:            http://www.cacas.org/java/gnu/regexp/
Group:          Development/Libraries/Java
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
The gnu-regexp package is a pure-Java implementation of a traditional
(non-POSIX) NFA regular expression engine. Its syntax can emulate many
popular development tools, including awk, sed, emacs, perl and grep.
For a relatively complete list of supported and non-supported syntax,
refer to the syntax and usage notes.



%package demo
License:        LGPL-2.1+
Summary:        Java NFA regular expression engine (demo and samples)
Requires:       %{name} = %{version}-%{release}
Requires:       gnu-getopt
Group:          Development/Libraries/Java

%description demo
Demonstrations and samples for gnu-regexp.



%package javadoc
License:        LGPL-2.1+
PreReq:         coreutils
Summary:        Java NFA regular expression engine (documentation)
Group:          Development/Libraries/Java

%description javadoc
Javadoc for gnu-regexp.



%prep
%setup -q -n gnu.regexp-1.1.4
%__cp -a %{SOURCE1} build.xml
# remove all binary libs
find . -name "*.jar" -exec %__rm -f {} \;

%build
export CLASSPATH=$(build-classpath gnu.getopt)
%ant jar javadoc

%install
# jars
%__mkdir_p %{buildroot}%{_javadir}
%__cp -a build/lib/gnu.regexp.jar %{buildroot}%{_javadir}/gnu.regexp-%{version}.jar
(cd %{buildroot}%{_javadir} && ln -sf gnu.regexp-%{version}.jar %{name}-%{version}.jar && \
    for jar in *-%{version}*; do %__ln_s ${jar} `echo $jar| sed "s|-%{version}||g"`; done)
# demo
%__mkdir_p %{buildroot}%{_datadir}/gnu.regexp/gnu/regexp/util
%__cp -a build/classes/gnu/regexp/util/*.class \
  %{buildroot}%{_datadir}/gnu.regexp/gnu/regexp/util
# javadoc
%__mkdir_p %{buildroot}%{_javadocdir}/gnu.regexp-%{version}
%__cp -a build/api/* %{buildroot}%{_javadocdir}/gnu.regexp-%{version}
(cd %{buildroot}%{_javadocdir} && %__ln_s gnu.regexp-%{version} gnu.regexp)

%clean
rm -rf $RPM_BUILD_ROOT

%post javadoc
%__rm -f %{_javadocdir}/gnu.regexp
%__ln_s gnu.regexp-%{version} %{_javadocdir}/gnu.regexp

%postun javadoc
if [ $1 -eq 0 ]; then
  %__rm -f %{_javadocdir}/gnu.regexp
fi

%files
%defattr(0644,root,root,0755)
%doc COPYING COPYING.LIB README TODO docs/*.html
%{_javadir}/*

%files demo
%defattr(0644,root,root,0755)
%{_datadir}/gnu.regexp

%files javadoc
%defattr(0644,root,root,0755)
%dir %{_javadocdir}/gnu.regexp-%{version}
%{_javadocdir}/gnu.regexp-%{version}/*
%ghost %dir %{_javadocdir}/gnu.regexp

%changelog
* Thu Apr 23 2009 mvyskocil@suse.cz
- add gnu-regexp jars to make build-classpath works as expected
* Mon Sep 25 2006 skh@suse.de
- don't use icecream
- use source="1.4" and target="1.4" for build with java 1.5
* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Tue Oct 25 2005 ro@suse.de
- fix demo package requires
* Mon Oct 17 2005 jsmeix@suse.de
- Current version 1.1.4 from JPackage.org