1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
env = Environment()
conf = Configure(env)
for lib, h in (('Imlib2', 'Imlib2.h'), ('glib-2.0', None), ('sqlite3', 'sqlite3.h'), ('gtk-x11-2.0', None)):
if h:
libfound = conf.CheckLibWithHeader(lib, h, 'c')
else:
libfound = conf.CheckLib(lib)
if not libfound:
print 'Can''t find %s' % lib
Exit(1)
env = conf.Finish()
env.Append(CCFLAGS = ['-std=gnu99', '-g'])
env.Append(LINKFLAGS = ['-Wl,--export-dynamic'])
env.ParseConfig('imlib2-config --cflags --libs')
env.ParseConfig('pkg-config --cflags --libs glib-2.0')
env.ParseConfig('pkg-config --cflags --libs sqlite3')
env.ParseConfig('pkg-config --cflags --libs gtk+-2.0')
def build_ui(target, source, env):
f = open(str(target[0]), 'w')
f.write('#ifndef _WALLS_UI_H_\n')
f.write('#define _WALLS_UI_H_\n')
f.write('#include <gtk/gtk.h>\n')
f.write('gchar *ui_string = \n')
for line in open(str(source[0]), 'r'):
f.write('"%s"\n' % line.replace('"', '\\"').strip())
f.write(';\n')
f.write('#endif\n')
ui_builder = Builder(action = build_ui)
env['BUILDERS']['walls_ui'] = ui_builder
env.walls_ui('walls_ui.h', 'walls.ui')
env.Program('walls', Glob('*.c'))
# vim: syn=python
|