1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
|
# New ports collection makefile for: Sphinx full-text search engine
# Date created: 12 November 2006
# Whom: Matthew Seaman <m.seaman@infracaninophile.co.uk>
#
# $FreeBSD$
#
# Note: the Sphinx Storage Engine MySQL plugin is not supported by
# this port. You need a patched version of mysql server for that.
# See http://www.infracaninophile.co.uk/articles/sphinxse.html
PORTNAME= sphinxsearch
PORTVERSION= 2.0.4
CATEGORIES= textproc databases
MASTER_SITES= http://sphinxsearch.com/files/
DISTNAME= sphinx-${PORTVERSION}-release
DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
MAINTAINER= matthew@FreeBSD.org
COMMENT= Sphinx Full-Text Search Engine
LICENSE= GPLv2
# If expat is present on the system and configure finds it, it will
# unconditionally link the output binary against it. There's no way
# of turning this off. So for consistency, make sure it's always on.
LIB_DEPENDS= expat:${PORTSDIR}/textproc/expat2
OPTIONS_DEFINE= ICONV ID64 LIBSTEMMER MYSQL OPTIMIZED_CFLAGS PGSQL \
SYSLOG UNIXODBC
#ICONV_DESC= Iconv support
ID64_DESC= use 64-bit document and word IDs
LIBSTEMMER_DESC= compile with libstemmer support
#MYSQL_DESC= MySQL support
#OPTIMIZED_CFLAGS_DESC= Use compiler optimization (-O3)
#PGSQL_DESC= PostgreSQL support
SYSLOG_DESC= enable logging via syslog
UNIXODBC_DESC= unixODBC support
OPTIONS_DEFAULT= ICONV MYSQL SYSLOG
CONFLICTS= sphinxsearch-devel-[0-9]*
.include <bsd.port.options.mk>
# The port will successfully compile with both PGSQL and MYSQL support
# simultaneously. Not sure how useful that is in practice though.
.if ${PORT_OPTIONS:MMYSQL}
CONFIGURE_ARGS+= --with-mysql
USE_MYSQL= yes
.else
CONFIGURE_ARGS+= --without-mysql
.endif
.if ${PORT_OPTIONS:MPGSQL}
CONFIGURE_ARGS+= --with-pgsql
USE_PGSQL= yes
.else
CONFIGURE_ARGS+= --without-pgsql
.endif
.if ${PORT_OPTIONS:MICONV}
CONFIGURE_ARGS+= --with-iconv
USE_ICONV= yes
.else
CONFIGURE_ARGS+= --without-iconv
.endif
.if ${PORT_OPTIONS:MOPTIMIZED_CFLAGS}
CXXFLAGS+= -O3 -fomit-frame-pointer
.endif
# Changes document and word IDs to a 64bit type, useful if you have
# more than about 4.2E9 such items to deal with. Means corresponding
# changes in DB schema. Disabled by default.
.if ${PORT_OPTIONS:MID64}
CONFIGURE_ARGS+= --enable-id64
.endif
.if ${PORT_OPTIONS:MUNIXODBC}
CONFIGURE_ARGS+= --with-unixodbc
LIB_DEPENDS+= odbc:${PORTSDIR}/databases/unixODBC
.else
CONFIGURE_ARGS+= --without-unixodbc
.endif
.if ${PORT_OPTIONS:MSYSLOG}
CONFIGURE_ARGS+= --with-syslog
.else
CONFIGURE_ARGS+= --without-syslog
.endif
# Note: The snowball project doesn't release numbered versions of it's
# pre-processors. Instead, at arbitrary but fairly long intervals a
# snapshot of their source repository is turned into a tarball (always
# the same filename) and placed on their web site. It's like they
# want to make it as hard as possible for anyone to package and use
# their software.
#
# Adds support for two additional word stemmming pre-processors from
# the Snowball project (http://snowball.tartarus.org/) -- these
# essentially do exactly the same thing as the built in English,
# Russian and Czech stemmers but also support French, Spanish,
# Portuguese, Italian, Romanian, German, Dutch, Swedish, Norwegian,
# Danish, Finnish, Hungarian. Disabled by default.
.if ${PORT_OPTIONS:MLIBSTEMMER} || make(makesum) || defined(FETCH_ALL)
MASTER_SITES+= http://snowball.tartarus.org/dist/:libstemmer
LIBSTEMMER_TGZ= libstemmer_c.tgz
DISTFILES+= ${LIBSTEMMER_TGZ}:libstemmer
EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX}
.endif
.if ${PORT_OPTIONS:MLIBSTEMMER}
CONFIGURE_ARGS+= --with-libstemmer
.else
CONFIGURE_ARGS+= --without-libstemmer
.endif
USERS?= _sphinx
GROUPS?= _sphinx
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
CPPFLAGS+= ${CXXFLAGS}
CFGFILE= ${PREFIX}/etc/sphinx.conf
USE_RC_SUBR= sphinxsearch.sh
SUB_LIST+= PORTNAME=${PORTNAME} \
CFGFILE=${CFGFILE} \
SPHINX_USR=${USERS} \
SPHINX_GRP=${GROUPS} \
SPHINX_DIR=${SPHINX_DIR} \
SPHINX_RUN=${SPHINX_RUN} \
SPHINX_LOG=${SPHINX_LOG}
SUB_FILES+= pkg-deinstall
.if ${PORT_OPTIONS:MEXAMPLES}
EXAMPLES= example.sql api
PORTEXAMPLES= *
.endif
.if ${PORT_OPTIONS:MDOCS}
DOCS= doc/sphinx.css doc/sphinx.html doc/sphinx.txt doc/sphinx.xml
.endif
post-extract:
.if ${PORT_OPTIONS:MLIBSTEMMER}
@( cd ${WRKSRC} && \
${GZIP_CMD} ${EXTRACT_BEFORE_ARGS} ${DISTDIR}/${LIBSTEMMER_TGZ} \
${EXTRACT_AFTER_ARGS} )
.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
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/spelldump ${PREFIX}/bin/spelldump
${INSTALL_PROGRAM} ${WRKSRC}/src/searchd ${PREFIX}/sbin/searchd
${INSTALL_DATA} ${WRKSRC}/sphinx.conf.dist ${CFGFILE}.sample
install-docs:
.if ${PORT_OPTIONS:MDOCS}
@${MKDIR} ${DOCSDIR}
.for doc in ${DOCS}
${INSTALL_DATA} ${WRKSRC}/${doc} ${DOCSDIR}
.endfor
.endif
install-examples:
.if ${PORT_OPTIONS:MEXAMPLES}
@${MKDIR} ${EXAMPLESDIR}
.for example in ${EXAMPLES}
@cd ${WRKSRC} && ${COPYTREE_SHARE} ${example} ${EXAMPLESDIR}
.endfor
.endif
post-install-cfg:
@if [ ! -f ${CFGFILE} ]; then \
${CP} -p ${CFGFILE}.sample ${CFGFILE} ; \
fi
.include <bsd.port.mk>
|