diff options
author | edwin <edwin@FreeBSD.org> | 2008-01-19 19:53:15 +0800 |
---|---|---|
committer | edwin <edwin@FreeBSD.org> | 2008-01-19 19:53:15 +0800 |
commit | fc3d416af56366d81791517a73125a757b9d266f (patch) | |
tree | 045ccdc6e7a927d00ac3bca07e0637951b8ddd8b | |
parent | b20387be31c51e0e914a7bc2f899d29f580ee431 (diff) | |
download | freebsd-ports-gnome-fc3d416af56366d81791517a73125a757b9d266f.tar.gz freebsd-ports-gnome-fc3d416af56366d81791517a73125a757b9d266f.tar.zst freebsd-ports-gnome-fc3d416af56366d81791517a73125a757b9d266f.zip |
Development version of textproc/sphinxsearch
Sphinx is a full-text search engine, distributed under GPL version
2. Commercial license is also available for embedded use.
Generally, it's 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.
As for the name, Sphinx is an acronym which is officially decoded as
SQL Phrase Index.
WWW: http://www.sphinxsearch.com/
Submitted by: Daniel Gerzo <danger@FreeBSD.org>
-rw-r--r-- | textproc/Makefile | 1 | ||||
-rw-r--r-- | textproc/sphinxsearch-devel/Makefile | 128 | ||||
-rw-r--r-- | textproc/sphinxsearch-devel/distinfo | 3 | ||||
-rw-r--r-- | textproc/sphinxsearch-devel/files/patch-src-searchd.cpp | 11 | ||||
-rw-r--r-- | textproc/sphinxsearch-devel/files/pkg-deinstall.in | 32 | ||||
-rw-r--r-- | textproc/sphinxsearch-devel/files/pkg-install.in | 123 | ||||
-rw-r--r-- | textproc/sphinxsearch-devel/files/sphinxsearch.sh.in | 70 | ||||
-rw-r--r-- | textproc/sphinxsearch-devel/pkg-descr | 14 | ||||
-rw-r--r-- | textproc/sphinxsearch-devel/pkg-plist | 16 |
9 files changed, 398 insertions, 0 deletions
diff --git a/textproc/Makefile b/textproc/Makefile index ccb45f4a3d35..d54f8193f8d9 100644 --- a/textproc/Makefile +++ b/textproc/Makefile @@ -957,6 +957,7 @@ SUBDIR += sp SUBDIR += spellutils SUBDIR += sphinxsearch + SUBDIR += sphinxsearch-devel SUBDIR += sr-aspell SUBDIR += srilm SUBDIR += ssddiff diff --git a/textproc/sphinxsearch-devel/Makefile b/textproc/sphinxsearch-devel/Makefile new file mode 100644 index 000000000000..5a76beb7ee13 --- /dev/null +++ b/textproc/sphinxsearch-devel/Makefile @@ -0,0 +1,128 @@ +# New ports collection makefile for: Sphinx full-text search engine +# Date created: 18 January 2008 +# Whom: Daniel Gerzo <danger@FreeBSD.org> +# +# $FreeBSD$ +# +# Note: the Sphinx Storage Engine MySQL plugin is not supported by +# this port. You need a patched version of mysql server for that. + +PORTNAME= sphinxsearch +PORTVERSION= 0.9.8.r1065 +CATEGORIES= textproc databases +MASTER_SITES= http://www.sphinxsearch.com/downloads/ +PKGNAMESUFFIX?= -devel +DISTNAME= sphinx-0.9.8-svn-r1065 + +MAINTAINER= danger@FreeBSD.org +COMMENT= Sphinx Full-Text Search Engine + +LATEST_LINK= sphinxsearch-devel + +CONFLICTS= sphinxsearch-[0-9]* + +OPTIONS= MYSQL "MySQL support" on \ + PGSQL "PostgreSQL support" off \ + OPTIMIZED_CFLAGS "Use compiler optimization (-O3)" off + +SPHINX_USR?= _sphinx +SPHINX_UID?= 312 +SPHINX_GRP?= _sphinx +SPHINX_GID?= 312 +SPHINX_DIR?= /var/db/${PORTNAME} +SPHINX_RUN?= /var/run/${PORTNAME} +SPHINX_LOG?= /var/log/${PORTNAME} + +# Yes, the conflation of CPPFLAGS and CXXFLAGS is deliberate. No, +# don't ask. + +GNU_CONFIGURE= yes +CONFIGURE_TARGET= --build=${MACHINE_ARCH}-portbld-freebsd${OSREL} +CONFIGURE_ENV+= CC=${CC} CPPFLAGS="${CXXFLAGS}" +CFGFILE= ${PREFIX}/etc/sphinx.conf +USE_RC_SUBR= sphinxsearch.sh +SUB_LIST+= PORTNAME=${PORTNAME} \ + CFGFILE=${CFGFILE} \ + SPHINX_USR=${SPHINX_USR} \ + SPHINX_UID=${SPHINX_UID} \ + SPHINX_GRP=${SPHINX_GRP} \ + SPHINX_GID=${SPHINX_GID} \ + SPHINX_DIR=${SPHINX_DIR} \ + SPHINX_RUN=${SPHINX_RUN} \ + SPHINX_LOG=${SPHINX_LOG} +SUB_FILES+= pkg-install pkg-deinstall + +.if !defined(NOPORTDOCS) +EXAMPLES= example.sql api/sphinxapi.php api/test.php api/test2.php +DOCS= doc/sphinx.css doc/sphinx.html doc/sphinx.txt doc/sphinx.xml +.endif + +.include <bsd.port.pre.mk> + +# The port will successfully compile with both PGSQL and MYSQL support +# simultaneously. Not sure how useful that is in practice though. + +.if defined(WITH_MYSQL) && !defined(WITHOUT_MYSQL) +CONFIGURE_ARGS+= --with-mysql +USE_MYSQL= yes +.else +CONFIGURE_ARGS+= --without-mysql +.endif + +.if defined(WITH_PGSQL) && !defined(WITHOUT_PGSQL) +CONFIGURE_ARGS+= --with-pgsql +USE_PGSQL= yes +.else +CONFIGURE_ARGS+= --without-pgsql +.endif + +.if defined(WITH_OPTIMIZED_CFLAGS) +CXXFLAGS+= -O3 -fomit-frame-pointer +.endif + +# Fix up the sample configuration file to correspond to FreeBSD norms + +post-patch: + @${REINPLACE_CMD} \ + -e "s!@CONFDIR@/log/searchd.pid!${SPHINX_RUN}/searchd.pid!" \ + -e "s!@CONFDIR@/log/query.log!${SPHINX_LOG}/sphinx-query.log!" \ + -e "s!@CONFDIR@/log/searchd.log!${SPHINX_LOG}/searchd.log!" \ + -e "s!@CONFDIR@!${SPHINX_DIR}!" \ + ${WRKSRC}/sphinx.conf.in + +pre-install: + @${SETENV} ${SCRIPTS_ENV} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL + +do-install: install-bin install-docs install-examples + +install-bin: + ${INSTALL_PROGRAM} ${WRKSRC}/src/indexer ${PREFIX}/bin/indexer + ${INSTALL_PROGRAM} ${WRKSRC}/src/search ${PREFIX}/bin/search + ${INSTALL_PROGRAM} ${WRKSRC}/src/searchd ${PREFIX}/sbin/searchd + ${INSTALL_DATA} ${WRKSRC}/sphinx.conf.dist ${CFGFILE}.sample + +install-docs: +.if !defined(NOPORTDOCS) + @${MKDIR} ${DOCSDIR} +.for doc in ${DOCS} + ${INSTALL_DATA} ${WRKSRC}/${doc} ${DOCSDIR} +.endfor +.endif + +install-examples: +.if !defined(NOPORTDOCS) + @${MKDIR} ${EXAMPLESDIR} +.for example in ${EXAMPLES} + ${INSTALL_DATA} ${WRKSRC}/${example} ${EXAMPLESDIR} +.endfor +.endif + +post-install: post-install-cfg + @${SETENV} ${SCRIPTS_ENV} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL + +post-install-cfg: + @if [ ! -f ${CFGFILE} ]; then \ + ${CP} -p ${CFGFILE}.sample ${CFGFILE} ; \ + fi + +.include <bsd.port.post.mk> diff --git a/textproc/sphinxsearch-devel/distinfo b/textproc/sphinxsearch-devel/distinfo new file mode 100644 index 000000000000..4f73ea6397dd --- /dev/null +++ b/textproc/sphinxsearch-devel/distinfo @@ -0,0 +1,3 @@ +MD5 (sphinx-0.9.8-svn-r1065.tar.gz) = 98fbb0d6018b8aa62467105483336f7f +SHA256 (sphinx-0.9.8-svn-r1065.tar.gz) = f8d4e9084570400be377c276c0987609d9e329ffc046806f8c99ec9adfc3fd59 +SIZE (sphinx-0.9.8-svn-r1065.tar.gz) = 491770 diff --git a/textproc/sphinxsearch-devel/files/patch-src-searchd.cpp b/textproc/sphinxsearch-devel/files/patch-src-searchd.cpp new file mode 100644 index 000000000000..b69e0395a1d4 --- /dev/null +++ b/textproc/sphinxsearch-devel/files/patch-src-searchd.cpp @@ -0,0 +1,11 @@ +diff -ruN sphinx-0.9.8-svn-r1065.orig/src/searchd.cpp sphinx-0.9.8-svn-r1065/src/searchd.cpp +--- src/searchd.cpp 2008-01-14 01:49:00.000000000 +0100 ++++ src/searchd.cpp 2008-01-18 23:44:55.000000000 +0100 +@@ -20,6 +20,7 @@ + #include <signal.h> + #include <stdio.h> + #include <string.h> ++#include <sys/resource.h> + #include <sys/stat.h> + #include <sys/types.h> + #include <time.h> diff --git a/textproc/sphinxsearch-devel/files/pkg-deinstall.in b/textproc/sphinxsearch-devel/files/pkg-deinstall.in new file mode 100644 index 000000000000..85b63ccf82cf --- /dev/null +++ b/textproc/sphinxsearch-devel/files/pkg-deinstall.in @@ -0,0 +1,32 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +sphinx_usr=%%SPHINX_USR%% +sphinx_grp=%%SPHINX_GRP%% +sphinx_dir=%%SPHINX_DIR%% +sphinx_name=%%PORTNAME%% + +case $2 in + POST-DEINSTALL) + + cat <<EOMSG + +The $sphinx_name port has been deleted. If you are not +upgrading and don't intend to use $sphinx_name any more +then you may wish to delete the $sphinx_usr account, +and the $sphinx_grp group together with the working +directory $sphinx_dir; which can be done with the +following commands: + + # pw userdel -n $sphinx_usr + # rm -rf $sphinx_dir +EOMSG + echo + ;; +esac + +# +# That's All Folks! +# diff --git a/textproc/sphinxsearch-devel/files/pkg-install.in b/textproc/sphinxsearch-devel/files/pkg-install.in new file mode 100644 index 000000000000..37e03b835600 --- /dev/null +++ b/textproc/sphinxsearch-devel/files/pkg-install.in @@ -0,0 +1,123 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +PATH=/usr/sbin:/usr/bin:/bin ; export PATH + +sphinx_dir=%%SPHINX_DIR%% +sphinx_usr=%%SPHINX_USR%% +sphinx_uid=%%SPHINX_UID%% +sphinx_grp=%%SPHINX_GRP%% +sphinx_gid=%%SPHINX_GID%% +sphinx_run=%%SPHINX_RUN%% +sphinx_log=%%SPHINX_LOG%% +sphinx_name=%%PORTNAME%% + +sphinx_gcos="Sphinxsearch Owner" +sphinx_home=/nonexistent +sphinx_shell=/sbin/nologin + +create_group() { + local user uid group gid gcos home shell + + user=$1 + uid=$2 + group=$3 + gid=$4 + gcos=$5 + home=$6 + shell=$7 + + if pw groupadd -n $group -g $gid ; then + echo "===> Group $group created" + else + cat <<-EOERRORMSG + *** Failed to create the $group group. + + Please add the $user user and $group group + manually with the commands: + + pw groupadd -n $group -g $gid + pw useradd -n $user -u $uid -g $group -c "$gcos" \\ + -d $home -s $shell -h - + + and retry installing this package. + EOERRORMSG + exit 1 + fi +} + + +create_user() { + local user uid group gid gcos home shell + + user=$1 + uid=$2 + group=$3 + gid=$4 + gcos=$5 + home=$6 + shell=$7 + + if pw useradd -n $user -u $uid -g $group -c "$gcos" -d $home \ + -s $shell -h - ; then + echo "===> Created $user user" + else + cat <<-EOERRORMSG + *** Failed to create the $user user. + + Please add the $user user manually with the command: + + pw useradd -n $user -u $uid -g $group -c "$gcos" \\ + -d $home -s $shell -h - + + and retry installing this package. + EOERRORMSG + exit 1 + fi +} + + +case $2 in + PRE-INSTALL) + + # Create the sphinx user and group if they do not already exist + + if pw user show -n $sphinx_usr >/dev/null 2>&1 ; then + echo "===> Using pre-existing user $sphinx_usr" + else + if ! pw group show -n $sphinx_grp >/dev/null 2>&1 ; then + create_group $sphinx_usr $sphinx_uid $sphinx_grp $sphinx_gid \ + "$sphinx_gcos" $sphinx_home $sphinx_shell + fi + create_user $sphinx_usr $sphinx_uid $sphinx_grp $sphinx_gid \ + "$sphinx_gcos" $sphinx_home $sphinx_shell + fi + ;; + POST-INSTALL) + + # Create and set ownership of the Sphinx working directory + if [ -d $sphinx_dir ]; then + echo "==> Using pre-existing directory $sphinx_dir" + else + echo "==> Creating the Sphinx working directory: $sphinx_dir" + mkdir -m 755 $sphinx_dir || exit 1 + fi + + # Create and set ownership of the Sphinx data directory + if [ -d $sphinx_dir/data ]; then + echo "==> Using pre-existing directory $sphinx_dir/data" + else + echo "==> Creating the Sphinx data directory: $sphinx_dir/data" + mkdir -m 755 $sphinx_dir/data || exit 1 + fi + + echo "===> Adjusting file ownership in $sphinx_dir" + chown -R $sphinx_usr:$sphinx_grp $sphinx_dir || exit 1 + ;; +esac + +# +# That's All Folks! +# diff --git a/textproc/sphinxsearch-devel/files/sphinxsearch.sh.in b/textproc/sphinxsearch-devel/files/sphinxsearch.sh.in new file mode 100644 index 000000000000..5fe3887eafa5 --- /dev/null +++ b/textproc/sphinxsearch-devel/files/sphinxsearch.sh.in @@ -0,0 +1,70 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# PROVIDE: %%PORTNAME%% +# REQUIRE: LOGIN +# KEYWORD: shutdown + +# +# Add the following lines to /etc/rc.conf to enable %%PORTNAME%%: +# +# %%PORTNAME%%_enable="YES" +# +# Other rc.conf variables: +# +# %%PORTNAME%%_conffile="%%CFGFILE%%" +# -- path to config file +# %%PORTNAME%%_pidfile="%%SPHINX_RUN%%/searchd.pid" +# -- location of pidfile: must match setting +# in ${%%PORTNAME%%_conffile} +# %%PORTNAME%%_user="%%SPHINX_USR%%" +# -- user to run searchd as +# %%PORTNAME%%_group="%%SPHINX_GRP%%" +# -- group to run searchd as +# %%PORTNAME%%_logdir="%%SPHINX_LOG%%" +# -- directory searchd writes logs to +# +. /etc/rc.subr + +name=%%PORTNAME%% +rcvar=`set_rcvar` + +load_rc_config ${name} + +: ${%%PORTNAME%%_enable="NO"} +: ${%%PORTNAME%%_conffile="%%CFGFILE%%"} +: ${%%PORTNAME%%_pidfile="%%SPHINX_RUN%%/searchd.pid"} +: ${%%PORTNAME%%_user="%%SPHINX_USR%%"} +: ${%%PORTNAME%%_group="%%SPHINX_GRP%%"} +: ${%%PORTNAME%%_logdir="%%SPHINX_LOG%%"} + +command=%%PREFIX%%/sbin/searchd +pidfile=${%%PORTNAME%%_pidfile} +required_files=${%%PORTNAME%%_conffile} + +%%PORTNAME%%_precmd () +{ + piddir=$(dirname ${%%PORTNAME%%_pidfile}) + if [ ! -d ${piddir} ]; then + mkdir -m 755 -p ${piddir} + chown -R ${%%PORTNAME%%_user}:${%%PORTNAME%%_group} ${piddir} + fi + if [ ! -d ${%%PORTNAME%%_logdir} ]; then + mkdir -m 755 -p ${%%PORTNAME%%_logdir} + chown -R ${%%PORTNAME%%_user}:${%%PORTNAME%%_group} \ + ${%%PORTNAME%%_logdir} + fi +} + +case "${%%PORTNAME%%_flags}" in + *--config\ *) + echo "Warning \$%%PORTNAME%%_flags includes --config option." \ + "Please use \$%%PORTNAME%%_conffile instead." + ;; + *) + %%PORTNAME%%_flags="--config ${%%PORTNAME%%_conffile} ${%%PORTNAME%%_flags}" + ;; +esac + +run_rc_command "$1" diff --git a/textproc/sphinxsearch-devel/pkg-descr b/textproc/sphinxsearch-devel/pkg-descr new file mode 100644 index 000000000000..59b3fdaa98a7 --- /dev/null +++ b/textproc/sphinxsearch-devel/pkg-descr @@ -0,0 +1,14 @@ +Sphinx is a full-text search engine, distributed under GPL version +2. Commercial license is also available for embedded use. + +Generally, it's 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. + +As for the name, Sphinx is an acronym which is officially decoded as +SQL Phrase Index. + +WWW: http://www.sphinxsearch.com/ diff --git a/textproc/sphinxsearch-devel/pkg-plist b/textproc/sphinxsearch-devel/pkg-plist new file mode 100644 index 000000000000..72eeabf7f437 --- /dev/null +++ b/textproc/sphinxsearch-devel/pkg-plist @@ -0,0 +1,16 @@ +bin/indexer +bin/search +sbin/searchd +@unexec if cmp -s %D/etc/sphinx.conf.sample %D/etc/sphinx.conf; then rm -f %D/etc/sphinx.conf; fi +etc/sphinx.conf.sample +@exec if [ ! -f %D/etc/sphinx.conf ] ; then cp -p %D/%F %B/sphinx.conf; fi +%%PORTDOCS%%%%DOCSDIR%%/sphinx.css +%%PORTDOCS%%%%DOCSDIR%%/sphinx.html +%%PORTDOCS%%%%DOCSDIR%%/sphinx.txt +%%PORTDOCS%%%%DOCSDIR%%/sphinx.xml +%%PORTDOCS%%%%EXAMPLESDIR%%/example.sql +%%PORTDOCS%%%%EXAMPLESDIR%%/sphinxapi.php +%%PORTDOCS%%%%EXAMPLESDIR%%/test.php +%%PORTDOCS%%%%EXAMPLESDIR%%/test2.php +%%PORTDOCS%%@dirrm %%DOCSDIR%% +%%PORTDOCS%%@dirrm %%EXAMPLESDIR%% |