easyblock = 'Bundle'

name = 'X11'
version = '20160819'
versionsuffix = '-test'

homepage = 'https://www.x.org'
description = "The X Window System (X11) is a windowing system for bitmap displays"

toolchain = {'name': 'system', 'version': ''}

source_urls = [
    XORG_LIB_SOURCE,
    XORG_PROTO_SOURCE,
    'http://xcb.freedesktop.org/dist/',
    'http://xkbcommon.org/download/',
    'http://cgit.freedesktop.org/xorg/util/macros/snapshot',
]

builddependencies = [
    ('Autotools', '20150215'),
    ('pkg-config', '0.29.2'),
]
dependencies = [
    ('freetype', '2.5.3'),
    ('fontconfig', '2.11.1'),
    ('zlib', '1.2.11'),
    ('bzip2', '1.0.6'),
]

default_easyblock = 'ConfigureMake'

common_specs = {
    'sources': [SOURCE_TAR_GZ],
    'start_dir': '%(name)s-%(version)s',
}
components = [
    ('xorg-macros', '1.19.0', {
        'sources': ['util-macros-%(version)s.tar.gz'],
        'start_dir': 'util-macros-%(version)s',
    }),
    ('xf86-video-dummy', '0.3.5', common_specs),
    ('libpthread-stubs', '0.3', common_specs),
    ('bigreqsproto', '1.1.2', common_specs),
    ('compositeproto', '0.4.2', common_specs),
    ('damageproto', '1.2.1', common_specs),
    ('dmxproto', '2.3.1', common_specs),
    ('dri2proto', '2.8', common_specs),
    ('dri3proto', '1.0', common_specs),
    ('fixesproto', '5.0', common_specs),
    ('fontsproto', '2.1.3', common_specs),
    ('glproto', '1.4.17', common_specs),
    ('inputproto', '2.3.1', common_specs),
    ('kbproto', '1.0.7', common_specs),
    ('presentproto', '1.0', common_specs),
    ('randrproto', '1.5.0', common_specs),
    ('recordproto', '1.14.2', common_specs),
    ('renderproto', '0.11', common_specs),
    ('resourceproto', '1.2.0', common_specs),
    ('scrnsaverproto', '1.2.2', common_specs),
    ('videoproto', '2.3.3', common_specs),
    ('xcmiscproto', '1.2.2', common_specs),
    ('xextproto', '7.3.0', common_specs),
    ('xf86bigfontproto', '1.2.0', common_specs),
    ('xf86dgaproto', '2.1', common_specs),
    ('xf86driproto', '2.1.1', common_specs),
    ('xf86vidmodeproto', '2.3.1', common_specs),
    ('xineramaproto', '1.2.1', common_specs),
    ('xproto', '7.0.28', common_specs),
    ('libXau', '1.0.8', common_specs),
    ('libXdmcp', '1.1.2', common_specs),
    ('xcb-proto', '1.11', common_specs),
    ('libxcb', '1.11.1', common_specs),
    ('xtrans', '1.3.5', common_specs),
    ('libxkbcommon', '0.6.1', {
        'sources': ['libxkbcommon-%(version)s.tar.xz'],
        'start_dir': 'libxkbcommon-%(version)s',
    }),
    ('libX11', '1.6.3', common_specs),
    ('libXext', '1.3.3', common_specs),
    ('libFS', '1.0.7', common_specs),
    ('libICE', '1.0.9', common_specs),
    ('libSM', '1.2.2', common_specs),
    ('libXScrnSaver', '1.2.2', common_specs),
    ('libXt', '1.1.5', common_specs),
    ('libXmu', '1.1.2', common_specs),
    ('libXpm', '3.5.11', common_specs),
    ('libXaw', '1.0.13', common_specs),
    ('libXfixes', '5.0.2', common_specs),
    ('libXcomposite', '0.4.4', common_specs),
    ('libXrender', '0.9.9', common_specs),
    ('libXcursor', '1.1.14', common_specs),
    ('libXdamage', '1.1.4', common_specs),
    ('libfontenc', '1.1.3', common_specs),
    ('libXfont', '1.5.1', common_specs),
    ('libXi', '1.7.6', common_specs),
    ('libXinerama', '1.1.3', common_specs),
    ('libXrandr', '1.5.0', common_specs),
    ('libXres', '1.0.7', common_specs),
    ('libXtst', '1.2.2', common_specs),
    ('libXv', '1.0.10', common_specs),
    ('libXvMC', '1.0.9', common_specs),
    ('libXxf86dga', '1.1.4', common_specs),
    ('libXxf86vm', '1.1.4', common_specs),
    ('libdmx', '1.1.3', common_specs),
    ('libpciaccess', '0.13.4', common_specs),
    ('libxkbfile', '1.0.9', common_specs),
    ('libxshmfence', '1.2', common_specs),
    ('xcb-util', '0.4.0', common_specs),
    ('xcb-util-image', '0.4.0', common_specs),
    ('xcb-util-keysyms', '0.4.0', common_specs),
    ('xcb-util-renderutil', '0.3.9', common_specs),
    ('xcb-util-wm', '0.4.1', common_specs),
    ('xcb-util-cursor', '0.1.3', common_specs),
]

# Python is required for xcb-proto
allow_system_deps = [('Python', SYS_PYTHON_VERSION)]
pyshortver = '.'.join(SYS_PYTHON_VERSION.split('.')[0:2])

preconfigopts = "if [ ! -f configure ]; then ./autogen.sh; fi && "

# specify that Bundle easyblock should run a full sanity check, rather
# than just trying to load the module
full_sanity_check = True


modluafooter = 'add_property("state","testing")'

sanity_check_paths = {
    'files': [
        'include/X11/Xlib.h',
        'include/X11/Xutil.h'],
    'dirs': [
        'include/GL',
        'include/X11',
        'include/X11/extensions',
        'lib',
        'lib/python%s/site-packages/xcbgen' %
        pyshortver,
        'lib/pkgconfig',
        'share/pkgconfig'],
}

moduleclass = 'vis'
