%global short_name solr
%global codec_v 1.3
%global csv_v 1.0-SNAPSHOT-r609327
%global fileupload_v 1.2.1
%global httpclient_v 3.1
%global io_v 1.4
%global stax_api_v 1.0.1
%global slf4j_v 1.5.5
%global junit_v 4.3
%global lucene_v 2.9.3
%global servlet_v 2.4
%global wstx_v 3.2.7
%global jetty_v 6.1.3
%global mail_v 1.4.1
%global jar_version 1.4.2-dev
Name: apache-%{short_name}
Version: 1.4.1
Release: 1%{?dist}
Summary: Open source enterprise search platform from the Apache Lucene project
Group: Development/Libraries
License: ASL 2.0
URL: http://lucene.apache.org/solr/
Source0: http://www.apache.org/dist/lucene/solr/%{version}/%{name}-%{version}.tgz
BuildArch: noarch
BuildRequires: java-devel >= 1:1.6.0
BuildRequires: ant
BuildRequires: apache-commons-codec
BuildRequires: apache-commons-csv
BuildRequires: apache-commons-fileupload
BuildRequires: apache-commons-io
BuildRequires: jakarta-commons-httpclient
BuildRequires: easymock
BuildRequires: bea-stax-api
BuildRequires: bea-stax
BuildRequires: slf4j
BuildRequires: junit4
BuildRequires: lucene-contrib >= 2.9.0
BuildRequires: servlet25
BuildRequires: jetty
BuildRequires: javamail
Requires: lucene-contrib >= 2.9.0
Requires: apache-commons-codec
Requires: apache-commons-csv
Requires: apache-commons-fileupload
Requires: apache-commons-io
Requires: jakarta-commons-httpclient
Requires: bea-stax-api
Requires: bea-stax
Requires: slf4j
Requires: javamail
Requires: java >= 1:1.6.0
Requires(post): jpackage-utils
Requires(postun): jpackage-utils
%description
Solr is the popular, blazing fast open source enterprise search
platform from the Apache Lucene project. Its major features include
powerful full-text search, hit highlighting, faceted search, dynamic
clustering, database integration, and rich document (e.g., Word, PDF)
handling. Solr is highly scalable, providing distributed search and
index replication, and it powers the search and navigation features of
many of the world's largest internet sites.
Solr is written in Java and runs as a standalone full-text search
server within a servlet container such as Tomcat. Solr uses the Lucene
Java search library at its core for full-text indexing and search, and
has REST-like HTTP/XML and JSON APIs that make it easy to use from
virtually any programming language. Solr's powerful external
configuration allows it to be tailored to almost any type of
application without Java coding, and it has an extensive plugin
architecture when more advanced customization is required.
%package webapp
Summary: Webapp application to be used in J2EE containers
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
%description webapp
%{summary}.
%package tomcat6
Summary: Default Tomcat 6 configuration files for webapp
Group: Development/Libraries
Requires: %{name}-webapp = %{version}-%{release}
Requires: tomcat6
%description tomcat6
%{summary}.
%package javadoc
Summary: API documentation for %{name}
Group: Documentation
Requires: jpackage-utils
%description javadoc
%{summary}.
%prep
%setup -q
find . -iname '*.jar' -delete
find . -iname '*.war' -delete
find . -iname '*.class' -delete
# recreate lib dir dependencies
pushd lib/
ln -sf $(build-classpath apache-commons-codec) commons-codec-%{codec_v}.jar
ln -sf $(build-classpath apache-commons-csv) commons-csv-%{csv_v}.jar
ln -sf $(build-classpath commons-fileupload) commons-fileupload-%{fileupload_v}.jar
ln -sf $(build-classpath commons-httpclient) commons-httpclient-%{httpclient_v}.jar
ln -sf $(build-classpath commons-io) commons-io-%{io_v}.jar
ln -sf $(build-classpath easymock2) easymock.jar
ln -sf $(build-classpath bea-stax-api) geronimo-stax-api_1.0_spec-%{stax_api_v}.jar
ln -sf $(build-classpath slf4j/jcl-over-slf4j) jcl-over-slf4j-%{slf4j_v}.jar
ln -sf $(build-classpath slf4j/api) slf4j-api-%{slf4j_v}.jar
ln -sf $(build-classpath slf4j/jdk14) slf4j-jdk4-%{slf4j_v}.jar
ln -sf $(build-classpath junit4) junit-%{junit_v}.jar
ln -sf $(build-classpath lucene-core) lucene-core-%{lucene_v}.jar
for i in analyzers highlighter memory misc queries snowball spellchecker;do
ln -sf $(build-classpath lucene-contrib/lucene-$i) lucene-$i-%{lucene_v}.jar
done
ln -sf $(build-classpath tomcat6-servlet-2.5-api) servlet-api-%{servlet_v}.jar
ln -sf $(build-classpath bea-stax-ri) wstx-asl-%{wstx_v}.jar
popd
ln -sf $(build-classpath jetty/jetty) example/lib/jetty-%{jetty_v}.jar
ln -sf $(build-classpath jetty/jetty-util) example/lib/jetty-util-%{jetty_v}.jar
ln -sf $(build-classpath javamail) contrib/dataimporthandler/lib/mail-%{mail_v}.jar
# skip building of these extensions for now
rm -rf contrib/clustering
rm -rf contrib/extraction
rm -rf contrib/dataimporthandler
rm -rf contrib/velocity
find . -iname '*pom.xml.template' -exec sed -i "s:@maven_version@:%{version}:g;s:@lucene_version@:%{lucene_v}:g" \{\} \;
# create default tomcat6 config for deployment
cat > %{name}.xml << EOF
EOF
%build
# create no-aop build environment
ant dist
# we are installing the webapp unrolled so that we can use our system jar dependencies
# NOTE: This should probably be generalized and put into jpackage-utils scripts
pushd dist
mkdir webapp
unzip %{name}-%{jar_version}.war -d webapp
cd webapp/WEB-INF/lib
rm *.jar
ln -sf %{_javadir}/%{name}-core.jar %{name}-core-%{jar_version}.jar
ln -sf %{_javadir}/%{name}-solrj.jar %{name}-solrj-%{jar_version}.jar
ln -sf $(build-classpath apache-commons-codec) commons-codec-%{codec_v}.jar
ln -sf $(build-classpath apache-commons-csv) commons-csv-%{csv_v}.jar
ln -sf $(build-classpath commons-fileupload) commons-fileupload-%{fileupload_v}.jar
ln -sf $(build-classpath commons-httpclient) commons-httpclient-%{httpclient_v}.jar
ln -sf $(build-classpath commons-io) commons-io-%{io_v}.jar
ln -sf $(build-classpath bea-stax-api) geronimo-stax-api_1.0_spec-%{stax_api_v}.jar
ln -sf $(build-classpath slf4j/jcl-over-slf4j) jcl-over-slf4j-%{slf4j_v}.jar
ln -sf $(build-classpath slf4j/api) slf4j-api-%{slf4j_v}.jar
ln -sf $(build-classpath slf4j/jdk14) slf4j-jdk4-%{slf4j_v}.jar
ln -sf $(build-classpath lucene-core) lucene-core-%{lucene_v}.jar
for i in analyzers highlighter memory misc queries snowball spellchecker;do
ln -sf $(build-classpath lucene-contrib/lucene-$i) lucene-$i-%{lucene_v}.jar
done
ln -sf $(build-classpath bea-stax-ri) wstx-asl-%{wstx_v}.jar
popd
%install
install -d -m 0755 %{buildroot}%{_javadir}
for mod in core solrj; do
install -Dpm 644 dist/%{name}-$mod-%{jar_version}.jar %{buildroot}%{_javadir}/%{name}-$mod.jar
%add_to_maven_depmap org.apache.solr solr-$mod %{version} JPP %{name}-$mod
install -Dpm 644 src/maven/solr-$mod-pom.xml.template %{buildroot}%{_mavenpomdir}/JPP-%{name}-$mod.pom
done
%add_to_maven_depmap org.apache.solr solr-parent %{version} JPP %{name}-parent
install -Dpm 644 src/maven/solr-parent-pom.xml.template %{buildroot}%{_mavenpomdir}/JPP-%{name}-parent.pom
install -d -m 0755 %{buildroot}%{_datadir}/webapps-java/%{name}
cp -R dist/webapp/* %{buildroot}%{_datadir}/webapps-java/%{name}/
# javadoc
install -d -m 0755 %{buildroot}%{_javadocdir}/%{name}
cp -r docs/api/* %{buildroot}%{_javadocdir}/%{name}
# tomcat6 webapp config
install -d -m 0755 %{buildroot}%{_sysconfdir}/tomcat6/Catalina/localhost/
cp %{name}.xml %{buildroot}%{_sysconfdir}/tomcat6/Catalina/localhost/
# copy default tomcat solr home into /var/lib. Users can modify depending on their needs
# webapp needs write permissions for this directory
install -d -m 0775 %{buildroot}%{_sharedstatedir}/%{name}-tomcat
cp -R example/solr/* %{buildroot}%{_sharedstatedir}/%{name}-tomcat/
%post
%update_maven_depmap
%postun
%update_maven_depmap
%files
%defattr(-,root,root,-)
%doc CHANGES.txt LICENSE.txt NOTICE.txt README.txt
%doc example/solr
%{_javadir}/*.jar
%{_mavenpomdir}/*
%{_mavendepmapfragdir}/*
%files webapp
%defattr(-,root,root,-)
%{_datadir}/webapps-java/%{name}
%files tomcat6
%defattr(-,tomcat,tomcat,-)
%{_sysconfdir}/tomcat6/Catalina/localhost/%{name}.xml
%{_sharedstatedir}/%{name}-tomcat
%files javadoc
%defattr(-,root,root,-)
%doc LICENSE.txt NOTICE.txt
%doc %{_javadocdir}/%{name}
%changelog
* Tue Mar 8 2011 Stanislav Ochotnicky - 1.4.1-1
- Initial version of the package