# -*- python -*-
# encoding: utf-8

def configure(conf):
    conf.env.append_value('MODULES_AVAILABLE', 'evince')
    if 'evince' in conf.env['ENABLE_MODULES'] or 'all' in conf.env['ENABLE_MODULES']:
        if conf.pkg_check_modules('EVINCE', 'evince-document-2.29 evince-view-2.29 pygobject-2.0 pygtk-2.0',
                                  mandatory=False):
            conf.env.append_value('MODULES_TO_BUILD', 'evince')



def build(bld):
    
    if 'evince' in bld.env['MODULES_TO_BUILD']:
        bld.codegen('evince')
        pyext = bld.create_pyext()
        pyext.source = 'evincemodule.c evince.c'
        pyext.target = 'evince'
        pyext.uselib = 'EVINCE'
        pyext.install_path = '${PYTHONDIR}/gtk-2.0'

        bld.install_files('${DATADIR}/pygtk/2.0/defs', 'evince.defs')

