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