File gnu-regexp.spec of Package gnu-regexp

#
# spec file for package gnu-regexp
#
# 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/
#
# icecream 0


Name:           gnu-regexp
BuildRequires:  ant
BuildRequires:  gnu-getopt
BuildRequires:  java2-devel-packages
BuildRequires:  xml-commons-apis
%define section free
Version:        1.1.4
Release:        0
Summary:        Java NFA regular expression engine
License:        LGPL-2.1+
Group:          Development/Libraries/Java
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/
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
Summary:        Java NFA regular expression engine (demo and samples)
Group:          Development/Libraries/Java
Requires:       %{name} = %{version}-%{release}
Requires:       gnu-getopt

%description demo
Demonstrations and samples for gnu-regexp.



%package javadoc
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 %{_javadocdir}/gnu.regexp

%changelog
openSUSE Build Service is sponsored by