Implement and use vomak_warning() to print or log warnings properly.
[vomak.git] / wscript
blobca6ec8f98396297ab902e2183252424303f2e286
1 #! /usr/bin/env python
2 # -*- coding: utf-8 -*-
4 # WAF build script - this file is part of vomak - a very simple IRC bot
6 # Copyright 2008 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 # $Id: wscript 2649 2008-06-05 16:52:39Z eht16 $
23 """
24 This is a WAF build script (http://code.google.com/p/waf/).
25 """
28 import Options, subprocess
31 APPNAME = 'vomak'
32 VERSION = '0.1'
34 srcdir = '.'
35 blddir = '_build_'
38 def configure(conf):
40 conf.check_tool('compiler_cc')
42 conf.check_cfg(package='glib-2.0', atleast_version='2.6.0', uselib_store='GLIB', mandatory=True)
43 conf.check_cfg(package='glib-2.0', args='--cflags --libs', uselib_store='GLIB')
45 if Options.options.debug:
46 conf.env.append_value('CCFLAGS', '-g -DDEBUG -O0')
49 def set_options(opt):
50 opt.tool_options('compiler_cc')
52 opt.add_option('--html', action='store_true', default=False,
53 help='generate HTML doc [default: No]', dest='html')
55 opt.add_option('--debug', action='store_true', default=False,
56 help='enable debug mode [default: No]', dest='debug')
59 def build(bld):
60 obj = bld.new_task_gen('cc', 'program')
61 obj.name = 'vomak'
62 obj.target = 'vomak'
63 obj.source = 'src/irc.c src/socket.c src/vomak.c'
64 obj.includes = '. src/'
65 obj.uselib = 'GLIB'
68 def shutdown():
69 if Options.options.html:
70 # first try rst2html.py as it is the upstream default
71 ret = launch('rst2html.py -stg --stylesheet=vomak.css README readme.html',
72 'Generating HTML documentation')
73 if not ret == 0:
74 launch('rst2html -stg --stylesheet=vomak.css README readme.html',
75 'Generating HTML documentation (using fallback "rst2html")')
76 ret = launch('rst2html -stg --stylesheet=vomak.css README readme.html',
77 'Generating HTML documentation')
80 # Simple function to execute a command and print its exit status
81 def launch(command, status, success_color='GREEN'):
82 ret = 0
83 Utils.pprint(success_color, status)
84 try:
85 ret = subprocess.call(command.split())
86 except OSError, e:
87 ret = 1
88 print str(e), ":", command
89 except:
90 ret = 1
92 if ret != 0:
93 Utils.pprint('RED', status + ' failed')
95 return ret