[buildout]

parts = boa

[boa-patch-ENOSYS]
recipe = hexagonit.recipe.download
url = http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/www-servers/boa/files/boa-0.94.14_rc21-ENOSYS.patch?revision=1.1
filename = boa-0.94.14_rc21-ENOSYS.patch
md5sum = 7206b342195961501ed1eae38486e5db
download-only = true


[boa]
recipe = slapos.recipe.build
url = http://www.boa.org/boa-0.94.14rc21.tar.gz
md5sum = e24b570bd767a124fcfb40a34d148ba9
patches =
    ${boa-patch-ENOSYS:location}/${boa-patch-ENOSYS:filename}
slapos_promise =
    directory:bin/
    file:bin/boa
    file:bin/boa_indexer
script = 
    import shutil
    import os
    url = self.download(self.options['url'], self.options['md5sum'])
    extract_dir = self.extract(url)
    workdir = guessworkdir(extract_dir)
    self.applyPatchList(self.options.get('patches'), '-p1', cwd=workdir)
    call(['./configure'], cwd=workdir)
    call(['make'], cwd=workdir)
    # Installation of boa. Manually, no make install
    os.makedirs('%(location)s/bin/')
    shutil.copyfile(workdir + '/src/boa', '%(location)s/bin/boa')
    os.chmod('%(location)s/bin/boa', 0755)
    shutil.copyfile(workdir + '/src/boa_indexer', '%(location)s/bin/boa_indexer')
    os.chmod('%(location)s/bin/boa_indexer', 0755)
