File lucene.spec of Package lucene

#
# spec file for package lucene (Version 2.4.1)
#
# 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/
#


%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 with_db 1
%bcond_with             db
%define section  free
%define oname    lucene

Name:           lucene
Version:        2.4.1
Release:        4
Summary:        High-performance, full-featured text search engine
License:        Apache Software License ..
Group:          Development/Libraries/Java
Url:            http://lucene.apache.org/
# wget http://www.apache.org/dist/lucene/java/lucene-2.4.1-src.tar.bz2
# tar -xf lucene-2.4.1-src.tar.bz2
# find lucene-2.4.1/ -name '*jar' | xargs rm -rf
# tar -cjf lucene-2.4.1-src-nojars.tar.bz2  lucene-2.4.1/
Source0:        lucene-%{version}-src-nojars.tar.bz2
Source1:        http://repo1.maven.org/maven2/org/apache/lucene/lucene-analyzers/2.4.0/lucene-analyzers-2.4.0.pom
Source2:        http://repo1.maven.org/maven2/org/apache/lucene/lucene-ant/2.4.0/lucene-ant-2.4.0.pom
Source3:        http://repo1.maven.org/maven2/org/apache/lucene/lucene-bdb/2.4.0/lucene-bdb-2.4.0.pom
Source4:        http://repo1.maven.org/maven2/org/apache/lucene/lucene-bdb-je/2.4.0/lucene-bdb-je-2.4.0.pom
Source5:        http://repo1.maven.org/maven2/org/apache/lucene/lucene-benchmark/2.4.0/lucene-benchmark-2.4.0.pom
Source6:        http://repo1.maven.org/maven2/org/apache/lucene/lucene-contrib/2.4.0/lucene-contrib-2.4.0.pom
Source7:        http://repo1.maven.org/maven2/org/apache/lucene/lucene-core/2.4.0/lucene-core-2.4.0.pom
Source8:        http://repo1.maven.org/maven2/org/apache/lucene/lucene-demos/2.4.0/lucene-demos-2.4.0.pom
Source9:        http://repo1.maven.org/maven2/org/apache/lucene/lucene-highlighter/2.4.0/lucene-highlighter-2.4.0.pom
Source10:       http://repo1.maven.org/maven2/org/apache/lucene/lucene-lucli/2.4.0/lucene-lucli-2.4.0.pom
Source11:       http://repo1.maven.org/maven2/org/apache/lucene/lucene-memory/2.4.0/lucene-memory-2.4.0.pom
Source12:       http://repo1.maven.org/maven2/org/apache/lucene/lucene-misc/2.4.0/lucene-misc-2.4.0.pom
Source13:       http://repo1.maven.org/maven2/org/apache/lucene/lucene-parent/2.4.0/lucene-parent-2.4.0.pom
Source14:       http://repo1.maven.org/maven2/org/apache/lucene/lucene-queries/2.4.0/lucene-queries-2.4.0.pom
Source15:       http://repo1.maven.org/maven2/org/apache/lucene/lucene-regex/2.4.0/lucene-regex-2.4.0.pom
Source16:       http://repo1.maven.org/maven2/org/apache/lucene/lucene-snowball/2.4.0/lucene-snowball-2.4.0.pom
Source17:       http://repo1.maven.org/maven2/org/apache/lucene/lucene-spellchecker/2.4.0/lucene-spellchecker-2.4.0.pom
Source18:       http://repo1.maven.org/maven2/org/apache/lucene/lucene-surround/2.4.0/lucene-surround-2.4.0.pom
Source19:       http://repo1.maven.org/maven2/org/apache/lucene/lucene-swing/2.4.0/lucene-swing-2.4.0.pom
Source21:       http://repo1.maven.org/maven2/org/apache/lucene/lucene-wordnet/2.4.0/lucene-wordnet-2.4.0.pom
Source22:       http://repo1.maven.org/maven2/org/apache/lucene/lucene-xml-query-parser/2.4.0/lucene-xml-query-parser-2.4.0.pom
Patch0:         lucene-no-classpath-in-manifest.patch
Patch1:         lucene-no-get.patch
Patch4:         lucene-2.3.0-db-javadoc.patch
Source100:      lucene-1.9-OSGi-MANIFEST.MF
Source200:      lucene-1.9-analysis-OSGi-MANIFEST.MF
Requires(post): jpackage-utils >= 1.7.5
Requires(postun): jpackage-utils >= 1.7.5
BuildRequires:  ant >= 1.6
BuildRequires:  ant-junit >= 1.6
%if %with db
BuildRequires:  berkeleydb >= 2.0.90
BuildRequires:  geronimo-j2ee-connector-1_5-api
BuildRequires:  libdb_java-4_5
%endif
BuildRequires:  jakarta-commons-beanutils
BuildRequires:  jakarta-commons-collections
BuildRequires:  jakarta-commons-digester
BuildRequires:  jakarta-commons-logging
BuildRequires:  java-devel >= 1.5.0
#BuildRequires:  java-javadoc
BuildRequires:  java-1_6_0-openjdk-javadoc
BuildRequires:  javacc
BuildRequires:  jline
BuildRequires:  jtidy
BuildRequires:  log4j
BuildRequires:  jpackage-utils >= 1.7.5
BuildRequires:  junit
BuildRequires:  regexp
BuildRequires:  zip
BuildRequires:  fdupes
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Jakarta Lucene is a high-performance, full-featured text search engine
written entirely in Java. It is a technology suitable for nearly any
application that requires full-text search, especially cross-platform.



%package javadoc
License:        Apache Software License ..
Summary:        High-performance, full-featured text search engine
Group:          Development/Libraries/Java

%description javadoc
Jakarta Lucene is a high-performance, full-featured text search engine
written entirely in Java. It is a technology suitable for nearly any
application that requires full-text search, especially cross-platform.



%package demo
License:        Apache Software License ..
Summary:        High-performance, full-featured text search engine
Group:          Development/Libraries/Java
Requires:       %{name} = %{version}

%description demo
Jakarta Lucene is a high-performance, full-featured text search engine
written entirely in Java. It is a technology suitable for nearly any
application that requires full-text search, especially cross-platform.



%package contrib
License:        Apache Software License ..
Summary:        High-performance, full-featured text search engine
Group:          Development/Libraries/Java
Requires:       %{name} = %{version}
Requires:       jline

%description contrib
Jakarta Lucene is a high-performance, full-featured text search engine
written entirely in Java. It is a technology suitable for nearly any
application that requires full-text search, especially cross-platform.



%package contrib-benchmark
License:        Apache Software License ..
Summary:        High-performance, full-featured text search engine
Group:          Development/Libraries/Java
Requires:       %{name} = %{version}
Requires:       jakarta-commons-beanutils
Requires:       jakarta-commons-collections
Requires:       jakarta-commons-digester
Requires:       jakarta-commons-logging
Requires:       xerces-j2
Requires:       xml-commons-apis >= 1.3

%description contrib-benchmark
Jakarta Lucene is a high-performance, full-featured text search engine
written entirely in Java. It is a technology suitable for nearly any
application that requires full-text search, especially cross-platform.



%if %with db

%package contrib-db
License:        Apache Software License ..
Summary:        High-performance, full-featured text search engine
Group:          Development/Libraries/Java
Requires:       %{name} = %{version}
Requires:       berkeleydb >= 2.0.90
Requires:       libdb_java-4_5

%description contrib-db
Jakarta Lucene is a high-performance, full-featured text search engine
written entirely in Java. It is a technology suitable for nearly any
application that requires full-text search, especially cross-platform.



%endif

%prep
%setup -q -n %{oname}-%{version}
%patch0 -p0
%patch1 -p0
%patch4 -p1
%if %without db
rm -r contrib/db
%endif

%build
export CLASSPATH=$(build-classpath \
%if %with db
berkeleydb \
db \
%endif
commons-digester jline jtidy junit regexp)
export OPT_JAR_LIST=:
ant \
  -Djavacc.home=%{_bindir}/javacc \
  -Djavacc.jar=%{_javadir}/javacc.jar \
  -Djavacc.jar.dir=%{_javadir} \
  -Djavadoc.link=%{_javadocdir}/java \
  -Dversion=%{version} \
package-all-binary
mkdir -p META-INF
cp %{SOURCE100} META-INF/MANIFEST.MF
zip -qqu build/lucene-core-%{version}.jar META-INF/MANIFEST.MF
cp %{SOURCE200} META-INF/MANIFEST.MF
zip -qqu build/contrib/analyzers/lucene-analyzers-%{version}.jar META-INF/MANIFEST.MF

%install
# jars
install -d -m 0755 %{buildroot}%{_javadir}
install -p -m 0644 build/%{oname}-core-%{version}.jar %{buildroot}%{_javadir}/%{name}-%{version}.jar
install -p -m 0644 build/%{oname}-demos-%{version}.jar %{buildroot}%{_javadir}/%{name}-demos-%{version}.jar
(cd %{buildroot}%{_javadir} && for jar in *-%{version}.jar; do ln -sf ${jar} `echo $jar| sed "s|-%{version}||g"`; done)
# contrib jars
install -d -m 0755 %{buildroot}%{_javadir}/%{name}-contrib
for c in analyzers ant benchmark highlighter lucli memory misc queries regex similarity snowball spellchecker surround swing wikipedia wordnet xml-query-parser; do
    install -p -m 0644 build/contrib/$c/%{oname}-${c}-%{version}.jar \
                %{buildroot}%{_javadir}/%{name}-contrib/${c}-%{version}.jar
done
(cd %{buildroot}%{_javadir}/%{name}-contrib && for jar in *-%{version}.jar; do ln -sf ${jar} `echo $jar| sed "s|-%{version}||g"`; done)
# benchmark contrib jars
install -d -m 0755 %{buildroot}%{_javadir}/%{name}-contrib-benchmark
install -p -m 0644 build/contrib/benchmark/%{oname}-benchmark-%{version}.jar \
                %{buildroot}%{_javadir}/%{name}-contrib-benchmark/benchmark-%{version}.jar
(cd %{buildroot}%{_javadir}/%{name}-contrib-benchmark && for jar in *-%{version}.jar; do ln -sf ${jar} `echo $jar| sed "s|-%{version}||g"`; done)
%if %with db
# bdb contrib jars
install -d -m 0755 %{buildroot}%{_javadir}/%{name}-contrib-db
install -p -m 0644 build/contrib/db/bdb/%{oname}-bdb-%{version}.jar \
                %{buildroot}%{_javadir}/%{name}-contrib-db/bdb-%{version}.jar
install -p -m 0644 build/contrib/db/bdb-je/%{oname}-bdb-je-%{version}.jar \
                %{buildroot}%{_javadir}/%{name}-contrib-db/bdb-je-%{version}.jar
(cd %{buildroot}%{_javadir}/%{name}-contrib-db && for jar in *-%{version}.jar; do ln -sf ${jar} `echo $jar| sed "s|-%{version}||g"`; done)
%endif
# poms
install -d -m 0755 %{buildroot}%{_datadir}/maven2/poms
install -p -m 0644 %{SOURCE1} %{buildroot}%{_datadir}/maven2/poms/JPP.%{name}-contrib-analyzers.pom
%add_to_maven_depmap org.apache.lucene lucene-analyzers %{version} JPP/%{name}-contrib analyzers
install -p -m 0644 %{SOURCE2} %{buildroot}%{_datadir}/maven2/poms/JPP.%{name}-contrib-ant.pom
%add_to_maven_depmap org.apache.lucene lucene-ant %{version} JPP/%{name}-contrib ant
%if %with db
install -p -m 0644 %{SOURCE3} %{buildroot}%{_datadir}/maven2/poms/JPP.%{name}-contrib-db-bdb.pom
%add_to_maven_depmap org.apache.lucene lucene-bdb %{version} JPP/%{name}-contrib-db bdb
install -p -m 0644 %{SOURCE4} %{buildroot}%{_datadir}/maven2/poms/JPP.%{name}-contrib-db-bdb-je.pom
%add_to_maven_depmap org.apache.lucene lucene-bdb-je %{version} JPP/%{name}-contrib-db bdb-je
%endif
install -p -m 0644 %{SOURCE5} %{buildroot}%{_datadir}/maven2/poms/JPP.%{name}-contrib-benchmark-benchmark.pom
%add_to_maven_depmap org.apache.lucene lucene-benchmark %{version} JPP/%{name}-contrib-benchmark benchmark
install -p -m 0644 %{SOURCE6} %{buildroot}%{_datadir}/maven2/poms/JPP.%{name}-contrib.pom
%add_to_maven_depmap org.apache.lucene lucene-contrib %{version} JPP/%{name} contrib
install -p -m 0644 %{SOURCE7} %{buildroot}%{_datadir}/maven2/poms/JPP-%{name}.pom
%add_to_maven_depmap org.apache.lucene lucene-core %{version} JPP %{name}
install -p -m 0644 %{SOURCE8} %{buildroot}%{_datadir}/maven2/poms/JPP-%{name}-demos.pom
%add_to_maven_depmap org.apache.lucene lucene-demos %{version} JPP %{name}-demos
install -p -m 0644 %{SOURCE9} %{buildroot}%{_datadir}/maven2/poms/JPP.%{name}-contrib-highlighter.pom
%add_to_maven_depmap org.apache.lucene lucene-highlighter %{version} JPP/%{name}-contrib highlighter
install -p -m 0644 %{SOURCE10} %{buildroot}%{_datadir}/maven2/poms/JPP.%{name}-contrib-lucli.pom
%add_to_maven_depmap org.apache.lucene lucene-lucli %{version} JPP/%{name}-contrib lucli
install -p -m 0644 %{SOURCE11} %{buildroot}%{_datadir}/maven2/poms/JPP.%{name}-contrib-memory.pom
%add_to_maven_depmap org.apache.lucene lucene-memory %{version} JPP/%{name}-contrib memory
install -p -m 0644 %{SOURCE12} %{buildroot}%{_datadir}/maven2/poms/JPP.%{name}-contrib-misc.pom
%add_to_maven_depmap org.apache.lucene lucene-misc %{version} JPP/%{name}-contrib misc
install -p -m 0644 %{SOURCE13} %{buildroot}%{_datadir}/maven2/poms/JPP.%{name}-parent.pom
%add_to_maven_depmap org.apache.lucene lucene-parent %{version} JPP/%{name} parent
install -p -m 0644 %{SOURCE14} %{buildroot}%{_datadir}/maven2/poms/JPP.%{name}-contrib-queries.pom
%add_to_maven_depmap org.apache.lucene lucene-queries %{version} JPP/%{name}-contrib queries
install -p -m 0644 %{SOURCE15} %{buildroot}%{_datadir}/maven2/poms/JPP.%{name}-contrib-regexp.pom
%add_to_maven_depmap org.apache.lucene lucene-regexp %{version} JPP/%{name}-contrib regexp
install -p -m 0644 %{SOURCE16} %{buildroot}%{_datadir}/maven2/poms/JPP.%{name}-contrib-snowball.pom
%add_to_maven_depmap org.apache.lucene lucene-snowball %{version} JPP/%{name}-contrib snowball
install -p -m 0644 %{SOURCE17} %{buildroot}%{_datadir}/maven2/poms/JPP.%{name}-contrib-spellchecker.pom
%add_to_maven_depmap org.apache.lucene lucene-spellchecker %{version} JPP/%{name}-contrib spellchecker
install -p -m 0644 %{SOURCE18} %{buildroot}%{_datadir}/maven2/poms/JPP.%{name}-contrib-surround.pom
%add_to_maven_depmap org.apache.lucene lucene-surround %{version} JPP/%{name}-contrib surround
install -p -m 0644 %{SOURCE19} %{buildroot}%{_datadir}/maven2/poms/JPP.%{name}-contrib-swing.pom
%add_to_maven_depmap org.apache.lucene lucene-swing %{version} JPP/%{name}-contrib swing
install -p -m 0644 %{SOURCE21} %{buildroot}%{_datadir}/maven2/poms/JPP.%{name}-contrib-wordnet.pom
%add_to_maven_depmap org.apache.lucene lucene-wordnet %{version} JPP/%{name}-contrib wordnet
install -p -m 0644 %{SOURCE22} %{buildroot}%{_datadir}/maven2/poms/JPP.%{name}-contrib-xml-query-parser.pom
%add_to_maven_depmap org.apache.lucene lucene-xml-query-parser %{version} JPP/%{name}-contrib xml-query-parser
# javadoc
install -d -m 0755 %{buildroot}%{_javadocdir}/%{name}-%{version}
cp -pr build/docs/api/* \
  %{buildroot}%{_javadocdir}/%{name}-%{version}
ln -s %{name}-%{version} %{buildroot}%{_javadocdir}/%{name}
# webapp
install -d -m 0755 %{buildroot}%{_datadir}/%{name}-%{version}
install -p -m 0644 build/%{oname}web.war \
  %{buildroot}%{_datadir}/%{name}-%{version}
%fdupes -s %{buildroot}%{_javadocdir}/%{name}-%{version}

%clean
rm -rf %{buildroot}

%post
%update_maven_depmap

%postun
%update_maven_depmap

%files
%defattr(0644,root,root,0755)
%doc CHANGES.txt LICENSE.txt README.txt
%{_javadir}/%{name}-%{version}.jar
%{_javadir}/%{name}.jar
%{_datadir}/%{name}-%{version}
%{_datadir}/maven2/poms/*
%config %{_mavendepmapfragdir}/*

%files javadoc
%defattr(0644,root,root,0755)
%{_javadocdir}/%{name}-%{version}
%{_javadocdir}/%{name}

%files contrib
%defattr(0644,root,root,0755)
%dir %{_javadir}/%{name}-contrib
%{_javadir}/%{name}-contrib/analyzers-%{version}.jar
%{_javadir}/%{name}-contrib/analyzers.jar
%{_javadir}/%{name}-contrib/ant-%{version}.jar
%{_javadir}/%{name}-contrib/ant.jar
%{_javadir}/%{name}-contrib/benchmark-%{version}.jar
%{_javadir}/%{name}-contrib/benchmark.jar
%{_javadir}/%{name}-contrib/highlighter-%{version}.jar
%{_javadir}/%{name}-contrib/highlighter.jar
%{_javadir}/%{name}-contrib/lucli-%{version}.jar
%{_javadir}/%{name}-contrib/lucli.jar
%{_javadir}/%{name}-contrib/memory-%{version}.jar
%{_javadir}/%{name}-contrib/memory.jar
%{_javadir}/%{name}-contrib/misc-%{version}.jar
%{_javadir}/%{name}-contrib/misc.jar
%{_javadir}/%{name}-contrib/queries-%{version}.jar
%{_javadir}/%{name}-contrib/queries.jar
%{_javadir}/%{name}-contrib/regex-%{version}.jar
%{_javadir}/%{name}-contrib/regex.jar
%{_javadir}/%{name}-contrib/similarity-%{version}.jar
%{_javadir}/%{name}-contrib/similarity.jar
%{_javadir}/%{name}-contrib/snowball-%{version}.jar
%{_javadir}/%{name}-contrib/snowball.jar
%{_javadir}/%{name}-contrib/spellchecker-%{version}.jar
%{_javadir}/%{name}-contrib/spellchecker.jar
%{_javadir}/%{name}-contrib/surround-%{version}.jar
%{_javadir}/%{name}-contrib/surround.jar
%{_javadir}/%{name}-contrib/swing-%{version}.jar
%{_javadir}/%{name}-contrib/swing.jar
%{_javadir}/%{name}-contrib/wikipedia-%{version}.jar
%{_javadir}/%{name}-contrib/wikipedia.jar
%{_javadir}/%{name}-contrib/wordnet-%{version}.jar
%{_javadir}/%{name}-contrib/wordnet.jar
%{_javadir}/%{name}-contrib/xml-query-parser-%{version}.jar
%{_javadir}/%{name}-contrib/xml-query-parser.jar

%files contrib-benchmark
%defattr(0644,root,root,0755)
%{_javadir}/%{name}-contrib-benchmark
%if %with db

%files contrib-db
%defattr(0644,root,root,0755)
%{_javadir}/%{name}-contrib-db
%endif

%files demo
%defattr(0644,root,root,0755)
%{_javadir}/%{name}-demos-%{version}.jar
%{_javadir}/%{name}-demos.jar

%changelog