# This is software part of buildout for mysql with senna
# Originally made by Leonardo Rochael Almeida <leorochael@gmail.com> (thanks!)
# Original place: https://svn.erp5.org/repos/public/experimental/mysqlsenna.buildout/

[buildout]
extends =
  ../autoconf/buildout.cfg
  ../automake/buildout.cfg
  ../zlib/buildout.cfg
  ../bison/buildout.cfg
  ../flex/buildout.cfg
  ../libtool/buildout.cfg
  ../ncurses/buildout.cfg
  ../openssl/buildout.cfg
  ../readline/buildout.cfg

parts =
    mysql-tritonn-5.0

[senna]
recipe = slapos.recipe.cmmi
url = http://www.nexedi.org/static/tarballs/senna/senna-r1311.tar.gz
md5sum = 1cc51554789f81a9e5208da04a5c2f4c
configure-command =
  echo 'AC_CONFIG_MACRO_DIR([m4])' >> configure.ac
  echo 'ACLOCAL_AMFLAGS = -I m4' >> Makefile.am
  ACLOCAL_ARGS=-I${libtool:location}/share/aclocal ./autogen.sh
  ./configure
configure-options =
  --prefix=${buildout:parts-directory}/${:_buildout_section_name_}
  --without-mecab
  --disable-glibtest
make-options =
  LIBTOOL=libtool
environment =
  PATH=${autoconf:location}/bin:${automake:location}/bin:${libtool:location}/bin:%(PATH)s

[mysql-5.0-tritonn-patch]
recipe = hexagonit.recipe.download
ignore-existing = true
url = http://dl.sourceforge.jp/tritonn/44472/${:filename}
md5sum = 257abe9c4afdc9b08033687fd486a595
filename = tritonn-1.0.12-mysql-5.0.87.diff
download-only = true

[mysql-5.0-sphinx-patch]
recipe = hexagonit.recipe.download
ignore-existing = true
url = ${:_profile_base_location_}/${:filename}
md5sum = 4ca071cde319213a213ab3605e326d1c
filename = mysql-5.0.87-sphinx-1.10.diff
download-only = true

[mysql-tritonn-5.0]
recipe = slapos.recipe.cmmi
url = http://www.nexedi.org/static/tarballs/mysql/mysql-5.0.87.tar.gz
md5sum = 65e6229cc98b6a8d4c5206d7fe16c7be
# configure: how to avoid searching for my.cnf?
#  - like in mysql part in http://svn.zope.org/zodbshootout/trunk/buildout.cfg?view=markup
configure-command =
  libtoolize -c -f
  aclocal -I ${libtool:location}/share/aclocal -I config/ac-macros
  autoheader
  automake -c -a -f
  autoconf
  touch sql/sql_yacc.yy
  ./configure
configure-options =
  --prefix=${buildout:parts-directory}/${:_buildout_section_name_}
  --with-senna
  --with-openssl=${openssl:location}
  --without-mecab
  --enable-thread-safe-client
  --with-charset=utf8
  --with-collation=utf8_unicode_ci
  --with-server-suffix=mysql-tritonn-5.0
  --with-mysqlmanager
  --enable-assembler
  --without-readline
  --with-sphinx-storage-engine
  --with-zlib-dir=${zlib:location}

make-options =
  LIBTOOL=libtool
  LN_S='ln -s'

patch-options = -p1
patches =
  ${mysql-5.0-tritonn-patch:location}/${mysql-5.0-tritonn-patch:filename}
  ${mysql-5.0-sphinx-patch:location}/${mysql-5.0-sphinx-patch:filename}
environment =
    PATH=${senna:location}/bin:${autoconf:location}/bin:${automake:location}/bin:${libtool:location}/bin:${bison:location}/bin:${flex:location}/bin:%(PATH)s
    CPPFLAGS=-I${senna:location}/include/senna -I${ncurses:location}/include -I${readline5:location}/include
    LDFLAGS=-L${senna:location}/lib -L${readline5:location}/lib -L${ncurses:location}/lib -Wl,-rpath=${zlib:location}/lib -Wl,-rpath=${openssl:location}/lib -Wl,-rpath=${ncurses:location}/lib -Wl,-rpath=${readline5:location}/lib
