easyblock = 'CMakeMake'

name = 'MariaDB'
version = '10.2.11'

homepage = 'https://mariadb.org/'
description = """MariaDB An enhanced, drop-in replacement for MySQL."""

toolchain = {'name': 'intel', 'version': '2017b'}

source_urls = ['https://downloads.mariadb.org/f/mariadb-%(version)s/source']
sources = [SOURCELOWER_TAR_GZ]
patches = ['MariaDB-10.1.13-link-rt-for-jemalloc.patch']

dependencies = [
    ('zlib', '1.2.11'),
    ('ncurses', '6.0'),
    ('jemalloc', '5.0.1'),
    ('XZ', '5.2.3'),
    ('Boost', '1.66.0'),
    ('libxml2', '2.9.7'),
]

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

separate_build_dir = True

# we need to use the bundled PCRE because using an external one is broken,
# see https://bugs.exim.org/show_bug.cgi?id=2173
configopts = "-DWITH_PCRE=bundled -DWITH_JEMALLOC=yes -DWITH_ZLIB=system -DMYSQL_MAINTAINER_MODE=ON "
configopts += "-DWITH_EMBEDDED_SERVER=ON "  # for libmysqld.so & co
configopts += "-DWITHOUT_TOKUDB=ON "  # not supported with Intel compilers

sanity_check_paths = {
    'files': ['bin/mysql', 'bin/mysqld_safe', 'lib/libmysqlclient.%s' % SHLIB_EXT, 'lib/libmysqld.%s' % SHLIB_EXT,
              'scripts/mysql_install_db'],
    'dirs': ['include', 'share'],
}

moduleclass = 'data'
