Add Spectrograph sources and test files.
[dictix.git] / wscript
blob9145b3ca3d2447dc25d549967a7f2662c1c41731
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 libdictix/dix-spectrograph.c
73 '''
75 # Vala source files
76 dictix_sources = '''
77 src/dix-about.vala
78 src/dix-main.vala
79 src/dix-preferences.vala
80 src/dix-properties.vala
81 src/dix-ui.vala
82 src/dix-utils.vala
83 '''
85 # libdictix build
86 obj = bld.new_task_gen('cc', 'staticlib')
87 obj.source = libdictix_sources
88 obj.includes = ['.', './libdictix']
89 obj.name = 'libdictix_static'
90 obj.target = 'dictix_static'
91 obj.install_path = ''
92 obj.uselib = 'GLIB GOBJECT GTK GST GST_BASE GST_PBUTILS'
93 obj.ccflags = ['-Wall', '-g']
95 # dictix build
96 obj = bld.new_task_gen('cc', 'program')
97 obj.source = dictix_sources
98 obj.includes = ['.', 'src/', 'libdictix/']
99 obj.vapi_dirs = 'vapi/',
100 obj.name = 'Dictix'
101 obj.target = 'dictix'
102 obj.vnum = VERSION
103 obj.install_path = os.path.join('${PREFIX}', 'bin');
104 obj.uselib = 'GLIB GOBJECT GMODULE GTK GST NOTIFY'
105 obj.packages = 'glib-2.0 gobject-2.0 gtk+-3.0 gstreamer-0.10 libnotify'
106 obj.packages += ' config libdictix'
107 obj.ccflags = ['-include', 'config.h']
108 obj.uselib_local = 'libdictix_static'
110 obj = bld.new_task_gen('cc', 'program')
111 obj.source = 'spectrograph-test.c'
112 obj.includes = ['.', 'libdictix/']
113 obj.name = 'Spectrograph-test'
114 obj.target = 'spectrograph-test'
115 obj.vnum = VERSION
116 obj.uselib = 'GLIB GOBJECT GTK GST'
117 obj.packages = 'glib-2.0 gobject-2.0 gtk+-3.0 gstreamer-0.10'
118 obj.packages += ' config libdictix'
119 obj.ccflags = ['-include', 'config.h']
120 obj.uselib_local = 'libdictix_static'
122 bld.install_files(bld.env['DATADIR'] + "/" + NAME, 'data/main.ui')
123 bld.install_files(bld.env['DATADIR'] + "/" + NAME, 'data/menu.ui')
125 bld.install_files(bld.env['DATADIR'] + '/icons/hicolor/16x16/apps', 'data/icons/16x16/dictix.png')
126 bld.install_files(bld.env['DATADIR'] + '/icons/hicolor/22x22/apps', 'data/icons/22x22/dictix.png')
127 bld.install_files(bld.env['DATADIR'] + '/icons/hicolor/24x24/apps', 'data/icons/24x24/dictix.png')
128 bld.install_files(bld.env['DATADIR'] + '/icons/hicolor/32x32/apps', 'data/icons/32x32/dictix.png')
129 bld.install_files(bld.env['DATADIR'] + '/icons/hicolor/48x48/apps', 'data/icons/48x48/dictix.png')
130 bld.install_files(bld.env['DATADIR'] + '/icons/hicolor/256x256/apps', 'data/icons/256x256/dictix.png')
131 bld.install_files(bld.env['DATADIR'] + '/icons/hicolor/scalable/apps', 'data/icons/scalable/dictix.svg')
133 obj = bld.new_task_gen(features = 'subst', source = 'data/dictix.desktop.in')
134 bld.install_files(bld.env['DATADIR'] + '/applications', 'data/dictix.desktop')
136 def shutdown():
137 gnome.postinstall_icons()