easyblock = 'CMakeMake'

name = 'rstudio'
version = '1.1.366'

homepage = 'https://www.rstudio.com/products/rstudio/download/'
description = """RStudio is a set of integrated tools designed to help you be more productive with R."""
toolchain = {'name': 'intel', 'version': '2017.02'}

source_urls = ['https://github.com/rstudio/rstudio/archive/']
sources = ['v%(version)s.tar.gz']

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

dependencies = [
    ('Boost', '1.63.0'),
    ('LibUUID', '1.0.3'),
    ('bzip2', '1.0.6'),
    ('zlib', '1.2.11'),
    ('libffi', '3.2.1'),
    ('QtWebkit', '5.8.0'),
    ('libxkbcommon', '0.6.1'),
    ('R', '3.4.0'),
]

osdependencies = [('libbsd-dev', 'libbsd-devel')]

preconfigopts = "sed -i 's#get_filename_component#set(QT_QMAKE_EXECUTABLE \"/opt/software/Qt5/5.8.0-intel-2017.02/bin/qmake\")\\nset(QT_VERSION \"5.8\")\\n&#g' src/cpp/desktop/CMakeLists.txt && cd dependencies/common/ && sed -i '/boost/d' install-common && ./install-common && cd ../.. && "

configopts = [
    "-DRSTUDIO_TARGET=Desktop",
    "-DCMAKE_BUILD_TYPE=Release",
]

prebuildopts = "sed -i 's/-O2 -xHost -ftz/-O2 -xHost -ftz -pthread -lbsd -fstack-protector/g' CMakeCache.txt && "

sanity_check_paths = {
    'files': ["bin/rstudio"],
    'dirs': [],
}

moduleclass = 'lang'
