aboutsummaryrefslogtreecommitdiffstats
path: root/community/sphinx
diff options
context:
space:
mode:
authorFrancesco Colista <fcolista@alpinelinux.org>2016-08-22 07:55:13 +0000
committerFrancesco Colista <fcolista@alpinelinux.org>2016-08-22 07:55:13 +0000
commit623a8e0ecf210686179171915777ac0e0c5308b1 (patch)
tree2eb2c607aa26ea3fea3152d31ca67b3793397e87 /community/sphinx
parent8ce0f835b722d4427705adaf542f994da5012b4d (diff)
downloadaports-623a8e0ecf210686179171915777ac0e0c5308b1.tar.bz2
aports-623a8e0ecf210686179171915777ac0e0c5308b1.tar.xz
community/sphinx: moved from testing
Diffstat (limited to 'community/sphinx')
-rw-r--r--community/sphinx/APKBUILD105
-rw-r--r--community/sphinx/sphinx-pagesize.patch72
-rw-r--r--community/sphinx/sphinx.confd2
-rw-r--r--community/sphinx/sphinx.initd33
4 files changed, 212 insertions, 0 deletions
diff --git a/community/sphinx/APKBUILD b/community/sphinx/APKBUILD
new file mode 100644
index 0000000000..bdf8c5009d
--- /dev/null
+++ b/community/sphinx/APKBUILD
@@ -0,0 +1,105 @@
+# Contributor: Ɓukasz Jendrysik <scadu@yandex.com>
+# Contributor: Francesco Colista <fcolista@alpinelinux.org>
+# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
+pkgname=sphinx
+pkgver=2.2.11
+pkgrel=0
+pkgdesc="Free open-source SQL full-text search engine"
+url="http://www.sphinxsearch.com"
+arch="all"
+license="GPL2"
+depends=""
+depends_dev=""
+makedepends="$depends_dev postgresql-dev mariadb-dev unixodbc-dev expat-dev
+ libre2-dev snowball-dev"
+install=""
+pkgusers="$pkgname"
+pkggroups="$pkgname"
+subpackages="$pkgname-doc $pkgname-php $pkgname-python"
+source="http://sphinxsearch.com/files/$pkgname-$pkgver-release.tar.gz
+ sphinx.initd
+ sphinx.confd
+ sphinx-pagesize.patch"
+
+_builddir="$srcdir"/$pkgname-$pkgver-release
+
+prepare() {
+ local i
+ cd "$_builddir"
+ for i in $source; do
+ case $i in
+ *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+ esac
+ done
+}
+
+build() {
+ cd "$_builddir"
+ ./configure --prefix=/usr \
+ --exec-prefix=/usr \
+ --localstatedir=/var/lib/sphinx \
+ --sysconfdir=/etc/sphinx \
+ --docdir=/usr/share/doc/sphinx \
+ --mandir=/usr/share/man \
+ --with-pgsql \
+ --with-mysql \
+ --with-unixodbc \
+ --with-libexpat \
+ --with-iconv \
+ --with-libstemmer \
+ --with-syslog \
+ --with-re2 \
+ --enable-id64
+ make || return 1
+}
+
+package() {
+ cd "$_builddir"
+ make DESTDIR="$pkgdir" install
+ install -Dm755 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname \
+ || return 1
+ install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname \
+ || return 1
+ chown -R $pkgusers:$pkggroups "$pkgdir"/var/lib/sphinx
+}
+
+
+php() {
+ pkgdesc="PHP api for sphinx search engine"
+ arch="noarch"
+ mkdir -p "$subpkgdir"/usr/share/php/$pkgname/api
+ for i in $(ls $_builddir/api/*.php); do
+ mv $i "$subpkgdir"/usr/share/php/$pkgname/api ;
+ done
+}
+
+
+python() {
+
+ pkgdesc="Python api for sphinx search engine"
+ arch="noarch"
+ mkdir -p "$subpkgdir"/usr/lib/python2.7/site-packages/$pkgname/
+ for i in $(ls $_builddir/api/*.py); do
+ mv $i "$subpkgdir"/usr/lib/python2.7/site-packages/$pkgname/ ;
+ done
+}
+
+doc() {
+ default_doc;
+ mkdir -p "$subpkgdir"/usr/share/doc/$pkgname/misc
+ cp -r "$_builddir"/misc/* "$subpkgdir"/usr/share/doc/$pkgname/misc
+
+}
+
+md5sums="5cac34f3d78a9d612ca4301abfcbd666 sphinx-2.2.11-release.tar.gz
+0c8cb04f2bc101b23d301d198fc2a7d2 sphinx.initd
+275efea3b1c4964955637862f60706bb sphinx.confd
+8360e9ce8df0147dfe5b596f61023272 sphinx-pagesize.patch"
+sha256sums="6662039f093314f896950519fa781bc87610f926f64b3d349229002f06ac41a9 sphinx-2.2.11-release.tar.gz
+5b2cd35cac67add71f857280d98ad619ff7d74097b3810c7123669ce090fbdf8 sphinx.initd
+92758356582373cb0691541ad7844ad86bfee8792023fe933aa7c4eec47713ed sphinx.confd
+ccc6e8992a182ba396d52075104469cdac8b61e02799497ed48216683e513858 sphinx-pagesize.patch"
+sha512sums="cf1a262a5b0fbf0bd2827ec6ec629edeaf709ce855a6e7b509b65342baaeb26c02717ca63f1578d32c83d21e2fd6d1e92dceb34660e6351b93cd96fd4e623689 sphinx-2.2.11-release.tar.gz
+583601ff63e663099ae40048b8a216d0bc815a50a82370a42d3e7b923c90c650d58951636041ff9000141d897357767b7895a238a4edc49c328e46241b391350 sphinx.initd
+8dbbb3b75bfbde5c6d2bee801df8c7a82650d3943dd667a4330cae473cbf18390aff5eb8d6aa6e5d69c4c995065d48289047b9166fa756c6015bf71f2b13a8f0 sphinx.confd
+9563c5a926e5be30477781038ccf115a809a32bbcbc02c5b82e7985fca76185005968b5f0442772ec598b2ff17ef5c185582e24ae74775e5358abc88192345f2 sphinx-pagesize.patch"
diff --git a/community/sphinx/sphinx-pagesize.patch b/community/sphinx/sphinx-pagesize.patch
new file mode 100644
index 0000000000..83a63b0ad5
--- /dev/null
+++ b/community/sphinx/sphinx-pagesize.patch
@@ -0,0 +1,72 @@
+diff --git a/src/sphinx.cpp b/src/sphinx.cpp
+index 71f75f3..b65aeaa 100644
+--- a/src/sphinx.cpp
++++ b/src/sphinx.cpp
+@@ -8706,7 +8706,7 @@ protected:
+ static const int MAX_BITS = 12;
+ static const int NUM_SIZES = MAX_BITS-MIN_BITS+2; ///< one for 0 (empty pages), and one for each size from min to max
+
+- static const int PAGE_SIZE = 1<<MAX_BITS;
++ static const int PAGE_SIZES = 1<<MAX_BITS;
+ static const int PAGE_ALLOCS = 1<<( MAX_BITS-MIN_BITS);
+ static const int PAGE_BITMAP = ( PAGE_ALLOCS+8*sizeof(DWORD)-1 )/( 8*sizeof(DWORD) );
+
+@@ -8820,9 +8820,9 @@ DWORD * CSphArena::ReInit ( int uMaxBytes )
+
+ DWORD * CSphArena::Init ( int uMaxBytes )
+ {
+- m_iPages = ( uMaxBytes+PAGE_SIZE-1 ) / PAGE_SIZE;
++ m_iPages = ( uMaxBytes+PAGE_SIZES-1 ) / PAGE_SIZES;
+
+- int iData = m_iPages*PAGE_SIZE; // data size, bytes
++ int iData = m_iPages*PAGE_SIZES; // data size, bytes
+ int iMyTaglist = sizeof(int) + MAX_TAGS*sizeof(TagDesc_t); // int length, TagDesc_t[] tags; NOLINT
+ int iMy = m_iPages*sizeof(PageDesc_t) + NUM_SIZES*sizeof(int) + iMyTaglist; // my internal structures size, bytes; NOLINT
+ #if ARENADEBUG
+@@ -8950,7 +8950,7 @@ int CSphArena::RawAlloc ( int iBytes )
+ pPage->m_uBitmap[i] |= ( 1<<iFree );
+
+ pPage->m_iUsed++;
+- if ( pPage->m_iUsed==( PAGE_SIZE >> pPage->m_iSizeBits ) )
++ if ( pPage->m_iUsed==( PAGE_SIZES >> pPage->m_iSizeBits ) )
+ {
+ // this page is full now, unchain from the free-list
+ assert ( m_pFreelistHeads[iSizeSlot]==pPage-m_pPages );
+@@ -8970,7 +8970,7 @@ int CSphArena::RawAlloc ( int iBytes )
+
+ CheckFreelists ();
+
+- int iOffset = ( pPage-m_pPages )*PAGE_SIZE + ( i*32+iFree )*( 1<<iSizeBits ); // raw internal byte offset (FIXME! optimize with shifts?)
++ int iOffset = ( pPage-m_pPages )*PAGE_SIZES + ( i*32+iFree )*( 1<<iSizeBits ); // raw internal byte offset (FIXME! optimize with shifts?)
+ int iIndex = 2 + ( iOffset/sizeof(DWORD) ); // dword index with tag and backtrack fixup
+
+ m_pBasePtr[iIndex-1] = DWORD(-1); // untagged by default
+@@ -8988,7 +8988,7 @@ void CSphArena::RawFree ( int iIndex )
+ CheckFreelists ();
+
+ int iOffset = (iIndex-2)*sizeof(DWORD); // remove tag fixup, and go to raw internal byte offset
+- int iPage = iOffset / PAGE_SIZE;
++ int iPage = iOffset / PAGE_SIZES;
+
+ if ( iPage<0 || iPage>m_iPages )
+ {
+@@ -8997,8 +8997,8 @@ void CSphArena::RawFree ( int iIndex )
+ }
+
+ PageDesc_t * pPage = m_pPages + iPage;
+- int iBit = ( iOffset % PAGE_SIZE ) >> pPage->m_iSizeBits;
+- assert ( ( iOffset % PAGE_SIZE )==( iBit << pPage->m_iSizeBits ) && "internal error, freed offset is unaligned" );
++ int iBit = ( iOffset % PAGE_SIZES ) >> pPage->m_iSizeBits;
++ assert ( ( iOffset % PAGE_SIZES )==( iBit << pPage->m_iSizeBits ) && "internal error, freed offset is unaligned" );
+
+ if (!( pPage->m_uBitmap[iBit>>5] & ( 1UL<<(iBit & 31) ) ))
+ {
+@@ -9018,7 +9018,7 @@ void CSphArena::RawFree ( int iIndex )
+
+ int iSizeSlot = pPage->m_iSizeBits-MIN_BITS+1;
+
+- if ( pPage->m_iUsed==( PAGE_SIZE >> pPage->m_iSizeBits )-1 )
++ if ( pPage->m_iUsed==( PAGE_SIZES >> pPage->m_iSizeBits )-1 )
+ {
+ // this page was full, but it's semi-free now
+ // chain to free-list
diff --git a/community/sphinx/sphinx.confd b/community/sphinx/sphinx.confd
new file mode 100644
index 0000000000..44082f99ce
--- /dev/null
+++ b/community/sphinx/sphinx.confd
@@ -0,0 +1,2 @@
+SPHINX_USER=sphinx
+SPHINX_GROUP=sphinx
diff --git a/community/sphinx/sphinx.initd b/community/sphinx/sphinx.initd
new file mode 100644
index 0000000000..8ab20e0b71
--- /dev/null
+++ b/community/sphinx/sphinx.initd
@@ -0,0 +1,33 @@
+#!/sbin/openrc-run
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-misc/sphinx/files/searchd.rc,v 1.1 2009/11/05 15:41:56 graaff Exp $
+
+depend() {
+ need net
+ use logger
+}
+
+checkconfig() {
+ if [ ! -f /etc/sphinx/sphinx.conf ] ; then
+ eerror "Please create /etc/sphinx/sphinx.conf"
+ eerror "Sample conf: /etc/sphinx/sphinx.conf.dist"
+ return 1
+ fi
+ return 0
+}
+
+start() {
+ checkconfig || return $?
+
+ ebegin "Starting sphinx searchd"
+ start-stop-daemon --start -u ${SPHINX_USER} -g ${SPHINX_GROUP} --exec /usr/bin/searchd
+ eend $? "Failed to start sphinx searchd"
+}
+
+stop() {
+ ebegin "Stopping sphinx searchd"
+ start-stop-daemon --stop --exec /usr/bin/searchd
+ eend $? "Failed to stop sphinx searchd"
+}
+