env = Environment() conf = Configure(env) for lib, h in (('glib-2.0', None), ('sqlite3', 'sqlite3.h'), ('gtk-x11-2.0', None), ('gthread-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', '-Wall']) env.Append(LINKFLAGS = ['-Wl,--export-dynamic']) 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') env.ParseConfig('pkg-config --cflags --libs gthread-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 \n') f.write('gchar *%s_string = \n' % str(target[0]).rsplit('.', 1)[0]) 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.walls_ui('tags_ui.h', 'tags.ui') walls = env.Program('walls', Glob('*.c')) destdir = ARGUMENTS.get('DESTDIR', '') prefix = ARGUMENTS.get('PREFIX', '/usr/local') final_dest = destdir + prefix + '/bin' env.Install(final_dest, walls) env.Alias('install', final_dest) # vim: syn=python