系統:FreeBSD 7.1-RELEASE MySQL:5.1.30 Sphinx:0.9.8.1

mysql51-server.diff
diff -Nur /usr/ports/databases/mysql51-server/Makefile mysql51-server/Makefile
— /usr/ports/databases/mysql51-server/Makefile    2008-07-27 09:56:19.000000000 +0100
+++ mysql51-server/Makefile    2008-08-06 16:20:51.000000000 +0100
@@ -60,6 +60,16 @@
CONFIGURE_ARGS+=–with-collation=${WITH_COLLATION}
.endif

+# Sphinx Engine
+.if defined(WITH_SPHINXSE)
+SPHINX_PORT?=  textproc/sphinxsearch
+SPHINX_WRKSRC= cd ${PORTSDIR}/${SPHINX_PORT} && ${MAKE} -V WRKSRC
+
+EXTRACT_DEPENDS+=    ${NONEXISTENT}:${PORTSDIR}/${SPHINX_PORT}:extract
+RUN_DEPENDS+=        searchd:${PORTSDIR}/${SPHINX_PORT}
+USE_AUTOTOOLS+=        autoconf:262 automake:110
+.endif
+
.include

.if ${ARCH} == “i386″
@@ -124,8 +134,14 @@
@${ECHO} “    BUILD_STATIC=yes    Build a static version of mysqld.”
@${ECHO} “                (use it if you need even more speed).”
@${ECHO} “    WITH_NDB=yes        Enable support for NDB Cluster.”
+    @${ECHO} “    WITH_SPHINXSE=yes    Enable support for Sphinx Storage Engine.”
@${ECHO} “”

+.if defined(WITH_SPHINXSE)
+pre-patch:
+    ${CP} -pr $$( ${SPHINX_WRKSRC} )/mysqlse/ ${WRKSRC}/storage/sphinx
+.endif
+
post-patch:
@${REINPLACE_CMD} -e “s|SUBDIRS =|SUBDIRS = include @docs_dirs@ sql-common @sql_server_dirs@ storage scripts @sql_server@ @man_dirs@ support-files|g”

${WRKSRC}/Makefile.in
@${REINPLACE_CMD} -e “s|bin_SCRIPTS =|bin_SCRIPTS = @server_scripts@|g” ${WRKSRC}/scripts/Makefile.in

# cd /usr/ports/databases/mysql51-server
# patch -p0 < mysql51-server.diff
# echo WITH_SPHINXSE=yes >> /etc/make.conf
# make install clean

參考資料:http://www.infracaninophile.co.uk/articles/sphinxse.html

原文 http://gis.iwant-in.net/blog/?p=103