- last minute-changes in the 3.3.11 release
[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}
ba649e55
GE
29Requires: /usr/bin/catdoc
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
176sed -i 's|#Mime application/msword "text/plain; charset=utf-8" "catdoc -a -dutf-8 $1"|Mime application/msword "text/plain; charset=utf-8" "catdoc -a -dutf-8 $1"|g' \
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
a3f86052
GE
188# the cgi is no regular binary, move it to libexec
189install -d %{buildroot}%{_libexecdir}/mnogosearch
190mv -f %{buildroot}%{_bindir}/*.cgi %{buildroot}%{_libexecdir}/mnogosearch/
191
192# the .la's confuse libtool when building the php lib and they should not
193# be packaged at all, so remove them
194rm -f %{buildroot}%{_libdir}/*.la
195
196install -m0755 %{SOURCE1} %{buildroot}%{_bindir}/
197
198install -d %{buildroot}%{_sysconfdir}/cron.d/
199install -m0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/cron.d/mnogosearch
200
201install -d %{buildroot}%{_sysconfdir}/httpd/conf.d/
202install -m0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/httpd/conf.d/mnogosearch.conf
203
204
205# ---------------------
206# make & install php stuff
207# must be in install-section because it needs an already installed mnogosearch
208cd php
209
210/usr/bin/phpize
211%configure --with-mnogosearch=%{buildroot}%{_prefix}
212
213# get rid of rpath
214sed -i 's|-Wl,-rpath,[^ ]*||g' Makefile
215
216make %{?_smp_mflags} EXTRA_LDFLAGS="-L%{buildroot}%{_libdir}" EXTRA_CFLAGS="-I%{buildroot}%{_includedir}/mnogosearch"
217make install \
218 INSTALL_ROOT=$RPM_BUILD_ROOT
219cd ..
220
221install -d %{buildroot}%{_sysconfdir}/php.d
222cat >%{buildroot}%{_sysconfdir}/php.d/mnogosearch.ini <<EOF
223; Enable mnogosearch extension module
224extension=mnogosearch.so
225EOF
226
227# end PHP stuff
228# ---------------------
229
230# create state-dir
231install -d %{buildroot}%{_localstatedir}/lib/mnogosearch
232
233# fix docs
234rm -rf html; mkdir -p html
235cp -p doc/*.html html/
236rm -rf %{buildroot}/usr/doc
237
238%check
239%if %{with_tests}
240# run unit tests with sqlite backend
241touch ./msearch-test/sqlite.db
242export UDM_TEST_DBADDR=sqlite3://`pwd`/msearch-test/sqlite.db/,sqlite3://`pwd`/msearch-test/sqlite2.db/
243make check
244%endif
245
246%clean
247rm -rf %{buildroot}
248
249%pre
250# create mnogosearch user and group
251getent group mnogosearch >/dev/null || groupadd -r mnogosearch
252getent passwd mnogosearch >/dev/null || \
253 useradd -r -g mnogosearch -d %{_localstatedir}/lib/mnogosearch \
254 -c "User the indexer of the mnoGoSearch search engine is executed with" \
255 -s /sbin/nologin mnogosearch
256exit 0
257
258%post
259# the cgi (executed with the apache user) must be able to read the database:
260# the apache user must be in the mnogosearch group
261usermod -a -G mnogosearch apache || :
262
263# we brought our own apache config snippet and new group rights
264service httpd condrestart > /dev/null 2>&1 || :
265
266# create default mnogosearch database (only during install)
267if [ $1 -eq 1 ] ; then
268 /usr/bin/indexer --create >/dev/null
269 chown mnogosearch:mnogosearch %{_localstatedir}/lib/mnogosearch/default.db
270 # db must be group writeable to allow query tracking
271 chmod 0660 %{_localstatedir}/lib/mnogosearch/default.db
272fi
273
274%postun
275service httpd condrestart > /dev/null 2>&1 || :
276
277%post libs -p /sbin/ldconfig
278
279%postun libs -p /sbin/ldconfig
280
281%files
282%defattr(-,root,root,-)
283%{_bindir}/indexer
284%{_bindir}/mconv
285%{_bindir}/mguesser
286%{_bindir}/mnogosearch-reindex
287%dir %{_libexecdir}/mnogosearch
288%{_libexecdir}/mnogosearch/search.cgi
289%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/cron.d/mnogosearch
290%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/httpd/conf.d/mnogosearch.conf
291
292%defattr (0644,root,root,0755)
293%doc ChangeLog README README.XML README.CVS TODO COPYING AUTHORS INSTALL NEWS FAQ html doc/samples
294%{_mandir}/man?/*
295%{_datadir}/mnogosearch
296
297# the config files of mnogosearch often contain database passwords -> should not be world readable
298%defattr (0640,root,mnogosearch,0750)
299%dir %{_sysconfdir}/mnogosearch
300
301# indexer.conf is executable: has a correct shebang to run the indexer with this configuration
302%attr(0755,root,mnogosearch) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/mnogosearch/indexer.conf
303%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/mnogosearch/langmap.conf
304%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/mnogosearch/stopwords.conf
305%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/mnogosearch/search.htm
306%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/mnogosearch/node.xml
307
308# default dir for search databases should not be world-readable:
309# the search engine could have indexed secret files
310%attr (0750,mnogosearch,mnogosearch) %dir %{_localstatedir}/lib/mnogosearch
311
312%files libs
313%defattr(-,root,root,-)
314%{_libdir}/lib*-*.so
315
316%files devel
317%defattr(-,root,root,-)
318%{_bindir}/udm-config
319%{_includedir}/mnogosearch
320%{_libdir}/*.a
321%{_libdir}/libmnogosearch.so
322%{_libdir}/libmnogocharset.so
323
324%files php
325%defattr(-,root,root,-)
326%{_sysconfdir}/php.d/mnogosearch.ini
327%{php_extdir}
328
329%changelog
ba649e55
GE
330* Thu Jan 27 2011 Gerd v. Egidy <gerd@egidy.de> 3.3.11-2
331- last minute-changes in the 3.3.11 release
332- enable some external document helpers by default:
333 we always have them because of requires
334- require the binaries of the helpers used, not the package names
335
a3f86052
GE
336* Thu Jan 27 2011 Gerd v. Egidy <gerd@egidy.de> 3.3.11-1
337- mnogosearch 3.3.11
338- unit testing with two databases
339- require catdoc and xlhtml for install and during build
340- move make check into check-section
d2ffe0d6 341- fix timezone issue with test-blob unit test
a3f86052
GE
342
343* Thu Jan 27 2011 Gerd v. Egidy <gerd@egidy.de> 3.3.10-7.20110127cvs
344- new cvs version with fix for directory names
345- fix commandline options in mnogosearch-reindex
346
347* Wed Jan 26 2011 Gerd v. Egidy <gerd@egidy.de> 3.3.10-6.20110126cvs
348- import new upstream fixes for issues found during packaging
349- group writeable default.db
350- reindex option improvements by Alexander Barkov
351- only create db on install
352- create databases not with sqlite, but with the --create option of indexer
353
354* Tue Jan 25 2011 Gerd v. Egidy <gerd@egidy.de> 3.3.10-5.20110124cvs
355- update cvs version to get lib64 fix
356- don't package *.la files as per Fedora review policy
357- filter php module from provides
358- create mnogosearch user and group during installation
359- tighten file permissions to protect passwords and data
360- create default configuration suitable for Fedora
361
362* Fri Jan 21 2011 Gerd v. Egidy <gerd@egidy.de> 3.3.10-4.20110121cvs
363- don't rename udm-config anymore
364- better differentiation between release and cvs snapshots
365- don't use $RPM_BUILD_DIR anymore
366
367* Thu Jan 20 2011 Gerd v. Egidy <gerd@egidy.de> 3.3.10-3.20110120cvs
368- make use of the new fhs configure option
369- move language files to /usr/share
370- move cgi to /usr/libexec
371- clean up unneeded stuff left over from Mandriva
372- link firebird database
373- run supplied unit tests after build
374
375* Mon Jan 17 2011 Gerd v. Egidy <gerd@egidy.de> 3.3.10-2.20110117cvs
376- use current CVS as there are/will be some patches making packaging more easy
377
378* Thu Jan 13 2011 Gerd v. Egidy <gerd@egidy.de> 3.3.10-1
379- add building of the php module
380- initial packaging for Fedora
381- based on the Mandriva .spec by Oden Eriksson
382