- from PLD
authorMarcin Krol <hawk@tld-linux.org>
Thu, 23 Jul 2015 22:32:50 +0000 (22:32 +0000)
committerMarcin Krol <hawk@tld-linux.org>
Thu, 23 Jul 2015 22:32:50 +0000 (22:32 +0000)
bug-468.patch [new file with mode: 0644]
libstemmer.patch [new file with mode: 0644]
sphinx.conf.sh [new file with mode: 0755]
sphinx.init [new file with mode: 0755]
sphinx.logrotate [new file with mode: 0644]
sphinx.spec [new file with mode: 0644]
sphinx.tmpfiles [new file with mode: 0644]
x32.patch [new file with mode: 0644]

diff --git a/bug-468.patch b/bug-468.patch
new file mode 100644 (file)
index 0000000..247982f
--- /dev/null
@@ -0,0 +1,23 @@
+http://www.sphinxsearch.com/bugs/view.php?id=468
+http://code.google.com/p/sphinxsearch/source/detail?r=2225
+
+--- sphinx-0.9.9/api/libsphinxclient/sphinxclient.c~   2009-11-14 01:23:06.000000000 +0200
++++ sphinx-0.9.9/api/libsphinxclient/sphinxclient.c    2010-03-31 00:51:23.815645056 +0300
+@@ -277,7 +277,7 @@
+ }
+-void sock_close ( int sock );
++static void sock_close ( int sock );
+ void sphinx_destroy ( sphinx_client * client )
+ {
+@@ -1253,7 +1253,7 @@
+ }
+-void sock_close ( int sock )
++static void sock_close ( int sock )
+ {
+       if ( sock<0 )
+               return;
diff --git a/libstemmer.patch b/libstemmer.patch
new file mode 100644 (file)
index 0000000..8858d5e
--- /dev/null
@@ -0,0 +1,11 @@
+--- sphinx-2.2.8-release/acinclude.m4~ 2013-11-12 12:53:36.000000000 +0100
++++ sphinx-2.2.8-release/acinclude.m4  2015-03-15 10:20:29.942336158 +0100
+@@ -322,7 +322,7 @@
+ includedirs="/usr/include /usr/include/libstemmer /usr/include/libstemmer_c"
+ # possible libdirs -- 64bit first in case of multiarch environments
+-libdirs="/usr/lib/x86_64-linux-gnu /usr/lib64 /usr/local/lib64 /usr/lib/i386-linux-gnu /usr/lib /usr/local/lib"
++libdirs="/usr/libx32 /usr/lib64 /usr/lib"
+ # possible libnames -- shared one first, then static one
+ libnames="stemmer stemmer_c"
diff --git a/sphinx.conf.sh b/sphinx.conf.sh
new file mode 100755 (executable)
index 0000000..ce24025
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+# include support for sphinx configs
+# until real include directive added, which may be never
+# http://sphinxsearch.com/bugs/view.php?id=964
+
+dir=$(dirname "$0")
+
+# load global config: indexer, searchd
+cat $dir/sphinx-common.conf
+
+# load extra indexes definitons
+for config in $dir/index.d/*.conf; do
+       if [ -f "$config" ]; then
+               cat "$config"
+       fi
+done
diff --git a/sphinx.init b/sphinx.init
new file mode 100755 (executable)
index 0000000..353410d
--- /dev/null
@@ -0,0 +1,110 @@
+#!/bin/sh
+#
+# sphinx searchd Free open-source SQL full-text search engine
+#
+# chkconfig:   345 20 80
+#
+# description: Starts and stops the sphinx searchd daemon that handles \
+#             all search requests.
+#
+# processname: searchd
+#
+# $Id$
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+# Get network config
+. /etc/sysconfig/network
+
+# Get service config - may override defaults
+SEARCHD_CONFIG=/etc/sphinx/sphinx.conf
+[ -f /etc/sysconfig/sphinx ] && . /etc/sysconfig/sphinx
+
+# Check that networking is up.
+if is_yes "${NETWORKING}"; then
+       if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+               msg_network_down "sphinx searchd"
+               exit 1
+       fi
+else
+       exit 0
+fi
+
+start() {
+       # Check if the service is already running?
+       if [ -f /var/lock/subsys/sphinx ]; then
+               msg_already_running "sphinx searchd"
+               return
+       fi
+
+       msg_starting "sphinx searchd"
+    daemon --user sphinx /usr/sbin/searchd --config $SEARCHD_CONFIG
+       RETVAL=$?
+       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sphinx
+}
+
+stop() {
+       if [ ! -f /var/lock/subsys/sphinx ]; then
+               msg_not_running "sphinx searchd"
+               return
+       fi
+
+       # Stop daemons.
+       msg_stopping "sphinx searchd"
+       killproc searchd
+       rm -f /var/lock/subsys/sphinx
+}
+
+reload() {
+       if [ ! -f /var/lock/subsys/sphinx ]; then
+               msg_not_running "sphinx searchd"
+               RETVAL=7
+               return
+       fi
+
+       msg_reloading "sphinx searchd"
+       killproc searchd -HUP
+       RETVAL=$?
+}
+
+condrestart() {
+       if [ ! -f /var/lock/subsys/sphinx ]; then
+               msg_not_running "sphinx searchd"
+               RETVAL=$1
+               return
+       fi
+
+       stop
+       start
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
+       ;;
+  restart)
+       stop
+       start
+       ;;
+  try-restart)
+       condrestart 0
+       ;;
+  reload|force-reload)
+       reload
+       ;;
+  status)
+       status sphinx searchd
+       RETVAL=$?
+       ;;
+  *)
+       msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
+       exit 3
+esac
+
+exit $RETVAL
diff --git a/sphinx.logrotate b/sphinx.logrotate
new file mode 100644 (file)
index 0000000..0ff736a
--- /dev/null
@@ -0,0 +1,12 @@
+/var/log/sphinx/*.log
+{
+       su root sphinx
+       weekly
+       rotate 10
+       copytruncate
+       delaycompress
+       compress
+       notifempty
+       missingok
+       olddir /var/log/archive/sphinx
+}
diff --git a/sphinx.spec b/sphinx.spec
new file mode 100644 (file)
index 0000000..1a2f48c
--- /dev/null
@@ -0,0 +1,342 @@
+# TODO:
+#  - package for ruby API
+#  - subpackage for driver backend deps if code patched to support it:
+#    sphinx-0.9.9-2.i686: required "libodbc.so.1" is provided by following packages:
+#    libmysqlclient.so.16 libmysqlclient.so.16(libmysqlclient_16) libpq.so.5
+#
+# Conditional build:
+%bcond_without java            # without Java support
+%bcond_without libstemmer      # without libstemmer support
+%bcond_without mysql           # without MySQL support
+%bcond_without pgsql           # without PostgreSQL support
+
+%define                php_min_version 5.0.4
+%include       /usr/lib/rpm/macros.php
+%{?with_java:%include  /usr/lib/rpm/macros.java}
+Summary:       Free open-source SQL full-text search engine
+Summary(pl.UTF-8):     Silnik przeszukiwania pełnotekstowego SQL open-source
+Name:          sphinx
+Version:       2.2.9
+Release:       1
+License:       GPL v2
+Group:         Applications/Databases
+Source0:       http://www.sphinxsearch.com/files/%{name}-%{version}-release.tar.gz
+# Source0-md5: 1fcc3d180c0559bdeb93602ef248caf4
+Source1:       %{name}.init
+Source2:       %{name}.logrotate
+Source3:       %{name}.conf.sh
+Source4:       %{name}.tmpfiles
+Patch0:                bug-468.patch
+Patch1:                libstemmer.patch
+Patch2:                x32.patch
+URL:           http://www.sphinxsearch.com/
+BuildRequires: autoconf
+BuildRequires: automake >= 1:1.12
+BuildRequires: expat-devel
+%{?with_java:BuildRequires:    jdk}
+BuildRequires: libstdc++-devel
+%{?with_libstemmer:BuildRequires:      libstemmer-devel}
+BuildRequires: libtool
+%{?with_mysql:BuildRequires:   mysql-devel}
+%{?with_pgsql:BuildRequires:   postgresql-devel}
+BuildRequires: python
+BuildRequires: python-modules
+%{?with_java:BuildRequires:    rpm-javaprov}
+BuildRequires: rpm-php-pearprov >= 4.4.2-11
+BuildRequires: rpm-pythonprov
+BuildRequires: rpmbuild(macros) >= 1.647
+Requires(postun):      /usr/sbin/groupdel
+Requires(postun):      /usr/sbin/userdel
+Requires(pre): /bin/id
+Requires(pre): /usr/bin/getgid
+Requires(pre): /usr/sbin/groupadd
+Requires(pre): /usr/sbin/useradd
+Provides:      group(sphinx)
+Provides:      user(sphinx)
+Conflicts:     logrotate < 3.8.0
+BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%define                _sysconfdir     /etc/%{name}
+
+%description
+Sphinx is a a standalone search engine, meant to provide fast,
+size-efficient and relevant fulltext search functions to other
+applications. Sphinx was specially designed to integrate well with SQL
+databases and scripting languages. Currently built-in data sources
+support fetching data either via direct connection to MySQL, or from
+an XML pipe.
+
+%description -l pl.UTF-8
+Sphinx jest samodzielnym silnikiem przeszukującym, dostarczającym
+innym aplikacjom szybkie, zoptymalizowane rozmiarowo funkcje
+przeszukiwania pełnotekstowego. Sphinx został specjalnie
+zaprojektowany z myślą o dobrej integracji z bazami danych SQL oraz
+językami skryptowymi. Obecnie wbudowane źródła danych wspierają
+pobieranie danych poprzez bezpośrednie połączenie z MySQL lub z potoku
+XML.
+
+%package -n libsphinxclient
+Summary:       Client library for Sphinx
+Summary(pl.UTF-8):     Biblioteka kliencka do Sphinx
+Group:         Libraries
+
+%description -n libsphinxclient
+This package provides a client library for Sphinx search engine.
+
+%description -n libsphinxclient -l pl.UTF-8
+Ten pakiet dostarcza bibliotekę kliencką do silnika Sphinx.
+
+%package -n libsphinxclient-devel
+Summary:       Header files for sphinxclient library
+Summary(pl.UTF-8):     Pliki nagłówkowe biblioteki sphinxclient
+Group:         Development/Libraries
+Requires:      libsphinxclient = %{version}-%{release}
+
+%description -n libsphinxclient-devel
+Header files for sphinxclient library.
+
+%description -n libsphinxclient-devel -l pl.UTF-8
+Pliki nagłówkowe biblioteki sphinxclient.
+
+%package -n libsphinxclient-static
+Summary:       Static sphinxclient library
+Summary(pl.UTF-8):     Statyczna biblioteka sphinxclient
+Group:         Development/Libraries
+Requires:      libsphinxclient-devel = %{version}-%{release}
+
+%description -n libsphinxclient-static
+Static sphinxclient library.
+
+%description -n libsphinxclient-static -l pl.UTF-8
+Statyczna biblioteka sphinxclient.
+
+%package -n java-sphinxapi
+Summary:       Java API for Sphinx
+Summary(pl.UTF-8):     API Javy dla Sphinksa
+Group:         Development/Languages/Java
+Requires:      jpackage-utils
+Obsoletes:     java-sphinx < 2.0.3-5
+%if "%{_rpmversion}" >= "5"
+BuildArch:     noarch
+%endif
+
+%description -n java-sphinxapi
+Java API for Sphinx.
+
+%description -n java-sphinxapi -l pl.UTF-8
+API Javy dla Sphinksa.
+
+%package -n php-sphinxapi
+Summary:       PHP API for Sphinx Search
+Summary(pl.UTF-8):     API PHP dla Sphinksa
+Group:         Libraries
+Requires:      php(core) >= %{php_min_version}
+Provides:      php(sphinx)
+Obsoletes:     php-sphinx < 2.0.3-5
+%if "%{_rpmversion}" >= "5"
+BuildArch:     noarch
+%endif
+
+%description -n php-sphinxapi
+PHP API for Sphinx Search.
+
+%description -n php-sphinxapi -l pl.UTF-8
+API PHP dla Sphinksa.
+
+%package -n python-sphinxapi
+Summary:       Python API for Sphinx Search
+Summary(pl.UTF-8):     API Python dla Sphinksa
+Group:         Development/Languages/Python
+Requires:      python
+Obsoletes:     python-sphinx < 2.0.3-5
+%if "%{_rpmversion}" >= "5"
+BuildArch:     noarch
+%endif
+
+%description -n python-sphinxapi
+Python API for Sphinx Search.
+
+%description -n python-sphinxapi -l pl.UTF-8
+API Pythona dla Sphinksa.
+
+%prep
+%setup -q -n %{name}-%{version}-release
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+
+sed -i -e 's#AM_MAINTAINER_MODE#AM_MAINTAINER_MODE\nAM_PROG_AR#' configure.ac
+
+sed -i -e '
+       s#/var/run/#/var/run/sphinx/#
+       s#@CONFDIR@/log/searchd.pid#/var/run/sphinx/searchd.pid#
+       s#@CONFDIR@/log/#/var/log/sphinx/#g
+       s#@CONFDIR@/data/#/var/lib/sphinx/#g
+' sphinx*.conf.in
+
+%build
+%{__aclocal}
+%{__autoconf}
+CPPFLAGS=-D_FILE_OFFSET_BITS=64
+%configure \
+       --with%{!?with_libstemmer:out}-libstemmer \
+       --with%{!?with_pgsql:out}-pgsql \
+       --with%{!?with_mysql:out}-mysql \
+       --with-syslog
+%{__make} -j1
+# use .conf ext for %doc
+cp -pf sphinx.conf.dist sphinx.conf
+cp -pf sphinx-min.conf.dist sphinx-min.conf
+
+# libsphinxclient
+cd api/libsphinxclient
+%{__libtoolize}
+%{__aclocal}
+%{__autoconf}
+%{__autoheader}
+%{__automake}
+CPPFLAGS=-D_FILE_OFFSET_BITS=64
+%configure
+%{__make} -j1
+cd ../..
+
+# java api
+%if %{with java}
+export JAVA_HOME="%{java_home}"
+%{__make} -j1 -C api/java
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT{%{_sbindir},/etc/{logrotate.d,rc.d/init.d}}\
+       $RPM_BUILD_ROOT{/var/{log,run,lib}/%{name},/var/log/archive/%{name}} \
+       $RPM_BUILD_ROOT%{systemdtmpfilesdir}
+
+%{__make} -j1 install \
+       DESTDIR=$RPM_BUILD_ROOT
+
+rm $RPM_BUILD_ROOT%{_sysconfdir}/example.sql
+rm $RPM_BUILD_ROOT%{_sysconfdir}/sphinx.conf.dist
+
+# create default config with no index definition
+sed -e '/## data source definition/,/## indexer settings/d' sphinx.conf > $RPM_BUILD_ROOT%{_sysconfdir}/sphinx-common.conf
+# dir for indexes definition
+install -d $RPM_BUILD_ROOT%{_sysconfdir}/index.d
+
+rm $RPM_BUILD_ROOT%{_sysconfdir}/sphinx-min.conf.dist
+mv $RPM_BUILD_ROOT{%{_bindir},%{_sbindir}}/searchd
+install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
+cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
+install -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.conf
+install %{SOURCE4} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{name}.conf
+
+install -d $RPM_BUILD_ROOT%{php_data_dir}
+cp -p api/sphinxapi.php $RPM_BUILD_ROOT%{php_data_dir}
+
+# libsphinxclient
+%{__make} -C api/libsphinxclient install \
+       DESTDIR=$RPM_BUILD_ROOT
+
+# python api
+install -d $RPM_BUILD_ROOT%{py_sitescriptdir}
+cp -p api/sphinxapi.py $RPM_BUILD_ROOT%{py_sitescriptdir}
+%py_comp $RPM_BUILD_ROOT%{py_sitescriptdir}
+%py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir}
+%py_postclean
+
+# ruby api
+
+# java api
+%if %{with java}
+install -d $RPM_BUILD_ROOT%{_javadir}
+cp -p api/java/sphinxapi.jar $RPM_BUILD_ROOT%{_javadir}/sphinxapi-%{version}.jar
+ln -s sphinxapi-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/sphinxapi.jar
+%endif
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post  -n libsphinxclient -p /sbin/ldconfig
+%postun        -n libsphinxclient -p /sbin/ldconfig
+
+%pre
+%groupadd -g 249 sphinx
+%useradd -u 249 -d /var/lib/%{name} -g sphinx -c "Sphinx Search" sphinx
+
+%post
+/sbin/chkconfig --add sphinx
+%service sphinx restart
+
+%preun
+if [ "$1" = 0 ]; then
+       %service sphinx stop
+       /sbin/chkconfig --del sphinx
+fi
+
+%triggerpostun -- %{name} < 0.9.9-7.6
+if [ -f %{_sysconfdir}/sphinx.conf.rpmsave ]; then
+       cp -f %{_sysconfdir}/sphinx-common.conf{,.rpmnew}
+       mv -f %{_sysconfdir}/sphinx.conf.rpmsave %{_sysconfdir}/sphinx-common.conf
+       %service -q sphinx restart
+fi
+
+%files
+%defattr(644,root,root,755)
+%doc doc/sphinx.txt example.sql sphinx.conf sphinx-min.conf
+
+%dir %attr(750,root,sphinx) %{_sysconfdir}
+# main sphinx config
+%config(noreplace) %verify(not md5 mtime size) %attr(640,root,sphinx) %{_sysconfdir}/sphinx-common.conf
+# shell wrapper which loads main config and extra indexes config
+%attr(755,root,sphinx) %{_sysconfdir}/sphinx.conf
+# put here *.conf files defining extra indexes
+%dir %attr(750,root,sphinx) %{_sysconfdir}/index.d
+
+%config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name}
+%attr(754,root,root) /etc/rc.d/init.d/%{name}
+%attr(755,root,root) %{_bindir}/indexer
+%attr(755,root,root) %{_bindir}/indextool
+%attr(755,root,root) %{_bindir}/spelldump
+%attr(755,root,root) %{_bindir}/wordbreaker
+%attr(755,root,root) %{_sbindir}/searchd
+
+%{_mandir}/man1/indexer.1*
+%{_mandir}/man1/indextool.1*
+%{_mandir}/man1/search.1*
+%{_mandir}/man1/searchd.1*
+%{_mandir}/man1/spelldump.1*
+%{systemdtmpfilesdir}/%{name}.conf
+%dir %attr(771,root,sphinx) /var/run/sphinx
+%dir %attr(770,root,sphinx) /var/log/sphinx
+%dir %attr(770,root,sphinx) /var/log/archive/sphinx
+%dir %attr(770,root,sphinx) /var/lib/sphinx
+
+%files -n libsphinxclient
+%defattr(644,root,root,755)
+%doc api/libsphinxclient/README
+%attr(755,root,root) %{_libdir}/libsphinxclient-*.*.*.so
+
+%files -n libsphinxclient-devel
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libsphinxclient.so
+%{_libdir}/libsphinxclient.la
+%{_includedir}/sphinxclient.h
+
+%files -n libsphinxclient-static
+%defattr(644,root,root,755)
+%{_libdir}/libsphinxclient.a
+
+%if %{with java}
+%files -n java-sphinxapi
+%defattr(644,root,root,755)
+%doc api/java/README
+%{_javadir}/sphinx*.jar
+%endif
+
+%files -n php-sphinxapi
+%defattr(644,root,root,755)
+%{php_data_dir}/sphinxapi.php
+
+%files -n python-sphinxapi
+%defattr(644,root,root,755)
+%{py_sitescriptdir}/*.py[co]
diff --git a/sphinx.tmpfiles b/sphinx.tmpfiles
new file mode 100644 (file)
index 0000000..8887e7c
--- /dev/null
@@ -0,0 +1 @@
+d /var/run/sphinx 0771 root sphinx -
diff --git a/x32.patch b/x32.patch
new file mode 100644 (file)
index 0000000..3402515
--- /dev/null
+++ b/x32.patch
@@ -0,0 +1,11 @@
+--- sphinx-2.2.8-release/src/sphinxutils.cpp~  2015-01-20 08:02:07.000000000 +0100
++++ sphinx-2.2.8-release/src/sphinxutils.cpp   2015-03-15 10:30:39.062340287 +0100
+@@ -2011,7 +2011,7 @@
+               __asm __volatile__ ( "movl %%ebp,%0":"=r"(pFramePointer):"r"(pFramePointer) );
+ #endif
+-#ifdef __x86_64__
++#if defined(__x86_64__) && !defined(__ILP32__)
+ #define SIGRETURN_FRAME_OFFSET 23
+               __asm __volatile__ ( "movq %%rbp,%0":"=r"(pFramePointer):"r"(pFramePointer) );
+ #endif