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