summaryrefslogtreecommitdiffstats
path: root/storage/mroonga/packages
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:07:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:07:14 +0000
commita175314c3e5827eb193872241446f2f8f5c9d33c (patch)
treecd3d60ca99ae00829c52a6ca79150a5b6e62528b /storage/mroonga/packages
parentInitial commit. (diff)
downloadmariadb-10.5-a175314c3e5827eb193872241446f2f8f5c9d33c.tar.xz
mariadb-10.5-a175314c3e5827eb193872241446f2f8f5c9d33c.zip
Adding upstream version 1:10.5.12.upstream/1%10.5.12upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'storage/mroonga/packages')
-rw-r--r--storage/mroonga/packages/Makefile.am7
-rw-r--r--storage/mroonga/packages/apt/Makefile.am91
-rw-r--r--storage/mroonga/packages/apt/Vagrantfile50
-rwxr-xr-xstorage/mroonga/packages/apt/build-deb.sh106
-rw-r--r--storage/mroonga/packages/apt/env.sh.in16
-rwxr-xr-xstorage/mroonga/packages/apt/sign-packages.sh42
-rwxr-xr-xstorage/mroonga/packages/apt/sign-repository.sh46
-rwxr-xr-xstorage/mroonga/packages/apt/update-repository.sh130
-rw-r--r--storage/mroonga/packages/rpm/Makefile.am2
-rw-r--r--storage/mroonga/packages/rpm/centos/Makefile.am19
-rw-r--r--storage/mroonga/packages/rpm/centos/mariadb-mroonga.spec.in486
-rw-r--r--storage/mroonga/packages/rpm/centos/mysql55-mroonga.spec.in311
-rw-r--r--storage/mroonga/packages/rpm/centos/mysql56-community-mroonga.spec.in374
-rw-r--r--storage/mroonga/packages/rpm/centos/percona-server-56-mroonga.spec.in273
-rw-r--r--storage/mroonga/packages/source/Makefile.am125
-rw-r--r--storage/mroonga/packages/source/patches/mariadb-10.0.3-windows-build.diff9
-rw-r--r--storage/mroonga/packages/ubuntu/Makefile.am57
-rwxr-xr-xstorage/mroonga/packages/ubuntu/upload.rb247
-rw-r--r--storage/mroonga/packages/windows/Makefile.am12
-rw-r--r--storage/mroonga/packages/windows/README.md21
-rw-r--r--storage/mroonga/packages/windows/build-vc2015-msi-32.bat8
-rw-r--r--storage/mroonga/packages/windows/build-vc2015-msi-64.bat8
-rw-r--r--storage/mroonga/packages/windows/build-vc2015-zip-32.bat13
-rw-r--r--storage/mroonga/packages/windows/build-vc2015-zip-64.bat13
-rw-r--r--storage/mroonga/packages/windows/build-vc2015.bat4
-rw-r--r--storage/mroonga/packages/yum/Makefile.am77
-rw-r--r--storage/mroonga/packages/yum/Vagrantfile42
-rwxr-xr-xstorage/mroonga/packages/yum/build-in-vm.sh85
-rwxr-xr-xstorage/mroonga/packages/yum/build-rpm.sh182
-rw-r--r--storage/mroonga/packages/yum/env.sh.in32
-rwxr-xr-xstorage/mroonga/packages/yum/sign-rpm.sh52
-rwxr-xr-xstorage/mroonga/packages/yum/update-repository.sh27
32 files changed, 2967 insertions, 0 deletions
diff --git a/storage/mroonga/packages/Makefile.am b/storage/mroonga/packages/Makefile.am
new file mode 100644
index 00000000..fed925c3
--- /dev/null
+++ b/storage/mroonga/packages/Makefile.am
@@ -0,0 +1,7 @@
+SUBDIRS = \
+ apt \
+ rpm \
+ source \
+ ubuntu \
+ windows \
+ yum
diff --git a/storage/mroonga/packages/apt/Makefile.am b/storage/mroonga/packages/apt/Makefile.am
new file mode 100644
index 00000000..0ebc7f67
--- /dev/null
+++ b/storage/mroonga/packages/apt/Makefile.am
@@ -0,0 +1,91 @@
+REPOSITORIES_PATH = repositories
+DISTRIBUTIONS = debian
+ARCHITECTURES = i386 amd64
+CODE_NAMES = jessie stretch
+MYSQL_VARIANTS = 5.5 mariadb-10.0
+
+all:
+
+release: download build sign-packages update-repository sign-repository upload
+
+remove-existing-packages:
+ for distribution in $(DISTRIBUTIONS); do \
+ find $(REPOSITORIES_PATH)/$${distribution}/pool \
+ -type f -delete; \
+ done
+
+download:
+ for distribution in $(DISTRIBUTIONS); do \
+ rsync -avz --progress --delete \
+ $(RSYNC_PATH)/$${distribution} $(REPOSITORIES_PATH)/; \
+ done
+
+sign-packages:
+ ./sign-packages.sh '$(GPG_UID)' '$(REPOSITORIES_PATH)/' '$(CODE_NAMES)'
+
+update-repository:
+ ./update-repository.sh '$(PACKAGE_NAME)' '$(REPOSITORIES_PATH)/' \
+ '$(ARCHITECTURES)' '$(CODE_NAMES)'
+
+sign-repository:
+ ./sign-repository.sh '$(GPG_UID)' '$(REPOSITORIES_PATH)/' '$(CODE_NAMES)'
+
+ensure-rsync-path:
+ @if test -z "$(RSYNC_PATH)"; then \
+ echo "--with-rsync-path configure option must be specified."; \
+ false; \
+ fi
+
+upload: ensure-rsync-path
+ for distribution in $(DISTRIBUTIONS); do \
+ (cd $(REPOSITORIES_PATH)/$${distribution}; \
+ rsync -avz --progress --delete \
+ dists pool $(RSYNC_PATH)/$${distribution}; \
+ ); \
+ done
+
+build: build-package-deb
+
+build-package-deb: source env.sh
+ vagrant destroy --force
+ for variant in $(MYSQL_VARIANTS); do \
+ cp env.sh tmp/; \
+ echo "MYSQL_VARIANT=$${variant}" >> tmp/env.sh; \
+ for architecture in $(ARCHITECTURES); do \
+ for code_name in $(CODE_NAMES); do \
+ rm -rf tmp/debian; \
+ if [ $${variant} = "5.5" -a $${code_name} = "stretch" ]; then \
+ continue; \
+ fi; \
+ if [ $${code_name} = "stretch" ]; then \
+ cp -rp $(srcdir)/../debian-mariadb-10.0 tmp/debian; \
+ for f in `find tmp/debian -maxdepth 2 -type f`; do \
+ RENAMED=`echo $$f | sed 's/10.0/10.1/'`; \
+ sed -i'' 's/10.0/10.1/g' $${f}; \
+ if [ $${f} = $$RENAMED ]; then \
+ continue; \
+ fi; \
+ mv $${f} $$RENAMED; \
+ done; \
+ if [ $${architecture} = "amd64" ]; then \
+ sed -i'' 's,lib/mysql/,lib/x86_64-linux-gnu/mariadb18/,' \
+ tmp/debian/mariadb-server-10.1-mroonga.install; \
+ elif [ $${architecture} = "i386" ]; then \
+ sed -i'' 's,lib/mysql/,lib/i386-linux-gnu/mariadb18/,' \
+ tmp/debian/mariadb-server-10.1-mroonga.install; \
+ fi; \
+ else \
+ cp -rp $(srcdir)/../debian-$${variant} tmp/debian; \
+ fi; \
+ id=debian-$$code_name-$$architecture; \
+ vagrant up $$id || exit 1; \
+ vagrant destroy --force $$id; \
+ done; \
+ done; \
+ done
+
+source: tmp/$(PACKAGE)-$(VERSION).tar.gz
+
+tmp/$(PACKAGE)-$(VERSION).tar.gz: $(abs_top_builddir)/$(PACKAGE)-$(VERSION).tar.gz
+ mkdir -p tmp
+ cp $(abs_top_builddir)/$(PACKAGE)-$(VERSION).tar.gz $@
diff --git a/storage/mroonga/packages/apt/Vagrantfile b/storage/mroonga/packages/apt/Vagrantfile
new file mode 100644
index 00000000..ee4a6aeb
--- /dev/null
+++ b/storage/mroonga/packages/apt/Vagrantfile
@@ -0,0 +1,50 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
+VAGRANTFILE_API_VERSION = "2"
+
+Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
+ vms = [
+ {
+ :id => "debian-jessie-i386",
+ :box => "bento/debian-8.9-i386",
+ },
+ {
+ :id => "debian-jessie-amd64",
+ :box => "bento/debian-8.9",
+ },
+ {
+ :id => "debian-stretch-i386",
+ :box => "bento/debian-9.1-i386",
+ },
+ {
+ :id => "debian-stretch-amd64",
+ :box => "bento/debian-9.1",
+ },
+ ]
+
+ vms.each do |vm|
+ config.vm.define(vm[:id]) do |node|
+ # Use official box
+ node.vm.box = vm[:box] if vm[:box]
+ # Use box and box_url until official box is released
+ node.vm.box = vm[:id] if vm[:box_url]
+ node.vm.box_url = vm[:box_url] if vm[:box_url]
+ node.vm.provision(:shell, :path => "build-deb.sh")
+ node.vm.provider("virtualbox") do |virtual_box|
+ system_n_cpus = 1
+ if File.exist?("/proc/cpuinfo")
+ system_n_cpus = File.readlines("/proc/cpuinfo").grep(/^processor/).size
+ end
+ if system_n_cpus > 1
+ vm_n_cpus = system_n_cpus / 2
+ else
+ vm_n_cpus = 1
+ end
+ virtual_box.cpus = (ENV["VM_CPUS"] || vm_n_cpus).to_i
+ virtual_box.memory = (ENV["VM_MEMORY"] || 768).to_i
+ end
+ end
+ end
+end
diff --git a/storage/mroonga/packages/apt/build-deb.sh b/storage/mroonga/packages/apt/build-deb.sh
new file mode 100755
index 00000000..e0e03d8e
--- /dev/null
+++ b/storage/mroonga/packages/apt/build-deb.sh
@@ -0,0 +1,106 @@
+#!/bin/sh
+
+LANG=C
+
+run()
+{
+ "$@"
+ if test $? -ne 0; then
+ echo "Failed $@"
+ exit 1
+ fi
+}
+
+. /vagrant/tmp/env.sh
+
+code_name=$(lsb_release --codename --short)
+case "${MYSQL_VARIANT}" in
+ mariadb-*)
+ case "${code_name}" in
+ stretch)
+ mysql_server_package=mariadb-server-10.1
+ MYSQL_VARIANT=mariadb-10.1
+ ;;
+ *)
+ mysql_server_package=mariadb-server-${MYSQL_VARIANT##mariadb-}
+ ;;
+ esac
+ DEPENDED_PACKAGES="${DEPENDED_PACKAGES} libmariadb-client-lgpl-dev"
+ DEPENDED_PACKAGES="${DEPENDED_PACKAGES} libmariadbd-dev"
+ ;;
+ *)
+ mysql_server_package=mysql-server-${MYSQL_VARIANT}
+ DEPENDED_PACKAGES="${DEPENDED_PACKAGES} libmysqlclient-dev"
+ DEPENDED_PACKAGES="${DEPENDED_PACKAGES} libmysqld-dev"
+ ;;
+esac
+
+grep '^deb ' /etc/apt/sources.list | \
+ sed -e 's/^deb /deb-src /' > /etc/apt/sources.list.d/base-source.list
+
+run sudo sed -i'' -e 's/httpredir/ftp.jp/g' /etc/apt/sources.list
+
+run apt-get update
+run apt-get install -y lsb-release
+
+distribution=$(lsb_release --id --short | tr 'A-Z' 'a-z')
+case "${distribution}" in
+ debian)
+ component=main
+ run cat <<EOF > /etc/apt/sources.list.d/groonga.list
+deb http://packages.groonga.org/debian/ ${code_name} main
+deb-src http://packages.groonga.org/debian/ ${code_name} main
+EOF
+ if ! grep --quiet security /etc/apt/sources.list; then
+ run cat <<EOF > /etc/apt/sources.list.d/security.list
+deb http://security.debian.org/ ${code_name}/updates main
+deb-src http://security.debian.org/ ${code_name}/updates main
+EOF
+ fi
+ run apt-get update
+ run apt-get install -y --allow-unauthenticated groonga-keyring
+ run apt-get update
+ ;;
+ ubuntu)
+ component=universe
+ run cat <<EOF > /etc/apt/sources.list.d/security.list
+deb http://security.ubuntu.com/ubuntu ${code_name}-security main restricted
+deb-src http://security.ubuntu.com/ubuntu ${code_name}-security main restricted
+EOF
+ run sed -e 's/main/universe/' /etc/apt/sources.list > \
+ /etc/apt/sources.list.d/universe.list
+ run apt-get -y install software-properties-common
+ run add-apt-repository -y universe
+ run add-apt-repository -y ppa:groonga/ppa
+ run apt-get update
+ ;;
+esac
+
+run apt-get install -V -y build-essential devscripts ${DEPENDED_PACKAGES}
+run apt-get build-dep -y ${mysql_server_package}
+
+run mkdir -p build
+run cd build
+run tar xfz /vagrant/tmp/${PACKAGE}-${VERSION}.tar.gz
+run mv ${PACKAGE}-${VERSION} ${PACKAGE}-${MYSQL_VARIANT}-${VERSION}
+run tar cfz ${PACKAGE}-${MYSQL_VARIANT}_${VERSION}.orig.tar.gz \
+ ${PACKAGE}-${MYSQL_VARIANT}-${VERSION}
+run cd ${PACKAGE}-${MYSQL_VARIANT}-${VERSION}/
+run cp -rp /vagrant/tmp/debian debian
+# export DEB_BUILD_OPTIONS=noopt
+MYSQL_PACKAGE_INFO=$(apt-cache show ${mysql_server_package} |
+ grep Version |
+ sort |
+ tail -1)
+MYSQL_PACKAGE_VERSION=${MYSQL_PACKAGE_INFO##Version: }
+sed -i'' \
+ -e "s/MYSQL_VERSION/$MYSQL_PACKAGE_VERSION/g" \
+ -e "s/MARIADB_VERSION/$MYSQL_PACKAGE_VERSION/g" \
+ debian/control
+run debuild -us -uc
+run cd -
+
+package_initial=$(echo "${PACKAGE}" | sed -e 's/\(.\).*/\1/')
+pool_dir="/vagrant/repositories/${distribution}/pool/${code_name}/${component}/${package_initial}/${PACKAGE}"
+run mkdir -p "${pool_dir}/"
+run cp *.tar.* *.diff.gz *.dsc *.deb "${pool_dir}/"
diff --git a/storage/mroonga/packages/apt/env.sh.in b/storage/mroonga/packages/apt/env.sh.in
new file mode 100644
index 00000000..51109aee
--- /dev/null
+++ b/storage/mroonga/packages/apt/env.sh.in
@@ -0,0 +1,16 @@
+PACKAGE=@PACKAGE@
+VERSION=@VERSION@
+DEPENDED_PACKAGES="
+debhelper
+autotools-dev
+libgroonga-dev
+pkg-config
+libmecab-dev
+mecab-utils
+gdb
+libxml2-dev
+unixodbc-dev
+libssl-dev
+groonga-normalizer-mysql
+wget
+"
diff --git a/storage/mroonga/packages/apt/sign-packages.sh b/storage/mroonga/packages/apt/sign-packages.sh
new file mode 100755
index 00000000..57c985f3
--- /dev/null
+++ b/storage/mroonga/packages/apt/sign-packages.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+script_base_dir=`dirname $0`
+
+if [ $# != 3 ]; then
+ echo "Usage: $0 GPG_UID DESITINATION CODES"
+ echo " e.g.: $0 'F10399C0' repositories/ 'lenny unstable hardy karmic'"
+ exit 1
+fi
+
+GPG_UID=$1
+DESTINATION=$2
+CODES=$3
+
+run()
+{
+ "$@"
+ if test $? -ne 0; then
+ echo "Failed $@"
+ exit 1
+ fi
+}
+
+for code_name in ${CODES}; do
+ case ${code_name} in
+ jessie|stretch|unstable)
+ distribution=debian
+ ;;
+ *)
+ distribution=ubuntu
+ ;;
+ esac
+
+ base_directory=${DESTINATION}${distribution}
+ debsign -pgpg2 --re-sign -k${GPG_UID} \
+ $(find ${base_directory} -name '*.dsc' -or -name '*.changes') &
+ if [ "${PARALLEL}" != "yes" ]; then
+ wait
+ fi
+done
+
+wait
diff --git a/storage/mroonga/packages/apt/sign-repository.sh b/storage/mroonga/packages/apt/sign-repository.sh
new file mode 100755
index 00000000..e0d963ff
--- /dev/null
+++ b/storage/mroonga/packages/apt/sign-repository.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+script_base_dir=`dirname $0`
+
+if [ $# != 3 ]; then
+ echo "Usage: $0 GPG_UID DESTINATION CODES"
+ echo " e.g.: $0 'F10399C0' repositories/ 'lenny unstable hardy karmic'"
+ exit 1
+fi
+
+GPG_UID=$1
+DESTINATION=$2
+CODES=$3
+
+run()
+{
+ "$@"
+ if test $? -ne 0; then
+ echo "Failed $@"
+ exit 1
+ fi
+}
+
+for code_name in ${CODES}; do
+ case ${code_name} in
+ jessie|stretch|unstable)
+ distribution=debian
+ ;;
+ *)
+ distribution=ubuntu
+ ;;
+ esac
+
+ release=${DESTINATION}${distribution}/dists/${code_name}/Release
+ rm -f ${release}.gpg
+ gpg2 --sign --detach-sign --armor \
+ --local-user ${GPG_UID} \
+ --output ${release}.gpg \
+ ${release} &
+
+ if [ "${PARALLEL}" != "yes" ]; then
+ wait
+ fi
+done
+
+wait
diff --git a/storage/mroonga/packages/apt/update-repository.sh b/storage/mroonga/packages/apt/update-repository.sh
new file mode 100755
index 00000000..a95ad117
--- /dev/null
+++ b/storage/mroonga/packages/apt/update-repository.sh
@@ -0,0 +1,130 @@
+#!/bin/sh
+
+script_base_dir=`dirname $0`
+
+if [ $# != 4 ]; then
+ echo "Usage: $0 PROJECT_NAME DESTINATION ARCHITECTURES CODES"
+ echo " e.g.: $0 mroonga repositories/ 'i386 amd64' 'lenny unstable hardy karmic'"
+ exit 1
+fi
+
+PROJECT_NAME=$1
+DESTINATION=$2
+ARCHITECTURES=$3
+CODES=$4
+
+run()
+{
+ "$@"
+ if test $? -ne 0; then
+ echo "Failed $@"
+ exit 1
+ fi
+}
+
+update_repository()
+{
+ distribution=$1
+ code_name=$2
+ component=$3
+
+ rm -rf dists/${code_name}
+ mkdir -p dists/${code_name}/${component}/binary-i386/
+ mkdir -p dists/${code_name}/${component}/binary-amd64/
+ mkdir -p dists/${code_name}/${component}/source/
+
+ cat <<EOF > dists/.htaccess
+Options +Indexes
+EOF
+
+ cat <<EOF > dists/${code_name}/${component}/binary-i386/Release
+Archive: ${code_name}
+Component: ${component}
+Origin: The ${PROJECT_NAME} project
+Label: The ${PROJECT_NAME} project
+Architecture: i386
+EOF
+
+ cat <<EOF > dists/${code_name}/${component}/binary-amd64/Release
+Archive: ${code_name}
+Component: ${component}
+Origin: The ${PROJECT_NAME} project
+Label: The ${PROJECT_NAME} project
+Architecture: amd64
+EOF
+
+ cat <<EOF > dists/${code_name}/${component}/source/Release
+Archive: ${code_name}
+Component: ${component}
+Origin: The ${PROJECT_NAME} project
+Label: The ${PROJECT_NAME} project
+Architecture: source
+EOF
+
+ cat <<EOF > generate-${code_name}.conf
+Dir::ArchiveDir ".";
+Dir::CacheDir ".";
+TreeDefault::Directory "pool/${code_name}/${component}";
+TreeDefault::SrcDirectory "pool/${code_name}/${component}";
+Default::Packages::Extensions ".deb";
+Default::Packages::Compress ". gzip bzip2";
+Default::Sources::Compress ". gzip bzip2";
+Default::Contents::Compress "gzip bzip2";
+
+BinDirectory "dists/${code_name}/${component}/binary-i386" {
+ Packages "dists/${code_name}/${component}/binary-i386/Packages";
+ Contents "dists/${code_name}/Contents-i386";
+ SrcPackages "dists/${code_name}/${component}/source/Sources";
+};
+
+BinDirectory "dists/${code_name}/${component}/binary-amd64" {
+ Packages "dists/${code_name}/${component}/binary-amd64/Packages";
+ Contents "dists/${code_name}/Contents-amd64";
+ SrcPackages "dists/${code_name}/${component}/source/Sources";
+};
+
+Tree "dists/${code_name}" {
+ Sections "${component}";
+ Architectures "i386 amd64 source";
+};
+EOF
+ apt-ftparchive generate generate-${code_name}.conf
+ chmod 644 dists/${code_name}/Contents-*
+
+ rm -f dists/${code_name}/Release*
+ rm -f *.db
+ cat <<EOF > release-${code_name}.conf
+APT::FTPArchive::Release::Origin "The ${PROJECT_NAME} project";
+APT::FTPArchive::Release::Label "The ${PROJECT_NAME} project";
+APT::FTPArchive::Release::Architectures "i386 amd64";
+APT::FTPArchive::Release::Codename "${code_name}";
+APT::FTPArchive::Release::Suite "${code_name}";
+APT::FTPArchive::Release::Components "${component}";
+APT::FTPArchive::Release::Description "${PACKAGE_NAME} packages";
+EOF
+ apt-ftparchive -c release-${code_name}.conf \
+ release dists/${code_name} > /tmp/Release
+ mv /tmp/Release dists/${code_name}
+}
+
+for code_name in ${CODES}; do
+ case ${code_name} in
+ jessie|stretch|unstable)
+ distribution=debian
+ component=main
+ ;;
+ *)
+ distribution=ubuntu
+ component=universe
+ ;;
+ esac
+
+ mkdir -p ${DESTINATION}${distribution}
+ (cd ${DESTINATION}${distribution}
+ update_repository $distribution $code_name $component) &
+ if [ "${PARALLEL}" != "yes" ]; then
+ wait
+ fi
+done
+
+wait
diff --git a/storage/mroonga/packages/rpm/Makefile.am b/storage/mroonga/packages/rpm/Makefile.am
new file mode 100644
index 00000000..aa1ba3ad
--- /dev/null
+++ b/storage/mroonga/packages/rpm/Makefile.am
@@ -0,0 +1,2 @@
+SUBDIRS = \
+ centos
diff --git a/storage/mroonga/packages/rpm/centos/Makefile.am b/storage/mroonga/packages/rpm/centos/Makefile.am
new file mode 100644
index 00000000..72d860a9
--- /dev/null
+++ b/storage/mroonga/packages/rpm/centos/Makefile.am
@@ -0,0 +1,19 @@
+EXTRA_DIST = \
+ mysql55-mroonga.spec.in \
+ mysql56-community-mroonga.spec.in \
+ mysql57-community-mroonga.spec.in \
+ mariadb-mroonga.spec.in \
+ mariadb-10.1-mroonga.spec.in \
+ mariadb-10.2-mroonga.spec.in \
+ percona-server-56-mroonga.spec.in \
+ percona-server-57-mroonga.spec.in
+
+noinst_DATA = \
+ mysql55-mroonga.spec \
+ mysql56-community-mroonga.spec \
+ mysql57-community-mroonga.spec \
+ mariadb-mroonga.spec \
+ mariadb-10.1-mroonga.spec \
+ mariadb-10.2-mroonga.spec \
+ percona-server-56-mroonga.spec \
+ percona-server-57-mroonga.spec
diff --git a/storage/mroonga/packages/rpm/centos/mariadb-mroonga.spec.in b/storage/mroonga/packages/rpm/centos/mariadb-mroonga.spec.in
new file mode 100644
index 00000000..d23c499f
--- /dev/null
+++ b/storage/mroonga/packages/rpm/centos/mariadb-mroonga.spec.in
@@ -0,0 +1,486 @@
+%define mariadb_epoch_default 1
+%define mariadb_version_default 5.5.56
+%define mariadb_release_default 2
+%define mariadb_dist_default .el7
+%define mariadb_download_base_url_default http://vault.centos.org/7.4.1708/os/Source/SPackages/
+%define mariadb_spec_file_default mariadb.spec
+
+%define _mariadb_epoch %{?mariadb_epoch:%{mariadb_epoch}}%{!?mariadb_epoch:%{mariadb_epoch_default}}
+%define _mariadb_version %{?mariadb_version:%{mariadb_version}}%{!?mariadb_version:%{mariadb_version_default}}
+%define _mariadb_release %{?mariadb_release:%{mariadb_release}}%{!?mariadb_release:%{mariadb_release_default}}
+%define _mariadb_dist %{?mariadb_dist:%{mariadb_dist}}%{!?mariadb_dist:%{mariadb_dist_default}}
+%define _mariadb_download_base_url %{?mariadb_download_base_url:%{mariadb_download_base_url}}%{!?mariadb_download_base_url:%{mariadb_download_base_url_default}}
+%define _mariadb_spec_file %{?mariadb_spec_file:%{mariadb_spec_file}}%{!?mariadb_spec_file:%{mariadb_spec_file_default}}
+
+%define _mariadb_package_version %{_mariadb_epoch}:%{_mariadb_version}-%{_mariadb_release}%{_mariadb_dist}
+
+%define groonga_required_version @REQUIRED_GROONGA_VERSION@
+
+Name: mariadb-mroonga
+Version: @VERSION@
+Release: 1%{?dist}
+Summary: A fast fulltext searchable storage engine for MariaDB
+
+Group: Applications/Databases
+License: LGPLv2.1
+URL: http://mroonga.org/
+Source0: http://packages.groonga.org/source/mroonga/mroonga-%{version}.tar.gz
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u} -n)
+BuildRequires: groonga-devel >= %{groonga_required_version}
+BuildRequires: groonga-normalizer-mysql-devel
+BuildRequires: wget
+BuildRequires: mariadb-devel = %{_mariadb_package_version}
+Requires: mariadb-server = %{_mariadb_package_version}
+Requires: mariadb = %{_mariadb_package_version}
+Requires: groonga-libs >= %{groonga_required_version}
+Requires: groonga-normalizer-mysql
+
+%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.1
+
+%description doc
+Documentation for Mroonga
+
+
+%prep
+%setup -q -n mroonga-%{version}
+
+mariadb_full_version=%{_mariadb_version}-%{_mariadb_release}%{_mariadb_dist}
+srpm=mariadb-${mariadb_full_version}.src.rpm
+if [ ! -f ../../SRPMS/$srpm ]; then
+ wget --continue -O ../../SRPMS/$srpm %{_mariadb_download_base_url}/$srpm
+ rpm -Uvh ../../SRPMS/$srpm
+ rm ../../SRPMS/$srpm
+fi
+
+%build
+mariadb_source=../mariadb-%{_mariadb_version}
+if [ ! -d ${mariadb_source} ]; then
+ rpmbuild -bc \
+ --define 'runselftest 0' \
+ --define 'optflags -O0' \
+ ../../SPECS/%{_mariadb_spec_file}
+fi
+%configure \
+ --disable-static \
+ --with-mysql-source=${mariadb_source} \
+ %{?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/ mysql-mroonga-doc/
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post
+if /usr/bin/mysql -u root -e "quit" > /dev/null 2>&1; then
+ password_option=""
+else
+ password_option="-p"
+fi
+current_version=0
+version=$(echo %{groonga_required_version} | sed -e 's/\.//g')
+required_version=$(expr $version)
+version=$(/usr/bin/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
+install_sql=%{_datadir}/mroonga/install.sql
+uninstall_sql=%{_datadir}/mroonga/uninstall.sql
+
+if [ "$1" = 2 ] ; then
+ if [ $current_version -lt $required_version ]; then
+ command="/usr/bin/mysql -u root $password_option"
+ echo "run the following command after restarting MySQL server:";
+ echo " $command < ${uninstall_sql}"
+ echo " $command < ${install_sql}"
+ exit 0
+ else
+ command="/usr/bin/mysql -u root $password_option"
+ command="${command} < ${uninstall_sql}"
+ echo $command
+ eval $command || \
+ (echo "run the following command to unregister Mroonga:"; \
+ echo " $command")
+ fi
+fi
+
+command="/usr/bin/mysql -u root $password_option < ${install_sql}"
+echo $command
+eval $command || \
+ (echo "run the following command to register Mroonga:"; \
+ echo " $command")
+
+%preun
+uninstall_sql=%{_datadir}/mroonga/uninstall.sql
+
+if mysql -u root -e "quit" > /dev/null 2>&1; then
+ password_option=""
+else
+ password_option="-p"
+fi
+if [ "$1" = 0 ]; then
+ command="/usr/bin/mysql -u root $password_option < ${uninstall_sql}"
+ echo $command
+ eval $command || \
+ (echo "run the following command to unregister Mroonga:"; \
+ echo " $command")
+fi
+
+%files
+%defattr(-,root,root,-)
+%{_libdir}/mysql/plugin/
+%{_datadir}/mroonga/*
+%{_datadir}/man/man1/*
+%{_datadir}/man/*/man1/*
+
+%files doc
+%defattr(-,root,root,-)
+%doc README COPYING
+%doc mysql-mroonga-doc/*
+
+%changelog
+* Thu Oct 12 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.07-1
+- new upstream release.
+
+* Fri Sep 15 2017 Kouhei Sutou <kou@clear-code.com> - 7.06-2
+- rebuild against the latest MariaDB.
+
+* Tue Aug 29 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.06-1
+- new upstream release.
+
+* Sat Jul 29 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.05-1
+- new upstream release.
+
+* Thu Jun 29 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.04-1
+- new upstream release.
+
+* Mon May 29 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.03-1
+- new upstream release.
+
+* Sat Apr 29 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.02-1
+- new upstream release.
+
+* Wed Mar 29 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.01-1
+- new upstream release.
+
+* Thu Feb 09 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.00-1
+- new upstream release.
+
+* Sat Oct 29 2016 Kentaro Hayashi <hayashi@clear-code.com> - 6.10-1
+- new upstream release.
+
+* Thu Sep 29 2016 Kentaro Hayashi <hayashi@clear-code.com> - 6.09-1
+- new upstream release.
+
+* Mon Aug 29 2016 Kentaro Hayashi <hayashi@clear-code.com> - 6.08-1
+- new upstream release.
+
+* Fri Jul 29 2016 Kentaro Hayashi <hayashi@clear-code.com> - 6.07-1
+- new upstream release.
+
+* Thu Jun 30 2016 Masafumi Yokoyama <yokoyama@clear-code.com> - 6.06-1
+- new upstream release.
+
+* Wed Jun 29 2016 Kentaro Hayashi <hayashi@clear-code.com> - 6.05-1
+- new upstream release.
+
+* Sun May 29 2016 Kentaro Hayashi <hayashi@clear-code.com> - 6.03-1
+- new upstream release.
+
+* Fri Apr 29 2016 HAYASHI Kentaro <hayashi@clear-code.com> - 6.02-1
+- new upstream release.
+
+* Tue Mar 29 2016 Masafumi Yokoyama <yokoyama@clear-code.com> - 6.01-1
+- new upstream release.
+
+* Mon Feb 29 2016 Kouhei Sutou <kou@clear-code.com> - 6.00-1
+- new upstream release.
+
+* Tue Dec 29 2015 Kouhei Sutou <kou@clear-code.com> - 5.11-1
+- new upstream release.
+
+* Wed Dec 16 2015 Kouhei Sutou <kou@clear-code.com> - 5.10-2
+- rebuild against MariaDB on CentOS 7.2. Reported by Larry Kim. Thanks!!!
+
+* Sun Nov 29 2015 Kouhei Sutou <kou@clear-code.com> - 5.10-1
+- new upstream release.
+
+* Thu Oct 29 2015 Kouhei Sutou <kou@cozmixng.org> - 5.09-1
+- new upstream release.
+
+* Tue Sep 29 2015 Kouhei Sutou <kou@clear-code.com> - 5.08-1
+- new upstream release.
+
+* Mon Aug 31 2015 Kouhei Sutou <kou@clear-code.com> - 5.06-1
+- new upstream release.
+
+* Wed Jul 29 2015 Masafumi Yokoyama <yokoyama@clear-code.com> - 5.05-1
+- new upstream release.
+
+* Mon Jun 29 2015 Masafumi Yokoyama <myokoym@gmail.com> - 5.04-1
+- new upstream release.
+
+* Fri May 29 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 5.03-1
+- new upstream release.
+
+* Wed Apr 29 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 5.02-1
+- new upstream release.
+
+* Sun Mar 29 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 5.01-1
+- new upstream release.
+
+* Mon Feb 09 2015 <hayashi@clear-code.com> - 5.00-1
+- new upstream release.
+
+* Thu Jan 29 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 4.10-1
+- new upstream release.
+
+* Wed Jan 14 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 4.09-2
+- build against mariadb-5.5.40-2.el7_0.
+
+* Mon Dec 29 2014 Kouhei Sutou <kou@cozmixng.org> - 4.09-1
+- new upstream release.
+
+* Sat Nov 29 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 4.08-1
+- new upstream release.
+
+* Wed Oct 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.07-1
+- new upstream release.
+
+* Mon Sep 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.06-1
+- new upstream release.
+
+* Fri Aug 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.05-1
+- new upstream release.
+
+* Thu Aug 14 2014 Kouhei Sutou <kou@clear-code.com> - 4.04-4
+- build MariaDB for libmysqlservices.a.
+
+* Thu Aug 14 2014 Kouhei Sutou <kou@clear-code.com> - 4.04-3
+- support epoch in MariaDB.
+
+* Wed Aug 13 2014 Kouhei Sutou <kou@clear-code.com> - 4.04-2
+- build against mariadb-5.5.37-1.el7_0.
+
+* Sun Aug 10 2014 Kouhei Sutou <kou@clear-code.com> - 4.04-1
+- initial packaging for CentOS 7 based on mysql-mroogna package.
+
+* Tue Jul 29 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 4.04-1
+- new upstream release.
+
+* Thu May 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.03-1
+- new upstream release.
+
+* Tue Apr 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.02-1
+- new upstream release.
+
+* Sat Mar 29 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 4.01-1
+- new upstream release.
+
+* Thu Feb 13 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 4.00-2
+- use MySQL 5.1.73-3 on CentOS 6.
+
+* Sun Feb 09 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 4.00-1
+- new upstream release.
+
+* Wed Jan 29 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 3.12-1
+- new upstream release.
+
+* Sun Dec 29 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.11-1
+- new upstream release.
+
+* Sat Dec 7 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.10-2
+- use MySQL 5.1.71-1 on CentOS 6.
+
+* Fri Nov 29 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.10-1
+- new upstream release.
+
+* Tue Oct 29 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.09-1
+- new upstream release.
+
+* Sun Sep 29 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.08-1
+- new upstream release.
+- use MySQL 5.6.14-1 on CentOS 5.
+
+* Wed Sep 4 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.07-2
+- fix a bug that mroonga is removed accidentally on upgrade #1918.
+ Reported by @ceekz. Thanks!!!
+
+* Thu Aug 29 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.07-1
+- new upstream release.
+- use MySQL 5.6.13-1 on CentOS 5.
+
+* Mon Jul 29 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.06-1
+- new upstream release.
+- use MySQL 5.6.12-2 on CentOS 5.
+
+* Sat Jun 29 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.05-1
+- new upstream release.
+- use MySQL 5.6.12 on CentOS 5.
+
+* Wed May 29 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.04-1
+- new upstream release.
+
+* Fri May 10 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.03-2
+- use MySQL 5.6.11-2 on CentOS 5. see http://bugs.mysql.com/bug.php?id=69027
+ Reported by Y.Kentaro. Thanks!!!
+
+* Mon Apr 29 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.03-1
+- new upstream release.
+
+* Fri Mar 29 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.02-0
+- new upstream release.
+
+* Thu Feb 28 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.01-0
+- new upstream release.
+
+* Sat Feb 09 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.00-0
+- new upstream release.
+- require groonga 3.0.0 or later
+
+* Tue Feb 05 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 2.10-2
+- use MySQL 5.1.67-1 on CentOS 6.
+ Reported by wakisuke.ua. Thanks!!!
+
+* Sat Dec 29 2012 HAYASHI Kentaro <hayashi@clear-code.com> - 2.10-0
+- new upstream release.
+
+* Mon Dec 10 2012 HAYASHI Kentaro <hayashi@clear-code.com> - 2.09-1
+- use MySQL 5.1.66-2 on CentOS 6.
+ Reported by wakisuke.ua. Thanks!!!
+
+* Thu Nov 29 2012 HAYASHI Kentaro <hayashi@clear-code.com> - 2.09-0
+- new upstream release.
+- use MySQL 5.5.28 on CentOS 5.
+- use MySQL 5.1.66 on CentOS 6.
+
+* Mon Oct 29 2012 HAYASHI Kentaro <hayashi@clear-code.com> - 2.08-0
+- new upstream release.
+- add missing "DROP FUNCTION mroonga_snippet".
+ Reported by @tokuhy. Thanks!!!
+
+* Sat Sep 29 2012 HAYASHI Kentaro <hayashi@clear-code.com> - 2.07-0
+- new upstream release.
+
+* Wed Aug 29 2012 Kouhei Sutou <kou@clear-code.com> - 2.06-0
+- new upstream release.
+- make MySQL spec file name customizable.
+- make mroonga configure options customizable.
+- add missing mysql-devel BuildRequires. Reported by wing. Thanks!!!
+- use MySQL 5.5.27.
+
+* Sun Jul 29 2012 HAYASHI Kentaro <hayashi@clear-code.com> - 2.05-0
+- new upstream release.
+- use MySQL 5.5.25a.
+
+* Fri Jun 29 2012 Kouhei Sutou <kou@clear-code.com> - 2.04-0
+- new upstream release.
+- ensure deleting mroonga plugin before install.
+ Suggested by Kazuhiro Isobe. Thanks!!!
+- use MySQL 5.5.25.
+
+* Tue May 29 2012 Kouhei Sutou <kou@clear-code.com> - 2.03-0
+- new upstream release.
+- use MySQL 5.5.24.
+- make mysql_* variables customizable
+- require groonga 2.0.3 or later.
+
+* Sun Apr 29 2012 Kouhei Sutou <kou@clear-code.com> - 2.02-0
+- new upstream release.
+- use MySQL 5.5.23.
+- require groonga 2.0.2 or later.
+
+* Thu Mar 29 2012 Kouhei Sutou <kou@clear-code.com> - 2.01-0
+- new upstream release.
+- ensure plugin is uninstalled by closing all tables use mroonga.
+
+* Wed Feb 29 2012 Kouhei Sutou <kou@clear-code.com> - 2.00-0
+- new upstream release.
+- always install/uninstall plugin.
+- use MySQL 5.1.61 and 5.5.21.
+- require groonga 2.0.0 or later.
+
+* Sun Jan 29 2012 Kouhei Sutou <kou@clear-code.com> - 1.20-0
+- new upstream release.
+- require groonga 1.3.0.
+- groonga -> mroonga.
+- use MySQL 5.5.20.
+
+* Thu Dec 29 2011 Kouhei Sutou <kou@clear-code.com> - 1.11-0
+- new upstream release.
+
+* Sat Oct 29 2011 Kouhei Sutou <kou@clear-code.com> - 1.10-0
+- new upstream release.
+- groonga storage engine -> mroonga.
+
+* Thu Sep 29 2011 Kouhei Sutou <kou@clear-code.com> - 1.0.0-0
+- new upstream release.
+
+* Mon Aug 29 2011 Kouhei Sutou <kou@clear-code.com> - 0.9-0
+- new upstream release.
+
+* Fri Jul 29 2011 Kouhei Sutou <kou@clear-code.com> - 0.8-0
+- new upstream release.
+
+* Wed Jun 29 2011 Kouhei Sutou <kou@clear-code.com> - 0.7-0
+- new upstream release.
+
+* Sun May 29 2011 Kouhei Sutou <kou@clear-code.com> - 0.6-0
+- new upstream release.
+
+* Tue May 17 2011 Kouhei Sutou <kou@clear-code.com> - 0.5-2
+- use MySQL 5.5.12.
+
+* Tue Mar 29 2011 Kouhei Sutou <kou@clear-code.com> - 0.5-1
+- new upstream release.
+
+* Sat Jan 29 2011 Kouhei Sutou <kou@clear-code.com> - 0.4-4
+- do not remove plugin on upgrade.
+
+* Wed Jan 12 2011 Kouhei Sutou <kou@clear-code.com> - 0.4-3
+- rebuild without debug symbol.
+
+* Thu Dec 30 2010 Kouhei Sutou <kou@clear-code.com> - 0.4-2
+- use MySQL 5.5.8-1.
+- fix SQL literal notation.
+
+* Mon Nov 29 2010 Kouhei Sutou <kou@clear-code.com> - 0.4-1
+- use the latest MySQL.
+- new upstream release.
+
+* Sun Nov 21 2010 Kouhei Sutou <kou@clear-code.com> - 0.3-2
+- install user define function.
+
+* Fri Oct 29 2010 Kouhei Sutou <kou@clear-code.com> - 0.3-1
+- new upstream release.
+
+* Fri Oct 08 2010 Kouhei Sutou <kou@clear-code.com> - 0.2-2
+- specify target MySQL version.
+- use %{version}.
+
+* Wed Sep 29 2010 Kouhei Sutou <kou@clear-code.com> - 0.2-1
+- new upstream release.
+
+* Sun Sep 12 2010 Kouhei Sutou <kou@clear-code.com> - 0.1-3
+- require MySQL-client-community.
+
+* Fri Sep 10 2010 Kouhei Sutou <kou@clear-code.com> - 0.1-2
+- use MySQL-devel-community.
+
+* Fri Sep 03 2010 Kouhei Sutou <kou@clear-code.com> - 0.1-1
+- initial packaging for CentOS.
diff --git a/storage/mroonga/packages/rpm/centos/mysql55-mroonga.spec.in b/storage/mroonga/packages/rpm/centos/mysql55-mroonga.spec.in
new file mode 100644
index 00000000..8bd2ba54
--- /dev/null
+++ b/storage/mroonga/packages/rpm/centos/mysql55-mroonga.spec.in
@@ -0,0 +1,311 @@
+%{?scl:%scl_package mroonga}
+%{!?scl:%global pkg_name %{name}}
+%define _centos_ver %{?centos_ver:%{centos_ver}}%{!?centos_ver:5}
+
+%if %{_centos_ver} == 6
+%define mysql_version_default 5.5.52
+%define mysql_release_default 1
+%define mysql_dist_default el6
+%define mysql_download_base_url_default http://vault.centos.org/6.8/sclo/Source/rh/mysql55/
+%define mysql_spec_file_default mysql.spec
+%else
+%define mysql_version_default 5.5.45
+%define mysql_release_default 1
+%define mysql_dist_default el5
+%define mysql_download_base_url_default http://vault.centos.org/5.11/updates/SRPMS
+%define mysql_spec_file_default mysql.spec
+%endif
+
+%define _mysql_version %{?mysql_version:%{mysql_version}}%{!?mysql_version:%{mysql_version_default}}
+%define _mysql_release %{?mysql_release:%{mysql_release}}%{!?mysql_release:%{mysql_release_default}}
+%define _mysql_dist %{?mysql_dist:%{mysql_dist}}%{!?mysql_dist:%{mysql_dist_default}}
+%define _mysql_download_base_url %{?mysql_download_base_url:%{mysql_download_base_url}}%{!?mysql_download_base_url:%{mysql_download_base_url_default}}
+%define _mysql_spec_file %{?mysql_spec_file:%{mysql_spec_file}}%{!?mysql_spec_file:%{mysql_spec_file_default}}
+
+%define groonga_required_version @REQUIRED_GROONGA_VERSION@
+
+Name: %{?scl_prefix}mroonga
+Version: @VERSION@
+Release: 1%{?dist}
+Summary: A fast fulltext searchable storage engine for MySQL
+
+Group: Applications/Databases
+License: LGPLv2.1
+URL: http://mroonga.org/
+Source0: http://packages.groonga.org/source/mroonga/mroonga-%{version}.tar.gz
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u} -n)
+BuildRequires: groonga-devel >= %{groonga_required_version}
+BuildRequires: groonga-normalizer-mysql-devel
+BuildRequires: wget
+BuildRequires: which
+BuildRequires: mysql55-mysql-devel = %{_mysql_version}-%{_mysql_release}.%{_mysql_dist}
+BuildRequires: mysql55-build
+Requires: mysql55-mysql-server = %{_mysql_version}-%{_mysql_release}.%{_mysql_dist}
+Requires: mysql55-mysql = %{_mysql_version}-%{_mysql_release}.%{_mysql_dist}
+Requires: groonga-libs >= %{groonga_required_version}
+Requires: groonga-normalizer-mysql
+%{?scl:Requires: %scl_runtime}
+
+%description
+Mroonga is a fast fulltext searchable storage plugin for MySQL.
+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.1
+
+%description doc
+Documentation for Mroonga
+
+
+%prep
+%setup -q -n %{pkg_name}-%{version}
+
+mysql_full_version=%{_mysql_version}-%{_mysql_release}.%{_mysql_dist}
+srpm=mysql55-mysql-${mysql_full_version}.src.rpm
+if [ ! -f ../../SRPMS/$srpm ]; then
+ wget --continue -O ../../SRPMS/$srpm %{_mysql_download_base_url}/$srpm
+ rpm -Uvh ../../SRPMS/$srpm
+fi
+
+%build
+mysql_source=../mysql-%{_mysql_version}
+if [ ! -d ${mysql_source} ]; then
+ specs_dir=
+ MYSQL_RPMBUILD_TEST=no rpmbuild -bp \
+ --define 'runselftest 0' \
+ --define 'optflags -O0' \
+ ../../SPECS/%{_mysql_spec_file}
+fi
+%configure --disable-static --with-mysql-source=${mysql_source} \
+ --disable-fast-mutexes \
+ --with-mysql-config=`scl enable mysql55 'which mysql_config'` \
+ %{?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/ mysql-mroonga-doc/
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post
+mysql_command=`scl enable mysql55 'which mysql'`
+if $mysql_command -u root -e "quit" > /dev/null 2>&1; then
+ password_option=""
+else
+ password_option="-p"
+fi
+current_version=0
+version=`echo %{groonga_required_version} | sed -e 's/\.//g'`
+required_version=`expr $version`
+version=`$mysql_command -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
+install_sql=%{_datadir}/mroonga/install.sql
+uninstall_sql=%{_datadir}/mroonga/uninstall.sql
+
+if [ "$1" = 2 ] ; then
+ if [ $current_version -lt $required_version ]; then
+ command="$mysql_command -u root $password_option"
+ echo "run the following command after restarting MySQL server:";
+ echo " $command < ${uninstall_sql}"
+ echo " $command < ${install_sql}"
+ exit 0
+ else
+ command="$mysql_command -u root $password_option < ${uninstall_sql}"
+ echo $command
+ eval $command || \
+ (echo "run the following command to unregister Mroonga:"; \
+ echo " $command")
+ fi
+fi
+command="$mysql_command -u root $password_option < ${install_sql}"
+echo $command
+eval $command || \
+ (echo "run the following command to register Mroonga:"; \
+ echo " $command")
+
+%preun
+uninstall_sql=%{_datadir}/mroonga/uninstall.sql
+mysql_command=`scl enable mysql55 'which mysql'`
+if $mysql_command -u root -e "quit" > /dev/null 2>&1; then
+ password_option=""
+else
+ password_option="-p"
+fi
+if [ "$1" = 0 ]; then
+ command="$mysql_command -u root $password_option < ${uninstall_sql}"
+ echo $command
+ eval $command || \
+ (echo "run the following command to unregister Mroonga:"; \
+ echo " $command")
+fi
+
+%files
+%defattr(-,root,root,-)
+%{_libdir}/mysql/plugin/
+%{_datadir}/mroonga/*
+%{_datadir}/man/man1/*
+%{_datadir}/man/*/man1/*
+
+%files doc
+%defattr(-,root,root,-)
+%doc README COPYING
+%doc mysql-mroonga-doc/*
+
+%changelog
+* Thu Oct 12 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.07-1
+- new upstream release.
+
+* Tue Aug 29 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.06-1
+- new upstream release.
+
+* Sat Jul 29 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.05-1
+- new upstream release.
+
+* Thu Jun 29 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.04-1
+- new upstream release.
+
+* Mon May 29 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.03-1
+- new upstream release.
+
+* Sat Apr 29 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.02-1
+- new upstream release.
+
+* Wed Mar 29 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.01-1
+- new upstream release.
+
+* Thu Feb 09 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.00-1
+- new upstream release.
+
+* Fri Jan 13 2017 Kouhei Sutou <kou@clear-code.com> - 6.13-1
+- new upstream release.
+
+* Thu Dec 29 2016 Kentaro Hayashi <hayashi@clear-code.com> - 6.12-1
+- new upstream release.
+
+* Tue Nov 29 2016 Kentaro Hayashi <hayashi@clear-code.com> - 6.11-1
+- new upstream release.
+
+* Sat Oct 29 2016 Kentaro Hayashi <hayashi@clear-code.com> - 6.10-1
+- new upstream release.
+
+* Thu Sep 29 2016 Kentaro Hayashi <hayashi@clear-code.com> - 6.09-1
+- new upstream release.
+
+* Mon Aug 29 2016 Kentaro Hayashi <hayashi@clear-code.com> - 6.08-1
+- new upstream release.
+
+* Fri Jul 29 2016 Kentaro Hayashi <hayashi@clear-code.com> - 6.07-1
+- new upstream release.
+
+* Thu Jun 30 2016 Masafumi Yokoyama <yokoyama@clear-code.com> - 6.06-1
+- new upstream release.
+
+* Wed Jun 29 2016 Kentaro Hayashi <hayashi@clear-code.com> - 6.05-1
+- new upstream release.
+
+* Sun May 29 2016 Kentaro Hayashi <hayashi@clear-code.com> - 6.03-1
+- new upstream release.
+
+* Fri Apr 29 2016 HAYASHI Kentaro <hayashi@clear-code.com> - 6.02-1
+- new upstream release.
+
+* Tue Mar 29 2016 Masafumi Yokoyama <yokoyama@clear-code.com> - 6.01-1
+- new upstream release.
+
+* Mon Feb 29 2016 Kouhei Sutou <kou@clear-code.com> - 6.00-1
+- new upstream release.
+
+* Fri Jan 29 2016 Kouhei Sutou <kou@clear-code.com> - 5.12-1
+- new upstream release.
+
+* Sun Nov 29 2015 Kouhei Sutou <kou@clear-code.com> - 5.10-1
+- new upstream release.
+
+* Thu Oct 29 2015 Kouhei Sutou <kou@cozmixng.org> - 5.09-1
+- new upstream release.
+
+* Tue Sep 29 2015 Kouhei Sutou <kou@clear-code.com> - 5.08-1
+- new upstream release.
+
+* Mon Aug 31 2015 Kouhei Sutou <kou@clear-code.com> - 5.06-1
+- new upstream release.
+
+* Wed Jul 29 2015 Masafumi Yokoyama <yokoyama@clear-code.com> - 5.05-1
+- new upstream release.
+
+* Mon Jun 29 2015 Masafumi Yokoyama <myokoym@gmail.com> - 5.04-1
+- new upstream release.
+
+* Fri May 29 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 5.03-1
+- new upstream release.
+
+* Wed Apr 29 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 5.02-1
+- new upstream release.
+
+* Sun Mar 29 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 5.01-1
+- new upstream release.
+
+* Mon Feb 09 2015 <hayashi@clear-code.com> - 5.00-1
+- new upstream release.
+
+* Thu Jan 29 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 4.10-1
+- new upstream release.
+
+* Mon Dec 29 2014 Kouhei Sutou <kou@cozmixng.org> - 4.09-1
+- new upstream release.
+
+* Sat Nov 29 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 4.08-1
+- new upstream release.
+
+* Wed Oct 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.07-1
+- new upstream release.
+
+* Mon Sep 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.06-1
+- new upstream release.
+
+* Fri Aug 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.05-1
+- new upstream release.
+
+* Tue Jul 29 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 4.04-1
+- new upstream release.
+
+* Thu May 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.03-2
+- build against MySQL 5.6.37. Reported by YOSHIDA Mitsuo. Thanks!!!
+
+* Thu May 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.03-1
+- new upstream release.
+
+* Tue Apr 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.02-1
+- new upstream release.
+
+* Sat Mar 29 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 4.01-1
+- new upstream release.
+
+* Thu Mar 06 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 4.00-2
+- use MySQL 5.5.36 on CentOS 5.
+
+* Sun Feb 09 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 4.00-1
+- new upstream release.
+
+* Wed Jan 29 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 3.12-1
+- new upstream release.
+
+* Sun Dec 29 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.11-1
+- new upstream release.
+
+* Fri Nov 29 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.10-1
+- new upstream release.
+
+* Tue Oct 29 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.09-1
+- initial packaging for MySQL 5.5 on CentOS 5.
diff --git a/storage/mroonga/packages/rpm/centos/mysql56-community-mroonga.spec.in b/storage/mroonga/packages/rpm/centos/mysql56-community-mroonga.spec.in
new file mode 100644
index 00000000..dea7cebc
--- /dev/null
+++ b/storage/mroonga/packages/rpm/centos/mysql56-community-mroonga.spec.in
@@ -0,0 +1,374 @@
+%define _centos_ver %{?centos_ver:%{centos_ver}}%{!?centos_ver:5}
+
+%if %{_centos_ver} == 7
+%define mysql_version_default 5.6.37
+%define mysql_release_default 2
+%define mysql_dist_default el7
+%define mysql_download_base_url_default http://repo.mysql.com/yum/mysql-5.6-community/el/7/SRPMS
+%define mysql_spec_file_default mysql.spec
+%else
+%define mysql_version_default 5.6.37
+%define mysql_release_default 2
+%define mysql_dist_default el6
+%define mysql_download_base_url_default http://repo.mysql.com/yum/mysql-5.6-community/el/6/SRPMS
+%define mysql_spec_file_default mysql.spec
+%endif
+
+%define _mysql_version %{?mysql_version:%{mysql_version}}%{!?mysql_version:%{mysql_version_default}}
+%define _mysql_release %{?mysql_release:%{mysql_release}}%{!?mysql_release:%{mysql_release_default}}
+%define _mysql_dist %{?mysql_dist:%{mysql_dist}}%{!?mysql_dist:%{mysql_dist_default}}
+%define _mysql_download_base_url %{?mysql_download_base_url:%{mysql_download_base_url}}%{!?mysql_download_base_url:%{mysql_download_base_url_default}}
+%define _mysql_spec_file %{?mysql_spec_file:%{mysql_spec_file}}%{!?mysql_spec_file:%{mysql_spec_file_default}}
+
+%define groonga_required_version @REQUIRED_GROONGA_VERSION@
+
+Name: mysql-community-mroonga
+Version: @VERSION@
+Release: 1%{?dist}
+Summary: A fast fulltext searchable storage engine for MySQL
+
+Group: Applications/Databases
+License: LGPLv2.1
+URL: http://mroonga.org/
+Source0: http://packages.groonga.org/source/mroonga/mroonga-%{version}.tar.gz
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u} -n)
+BuildRequires: groonga-devel >= %{groonga_required_version}
+BuildRequires: groonga-normalizer-mysql-devel
+BuildRequires: wget
+BuildRequires: which
+BuildRequires: gcc, gcc-c++
+BuildRequires: numactl-devel
+BuildRequires: mysql-community-devel = %{_mysql_version}-%{_mysql_release}.%{_mysql_dist}
+Requires: mysql-community-server = %{_mysql_version}-%{_mysql_release}.%{_mysql_dist}
+Requires: mysql-community-client = %{_mysql_version}-%{_mysql_release}.%{_mysql_dist}
+Requires: groonga-libs >= %{groonga_required_version}
+Requires: groonga-normalizer-mysql
+
+%description
+Mroonga is a fast fulltext searchable storage plugin for MySQL.
+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.1
+
+%description doc
+Documentation for Mroonga
+
+
+%prep
+%setup -q -n mroonga-%{version}
+
+mysql_full_version=%{_mysql_version}-%{_mysql_release}.%{_mysql_dist}
+srpm=mysql-community-${mysql_full_version}.src.rpm
+if [ ! -f ../../SRPMS/$srpm ]; then
+ wget --continue -O ../../SRPMS/$srpm %{_mysql_download_base_url}/$srpm
+ rpm -Uvh ../../SRPMS/$srpm
+fi
+
+%build
+mysql_source=../mysql-%{_mysql_version}/mysql-%{_mysql_version}
+if [ ! -d ${mysql_source} ]; then
+ specs_dir=
+ MYSQL_RPMBUILD_TEST=no rpmbuild -bp \
+ --define 'runselftest 0' \
+ --define 'optflags -O0' \
+ ../../SPECS/%{_mysql_spec_file}
+fi
+%configure \
+ --disable-static \
+ --with-mysql-source=${mysql_source} \
+ --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/ mysql-mroonga-doc/
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post
+if ! /sbin/service mysqld status > /dev/null; then
+ /sbin/service mysqld start
+ stop_after_installation=1
+else
+ stop_after_installation=0
+fi
+
+mysql_command=`which mysql`
+if $mysql_command -u root -e "quit" > /dev/null 2>&1; then
+ password_option=""
+else
+ password_option="-p"
+fi
+current_version=0
+version=`echo %{groonga_required_version} | sed -e 's/\.//g'`
+required_version=`expr $version`
+version=`$mysql_command -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
+install_sql=%{_datadir}/mroonga/install.sql
+uninstall_sql=%{_datadir}/mroonga/uninstall.sql
+
+if [ "$1" = 2 ] ; then
+ if [ $current_version -lt $required_version ]; then
+ command="$mysql_command -u root $password_option"
+ echo "run the following command after restarting MySQL server:";
+ echo " $command < ${uninstall_sql}"
+ echo " $command < ${install_sql}"
+ exit 0
+ else
+ command="$mysql_command -u root $password_option < ${uninstall_sql}"
+ echo $command
+ eval $command || \
+ (echo "run the following command to unregister Mroonga:"; \
+ echo " $command")
+ fi
+fi
+command="$mysql_command -u root $password_option < ${install_sql}"
+echo $command
+eval $command || \
+ (echo "run the following command to register Mroonga:"; \
+ echo " $command")
+
+if [ "$stop_after_installation" = "1" ]; then
+ /sbin/service mysqld stop
+fi
+
+%preun
+if ! /sbin/service mysqld status > /dev/null; then
+ /sbin/service mysqld start
+ stop_after_uninstallation=1
+else
+ stop_after_uninstallation=0
+fi
+
+uninstall_sql=%{_datadir}/mroonga/uninstall.sql
+mysql_command=`which mysql`
+if $mysql_command -u root -e "quit" > /dev/null 2>&1; then
+ password_option=""
+else
+ password_option="-p"
+fi
+if [ "$1" = 0 ]; then
+ command="$mysql_command -u root $password_option < ${uninstall_sql}"
+ echo $command
+ eval $command || \
+ (echo "run the following command to unregister Mroonga:"; \
+ echo " $command")
+fi
+
+if [ "$stop_after_uninstallation" = "1" ]; then
+ /sbin/service mysqld stop
+fi
+
+%files
+%defattr(-,root,root,-)
+%{_libdir}/mysql/plugin/
+%{_datadir}/mroonga/*
+%{_datadir}/man/man1/*
+%{_datadir}/man/*/man1/*
+
+%files doc
+%defattr(-,root,root,-)
+%doc README COPYING
+%doc mysql-mroonga-doc/*
+
+%changelog
+* Thu Oct 12 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.07-1
+- new upstream release.
+
+* Tue Aug 29 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.06-1
+- new upstream release.
+
+* Wed Aug 23 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.05-2
+- build against MySQL 5.6.37 on CentOS 7. Reported by Hiroshi Kagami. Thanks!!!
+
+* Sat Jul 29 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.05-1
+- new upstream release.
+
+* Fri Jul 21 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.04-2
+- build against MySQL 5.6.37 on CentOS 6. Reported by Hiroshi Kagami. Thanks!!!
+
+* Thu Jun 29 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.04-1
+- new upstream release.
+
+* Mon May 29 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.03-1
+- new upstream release.
+
+* Sat Apr 29 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.02-1
+- new upstream release.
+
+* Wed Apr 12 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.01-2
+- build against MySQL 5.6.36 Reported by @tigersun2000. Thanks!!!
+
+* Wed Mar 29 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.01-1
+- new upstream release.
+
+* Thu Feb 09 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.00-1
+- new upstream release.
+
+* Fri Jan 13 2017 Kouhei Sutou <kou@clear-code.com> - 6.13-1
+- new upstream release.
+
+* Thu Dec 29 2016 Kentaro Hayashi <hayashi@clear-code.com> - 6.12-1
+- new upstream release.
+
+* Tue Nov 29 2016 Kentaro Hayashi <hayashi@clear-code.com> - 6.11-1
+- new upstream release.
+
+* Sat Oct 29 2016 Kentaro Hayashi <hayashi@clear-code.com> - 6.10-1
+- new upstream release.
+
+* Mon Oct 24 2016 Kouhei Sutou <kou@clear-code.com> - 6.09-2
+- build against MySQL 5.6.34. Reported by Hiroshi Kagami. Thanks!!!
+
+* Thu Sep 29 2016 Kentaro Hayashi <hayashi@clear-code.com> - 6.09-1
+- new upstream release.
+
+* Wed Sep 14 2016 Kentaro Hayashi <hayashi@clear-code.com> - 6.08-2
+- build against MySQL 5.6.33.
+
+* Mon Aug 29 2016 Kentaro Hayashi <hayashi@clear-code.com> - 6.08-1
+- new upstream release.
+
+* Fri Jul 29 2016 Kentaro Hayashi <hayashi@clear-code.com> - 6.07-1
+- new upstream release.
+
+* Thu Jun 30 2016 Masafumi Yokoyama <yokoyama@clear-code.com> - 6.06-1
+- new upstream release.
+
+* Wed Jun 29 2016 Kentaro Hayashi <hayashi@clear-code.com> - 6.05-1
+- new upstream release.
+
+* Mon Jun 06 2016 Kouhei Sutou <kou@clear-code.com> - 6.03-2
+- build against MySQL 5.6.30.
+
+* Sun May 29 2016 Kentaro Hayashi <hayashi@clear-code.com> - 6.03-1
+- new upstream release.
+
+* Fri Apr 29 2016 HAYASHI Kentaro <hayashi@clear-code.com> - 6.02-1
+- new upstream release.
+
+* Tue Mar 29 2016 Masafumi Yokoyama <yokoyama@clear-code.com> - 6.01-1
+- new upstream release.
+
+* Mon Feb 29 2016 Kouhei Sutou <kou@clear-code.com> - 6.00-1
+- new upstream release.
+
+* Fri Jan 29 2016 Kouhei Sutou <kou@clear-code.com> - 5.12-1
+- new upstream release.
+
+* Tue Dec 29 2015 Kouhei Sutou <kou@clear-code.com> - 5.11-1
+- new upstream release.
+
+* Wed Dec 09 2015 Kouhei Sutou <kou@clear-code.com> - 5.10-2
+- build against MySQL 5.6.28. Reported by @stealthinu. Thanks!!!
+
+* Sun Nov 29 2015 Kouhei Sutou <kou@clear-code.com> - 5.10-1
+- new upstream release.
+
+* Thu Oct 29 2015 Kouhei Sutou <kou@cozmixng.org> - 5.09-1
+- new upstream release.
+
+* Sat Oct 03 2015 Kouhei Sutou <kou@clear-code.com> - 5.08-2
+- build against MySQL 5.6.27. Reported by @star_orihime. Thanks!!!
+
+* Tue Sep 29 2015 Kouhei Sutou <kou@clear-code.com> - 5.08-1
+- new upstream release.
+
+* Mon Aug 31 2015 Kouhei Sutou <kou@clear-code.com> - 5.06-1
+- new upstream release.
+
+* Wed Jul 29 2015 Masafumi Yokoyama <yokoyama@clear-code.com> - 5.05-1
+- new upstream release.
+
+* Mon Jun 29 2015 Masafumi Yokoyama <myokoym@gmail.com> - 5.04-1
+- new upstream release.
+
+* Tue Jun 02 2015 Masafumi Yokoyama <yokoyama@clear-code.com> - 5.03-2
+- build against MySQL 5.6.25.
+
+* Fri May 29 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 5.03-1
+- new upstream release.
+
+* Wed Apr 29 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 5.02-1
+- new upstream release.
+
+* Fri Apr 10 2015 Kouhei Sutou <kou@clear-code.com> - 5.01-2
+- build against MySQL 5.6.24.
+
+* Sun Mar 29 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 5.01-1
+- new upstream release.
+
+* Mon Feb 09 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 5.00-1
+- new upstream release.
+
+* Wed Feb 04 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 4.10-2
+- build against MySQL 5.6.23-2 on MySQL yum repository.
+
+* Thu Jan 29 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 4.10-1
+- new upstream release.
+
+* Mon Dec 29 2014 Kouhei Sutou <kou@cozmixng.org> - 4.09-1
+- new upstream release.
+
+* Sat Nov 29 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 4.08-1
+- new upstream release.
+
+* Wed Oct 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.07-1
+- new upstream release.
+
+* Mon Sep 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.06-1
+- new upstream release.
+
+* Sat Sep 27 2014 Eiichi Sato <miko@cafelounge.net> - 4.05-2
+- build against MySQL 5.6.21-2 on MySQL yum repository.
+
+* Fri Aug 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.05-1
+- new upstream release.
+
+* Sat Aug 09 2014 Eiichi Sato <miko@cafelounge.net> - 4.04-2
+- build against MySQL 5.6.20-4 on MySQL yum repository.
+
+* Tue Jul 29 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 4.04-1
+- new upstream release.
+
+* Thu May 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.03-2
+- build against MySQL 5.6.37. Reported by YOSHIDA Mitsuo. Thanks!!!
+
+* Thu May 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.03-1
+- new upstream release.
+
+* Tue Apr 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.02-1
+- new upstream release.
+
+* Sat Mar 29 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 4.01-1
+- new upstream release.
+
+* Thu Mar 06 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 4.00-2
+- use MySQL 5.5.36 on CentOS 5.
+
+* Sun Feb 09 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 4.00-1
+- new upstream release.
+
+* Wed Jan 29 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 3.12-1
+- new upstream release.
+
+* Sun Dec 29 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.11-1
+- new upstream release.
+
+* Fri Nov 29 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.10-1
+- new upstream release.
+
+* Tue Oct 29 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.09-1
+- initial packaging for MySQL 5.5 on CentOS 5.
diff --git a/storage/mroonga/packages/rpm/centos/percona-server-56-mroonga.spec.in b/storage/mroonga/packages/rpm/centos/percona-server-56-mroonga.spec.in
new file mode 100644
index 00000000..abf3bfde
--- /dev/null
+++ b/storage/mroonga/packages/rpm/centos/percona-server-56-mroonga.spec.in
@@ -0,0 +1,273 @@
+%define _centos_ver %{?centos_ver:%{centos_ver}}%{!?centos_ver:5}
+
+%define mysql_version_default 5.6.37
+%define mysql_release_default rel82.2
+%define mysql_dist_default %{?dist}
+%define mysql_download_base_url_default http://repo.percona.com/centos/%{_centos_ver}/SRPMS
+%define mysql_spec_file_default percona-server.spec
+
+%define _mysql_version %{?mysql_version:%{mysql_version}}%{!?mysql_version:%{mysql_version_default}}
+%define _mysql_release %{?mysql_release:%{mysql_release}}%{!?mysql_release:%{mysql_release_default}}
+%define _mysql_dist %{?mysql_dist:%{mysql_dist}}%{!?mysql_dist:%{mysql_dist_default}}
+%define _mysql_download_base_url %{?mysql_download_base_url:%{mysql_download_base_url}}%{!?mysql_download_base_url:%{mysql_download_base_url_default}}
+%define _mysql_spec_file %{?mysql_spec_file:%{mysql_spec_file}}%{!?mysql_spec_file:%{mysql_spec_file_default}}
+
+%define groonga_required_version @REQUIRED_GROONGA_VERSION@
+
+Name: percona-server-56-mroonga
+Version: @VERSION@
+Release: 1%{?dist}
+Summary: A fast fulltext searchable storage engine for MySQL
+
+Group: Applications/Databases
+License: LGPLv2.1
+URL: http://mroonga.org/
+Source0: http://packages.groonga.org/source/mroonga/mroonga-%{version}.tar.gz
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u} -n)
+BuildRequires: groonga-devel >= %{groonga_required_version}
+BuildRequires: groonga-normalizer-mysql-devel
+BuildRequires: wget
+BuildRequires: which
+BuildRequires: gcc
+BuildRequires: gcc-c++
+BuildRequires: Percona-Server-devel-56 = %{_mysql_version}-%{_mysql_release}%{_mysql_dist}
+BuildRequires: selinux-policy-devel
+Requires: Percona-Server-server-56 = %{_mysql_version}-%{_mysql_release}%{_mysql_dist}
+Requires: Percona-Server-client-56 = %{_mysql_version}-%{_mysql_release}%{_mysql_dist}
+Requires: groonga-libs >= %{groonga_required_version}
+Requires: groonga-normalizer-mysql
+
+%description
+Mroonga is a fast fulltext searchable storage plugin for MySQL.
+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.1
+
+%description doc
+Documentation for Mroonga
+
+
+%prep
+%setup -q -n mroonga-%{version}
+
+mysql_full_version=%{_mysql_version}-%{_mysql_release}.generic
+srpm=Percona-Server-56-${mysql_full_version}.src.rpm
+if [ ! -f ../../SRPMS/$srpm ]; then
+ wget --continue -O ../../SRPMS/$srpm %{_mysql_download_base_url}/$srpm
+ rpm -Uvh ../../SRPMS/$srpm
+fi
+
+%build
+mysql_source=../percona-server-%{_mysql_version}-$(echo %{_mysql_release} | sed -e 's/rel//')
+if [ ! -d ${mysql_source} ]; then
+ specs_dir=
+ rpmbuild -bp \
+ --define 'runselftest 0' \
+ --define 'optflags -O0' \
+ ../../SPECS/%{_mysql_spec_file}
+fi
+%configure \
+ --disable-static \
+ --with-mysql-source=${mysql_source} \
+ --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/ mysql-mroonga-doc/
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post
+if ! /sbin/service mysql status > /dev/null; then
+ /sbin/service mysql start
+ stop_after_installation=1
+else
+ stop_after_installation=0
+fi
+
+mysql_command=`which mysql`
+password_option=""
+
+if $mysql_command -u root -e "quit" > /dev/null 2>&1; then
+ password_option=""
+else
+ password_option="-p"
+fi
+current_version=0
+version=`echo %{groonga_required_version} | sed -e 's/\.//g'`
+required_version=`expr $version`
+version=`$mysql_command -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
+install_sql=%{_datadir}/mroonga/install.sql
+uninstall_sql=%{_datadir}/mroonga/uninstall.sql
+
+if [ "$1" = 2 ] ; then
+ if [ $current_version -lt $required_version ]; then
+ command="$mysql_command -u root $password_option"
+ echo "run the following command after restarting MySQL server:";
+ echo " $command < ${uninstall_sql}"
+ echo " $command < ${install_sql}"
+ exit 0
+ else
+ command="$mysql_command -u root $password_option < ${uninstall_sql}"
+ echo $command
+ eval $command || \
+ (echo "run the following command to unregister Mroonga:"; \
+ echo " $command")
+ fi
+fi
+command="$mysql_command -u root $password_option < ${install_sql}"
+echo $command
+eval $command || \
+ (echo "run the following command to register Mroonga:"; \
+ echo " $command")
+
+if [ "$stop_after_installation" = "1" ]; then
+ /sbin/service mysql stop
+fi
+
+%preun
+if ! /sbin/service mysql status > /dev/null; then
+ /sbin/service mysql start
+ stop_after_uninstallation=1
+else
+ stop_after_uninstallation=0
+fi
+
+uninstall_sql=%{_datadir}/mroonga/uninstall.sql
+mysql_command=`which mysql`
+if $mysql_command -u root -e "quit" > /dev/null 2>&1; then
+ password_option=""
+else
+ password_option="-p"
+fi
+if [ "$1" = 0 ]; then
+ command="$mysql_command -u root $password_option < ${uninstall_sql}"
+ echo $command
+ eval $command || \
+ (echo "run the following command to unregister Mroonga:"; \
+ echo " $command")
+fi
+
+if [ "$stop_after_uninstallation" = "1" ]; then
+ /sbin/service mysql stop
+fi
+
+%files
+%defattr(-,root,root,-)
+%{_libdir}/mysql/plugin/
+%{_datadir}/mroonga/*
+%{_datadir}/man/man1/*
+%{_datadir}/man/*/man1/*
+
+%files doc
+%defattr(-,root,root,-)
+%doc README COPYING
+%doc mysql-mroonga-doc/*
+
+%changelog
+* Thu Oct 12 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.07-1
+- new upstream release.
+
+* Tue Aug 29 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.06-1
+- new upstream release.
+
+* Mon Aug 14 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.05-2
+- build against Percona Server 5.6.36rel82.1 Reported by @tigersun2000_twitter. Thanks!!!
+
+* Sat Jul 29 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.05-1
+- new upstream release.
+
+* Thu Jun 29 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.04-1
+- new upstream release.
+
+* Mon May 29 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.03-1
+- new upstream release.
+
+* Thu May 17 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.02-2
+- build against Percona Server 5.6.36. Reported by @pinpikokun. Thanks!!!
+
+* Sat Apr 29 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.02-1
+- new upstream release.
+
+* Wed Mar 29 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.01-1
+- new upstream release.
+
+* Thu Feb 09 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.00-1
+- new upstream release.
+
+* Fri Jan 13 2017 Kouhei Sutou <kou@clear-code.com> - 6.13-1
+- new upstream release.
+
+* Thu Dec 29 2016 Kentaro Hayashi <hayashi@clear-code.com> - 6.12-1
+- new upstream release.
+
+* Tue Nov 29 2016 Kentaro Hayashi <hayashi@clear-code.com> - 6.11-1
+- new upstream release.
+
+* Sat Oct 29 2016 Kentaro Hayashi <hayashi@clear-code.com> - 6.10-1
+- new upstream release.
+
+* Mon Oct 24 2016 Kouhei Sutou <kou@clear-code.com> - 6.09-2
+- build against Percona Server 5.6.33. Reported by Hiroshi Kagami. Thanks!!!
+
+* Thu Sep 29 2016 Kentaro Hayashi <hayashi@clear-code.com> - 6.09-1
+- new upstream release.
+
+* Mon Aug 29 2016 Kentaro Hayashi <hayashi@clear-code.com> - 6.08-1
+- new upstream release.
+
+* Fri Jul 29 2016 Kentaro Hayashi <hayashi@clear-code.com> - 6.07-1
+- new upstream release.
+
+* Thu Jun 30 2016 Masafumi Yokoyama <yokoyama@clear-code.com> - 6.06-1
+- new upstream release.
+
+* Wed Jun 29 2016 Kentaro Hayashi <hayashi@clear-code.com> - 6.05-1
+- new upstream release.
+
+* Sun May 29 2016 Kentaro Hayashi <hayashi@clear-code.com> - 6.03-1
+- new upstream release.
+
+* Fri Apr 29 2016 HAYASHI Kentaro <hayashi@clear-code.com> - 6.02-1
+- new upstream release.
+
+* Tue Mar 29 2016 Masafumi Yokoyama <yokoyama@clear-code.com> - 6.01-1
+- new upstream release.
+
+* Mon Feb 29 2016 Kouhei Sutou <kou@clear-code.com> - 6.00-1
+- new upstream release.
+
+* Fri Jan 29 2016 Kouhei Sutou <kou@clear-code.com> - 5.12-1
+- new upstream release.
+
+* Tue Dec 29 2015 Kouhei Sutou <kou@clear-code.com> - 5.11-1
+- new upstream release.
+
+* Sun Nov 29 2015 Kouhei Sutou <kou@clear-code.com> - 5.10-1
+- new upstream release.
+
+* Thu Oct 29 2015 Kouhei Sutou <kou@cozmixng.org> - 5.09-1
+- new upstream release.
+
+* Tue Sep 29 2015 Kouhei Sutou <kou@clear-code.com> - 5.08-1
+- new upstream release.
+
+* Mon Aug 31 2015 Kouhei Sutou <kou@clear-code.com> - 5.06-1
+- new upstream release.
+
+* Tue Mar 17 2015 Kouhei Sutou <kou@clear-code.com> - 5.00-1
+- initial release.
diff --git a/storage/mroonga/packages/source/Makefile.am b/storage/mroonga/packages/source/Makefile.am
new file mode 100644
index 00000000..efd09777
--- /dev/null
+++ b/storage/mroonga/packages/source/Makefile.am
@@ -0,0 +1,125 @@
+MROONGA_BASE = $(PACKAGE)-$(VERSION)
+MROONGA_TAR_GZ = $(MROONGA_BASE).tar.gz
+
+GROONGA_VERSION = 7.0.7
+GROONGA_BASE = groonga-$(GROONGA_VERSION)
+GROONGA_TAR_GZ = $(GROONGA_BASE).tar.gz
+
+GROONGA_NORMALIZER_MYSQL_VERSION = 1.1.1
+GROONGA_NORMALIZER_MYSQL_BASE = \
+ groonga-normalizer-mysql-$(GROONGA_NORMALIZER_MYSQL_VERSION)
+GROONGA_NORMALIZER_MYSQL_TAR_GZ = \
+ $(GROONGA_NORMALIZER_MYSQL_BASE).tar.gz
+
+MARIADB_VERSION = 10.1.28
+MARIADB_BASE = mariadb-$(MARIADB_VERSION)
+MARIADB_TAR_GZ = $(MARIADB_BASE).tar.gz
+
+MARIADB_WITH_MROONGA_BASE = $(MARIADB_BASE)-with-$(MROONGA_BASE)
+MARIADB_WITH_MROONGA_FOR_WINDOWS_BASE = $(MARIADB_WITH_MROONGA_BASE)-for-windows
+
+GROONGA_PROJECT_DOWNLOAD_BASE = http://packages.groonga.org/source
+GROONGA_DOWNLOAD_BASE = $(GROONGA_PROJECT_DOWNLOAD_BASE)/groonga
+GROONGA_NORMALIZER_MYSQL_DOWNLOAD_BASE = \
+ $(GROONGA_PROJECT_DOWNLOAD_BASE)/groonga-normalizer-mysql
+MARIADB_DOWNLOAD_BASE = http://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb
+
+
+CURL = curl --fail --silent --show-error
+
+all:
+
+release: download archive upload
+
+ensure-rsync-path:
+ @if test -z "$(RSYNC_PATH)"; then \
+ echo "--with-rsync-path configure option must be specified."; \
+ false; \
+ fi
+
+download: ensure-rsync-path
+ rsync -avz --progress --delete $(RSYNC_PATH)/source/mroonga/ files
+
+ARCHIVES = \
+ files/$(MROONGA_TAR_GZ) \
+ files/$(MARIADB_WITH_MROONGA_BASE).tar.gz \
+ files/$(MARIADB_WITH_MROONGA_FOR_WINDOWS_BASE).zip
+
+archive: $(ARCHIVES)
+
+upload: ensure-rsync-path
+ rsync -avz --progress --delete files/ $(RSYNC_PATH)/source/mroonga
+
+files/$(MROONGA_TAR_GZ): $(top_builddir)/$(MROONGA_TAR_GZ)
+ mkdir -p files
+ cp -p $< $@
+
+tmp/$(GROONGA_TAR_GZ):
+ mkdir -p tmp
+ $(CURL) --output $@ $(GROONGA_DOWNLOAD_BASE)/$(GROONGA_TAR_GZ)
+
+tmp/$(GROONGA_NORMALIZER_MYSQL_TAR_GZ):
+ mkdir -p tmp
+ $(CURL) --output $@ $(GROONGA_NORMALIZER_MYSQL_DOWNLOAD_BASE)/$(GROONGA_NORMALIZER_MYSQL_TAR_GZ)
+
+tmp/$(MARIADB_TAR_GZ):
+ mkdir -p tmp
+ $(CURL) --output $@ $(MARIADB_DOWNLOAD_BASE)/mariadb-$(MARIADB_VERSION)/source/$(MARIADB_TAR_GZ)
+
+MARIADB_WITH_MROONGA_ARCHIVES = \
+ tmp/$(GROONGA_TAR_GZ) \
+ tmp/$(GROONGA_NORMALIZER_MYSQL_TAR_GZ) \
+ tmp/$(MARIADB_TAR_GZ) \
+ $(top_builddir)/$(MROONGA_TAR_GZ)
+
+BUNDLED_MROONGA_PATH = $(MARIADB_BASE)/storage/$(PACKAGE)
+BUNDLED_GROONGA_PATH = $(BUNDLED_MROONGA_PATH)/vendor/groonga
+BUNDLED_GROONGA_NORMALIZER_MYSQL_PATH = \
+ $(BUNDLED_GROONGA_PATH)/vendor/plugins/groonga-normalizer-mysql
+
+tmp/$(MARIADB_WITH_MROONGA_BASE).stamp: $(MARIADB_WITH_MROONGA_ARCHIVES)
+ rm -rf $(MARIADB_BASE)
+ tar xf tmp/$(MARIADB_TAR_GZ)
+
+ rm -fr $(MARIADB_BASE)/storage/mroonga
+ tar xf $(top_builddir)/$(MROONGA_TAR_GZ)
+ mv $(MROONGA_BASE) $(BUNDLED_MROONGA_PATH)
+
+ mkdir -p $$(dirname $(BUNDLED_GROONGA_PATH))
+ tar xf tmp/$(GROONGA_TAR_GZ)
+ rm -rf $(GROONGA_BASE)/test
+ cd $(GROONGA_BASE)/vendor && ruby download_mecab.rb
+ cd $(GROONGA_BASE)/vendor && ruby download_lz4.rb
+ mv $(GROONGA_BASE) $(BUNDLED_GROONGA_PATH)
+
+ tar xf tmp/$(GROONGA_NORMALIZER_MYSQL_TAR_GZ)
+ rm -rf $(GROONGA_NORMALIZER_MYSQL_BASE)/test
+ mv $(GROONGA_NORMALIZER_MYSQL_BASE) $(BUNDLED_GROONGA_NORMALIZER_MYSQL_PATH)
+
+ rm -rf tmp/$(MARIADB_WITH_MROONGA_BASE)
+ mv $(MARIADB_BASE) tmp/$(MARIADB_WITH_MROONGA_BASE)
+
+ touch $@
+
+files/$(MARIADB_WITH_MROONGA_BASE).tar.gz: tmp/$(MARIADB_WITH_MROONGA_BASE).stamp
+ mkdir -p files/
+ (cd tmp && tar czf ../$@ $(MARIADB_WITH_MROONGA_BASE))
+
+PATCHES = \
+ patches/mariadb-10.0.3-windows-build.diff
+
+tmp/$(MARIADB_WITH_MROONGA_FOR_WINDOWS_BASE).stamp: tmp/$(MARIADB_WITH_MROONGA_BASE).stamp $(PATCHES)
+ rm -rf tmp/$(MARIADB_WITH_MROONGA_FOR_WINDOWS_BASE)
+ cp -a \
+ tmp/$(MARIADB_WITH_MROONGA_BASE) \
+ tmp/$(MARIADB_WITH_MROONGA_FOR_WINDOWS_BASE)
+ for patch in $(PATCHES); do \
+ (cd tmp/$(MARIADB_WITH_MROONGA_FOR_WINDOWS_BASE) && \
+ patch -p1 < $(abs_srcdir)/$${patch}); \
+ done
+
+ touch $@
+
+files/$(MARIADB_WITH_MROONGA_FOR_WINDOWS_BASE).zip: tmp/$(MARIADB_WITH_MROONGA_FOR_WINDOWS_BASE).stamp
+ mkdir -p files/
+ (cd tmp && zip -q -r ../$@ $(MARIADB_WITH_MROONGA_FOR_WINDOWS_BASE))
diff --git a/storage/mroonga/packages/source/patches/mariadb-10.0.3-windows-build.diff b/storage/mroonga/packages/source/patches/mariadb-10.0.3-windows-build.diff
new file mode 100644
index 00000000..c135088b
--- /dev/null
+++ b/storage/mroonga/packages/source/patches/mariadb-10.0.3-windows-build.diff
@@ -0,0 +1,9 @@
+diff -ur mariadb-10.0.2.orig/sql/sql_locale.cc mariadb-10.0.2/sql/sql_locale.cc
+--- mariadb-10.0.2.orig/sql/sql_locale.cc 2013-04-23 13:13:59.000000000 +0900
++++ mariadb-10.0.2/sql/sql_locale.cc 2013-05-19 12:55:27.590366542 +0900
+@@ -1,4 +1,4 @@
+-/* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
++/* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
diff --git a/storage/mroonga/packages/ubuntu/Makefile.am b/storage/mroonga/packages/ubuntu/Makefile.am
new file mode 100644
index 00000000..7241391b
--- /dev/null
+++ b/storage/mroonga/packages/ubuntu/Makefile.am
@@ -0,0 +1,57 @@
+CODE_NAMES = trusty,xenial,zesty
+SOURCE = ../$(PACKAGE)-$(VERSION).tar.gz
+SOURCE_55_BASE = $(PACKAGE)-5.5
+SOURCE_55 = $(SOURCE_55_BASE)_$(VERSION).orig.tar.gz
+SOURCE_56_BASE = $(PACKAGE)-5.6
+SOURCE_56 = $(SOURCE_56_BASE)_$(VERSION).orig.tar.gz
+SOURCE_57_BASE = $(PACKAGE)-5.7
+SOURCE_57 = $(SOURCE_57_BASE)_$(VERSION).orig.tar.gz
+SOURCE_MARIADB_10_0_BASE = $(PACKAGE)-mariadb-10.0
+SOURCE_MARIADB_10_0 = $(SOURCE_MARIADB_10_0_BASE)_$(VERSION).orig.tar.gz
+
+all:
+
+ensure-launchpad-configuration:
+ @if test -z "$(LAUNCHPAD_UPLOADER_PGP_KEY)"; then \
+ echo "--with-launchpad-uploader-pgp-key configure option must be specified."; \
+ false; \
+ fi
+
+upload: source ensure-launchpad-configuration
+ ./upload.rb \
+ --package '$(PACKAGE)' \
+ --version '$(VERSION)' \
+ --source-archive-directory '$(builddir)/' \
+ --code-names '$(CODE_NAMES)' \
+ --debian-base-directory '$(srcdir)/../' \
+ --ppa '$(LAUNCHPAD_PPA)' \
+ --pgp-sign-key '$(LAUNCHPAD_UPLOADER_PGP_KEY)'
+
+source: $(SOURCE_55) $(SOURCE_56) $(SOURCE_57) $(SOURCE_MARIADB_10_0)
+
+$(SOURCE):
+ ln -s $(abs_top_builddir)/$(PACKAGE)-$(VERSION).tar.gz $(SOURCE)
+
+$(SOURCE_55): $(SOURCE)
+ tar xf $(SOURCE)
+ mv $(PACKAGE)-$(VERSION) $(SOURCE_55_BASE)-$(VERSION)
+ tar cfz $(SOURCE_55) $(SOURCE_55_BASE)-$(VERSION)
+ rm -r $(SOURCE_55_BASE)-$(VERSION)
+
+$(SOURCE_56): $(SOURCE)
+ tar xf $(SOURCE)
+ mv $(PACKAGE)-$(VERSION) $(SOURCE_56_BASE)-$(VERSION)
+ tar cfz $(SOURCE_56) $(SOURCE_56_BASE)-$(VERSION)
+ rm -r $(SOURCE_56_BASE)-$(VERSION)
+
+$(SOURCE_57): $(SOURCE)
+ tar xf $(SOURCE)
+ mv $(PACKAGE)-$(VERSION) $(SOURCE_57_BASE)-$(VERSION)
+ tar cfz $(SOURCE_57) $(SOURCE_57_BASE)-$(VERSION)
+ rm -r $(SOURCE_57_BASE)-$(VERSION)
+
+$(SOURCE_MARIADB_10_0): $(SOURCE)
+ tar xf $(SOURCE)
+ mv $(PACKAGE)-$(VERSION) $(SOURCE_MARIADB_10_0_BASE)-$(VERSION)
+ tar cfz $(SOURCE_MARIADB_10_0) $(SOURCE_MARIADB_10_0_BASE)-$(VERSION)
+ rm -r $(SOURCE_MARIADB_10_0_BASE)-$(VERSION)
diff --git a/storage/mroonga/packages/ubuntu/upload.rb b/storage/mroonga/packages/ubuntu/upload.rb
new file mode 100755
index 00000000..c8ca8aa5
--- /dev/null
+++ b/storage/mroonga/packages/ubuntu/upload.rb
@@ -0,0 +1,247 @@
+#!/usr/bin/env ruby
+#
+# Copyright(C) 2014-2016 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2014 HAYASHI Kentaro <hayashi@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1 as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
+
+require "optparse"
+require "fileutils"
+require "pathname"
+require "open-uri"
+
+class Uploader
+ def initialize
+ @dput_configuration_name = "groonga-ppa"
+ @use_pbuilder = false
+ end
+
+ def run
+ ensure_dput_configuration
+
+ parse_command_line!
+
+ ensure_mysql_version
+
+ @required_groonga_version = required_groonga_version
+
+ @code_names.each do |code_name|
+ mysql55_version = @mysql55_versions[code_name]
+ mysql56_version = @mysql56_versions[code_name]
+ mysql57_version = @mysql57_versions[code_name]
+ mariadb10_0_version = @mariadb10_0_versions[code_name]
+ if mysql55_version
+ upload(code_name, "5.5", mysql55_version)
+ end
+ if mysql56_version
+ upload(code_name, "5.6", mysql56_version)
+ end
+ if mysql57_version
+ upload(code_name, "5.7", mysql57_version)
+ end
+ if mariadb10_0_version
+ upload(code_name, "mariadb-10.0", mariadb10_0_version)
+ end
+ end
+ end
+
+ private
+ def ensure_dput_configuration
+ dput_cf_path = Pathname.new("~/.dput.cf").expand_path
+ if dput_cf_path.exist?
+ dput_cf_content = dput_cf_path.read
+ else
+ dput_cf_content = ""
+ end
+ dput_cf_content.each_line do |line|
+ return if line.chomp == "[#{@dput_configuration_name}]"
+ end
+
+ dput_cf_path.open("w") do |dput_cf|
+ dput_cf.puts(dput_cf_content)
+ dput_cf.puts(<<-CONFIGURATION)
+[#{@dput_configuration_name}]
+fqdn = ppa.launchpad.net
+method = ftp
+incoming = ~groonga/ppa/ubuntu/
+login = anonymous
+allow_unsigned_uploads = 0
+ CONFIGURATION
+ end
+ end
+
+ def ensure_mysql_version
+ @mysql_versions = {}
+ @mysql55_versions = {}
+ @mysql56_versions = {}
+ @mysql57_versions = {}
+ @mariadb10_0_versions = {}
+ @code_names.each do |code_name|
+ source_names = [code_name, "#{code_name}-updates"]
+ source_names.each do |source_name|
+ allpackages_url =
+ "http://packages.ubuntu.com/#{source_name}/allpackages?format=txt.gz"
+ open(allpackages_url) do |file|
+ file.each_line do |line|
+ case line
+ when /\Amysql-server \((.+?)[\s)]/
+ @mysql_versions[code_name] = $1
+ when /\Amysql-server-5\.5 \((.+?)[\s)]/
+ @mysql55_versions[code_name] = $1
+ when /\Amysql-server-5\.6 \((.+?)[\s)]/
+ @mysql56_versions[code_name] = $1
+ when /\Amysql-server-5\.7 \((.+?)[\s)]/
+ @mysql57_versions[code_name] = $1
+ when /\Amariadb-server-10\.0 \((.+?)[\s)]/
+ @mariadb10_0_versions[code_name] = $1
+ end
+ end
+ end
+ end
+ end
+ end
+
+ def parse_command_line!
+ parser = OptionParser.new
+ parser.on("--package=NAME",
+ "The package name") do |name|
+ @package = name
+ end
+ parser.on("--version=VERSION",
+ "The version") do |version|
+ @version = version
+ end
+ parser.on("--source-archive-directory=DIRECTORY",
+ "The directory that has source archives") do |directory|
+ @source_archive_directory = Pathname.new(directory).expand_path
+ end
+ parser.on("--code-names=CODE_NAME1,CODE_NAME2,CODE_NAME3,...", Array,
+ "The target code names") do |code_names|
+ @code_names = code_names
+ end
+ parser.on("--debian-base-directory=DIRECTORY",
+ "The directory that has debianXX/ directory") do |directory|
+ @debian_base_directory = Pathname.new(directory).expand_path
+ end
+ parser.on("--ppa=PPA",
+ "The personal package archive name (groonga-ppa or groonga-nightly") do |ppa|
+ @dput_configuration_name = ppa
+ end
+ parser.on("--pgp-sign-key=KEY",
+ "The PGP key to sign .changes and .dsc") do |pgp_sign_key|
+ @pgp_sign_key = pgp_sign_key
+ end
+ parser.on("--[no-]pbuilder",
+ "Use pbuilder for build check") do |use_pbuilder|
+ @use_pbuilder = use_pbuilder
+ end
+
+ parser.parse!
+ end
+
+ def upload(code_name, mysql_short_version, mysql_version)
+ default_mysql_version = (@mysql_versions[code_name] == mysql_version)
+ deb_package_name = "#{@package}-#{mysql_short_version}"
+ in_temporary_directory do
+ source_archive =
+ @source_archive_directory + "#{deb_package_name}_#{@version}.orig.tar.gz"
+ run_command("tar", "xf", source_archive.to_s)
+ directory_name = "#{deb_package_name}-#{@version}"
+ Dir.chdir(directory_name) do
+ debian_directory =
+ @debian_base_directory + "debian-#{mysql_short_version}"
+ FileUtils.cp_r(debian_directory.to_s, "debian")
+ deb_version = "#{current_deb_version.succ}~#{code_name}1"
+ run_command("dch",
+ "--distribution", code_name,
+ "--newversion", deb_version,
+ "Build for #{code_name}.")
+ remove_versionless_mroonga = true
+ if default_mysql_version or mysql_short_version.start_with?("mariadb-")
+ remove_versionless_mroonga = false
+ end
+ if remove_versionless_mroonga
+ control_content = File.read("debian/control")
+ File.open("debian/control", "w") do |control|
+ in_mysql_server_mroonga = false
+ control_content.each_line do |line|
+ case line.chomp
+ when ""
+ if in_mysql_server_mroonga
+ in_mysql_server_mroonga = false
+ else
+ control.print(line)
+ end
+ when "Package: mysql-server-mroonga"
+ in_mysql_server_mroonga = true
+ else
+ next if in_mysql_server_mroonga
+ control.print(line)
+ end
+ end
+ end
+ end
+ run_command("sed",
+ "-i", "-e",
+ "s,MYSQL_VERSION\\|MARIADB_VERSION,#{mysql_version},",
+ "debian/control")
+ run_command("debuild",
+ "--no-lintian",
+ # Workaround for Launchpad. Launchpad doesn't accept
+ # .buildinfo yet.
+ # See also: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=853795
+ "--buildinfo-option=-O",
+ "-d",
+ "-S",
+ "-sa",
+ "-pgpg2",
+ "-k#{@pgp_sign_key}")
+ if @use_pbuilder
+ run_command("pbuilder-dist", code_name, "build",
+ "../#{deb_package_name}_#{deb_version}.dsc")
+ else
+ run_command("dput", @dput_configuration_name,
+ "../#{deb_package_name}_#{deb_version}_source.changes")
+ end
+ end
+ end
+ end
+
+ def required_groonga_version
+ File.read("../../required_groonga_version").lines.first.chomp
+ end
+
+ def current_deb_version
+ /\((.+)\)/ =~ File.read("debian/changelog").lines.first
+ $1
+ end
+
+ def in_temporary_directory
+ name = "tmp"
+ FileUtils.rm_rf(name)
+ FileUtils.mkdir_p(name)
+ Dir.chdir(name) do
+ yield
+ end
+ end
+
+ def run_command(*command_line)
+ unless system(*command_line)
+ raise "failed to run command: #{command_line.join(' ')}"
+ end
+ end
+end
+
+uploader = Uploader.new
+uploader.run
diff --git a/storage/mroonga/packages/windows/Makefile.am b/storage/mroonga/packages/windows/Makefile.am
new file mode 100644
index 00000000..240c3873
--- /dev/null
+++ b/storage/mroonga/packages/windows/Makefile.am
@@ -0,0 +1,12 @@
+EXTRA_DIST = \
+ README.md \
+ build-vc2015.bat \
+ build-vc2015-zip-32.bat \
+ build-vc2015-zip-64.bat \
+ build-vc2015-msi-32.bat \
+ build-vc2015-msi-64.bat \
+ build-vc2017.bat \
+ build-vc2017-zip-32.bat \
+ build-vc2017-zip-64.bat \
+ build-vc2017-msi-32.bat \
+ build-vc2017-msi-64.bat
diff --git a/storage/mroonga/packages/windows/README.md b/storage/mroonga/packages/windows/README.md
new file mode 100644
index 00000000..8737f262
--- /dev/null
+++ b/storage/mroonga/packages/windows/README.md
@@ -0,0 +1,21 @@
+# How to build Windows binaries
+
+## Preparation
+
+TODO...
+
+## Build with Visual C++ Express
+
+You need to use Visual Studio 2015 for Windows Desktop or later to build Mroonga with express
+edition. `build-vc2015.bat` is a build batch script to build with
+Visual Studio 2015 for Windows Desktop.
+
+Note that you can't build MSI file with Express edition. You need to
+use Professional edition or upper editions to build MSI file.
+
+## Build with Visual Studio Community
+
+You can build both zip file MSI file with Professional edition.
+But now, this feature is temporary disabled.
+If you want to create MSI package, please uncomment in `build-vc2015.bat`.
+And then, you can build MSI package with Visual Studio 2015 Community.
diff --git a/storage/mroonga/packages/windows/build-vc2015-msi-32.bat b/storage/mroonga/packages/windows/build-vc2015-msi-32.bat
new file mode 100644
index 00000000..69d803e8
--- /dev/null
+++ b/storage/mroonga/packages/windows/build-vc2015-msi-32.bat
@@ -0,0 +1,8 @@
+rmdir /S /Q build-vc2015-msi-32
+mkdir build-vc2015-msi-32
+cd build-vc2015-msi-32
+cmake ..\source -G "Visual Studio 14 2015" > config.log
+cmake --build . --config RelWithDebInfo > build.log
+cmake --build . --config RelWithDebInfo --target msi > msi.log
+move *.msi ..\
+cd ..
diff --git a/storage/mroonga/packages/windows/build-vc2015-msi-64.bat b/storage/mroonga/packages/windows/build-vc2015-msi-64.bat
new file mode 100644
index 00000000..a3d6681b
--- /dev/null
+++ b/storage/mroonga/packages/windows/build-vc2015-msi-64.bat
@@ -0,0 +1,8 @@
+rmdir /S /Q build-vc2015-msi-64
+mkdir build-vc2015-msi-64
+cd build-vc2015-msi-64
+cmake ..\source -G "Visual Studio 14 2015 Win64" > config.log
+cmake --build . --config RelWithDebInfo > build.log
+cmake --build . --config RelWithDebInfo --target msi > msi.log
+move *.msi ..\
+cd ..
diff --git a/storage/mroonga/packages/windows/build-vc2015-zip-32.bat b/storage/mroonga/packages/windows/build-vc2015-zip-32.bat
new file mode 100644
index 00000000..8247fd54
--- /dev/null
+++ b/storage/mroonga/packages/windows/build-vc2015-zip-32.bat
@@ -0,0 +1,13 @@
+rmdir /S /Q build-vc2015-zip-32
+mkdir build-vc2015-zip-32
+cd build-vc2015-zip-32
+cmake ..\source -G "Visual Studio 14 2015" ^
+ -DMRN_GROONGA_EMBED=OFF ^
+ -DMRN_GROONGA_NORMALIZER_MYSQL_EMBED=OFF ^
+ -DGRN_WITH_BUNDLED_LZ4=ON ^
+ -DGRN_WITH_BUNDLED_MECAB=ON ^
+ > config.log
+cmake --build . --config RelWithDebInfo > build.log
+cmake --build . --config RelWithDebInfo --target package > zip.log
+move *.zip ..\
+cd ..
diff --git a/storage/mroonga/packages/windows/build-vc2015-zip-64.bat b/storage/mroonga/packages/windows/build-vc2015-zip-64.bat
new file mode 100644
index 00000000..b56d80eb
--- /dev/null
+++ b/storage/mroonga/packages/windows/build-vc2015-zip-64.bat
@@ -0,0 +1,13 @@
+rmdir /S /Q build-vc2015-zip-64
+mkdir build-vc2015-zip-64
+cd build-vc2015-zip-64
+cmake ..\source -G "Visual Studio 14 2015 Win64" ^
+ -DMRN_GROONGA_EMBED=OFF ^
+ -DMRN_GROONGA_NORMALIZER_MYSQL_EMBED=OFF ^
+ -DGRN_WITH_BUNDLED_LZ4=ON ^
+ -DGRN_WITH_BUNDLED_MECAB=ON ^
+ > config.log
+cmake --build . --config RelWithDebInfo > build.log
+cmake --build . --config RelWithDebInfo --target package > zip.log
+move *.zip ..\
+cd ..
diff --git a/storage/mroonga/packages/windows/build-vc2015.bat b/storage/mroonga/packages/windows/build-vc2015.bat
new file mode 100644
index 00000000..729f181d
--- /dev/null
+++ b/storage/mroonga/packages/windows/build-vc2015.bat
@@ -0,0 +1,4 @@
+call build-vc2015-zip-32.bat
+call build-vc2015-zip-64.bat
+REM build-vc2015-msi-32.bat
+REM build-vc2015--msi-64.bat
diff --git a/storage/mroonga/packages/yum/Makefile.am b/storage/mroonga/packages/yum/Makefile.am
new file mode 100644
index 00000000..9d1bd606
--- /dev/null
+++ b/storage/mroonga/packages/yum/Makefile.am
@@ -0,0 +1,77 @@
+REPOSITORIES_PATH = repositories
+DISTRIBUTIONS = centos
+ARCHITECTURES = i386 x86_64
+MYSQL_VARIANTS = \
+ mysql55 \
+ mysql56-community \
+ mysql57-community \
+ mariadb \
+ mariadb-10.1 \
+ mariadb-10.2 \
+ percona-server-56 \
+ percona-server-57
+CENTOS_VERSIONS = 6 7
+SPEC_DIR = $(builddir)/../rpm/centos
+
+all:
+
+release: download build sign-packages update-repository upload
+
+remove-existing-packages:
+ for distribution in $(DISTRIBUTIONS); do \
+ find $${distribution} -name "*.rpm" -delete; \
+ done
+
+ensure-rsync-path:
+ @if test -z "$(RSYNC_PATH)"; then \
+ echo "--with-rsync-path configure option must be specified."; \
+ false; \
+ fi
+
+sign-packages:
+ ./sign-rpm.sh '$(GPG_UID)' '$(REPOSITORIES_PATH)/' '$(DISTRIBUTIONS)'
+
+update-repository:
+ ./update-repository.sh '$(REPOSITORIES_PATH)/' '$(DISTRIBUTIONS)'
+
+upload: ensure-rsync-path
+ for distribution in $(DISTRIBUTIONS); do \
+ rsync -avz --progress --delete --exclude .gitignore \
+ $(REPOSITORIES_PATH)/$${distribution}/ \
+ $(RSYNC_PATH)/$${distribution}; \
+ done
+
+download: ensure-rsync-path
+ mkdir -p $(REPOSITORIES_PATH)
+ for distribution in $(DISTRIBUTIONS); do \
+ rsync -avz --progress --delete \
+ $(RSYNC_PATH)/$${distribution}/ \
+ $(REPOSITORIES_PATH)/$${distribution}; \
+ done
+
+build: build-in-vm
+
+build-in-vm: source specs env.sh
+ ./build-in-vm.sh \
+ "$(PACKAGE)" \
+ "$(SPEC_DIR)" \
+ "$(MYSQL_VARIANTS)" \
+ "$(ARCHITECTURES)" \
+ "$(CENTOS_VERSIONS)"
+
+source: tmp/$(PACKAGE)-$(VERSION).tar.gz
+
+tmp/$(PACKAGE)-$(VERSION).tar.gz: $(abs_top_builddir)/$(PACKAGE)-$(VERSION).tar.gz
+ mkdir -p tmp/
+ cp $(abs_top_builddir)/$(PACKAGE)-$(VERSION).tar.gz tmp/
+
+$(abs_top_builddir)/$(PACKAGE)-$(VERSION).tar.gz:
+ cd $(abs_top_builddir) && $(MAKE) dist
+
+specs: $(SPEC_DIR)/mysql55-$(PACKAGE).spec
+specs: $(SPEC_DIR)/mysql56-community-$(PACKAGE).spec
+specs: $(SPEC_DIR)/mariadb-$(PACKAGE).spec
+specs: $(SPEC_DIR)/mariadb-10.1-$(PACKAGE).spec
+specs: $(SPEC_DIR)/mariadb-10.2-$(PACKAGE).spec
+specs: $(SPEC_DIR)/percona-server-56-$(PACKAGE).spec
+specs: $(SPEC_DIR)/percona-server-57-$(PACKAGE).spec
diff --git a/storage/mroonga/packages/yum/Vagrantfile b/storage/mroonga/packages/yum/Vagrantfile
new file mode 100644
index 00000000..af14bc9a
--- /dev/null
+++ b/storage/mroonga/packages/yum/Vagrantfile
@@ -0,0 +1,42 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
+VAGRANTFILE_API_VERSION = "2"
+
+Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
+ vms = [
+ {
+ :id => "centos-6-i386",
+ :box => "bento/centos-6.9-i386",
+ },
+ {
+ :id => "centos-6-x86_64",
+ :box => "bento/centos-6.9",
+ },
+ {
+ :id => "centos-7-x86_64",
+ :box => "bento/centos-7.4",
+ },
+ ]
+
+ vms.each do |vm|
+ config.vm.define(vm[:id]) do |node|
+ node.vm.box = vm[:box]
+ node.vm.provision(:shell, :path => "build-rpm.sh")
+ node.vm.provider("virtualbox") do |virtual_box|
+ system_n_cpus = 1
+ if File.exist?("/proc/cpuinfo")
+ system_n_cpus = File.readlines("/proc/cpuinfo").grep(/^processor/).size
+ end
+ if system_n_cpus > 1
+ vm_n_cpus = system_n_cpus / 2
+ else
+ vm_n_cpus = 1
+ end
+ virtual_box.cpus = vm_n_cpus
+ virtual_box.memory = (ENV["VM_MEMORY"] || 1024).to_i
+ end
+ end
+ end
+end
diff --git a/storage/mroonga/packages/yum/build-in-vm.sh b/storage/mroonga/packages/yum/build-in-vm.sh
new file mode 100755
index 00000000..fc84e450
--- /dev/null
+++ b/storage/mroonga/packages/yum/build-in-vm.sh
@@ -0,0 +1,85 @@
+#!/bin/sh
+
+if [ $# != 5 ]; then
+ echo "Usage: $0 PACKAGE SPEC_DIR MYSQL_VARIANTS ARCHITECTURES"
+ echo " e.g.: $0 mroonga ../rpm/centos 'mysql55 mariadb' 'i386 x86_64' '6 7'"
+ exit 1
+fi
+
+PACKAGE="$1"
+SPEC_DIR="$2"
+MYSQL_VARIANTS="$3"
+ARCHITECTURES="$4"
+CENTOS_VERSIONS="$5"
+
+run()
+{
+ "$@"
+ if test $? -ne 0; then
+ echo "Failed $@"
+ exit 1
+ fi
+}
+
+run vagrant destroy --force
+
+for mysql_variant in ${MYSQL_VARIANTS}; do
+ rm -rf tmp/centos/
+ mkdir -p tmp/centos/
+ cp ${SPEC_DIR}/${mysql_variant}-${PACKAGE}.spec tmp/centos/
+
+ architectures="${ARCHITECTURES}"
+ case ${mysql_variant} in
+ mysql55)
+ centos_versions="6"
+ ;;
+ mysql56-community)
+ centos_versions="6 7"
+ ;;
+ mysql57-community)
+ centos_versions="6 7"
+ ;;
+ mariadb)
+ centos_versions="7"
+ ;;
+ mariadb-10.1)
+ centos_versions="6 7"
+ ;;
+ mariadb-10.2)
+ centos_versions="6 7"
+ ;;
+ percona-server-56)
+ centos_versions="6 7"
+ ;;
+ percona-server-57)
+ centos_versions="6 7"
+ ;;
+ esac
+
+ for architecture in ${architectures}; do
+ for centos_version in ${centos_versions}; do
+ skip=1
+ for given_version in ${CENTOS_VERSIONS}; do
+ if [ ${given_version} = ${centos_version} ]; then
+ skip=0
+ fi
+ done
+ if [ $skip -eq 1 ]; then
+ continue
+ fi
+ if [ ${mysql_variant} = mysql55 -a ${centos_version} = 6 -a ${architecture} = i386 ]; then
+ continue
+ fi
+ if [ ${centos_version} = 7 -a ${architecture} = i386 ]; then
+ continue
+ fi
+ id=centos-${centos_version}-${architecture}
+ vagrant up ${id}
+ build_status=$?
+ if [ $build_status -ne 0 ]; then
+ exit $build_status
+ fi
+ vagrant destroy --force ${id}
+ done
+ done
+done
diff --git a/storage/mroonga/packages/yum/build-rpm.sh b/storage/mroonga/packages/yum/build-rpm.sh
new file mode 100755
index 00000000..6ba943ae
--- /dev/null
+++ b/storage/mroonga/packages/yum/build-rpm.sh
@@ -0,0 +1,182 @@
+#!/bin/sh
+
+LANG=C
+
+run()
+{
+ "$@"
+ if test $? -ne 0; then
+ echo "Failed $@"
+ exit 1
+ fi
+}
+
+rpmbuild_options=
+
+. /vagrant/env.sh
+
+distribution=$(cut -d " " -f 1 /etc/redhat-release | tr "A-Z" "a-z")
+if grep -q Linux /etc/redhat-release; then
+ distribution_version=$(cut -d " " -f 4 /etc/redhat-release)
+else
+ distribution_version=$(cut -d " " -f 3 /etc/redhat-release)
+fi
+distribution_version=$(echo ${distribution_version} | sed -e 's/\..*$//g')
+
+architecture="$(arch)"
+case "${architecture}" in
+ i*86)
+ architecture=i386
+ ;;
+esac
+
+run yum groupinstall -y "Development Tools"
+run yum install -y rpm-build rpmdevtools tar wget
+
+if [ -x /usr/bin/rpmdev-setuptree ]; then
+ rm -rf .rpmmacros
+ run rpmdev-setuptree
+else
+ run cat <<EOM > ~/.rpmmacros
+%_topdir ${HOME}/rpmbuild
+EOM
+ run mkdir -p ~/rpmbuild/SOURCES
+ run mkdir -p ~/rpmbuild/SPECS
+ run mkdir -p ~/rpmbuild/BUILD
+ run mkdir -p ~/rpmbuild/RPMS
+ run mkdir -p ~/rpmbuild/SRPMS
+fi
+
+repository="/vagrant/repositories/${distribution}/${distribution_version}"
+rpm_dir="${repository}/${architecture}/Packages"
+srpm_dir="${repository}/source/SRPMS"
+run mkdir -p "${rpm_dir}" "${srpm_dir}"
+
+rpmbuild_options=""
+
+# for debug
+# rpmbuild_options="${rpmbuild_options} --define 'optflags -O0 -g3'"
+
+cd
+
+run cp /vagrant/tmp/${PACKAGE}-${VERSION}.* rpmbuild/SOURCES/
+run cp /vagrant/tmp/${distribution}/*.spec rpmbuild/SPECS/
+
+package_name=$(cd rpmbuild/SPECS; echo *.spec | sed -e 's/\.spec$//g')
+
+case ${distribution} in
+ fedora)
+ USE_MYSQLSERVICES_COMPAT=yes
+ run yum install -y mariadb-devel
+ ;;
+ centos)
+ release_rpm=groonga-release-1.3.0-1.noarch.rpm
+ if [ ${distribution_version} = 5 ]; then
+ wget http://packages.groonga.org/${distribution}/${release_rpm}
+ run yum install -y --nogpgcheck ${release_rpm}
+ rm -f ${release_rpm}
+ else
+ run yum install -y \
+ http://packages.groonga.org/${distribution}/${release_rpm}
+ fi
+ run yum makecache
+
+ case ${package_name} in
+ mysql55-${PACKAGE})
+ USE_MYSQLSERVICES_COMPAT=yes
+ run yum install -y scl-utils-build
+ if [ ${distribution_version} = 6 ]; then
+ run yum install -y centos-release-scl
+ fi
+ run yum install -y mysql55-mysql-devel mysql55-build
+ ;;
+ mysql5?-community-${PACKAGE})
+ release_rpm=mysql-community-release-el${distribution_version}-7.noarch.rpm
+ run yum -y install http://repo.mysql.com/${release_rpm}
+ if [ "${package_name}" = "mysql57-community-${PACKAGE}" ]; then
+ run yum install -y yum-utils
+ run yum-config-manager --disable mysql56-community
+ run yum-config-manager --enable mysql57-community
+ if [ ${distribution_version} = 6 ]; then
+ run yum install -y cmake28
+ fi
+ fi
+ run yum install -y mysql-community-devel
+ ;;
+ mariadb-${PACKAGE})
+ run yum install -y mariadb-devel
+ ;;
+ mariadb-10.1-${PACKAGE})
+ if [ "${architecture}" = "x86_64" ]; then
+ mariadb_architecture="amd64"
+ else
+ mariadb_architecture="x86"
+ fi
+ cat <<REPO > /etc/yum.repos.d/MariaDB.repo
+[mariadb]
+name = MariaDB
+baseurl = http://yum.mariadb.org/10.1/${distribution}${distribution_version}-${mariadb_architecture}
+gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
+gpgcheck=1
+REPO
+ run yum install -y MariaDB-devel
+ if [ ${distribution_version} = 6 ]; then
+ run yum install -y cmake28
+ fi
+ ;;
+ mariadb-10.2-${PACKAGE})
+ if [ "${architecture}" = "x86_64" ]; then
+ mariadb_architecture="amd64"
+ else
+ mariadb_architecture="x86"
+ fi
+ cat <<REPO > /etc/yum.repos.d/MariaDB.repo
+[mariadb]
+name = MariaDB
+baseurl = http://yum.mariadb.org/10.2/${distribution}${distribution_version}-${mariadb_architecture}
+gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
+gpgcheck=1
+REPO
+ run yum install -y MariaDB-devel
+ if [ ${distribution_version} = 6 ]; then
+ run yum install -y cmake28
+ fi
+ ;;
+ percona-server-56-${PACKAGE})
+ release_rpm_version=0.1-4
+ release_rpm=percona-release-${release_rpm_version}.noarch.rpm
+ run yum install -y http://www.percona.com/downloads/percona-release/redhat/${release_rpm_version}/${release_rpm}
+ run yum install -y Percona-Server-devel-56
+ ;;
+ percona-server-57-${PACKAGE})
+ release_rpm_version=0.1-4
+ release_rpm=percona-release-${release_rpm_version}.noarch.rpm
+ run yum install -y http://www.percona.com/downloads/percona-release/redhat/${release_rpm_version}/${release_rpm}
+ run yum install -y Percona-Server-devel-57
+ if [ ${distribution_version} = 6 ]; then
+ run yum install -y cmake28
+ fi
+ ;;
+ esac
+ ;;
+esac
+run yum install -y ${DEPENDED_PACKAGES}
+
+if [ "${package_name}" = "percona-server-56-${PACKAGE}" ]; then
+ if [ "${distribution_version}" = "7" ]; then
+ rpmbuild_options="$rpmbuild_options --define 'dist .el7'"
+ fi
+fi
+if [ "${package_name}" = "percona-server-57-${PACKAGE}" ]; then
+ if [ "${distribution_version}" = "7" ]; then
+ rpmbuild_options="$rpmbuild_options --define 'dist .el7'"
+ fi
+fi
+if [ "${USE_MYSQLSERVICES_COMPAT}" = "yes" ]; then
+ rpmbuild_options="$rpmbuild_options --define 'mroonga_configure_options --with-libmysqlservices-compat'"
+fi
+
+run eval rpmbuild -ba ${rpmbuild_options} rpmbuild/SPECS/${package_name}.spec
+
+run mv rpmbuild/RPMS/*/* "${rpm_dir}/"
+run mv rpmbuild/SRPMS/* "${srpm_dir}/"
diff --git a/storage/mroonga/packages/yum/env.sh.in b/storage/mroonga/packages/yum/env.sh.in
new file mode 100644
index 00000000..3d327a17
--- /dev/null
+++ b/storage/mroonga/packages/yum/env.sh.in
@@ -0,0 +1,32 @@
+PACKAGE=@PACKAGE@
+VERSION=@VERSION@
+DEPENDED_PACKAGES="
+intltool
+libtool
+gcc
+gcc-c++
+make
+gperf
+readline-devel
+openssl-devel
+zlib-devel
+time
+wget
+ncurses-devel
+sudo
+pkgconfig
+tar
+cmake
+libaio-devel
+systemtap-sdt-devel
+perl-Time-HiRes
+perl-Env
+perl-Test-Simple
+pam-devel
+selinux-policy-devel
+numactl-devel
+groonga-devel
+groonga-normalizer-mysql-devel
+cyrus-sasl-devel
+openldap-devel
+"
diff --git a/storage/mroonga/packages/yum/sign-rpm.sh b/storage/mroonga/packages/yum/sign-rpm.sh
new file mode 100755
index 00000000..27ec5711
--- /dev/null
+++ b/storage/mroonga/packages/yum/sign-rpm.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+script_base_dir=`dirname $0`
+
+if [ $# != 3 ]; then
+ echo "Usage: $0 GPG_UID DESTINATION DISTRIBUTIONS"
+ echo " e.g.: $0 'F10399C0' repositories/ 'fedora centos'"
+ exit 1
+fi
+
+GPG_UID=$1
+DESTINATION=$2
+DISTRIBUTIONS=$3
+
+run()
+{
+ "$@"
+ if test $? -ne 0; then
+ echo "Failed $@"
+ exit 1
+ fi
+}
+
+unsigned_rpms()
+{
+ while read rpm; do
+ rpm --checksig "$rpm" | grep -v 'gpg OK' | grep -v 'MISSING KEYS' | cut -d":" -f1
+ done
+}
+
+if ! gpg --list-keys "${GPG_UID}" > /dev/null 2>&1; then
+ run gpg --keyserver keyserver.ubuntu.com --recv-key "${GPG_UID}"
+fi
+run mkdir -p tmp
+run gpg --armor --export "${GPG_UID}" > tmp/sign-key
+run rpm --import tmp/sign-key
+run rm -rf tmp/sign-key
+
+rpms=""
+for distribution in ${DISTRIBUTIONS}; do
+ rpms="${rpms} $(find ${DESTINATION}${distribution} -name '*.rpm' | unsigned_rpms)"
+done
+
+echo "NOTE: YOU JUST ENTER! YOU DON'T NEED TO INPUT PASSWORD!"
+echo " IT'S JUST FOR rpm COMMAND RESTRICTION!"
+run echo $rpms | xargs rpm \
+ -D "_gpg_name ${GPG_UID}" \
+ -D "_gpg_digest_algo sha1" \
+ -D "__gpg /usr/bin/gpg2" \
+ -D "__gpg_check_password_cmd /bin/true true" \
+ -D "__gpg_sign_cmd %{__gpg} gpg --batch --no-verbose --no-armor %{?_gpg_digest_algo:--digest-algo %{_gpg_digest_algo}} --no-secmem-warning -u \"%{_gpg_name}\" -sbo %{__signature_filename} %{__plaintext_filename}" \
+ --resign
diff --git a/storage/mroonga/packages/yum/update-repository.sh b/storage/mroonga/packages/yum/update-repository.sh
new file mode 100755
index 00000000..59eeafa5
--- /dev/null
+++ b/storage/mroonga/packages/yum/update-repository.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+script_base_dir=`dirname $0`
+
+if [ $# != 2 ]; then
+ echo "Usage: $0 DESTINATION DISTRIBUTIONS"
+ echo " e.g.: $0 repositories/ 'fedora centos'"
+ exit 1
+fi
+
+DESTINATION=$1
+DISTRIBUTIONS=$2
+
+run()
+{
+ "$@"
+ if test $? -ne 0; then
+ echo "Failed $@"
+ exit 1
+ fi
+}
+
+for distribution in ${DISTRIBUTIONS}; do
+ for dir in ${DESTINATION}${distribution}/*/*; do
+ test -d $dir && run createrepo $dir
+ done;
+done