easyblock = 'CMakeMake'

name = "QGIS"
version = "2.12.3"

homepage = 'http://www.qgis.org'
description = """A Free and Open Source Geographic Information System"""

toolchain = {'name': 'foss', 'version': '2015g'}

source_urls = ['http://qgis.org/downloads']

sources = [SOURCELOWER_TAR_BZ2]

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

separate_build_dir = True

python = 'Python'
pyver = '2.7.9'
pysuff = '-%s-%s' % (python,pyver)

dependencies = [('QCA', '2.1.0'),
                ('Qt','4.8.6'),
                ('PROJ_4','4.9.2'),
                ('GEOS','3.5.0'),
                ('SQLite','3.8.8.1'),
                ('GDAL','2.1.0'),
                ('Qwt','6.1.2'),
                ('expat','2.1.0'),
                ('SpatiaLite','4.3.0a'),
                ('SIP','4.17', pysuff),
                ('PyQt','4.11.4', pysuff),
                ('spatialindex','1.8.5'),
]


configopts = '-DCMAKE_EXE_LINKER_FLAGS=-L$EBROOTSQLITE/lib -DWITH_INTERNAL_SPATIALITE=FALSE -DWITH_PYSPATIALITE=FALSE'
configopts += ' -DSPATIALITE_LIBRARY=$EBROOTSPATIALITE/lib/libspatialite.so -DSPATIALITE_INCLUDE_DIR=$EBROOTSPATIALITE/include '
configopts += ' -DQCA_INCLUDE_DIR=$EBROOTQCA/include/QtCrypto -DQCA_LIBRARY=$EBROOTQCA/lib/libqca.so '
configopts += ' -DQWT_INCLUDE_DIR=$EBROOTQWT/include  -DQWT_LIBRARY=$EBROOTQWT/lib/libqwt.so '
configopts += ' -DSPATIALINDEX_LIBRARY=$EBROOTSPATIALINDEX/lib/libspatialindex.so -DWITH_POSTGRESQL=OFF -DWITH_QWTPOLAR=OFF '
configopts += ' -DSPATIALINDEX_INCLUDE_DIR=$EBROOTSPATIALINDEX/include/spatialindex/ -DGSL_CONFIG=/apps/all/GSL/1.16-intel-2015b/bin/gsl-config '
configopts += ' -DWITH_BINDINGS=TRUE -DBINDINGS_GLOBAL_INSTALL=TRUE -DWITH_POSTGRESQL=TRUE'

sanity_check_paths = {
    'files': ['bin/qgis',
        'lib/libqgis_gui.so'
    ],
    'dirs': ['include', 'bin', 'lib'],
}

moduleclass = 'lib'
