]>
Commit | Line | Data |
---|---|---|
c6a4b25a AG |
1 | # TODO: |
2 | # - package for ruby API | |
aa4b3fd5 ER |
3 | # - subpackage for driver backend deps if code patched to support it: |
4 | # sphinx-0.9.9-2.i686: required "libodbc.so.1" is provided by following packages: | |
5 | # libmysqlclient.so.16 libmysqlclient.so.16(libmysqlclient_16) libpq.so.5 | |
f1ac865a JB |
6 | # |
7 | # Conditional build: | |
1f2de170 | 8 | %bcond_without java # without Java support |
c6a4b25a | 9 | %bcond_without libstemmer # without libstemmer support |
1f2de170 JB |
10 | %bcond_without mysql # without MySQL support |
11 | %bcond_without pgsql # without PostgreSQL support | |
443cfccc | 12 | |
1e7134e7 | 13 | %define php_min_version 5.0.4 |
910da407 | 14 | Summary: Free open-source SQL full-text search engine |
68b62e17 | 15 | Summary(pl.UTF-8): Silnik przeszukiwania pełnotekstowego SQL open-source |
910da407 | 16 | Name: sphinx |
7676bbc1 | 17 | Version: 2.2.11 |
853d62cb | 18 | Release: 2 |
8b84c6ea | 19 | License: GPL v2, LGPL (API libraries) |
910da407 | 20 | Group: Applications/Databases |
ecddefda | 21 | Source0: http://www.sphinxsearch.com/files/%{name}-%{version}-release.tar.gz |
7676bbc1 | 22 | # Source0-md5: 5cac34f3d78a9d612ca4301abfcbd666 |
13c36946 | 23 | Source1: %{name}.init |
db04d92c | 24 | Source2: %{name}.logrotate |
bd84607f | 25 | Source3: %{name}.conf.sh |
2b2397c4 | 26 | Source4: %{name}.tmpfiles |
7556b6cf | 27 | Patch0: bug-468.patch |
976ac5d6 JR |
28 | Patch1: libstemmer.patch |
29 | Patch2: x32.patch | |
910da407 ER |
30 | URL: http://www.sphinxsearch.com/ |
31 | BuildRequires: autoconf | |
aa334d3c | 32 | BuildRequires: automake >= 1:1.12 |
c6a4b25a | 33 | BuildRequires: expat-devel |
ff8e46de | 34 | %{?with_java:BuildRequires: jdk} |
13c36946 | 35 | BuildRequires: libstdc++-devel |
c6a4b25a | 36 | %{?with_libstemmer:BuildRequires: libstemmer-devel} |
4d294510 | 37 | BuildRequires: libtool |
c6a4b25a | 38 | %{?with_mysql:BuildRequires: mysql-devel} |
3bdbac33 | 39 | %{?with_pgsql:BuildRequires: postgresql-devel} |
4d294510 | 40 | BuildRequires: python |
41 | BuildRequires: python-modules | |
aa334d3c | 42 | %{?with_java:BuildRequires: rpm-javaprov} |
1e7134e7 | 43 | BuildRequires: rpm-php-pearprov >= 4.4.2-11 |
4d294510 | 44 | BuildRequires: rpm-pythonprov |
7d8040b3 | 45 | BuildRequires: rpmbuild(macros) >= 1.647 |
91a58c85 ER |
46 | Requires(postun): /usr/sbin/groupdel |
47 | Requires(postun): /usr/sbin/userdel | |
48 | Requires(pre): /bin/id | |
49 | Requires(pre): /usr/bin/getgid | |
50 | Requires(pre): /usr/sbin/groupadd | |
51 | Requires(pre): /usr/sbin/useradd | |
52 | Provides: group(sphinx) | |
53 | Provides: user(sphinx) | |
7d8040b3 | 54 | Conflicts: logrotate < 3.8.0 |
910da407 ER |
55 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
56 | ||
6688ccc8 ER |
57 | %define _sysconfdir /etc/%{name} |
58 | ||
910da407 ER |
59 | %description |
60 | Sphinx is a a standalone search engine, meant to provide fast, | |
61 | size-efficient and relevant fulltext search functions to other | |
62 | applications. Sphinx was specially designed to integrate well with SQL | |
63 | databases and scripting languages. Currently built-in data sources | |
64 | support fetching data either via direct connection to MySQL, or from | |
65 | an XML pipe. | |
66 | ||
68b62e17 | 67 | %description -l pl.UTF-8 |
68 | Sphinx jest samodzielnym silnikiem przeszukującym, dostarczającym | |
69 | innym aplikacjom szybkie, zoptymalizowane rozmiarowo funkcje | |
70 | przeszukiwania pełnotekstowego. Sphinx został specjalnie | |
71 | zaprojektowany z myślą o dobrej integracji z bazami danych SQL oraz | |
72 | językami skryptowymi. Obecnie wbudowane źródła danych wspierają | |
3bdbac33 ER |
73 | pobieranie danych poprzez bezpośrednie połączenie z MySQL lub z potoku |
74 | XML. | |
68b62e17 | 75 | |
c6a4b25a AG |
76 | %package -n libsphinxclient |
77 | Summary: Client library for Sphinx | |
78 | Summary(pl.UTF-8): Biblioteka kliencka do Sphinx | |
79 | Group: Libraries | |
80 | ||
81 | %description -n libsphinxclient | |
82 | This package provides a client library for Sphinx search engine. | |
83 | ||
adb1201d | 84 | %description -n libsphinxclient -l pl.UTF-8 |
1f2de170 | 85 | Ten pakiet dostarcza bibliotekę kliencką do silnika Sphinx. |
c6a4b25a AG |
86 | |
87 | %package -n libsphinxclient-devel | |
88 | Summary: Header files for sphinxclient library | |
89 | Summary(pl.UTF-8): Pliki nagłówkowe biblioteki sphinxclient | |
90 | Group: Development/Libraries | |
91 | Requires: libsphinxclient = %{version}-%{release} | |
92 | ||
93 | %description -n libsphinxclient-devel | |
94 | Header files for sphinxclient library. | |
95 | ||
96 | %description -n libsphinxclient-devel -l pl.UTF-8 | |
97 | Pliki nagłówkowe biblioteki sphinxclient. | |
98 | ||
99 | %package -n libsphinxclient-static | |
100 | Summary: Static sphinxclient library | |
101 | Summary(pl.UTF-8): Statyczna biblioteka sphinxclient | |
102 | Group: Development/Libraries | |
103 | Requires: libsphinxclient-devel = %{version}-%{release} | |
104 | ||
105 | %description -n libsphinxclient-static | |
106 | Static sphinxclient library. | |
107 | ||
108 | %description -n libsphinxclient-static -l pl.UTF-8 | |
109 | Statyczna biblioteka sphinxclient. | |
110 | ||
7d8040b3 | 111 | %package -n java-sphinxapi |
13c36946 | 112 | Summary: Java API for Sphinx |
37ac51db | 113 | Summary(pl.UTF-8): API Javy dla Sphinksa |
8b84c6ea | 114 | License: LGPL |
13c36946 ER |
115 | Group: Development/Languages/Java |
116 | Requires: jpackage-utils | |
7d8040b3 | 117 | Obsoletes: java-sphinx < 2.0.3-5 |
ee80571b | 118 | BuildArch: noarch |
13c36946 | 119 | |
7d8040b3 | 120 | %description -n java-sphinxapi |
13c36946 ER |
121 | Java API for Sphinx. |
122 | ||
7d8040b3 | 123 | %description -n java-sphinxapi -l pl.UTF-8 |
37ac51db JB |
124 | API Javy dla Sphinksa. |
125 | ||
7d8040b3 ER |
126 | %package -n php-sphinxapi |
127 | Summary: PHP API for Sphinx Search | |
56d91f88 | 128 | Summary(pl.UTF-8): API PHP dla Sphinksa |
8b84c6ea | 129 | License: LGPL |
b8b1e75a | 130 | Group: Libraries |
fd570e82 | 131 | Requires: php(core) >= %{php_min_version} |
80101f7f | 132 | Provides: php(sphinx) |
7d8040b3 | 133 | Obsoletes: php-sphinx < 2.0.3-5 |
ee80571b | 134 | BuildArch: noarch |
b8b1e75a | 135 | |
7d8040b3 ER |
136 | %description -n php-sphinxapi |
137 | PHP API for Sphinx Search. | |
b8b1e75a | 138 | |
7d8040b3 | 139 | %description -n php-sphinxapi -l pl.UTF-8 |
56d91f88 JB |
140 | API PHP dla Sphinksa. |
141 | ||
7d8040b3 ER |
142 | %package -n python-sphinxapi |
143 | Summary: Python API for Sphinx Search | |
c6a4b25a | 144 | Summary(pl.UTF-8): API Python dla Sphinksa |
8b84c6ea | 145 | License: LGPL |
c6a4b25a | 146 | Group: Development/Languages/Python |
8a4a8e2c | 147 | Requires: python |
7d8040b3 | 148 | Obsoletes: python-sphinx < 2.0.3-5 |
ee80571b | 149 | BuildArch: noarch |
c6a4b25a | 150 | |
7d8040b3 ER |
151 | %description -n python-sphinxapi |
152 | Python API for Sphinx Search. | |
c6a4b25a | 153 | |
7d8040b3 | 154 | %description -n python-sphinxapi -l pl.UTF-8 |
c6a4b25a AG |
155 | API Pythona dla Sphinksa. |
156 | ||
910da407 | 157 | %prep |
6b1bf788 | 158 | %setup -q -n %{name}-%{version}-release |
910da407 | 159 | %patch0 -p1 |
853d62cb | 160 | #patch1 -p1 |
976ac5d6 | 161 | %patch2 -p1 |
7556b6cf | 162 | |
2d2e893b ER |
163 | sed -i -e ' |
164 | s#/var/run/#/var/run/sphinx/# | |
165 | s#@CONFDIR@/log/searchd.pid#/var/run/sphinx/searchd.pid# | |
166 | s#@CONFDIR@/log/#/var/log/sphinx/#g | |
167 | s#@CONFDIR@/data/#/var/lib/sphinx/#g | |
168 | ' sphinx*.conf.in | |
169 | ||
853d62cb JR |
170 | sed -i -e ' |
171 | s#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"# | |
172 | ' configure | |
173 | ||
910da407 | 174 | %build |
d9cd41fd | 175 | CPPFLAGS=-D_FILE_OFFSET_BITS=64 |
46bfcba0 | 176 | %configure \ |
c6a4b25a AG |
177 | --with%{!?with_libstemmer:out}-libstemmer \ |
178 | --with%{!?with_pgsql:out}-pgsql \ | |
6b1bf788 AM |
179 | --with%{!?with_mysql:out}-mysql \ |
180 | --with-syslog | |
90d211da | 181 | %{__make} -j1 |
6688ccc8 | 182 | # use .conf ext for %doc |
7d8040b3 ER |
183 | cp -pf sphinx.conf.dist sphinx.conf |
184 | cp -pf sphinx-min.conf.dist sphinx-min.conf | |
c6a4b25a AG |
185 | |
186 | # libsphinxclient | |
187 | cd api/libsphinxclient | |
c6a4b25a AG |
188 | CPPFLAGS=-D_FILE_OFFSET_BITS=64 |
189 | %configure | |
90d211da | 190 | %{__make} -j1 |
c6a4b25a | 191 | cd ../.. |
910da407 | 192 | |
c6a4b25a AG |
193 | # java api |
194 | %if %{with java} | |
13c36946 ER |
195 | export JAVA_HOME="%{java_home}" |
196 | %{__make} -j1 -C api/java | |
c6a4b25a | 197 | %endif |
13c36946 | 198 | |
910da407 ER |
199 | %install |
200 | rm -rf $RPM_BUILD_ROOT | |
2b2397c4 JR |
201 | install -d $RPM_BUILD_ROOT{%{_sbindir},/etc/{logrotate.d,rc.d/init.d}}\ |
202 | $RPM_BUILD_ROOT{/var/{log,run,lib}/%{name},/var/log/archive/%{name}} \ | |
7d8040b3 | 203 | $RPM_BUILD_ROOT%{systemdtmpfilesdir} |
910da407 | 204 | |
90d211da | 205 | %{__make} -j1 install \ |
910da407 ER |
206 | DESTDIR=$RPM_BUILD_ROOT |
207 | ||
6688ccc8 ER |
208 | rm $RPM_BUILD_ROOT%{_sysconfdir}/example.sql |
209 | rm $RPM_BUILD_ROOT%{_sysconfdir}/sphinx.conf.dist | |
210 | ||
211 | # create default config with no index definition | |
bd84607f ER |
212 | sed -e '/## data source definition/,/## indexer settings/d' sphinx.conf > $RPM_BUILD_ROOT%{_sysconfdir}/sphinx-common.conf |
213 | # dir for indexes definition | |
214 | install -d $RPM_BUILD_ROOT%{_sysconfdir}/index.d | |
6688ccc8 | 215 | |
91a58c85 | 216 | rm $RPM_BUILD_ROOT%{_sysconfdir}/sphinx-min.conf.dist |
cf28692c | 217 | mv $RPM_BUILD_ROOT{%{_bindir},%{_sbindir}}/searchd |
9d9b76b9 | 218 | install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name} |
bd84607f ER |
219 | cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/logrotate.d/%{name} |
220 | install -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.conf | |
8b84c6ea | 221 | cp -p %{SOURCE4} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{name}.conf |
910da407 | 222 | |
b7f79218 | 223 | install -d $RPM_BUILD_ROOT%{php_data_dir} |
bd84607f | 224 | cp -p api/sphinxapi.php $RPM_BUILD_ROOT%{php_data_dir} |
b8b1e75a | 225 | |
c6a4b25a AG |
226 | # libsphinxclient |
227 | %{__make} -C api/libsphinxclient install \ | |
228 | DESTDIR=$RPM_BUILD_ROOT | |
229 | ||
230 | # python api | |
231 | install -d $RPM_BUILD_ROOT%{py_sitescriptdir} | |
bd84607f | 232 | cp -p api/sphinxapi.py $RPM_BUILD_ROOT%{py_sitescriptdir} |
c6a4b25a AG |
233 | %py_comp $RPM_BUILD_ROOT%{py_sitescriptdir} |
234 | %py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir} | |
235 | %py_postclean | |
236 | ||
237 | # ruby api | |
238 | ||
239 | # java api | |
240 | %if %{with java} | |
13c36946 | 241 | install -d $RPM_BUILD_ROOT%{_javadir} |
7d8040b3 ER |
242 | cp -p api/java/sphinxapi.jar $RPM_BUILD_ROOT%{_javadir}/sphinxapi-%{version}.jar |
243 | ln -s sphinxapi-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/sphinxapi.jar | |
c6a4b25a | 244 | %endif |
13c36946 | 245 | |
910da407 ER |
246 | %clean |
247 | rm -rf $RPM_BUILD_ROOT | |
248 | ||
1f2de170 JB |
249 | %post -n libsphinxclient -p /sbin/ldconfig |
250 | %postun -n libsphinxclient -p /sbin/ldconfig | |
c6a4b25a | 251 | |
91a58c85 ER |
252 | %pre |
253 | %groupadd -g 249 sphinx | |
2d2e893b | 254 | %useradd -u 249 -d /var/lib/%{name} -g sphinx -c "Sphinx Search" sphinx |
91a58c85 ER |
255 | |
256 | %post | |
257 | /sbin/chkconfig --add sphinx | |
258 | %service sphinx restart | |
259 | ||
260 | %preun | |
6688ccc8 | 261 | if [ "$1" = 0 ]; then |
91a58c85 ER |
262 | %service sphinx stop |
263 | /sbin/chkconfig --del sphinx | |
264 | fi | |
265 | ||
bd84607f ER |
266 | %triggerpostun -- %{name} < 0.9.9-7.6 |
267 | if [ -f %{_sysconfdir}/sphinx.conf.rpmsave ]; then | |
268 | cp -f %{_sysconfdir}/sphinx-common.conf{,.rpmnew} | |
269 | mv -f %{_sysconfdir}/sphinx.conf.rpmsave %{_sysconfdir}/sphinx-common.conf | |
270 | %service -q sphinx restart | |
271 | fi | |
272 | ||
910da407 ER |
273 | %files |
274 | %defattr(644,root,root,755) | |
6688ccc8 | 275 | %doc doc/sphinx.txt example.sql sphinx.conf sphinx-min.conf |
bd84607f | 276 | |
aa4b3fd5 | 277 | %dir %attr(750,root,sphinx) %{_sysconfdir} |
bd84607f ER |
278 | # main sphinx config |
279 | %config(noreplace) %verify(not md5 mtime size) %attr(640,root,sphinx) %{_sysconfdir}/sphinx-common.conf | |
280 | # shell wrapper which loads main config and extra indexes config | |
281 | %attr(755,root,sphinx) %{_sysconfdir}/sphinx.conf | |
282 | # put here *.conf files defining extra indexes | |
283 | %dir %attr(750,root,sphinx) %{_sysconfdir}/index.d | |
284 | ||
db04d92c | 285 | %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name} |
6688ccc8 | 286 | %attr(754,root,root) /etc/rc.d/init.d/%{name} |
910da407 | 287 | %attr(755,root,root) %{_bindir}/indexer |
9d9b76b9 | 288 | %attr(755,root,root) %{_bindir}/indextool |
c6a4b25a | 289 | %attr(755,root,root) %{_bindir}/spelldump |
8a4a8e2c | 290 | %attr(755,root,root) %{_bindir}/wordbreaker |
cf28692c | 291 | %attr(755,root,root) %{_sbindir}/searchd |
b8b1e75a | 292 | |
6b1bf788 AM |
293 | %{_mandir}/man1/indexer.1* |
294 | %{_mandir}/man1/indextool.1* | |
6b1bf788 AM |
295 | %{_mandir}/man1/searchd.1* |
296 | %{_mandir}/man1/spelldump.1* | |
7d8040b3 | 297 | %{systemdtmpfilesdir}/%{name}.conf |
2d2e893b ER |
298 | %dir %attr(771,root,sphinx) /var/run/sphinx |
299 | %dir %attr(770,root,sphinx) /var/log/sphinx | |
4b37062a | 300 | %dir %attr(770,root,sphinx) /var/log/archive/sphinx |
2d2e893b ER |
301 | %dir %attr(770,root,sphinx) /var/lib/sphinx |
302 | ||
c6a4b25a AG |
303 | %files -n libsphinxclient |
304 | %defattr(644,root,root,755) | |
305 | %doc api/libsphinxclient/README | |
306 | %attr(755,root,root) %{_libdir}/libsphinxclient-*.*.*.so | |
307 | ||
308 | %files -n libsphinxclient-devel | |
309 | %defattr(644,root,root,755) | |
310 | %attr(755,root,root) %{_libdir}/libsphinxclient.so | |
1f2de170 | 311 | %{_libdir}/libsphinxclient.la |
d7da04be | 312 | %{_includedir}/sphinxclient.h |
c6a4b25a AG |
313 | |
314 | %files -n libsphinxclient-static | |
315 | %defattr(644,root,root,755) | |
1f2de170 | 316 | %{_libdir}/libsphinxclient.a |
c6a4b25a AG |
317 | |
318 | %if %{with java} | |
7d8040b3 | 319 | %files -n java-sphinxapi |
13c36946 ER |
320 | %defattr(644,root,root,755) |
321 | %doc api/java/README | |
37ac51db | 322 | %{_javadir}/sphinx*.jar |
c6a4b25a | 323 | %endif |
13c36946 | 324 | |
7d8040b3 | 325 | %files -n php-sphinxapi |
56d91f88 | 326 | %defattr(644,root,root,755) |
b7f79218 | 327 | %{php_data_dir}/sphinxapi.php |
c6a4b25a | 328 | |
7d8040b3 | 329 | %files -n python-sphinxapi |
c6a4b25a | 330 | %defattr(644,root,root,755) |
9d9b76b9 | 331 | %{py_sitescriptdir}/*.py[co] |