Add the TODO file.
[dictix.git] / wscript
blob9bc91a58dafd5b2ec915f41f669b422a9375532e
1 #! /usr/bin/env python
2 # encoding: utf-8
3 import os
4 import sys
5 import gnome
6 import intltool
7 import misc
9 import Build
10 import Configure
11 import Options
12 import Utils
14 # Variables for 'waf dist'
15 NAME = 'dictix'
16 APPNAME = 'Dictix'
17 VERSION = '0.1'
19 # Mandatory variables
20 srcdir = '.'
21 blddir = 'build'
23 def display_msg(conf, msg, status = None, color = None):
24 color = 'CYAN'
25 if type(status) == bool and status or status == "True":
26 color = 'GREEN'
27 elif type(status) == bool and not status or status == "False":
28 color = 'YELLOW'
29 Utils.pprint('NORMAL', "%s :" % msg.ljust(conf.line_just), sep='')
30 Utils.pprint(color, status)
33 def set_options(opt):
34 opt.tool_options('compiler_cc vala')
37 def configure(conf):
38 conf.check_tool('compiler_cc vala')
39 conf.check_tool('intltool')
41 conf.check_cfg(package='glib-2.0', uselib_store='GLIB', atleast_version='2.28.0', args='--cflags --libs', mandatory=True)
42 conf.check_cfg(package='gobject-2.0', uselib_store='GOBJECT', atleast_version='2.28.0', args='--cflags --libs', mandatory=True)
43 conf.check_cfg(package='gmodule-export-2.0', uselib_store='GMODULE', atleast_version='2.28.0', args='--cflags --libs', mandatory=True)
44 conf.check_cfg(package='gtk+-3.0', uselib_store='GTK', atleast_version='3.0.0', args='--cflags --libs', mandatory=True)
45 conf.check_cfg(package='gstreamer-0.10', uselib_store='GST', atleast_version='0.10.20', args='--cflags --libs', mandatory=True)
46 conf.check_cfg(package='gstreamer-base-0.10', uselib_store='GST_BASE', atleast_version='0.10.20', args='--cflags --libs', mandatory=True)
47 conf.check_cfg(package='gstreamer-pbutils-0.10', uselib_store='GST_PBUTILS', atleast_version='0.10.20', args='--cflags --libs', mandatory=True)
48 conf.check_cfg(package='libnotify', uselib_store='NOTIFY', atleast_version='0.7.0', args='--cflags --libs', mandatory=True)
50 conf.define('PACKAGE', NAME)
51 conf.define('PACKAGE_NAME', APPNAME)
52 conf.define('PACKAGE_VERSION', VERSION)
53 conf.define('PACKAGE_DATADIR', conf.env['PREFIX'] + '/share/')
54 conf.define('PACKAGE_LOCALEDIR', conf.env['PREFIX'] + '/share/locale/')
55 conf.define('PACKAGE_SCHEMA', '/org/gnome/' + NAME)
56 conf.define('GETTEXT_PACKAGE', APPNAME + '-' + VERSION)
58 conf.env['PREFIX'] = os.path.abspath(os.path.expanduser(os.path.normpath(conf.env['PREFIX'])))
59 conf.env.append_value('CCFLAGS', '-DHAVE_CONFIG_H --export-dynamic -Wall -g')
60 conf.write_config_header('config.h')
62 display_msg(conf, "Install prefix", conf.env['PREFIX'])
64 def build(bld):
65 # C source files
66 libdictix_sources = '''
67 libdictix/dix-player.c
68 libdictix/dix-recorder.c
69 libdictix/dix-tag-reader.c
70 libdictix/dix-tag-writer.c
71 libdictix/dix-transcoder.c
72 '''
74 # Vala source files
75 dictix_sources = '''
76 src/dix-about.vala
77 src/dix-main.vala
78 src/dix-preferences.vala
79 src/dix-properties.vala
80 src/dix-ui.vala
81 src/dix-utils.vala
82 '''
84 # libdictix build
85 obj = bld.new_task_gen('cc', 'staticlib')
86 obj.source = libdictix_sources
87 obj.includes = ['.', './libdictix']
88 obj.name = 'libdictix_static'
89 obj.target = 'dictix_static'
90 obj.install_path = ''
91 obj.uselib = 'GLIB GOBJECT GST GST_BASE GST_PBUTILS'
92 obj.ccflags = ['-Wall', '-g']
94 # dictix build
95 obj = bld.new_task_gen('cc', 'program')
96 obj.source = dictix_sources
97 obj.includes = ['.', 'src/', 'libdictix/']
98 obj.vapi_dirs = 'vapi/',
99 obj.name = 'Dictix'
100 obj.target = 'dictix'
101 obj.vnum = VERSION
102 obj.install_path = os.path.join('${PREFIX}', 'bin');
103 obj.uselib = 'GLIB GOBJECT GMODULE GTK GST NOTIFY'
104 obj.packages = 'glib-2.0 gobject-2.0 gtk+-3.0 gstreamer-0.10 libnotify'
105 obj.packages += ' config libdictix'
106 obj.ccflags = ['-include', 'config.h']
107 obj.uselib_local = 'libdictix_static'
109 bld.install_files(bld.env['DATADIR'] + "/" + NAME, 'data/main.ui')
110 bld.install_files(bld.env['DATADIR'] + "/" + NAME, 'data/menu.ui')
112 bld.install_files(bld.env['DATADIR'] + '/icons/hicolor/16x16/apps', 'data/icons/16x16/dictix.png')
113 bld.install_files(bld.env['DATADIR'] + '/icons/hicolor/22x22/apps', 'data/icons/22x22/dictix.png')
114 bld.install_files(bld.env['DATADIR'] + '/icons/hicolor/24x24/apps', 'data/icons/24x24/dictix.png')
115 bld.install_files(bld.env['DATADIR'] + '/icons/hicolor/32x32/apps', 'data/icons/32x32/dictix.png')
116 bld.install_files(bld.env['DATADIR'] + '/icons/hicolor/48x48/apps', 'data/icons/48x48/dictix.png')
117 bld.install_files(bld.env['DATADIR'] + '/icons/hicolor/256x256/apps', 'data/icons/256x256/dictix.png')
118 bld.install_files(bld.env['DATADIR'] + '/icons/hicolor/scalable/apps', 'data/icons/scalable/dictix.svg')
120 obj = bld.new_task_gen(features = 'subst', source = 'data/dictix.desktop.in')
121 bld.install_files(bld.env['DATADIR'] + '/applications', 'data/dictix.desktop')
123 def shutdown():
124 gnome.postinstall_icons()