ladish-1.2
[ladish.git] / wscript
blobeadc720723a2f637bf5295dbbb3791fcf2450185
1 #! /usr/bin/env python
2 # encoding: utf-8
4 from __future__ import with_statement
7 parallel_debug = False
9 APPNAME='ladish'
10 VERSION='1.2'
11 DBUS_NAME_BASE = 'org.ladish'
12 RELEASE = True
14 # these variables are mandatory ('/' are converted automatically)
15 top = '.'
16 out = 'build'
18 import os, sys, re, io, optparse, shutil, tokenize
19 from hashlib import md5
21 from waflib import Errors, Utils, Options, Logs, Scripting
22 from waflib import Configure
23 from waflib import Context
25 def display_msg(conf, msg="", status = None, color = None):
26 if status:
27 conf.msg(msg, status, color)
28 else:
29 Logs.pprint('NORMAL', msg)
31 def display_raw_text(conf, text, color = 'NORMAL'):
32 Logs.pprint(color, text, sep = '')
34 def display_line(conf, text, color = 'NORMAL'):
35 Logs.pprint(color, text, sep = os.linesep)
37 def yesno(bool):
38 if bool:
39 return "yes"
40 else:
41 return "no"
43 def options(opt):
44 opt.load('compiler_c')
45 opt.load('compiler_cxx')
46 opt.load('python')
47 opt.add_option('--enable-pkg-config-dbus-service-dir', action='store_true', default=False, help='force D-Bus service install dir to be one returned by pkg-config')
48 opt.add_option('--enable-gladish', action='store_true', default=False, help='Build gladish')
49 opt.add_option('--enable-liblash', action='store_true', default=False, help='Build LASH compatibility library')
50 opt.add_option('--enable-pylash', action='store_true', default=False, help='Build python bindings for LASH compatibility library')
51 opt.add_option('--debug', action='store_true', default=False, dest='debug', help="Build debuggable binaries")
52 opt.add_option('--siginfo', action='store_true', default=False, dest='siginfo', help="Log backtrace on fatal signal")
53 opt.add_option('--doxygen', action='store_true', default=False, help='Enable build of doxygen documentation')
54 opt.add_option('--distnodeps', action='store_true', default=False, help="When creating distribution tarball, don't package git submodules")
55 opt.add_option('--distname', type='string', default=None, help="Name for the distribution tarball")
56 opt.add_option('--distsuffix', type='string', default="", help="String to append to the distribution tarball name")
57 opt.add_option('--tagdist', action='store_true', default=False, help='Create of git tag for distname')
58 opt.add_option('--libdir', type='string', default=None, help='Define lib dir')
59 opt.add_option('--docdir', type='string', default=None, help="Define doc dir [default: PREFIX'/share/doc/" + APPNAME + ']')
62 if parallel_debug:
63 opt.load('parallel_debug')
65 def add_cflag(conf, flag):
66 conf.env.prepend_value('CXXFLAGS', flag)
67 conf.env.prepend_value('CFLAGS', flag)
69 def add_linkflag(conf, flag):
70 conf.env.prepend_value('LINKFLAGS', flag)
72 def check_gcc_optimizations_enabled(flags):
73 gcc_optimizations_enabled = False
74 for flag in flags:
75 if len(flag) < 2 or flag[0] != '-' or flag[1] != 'O':
76 continue
77 if len(flag) == 2:
78 gcc_optimizations_enabled = True;
79 else:
80 gcc_optimizations_enabled = flag[2] != '0';
81 return gcc_optimizations_enabled
83 def create_service_taskgen(bld, target, opath, binary):
84 bld(
85 features = 'subst', # the feature 'subst' overrides the source/target processing
86 source = os.path.join('daemon', 'dbus.service.in'), # list of string or nodes
87 target = target, # list of strings or nodes
88 install_path = bld.env['DBUS_SERVICES_DIR'] + os.path.sep,
89 # variables to use in the substitution
90 dbus_object_path = opath,
91 daemon_bin_path = os.path.join(bld.env['PREFIX'], 'bin', binary))
93 def configure(conf):
94 conf.load('compiler_c')
95 conf.load('compiler_cxx')
96 conf.load('python')
97 conf.load('intltool')
98 if parallel_debug:
99 conf.load('parallel_debug')
101 # dladdr() is used by daemon/siginfo.c
102 # dlvsym() is used by the alsapid library
103 conf.check_cc(msg="Checking for libdl", lib=['dl'], uselib_store='DL')
105 # forkpty() is used by ladishd
106 conf.check_cc(msg="Checking for libutil", lib=['util'], uselib_store='UTIL')
108 conf.check_cfg(
109 package = 'jack',
110 mandatory = True,
111 errmsg = "not installed, see http://jackaudio.org/",
112 args = '--cflags --libs')
114 conf.check_cfg(
115 package = 'alsa',
116 mandatory = True,
117 errmsg = "not installed, see http://www.alsa-project.org/",
118 args = '--cflags')
120 conf.check_cfg(
121 package = 'dbus-1',
122 atleast_version = '1.0.0',
123 mandatory = True,
124 errmsg = "not installed, see http://dbus.freedesktop.org/",
125 args = '--cflags --libs')
127 dbus_dir = conf.check_cfg(package='dbus-1', args='--variable=session_bus_services_dir', msg="Retrieving D-Bus services dir")
128 if not dbus_dir:
129 return
131 dbus_dir = dbus_dir.strip()
132 conf.env['DBUS_SERVICES_DIR_REAL'] = dbus_dir
134 if Options.options.enable_pkg_config_dbus_service_dir:
135 conf.env['DBUS_SERVICES_DIR'] = dbus_dir
136 else:
137 conf.env['DBUS_SERVICES_DIR'] = os.path.join(os.path.normpath(conf.env['PREFIX']), 'share', 'dbus-1', 'services')
139 if Options.options.libdir:
140 conf.env['LIBDIR'] = Options.options.libdir
141 else:
142 conf.env['LIBDIR'] = os.path.join(os.path.normpath(conf.env['PREFIX']), 'lib')
144 if Options.options.docdir:
145 conf.env['DOCDIR'] = Options.options.docdir
146 else:
147 conf.env['DOCDIR'] = os.path.join(os.path.normpath(conf.env['PREFIX']), 'share', 'doc', APPNAME)
149 conf.env['BUILD_DOXYGEN_DOCS'] = Options.options.doxygen
151 conf.check_cfg(
152 package = 'uuid',
153 mandatory = True,
154 errmsg = "not installed, see http://e2fsprogs.sourceforge.net/",
155 args = '--cflags --libs')
157 conf.check(
158 header_name='expat.h',
159 mandatory = True,
160 errmsg = "not installed, see http://expat.sourceforge.net/")
162 conf.env['LIB_EXPAT'] = ['expat']
164 if Options.options.enable_gladish:
165 conf.check_cfg(
166 package = 'glib-2.0',
167 errmsg = "not installed, see http://www.gtk.org/",
168 args = '--cflags --libs')
169 conf.check_cfg(
170 package = 'dbus-glib-1',
171 errmsg = "not installed, see http://dbus.freedesktop.org/",
172 args = '--cflags --libs')
173 conf.check_cfg(
174 package = 'gtk+-2.0',
175 atleast_version = '2.20.0',
176 errmsg = "not installed, see http://www.gtk.org/",
177 args = '--cflags --libs')
178 conf.check_cfg(
179 package = 'gtkmm-2.4',
180 atleast_version = '2.10.0',
181 errmsg = "not installed, see http://www.gtkmm.org",
182 args = '--cflags --libs')
184 conf.check_cfg(
185 package = 'libgnomecanvasmm-2.6',
186 atleast_version = '2.6.0',
187 errmsg = "not installed, see http://www.gtkmm.org",
188 args = '--cflags --libs')
190 #autowaf.check_pkg(conf, 'libgvc', uselib_store='AGRAPH', atleast_version='2.8', mandatory=False)
192 # The boost headers package (e.g. libboost-dev) is needed
193 conf.multicheck(
194 {'header_name': "boost/shared_ptr.hpp"},
195 {'header_name': "boost/weak_ptr.hpp"},
196 {'header_name': "boost/enable_shared_from_this.hpp"},
197 {'header_name': "boost/utility.hpp"},
198 msg = "Checking for boost headers",
199 mandatory = False)
200 display_msg(conf, 'Found boost/shared_ptr.hpp',
201 yesno(conf.env['HAVE_BOOST_SHARED_PTR_HPP']))
202 display_msg(conf, 'Found boost/weak_ptr.hpp',
203 yesno(conf.env['HAVE_BOOST_WEAK_PTR_HPP']))
204 display_msg(conf, 'Found boost/enable_shared_from_this.hpp',
205 yesno(conf.env['HAVE_BOOST_ENABLE_SHARED_FROM_THIS_HPP']))
206 display_msg(conf, 'Found boost/utility.hpp',
207 yesno(conf.env['HAVE_BOOST_UTILITY_HPP']))
208 if not (conf.env['HAVE_BOOST_SHARED_PTR_HPP'] and \
209 conf.env['HAVE_BOOST_WEAK_PTR_HPP'] and \
210 conf.env['HAVE_BOOST_ENABLE_SHARED_FROM_THIS_HPP'] and \
211 conf.env['HAVE_BOOST_UTILITY_HPP']):
212 display_line(conf, "One or more boost headers not found, see http://boost.org/")
213 sys.exit(1)
215 conf.env['BUILD_GLADISH'] = Options.options.enable_gladish
216 conf.env['BUILD_LIBLASH'] = Options.options.enable_liblash
217 conf.env['BUILD_PYLASH'] = Options.options.enable_pylash
218 conf.env['BUILD_SIGINFO'] = Options.options.siginfo
219 if conf.env['BUILD_PYLASH'] and not conf.env['BUILD_LIBLASH']:
220 conf.fatal("pylash build was requested but liblash was not")
221 conf.env['BUILD_PYLASH'] = False
222 if conf.env['BUILD_PYLASH']:
223 conf.check_python_version()
224 conf.check_python_headers()
226 add_cflag(conf, '-fvisibility=hidden')
228 conf.env['BUILD_WERROR'] = False #not RELEASE
229 add_cflag(conf, '-Wall')
230 # lash_wrap code is generated by swig and causes warnings
231 if not conf.env['BUILD_PYLASH']:
232 add_cflag(conf, '-Wextra')
233 conf.env.append_unique('CXXFLAGS', '-Wno-unused-parameter') # the UNUSED() macro doesnt work for C++
235 add_cflag(conf, '-Wimplicit-fallthrough=2')
237 if conf.env['BUILD_WERROR']:
238 add_cflag(conf, '-Werror')
239 # for pre gcc-4.4, enable optimizations so use of uninitialized variables gets detected
240 try:
241 is_gcc = conf.env['CC_NAME'] == 'gcc'
242 if is_gcc:
243 gcc_ver = []
244 for n in conf.env['CC_VERSION']:
245 gcc_ver.append(int(n))
246 if gcc_ver[0] < 4 or gcc_ver[1] < 4:
247 #print "optimize force enable is required"
248 if not check_gcc_optimizations_enabled(conf.env['CFLAGS']):
249 if Options.options.debug:
250 print ("C optimization must be forced in order to enable -Wuninitialized")
251 print ("However this will not be made because debug compilation is enabled")
252 else:
253 print ("C optimization forced in order to enable -Wuninitialized")
254 conf.env.append_unique('CFLAGS', "-O")
255 except:
256 pass
258 conf.env['BUILD_DEBUG'] = Options.options.debug
259 if conf.env['BUILD_DEBUG']:
260 add_cflag(conf, '-g')
261 add_cflag(conf, '-O0')
262 add_linkflag(conf, '-g')
264 conf.env['DATA_DIR'] = os.path.normpath(os.path.join(conf.env['PREFIX'], 'share', APPNAME))
265 conf.env['LOCALE_DIR'] = os.path.normpath(os.path.join(conf.env['PREFIX'], 'share', 'locale'))
267 # write some parts of the configure environment to the config.h file
268 conf.define('DATA_DIR', conf.env['DATA_DIR'])
269 conf.define('LOCALE_DIR', conf.env['LOCALE_DIR'])
270 conf.define('PACKAGE_VERSION', VERSION)
271 conf.define('DBUS_NAME_BASE', DBUS_NAME_BASE)
272 conf.define('DBUS_BASE_PATH', '/' + DBUS_NAME_BASE.replace('.', '/'))
273 conf.define('BASE_NAME', APPNAME)
274 conf.define('SIGINFO_ENABLED', conf.env['BUILD_SIGINFO'])
275 conf.define('_GNU_SOURCE', 1)
276 conf.write_config_header('config.h')
278 display_msg(conf)
280 display_msg(conf, "==================")
281 version_msg = APPNAME + "-" + VERSION
283 if os.access('version.h', os.R_OK):
284 data = open('version.h').read()
285 m = re.match(r'^#define GIT_VERSION "([^"]*)"$', data)
286 if m != None:
287 version_msg += " exported from " + m.group(1)
288 elif os.access('.git', os.R_OK):
289 version_msg += " git revision will checked and eventually updated during build"
291 display_msg(conf, version_msg)
293 display_msg(conf)
294 display_msg(conf, "Install prefix", conf.env['PREFIX'], 'CYAN')
296 display_msg(conf, 'Build gladish', yesno(conf.env['BUILD_GLADISH']))
297 display_msg(conf, 'Build liblash', yesno(Options.options.enable_liblash))
298 display_msg(conf, 'Build pylash', yesno(conf.env['BUILD_PYLASH']))
299 display_msg(conf, 'Build with siginfo', yesno(conf.env['BUILD_SIGINFO']))
300 display_msg(conf, 'Treat warnings as errors', yesno(conf.env['BUILD_WERROR']))
301 display_msg(conf, 'Debuggable binaries', yesno(conf.env['BUILD_DEBUG']))
302 display_msg(conf, 'Build doxygen documentation', yesno(conf.env['BUILD_DOXYGEN_DOCS']))
304 if conf.env['DBUS_SERVICES_DIR'] != conf.env['DBUS_SERVICES_DIR_REAL']:
305 display_msg(conf)
306 display_line(conf, "WARNING: D-Bus session services directory as reported by pkg-config is", 'RED')
307 display_raw_text(conf, "WARNING:", 'RED')
308 display_line(conf, conf.env['DBUS_SERVICES_DIR_REAL'], 'CYAN')
309 display_line(conf, 'WARNING: but service file will be installed in', 'RED')
310 display_raw_text(conf, "WARNING:", 'RED')
311 display_line(conf, conf.env['DBUS_SERVICES_DIR'], 'CYAN')
312 display_line(conf, 'WARNING: You may need to adjust your D-Bus configuration after installing ladish', 'RED')
313 display_line(conf, 'WARNING: You can override dbus service install directory', 'RED')
314 display_line(conf, 'WARNING: with --enable-pkg-config-dbus-service-dir option to this script', 'RED')
316 display_msg(conf, 'C compiler flags', repr(conf.env['CFLAGS']))
317 display_msg(conf, 'C++ compiler flags', repr(conf.env['CXXFLAGS']))
318 display_msg(conf, 'Linker flags', repr(conf.env['LINKFLAGS']))
320 if not conf.env['BUILD_GLADISH']:
321 display_msg(conf)
322 display_line(conf, "WARNING: The GUI frontend will not built", 'RED')
324 display_msg(conf)
326 def git_ver(self):
327 bld = self.generator.bld
328 header = self.outputs[0].abspath()
329 if os.access('./version.h', os.R_OK):
330 header = os.path.join(os.getcwd(), out, "version.h")
331 shutil.copy('./version.h', header)
332 data = open(header).read()
333 m = re.match(r'^#define GIT_VERSION "([^"]*)"$', data)
334 if m != None:
335 self.ver = m.group(1)
336 Logs.pprint('BLUE', "tarball from git revision " + self.ver)
337 else:
338 self.ver = "tarball"
339 return
341 if bld.srcnode.find_node('.git'):
342 self.ver = bld.cmd_and_log("LANG= git rev-parse HEAD", quiet=Context.BOTH).splitlines()[0]
343 if bld.cmd_and_log("LANG= git diff-index --name-only HEAD", quiet=Context.BOTH).splitlines():
344 self.ver += "-dirty"
346 Logs.pprint('BLUE', "git revision " + self.ver)
347 else:
348 self.ver = "unknown"
350 fi = open(header, 'w')
351 fi.write('#define GIT_VERSION "%s"\n' % self.ver)
352 fi.close()
354 def build(bld):
355 if not bld.env['DATA_DIR']:
356 raise "DATA_DIR is emtpy"
358 bld(rule=git_ver, target='version.h', update_outputs=True, always=True, ext_out=['.h'])
360 daemon = bld.program(source = [], features = 'c cprogram', includes = [bld.path.get_bld()])
361 daemon.target = 'ladishd'
362 daemon.uselib = 'DBUS-1 UUID EXPAT DL UTIL'
363 daemon.ver_header = 'version.h'
364 # Make backtrace function lookup to work for functions in the executable itself
365 daemon.env.append_value("LINKFLAGS", ["-Wl,-E"])
366 daemon.defines = ["HAVE_CONFIG_H"]
368 daemon.source = ["string_constants.c"]
370 for source in [
371 'main.c',
372 'loader.c',
373 'proctitle.c',
374 'appdb.c',
375 'procfs.c',
376 'control.c',
377 'studio.c',
378 'graph.c',
379 'graph_manager.c',
380 'client.c',
381 'port.c',
382 'virtualizer.c',
383 'dict.c',
384 'graph_dict.c',
385 'escape.c',
386 'studio_jack_conf.c',
387 'studio_list.c',
388 'save.c',
389 'load.c',
390 'cmd_load_studio.c',
391 'cmd_new_studio.c',
392 'cmd_rename_studio.c',
393 'cmd_save_studio.c',
394 'cmd_start_studio.c',
395 'cmd_stop_studio.c',
396 'cmd_unload_studio.c',
397 'cmd_new_app.c',
398 'cmd_change_app_state.c',
399 'cmd_remove_app.c',
400 'cmd_create_room.c',
401 'cmd_delete_room.c',
402 'cmd_save_project.c',
403 'cmd_unload_project.c',
404 'cmd_load_project.c',
405 'cmd_exit.c',
406 'cqueue.c',
407 'app_supervisor.c',
408 'room.c',
409 'room_save.c',
410 'room_load.c',
411 'recent_store.c',
412 'recent_projects.c',
413 'check_integrity.c',
414 'lash_server.c',
415 'jack_session.c',
417 daemon.source.append(os.path.join("daemon", source))
419 if Options.options.siginfo:
420 daemon.source.append(os.path.join("daemon", 'siginfo.c'))
422 for source in [
423 'jack_proxy.c',
424 'graph_proxy.c',
425 'a2j_proxy.c',
426 "jmcore_proxy.c",
427 "notify_proxy.c",
428 "conf_proxy.c",
429 "lash_client_proxy.c",
431 daemon.source.append(os.path.join("proxies", source))
433 for source in [
434 'signal.c',
435 'method.c',
436 'object_path.c',
437 'interface.c',
438 'helpers.c',
440 daemon.source.append(os.path.join("cdbus", source))
442 for source in [
443 'log.c',
444 'time.c',
445 'dirhelpers.c',
446 'catdup.c',
448 daemon.source.append(os.path.join("common", source))
450 daemon.source.append(os.path.join("alsapid", "helper.c"))
452 # process dbus.service.in -> ladish.service
453 create_service_taskgen(bld, DBUS_NAME_BASE + '.service', DBUS_NAME_BASE, daemon.target)
455 #####################################################
456 # jmcore
457 jmcore = bld.program(source = [], features = 'c cprogram', includes = [bld.path.get_bld()])
458 jmcore.target = 'jmcore'
459 jmcore.uselib = 'DBUS-1 JACK'
460 jmcore.defines = ['LOG_OUTPUT_STDOUT']
461 jmcore.source = ['jmcore.c']
463 for source in [
464 'log.c',
466 jmcore.source.append(os.path.join("common", source))
468 for source in [
469 #'signal.c',
470 'method.c',
471 'object_path.c',
472 'interface.c',
473 'helpers.c',
475 jmcore.source.append(os.path.join("cdbus", source))
477 create_service_taskgen(bld, DBUS_NAME_BASE + '.jmcore.service', DBUS_NAME_BASE + ".jmcore", jmcore.target)
479 #####################################################
480 # conf
481 ladiconfd = bld.program(source = [], features = 'c cprogram', includes = [bld.path.get_bld()])
482 ladiconfd.target = 'ladiconfd'
483 ladiconfd.uselib = 'DBUS-1'
484 ladiconfd.defines = ['LOG_OUTPUT_STDOUT']
485 ladiconfd.source = ['conf.c']
487 for source in [
488 'log.c',
489 'dirhelpers.c',
490 'catdup.c',
492 ladiconfd.source.append(os.path.join("common", source))
494 for source in [
495 'signal.c',
496 'method.c',
497 'object_path.c',
498 'interface.c',
499 'helpers.c',
501 ladiconfd.source.append(os.path.join("cdbus", source))
503 create_service_taskgen(bld, DBUS_NAME_BASE + '.conf.service', DBUS_NAME_BASE + ".conf", ladiconfd.target)
505 #####################################################
506 # alsapid
507 alsapid = bld.shlib(source = [], features = 'c cshlib', includes = [bld.path.get_bld()])
508 alsapid.uselib = 'DL'
509 alsapid.target = 'alsapid'
510 for source in [
511 'lib.c',
512 'helper.c',
514 alsapid.source.append(os.path.join("alsapid", source))
516 #####################################################
517 # liblash
518 if bld.env['BUILD_LIBLASH']:
519 liblash = bld.shlib(source = [], features = 'c cshlib', includes = [bld.path.get_bld()])
520 liblash.uselib = 'DBUS-1'
521 liblash.target = 'lash'
522 liblash.vnum = "1.1.1"
523 liblash.defines = ['LOG_OUTPUT_STDOUT']
524 liblash.source = [os.path.join("lash_compat", "liblash", 'lash.c')]
526 for source in [
527 'dirhelpers.c',
528 'catdup.c',
529 'file.c',
530 'log.c',
532 liblash.source.append(os.path.join("common", source))
534 for source in [
535 'method.c',
536 'object_path.c',
537 'interface.c',
538 'helpers.c',
540 liblash.source.append(os.path.join("cdbus", source))
542 bld.install_files('${PREFIX}/include/lash-1.0/lash', bld.path.ant_glob('lash_compat/liblash/lash/*.h'))
544 # process lash-1.0.pc.in -> lash-1.0.pc
545 bld(
546 features = 'subst', # the feature 'subst' overrides the source/target processing
547 source = os.path.join("lash_compat", 'lash-1.0.pc.in'), # list of string or nodes
548 target = 'lash-1.0.pc', # list of strings or nodes
549 install_path = '${LIBDIR}/pkgconfig/',
550 # variables to use in the substitution
551 prefix = bld.env['PREFIX'],
552 exec_prefix = bld.env['PREFIX'],
553 libdir = bld.env['LIBDIR'],
554 includedir = os.path.normpath(bld.env['PREFIX'] + '/include'))
556 #####################################################
557 # pylash
558 if bld.env['BUILD_PYLASH']:
559 pylash = bld.shlib(source = [], features = 'c cshlib pyext', includes = ["lash_compat/liblash"])
560 pylash.target = '_lash'
561 pylash.use = 'lash'
562 pylash.install_path = '${PYTHONDIR}'
564 for source in [
565 'lash.c',
566 'lash_wrap.c',
568 pylash.source.append(os.path.join("lash_compat", "pylash", source))
570 bld.install_files('${PYTHONDIR}', os.path.join("lash_compat", "pylash", "lash.py"))
572 #####################################################
573 # gladish
574 if bld.env['BUILD_GLADISH']:
575 gladish = bld.program(source = [], features = 'c cxx cxxprogram', includes = [bld.path.get_bld()])
576 gladish.target = 'gladish'
577 gladish.defines = ['LOG_OUTPUT_STDOUT']
578 gladish.uselib = 'DBUS-1 DBUS-GLIB-1 GTKMM-2.4 LIBGNOMECANVASMM-2.6 GTK+-2.0'
580 gladish.source = ["string_constants.c"]
582 for source in [
583 'main.c',
584 'load_project_dialog.c',
585 'save_project_dialog.c',
586 'project_properties.c',
587 'world_tree.c',
588 'graph_view.c',
589 'canvas.cpp',
590 'graph_canvas.c',
591 'gtk_builder.c',
592 'ask_dialog.c',
593 'create_room_dialog.c',
594 'menu.c',
595 'dynmenu.c',
596 'toolbar.c',
597 'about.c',
598 'dbus.c',
599 'studio.c',
600 'studio_list.c',
601 'dialogs.c',
602 'jack.c',
603 'control.c',
604 'pixbuf.c',
605 'room.c',
606 'statusbar.c',
607 'action.c',
608 'settings.c',
609 'zoom.c',
611 gladish.source.append(os.path.join("gui", source))
613 for source in [
614 'Module.cpp',
615 'Item.cpp',
616 'Port.cpp',
617 'Connection.cpp',
618 'Ellipse.cpp',
619 'Canvas.cpp',
620 'Connectable.cpp',
622 gladish.source.append(os.path.join("gui", "flowcanvas", source))
624 for source in [
625 'jack_proxy.c',
626 'a2j_proxy.c',
627 'graph_proxy.c',
628 'studio_proxy.c',
629 'control_proxy.c',
630 'app_supervisor_proxy.c',
631 "room_proxy.c",
632 "conf_proxy.c",
634 gladish.source.append(os.path.join("proxies", source))
636 for source in [
637 'method.c',
638 'helpers.c',
640 gladish.source.append(os.path.join("cdbus", source))
642 for source in [
643 'log.c',
644 'catdup.c',
645 'file.c',
647 gladish.source.append(os.path.join("common", source))
649 # GtkBuilder UI definitions (XML)
650 bld.install_files('${DATA_DIR}', 'gui/gladish.ui')
652 # 'Desktop' file (menu entry, icon, etc)
653 bld.install_files('${PREFIX}/share/applications/', 'gui/gladish.desktop', chmod=0o0644)
655 # Icons
656 icon_sizes = ['16x16', '22x22', '24x24', '32x32', '48x48', '256x256']
657 for icon_size in icon_sizes:
658 bld.path.ant_glob('art/' + icon_size + '/apps/*.png')
659 bld.install_files('${PREFIX}/share/icons/hicolor/' + icon_size + '/apps/', 'art/' + icon_size + '/apps/gladish.png')
661 status_images = []
662 for status in ["down", "unloaded", "started", "stopped", "warning", "error"]:
663 status_images.append("art/status_" + status + ".png")
665 bld.install_files('${DATA_DIR}', status_images)
666 bld.install_files('${DATA_DIR}', "art/ladish-logo-128x128.png")
668 bld(features='intltool_po', appname=APPNAME, podir='po', install_path="${LOCALE_DIR}")
670 bld.install_files('${PREFIX}/bin', 'ladish_control', chmod=0o0755)
672 bld.install_files('${DOCDIR}', ["AUTHORS", "README.adoc", "NEWS"])
673 bld.install_as('${DATA_DIR}/COPYING', "gpl2.txt")
675 if bld.env['BUILD_DOXYGEN_DOCS'] == True:
676 html_docs_source_dir = "build/default/html"
677 if bld.cmd == 'clean':
678 if os.access(html_docs_source_dir, os.R_OK):
679 Logs.pprint('CYAN', "Removing doxygen generated documentation...")
680 shutil.rmtree(html_docs_source_dir)
681 Logs.pprint('CYAN', "Removing doxygen generated documentation done.")
682 elif bld.cmd == 'build':
683 if not os.access(html_docs_source_dir, os.R_OK):
684 os.popen("doxygen").read()
685 else:
686 Logs.pprint('CYAN', "doxygen documentation already built.")
688 def get_tags_dirs():
689 source_root = os.path.dirname(Utils.g_module.root_path)
690 if 'relpath' in os.path.__all__:
691 source_root = os.path.relpath(source_root)
692 paths = source_root
693 paths += " " + os.path.join(source_root, "common")
694 paths += " " + os.path.join(source_root, "cdbus")
695 paths += " " + os.path.join(source_root, "proxies")
696 paths += " " + os.path.join(source_root, "daemon")
697 paths += " " + os.path.join(source_root, "gui")
698 paths += " " + os.path.join(source_root, "example-apps")
699 paths += " " + os.path.join(source_root, "lib")
700 paths += " " + os.path.join(source_root, "lash_compat", "liblash")
701 paths += " " + os.path.join(source_root, "lash_compat", "liblash", "lash")
702 return paths
704 def gtags(ctx):
705 '''build tag files for GNU global'''
706 cmd = "find %s -mindepth 1 -maxdepth 1 -name '*.[ch]' -print | gtags --statistics -f -" % get_tags_dirs()
707 #print("Running: %s" % cmd)
708 os.system(cmd)
710 def etags(ctx):
711 '''build TAGS file using etags'''
712 cmd = "find %s -mindepth 1 -maxdepth 1 -name '*.[ch]' -print | etags -" % get_tags_dirs()
713 #print("Running: %s" % cmd)
714 os.system(cmd)
715 os.system("stat -c '%y' TAGS")
717 class ladish_dist(Scripting.Dist):
718 cmd = 'dist'
719 fun = 'dist'
721 def __init__(self):
722 Scripting.Dist.__init__(self)
723 if Options.options.distname:
724 self.base_name = Options.options.distname
725 else:
726 try:
727 sha = self.cmd_and_log("LANG= git rev-parse --short HEAD", quiet=Context.BOTH).splitlines()[0]
728 self.base_name = APPNAME + '-' + VERSION + "-g" + sha
729 except:
730 self.base_name = APPNAME + '-' + VERSION
731 self.base_name += Options.options.distsuffix
733 #print self.base_name
735 if Options.options.distname and Options.options.tagdist:
736 ret = self.exec_command("LANG= git tag " + self.base_name)
737 if ret != 0:
738 raise waflib.Errors.WafError('git tag creation failed')
740 def get_base_name(self):
741 return self.base_name
743 def get_excl(self):
744 excl = Scripting.Dist.get_excl(self)
746 excl += ' .gitmodules'
747 excl += ' GTAGS'
748 excl += ' GRTAGS'
749 excl += ' GPATH'
750 excl += ' GSYMS'
752 if Options.options.distnodeps:
753 excl += ' laditools'
754 excl += ' jack2'
755 excl += ' a2jmidid'
757 #print repr(excl)
758 return excl
760 def execute(self):
761 shutil.copy('./build/version.h', "./")
762 try:
763 super(ladish_dist, self).execute()
764 finally:
765 os.remove("version.h")