[buildout]
extends =
  ../autoconf/buildout.cfg
  ../automake/buildout.cfg
  ../bison/buildout.cfg
  ../cmake/buildout.cfg
  ../groonga/buildout.cfg
  ../libaio/buildout.cfg
  ../libtool/buildout.cfg
  ../ncurses/buildout.cfg
  ../pkgconfig/buildout.cfg
  ../zlib/buildout.cfg

parts =
    mysql-5.5

[mysql-5.5-sphinx-patch]
# this patch comes from sphinx-2.0.1-beta including changes for
# MySQL-5.5 in
# http://code.google.com/p/sphinxsearch/source/detail?r=2921
recipe = hexagonit.recipe.download
ignore-existing = true
url = ${:_profile_base_location_}/${:filename}
md5sum = 04549822ebfa91b5f84025ff49ef24c2
filename = mysql-5.5-sphinx-2.0.1-beta.diff
download-only = true

[mysql-5.5-no_test-patch]
recipe = hexagonit.recipe.download
ignore-existing = true
url = ${:_profile_base_location_}/${:filename}
md5sum = bb7ee34b9a98da1f913566c63ffbc6f5
filename = mysql_create_system_tables__no_test.patch
download-only = true

[mysql-5.5]
recipe = slapos.recipe.cmmi
version = 5.5.16
url = http://mysql.he.net/Downloads/MySQL-5.5/mysql-${:version}.tar.gz
md5sum = 462ab3752dd666ec06ca32f92673b59e
# compile directory is required to build mysql plugins.
keep-compile-dir = true
patch-options = -p0
patches =
  ${mysql-5.5-sphinx-patch:location}/${mysql-5.5-sphinx-patch:filename}
  ${mysql-5.5-no_test-patch:location}/${mysql-5.5-no_test-patch:filename}
configure-command = ${cmake:location}/bin/cmake
# we use embeded yassl instead of openssl to avoid compilation errors on sphinx search engine.
configure-options =
  -DCMAKE_INSTALL_PREFIX=${buildout:parts-directory}/${:_buildout_section_name_}
  -DBUILD_CONFIG=mysql_release
  -DDEFAULT_CHARSET=utf8
  -DDEFAULT_COLLATION=utf8_unicode_ci
  -DWITH_SSL=bundled
  -DWITH_ZLIB=system
  -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1
  -DWITHOUT_DAEMON_EXAMPLE=1
  -DWITH_SPHINX_STORAGE_ENGINE=1
  -DCMAKE_C_FLAGS="-I${libaio:location}/include -I${ncurses:location}/include -I${zlib:location}/include"
  -DCMAKE_INSTALL_RPATH=${libaio:location}/lib:${ncurses:location}/lib:${zlib:location}/lib
environment =
  CMAKE_PROGRAM_PATH=${autoconf:location}/bin:${automake:location}/bin:${cmake:location}/bin:${libtool:location}/bin:${bison:location}/bin:${flex:location}/bin
  CMAKE_INCLUDE_PATH=${libaio:location}/include:${ncurses:location}/include:${zlib:location}/include
  CMAKE_LIBRARY_PATH=${libaio:location}/lib:${ncurses:location}/lib:${zlib:location}/lib
  LDFLAGS=-L${libaio:location}/lib

[groonga-storage-engine-mysql-5.5]
recipe = slapos.recipe.cmmi
url = http://github.com/downloads/mroonga/mroonga/groonga-storage-engine-1.0.0.tar.gz
md5sum = 289b8b7919e790599ea79b6fe9270e04
configure-options =
  --with-mysql-source=${mysql-5.5:location}__compile__/mysql-${mysql-5.5:version}
  --with-mysql-config=${mysql-5.5:location}/bin/mysql_config
environment =
  PATH=${groonga:location}/bin:${pkgconfig:location}/bin:%(PATH)s
  CPPFLAGS=-I${groonga:location}/include/groonga
  LDFLAGS=-L${groonga:location}/lib
  PKG_CONFIG_PATH=${groonga:location}/lib/pkgconfig
