fix another compiler warning
[ladish.git] / wscript
blob2630856f1810e877ccdb1ced0f8630f8c9fd0c0e
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='0.4-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 = 'flowcanvas',
178 mandatory = False,
179 atleast_version = '0.6.4',
180 errmsg = "not installed, see http://drobilla.net/software/flowcanvas/",
181 args = '--cflags --libs'):
182 build_gui = False
184 if build_gui:
185 # We need the boost headers package (e.g. libboost-dev)
186 # shared_ptr.hpp and weak_ptr.hpp
187 build_gui = conf.check_boost(errmsg="not found, see http://boost.org/")
189 conf.env['BUILD_GLADISH'] = build_gui
191 conf.env['BUILD_LIBLASH'] = Options.options.enable_liblash
192 conf.env['BUILD_PYLASH'] = Options.options.enable_pylash
193 if conf.env['BUILD_PYLASH'] and not conf.env['BUILD_LIBLASH']:
194 conf.fatal("pylash build was requested but liblash was not")
195 conf.env['BUILD_PYLASH'] = False
196 if conf.env['BUILD_PYLASH']:
197 conf.check_python_version()
198 conf.check_python_headers()
200 conf.env['BUILD_WERROR'] = not RELEASE
201 add_cflag(conf, '-Wall')
202 if conf.env['BUILD_WERROR']:
203 add_cflag(conf, '-Werror')
204 # for pre gcc-4.4, enable optimizations so use of uninitialized variables gets detected
205 try:
206 is_gcc = conf.env['CC_NAME'] == 'gcc'
207 if is_gcc:
208 gcc_ver = []
209 for n in conf.env['CC_VERSION']:
210 gcc_ver.append(int(n))
211 if gcc_ver[0] < 4 or gcc_ver[1] < 4:
212 #print "optimize force enable is required"
213 if not check_gcc_optimizations_enabled(conf.env['CFLAGS']):
214 if Options.options.debug:
215 print "C optimization must be forced in order to enable -Wuninitialized"
216 print "However this will not be made because debug compilation is enabled"
217 else:
218 print "C optimization forced in order to enable -Wuninitialized"
219 conf.env.append_unique('CFLAGS', "-O")
220 except:
221 pass
223 conf.env['BUILD_DEBUG'] = Options.options.debug
224 if conf.env['BUILD_DEBUG']:
225 add_cflag(conf, '-g')
226 add_cflag(conf, '-O0')
227 add_linkflag(conf, '-g')
229 conf.env['DATA_DIR'] = os.path.normpath(os.path.join(conf.env['PREFIX'], 'share', APPNAME))
230 conf.env['LOCALE_DIR'] = os.path.normpath(os.path.join(conf.env['PREFIX'], 'share', 'locale'))
232 # write some parts of the configure environment to the config.h file
233 conf.define('DATA_DIR', conf.env['DATA_DIR'])
234 conf.define('LOCALE_DIR', conf.env['LOCALE_DIR'])
235 conf.define('PACKAGE_VERSION', VERSION)
236 conf.define('DBUS_NAME_BASE', DBUS_NAME_BASE)
237 conf.define('DBUS_BASE_PATH', '/' + DBUS_NAME_BASE.replace('.', '/'))
238 conf.define('BASE_NAME', APPNAME)
239 conf.define('_GNU_SOURCE', 1)
240 conf.write_config_header('config.h')
242 display_msg(conf)
244 display_msg(conf, "==================")
245 version_msg = APPNAME + "-" + VERSION
247 if os.access('version.h', os.R_OK):
248 data = file('version.h').read()
249 m = re.match(r'^#define GIT_VERSION "([^"]*)"$', data)
250 if m != None:
251 version_msg += " exported from " + m.group(1)
252 elif os.access('.git', os.R_OK):
253 version_msg += " git revision will checked and eventually updated during build"
255 display_msg(conf, version_msg)
257 display_msg(conf)
258 display_msg(conf, "Install prefix", conf.env['PREFIX'], 'CYAN')
260 display_msg(conf, 'Build gladish', yesno(conf.env['BUILD_GLADISH']))
261 display_msg(conf, 'Build liblash', yesno(Options.options.enable_liblash))
262 display_msg(conf, 'Build pylash', yesno(conf.env['BUILD_PYLASH']))
263 display_msg(conf, 'Treat warnings as errors', yesno(conf.env['BUILD_WERROR']))
264 display_msg(conf, 'Debuggable binaries', yesno(conf.env['BUILD_DEBUG']))
265 display_msg(conf, 'Build doxygen documentation', yesno(conf.env['BUILD_DOXYGEN_DOCS']))
267 if conf.env['DBUS_SERVICES_DIR'] != conf.env['DBUS_SERVICES_DIR_REAL']:
268 display_msg(conf)
269 display_line(conf, "WARNING: D-Bus session services directory as reported by pkg-config is", 'RED')
270 display_raw_text(conf, "WARNING:", 'RED')
271 display_line(conf, conf.env['DBUS_SERVICES_DIR_REAL'], 'CYAN')
272 display_line(conf, 'WARNING: but service file will be installed in', 'RED')
273 display_raw_text(conf, "WARNING:", 'RED')
274 display_line(conf, conf.env['DBUS_SERVICES_DIR'], 'CYAN')
275 display_line(conf, 'WARNING: You may need to adjust your D-Bus configuration after installing ladish', 'RED')
276 display_line(conf, 'WARNING: You can override dbus service install directory', 'RED')
277 display_line(conf, 'WARNING: with --enable-pkg-config-dbus-service-dir option to this script', 'RED')
279 display_msg(conf, 'C compiler flags', repr(conf.env['CFLAGS']))
280 display_msg(conf, 'C++ compiler flags', repr(conf.env['CXXFLAGS']))
282 if not conf.env['BUILD_GLADISH']:
283 display_msg(conf)
284 display_line(conf, "WARNING: The GUI frontend will not built", 'RED')
286 display_msg(conf)
288 def git_ver(self):
289 bld = self.generator.bld
290 header = self.outputs[0].abspath()
291 if os.access('./version.h', os.R_OK):
292 header = os.path.join(os.getcwd(), out, "version.h")
293 shutil.copy('./version.h', header)
294 data = file(header).read()
295 m = re.match(r'^#define GIT_VERSION "([^"]*)"$', data)
296 if m != None:
297 self.ver = m.group(1)
298 pprint('BLUE', "tarball from git revision " + self.ver)
299 else:
300 self.ver = "tarball"
301 return
303 if bld.srcnode.find_node('.git'):
304 self.ver = bld.cmd_and_log("LANG= git rev-parse HEAD", quiet=waflib.Context.BOTH).splitlines()[0]
305 if bld.cmd_and_log("LANG= git diff-index --name-only HEAD", quiet=waflib.Context.BOTH).splitlines():
306 self.ver += "-dirty"
308 pprint('BLUE', "git revision " + self.ver)
309 else:
310 self.ver = "unknown"
312 fi = open(header, 'w')
313 fi.write('#define GIT_VERSION "%s"\n' % self.ver)
314 fi.close()
316 def build(bld):
317 if not bld.env['DATA_DIR']:
318 raise "DATA_DIR is emtpy"
320 bld(rule=git_ver, target='version.h', update_outputs=True, always=True, ext_out=['.h'])
322 daemon = bld.program(source = [], features = 'c cprogram', includes = [bld.path.get_bld()])
323 daemon.target = 'ladishd'
324 daemon.uselib = 'DBUS-1 UUID EXPAT DL UTIL'
325 daemon.ver_header = 'version.h'
326 # Make backtrace function lookup to work for functions in the executable itself
327 daemon.env.append_value("LINKFLAGS", ["-Wl,-E"])
329 daemon.source = ["string_constants.c"]
331 for source in [
332 'main.c',
333 'loader.c',
334 'log.c',
335 'sigsegv.c',
336 'proctitle.c',
337 'appdb.c',
338 'procfs.c',
339 'control.c',
340 'studio.c',
341 'graph.c',
342 'graph_manager.c',
343 'client.c',
344 'port.c',
345 'virtualizer.c',
346 'dict.c',
347 'graph_dict.c',
348 'escape.c',
349 'studio_jack_conf.c',
350 'studio_list.c',
351 'save.c',
352 'load.c',
353 'cmd_load_studio.c',
354 'cmd_new_studio.c',
355 'cmd_rename_studio.c',
356 'cmd_save_studio.c',
357 'cmd_start_studio.c',
358 'cmd_stop_studio.c',
359 'cmd_unload_studio.c',
360 'cmd_new_app.c',
361 'cmd_change_app_state.c',
362 'cmd_remove_app.c',
363 'cmd_create_room.c',
364 'cmd_delete_room.c',
365 'cmd_save_project.c',
366 'cmd_unload_project.c',
367 'cmd_load_project.c',
368 'cmd_exit.c',
369 'cqueue.c',
370 'app_supervisor.c',
371 'room.c',
372 'room_save.c',
373 'room_load.c',
374 'recent_store.c',
375 'recent_projects.c',
376 'check_integrity.c',
377 'lash_server.c',
378 'jack_session.c',
380 daemon.source.append(os.path.join("daemon", source))
382 for source in [
383 'jack_proxy.c',
384 'graph_proxy.c',
385 'a2j_proxy.c',
386 "jmcore_proxy.c",
387 "notify_proxy.c",
388 "conf_proxy.c",
389 "lash_client_proxy.c",
391 daemon.source.append(os.path.join("proxies", source))
393 for source in [
394 'signal.c',
395 'method.c',
396 'error.c',
397 'object_path.c',
398 'interface.c',
399 'helpers.c',
401 daemon.source.append(os.path.join("dbus", source))
403 for source in [
404 'time.c',
405 'dirhelpers.c',
406 'catdup.c',
408 daemon.source.append(os.path.join("common", source))
410 daemon.source.append(os.path.join("alsapid", "helper.c"))
412 # process dbus.service.in -> ladish.service
413 create_service_taskgen(bld, DBUS_NAME_BASE + '.service', DBUS_NAME_BASE, daemon.target)
415 #####################################################
416 # jmcore
417 jmcore = bld.program(source = [], features = 'c cprogram', includes = [bld.path.get_bld()])
418 jmcore.target = 'jmcore'
419 jmcore.uselib = 'DBUS-1 JACK'
420 jmcore.defines = ['LOG_OUTPUT_STDOUT']
421 jmcore.source = ['jmcore.c']
423 for source in [
424 #'signal.c',
425 'method.c',
426 'error.c',
427 'object_path.c',
428 'interface.c',
429 'helpers.c',
431 jmcore.source.append(os.path.join("dbus", source))
433 create_service_taskgen(bld, DBUS_NAME_BASE + '.jmcore.service', DBUS_NAME_BASE + ".jmcore", jmcore.target)
435 #####################################################
436 # conf
437 ladiconfd = bld.program(source = [], features = 'c cprogram', includes = [bld.path.get_bld()])
438 ladiconfd.target = 'ladiconfd'
439 ladiconfd.uselib = 'DBUS-1'
440 ladiconfd.defines = ['LOG_OUTPUT_STDOUT']
441 ladiconfd.source = ['conf.c']
443 for source in [
444 'dirhelpers.c',
445 'catdup.c',
447 ladiconfd.source.append(os.path.join("common", source))
449 for source in [
450 'signal.c',
451 'method.c',
452 'error.c',
453 'object_path.c',
454 'interface.c',
455 'helpers.c',
457 ladiconfd.source.append(os.path.join("dbus", source))
459 create_service_taskgen(bld, DBUS_NAME_BASE + '.conf.service', DBUS_NAME_BASE + ".conf", ladiconfd.target)
461 #####################################################
462 # alsapid
463 bld.shlib(source = [os.path.join("alsapid", 'lib.c'), os.path.join("alsapid", "helper.c")], target = 'alsapid', uselib = 'DL')
465 #####################################################
466 # liblash
467 if bld.env['BUILD_LIBLASH']:
468 liblash = bld.shlib(source = [], features = 'c cshlib', includes = [bld.path.get_bld()])
469 liblash.uselib = 'DBUS-1'
470 liblash.target = 'lash'
471 liblash.vnum = "1.1.1"
472 liblash.defines = ['LOG_OUTPUT_STDOUT']
473 liblash.source = [os.path.join("lash_compat", "liblash", 'lash.c')]
475 for source in [
476 'dirhelpers.c',
477 'catdup.c',
478 'file.c',
480 liblash.source.append(os.path.join("common", source))
482 for source in [
483 'method.c',
484 'error.c',
485 'object_path.c',
486 'interface.c',
487 'helpers.c',
489 liblash.source.append(os.path.join("dbus", source))
491 bld.install_files('${PREFIX}/include/lash', bld.path.ant_glob('lash_compat/liblash/lash/*.h'))
493 # process lash-1.0.pc.in -> lash-1.0.pc
494 bld(
495 features = 'subst', # the feature 'subst' overrides the source/target processing
496 source = os.path.join("lash_compat", 'lash-1.0.pc.in'), # list of string or nodes
497 target = 'lash-1.0.pc', # list of strings or nodes
498 install_path = '${LIBDIR}/pkgconfig/',
499 # variables to use in the substitution
500 prefix = bld.env['PREFIX'],
501 exec_prefix = bld.env['PREFIX'],
502 libdir = bld.env['LIBDIR'],
503 includedir = os.path.normpath(bld.env['PREFIX'] + '/include'))
505 #####################################################
506 # pylash
507 if bld.env['BUILD_PYLASH']:
508 pylash = bld.shlib(source = [], features = 'c cshlib pyext', includes = ["lash_compat/liblash"])
509 pylash.target = '_lash'
510 pylash.use = 'lash'
511 pylash.install_path = '${PYTHONDIR}'
513 for source in [
514 'lash.c',
515 'lash_wrap.c',
517 pylash.source.append(os.path.join("lash_compat", "pylash", source))
519 bld.install_files('${PYTHONDIR}', os.path.join("lash_compat", "pylash", "lash.py"))
521 #####################################################
522 # gladish
523 if bld.env['BUILD_GLADISH']:
524 gladish = bld.program(source = [], features = 'c cxx cxxprogram', includes = [bld.path.get_bld()])
525 gladish.target = 'gladish'
526 gladish.defines = ['LOG_OUTPUT_STDOUT']
527 gladish.uselib = 'DBUS-1 DBUS-GLIB-1 FLOWCANVAS GTK+-2.0'
529 gladish.source = ["string_constants.c"]
531 for source in [
532 'main.c',
533 'load_project_dialog.c',
534 'save_project_dialog.c',
535 'project_properties.c',
536 'world_tree.c',
537 'graph_view.c',
538 'canvas.cpp',
539 'graph_canvas.c',
540 'gtk_builder.c',
541 'ask_dialog.c',
542 'create_room_dialog.c',
543 'menu.c',
544 'dynmenu.c',
545 'toolbar.c',
546 'about.c',
547 'dbus.c',
548 'studio.c',
549 'studio_list.c',
550 'dialogs.c',
551 'jack.c',
552 'control.c',
553 'pixbuf.c',
554 'room.c',
555 'statusbar.c',
556 'action.c',
557 'settings.c',
558 'zoom.c',
560 gladish.source.append(os.path.join("gui", source))
562 for source in [
563 'jack_proxy.c',
564 'a2j_proxy.c',
565 'graph_proxy.c',
566 'studio_proxy.c',
567 'control_proxy.c',
568 'app_supervisor_proxy.c',
569 "room_proxy.c",
570 "conf_proxy.c",
572 gladish.source.append(os.path.join("proxies", source))
574 for source in [
575 'method.c',
576 'helpers.c',
578 gladish.source.append(os.path.join("dbus", source))
580 for source in [
581 'catdup.c',
582 'file.c',
584 gladish.source.append(os.path.join("common", source))
586 # GtkBuilder UI definitions (XML)
587 bld.install_files('${DATA_DIR}', 'gui/gladish.ui')
589 bld.install_files('${PREFIX}/bin', 'ladish_control', chmod=0755)
591 # 'Desktop' file (menu entry, icon, etc)
592 bld.install_files('${PREFIX}/share/applications/', 'gui/gladish.desktop', chmod=0644)
594 # Icons
595 icon_sizes = ['16x16', '22x22', '24x24', '32x32', '48x48', '256x256']
596 for icon_size in icon_sizes:
597 bld.path.ant_glob('art/' + icon_size + '/apps/*.png')
598 bld.install_files('${PREFIX}/share/icons/hicolor/' + icon_size + '/apps/', 'art/' + icon_size + '/apps/gladish.png')
600 status_images = []
601 for status in ["down", "unloaded", "started", "stopped", "warning", "error"]:
602 status_images.append("art/status_" + status + ".png")
604 bld.install_files('${DATA_DIR}', status_images)
605 bld.install_files('${DATA_DIR}', "art/ladish-logo-128x128.png")
606 bld.install_files('${DATA_DIR}', ["AUTHORS", "README", "NEWS"])
607 bld.install_as('${DATA_DIR}/COPYING', "gpl2.txt")
609 if bld.env['BUILD_DOXYGEN_DOCS'] == True:
610 html_docs_source_dir = "build/default/html"
611 if bld.cmd == 'clean':
612 if os.access(html_docs_source_dir, os.R_OK):
613 pprint('CYAN', "Removing doxygen generated documentation...")
614 shutil.rmtree(html_docs_source_dir)
615 pprint('CYAN', "Removing doxygen generated documentation done.")
616 elif bld.cmd == 'build':
617 if not os.access(html_docs_source_dir, os.R_OK):
618 os.popen("doxygen").read()
619 else:
620 pprint('CYAN', "doxygen documentation already built.")
622 bld(features='intltool_po', appname=APPNAME, podir='po', install_path="${LOCALE_DIR}")
624 def get_tags_dirs():
625 source_root = os.path.dirname(Utils.g_module.root_path)
626 if 'relpath' in os.path.__all__:
627 source_root = os.path.relpath(source_root)
628 paths = source_root
629 paths += " " + os.path.join(source_root, "common")
630 paths += " " + os.path.join(source_root, "dbus")
631 paths += " " + os.path.join(source_root, "proxies")
632 paths += " " + os.path.join(source_root, "daemon")
633 paths += " " + os.path.join(source_root, "gui")
634 paths += " " + os.path.join(source_root, "example-apps")
635 paths += " " + os.path.join(source_root, "lib")
636 paths += " " + os.path.join(source_root, "lash_compat", "liblash")
637 paths += " " + os.path.join(source_root, "lash_compat", "liblash", "lash")
638 return paths
640 def gtags(ctx):
641 '''build tag files for GNU global'''
642 cmd = "find %s -mindepth 1 -maxdepth 1 -name '*.[ch]' -print | gtags --statistics -f -" % get_tags_dirs()
643 #print("Running: %s" % cmd)
644 os.system(cmd)
646 def etags(ctx):
647 '''build TAGS file using etags'''
648 cmd = "find %s -mindepth 1 -maxdepth 1 -name '*.[ch]' -print | etags -" % get_tags_dirs()
649 #print("Running: %s" % cmd)
650 os.system(cmd)
651 os.system("stat -c '%y' TAGS")
653 class ladish_dist(waflib.Scripting.Dist):
654 cmd = 'dist'
655 fun = 'dist'
657 def __init__(self):
658 Dist.__init__(self)
659 if Options.options.distname:
660 self.base_name = Options.options.distname
661 else:
662 try:
663 self.base_name = self.cmd_and_log("LANG= git describe --tags", quiet=waflib.Context.BOTH).splitlines()[0]
664 except:
665 self.base_name = APPNAME + '-' + VERSION
666 self.base_name += Options.options.distsuffix
668 #print self.base_name
670 if Options.options.distname and Options.options.tagdist:
671 ret = self.exec_command("LANG= git tag " + self.base_name)
672 if ret != 0:
673 raise waflib.Errors.WafError('git tag creation failed')
675 def get_base_name(self):
676 return self.base_name
678 def get_excl(self):
679 excl = Dist.get_excl(self)
681 excl += ' .gitmodules'
682 excl += ' GTAGS'
683 excl += ' GRTAGS'
684 excl += ' GPATH'
685 excl += ' GSYMS'
687 if Options.options.distnodeps:
688 excl += ' laditools'
689 excl += ' flowcanvas'
690 excl += ' jack2'
691 excl += ' a2jmidid'
693 #print repr(excl)
694 return excl
696 def execute(self):
697 shutil.copy('./build/version.h', "./")
698 try:
699 super(ladish_dist, self).execute()
700 finally:
701 os.remove("version.h")