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