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