diff options
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/SConstruct b/SConstruct new file mode 100644 index 0000000..4aae244 --- /dev/null +++ b/SConstruct @@ -0,0 +1,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 |