# IT4Innovations

easyblock = 'CMakeMake'

name = 'HyperLoom'
version = '0.9'

homepage = 'https://code.it4i.cz/ADAS/loom'
description = "Framework for distributed task execution"

toolchain = SYSTEM
toolchainopts = {'pic': True}

source_urls = ['https://code.it4i.cz/ADAS/loom/-/archive/v0.9/']
sources = ['loom-v0.9.tar.gz']

builddependencies = [
    ('CMake', '3.9.1'),
]

dependencies = [
    ('zlib', '1.2.11'),
    ('libuv', '1.20.3'),
    ('protobuf-python', '3.2.0', '-GCC-7.1.0-2.28-Python-3.6.1'),
]

separate_build_dir = True

#configopts = " -DPROTOBUF_INCLUDE_DIR=$EBROOTPROTOBUF/include "
#configopts += " -DPROTOBUF_LIBRARY=$EBROOTPROTOBUF/lib/libprotobuf.so "
#configopts += " -DCMAKE_INSTALL_PREFIX=$EBROOTLIBUV "
#configopts += " -DPYTHON_LIBRARY=$EBROOTPYTHON/lib/libpython3.6m.so "
#configopts += " -DPYTHON_INCLUDE_DIR=$EBROOTPYTHON/include/python3.6m "
#configopts += " -DPROTOBUF_PROTOC_EXECUTABLE=$EBROOTPYTHON/bin/protoc "
configopts = " -DPROTOBUF_INCLUDE_DIR=/apps/all/protobuf/3.2.0-GCC-7.1.0-2.28-Python-3.6.1/include "
configopts += " -DPROTOBUF_LIBRARY=/apps/all/protobuf/3.2.0-GCC-7.1.0-2.28-Python-3.6.1/lib/libprotobuf.so "
configopts += " -DCMAKE_INSTALL_PREFIX=/apps/all/libuv/1.20.3 "
configopts += " -DPYTHON_LIBRARY=/apps/all/Python/3.6.1/lib/libpython3.6m.so "
configopts += " -DPYTHON_INCLUDE_DIR=/apps/all/Python/3.6.1/include/python3.6m "
configopts += " -DPROTOBUF_PROTOC_EXECUTABLE=/apps/all/protobuf/3.2.0-GCC-7.1.0-2.28-Python-3.6.1/bin/protoc"

postinstallcmds = [
    'mkdir %(installdir)s/bin',
    'cp %(builddir)s/easybuild_obj/src/server/loom-server %(installdir)s/bin/',
    'cp %(builddir)s/easybuild_obj/src/worker/loom-worker %(installdir)s/bin/',
    'cp %(builddir)s/loom-v0.9/python %(installdir)s/python -R',
]

sanity_check_paths = {
    'files': ['bin/%s' % x for x in ['loom-server', 'loom-worker']],
    'dirs': ['python'],
}

moduleclass = 'lib'
