%define mariadb_version 5.5.32 %define mariadb_release 8%{?dist} %define mariadb_download_base_url http://ftp.iij.ad.jp/pub/linux/fedora/updates/19/SRPMS %define groonga_required_version 3.0.7 Name: mariadb-mroonga Version: 3.08 Release: 2%{?dist} Summary: A fast fulltext searchable storage engine for MariaDB Group: Applications/Databases License: LGPLv2 URL: http://mroonga.org/ Source0: http://packages.groonga.org/source/mroonga/mroonga-%{version}.tar.gz BuildRequires: groonga-devel >= %{groonga_required_version} BuildRequires: groonga-normalizer-mysql-devel BuildRequires: mariadb-devel BuildRequires: perl(Test::More) Requires: groonga-libs >= %{groonga_required_version} Requires: mariadb-server = 1:%{mariadb_version}-%{mariadb_release} Requires: mariadb = 1:%{mariadb_version}-%{mariadb_release} Requires: groonga-normalizer-mysql Obsoletes: mysql-groonga < 1.10-0 %description Mroonga is a fast fulltext searchable storage plugin for MariaDB. It is based on groonga that is a fast fulltext search engine and column store. Groonga is good at real-time update. %package doc Summary: Documentation for mroonga Group: Documentation License: LGPLv2 BuildArch: noarch %description doc Documentation for mroonga %prep %setup -q -n mroonga-%{version} srpm=mariadb-%{mariadb_version}-%{mariadb_release}.src.rpm if [ ! -f ../../SRPMS/$srpm ]; then curl --output ../../SRPMS/$srpm %{mariadb_download_base_url}/$srpm rpm -Uvh ../../SRPMS/$srpm fi %build if [ ! -d ../mariadb-%{mariadb_version} ]; then rpmbuild -bp --define 'runselftest 0' --define 'optflags -O0' \ ../../SPECS/mariadb.spec fi %configure CPPFLAGS="-DDISABLE_DTRACE" \ --disable-static \ --with-mysql-source=../mariadb-%{mariadb_version} \ --enable-fast-mutexes \ %{?mroonga_configure_options} make %{?_smp_mflags} %install rm -rf $RPM_BUILD_ROOT make install DESTDIR=$RPM_BUILD_ROOT rm $RPM_BUILD_ROOT%{_libdir}/mysql/plugin/*.la mv $RPM_BUILD_ROOT%{_datadir}/doc/mroonga/ mariadb-mroonga-doc/ %post password_option="" mysql -u root -e "quit" if [ $? -ne 0 ]; then password_option="-p" fi current_version=0 version=`echo %{groonga_required_version} | sed -e 's/\.//g'` required_version=`expr $version` version=`mysql -e "show variables like 'mroonga_libgroonga_version'" | \ grep mroonga | cut -f 2 | sed -e 's/\.//g'` if [ -n "$version" ]; then current_version=`expr $version` fi drop_sql=" USE mysql; DROP FUNCTION IF EXISTS mroonga_snippet; DROP FUNCTION IF EXISTS last_insert_grn_id; DROP FUNCTION IF EXISTS mroonga_command; DROP FUNCTION IF EXISTS mroonga_escape; UNINSTALL PLUGIN mroonga; FLUSH TABLES; " install_sql=" DELETE IGNORE FROM mysql.plugin WHERE name = 'mroonga'; INSTALL PLUGIN mroonga SONAME 'ha_mroonga.so'; CREATE FUNCTION last_insert_grn_id RETURNS INTEGER SONAME 'ha_mroonga.so'; CREATE FUNCTION mroonga_snippet RETURNS STRING SONAME 'ha_mroonga.so'; CREATE FUNCTION mroonga_command RETURNS STRING SONAME 'ha_mroonga.so'; CREATE FUNCTION mroonga_escape RETURNS STRING SONAME 'ha_mroonga.so'; " if [ "$1" = 2 ] ; then if [ $current_version -lt $required_version ]; then sql="$drop_sql$install_sql" command="/usr/bin/mysql -u root $password_option -e \"$sql\"" echo "run the following command after restarting mariadb server:"; echo " $command" exit 0 else sql="$drop_sql" command="/usr/bin/mysql -u root $password_option -e \"$sql\"" echo $command eval $command || \ (echo "run the following command to unregister mroonga:"; \ echo " $command") fi fi sql="$install_sql" command="/usr/bin/mysql -u root $password_option -e \"$sql\"" echo $command eval $command || \ (echo "run the following command to register mroonga:"; \ echo " $command") %preun password_option="" mysql -u root -e "quit" if [ $? -ne 0 ]; then password_option="-p" fi if [ "$1" = 0 ]; then sql=" USE mysql; DROP FUNCTION IF EXISTS mroonga_snippet; DROP FUNCTION IF EXISTS last_insert_grn_id; DROP FUNCTION IF EXISTS mroonga_command; DROP FUNCTION IF EXISTS mroonga_escape; UNINSTALL PLUGIN mroonga; FLUSH TABLES; " command="/usr/bin/mysql -u root $password_option -e \"$sql\"" echo $command eval $command || \ (echo "run the following command to unregister mroonga:"; \ echo " $command") fi %files %defattr(-,root,root,-) %{_libdir}/mysql/plugin/ %{_datadir}/man/man1/* %{_datadir}/man/*/man1/* %files doc %defattr(-,root,root,-) %doc README COPYING %doc mariadb-mroonga-doc/* %changelog * Thu Oct 10 2013 HAYASHI Kentaro - 3.08-2 - mark doc package as noarch. - remove redundant clean section. * Sun Sep 29 2013 HAYASHI Kentaro - 3.08-1 - new upstream release. * Wed Sep 4 2013 HAYASHI Kentaro - 3.07-2 - fix a bug that mroonga is removed accidentally on upgrade #1918. Reported by @ceekz. Thanks!!! * Thu Aug 29 2013 HAYASHI Kentaro - 3.07-1 - new upstream release. * Mon Jul 29 2013 HAYASHI Kentaro - 3.06-1 - new upstream release. - initial packaging for mariadb on Fedora 19.