File lucene.spec of Package lucene

#
# spec file for package lucene
#
# Copyright (c) 2017 SUSE LINUX 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 jarname lucene-core
Name:           lucene
Version:        6.6.0
Release:        0
Summary:        Text search engine
License:        Apache-2.0
Group:          Development/Libraries/Java
Url:            http://lucene.apache.org/
Source0:        http://www.apache.org/dist/lucene/java/%{version}/%{name}-%{version}-src.tgz
Source1:        http://repo1.maven.org/maven2/org/apache/lucene/lucene-queryparser/%{version}/lucene-queryparser-%{version}.pom
Source2:        http://repo1.maven.org/maven2/org/apache/lucene/lucene-join/%{version}/lucene-join-%{version}.pom
Source3:        http://repo1.maven.org/maven2/org/apache/lucene/lucene-queries/%{version}/lucene-queries-%{version}.pom
Source4:        http://repo1.maven.org/maven2/org/apache/lucene/lucene-classification/%{version}/lucene-classification-%{version}.pom
Source5:        http://repo1.maven.org/maven2/org/apache/lucene/lucene-facet/%{version}/lucene-facet-%{version}.pom
Source6:        http://repo1.maven.org/maven2/org/apache/lucene/lucene-codecs/%{version}/lucene-codecs-%{version}.pom
Source7:        http://repo1.maven.org/maven2/org/apache/lucene/lucene-backward-codecs/%{version}/lucene-backward-codecs-%{version}.pom
Source8:        http://repo1.maven.org/maven2/org/apache/lucene/lucene-grouping/%{version}/lucene-grouping-%{version}.pom
Source9:        http://repo1.maven.org/maven2/org/apache/lucene/lucene-highlighter/%{version}/lucene-highlighter-%{version}.pom
Source10:       http://repo1.maven.org/maven2/org/apache/lucene/lucene-memory/%{version}/lucene-memory-%{version}.pom
Source11:       http://repo1.maven.org/maven2/org/apache/lucene/lucene-misc/%{version}/lucene-misc-%{version}.pom
Source12:       http://repo1.maven.org/maven2/org/apache/lucene/lucene-sandbox/%{version}/lucene-sandbox-%{version}.pom
Source13:       http://repo1.maven.org/maven2/org/apache/lucene/lucene-spatial3d/%{version}/lucene-spatial3d-%{version}.pom
Source14:       http://repo1.maven.org/maven2/org/apache/lucene/lucene-spatial/%{version}/lucene-spatial-%{version}.pom
Source15:       http://repo1.maven.org/maven2/org/apache/lucene/lucene-analyzers-common/%{version}/lucene-analyzers-common-%{version}.pom
Source16:       http://repo1.maven.org/maven2/org/apache/lucene/lucene-analyzers-smartcn/%{version}/lucene-analyzers-smartcn-%{version}.pom
Source17:       http://repo1.maven.org/maven2/org/apache/lucene/lucene-analyzers-stempel/%{version}/lucene-analyzers-stempel-%{version}.pom
Source18:       http://repo1.maven.org/maven2/org/apache/lucene/lucene-core/%{version}/lucene-core-%{version}.pom
BuildRequires:  ant >= 1.6
BuildRequires:  ant-junit >= 1.6
BuildRequires:  antlr-java
BuildRequires:  apache-commons-codec
BuildRequires:  apache-ivy
BuildRequires:  asm
BuildRequires:  fdupes
BuildRequires:  git
BuildRequires:  jakarta-commons-beanutils
BuildRequires:  jakarta-commons-collections
BuildRequires:  jakarta-commons-digester
BuildRequires:  jakarta-commons-logging
BuildRequires:  java-devel >= 1.8
BuildRequires:  javacc
BuildRequires:  javapackages-local
BuildRequires:  javapackages-tools
BuildRequires:  jline
BuildRequires:  jtidy
BuildRequires:  junit
BuildRequires:  log4j
BuildRequires:  regexp
BuildRequires:  zip
BuildArch:      noarch

%description
Apache Lucene is a full-text search engine written entirely in Java.
It offers fuzzy search based on edit (Levenshtein) distance,
incremental indexing, ranked searching, field-based searches and
multi-index searches.

%package queryparser
Summary:        Queryparser module for lucene
Group:          Development/Libraries/Java

%description queryparser
Apache Lucene is a full-text search engine written entirely in Java.
This package provides the "queryparser" module for lucene.

%files queryparser
%defattr(-,root,root)
%{_javadir}/lucene-queryparser-%{version}.jar

%package join
Summary:        Join module for lucene
Group:          Development/Libraries/Java

%description join
Apache Lucene is a full-text search engine written entirely in Java.
This package provides the "join" module for lucene.

%files join
%defattr(-,root,root)
%{_javadir}/lucene-join-%{version}.jar

%package queries
Summary:        Queries module for lucene
Group:          Development/Libraries/Java

%description queries
Apache Lucene is a full-text search engine written entirely in Java.
This package provides the "queries" module for lucene.

%files queries
%defattr(-,root,root)
%{_javadir}/lucene-queries-%{version}.jar

%package classification
Summary:        Classification module for lucene
Group:          Development/Libraries/Java

%description classification
Apache Lucene is a full-text search engine written entirely in Java.
This package provides the "classification" module for Lucene.

%files classification
%defattr(-,root,root)
%{_javadir}/lucene-classification-%{version}.jar

%package facet
Summary:        Facet module for lucene
Group:          Development/Libraries/Java

%description facet
Apache Lucene is a full-text search engine written entirely in Java.
This package provides the "facet" module for Lucene.

%files facet
%defattr(-,root,root)
%{_javadir}/lucene-facet-%{version}.jar

%package codecs
Summary:        Codecs module for lucene
Group:          Development/Libraries/Java

%description codecs
Apache Lucene is a full-text search engine written entirely in Java.
This package provides the "codecs" module for Lucene.

%files codecs
%defattr(-,root,root)
%{_javadir}/lucene-codecs-%{version}.jar

%package backward-codecs
Summary:        Backward-codecs module for lucene
Group:          Development/Libraries/Java

%description backward-codecs
Apache Lucene is a full-text search engine written entirely in Java.
This package provides the "backward-codecs" module for Lucene.

%files backward-codecs
%defattr(-,root,root)
%{_javadir}/lucene-backward-codecs-%{version}.jar

%package grouping
Summary:        Grouping module for lucene
Group:          Development/Libraries/Java

%description grouping
Apache Lucene is a full-text search engine written entirely in Java.
This package provides the "grouping" module for Lucene.

%files grouping
%defattr(-,root,root)
%{_javadir}/lucene-grouping-%{version}.jar

%package highlighter
Summary:        Highlighter module for lucene
Group:          Development/Libraries/Java

%description highlighter
Apache Lucene is a full-text search engine written entirely in Java.
This package provides the "highlighter" module for Lucene.

%files highlighter
%defattr(-,root,root)
%{_javadir}/lucene-highlighter-%{version}.jar

%package memory
Summary:        Memory module for lucene
Group:          Development/Libraries/Java

%description memory
Apache Lucene is a full-text search engine written entirely in Java.
This package provides the "memory" module for Lucene.

%files memory
%defattr(-,root,root)
%{_javadir}/lucene-memory-%{version}.jar

%package misc
Summary:        Misc module for lucene
Group:          Development/Libraries/Java

%description misc
Apache Lucene is a full-text search engine written entirely in Java.
This package provides the "misc" module for Lucene.

%files misc
%defattr(-,root,root)
%{_javadir}/lucene-misc-%{version}.jar

%package sandbox
Summary:        Sandbox module for lucene
Group:          Development/Libraries/Java

%description sandbox
Apache Lucene is a full-text search engine written entirely in Java.
This package provides the "sandbox" module for Lucene.

%files sandbox
%defattr(-,root,root)
%{_javadir}/lucene-sandbox-%{version}.jar

%package spatial3d
Summary:        Spatial3d module for lucene
Group:          Development/Libraries/Java

%description spatial3d
Apache Lucene is a full-text search engine written entirely in Java.
This package provides the "spatial3d" module for Lucene.

%files spatial3d
%defattr(-,root,root)
%{_javadir}/lucene-spatial3d-%{version}.jar

%package spatial
Summary:        Spatial module for lucene
Group:          Development/Libraries/Java

%description spatial
Apache Lucene is a full-text search engine written entirely in Java.
This package provides the "spatial" module for Lucene.

%files spatial
%defattr(-,root,root)
%{_javadir}/lucene-spatial-%{version}.jar

%package analyzers-common
Summary:        Analyzers-common module for lucene
Group:          Development/Libraries/Java

%description analyzers-common
Apache Lucene is a full-text search engine written entirely in Java.
This package provides the "analyzers-common" module for Lucene.

%files analyzers-common
%defattr(-,root,root)
%{_javadir}/lucene-analyzers-common-%{version}.jar

%package analyzers-smartcn
Summary:        Analyzers-smartcn module for lucene
Group:          Development/Libraries/Java

%description analyzers-smartcn
Apache Lucene is a full-text search engine written entirely in Java.
This package provides the "analyzers-smartcn" module for Lucene.

%files analyzers-smartcn
%defattr(-,root,root)
%{_javadir}/lucene-analyzers-smartcn-%{version}.jar

%package analyzers-stempel
Summary:        Analyzers-stempel module for lucene
Group:          Development/Libraries/Java

%description analyzers-stempel
Apache Lucene is a full-text search engine written entirely in Java.
This package provides the "analyzers-stempel" module for Lucene.

%files analyzers-stempel
%defattr(-,root,root)
%{_javadir}/lucene-analyzers-stempel-%{version}.jar

%prep
%setup -q

%build
export CLASSPATH=$(build-classpath 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} \
  -Divy.mode=local

# DOESN'T BUILD BECAUSE OF MISSING DEPS: replicator expressions spatial-extras analyzers-kuromoji analyzers-morfologik analyzers-phonetic
export modules="queryparser join queries classification facet codecs backward-codecs grouping highlighter memory misc sandbox spatial3d spatial"

for mod in $modules
do
  ant -f module-build.xml \
    -Djavacc.home=%{_bindir}/javacc \
    -Djavacc.jar=%{_javadir}/javacc.jar \
    -Djavacc.jar.dir=%{_javadir} \
    -Djavadoc.link=%{_javadocdir}/java \
    -Dversion=%{version} \
    -Divy.mode=local \
  jar-$mod
done

export modanalyzers="common smartcn stempel"
pushd analysis
ant \
  -Djavacc.home=%{_bindir}/javacc \
  -Djavacc.jar=%{_javadir}/javacc.jar \
  -Djavacc.jar.dir=%{_javadir} \
  -Djavadoc.link=%{_javadocdir}/java \
  -Dversion=%{version} \
  -Divy.mode=local \
$modanalyzers

%install
install -d -m 0755 %{buildroot}%{_javadir}

# maven pom dir
install -d -m 0755 %{buildroot}%{_mavenpomdir}/

install -p -m 0644 build/core/%{jarname}-%{version}.jar %{buildroot}%{_javadir}/%{jarname}-%{version}.jar
install -p -m 0644 %{_sourcedir}/lucene-core-%{version}.pom %{buildroot}%{_mavenpomdir}/JPP.%{name}-core-%{version}.pom
%add_maven_depmap JPP.%{name}-core-%{version}.pom lucene-core-%{version}.jar

export modules="queryparser join queries classification facet codecs backward-codecs grouping highlighter memory misc sandbox spatial3d spatial"
for mod in $modules
do
  install -p -m 0644 build/${mod}/lucene-$mod-%{version}.jar %{buildroot}%{_javadir}/lucene-$mod-%{version}.jar
  install -p -m 0644 %{_sourcedir}/lucene-${mod}-%{version}.pom %{buildroot}%{_mavenpomdir}/JPP.%{name}-${mod}-%{version}.pom
  %add_maven_depmap JPP.%{name}-${mod}-%{version}.pom lucene-${mod}-%{version}.jar
done

export modanalyzers="common smartcn stempel"
for mod in $modanalyzers
do
  install -p -m 0644 build/analysis/$mod/lucene-analyzers-$mod-%{version}.jar %{buildroot}%{_javadir}/lucene-analyzers-${mod}-%{version}.jar
  install -p -m 0644 %{_sourcedir}/lucene-analyzers-${mod}-%{version}.pom %{buildroot}%{_mavenpomdir}/JPP.%{name}-analyzers-${mod}-%{version}.pom
  %add_maven_depmap JPP.%{name}-analyzers-${mod}-%{version}.pom lucene-analyzers-${mod}-%{version}.jar
done

# javadoc DOES NOT BUILD BECAUSE OF MISSING MVN DEPS
# javadoc
#install -d -m 0755 %%{buildroot}%%{_javadocdir}/%%{name}
#cp -pr build/docs/api/* \
#  %%{buildroot}%%{_javadocdir}/%%{name}

%files
%defattr(-,root,root)
%doc CHANGES.txt LICENSE.txt README.txt
%{_javadir}/lucene-core-%{version}.jar
%{_mavenpomdir}/*
%{_datadir}/maven-metadata/%{name}.xml*

%changelog
openSUSE Build Service is sponsored by