Fix use of uninitialized memory in chdir() failure handling code path
[ladish.git] / wscript
blob6129a7b3aea6c0050acc9524094448c4d3325aa7
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 if parallel_debug:
58 opt.load('parallel_debug')
60 def add_cflag(conf, flag):
61 conf.env.append_unique('CXXFLAGS', flag)
62 conf.env.append_unique('CFLAGS', flag)
64 def add_linkflag(conf, flag):
65 conf.env.append_unique('LINKFLAGS', flag)
67 def check_gcc_optimizations_enabled(flags):
68 gcc_optimizations_enabled = False
69 for flag in flags:
70 if len(flag) < 2 or flag[0] != '-' or flag[1] != 'O':
71 continue
72 if len(flag) == 2:
73 gcc_optimizations_enabled = True;
74 else:
75 gcc_optimizations_enabled = flag[2] != '0';
76 return gcc_optimizations_enabled
78 def create_service_taskgen(bld, target, opath, binary):
79 bld(
80 features = 'subst', # the feature 'subst' overrides the source/target processing
81 source = os.path.join('daemon', 'dbus.service.in'), # list of string or nodes
82 target = target, # list of strings or nodes
83 install_path = bld.env['DBUS_SERVICES_DIR'] + os.path.sep,
84 # variables to use in the substitution
85 dbus_object_path = opath,
86 daemon_bin_path = os.path.join(bld.env['PREFIX'], 'bin', binary))
88 def configure(conf):
89 conf.load('compiler_c')
90 conf.load('compiler_cxx')
91 conf.load('boost')
92 conf.load('python')
93 conf.load('intltool')
94 if parallel_debug:
95 conf.load('parallel_debug')
97 # dladdr() is used by daemon/sigsegv.c
98 # dlvsym() is used by the alsapid library
99 conf.check_cc(msg="Checking for libdl", lib=['dl'], uselib_store='DL')
101 # forkpty() is used by ladishd
102 conf.check_cc(msg="Checking for libutil", lib=['util'], uselib_store='UTIL')
104 conf.check_cfg(
105 package = 'jack',
106 mandatory = True,
107 errmsg = "not installed, see http://jackaudio.org/",
108 args = '--cflags --libs')
110 conf.check_cfg(
111 package = 'alsa',
112 mandatory = True,
113 errmsg = "not installed, see http://www.alsa-project.org/",
114 args = '--cflags')
116 conf.check_cfg(
117 package = 'dbus-1',
118 atleast_version = '1.0.0',
119 mandatory = True,
120 errmsg = "not installed, see http://dbus.freedesktop.org/",
121 args = '--cflags --libs')
123 dbus_dir = conf.check_cfg(package='dbus-1', args='--variable=session_bus_services_dir', msg="Retrieving D-Bus services dir")
124 if not dbus_dir:
125 return
127 dbus_dir = dbus_dir.strip()
128 conf.env['DBUS_SERVICES_DIR_REAL'] = dbus_dir
130 if Options.options.enable_pkg_config_dbus_service_dir:
131 conf.env['DBUS_SERVICES_DIR'] = dbus_dir
132 else:
133 conf.env['DBUS_SERVICES_DIR'] = os.path.join(os.path.normpath(conf.env['PREFIX']), 'share', 'dbus-1', 'services')
135 conf.env['LIBDIR'] = os.path.join(os.path.normpath(conf.env['PREFIX']), 'lib')
137 conf.env['BUILD_DOXYGEN_DOCS'] = Options.options.doxygen
139 conf.check_cfg(
140 package = 'uuid',
141 mandatory = True,
142 errmsg = "not installed, see http://e2fsprogs.sourceforge.net/",
143 args = '--cflags --libs')
145 conf.check(
146 header_name='expat.h',
147 mandatory = True,
148 errmsg = "not installed, see http://expat.sourceforge.net/")
150 conf.env['LIB_EXPAT'] = ['expat']
152 build_gui = True
154 if build_gui and not conf.check_cfg(
155 package = 'glib-2.0',
156 mandatory = False,
157 errmsg = "not installed, see http://www.gtk.org/",
158 args = '--cflags --libs'):
159 build_gui = False
161 if build_gui and not conf.check_cfg(
162 package = 'dbus-glib-1',
163 mandatory = False,
164 errmsg = "not installed, see http://dbus.freedesktop.org/",
165 args = '--cflags --libs'):
166 build_gui = False
168 if build_gui and not conf.check_cfg(
169 package = 'gtk+-2.0',
170 mandatory = False,
171 atleast_version = '2.20.0',
172 errmsg = "not installed, see http://www.gtk.org/",
173 args = '--cflags --libs'):
174 build_gui = False
176 if build_gui and not conf.check_cfg(
177 package = 'gtkmm-2.4',
178 mandatory = False,
179 atleast_version = '2.10.0',
180 errmsg = "not installed, see http://www.gtkmm.org",
181 args = '--cflags --libs'):
182 build_gui = False
184 if build_gui and not conf.check_cfg(
185 package = 'libgnomecanvasmm-2.6',
186 mandatory = False,
187 atleast_version = '2.6.0',
188 errmsg = "not installed, see http://www.gtkmm.org",
189 args = '--cflags --libs'):
190 build_gui = False
192 #autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GLIBMM', atleast_version='2.10.0', mandatory=True)
193 #autowaf.check_pkg(conf, 'libgnomecanvasmm-2.6', uselib_store='GNOMECANVASMM', atleast_version='2.6.0', mandatory=True)
195 #autowaf.check_pkg(conf, 'libgvc', uselib_store='AGRAPH', atleast_version='2.8', mandatory=False)
197 if build_gui:
198 # We need the boost headers package (e.g. libboost-dev)
199 # shared_ptr.hpp and weak_ptr.hpp
200 build_gui = conf.check_boost(
201 mandatory = False,
202 errmsg="not found, see http://boost.org/")
204 conf.env['BUILD_GLADISH'] = build_gui
206 conf.env['BUILD_LIBLASH'] = Options.options.enable_liblash
207 conf.env['BUILD_PYLASH'] = Options.options.enable_pylash
208 if conf.env['BUILD_PYLASH'] and not conf.env['BUILD_LIBLASH']:
209 conf.fatal("pylash build was requested but liblash was not")
210 conf.env['BUILD_PYLASH'] = False
211 if conf.env['BUILD_PYLASH']:
212 conf.check_python_version()
213 conf.check_python_headers()
215 add_cflag(conf, '-fvisibility=hidden')
217 conf.env['BUILD_WERROR'] = not RELEASE
218 add_cflag(conf, '-Wall')
219 if conf.env['BUILD_WERROR']:
220 add_cflag(conf, '-Werror')
221 # for pre gcc-4.4, enable optimizations so use of uninitialized variables gets detected
222 try:
223 is_gcc = conf.env['CC_NAME'] == 'gcc'
224 if is_gcc:
225 gcc_ver = []
226 for n in conf.env['CC_VERSION']:
227 gcc_ver.append(int(n))
228 if gcc_ver[0] < 4 or gcc_ver[1] < 4:
229 #print "optimize force enable is required"
230 if not check_gcc_optimizations_enabled(conf.env['CFLAGS']):
231 if Options.options.debug:
232 print "C optimization must be forced in order to enable -Wuninitialized"
233 print "However this will not be made because debug compilation is enabled"
234 else:
235 print "C optimization forced in order to enable -Wuninitialized"
236 conf.env.append_unique('CFLAGS', "-O")
237 except:
238 pass
240 conf.env['BUILD_DEBUG'] = Options.options.debug
241 if conf.env['BUILD_DEBUG']:
242 add_cflag(conf, '-g')
243 add_cflag(conf, '-O0')
244 add_linkflag(conf, '-g')
246 conf.env['DATA_DIR'] = os.path.normpath(os.path.join(conf.env['PREFIX'], 'share', APPNAME))
247 conf.env['LOCALE_DIR'] = os.path.normpath(os.path.join(conf.env['PREFIX'], 'share', 'locale'))
249 # write some parts of the configure environment to the config.h file
250 conf.define('DATA_DIR', conf.env['DATA_DIR'])
251 conf.define('LOCALE_DIR', conf.env['LOCALE_DIR'])
252 conf.define('PACKAGE_VERSION', VERSION)
253 conf.define('DBUS_NAME_BASE', DBUS_NAME_BASE)
254 conf.define('DBUS_BASE_PATH', '/' + DBUS_NAME_BASE.replace('.', '/'))
255 conf.define('BASE_NAME', APPNAME)
256 conf.define('_GNU_SOURCE', 1)
257 conf.write_config_header('config.h')
259 display_msg(conf)
261 display_msg(conf, "==================")
262 version_msg = APPNAME + "-" + VERSION
264 if os.access('version.h', os.R_OK):
265 data = file('version.h').read()
266 m = re.match(r'^#define GIT_VERSION "([^"]*)"$', data)
267 if m != None:
268 version_msg += " exported from " + m.group(1)
269 elif os.access('.git', os.R_OK):
270 version_msg += " git revision will checked and eventually updated during build"
272 display_msg(conf, version_msg)
274 display_msg(conf)
275 display_msg(conf, "Install prefix", conf.env['PREFIX'], 'CYAN')
277 display_msg(conf, 'Build gladish', yesno(conf.env['BUILD_GLADISH']))
278 display_msg(conf, 'Build liblash', yesno(Options.options.enable_liblash))
279 display_msg(conf, 'Build pylash', yesno(conf.env['BUILD_PYLASH']))
280 display_msg(conf, 'Treat warnings as errors', yesno(conf.env['BUILD_WERROR']))
281 display_msg(conf, 'Debuggable binaries', yesno(conf.env['BUILD_DEBUG']))
282 display_msg(conf, 'Build doxygen documentation', yesno(conf.env['BUILD_DOXYGEN_DOCS']))
284 if conf.env['DBUS_SERVICES_DIR'] != conf.env['DBUS_SERVICES_DIR_REAL']:
285 display_msg(conf)
286 display_line(conf, "WARNING: D-Bus session services directory as reported by pkg-config is", 'RED')
287 display_raw_text(conf, "WARNING:", 'RED')
288 display_line(conf, conf.env['DBUS_SERVICES_DIR_REAL'], 'CYAN')
289 display_line(conf, 'WARNING: but service file will be installed in', 'RED')
290 display_raw_text(conf, "WARNING:", 'RED')
291 display_line(conf, conf.env['DBUS_SERVICES_DIR'], 'CYAN')
292 display_line(conf, 'WARNING: You may need to adjust your D-Bus configuration after installing ladish', 'RED')
293 display_line(conf, 'WARNING: You can override dbus service install directory', 'RED')
294 display_line(conf, 'WARNING: with --enable-pkg-config-dbus-service-dir option to this script', 'RED')
296 display_msg(conf, 'C compiler flags', repr(conf.env['CFLAGS']))
297 display_msg(conf, 'C++ compiler flags', repr(conf.env['CXXFLAGS']))
299 if not conf.env['BUILD_GLADISH']:
300 display_msg(conf)
301 display_line(conf, "WARNING: The GUI frontend will not built", 'RED')
303 display_msg(conf)
305 def git_ver(self):
306 bld = self.generator.bld
307 header = self.outputs[0].abspath()
308 if os.access('./version.h', os.R_OK):
309 header = os.path.join(os.getcwd(), out, "version.h")
310 shutil.copy('./version.h', header)
311 data = file(header).read()
312 m = re.match(r'^#define GIT_VERSION "([^"]*)"$', data)
313 if m != None:
314 self.ver = m.group(1)
315 pprint('BLUE', "tarball from git revision " + self.ver)
316 else:
317 self.ver = "tarball"
318 return
320 if bld.srcnode.find_node('.git'):
321 self.ver = bld.cmd_and_log("LANG= git rev-parse HEAD", quiet=waflib.Context.BOTH).splitlines()[0]
322 if bld.cmd_and_log("LANG= git diff-index --name-only HEAD", quiet=waflib.Context.BOTH).splitlines():
323 self.ver += "-dirty"
325 pprint('BLUE', "git revision " + self.ver)
326 else:
327 self.ver = "unknown"
329 fi = open(header, 'w')
330 fi.write('#define GIT_VERSION "%s"\n' % self.ver)
331 fi.close()
333 def build(bld):
334 if not bld.env['DATA_DIR']:
335 raise "DATA_DIR is emtpy"
337 bld(rule=git_ver, target='version.h', update_outputs=True, always=True, ext_out=['.h'])
339 daemon = bld.program(source = [], features = 'c cprogram', includes = [bld.path.get_bld()])
340 daemon.target = 'ladishd'
341 daemon.uselib = 'DBUS-1 UUID EXPAT DL UTIL'
342 daemon.ver_header = 'version.h'
343 # Make backtrace function lookup to work for functions in the executable itself
344 daemon.env.append_value("LINKFLAGS", ["-Wl,-E"])
346 daemon.source = ["string_constants.c"]
348 for source in [
349 'main.c',
350 'loader.c',
351 'log.c',
352 'sigsegv.c',
353 'proctitle.c',
354 'appdb.c',
355 'procfs.c',
356 'control.c',
357 'studio.c',
358 'graph.c',
359 'graph_manager.c',
360 'client.c',
361 'port.c',
362 'virtualizer.c',
363 'dict.c',
364 'graph_dict.c',
365 'escape.c',
366 'studio_jack_conf.c',
367 'studio_list.c',
368 'save.c',
369 'load.c',
370 'cmd_load_studio.c',
371 'cmd_new_studio.c',
372 'cmd_rename_studio.c',
373 'cmd_save_studio.c',
374 'cmd_start_studio.c',
375 'cmd_stop_studio.c',
376 'cmd_unload_studio.c',
377 'cmd_new_app.c',
378 'cmd_change_app_state.c',
379 'cmd_remove_app.c',
380 'cmd_create_room.c',
381 'cmd_delete_room.c',
382 'cmd_save_project.c',
383 'cmd_unload_project.c',
384 'cmd_load_project.c',
385 'cmd_exit.c',
386 'cqueue.c',
387 'app_supervisor.c',
388 'room.c',
389 'room_save.c',
390 'room_load.c',
391 'recent_store.c',
392 'recent_projects.c',
393 'check_integrity.c',
394 'lash_server.c',
395 'jack_session.c',
397 daemon.source.append(os.path.join("daemon", source))
399 for source in [
400 'jack_proxy.c',
401 'graph_proxy.c',
402 'a2j_proxy.c',
403 "jmcore_proxy.c",
404 "notify_proxy.c",
405 "conf_proxy.c",
406 "lash_client_proxy.c",
408 daemon.source.append(os.path.join("proxies", source))
410 for source in [
411 'signal.c',
412 'method.c',
413 'object_path.c',
414 'interface.c',
415 'helpers.c',
417 daemon.source.append(os.path.join("cdbus", source))
419 for source in [
420 'time.c',
421 'dirhelpers.c',
422 'catdup.c',
424 daemon.source.append(os.path.join("common", source))
426 daemon.source.append(os.path.join("alsapid", "helper.c"))
428 # process dbus.service.in -> ladish.service
429 create_service_taskgen(bld, DBUS_NAME_BASE + '.service', DBUS_NAME_BASE, daemon.target)
431 #####################################################
432 # jmcore
433 jmcore = bld.program(source = [], features = 'c cprogram', includes = [bld.path.get_bld()])
434 jmcore.target = 'jmcore'
435 jmcore.uselib = 'DBUS-1 JACK'
436 jmcore.defines = ['LOG_OUTPUT_STDOUT']
437 jmcore.source = ['jmcore.c']
439 for source in [
440 #'signal.c',
441 'method.c',
442 'object_path.c',
443 'interface.c',
444 'helpers.c',
446 jmcore.source.append(os.path.join("cdbus", source))
448 create_service_taskgen(bld, DBUS_NAME_BASE + '.jmcore.service', DBUS_NAME_BASE + ".jmcore", jmcore.target)
450 #####################################################
451 # conf
452 ladiconfd = bld.program(source = [], features = 'c cprogram', includes = [bld.path.get_bld()])
453 ladiconfd.target = 'ladiconfd'
454 ladiconfd.uselib = 'DBUS-1'
455 ladiconfd.defines = ['LOG_OUTPUT_STDOUT']
456 ladiconfd.source = ['conf.c']
458 for source in [
459 'dirhelpers.c',
460 'catdup.c',
462 ladiconfd.source.append(os.path.join("common", source))
464 for source in [
465 'signal.c',
466 'method.c',
467 'object_path.c',
468 'interface.c',
469 'helpers.c',
471 ladiconfd.source.append(os.path.join("cdbus", source))
473 create_service_taskgen(bld, DBUS_NAME_BASE + '.conf.service', DBUS_NAME_BASE + ".conf", ladiconfd.target)
475 #####################################################
476 # alsapid
477 alsapid = bld.shlib(source = [], features = 'c cshlib', includes = [bld.path.get_bld()])
478 alsapid.uselib = 'DL'
479 alsapid.target = 'alsapid'
480 for source in [
481 'lib.c',
482 'helper.c',
484 alsapid.source.append(os.path.join("alsapid", source))
486 #####################################################
487 # liblash
488 if bld.env['BUILD_LIBLASH']:
489 liblash = bld.shlib(source = [], features = 'c cshlib', includes = [bld.path.get_bld()])
490 liblash.uselib = 'DBUS-1'
491 liblash.target = 'lash'
492 liblash.vnum = "1.1.1"
493 liblash.defines = ['LOG_OUTPUT_STDOUT']
494 liblash.source = [os.path.join("lash_compat", "liblash", 'lash.c')]
496 for source in [
497 'dirhelpers.c',
498 'catdup.c',
499 'file.c',
501 liblash.source.append(os.path.join("common", source))
503 for source in [
504 'method.c',
505 'object_path.c',
506 'interface.c',
507 'helpers.c',
509 liblash.source.append(os.path.join("cdbus", source))
511 bld.install_files('${PREFIX}/include/lash', bld.path.ant_glob('lash_compat/liblash/lash/*.h'))
513 # process lash-1.0.pc.in -> lash-1.0.pc
514 bld(
515 features = 'subst', # the feature 'subst' overrides the source/target processing
516 source = os.path.join("lash_compat", 'lash-1.0.pc.in'), # list of string or nodes
517 target = 'lash-1.0.pc', # list of strings or nodes
518 install_path = '${LIBDIR}/pkgconfig/',
519 # variables to use in the substitution
520 prefix = bld.env['PREFIX'],
521 exec_prefix = bld.env['PREFIX'],
522 libdir = bld.env['LIBDIR'],
523 includedir = os.path.normpath(bld.env['PREFIX'] + '/include'))
525 #####################################################
526 # pylash
527 if bld.env['BUILD_PYLASH']:
528 pylash = bld.shlib(source = [], features = 'c cshlib pyext', includes = ["lash_compat/liblash"])
529 pylash.target = '_lash'
530 pylash.use = 'lash'
531 pylash.install_path = '${PYTHONDIR}'
533 for source in [
534 'lash.c',
535 'lash_wrap.c',
537 pylash.source.append(os.path.join("lash_compat", "pylash", source))
539 bld.install_files('${PYTHONDIR}', os.path.join("lash_compat", "pylash", "lash.py"))
541 #####################################################
542 # gladish
543 if bld.env['BUILD_GLADISH']:
544 gladish = bld.program(source = [], features = 'c cxx cxxprogram', includes = [bld.path.get_bld()])
545 gladish.target = 'gladish'
546 gladish.defines = ['LOG_OUTPUT_STDOUT']
547 gladish.uselib = 'DBUS-1 DBUS-GLIB-1 GTKMM-2.4 LIBGNOMECANVASMM-2.6 GTK+-2.0'
549 gladish.source = ["string_constants.c"]
551 for source in [
552 'main.c',
553 'load_project_dialog.c',
554 'save_project_dialog.c',
555 'project_properties.c',
556 'world_tree.c',
557 'graph_view.c',
558 'canvas.cpp',
559 'graph_canvas.c',
560 'gtk_builder.c',
561 'ask_dialog.c',
562 'create_room_dialog.c',
563 'menu.c',
564 'dynmenu.c',
565 'toolbar.c',
566 'about.c',
567 'dbus.c',
568 'studio.c',
569 'studio_list.c',
570 'dialogs.c',
571 'jack.c',
572 'control.c',
573 'pixbuf.c',
574 'room.c',
575 'statusbar.c',
576 'action.c',
577 'settings.c',
578 'zoom.c',
580 gladish.source.append(os.path.join("gui", source))
582 for source in [
583 'Module.cpp',
584 'Item.cpp',
585 'Port.cpp',
586 'Connection.cpp',
587 'Ellipse.cpp',
588 'Canvas.cpp',
589 'Connectable.cpp',
591 gladish.source.append(os.path.join("gui", "flowcanvas", source))
593 for source in [
594 'jack_proxy.c',
595 'a2j_proxy.c',
596 'graph_proxy.c',
597 'studio_proxy.c',
598 'control_proxy.c',
599 'app_supervisor_proxy.c',
600 "room_proxy.c",
601 "conf_proxy.c",
603 gladish.source.append(os.path.join("proxies", source))
605 for source in [
606 'method.c',
607 'helpers.c',
609 gladish.source.append(os.path.join("cdbus", source))
611 for source in [
612 'catdup.c',
613 'file.c',
615 gladish.source.append(os.path.join("common", source))
617 # GtkBuilder UI definitions (XML)
618 bld.install_files('${DATA_DIR}', 'gui/gladish.ui')
620 bld.install_files('${PREFIX}/bin', 'ladish_control', chmod=0755)
622 # 'Desktop' file (menu entry, icon, etc)
623 bld.install_files('${PREFIX}/share/applications/', 'gui/gladish.desktop', chmod=0644)
625 # Icons
626 icon_sizes = ['16x16', '22x22', '24x24', '32x32', '48x48', '256x256']
627 for icon_size in icon_sizes:
628 bld.path.ant_glob('art/' + icon_size + '/apps/*.png')
629 bld.install_files('${PREFIX}/share/icons/hicolor/' + icon_size + '/apps/', 'art/' + icon_size + '/apps/gladish.png')
631 status_images = []
632 for status in ["down", "unloaded", "started", "stopped", "warning", "error"]:
633 status_images.append("art/status_" + status + ".png")
635 bld.install_files('${DATA_DIR}', status_images)
636 bld.install_files('${DATA_DIR}', "art/ladish-logo-128x128.png")
637 bld.install_files('${DATA_DIR}', ["AUTHORS", "README", "NEWS"])
638 bld.install_as('${DATA_DIR}/COPYING', "gpl2.txt")
640 if bld.env['BUILD_DOXYGEN_DOCS'] == True:
641 html_docs_source_dir = "build/default/html"
642 if bld.cmd == 'clean':
643 if os.access(html_docs_source_dir, os.R_OK):
644 pprint('CYAN', "Removing doxygen generated documentation...")
645 shutil.rmtree(html_docs_source_dir)
646 pprint('CYAN', "Removing doxygen generated documentation done.")
647 elif bld.cmd == 'build':
648 if not os.access(html_docs_source_dir, os.R_OK):
649 os.popen("doxygen").read()
650 else:
651 pprint('CYAN', "doxygen documentation already built.")
653 bld(features='intltool_po', appname=APPNAME, podir='po', install_path="${LOCALE_DIR}")
655 def get_tags_dirs():
656 source_root = os.path.dirname(Utils.g_module.root_path)
657 if 'relpath' in os.path.__all__:
658 source_root = os.path.relpath(source_root)
659 paths = source_root
660 paths += " " + os.path.join(source_root, "common")
661 paths += " " + os.path.join(source_root, "cdbus")
662 paths += " " + os.path.join(source_root, "proxies")
663 paths += " " + os.path.join(source_root, "daemon")
664 paths += " " + os.path.join(source_root, "gui")
665 paths += " " + os.path.join(source_root, "example-apps")
666 paths += " " + os.path.join(source_root, "lib")
667 paths += " " + os.path.join(source_root, "lash_compat", "liblash")
668 paths += " " + os.path.join(source_root, "lash_compat", "liblash", "lash")
669 return paths
671 def gtags(ctx):
672 '''build tag files for GNU global'''
673 cmd = "find %s -mindepth 1 -maxdepth 1 -name '*.[ch]' -print | gtags --statistics -f -" % get_tags_dirs()
674 #print("Running: %s" % cmd)
675 os.system(cmd)
677 def etags(ctx):
678 '''build TAGS file using etags'''
679 cmd = "find %s -mindepth 1 -maxdepth 1 -name '*.[ch]' -print | etags -" % get_tags_dirs()
680 #print("Running: %s" % cmd)
681 os.system(cmd)
682 os.system("stat -c '%y' TAGS")
684 class ladish_dist(waflib.Scripting.Dist):
685 cmd = 'dist'
686 fun = 'dist'
688 def __init__(self):
689 Dist.__init__(self)
690 if Options.options.distname:
691 self.base_name = Options.options.distname
692 else:
693 try:
694 self.base_name = self.cmd_and_log("LANG= git describe --tags", quiet=waflib.Context.BOTH).splitlines()[0]
695 except:
696 self.base_name = APPNAME + '-' + VERSION
697 self.base_name += Options.options.distsuffix
699 #print self.base_name
701 if Options.options.distname and Options.options.tagdist:
702 ret = self.exec_command("LANG= git tag " + self.base_name)
703 if ret != 0:
704 raise waflib.Errors.WafError('git tag creation failed')
706 def get_base_name(self):
707 return self.base_name
709 def get_excl(self):
710 excl = Dist.get_excl(self)
712 excl += ' .gitmodules'
713 excl += ' GTAGS'
714 excl += ' GRTAGS'
715 excl += ' GPATH'
716 excl += ' GSYMS'
718 if Options.options.distnodeps:
719 excl += ' laditools'
720 excl += ' jack2'
721 excl += ' a2jmidid'
723 #print repr(excl)
724 return excl
726 def execute(self):
727 shutil.copy('./build/version.h', "./")
728 try:
729 super(ladish_dist, self).execute()
730 finally:
731 os.remove("version.h")