easyblock = 'Bundle'

name = 'X11'
version = '20170805'

homepage = 'https://www.x.org'

description = """
 The X Window System (X11) is a windowing system for bitmap displays
"""

toolchain = {'name': 'GCCcore', 'version': '6.4.0'}

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', '20170619'),
    # use same binutils version that was used when building GCCcore toolchain
    ('binutils', '2.28', '', True),
    ('Bison', '3.0.4'),
    ('gettext', '0.19.8.1'),
    ('pkg-config', '0.29.2'),
]

dependencies = [
    ('bzip2', '1.0.6'),
    ('fontconfig', '2.12.4'),
    ('freetype', '2.8'),
    ('zlib', '1.2.11'),
]

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

default_easyblock = 'ConfigureMake'

common_specs = {
    'sources': [SOURCE_TAR_GZ],
    'start_dir': '%(name)s-%(version)s',
}
components = [
    ('xorg-macros', '1.19.1', {                             # 2017-01-29
        'sources': ['util-macros-%(version)s.tar.gz'],
        'start_dir': 'util-macros-%(version)s',
    }),
    ('libpthread-stubs', '0.4', common_specs),              # 2017-03-14
    ('bigreqsproto', '1.1.2', common_specs),                # 2012-03-23
    ('compositeproto', '0.4.2', common_specs),              # 2010-10-30
    ('damageproto', '1.2.1', common_specs),                 # 2010-10-30
    ('dmxproto', '2.3.1', common_specs),                    # 2011-01-06
    ('dri2proto', '2.8', common_specs),                     # 2012-07-11
    ('dri3proto', '1.0', common_specs),                     # 2013-11-01
    ('fixesproto', '5.0', common_specs),                    # 2011-03-08
    ('fontsproto', '2.1.3', common_specs),                  # 2014-04-14
    ('glproto', '1.4.17', common_specs),                    # 2013-12-10
    ('inputproto', '2.3.2', common_specs),                  # 2016-04-04
    ('kbproto', '1.0.7', common_specs),                     # 2015-05-01
    ('presentproto', '1.1', common_specs),                  # 2017-01-26
    ('randrproto', '1.5.0', common_specs),                  # 2015-05-17
    ('recordproto', '1.14.2', common_specs),                # 2012-03-23
    ('renderproto', '0.11.1', common_specs),                # 2010-08-10
    ('resourceproto', '1.2.0', common_specs),               # 2011-05-28
    ('scrnsaverproto', '1.2.2', common_specs),              # 2012-03-23
    ('videoproto', '2.3.3', common_specs),                  # 2016-03-11
    ('xcmiscproto', '1.2.2', common_specs),                 # 2012-03-23
    ('xextproto', '7.3.0', common_specs),                   # 2013-12-27
    ('xf86bigfontproto', '1.2.0', common_specs),            # 2009-08-27
    ('xf86dgaproto', '2.1', common_specs),                  # 2009-10-01
    ('xf86driproto', '2.1.1', common_specs),                # 2011-01-06
    ('xf86vidmodeproto', '2.3.1', common_specs),            # 2011-01-06
    ('xineramaproto', '1.2.1', common_specs),               # 2011-01-06
    ('xproto', '7.0.31', common_specs),                     # 2016-09-23
    ('libXau', '1.0.8', common_specs),                      # 2013-05-24
    ('libXdmcp', '1.1.2', common_specs),                    # 2015-03-21
    ('xcb-proto', '1.12', common_specs),                    # 2016-05-18
    ('libxcb', '1.12', common_specs),                       # 2016-05-18
    ('xtrans', '1.3.5', common_specs),                      # 2014-09-22
    ('libxkbcommon', '0.7.2', {                             # 2017-08-04
        'sources': ['libxkbcommon-%(version)s.tar.xz'],
        'start_dir': 'libxkbcommon-%(version)s',
    }),
    ('libX11', '1.6.5', common_specs),                      # 2017-02-26
    ('libXext', '1.3.3', common_specs),                     # 2014-07-24
    ('libFS', '1.0.7', common_specs),                       # 2015-05-01
    ('libICE', '1.0.9', common_specs),                      # 2014-06-07
    ('libSM', '1.2.2', common_specs),                       # 2013-09-08
    ('libXScrnSaver', '1.2.2', common_specs),               # 2012-03-08
    ('libXt', '1.1.5', common_specs),                       # 2015-05-01
    ('libXmu', '1.1.2', common_specs),                      # 2013-09-08
    ('libXpm', '3.5.12', common_specs),                     # 2016-12-15
    ('libXaw', '1.0.13', common_specs),                     # 2015-05-01
    ('libXfixes', '5.0.3', common_specs),                   # 2016-10-04
    ('libXcomposite', '0.4.4', common_specs),               # 2013-01-03
    ('libXrender', '0.9.10', common_specs),                 # 2016-10-04
    ('libXcursor', '1.1.14', common_specs),                 # 2013-05-30
    ('libXdamage', '1.1.4', common_specs),                  # 2013-01-03
    ('libfontenc', '1.1.3', common_specs),                  # 2015-05-01
    ('libXfont', '1.5.2', common_specs),                    # 2016-08-31
    ('libXfont2', '2.0.1', common_specs),                   # 2015-12-11
    ('libXft', '2.3.2', common_specs),                      # 2014-06-06
    ('libXi', '1.7.9', common_specs),                       # 2017-01-23
    ('libXinerama', '1.1.3', common_specs),                 # 2013-05-31
    ('libXrandr', '1.5.1', common_specs),                   # 2016-10-04
    ('libXres', '1.0.7', common_specs),                     # 2013-05-31
    ('libXtst', '1.2.3', common_specs),                     # 2016-10-04
    ('libXv', '1.0.11', common_specs),                      # 2016-10-04
    ('libXvMC', '1.0.10', common_specs),                    # 2016-10-04
    ('libXxf86dga', '1.1.4', common_specs),                 # 2013-05-31
    ('libXxf86vm', '1.1.4', common_specs),                  # 2015-02-24
    ('libdmx', '1.1.3', common_specs),                      # 2013-05-28
    ('libpciaccess', '0.13.5', common_specs),               # 2017-04-04
    ('libxkbfile', '1.0.9', common_specs),                  # 2015-05-01
    ('libxshmfence', '1.2', common_specs),                  # 2015-01-02
    ('xcb-util', '0.4.0', common_specs),                    # 2014-10-15
    ('xcb-util-image', '0.4.0', common_specs),              # 2014-10-15
    ('xcb-util-keysyms', '0.4.0', common_specs),            # 2014-10-01
    ('xcb-util-renderutil', '0.3.9', common_specs),         # 2014-06-13
    ('xcb-util-wm', '0.4.1', common_specs),                 # 2014-02-19
    ('xcb-util-cursor', '0.1.3', common_specs),             # 2016-05-12
]

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


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

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'
