[buildout]
develop =
  /srv/slapgrid/slappart9/srv/runner/project/slapos
  /opt/slapdev_build

extends =
  ../../component/rsync/buildout.cfg
  ../../component/apache-perl/buildout.cfg
  ../../component/perl-Crypt-SSLeay/buildout.cfg
  ../../component/perl-XML-Parser/buildout.cfg
  ../../component/perl-XML-LibXML/buildout.cfg
  ../../component/perl-XML-LibXSLT/buildout.cfg
  ../../component/perl-Term-ReadLine-Gnu/buildout.cfg
  ../../component/perl-Text-Iconv/buildout.cfg
  ../../component/perl-Image-Magick/buildout.cfg
  ../../component/postgresql/buildout.cfg
  ../../component/perl-DBD-Pg/buildout.cfg
  ../../component/perl-Search-Xapian/buildout.cfg
  ../../component/libxslt/buildout.cfg
  ../../component/dcron/buildout.cfg
  ../../component/dropbear/buildout.cfg
  ../../component/lxml-python/buildout.cfg
  ../../stack/slapos.cfg

parts = 
  eggs
  apache-perl
  perl-Apache2-Request
  perl-Crypt-SSLeay
  perl-DBD-Pg
  perl-XML-Parser
  perl-XML-LibXML
  perl-XML-LibXSLT
  perl-Term-ReadLine-Gnu
  perl-Text-Iconv
  perl-Image-Magick
  perl-String-Checker-mioga
  perl-Search-Xapian
  cpan-simple-modules
  rsync
  mioga
  template
  template-apacheperl
  template-postgres

[eggs]
recipe = zc.recipe.egg
eggs =
  ${lxml-python:egg}
  slapos.cookbook
  cns.recipe.symlink

# override perl here to keep using 5.14.x.
[perl]
recipe = hexagonit.recipe.cmmi
version = 5.14.2
url = http://www.cpan.org/src/5.0/perl-${:version}.tar.bz2
md5sum = 04a4c5d3c1f9f19d77daff8e8cd19a26
siteprefix = ${buildout:parts-directory}/site_${:_buildout_section_name_}
patch-options = -p1
patches =
  ${perl-keep-linker-flags-in-ldflags.patch:location}/${perl-keep-linker-flags-in-ldflags.patch:filename}
# Viktor has adapted the following commands for AMD64 compilation
# TODO: find out how we can write a generic code that suits all architectures
configure-command =
  sh Configure -des \
    -A ccflags=-fPIC \
    -Dprefix=${buildout:parts-directory}/${:_buildout_section_name_} \
    -Dsiteprefix=${:siteprefix} \
    -Dcflags=-I${gdbm:location}/include \
    -Dldflags="-L${gdbm:location}/lib -Wl,-rpath=${gdbm:location}/lib" \
    -Ui_db \
    -Dnoextensions=ODBM_File \
    -Dusethreads
environment =
  PATH=${patch:location}/bin:%(PATH)s
  CFLAGS='-m64 -mtune=nocona'
post-make-hook = ${perl-postmakehook-download:location}/${perl-postmakehook-download:filename}:post_make_hook

[cpan-simple-modules]
recipe = slapos.recipe.build:cpan
modules =
  S/ST/STBEY/Date-Calc-6.3.tar.gz
  D/DC/DCOPPIT/Benchmark-Timer-0.7102.tar.gz
  R/RB/RBOW/Date-ICal-2.678.tar.gz
  S/SB/SBECK/Date-Manip-6.37.tar.gz
  G/GB/GBARR/TimeDate-1.20.tar.gz
  S/SH/SHLOMIF/Error-0.17018.tar.gz
  P/PA/PARDUS/File-MimeInfo/File-MimeInfo-0.16.tar.gz
  O/OV/OVID/HTML-TokeParser-Simple-3.15.tar.gz
  D/DS/DSKOLL/MIME-tools-5.503.tar.gz
  D/DS/DSKOLL/IO-stringy-2.110.tar.gz
  C/CO/COSIMO/HTTP-DAV-0.47.tar.gz
  M/MA/MARSCHAP/perl-ldap-0.48.tar.gz
  F/FD/FDESAR/Parse-Yapp-1.05.tar.gz
  S/SN/SNOWHARE/Unicode-MapUTF8-1.11.tar.gz
  G/GA/GAAS/Unicode-String-2.09.tar.gz
  T/TY/TYEMQ/Algorithm-Diff-1.1902.tar.gz
  J/JG/JGMYERS/Encode-Detect-1.01.tar.gz
  G/GU/GUIDO/libintl-perl-1.20.tar.gz
  K/KE/KEN/XML-XML2JSON-0.06.tar.gz
  A/AR/ARISTOTLE/XML-Atom-SimpleFeed-0.86.tar.gz
  P/PE/PETDANCE/Test-WWW-Mechanize-1.44.tar.gz
  G/GR/GRANTM/XML-Simple-2.20.tar.gz
  A/AD/ADAMK/Archive-Zip-1.30.tar.gz
  D/DU/DURIST/Proc-ProcessTable-0.45.tar.gz
  S/SU/SULLR/Net-INET6Glue-0.5.tar.gz
perl = perl
cpan-configuration =
  makepl_arg=''
  make_arg=''

[perl-String-Checker-mioga]
recipe = hexagonit.recipe.cmmi
url = http://packages.alixen.org/contribs/String-Checker-0.03.tar.gz
md5sum = c750a33505609544f95eace7a2896c84
configure-command =
  ${perl:location}/bin/perl Makefile.PL

[mioga]
recipe = hexagonit.recipe.cmmi
version = 2.4.16
# No use re-using "version", the whole URL will change for the next one
url = http://www.alixen.org/attachments/download/89/Mioga2-2.4.16.tar.gz
md5sum = 1d2e76c798ee6d5f233011997200e125
location = ${buildout:parts-directory}/${:_buildout_section_name_}
buildinst = ${mioga:location}/buildinst
static = ${mioga:location}/static
environment =
  MIOGA_BASE=${mioga:location}
  MIOGA_BUILDINST=${mioga:buildinst}
  MIOGA_STATIC=${mioga:static}
  MIOGA_SITEPERL=${perl:siteprefix}
  PATH=${libxslt:location}/bin:${libxml2:location}/bin:${perl:location}/bin:${perl:siteprefix}/bin:${rsync:location}/bin:%(PATH)s
patch-options = -p1
patches =
  ${mioga-patch:location}/${mioga-patch:filename}
# post-make-hook = ${mioga-postmakehook:location}/${mioga-postmakehook:filename}:post_make_hook
pre-configure-hook = ${mioga-hooks:location}/${mioga-hooks:filename}:pre_configure_hook
configure-command =
  ${perl:location}/bin/perl Makefile.PL
make-targets =
  slapos-compilation
keep-compile-dir = true
perl-binary = ${perl:location}/bin/perl

[mioga-patch]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/${:filename}
# md5sum = b836ad89902d1ea68b091a5b9800edd8
download-only = true
filename = ${:_buildout_section_name_}

[mioga-hooks]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/${:filename}
# md5sum = c7ceec7788749238cb5fbe09beb647b1
download-only = true
filename = mioga-hooks.py

[template]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
# md5sum = 
output = ${buildout:directory}/template.cfg
mode = 0644

[template-apacheperl]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-apacheperl.cfg
# md5sum = 
output = ${buildout:directory}/template-apacheperl.cfg
mode = 0644
compile-directory = ${mioga:compile-directory}/Mioga2-${mioga:version}


[template-postgres]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-postgres.cfg
# md5sum = 
output = ${buildout:directory}/template-postgres.cfg
mode = 0644