#
# spec file for "lucene"
#
# Copyright (c) 2018 SUSE LLC
#
# 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/
#

Name:           lucene
Version:        2.4.1
Release:        2.50.uyuni3
License:        Apache-2.0
Summary:        Library for full featured text search
Url:            https://github.com/apache/lucene-solr
Group:          Development/Libraries/Java
Source0:        lucene-%{version}-src.tar.gz
Source1:        build.sh
Patch0:         0001-Sources-updated.patch
Patch1:         0002-Sources-updated.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires: ant
BuildRequires: xmvn-tools
BuildRequires: xmvn-minimal
BuildRequires:  xz
BuildRequires:  java-devel >= 1.7.0
BuildArch:      noarch
Provides:       mvn(:lucene) == %{version}
Requires:       java >= 1.7.0

%description
Apache Lucene is a high-performance, full featured text search engine library written in Java.

%prep
%setup -q -c -n src
%patch0 -p2
%patch1 -p2
cp -f %{SOURCE1} .

%build
cd ..
sh src/build.sh

%install
export NO_BRP_CHECK_BYTECODE_VERSION=true
mkdir -p %{buildroot}%{_javadir}
cp -a lucene-%{version}/build/contrib/misc/lucene-misc-2.4.jar %{buildroot}%{_javadir}/lucene-misc-2.4.jar
cp -a lucene-%{version}/build/contrib/analyzers/lucene-analyzers-2.4.jar %{buildroot}%{_javadir}/lucene-analyzers-2.4.jar
cp -a lucene-%{version}/build/lucene-core-2.4.jar %{buildroot}%{_javadir}/lucene-core-2.4.jar
ln -sf lucene-misc-2.4.jar %{buildroot}%{_javadir}/lucene-misc.jar
ln -sf lucene-analyzers-2.4.jar %{buildroot}%{_javadir}/lucene-analyzers.jar
ln -sf lucene-core-2.4.jar %{buildroot}%{_javadir}/lucene.jar

%files
%defattr(-,root,root)
%{_javadir}/*
%{!?_licensedir:%global license %doc}
%license lucene-%{version}/LICENSE.txt

%changelog
* Tue Nov  6 2018 jgonzalez@suse.com
- Install missing LICENSE.txt file (bsc#1114814)
* Wed Mar 21 2018 jcavalheiro@suse.com
- Adjusted build.sh and spec file to publish lucene-misc package
* Fri Jan 26 2018 jbreuer@suse.de
- Bumping Java source and target version to 1.7 for lucene analyzer
  to allow build for SLE15 and Tumbleweed.
  Added:
  * 0002-Sources-updated.patch
* Fri Jan 26 2018 jbreuer@suse.de
- Also including lucene analyzers package now.
* Thu Jan 25 2018 jbreuer@suse.de
- Adding symlink for lucene.jar in java lib extension folder for
  easier imports.
* Tue Jan 23 2018 jbreuer@suse.de
- Bumping Java source and target version to 1.7 to allow build for
  SLE15 and Tumbleweed.
  Added:
  * 0001-Sources-updated.patch
* Thu Jan 18 2018 clanig@suse.com
- Initial commit of lucene-2.4.1.