| 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: 2 |
| 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 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) |
| 27 | |
| 28 | Requires: %{name}-libs = %{version}-%{release} |
| 29 | Requires: /usr/bin/catdoc |
| 30 | Requires: /usr/bin/xlhtml |
| 31 | Requires: /usr/bin/ppthtml |
| 32 | Requires: /usr/bin/pdftotext |
| 33 | Requires(pre): shadow-utils |
| 34 | |
| 35 | # user "apache" is added to mnogosearch group so we need the user to be present |
| 36 | Requires(post): httpd |
| 37 | |
| 38 | BuildRequires: autoconf |
| 39 | BuildRequires: automake |
| 40 | BuildRequires: libtool |
| 41 | BuildRequires: openssl-devel |
| 42 | BuildRequires: zlib-devel |
| 43 | BuildRequires: expat-devel |
| 44 | BuildRequires: openssl-devel |
| 45 | BuildRequires: openjade |
| 46 | BuildRequires: docbook-utils |
| 47 | BuildRequires: mysql-devel |
| 48 | BuildRequires: readline-devel |
| 49 | BuildRequires: ncurses-devel |
| 50 | BuildRequires: sqlite-devel |
| 51 | BuildRequires: unixODBC-devel |
| 52 | BuildRequires: postgresql-devel |
| 53 | BuildRequires: freetds-devel |
| 54 | BuildRequires: firebird-devel |
| 55 | BuildRequires: catdoc |
| 56 | BuildRequires: 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 |
| 63 | mnoGoSearch (formerly known as UdmSearch) is a full-featured Web search engine |
| 64 | that you can use to build search engines over HTTP, HTTPS, FTP, and NTTP |
| 65 | servers, local files, and database big text fields. It supports Oracle, MS SQL |
| 66 | Server, MySQL, PostgreSQL, InterBase/Firebird, Openlink Virtuoso, Intersystems |
| 67 | Cach, iODBC, EasySoft ODBC, and unixODBC database backends. It has XML, HTML, |
| 68 | and TEXT built-in support, and external converters support for other document |
| 69 | types. An automatic language/charset guesser for more 70 language/charset |
| 70 | combinations is included, along with basic authorization support, and you may |
| 71 | index password-protected intranet HTTP servers with proxy authorization |
| 72 | support. |
| 73 | |
| 74 | mnoGoSearch is built with support for mysql (including fulltext extension), |
| 75 | sqlite, postgresql, firebird, unixODBC and freetds. |
| 76 | |
| 77 | %package libs |
| 78 | Summary: Libraries for %{name} |
| 79 | Group: System Environment/Libraries |
| 80 | |
| 81 | %description libs |
| 82 | This package contains the %{name} library files. |
| 83 | |
| 84 | %package devel |
| 85 | Summary: Development headers and libraries for %{name} |
| 86 | Group: Development/Libraries |
| 87 | Requires: %{name} = %{version}-%{release} |
| 88 | |
| 89 | %description devel |
| 90 | This package contains the %{name} development files. |
| 91 | |
| 92 | %package php |
| 93 | Summary: PHP-extension for %{name} |
| 94 | Group: Applications/Internet |
| 95 | Requires: %{name}-libs = %{version}-%{release} |
| 96 | BuildRequires: php-devel |
| 97 | BuildRequires: php-cli |
| 98 | |
| 99 | %if 0%{?php_zend_api} |
| 100 | Requires: php(zend-abi) = %{php_zend_api} |
| 101 | Requires: php(api) = %{php_core_api} |
| 102 | %else |
| 103 | Requires: php-api = %{php_apiver} |
| 104 | %endif |
| 105 | |
| 106 | %description php |
| 107 | This package contains the PHP extension for %{name} |
| 108 | |
| 109 | %prep |
| 110 | %setup -q -n mnogosearch-%{version} |
| 111 | |
| 112 | %build |
| 113 | autoreconf -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 | |
| 142 | make %{?_smp_mflags} |
| 143 | |
| 144 | %install |
| 145 | rm -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} |
| 153 | for f in *-dist ; do |
| 154 | mv -f $f `basename $f -dist` |
| 155 | done |
| 156 | ) |
| 157 | |
| 158 | # fix header of config file |
| 159 | sed -i 's|/usr/local/mnogosearch/sbin/indexer|%{_bindir}/indexer|g' \ |
| 160 | %{buildroot}%{_sysconfdir}/mnogosearch/indexer.conf |
| 161 | |
| 162 | # change default configuration |
| 163 | sed -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 | |
| 167 | sed -i 's|#LocalCharset UTF-8|LocalCharset UTF-8|g' \ |
| 168 | %{buildroot}%{_sysconfdir}/mnogosearch/indexer.conf |
| 169 | |
| 170 | sed -i 's|#Server http://localhost/|Server http://localhost/|g' \ |
| 171 | %{buildroot}%{_sysconfdir}/mnogosearch/indexer.conf |
| 172 | |
| 173 | # enable common external document helpers by default |
| 174 | # we require them so they will be installed |
| 175 | |
| 176 | sed -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 | |
| 179 | sed -i 's|#Mime application/pdf text/plain "pdftotext $1 -"|Mime application/pdf text/plain "pdftotext $1 -"|g' \ |
| 180 | %{buildroot}%{_sysconfdir}/mnogosearch/indexer.conf |
| 181 | |
| 182 | sed -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 | |
| 185 | sed -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 | |
| 188 | # the cgi is no regular binary, move it to libexec |
| 189 | install -d %{buildroot}%{_libexecdir}/mnogosearch |
| 190 | mv -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 |
| 194 | rm -f %{buildroot}%{_libdir}/*.la |
| 195 | |
| 196 | install -m0755 %{SOURCE1} %{buildroot}%{_bindir}/ |
| 197 | |
| 198 | install -d %{buildroot}%{_sysconfdir}/cron.d/ |
| 199 | install -m0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/cron.d/mnogosearch |
| 200 | |
| 201 | install -d %{buildroot}%{_sysconfdir}/httpd/conf.d/ |
| 202 | install -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 |
| 208 | cd php |
| 209 | |
| 210 | /usr/bin/phpize |
| 211 | %configure --with-mnogosearch=%{buildroot}%{_prefix} |
| 212 | |
| 213 | # get rid of rpath |
| 214 | sed -i 's|-Wl,-rpath,[^ ]*||g' Makefile |
| 215 | |
| 216 | make %{?_smp_mflags} EXTRA_LDFLAGS="-L%{buildroot}%{_libdir}" EXTRA_CFLAGS="-I%{buildroot}%{_includedir}/mnogosearch" |
| 217 | make install \ |
| 218 | INSTALL_ROOT=$RPM_BUILD_ROOT |
| 219 | cd .. |
| 220 | |
| 221 | install -d %{buildroot}%{_sysconfdir}/php.d |
| 222 | cat >%{buildroot}%{_sysconfdir}/php.d/mnogosearch.ini <<EOF |
| 223 | ; Enable mnogosearch extension module |
| 224 | extension=mnogosearch.so |
| 225 | EOF |
| 226 | |
| 227 | # end PHP stuff |
| 228 | # --------------------- |
| 229 | |
| 230 | # create state-dir |
| 231 | install -d %{buildroot}%{_localstatedir}/lib/mnogosearch |
| 232 | |
| 233 | # fix docs |
| 234 | rm -rf html; mkdir -p html |
| 235 | cp -p doc/*.html html/ |
| 236 | rm -rf %{buildroot}/usr/doc |
| 237 | |
| 238 | %check |
| 239 | %if %{with_tests} |
| 240 | # run unit tests with sqlite backend |
| 241 | touch ./msearch-test/sqlite.db |
| 242 | export UDM_TEST_DBADDR=sqlite3://`pwd`/msearch-test/sqlite.db/,sqlite3://`pwd`/msearch-test/sqlite2.db/ |
| 243 | make check |
| 244 | %endif |
| 245 | |
| 246 | %clean |
| 247 | rm -rf %{buildroot} |
| 248 | |
| 249 | %pre |
| 250 | # create mnogosearch user and group |
| 251 | getent group mnogosearch >/dev/null || groupadd -r mnogosearch |
| 252 | getent 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 |
| 256 | exit 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 |
| 261 | usermod -a -G mnogosearch apache || : |
| 262 | |
| 263 | # we brought our own apache config snippet and new group rights |
| 264 | service httpd condrestart > /dev/null 2>&1 || : |
| 265 | |
| 266 | # create default mnogosearch database (only during install) |
| 267 | if [ $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 |
| 272 | fi |
| 273 | |
| 274 | %postun |
| 275 | service 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 |
| 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 | |
| 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 |
| 341 | - fix timezone issue with test-blob unit test |
| 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 | |