new srpm, built with rpmbuild-md5
[mnogosearch-rpm] / mnogosearch.spec
1 %global php_apiver  %((echo 0; php -i 2>/dev/null | sed -n 's/^PHP API => //p') | tail -1)
2 %global php_extdir  %(php-config --extension-dir 2>/dev/null || echo "undefined")
3 %global php_version %(php-config --version 2>/dev/null || echo 0)
4
5 # do not add php module to provides, it is no regular library
6 %{?filter_setup:
7 %filter_provides_in %{php_extdir}/.*\.so$
8 %filter_setup
9 }
10
11 Summary:        Web indexing and search system for a small domain or intranet
12 Name:           mnogosearch
13 Version:        3.3.11
14 Release:        5%{?dist}
15 License:        GPLv2+
16 Group:          Applications/Internet
17 URL:            http://www.mnogosearch.org/
18
19 # md5sum 906d5e1e21ba00024574f57548d32029
20 Source0:        http://www.mnogosearch.org/Download/mnogosearch-%{version}.tar.gz
21
22 Source1:        mnogosearch-reindex
23 Source2:        mnogosearch.crond
24 Source3:        httpd.conf
25
26 # makes adapting the configuration more easy, taken from upstream cvs
27 Patch0:         mnogosearch-3.3.11-prepare-config.patch
28
29 # modify the default configuration suitable for our distribution
30 # distribution-specific, not upstream
31 Patch1:         mnogosearch-distconfig.patch
32
33 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
34
35 Requires:       %{name}-libs = %{version}-%{release}
36 Requires:       /usr/bin/wvHtml
37 Requires:       /usr/bin/pdftohtml
38
39 %if !0%{?rhel}
40 # these are currently not available on RHEL/EPEL
41 Requires:       /usr/bin/xlhtml
42 Requires:       /usr/bin/ppthtml
43 Requires:       /usr/bin/unrtf
44 %endif
45
46 Requires(pre):  shadow-utils
47
48 # user "apache" is added to mnogosearch group so we need the user to be present
49 Requires(post): httpd
50
51 BuildRequires:  autoconf
52 BuildRequires:  automake
53 BuildRequires:  libtool
54 BuildRequires:  openssl-devel
55 BuildRequires:  zlib-devel
56 BuildRequires:  expat-devel
57 BuildRequires:  openssl-devel
58 BuildRequires:  openjade
59 BuildRequires:  docbook-utils
60 BuildRequires:  mysql-devel
61 BuildRequires:  readline-devel
62 BuildRequires:  ncurses-devel
63 BuildRequires:  sqlite-devel
64 BuildRequires:  unixODBC-devel
65 BuildRequires:  postgresql-devel
66 BuildRequires:  freetds-devel
67 BuildRequires:  firebird-devel
68 BuildRequires:  catdoc
69
70 %if !0%{?rhel}
71 BuildRequires:  xlhtml
72 %endif
73
74 # build is done with unit testing by default, but it can be disabled
75 # by --without tests to save time
76 %define with_tests  %{?_without_tests:  0} %{?!_without_tests:  1}
77
78 %description
79 mnoGoSearch (formerly known as UdmSearch) is a full-featured Web search engine
80 that you can use to build search engines over HTTP, HTTPS, FTP, and NTTP
81 servers, local files, and database big text fields. It supports Oracle, MS SQL
82 Server, MySQL, PostgreSQL, InterBase/Firebird, Openlink Virtuoso, Intersystems
83 Cach, iODBC, EasySoft ODBC, and unixODBC database backends. It has XML, HTML,
84 and TEXT built-in support, and external converters support for other document
85 types. An automatic language/charset guesser for more 70 language/charset
86 combinations is included, along with basic authorization support, and you may
87 index password-protected intranet HTTP servers with proxy authorization
88 support.
89
90 mnoGoSearch is built with support for mysql (including fulltext extension),
91 sqlite, postgresql, firebird, unixODBC and freetds.
92
93 %package libs
94 Summary:        Libraries for %{name}
95 Group:          System Environment/Libraries
96
97 %description libs
98 This package contains the %{name} library files.
99
100 %package devel
101 Summary:        Development headers and libraries for %{name}
102 Group:          Development/Libraries
103 Requires:       %{name} = %{version}-%{release}
104
105 %description devel
106 This package contains the %{name} development files.
107
108 %package php
109 Summary:        PHP-extension for %{name}
110 Group:          Applications/Internet
111 Requires:       %{name}-libs = %{version}-%{release}
112 BuildRequires:  php-devel
113 BuildRequires:  php-cli
114
115 %if 0%{?php_zend_api}
116 Requires:       php(zend-abi) = %{php_zend_api}
117 Requires:       php(api) = %{php_core_api}
118 %else
119 Requires:       php-api = %{php_apiver}
120 %endif
121
122 %description php
123 This package contains the PHP extension for %{name}
124
125 %prep
126 %setup -q -n mnogosearch-%{version}
127
128 %patch0 -p1
129 %patch1 -p1
130
131 %build
132 autoreconf -fi
133
134 %configure \
135     --sysconfdir=%{_sysconfdir}/mnogosearch  \
136     --datadir=%{_datadir}/mnogosearch  \
137     --localstatedir=%{_localstatedir}/lib/mnogosearch \
138     --includedir=%{_includedir}/mnogosearch \
139     --enable-syslog \
140     --enable-syslog=LOG_LOCAL6 \
141     --enable-parser \
142     --enable-mp3 \
143     --enable-file \
144     --enable-http \
145     --enable-ftp \
146     --enable-news \
147     --with-openssl=%{_prefix} \
148     --with-zlib \
149     --with-readline \
150     --with-extra-charsets=all \
151     --with-mysql \
152 %if !0%{?rhel}
153     --enable-mysql-fulltext-plugin \
154 %endif
155     --with-pgsql \
156     --with-sqlite3 \
157     --with-unixODBC \
158     --with-freetds=%{_prefix} \
159     --with-ibase \
160     --with-docs \
161     --enable-fhs-layout
162
163 make %{?_smp_mflags}
164
165 %install
166 rm -rf %{buildroot}
167
168 %{__make} install \
169     DESTDIR=$RPM_BUILD_ROOT \
170     doc_FILES='$(HTML_ALL)'
171
172 # no need to call the config files *-dist
173 (cd %{buildroot}%{_sysconfdir}/%{name}
174 for f in *-dist ; do
175     mv -f $f `basename $f -dist`
176 done
177 )
178
179 %if 0%{?rhel}
180 # comment out the converters not available on RHEL/EPEL
181 sed -i 's|^\(.*xlhtml.*\)$|#\1|g' %{buildroot}%{_sysconfdir}/%{name}/indexer.conf
182 sed -i 's|^\(.*ppthtml.*\)$|#\1|g' %{buildroot}%{_sysconfdir}/%{name}/indexer.conf
183 sed -i 's|^\(.*unrtf.*\)$|#\1|g' %{buildroot}%{_sysconfdir}/%{name}/indexer.conf
184 %endif
185
186 # the cgi is no regular binary, move it to libexec
187 install -d %{buildroot}%{_libexecdir}/mnogosearch
188 mv -f %{buildroot}%{_bindir}/*.cgi %{buildroot}%{_libexecdir}/mnogosearch/
189
190 # the .la's confuse libtool when building the php lib and they should not
191 # be packaged at all, so remove them
192 rm -f %{buildroot}%{_libdir}/*.la
193
194 install -m0755 %{SOURCE1} %{buildroot}%{_bindir}/
195
196 install -d %{buildroot}%{_sysconfdir}/cron.d/
197 install -m0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/cron.d/mnogosearch
198
199 install -d %{buildroot}%{_sysconfdir}/httpd/conf.d/
200 install -m0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/httpd/conf.d/mnogosearch.conf
201
202
203 # ---------------------
204 # make & install php stuff
205 # must be in install-section because it needs an already installed mnogosearch
206 cd php
207
208 /usr/bin/phpize
209 %configure --with-mnogosearch=%{buildroot}%{_prefix}
210
211 # get rid of rpath
212 sed -i 's|-Wl,-rpath,[^ ]*||g' Makefile
213
214 make %{?_smp_mflags} EXTRA_LDFLAGS="-L%{buildroot}%{_libdir}" EXTRA_CFLAGS="-I%{buildroot}%{_includedir}/mnogosearch"
215 make install \
216     INSTALL_ROOT=$RPM_BUILD_ROOT
217 cd ..
218
219 install -d %{buildroot}%{_sysconfdir}/php.d
220 cat >%{buildroot}%{_sysconfdir}/php.d/mnogosearch.ini <<EOF
221 ; Enable mnogosearch extension module
222 extension=mnogosearch.so
223 EOF
224
225 # end PHP stuff
226 # ---------------------
227
228 # create state-dir
229 install -d %{buildroot}%{_localstatedir}/lib/mnogosearch
230
231 # fix docs
232 rm -rf html; mkdir -p html
233 cp -p doc/*.html html/
234 rm -rf %{buildroot}/usr/doc
235
236 %check
237 %if %{with_tests}
238 # run unit tests with sqlite backend
239 touch ./msearch-test/sqlite.db
240 export UDM_TEST_DBADDR=sqlite3://`pwd`/msearch-test/sqlite.db/,sqlite3://`pwd`/msearch-test/sqlite2.db/
241 make check
242 %endif
243
244 %clean
245 rm -rf %{buildroot}
246
247 %pre
248 # create mnogosearch user and group
249 getent group mnogosearch >/dev/null || groupadd -r mnogosearch
250 getent passwd mnogosearch >/dev/null || \
251     useradd -r -g mnogosearch -d %{_localstatedir}/lib/mnogosearch \
252     -c "User the indexer of the mnoGoSearch search engine is executed with" \
253     -s /sbin/nologin mnogosearch
254 exit 0
255
256 %post
257 # the cgi (executed with the apache user) must be able to read the database:
258 # the apache user must be in the mnogosearch group
259 usermod -a -G mnogosearch apache || :
260
261 # we brought our own apache config snippet and new group rights
262 service httpd condrestart > /dev/null 2>&1 || :
263
264 # create default mnogosearch database (only during install)
265 if [ $1 -eq 1 ] ; then
266     /usr/bin/indexer --create >/dev/null
267     chown mnogosearch:mnogosearch %{_localstatedir}/lib/mnogosearch/default.db
268     # db must be group writeable to allow query tracking
269     chmod 0660 %{_localstatedir}/lib/mnogosearch/default.db
270 fi
271
272 %postun
273 service httpd condrestart > /dev/null 2>&1 || :
274
275 %post libs -p /sbin/ldconfig
276
277 %postun libs -p /sbin/ldconfig
278
279 %files
280 %defattr(-,root,root,-)
281 %{_bindir}/indexer
282 %{_bindir}/mconv
283 %{_bindir}/mguesser
284 %{_bindir}/mnogosearch-reindex
285 %dir %{_libexecdir}/mnogosearch
286 %{_libexecdir}/mnogosearch/search.cgi
287 %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/cron.d/mnogosearch
288 %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/httpd/conf.d/mnogosearch.conf
289
290 %defattr (0644,root,root,0755)
291 %doc ChangeLog README README.XML README.CVS TODO COPYING AUTHORS INSTALL NEWS FAQ html doc/samples
292 %{_mandir}/man?/*
293 %{_datadir}/mnogosearch
294
295 # the config files of mnogosearch often contain database passwords -> should not be world readable
296 %defattr (0640,root,mnogosearch,0750)
297 %dir %{_sysconfdir}/mnogosearch
298
299 # indexer.conf is executable: has a correct shebang to run the indexer with this configuration
300 %attr(0755,root,mnogosearch) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/mnogosearch/indexer.conf
301 %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/mnogosearch/langmap.conf
302 %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/mnogosearch/stopwords.conf
303 %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/mnogosearch/search.htm
304 %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/mnogosearch/node.xml
305
306 # default dir for search databases should not be world-readable:
307 # the search engine could have indexed secret files
308 %attr (0750,mnogosearch,mnogosearch) %dir %{_localstatedir}/lib/mnogosearch
309
310 %files libs
311 %defattr(-,root,root,-)
312 %{_libdir}/lib*-*.so
313
314 %files devel
315 %defattr(-,root,root,-)
316 %{_bindir}/udm-config
317 %{_includedir}/mnogosearch
318 %{_libdir}/*.a
319 %{_libdir}/libmnogosearch.so
320 %{_libdir}/libmnogocharset.so
321
322 %files php
323 %defattr(-,root,root,-)
324 %{_sysconfdir}/php.d/mnogosearch.ini
325 %{php_extdir}
326
327 %changelog
328 * Mon Feb 1 2011 Gerd v. Egidy <gerd@egidy.de> 3.3.11-5
329 - add dist-tag to the release
330 - add conditionals to allow building on RHEL 5 too
331
332 * Mon Feb 1 2011 Gerd v. Egidy <gerd@egidy.de> 3.3.11-4
333 - don't use stopwords by default anymore
334 - switch from pdftotext to pdftohtml
335 - explicit charset not needed for all converters
336
337 * Mon Jan 31 2011 Gerd v. Egidy <gerd@egidy.de> 3.3.11-3
338 - include upstream-patch to make adapting the config more easy
339 - add unrtf to default config and requires
340 - modifying the default configuration now done with a patch
341 - utf-8 now used in search template too
342 - include langmap and stopwords in search template too
343
344 * Thu Jan 27 2011 Gerd v. Egidy <gerd@egidy.de> 3.3.11-2
345 - last minute-changes in the 3.3.11 release
346 - enable some external document helpers by default:
347   we always have them because of requires
348 - require the binaries of the helpers used, not the package names
349 - use wvHtml instead of catdoc by default: it retains formatting
350 - don't disable the file types we now have helpers for
351
352 * Thu Jan 27 2011 Gerd v. Egidy <gerd@egidy.de> 3.3.11-1
353 - mnogosearch 3.3.11
354 - unit testing with two databases
355 - require catdoc and xlhtml for install and during build
356 - move make check into check-section
357 - fix timezone issue with test-blob unit test
358
359 * Thu Jan 27 2011 Gerd v. Egidy <gerd@egidy.de> 3.3.10-7.20110127cvs
360 - new cvs version with fix for directory names
361 - fix commandline options in mnogosearch-reindex
362
363 * Wed Jan 26 2011 Gerd v. Egidy <gerd@egidy.de> 3.3.10-6.20110126cvs
364 - import new upstream fixes for issues found during packaging
365 - group writeable default.db
366 - reindex option improvements by Alexander Barkov
367 - only create db on install
368 - create databases not with sqlite, but with the --create option of indexer
369
370 * Tue Jan 25 2011 Gerd v. Egidy <gerd@egidy.de> 3.3.10-5.20110124cvs
371 - update cvs version to get lib64 fix
372 - don't package *.la files as per Fedora review policy
373 - filter php module from provides
374 - create mnogosearch user and group during installation
375 - tighten file permissions to protect passwords and data
376 - create default configuration suitable for Fedora
377
378 * Fri Jan 21 2011 Gerd v. Egidy <gerd@egidy.de> 3.3.10-4.20110121cvs
379 - don't rename udm-config anymore
380 - better differentiation between release and cvs snapshots
381 - don't use $RPM_BUILD_DIR anymore
382
383 * Thu Jan 20 2011 Gerd v. Egidy <gerd@egidy.de> 3.3.10-3.20110120cvs
384 - make use of the new fhs configure option
385 - move language files to /usr/share
386 - move cgi to /usr/libexec
387 - clean up unneeded stuff left over from Mandriva
388 - link firebird database
389 - run supplied unit tests after build
390
391 * Mon Jan 17 2011 Gerd v. Egidy <gerd@egidy.de> 3.3.10-2.20110117cvs
392 - use current CVS as there are/will be some patches making packaging more easy
393
394 * Thu Jan 13 2011 Gerd v. Egidy <gerd@egidy.de> 3.3.10-1
395 - add building of the php module
396 - initial packaging for Fedora
397 - based on the Mandriva .spec by Oden Eriksson
398