#! /usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006 (ita)

import os
import Params, intltool, gnome

# the following two variables are used by the target "waf dist"
VERSION='0.0.2'
APPNAME='gnome-test'

# these variables are mandatory ('/' are converted automatically)
srcdir = '.'
blddir = 'build'

def set_options(opt):
	# add your custom options here, for example:
	#opt.add_option('--bunny', type='string', help='how many bunnies we have', dest='bunny')
	pass

def configure(conf):
	conf.check_tool('gcc gnome cs intltool')

	conf.check_pkg('libgnome-2.0',        destvar='GNOME',    vnum='2.10.0', mandatory=True)
	conf.check_pkg('libgnomeui-2.0',      destvar='GNOMEUI',  vnum='2.10.0', mandatory=True)
	conf.check_pkg('gtk+-2.0',            destvar='GTK',      vnum='2.6.0', mandatory=True)
	conf.check_pkg('dbus-glib-1',         destvar='DBUSGLIB', vnum='0.60', mandatory=True)

	conf.check_pkg('gtk-sharp-2.0',	      destvar='GTKSHARP',  mandatory=False)

	# here is how to add more libraries (look in src/wscript_build too)
	#conf.check_pkg('glib-2.0',            destvar='GLIB',     vnum='2.6.0')
	#conf.check_pkg('libbonobo-2.0',       destvar='BONOBO',   vnum='2.0.0')
	#conf.check_pkg('libbonoboui-2.0',     destvar='BONOBOUI', vnum='2.0.0')
	#conf.check_pkg('libglade-2.0',        destvar='GLADE',    vnum='2.0.1')
	#conf.check_pkg('libgnomecanvas-2.0',  destvar='CANVAS',   vnum='2.0.1')
	#conf.check_pkg('libgnomeprintui-2.2', destvar='PRINTUI',  vnum='2.2.0')
	#conf.check_pkg('libgnomeprint-2.2',   destvar='PRINT',    vnum='2.2.0')
	#conf.check_pkg('libxml-2.0',          destvar='XML',      vnum='2.4.23')
	#conf.check_pkg('gdk-x11-2.0',         destvar='GDK',      vnum='1.0.0')

	conf.define('VERSION', VERSION)
	conf.define('GETTEXT_PACKAGE', 'gnome-hello-2.0')
	conf.define('PACKAGE', 'gnome-hello')

	conf.env.append_value('CCFLAGS', '-DHAVE_CONFIG_H')

	conf.env['ASSEMBLIES_GLIB'] = '/usr/lib/mono/gtk-sharp/glib-sharp.dll'

	conf.write_config_header('config.h')

def build(bld):
	# process subfolders from here
	bld.add_subdirs('src mkenums marshal pixmaps')

	env = bld.env()
	if env['XML2PO'] and env['XSLTPROC2PO']:
		bld.add_subdirs('help')

	if env['INTLTOOL']:
		bld.add_subdirs('po data')

	if env['HAVE_GTKSHARP'] and env['MCS']:
		bld.add_subdirs('sharp')

	if env['SGML2MAN']:
		bld.add_subdirs('man')

def shutdown():
	# Postinstall tasks:
	gnome.postinstall_scrollkeeper('gnome-hello') # Installing the user docs
	gnome.postinstall_schemas('gnome-test') # Installing GConf schemas
	gnome.postinstall_icons() # Updating the icon cache
