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 $
24 This is a WAF build script (http://code.google.com/p/waf/).
28 import Options
, subprocess
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')
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')
60 obj
= bld
.new_task_gen('cc', 'program')
63 obj
.source
= 'src/irc.c src/socket.c src/vomak.c'
64 obj
.includes
= '. src/'
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')
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'):
83 Utils
.pprint(success_color
, status
)
85 ret
= subprocess
.call(command
.split())
88 print str(e
), ":", command
93 Utils
.pprint('RED', status
+ ' failed')