Random work from the last mounth...
[dictix.git] / wscript
bloba6d4d9a75f1bcef780a6f2a58941420848a290c9
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 -lm')
60 conf.env.append_value('LINKFLAGS', '-lm')
61 conf.write_config_header('config.h')
63 display_msg(conf, "Install prefix", conf.env['PREFIX'])
65 def build(bld):
66 # C source files
67 libdictix_sources = '''
68 libdictix/dix-player.c
69 libdictix/dix-recorder.c
70 libdictix/dix-tag-reader.c
71 libdictix/dix-tag-writer.c
72 libdictix/dix-transcoder.c
73 libdictix/dix-spectrograph.c
74 '''
76 # Vala source files
77 dictix_sources = '''
78 src/dix-about.vala
79 src/dix-main.vala
80 src/dix-preferences.vala
81 src/dix-properties.vala
82 src/dix-ui.vala
83 src/dix-utils.vala
84 '''
86 # libdictix build
87 obj = bld.new_task_gen('cc', 'staticlib')
88 obj.source = libdictix_sources
89 obj.includes = ['.', './libdictix']
90 obj.name = 'libdictix_static'
91 obj.target = 'dictix_static'
92 obj.install_path = ''
93 obj.uselib = 'GLIB GOBJECT GTK GST GST_BASE GST_PBUTILS'
94 obj.ccflags = ['-Wall', '-g']
96 # dictix build
97 obj = bld.new_task_gen('cc', 'program')
98 obj.source = dictix_sources
99 obj.includes = ['.', 'src/', 'libdictix/']
100 obj.vapi_dirs = 'vapi/',
101 obj.name = 'Dictix'
102 obj.target = 'dictix'
103 obj.vnum = VERSION
104 obj.install_path = os.path.join('${PREFIX}', 'bin');
105 obj.uselib = 'GLIB GOBJECT GMODULE GTK GST NOTIFY'
106 obj.packages = 'glib-2.0 gobject-2.0 gtk+-3.0 gstreamer-0.10 libnotify'
107 obj.packages += ' config libdictix'
108 obj.ccflags = ['-include', 'config.h']
109 obj.uselib_local = 'libdictix_static'
111 # obj = bld.new_task_gen('cc', 'program')
112 # obj.source = 'spectrograph-test.c'
113 # obj.includes = ['.', 'libdictix/']
114 # obj.name = 'Spectrograph-test'
115 # obj.target = 'spectrograph-test'
116 # obj.vnum = VERSION
117 # obj.uselib = 'GLIB GOBJECT GTK GST'
118 # obj.packages = 'glib-2.0 gobject-2.0 gtk+-3.0 gstreamer-0.10'
119 # obj.packages += ' config libdictix'
120 # obj.ccflags = ['-include', 'config.h']
121 # obj.uselib_local = 'libdictix_static'
123 bld.install_files(bld.env['DATADIR'] + "/" + NAME, 'data/main.ui')
124 bld.install_files(bld.env['DATADIR'] + "/" + NAME, 'data/menu.ui')
126 bld.install_files(bld.env['DATADIR'] + '/icons/hicolor/16x16/apps', 'data/icons/16x16/dictix.png')
127 bld.install_files(bld.env['DATADIR'] + '/icons/hicolor/22x22/apps', 'data/icons/22x22/dictix.png')
128 bld.install_files(bld.env['DATADIR'] + '/icons/hicolor/24x24/apps', 'data/icons/24x24/dictix.png')
129 bld.install_files(bld.env['DATADIR'] + '/icons/hicolor/32x32/apps', 'data/icons/32x32/dictix.png')
130 bld.install_files(bld.env['DATADIR'] + '/icons/hicolor/48x48/apps', 'data/icons/48x48/dictix.png')
131 bld.install_files(bld.env['DATADIR'] + '/icons/hicolor/256x256/apps', 'data/icons/256x256/dictix.png')
132 bld.install_files(bld.env['DATADIR'] + '/icons/hicolor/scalable/apps', 'data/icons/scalable/dictix.svg')
134 obj = bld.new_task_gen(features = 'subst', source = 'data/dictix.desktop.in')
135 bld.install_files(bld.env['DATADIR'] + '/applications', 'data/dictix.desktop')
137 def shutdown():
138 gnome.postinstall_icons()