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