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