# -*- python -*-
# -*- coding: utf-8 -*-

from waflib import Options

def options(opt):
    grp = opt.get_option_group("Guitarix Widget Library")
    grp.add_option('--glade-support',
                   action='store_const',
                   default=False,
                   const=True,
                   help=('build support for Glade / GtkBuilder (Developers only!!)'),
                   )

def configure(conf):
    if Options.options.glade_support:
        conf.check_cfg(package='gladeui-2.0', variables='catalogdir pixmapdir moduledir', uselib_store='GLADEUI', mandatory=True)
        conf.env.GX_GLADE_SUPPORT = True
        conf.env.GXW_SHARED = True
        conf.env.GXW_SHARED_INSTALL = True

def build(bld):
    if not bld.env.GX_GLADE_SUPPORT:
        return
    bld.recurse("glade-icons")
    bld.shlib(
        ccflags = bld.env.CXXFLAGS,
        use = ['GTK2','gxw'],
        source = ['glade-gxw.c'],
        target = 'gladegx',
        includes = ['..'],
        install_path = bld.env.GLADEUI_moduledir,
        )

    bld.install_files(bld.env.GLADEUI_catalogdir, "gxw.xml", chmod=0o644)
