easyblock = 'CMakeMake'

name = 'freeglut'
version = '3.0.0'
versionsuffix = '-Mesa-18.1.3'

homepage = 'http://freeglut.sourceforge.net/'
description = "freeglut is a completely OpenSourced alternative to the OpenGL Utility Toolkit (GLUT) library."

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

sources = [SOURCE_TAR_GZ]
source_urls = ['http://prdownloads.sourceforge.net/%(name)s']

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

dependencies = [
    ('X11', '20170314', '', True),
    ('libGLU', '9.0.0', '', True),
    ('Mesa', '18.1.3'),
]

configopts = ' -DX11_X11_LIB="$EBROOTX11/lib/libX11.so" '
configopts += ' -DX11_X11_INCLUDE_PATH="$EBROOTX11/include/X11" '
configopts += ' -DX11_Xext_LIB="$EBROOTX11/lib/libXext.so" '
configopts += ' -DX11_Xrandr_LIB="$EBROOTX11/lib/libXrandr.so" '
configopts += ' -DX11_Xrandr_INCLUDE_PATH="$EBROOTX11/include/X11/extensions/" '
configopts += ' -DX11_Xi_LIB="$EBROOTX11/lib/libXrandr.so" '
configopts += ' -DX11_Xi_INCLUDE_PATH="$EBROOTX11/include/X11/extensions/" '

sanity_check_paths = {
    'files': [
        ('lib/libglut.a', 'lib64/libglut.a'), ('lib/libglut.%s' %
                                               SHLIB_EXT, 'lib64/libglut.%s' %
                                               SHLIB_EXT)], 'dirs': ['include/GL'], }

moduleclass = 'lib'
