[buildout]

parts =
  boinc

extends =
  ../curl/buildout.cfg
  ../openssl/buildout.cfg
  ../zlib/buildout.cfg
  ../subversion/buildout.cfg
  ../m4/buildout.cfg
  ../automake/buildout.cfg
  ../libtool/buildout.cfg
  ../pkgconfig/buildout.cfg
  ../openldap/buildout.cfg
  ../gnutls/buildout.cfg
  ../../stack/slapos.cfg

[download-boinc]
recipe = slapos.recipe.download
url = http://boinc.berkeley.edu/dl/boinc_7.0.28_x86_64-pc-linux-gnu.sh
md5sum = efdfd115ae69227ceb6118ca09777988
location = ${buildout:parts-directory}/${:_buildout_section_name_}
filename = boinc_7.0.28_x86_64-pc-linux-gnu.sh
mode = 0744

[boinc-bin]
recipe = plone.recipe.command
on_install = true
on_update = true
command = cp ${download-boinc:location}/${download-boinc:filename} ${buildout:parts-directory} && \
  cd ${buildout:parts-directory} && \
  ./${download-boinc:filename}
#boinc client is a binary: write LD_LABRARY_PATH
ld_library = ${curl:location}/lib:${openssl:location}/lib:${zlib:location}/lib
location = ${buildout:parts-directory}/BOINC

[boinc-patch]
recipe = slapos.recipe.download
url = ${:_profile_base_location_}/boinc-abs-path.patch
md5sum = 412acedfbcdc8a9a7f196a02465da248
location = ${buildout:parts-directory}/${:_buildout_section_name_}
filename = boinc-abs-path.patch


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

# Compile now boinc client
[boinc]
recipe = slapos.recipe.cmmi
url = ${boinc-package:tarball}
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-server
  --with-pkg-config
  --with-ssl=${openssl:location}
  --with-libldap=${openldap:location}/lib
  --with-libgnutls=${gnutls:location}/lib
  --with-libcurl=${curl:location}/lib
  --with-x=no

patches =
  ${boinc-patch:location}/${boinc-patch:filename}

patch-options = -p1

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