[buildout]

parts=
  mariadb
  boinc  

extends =
  ../subversion/buildout.cfg
  ../m4/buildout.cfg
  ../automake/buildout.cfg
  ../libtool/buildout.cfg
  ../pkgconfig/buildout.cfg
  ../openssl/buildout.cfg
  ../cyrus-sasl/buildout.cfg
  ../openldap/buildout.cfg
  ../gnutls/buildout.cfg
  ../mariadb/buildout.cfg
  ../curl/buildout.cfg
  ../../stack/slapos.cfg

[mariadb]
# Compile dir is for plugins, not needed in boinc
keep-compile-dir = false

#checkout boinc package from svn repository
[boinc-package]
recipe = plone.recipe.command
location = ${buildout:parts-directory}/${:_buildout_section_name_}
svnversion = ${subversion:location}/bin/svnversion
command = ${subversion:location}/bin/svn co http://boinc.berkeley.edu/svn/branches/server_stable ${:location} && \
  sed -i 's#/usr/bin/svnversion#${:svnversion}#' ${:location}/tools/make_project

# Compile now boinc
# When installing boinc python module, path /srv/slapgrid/... is strip to srv/slapgrid... It is why
# we need to set --prefix="/${buildout:parts-directory}/${:_buildout_section_name_}"
[boinc]
recipe = hexagonit.recipe.cmmi
url = ${boinc-package:location}
keep-compile-dir = true
source = ${buildout:parts-directory}/${:_buildout_section_name_}__compile__
configure-command =
  echo 'AC_PROG_OBJCXX' >> configure.ac
  aclocal -I${pkgconfig:location}/share/aclocal -I${libtool:location}/share/aclocal
  ./_autosetup
  ./configure
configure-options = 
  --prefix="/${buildout:parts-directory}/${:_buildout_section_name_}"
  --disable-fcgi
  --disable-shared
  --enable-static
  --with-pic
  --disable-manager
  --disable-client
  --with-pkg-config
  --with-ssl=${openssl:location}
  --with-libsasl2=${cyrus-sasl:location}/lib
  --with-libldap=${openldap:location}/lib
  --with-libgnutls=${gnutls:location}/lib
  --with-libcurl=${curl:location}/lib
  --with-x=no

environment =
  PATH=${pkgconfig:location}/bin:${automake:location}/bin:${autoconf:location}/bin:${libtool:location}/bin:${subversion:location}/bin:%(PATH)s
  PKG_CONFIG_PATH=${openssl:location}/lib/pkgconfig
  M4=${m4:location}/bin/m4
  CFLAGS=-fPIC
  CPPFLAGS=-I${openssl:location}/include -I${mariadb:location}/include
  LDFLAGS = -L${openssl:location}/lib -Wl,-rpath=${openssl:location}/lib -L${mariadb:location}/lib -Wl,-rpath=${mariadb:location}/lib -L${zlib:location}/lib -Wl,-rpath=${zlib:location}/lib
  MYSQL_CONFIG=${mariadb:location}/bin/mysql_config
  ACLOCAL_PATH=${pkgconfig:location}/share/aclocal:${libtool:location}/share/aclocal