Install lash include files into dedicated dir
[ladish.git] / wscript
blob493c3fafc69ac7746c4729c3387bc729d2347b6a
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 # lash_wrap code is generated by swig and causes warnings
220 if not conf.env['BUILD_PYLASH']:
221 add_cflag(conf, '-Wextra')
222 conf.env.append_unique('CXXFLAGS', '-Wno-unused-parameter') # the UNUSED() macro doesnt work for C++
223 if conf.env['BUILD_WERROR']:
224 add_cflag(conf, '-Werror')
225 # for pre gcc-4.4, enable optimizations so use of uninitialized variables gets detected
226 try:
227 is_gcc = conf.env['CC_NAME'] == 'gcc'
228 if is_gcc:
229 gcc_ver = []
230 for n in conf.env['CC_VERSION']:
231 gcc_ver.append(int(n))
232 if gcc_ver[0] < 4 or gcc_ver[1] < 4:
233 #print "optimize force enable is required"
234 if not check_gcc_optimizations_enabled(conf.env['CFLAGS']):
235 if Options.options.debug:
236 print "C optimization must be forced in order to enable -Wuninitialized"
237 print "However this will not be made because debug compilation is enabled"
238 else:
239 print "C optimization forced in order to enable -Wuninitialized"
240 conf.env.append_unique('CFLAGS', "-O")
241 except:
242 pass
244 conf.env['BUILD_DEBUG'] = Options.options.debug
245 if conf.env['BUILD_DEBUG']:
246 add_cflag(conf, '-g')
247 add_cflag(conf, '-O0')
248 add_linkflag(conf, '-g')
250 conf.env['DATA_DIR'] = os.path.normpath(os.path.join(conf.env['PREFIX'], 'share', APPNAME))
251 conf.env['LOCALE_DIR'] = os.path.normpath(os.path.join(conf.env['PREFIX'], 'share', 'locale'))
253 # write some parts of the configure environment to the config.h file
254 conf.define('DATA_DIR', conf.env['DATA_DIR'])
255 conf.define('LOCALE_DIR', conf.env['LOCALE_DIR'])
256 conf.define('PACKAGE_VERSION', VERSION)
257 conf.define('DBUS_NAME_BASE', DBUS_NAME_BASE)
258 conf.define('DBUS_BASE_PATH', '/' + DBUS_NAME_BASE.replace('.', '/'))
259 conf.define('BASE_NAME', APPNAME)
260 conf.define('_GNU_SOURCE', 1)
261 conf.write_config_header('config.h')
263 display_msg(conf)
265 display_msg(conf, "==================")
266 version_msg = APPNAME + "-" + VERSION
268 if os.access('version.h', os.R_OK):
269 data = file('version.h').read()
270 m = re.match(r'^#define GIT_VERSION "([^"]*)"$', data)
271 if m != None:
272 version_msg += " exported from " + m.group(1)
273 elif os.access('.git', os.R_OK):
274 version_msg += " git revision will checked and eventually updated during build"
276 display_msg(conf, version_msg)
278 display_msg(conf)
279 display_msg(conf, "Install prefix", conf.env['PREFIX'], 'CYAN')
281 display_msg(conf, 'Build gladish', yesno(conf.env['BUILD_GLADISH']))
282 display_msg(conf, 'Build liblash', yesno(Options.options.enable_liblash))
283 display_msg(conf, 'Build pylash', yesno(conf.env['BUILD_PYLASH']))
284 display_msg(conf, 'Treat warnings as errors', yesno(conf.env['BUILD_WERROR']))
285 display_msg(conf, 'Debuggable binaries', yesno(conf.env['BUILD_DEBUG']))
286 display_msg(conf, 'Build doxygen documentation', yesno(conf.env['BUILD_DOXYGEN_DOCS']))
288 if conf.env['DBUS_SERVICES_DIR'] != conf.env['DBUS_SERVICES_DIR_REAL']:
289 display_msg(conf)
290 display_line(conf, "WARNING: D-Bus session services directory as reported by pkg-config is", 'RED')
291 display_raw_text(conf, "WARNING:", 'RED')
292 display_line(conf, conf.env['DBUS_SERVICES_DIR_REAL'], 'CYAN')
293 display_line(conf, 'WARNING: but service file will be installed in', 'RED')
294 display_raw_text(conf, "WARNING:", 'RED')
295 display_line(conf, conf.env['DBUS_SERVICES_DIR'], 'CYAN')
296 display_line(conf, 'WARNING: You may need to adjust your D-Bus configuration after installing ladish', 'RED')
297 display_line(conf, 'WARNING: You can override dbus service install directory', 'RED')
298 display_line(conf, 'WARNING: with --enable-pkg-config-dbus-service-dir option to this script', 'RED')
300 display_msg(conf, 'C compiler flags', repr(conf.env['CFLAGS']))
301 display_msg(conf, 'C++ compiler flags', repr(conf.env['CXXFLAGS']))
303 if not conf.env['BUILD_GLADISH']:
304 display_msg(conf)
305 display_line(conf, "WARNING: The GUI frontend will not built", 'RED')
307 display_msg(conf)
309 def git_ver(self):
310 bld = self.generator.bld
311 header = self.outputs[0].abspath()
312 if os.access('./version.h', os.R_OK):
313 header = os.path.join(os.getcwd(), out, "version.h")
314 shutil.copy('./version.h', header)
315 data = file(header).read()
316 m = re.match(r'^#define GIT_VERSION "([^"]*)"$', data)
317 if m != None:
318 self.ver = m.group(1)
319 pprint('BLUE', "tarball from git revision " + self.ver)
320 else:
321 self.ver = "tarball"
322 return
324 if bld.srcnode.find_node('.git'):
325 self.ver = bld.cmd_and_log("LANG= git rev-parse HEAD", quiet=waflib.Context.BOTH).splitlines()[0]
326 if bld.cmd_and_log("LANG= git diff-index --name-only HEAD", quiet=waflib.Context.BOTH).splitlines():
327 self.ver += "-dirty"
329 pprint('BLUE', "git revision " + self.ver)
330 else:
331 self.ver = "unknown"
333 fi = open(header, 'w')
334 fi.write('#define GIT_VERSION "%s"\n' % self.ver)
335 fi.close()
337 def build(bld):
338 if not bld.env['DATA_DIR']:
339 raise "DATA_DIR is emtpy"
341 bld(rule=git_ver, target='version.h', update_outputs=True, always=True, ext_out=['.h'])
343 daemon = bld.program(source = [], features = 'c cprogram', includes = [bld.path.get_bld()])
344 daemon.target = 'ladishd'
345 daemon.uselib = 'DBUS-1 UUID EXPAT DL UTIL'
346 daemon.ver_header = 'version.h'
347 # Make backtrace function lookup to work for functions in the executable itself
348 daemon.env.append_value("LINKFLAGS", ["-Wl,-E"])
350 daemon.source = ["string_constants.c"]
352 for source in [
353 'main.c',
354 'loader.c',
355 'sigsegv.c',
356 'proctitle.c',
357 'appdb.c',
358 'procfs.c',
359 'control.c',
360 'studio.c',
361 'graph.c',
362 'graph_manager.c',
363 'client.c',
364 'port.c',
365 'virtualizer.c',
366 'dict.c',
367 'graph_dict.c',
368 'escape.c',
369 'studio_jack_conf.c',
370 'studio_list.c',
371 'save.c',
372 'load.c',
373 'cmd_load_studio.c',
374 'cmd_new_studio.c',
375 'cmd_rename_studio.c',
376 'cmd_save_studio.c',
377 'cmd_start_studio.c',
378 'cmd_stop_studio.c',
379 'cmd_unload_studio.c',
380 'cmd_new_app.c',
381 'cmd_change_app_state.c',
382 'cmd_remove_app.c',
383 'cmd_create_room.c',
384 'cmd_delete_room.c',
385 'cmd_save_project.c',
386 'cmd_unload_project.c',
387 'cmd_load_project.c',
388 'cmd_exit.c',
389 'cqueue.c',
390 'app_supervisor.c',
391 'room.c',
392 'room_save.c',
393 'room_load.c',
394 'recent_store.c',
395 'recent_projects.c',
396 'check_integrity.c',
397 'lash_server.c',
398 'jack_session.c',
400 daemon.source.append(os.path.join("daemon", source))
402 for source in [
403 'jack_proxy.c',
404 'graph_proxy.c',
405 'a2j_proxy.c',
406 "jmcore_proxy.c",
407 "notify_proxy.c",
408 "conf_proxy.c",
409 "lash_client_proxy.c",
411 daemon.source.append(os.path.join("proxies", source))
413 for source in [
414 'signal.c',
415 'method.c',
416 'object_path.c',
417 'interface.c',
418 'helpers.c',
420 daemon.source.append(os.path.join("cdbus", source))
422 for source in [
423 'log.c',
424 'time.c',
425 'dirhelpers.c',
426 'catdup.c',
428 daemon.source.append(os.path.join("common", source))
430 daemon.source.append(os.path.join("alsapid", "helper.c"))
432 # process dbus.service.in -> ladish.service
433 create_service_taskgen(bld, DBUS_NAME_BASE + '.service', DBUS_NAME_BASE, daemon.target)
435 #####################################################
436 # jmcore
437 jmcore = bld.program(source = [], features = 'c cprogram', includes = [bld.path.get_bld()])
438 jmcore.target = 'jmcore'
439 jmcore.uselib = 'DBUS-1 JACK'
440 jmcore.defines = ['LOG_OUTPUT_STDOUT']
441 jmcore.source = ['jmcore.c']
443 for source in [
444 'log.c',
446 jmcore.source.append(os.path.join("common", source))
448 for source in [
449 #'signal.c',
450 'method.c',
451 'object_path.c',
452 'interface.c',
453 'helpers.c',
455 jmcore.source.append(os.path.join("cdbus", source))
457 create_service_taskgen(bld, DBUS_NAME_BASE + '.jmcore.service', DBUS_NAME_BASE + ".jmcore", jmcore.target)
459 #####################################################
460 # conf
461 ladiconfd = bld.program(source = [], features = 'c cprogram', includes = [bld.path.get_bld()])
462 ladiconfd.target = 'ladiconfd'
463 ladiconfd.uselib = 'DBUS-1'
464 ladiconfd.defines = ['LOG_OUTPUT_STDOUT']
465 ladiconfd.source = ['conf.c']
467 for source in [
468 'log.c',
469 'dirhelpers.c',
470 'catdup.c',
472 ladiconfd.source.append(os.path.join("common", source))
474 for source in [
475 'signal.c',
476 'method.c',
477 'object_path.c',
478 'interface.c',
479 'helpers.c',
481 ladiconfd.source.append(os.path.join("cdbus", source))
483 create_service_taskgen(bld, DBUS_NAME_BASE + '.conf.service', DBUS_NAME_BASE + ".conf", ladiconfd.target)
485 #####################################################
486 # alsapid
487 alsapid = bld.shlib(source = [], features = 'c cshlib', includes = [bld.path.get_bld()])
488 alsapid.uselib = 'DL'
489 alsapid.target = 'alsapid'
490 for source in [
491 'lib.c',
492 'helper.c',
494 alsapid.source.append(os.path.join("alsapid", source))
496 #####################################################
497 # liblash
498 if bld.env['BUILD_LIBLASH']:
499 liblash = bld.shlib(source = [], features = 'c cshlib', includes = [bld.path.get_bld()])
500 liblash.uselib = 'DBUS-1'
501 liblash.target = 'lash'
502 liblash.vnum = "1.1.1"
503 liblash.defines = ['LOG_OUTPUT_STDOUT']
504 liblash.source = [os.path.join("lash_compat", "liblash", 'lash.c')]
506 for source in [
507 'dirhelpers.c',
508 'catdup.c',
509 'file.c',
510 'log.c',
512 liblash.source.append(os.path.join("common", source))
514 for source in [
515 'method.c',
516 'object_path.c',
517 'interface.c',
518 'helpers.c',
520 liblash.source.append(os.path.join("cdbus", source))
522 bld.install_files('${PREFIX}/include/lash-1.0/lash', bld.path.ant_glob('lash_compat/liblash/lash/*.h'))
524 # process lash-1.0.pc.in -> lash-1.0.pc
525 bld(
526 features = 'subst', # the feature 'subst' overrides the source/target processing
527 source = os.path.join("lash_compat", 'lash-1.0.pc.in'), # list of string or nodes
528 target = 'lash-1.0.pc', # list of strings or nodes
529 install_path = '${LIBDIR}/pkgconfig/',
530 # variables to use in the substitution
531 prefix = bld.env['PREFIX'],
532 exec_prefix = bld.env['PREFIX'],
533 libdir = bld.env['LIBDIR'],
534 includedir = os.path.normpath(bld.env['PREFIX'] + '/include'))
536 #####################################################
537 # pylash
538 if bld.env['BUILD_PYLASH']:
539 pylash = bld.shlib(source = [], features = 'c cshlib pyext', includes = ["lash_compat/liblash"])
540 pylash.target = '_lash'
541 pylash.use = 'lash'
542 pylash.install_path = '${PYTHONDIR}'
544 for source in [
545 'lash.c',
546 'lash_wrap.c',
548 pylash.source.append(os.path.join("lash_compat", "pylash", source))
550 bld.install_files('${PYTHONDIR}', os.path.join("lash_compat", "pylash", "lash.py"))
552 #####################################################
553 # gladish
554 if bld.env['BUILD_GLADISH']:
555 gladish = bld.program(source = [], features = 'c cxx cxxprogram', includes = [bld.path.get_bld()])
556 gladish.target = 'gladish'
557 gladish.defines = ['LOG_OUTPUT_STDOUT']
558 gladish.uselib = 'DBUS-1 DBUS-GLIB-1 GTKMM-2.4 LIBGNOMECANVASMM-2.6 GTK+-2.0'
560 gladish.source = ["string_constants.c"]
562 for source in [
563 'main.c',
564 'load_project_dialog.c',
565 'save_project_dialog.c',
566 'project_properties.c',
567 'world_tree.c',
568 'graph_view.c',
569 'canvas.cpp',
570 'graph_canvas.c',
571 'gtk_builder.c',
572 'ask_dialog.c',
573 'create_room_dialog.c',
574 'menu.c',
575 'dynmenu.c',
576 'toolbar.c',
577 'about.c',
578 'dbus.c',
579 'studio.c',
580 'studio_list.c',
581 'dialogs.c',
582 'jack.c',
583 'control.c',
584 'pixbuf.c',
585 'room.c',
586 'statusbar.c',
587 'action.c',
588 'settings.c',
589 'zoom.c',
591 gladish.source.append(os.path.join("gui", source))
593 for source in [
594 'Module.cpp',
595 'Item.cpp',
596 'Port.cpp',
597 'Connection.cpp',
598 'Ellipse.cpp',
599 'Canvas.cpp',
600 'Connectable.cpp',
602 gladish.source.append(os.path.join("gui", "flowcanvas", source))
604 for source in [
605 'jack_proxy.c',
606 'a2j_proxy.c',
607 'graph_proxy.c',
608 'studio_proxy.c',
609 'control_proxy.c',
610 'app_supervisor_proxy.c',
611 "room_proxy.c",
612 "conf_proxy.c",
614 gladish.source.append(os.path.join("proxies", source))
616 for source in [
617 'method.c',
618 'helpers.c',
620 gladish.source.append(os.path.join("cdbus", source))
622 for source in [
623 'log.c',
624 'catdup.c',
625 'file.c',
627 gladish.source.append(os.path.join("common", source))
629 # GtkBuilder UI definitions (XML)
630 bld.install_files('${DATA_DIR}', 'gui/gladish.ui')
632 bld.install_files('${PREFIX}/bin', 'ladish_control', chmod=0755)
634 # 'Desktop' file (menu entry, icon, etc)
635 bld.install_files('${PREFIX}/share/applications/', 'gui/gladish.desktop', chmod=0644)
637 # Icons
638 icon_sizes = ['16x16', '22x22', '24x24', '32x32', '48x48', '256x256']
639 for icon_size in icon_sizes:
640 bld.path.ant_glob('art/' + icon_size + '/apps/*.png')
641 bld.install_files('${PREFIX}/share/icons/hicolor/' + icon_size + '/apps/', 'art/' + icon_size + '/apps/gladish.png')
643 status_images = []
644 for status in ["down", "unloaded", "started", "stopped", "warning", "error"]:
645 status_images.append("art/status_" + status + ".png")
647 bld.install_files('${DATA_DIR}', status_images)
648 bld.install_files('${DATA_DIR}', "art/ladish-logo-128x128.png")
649 bld.install_files('${DATA_DIR}', ["AUTHORS", "README", "NEWS"])
650 bld.install_as('${DATA_DIR}/COPYING', "gpl2.txt")
652 if bld.env['BUILD_DOXYGEN_DOCS'] == True:
653 html_docs_source_dir = "build/default/html"
654 if bld.cmd == 'clean':
655 if os.access(html_docs_source_dir, os.R_OK):
656 pprint('CYAN', "Removing doxygen generated documentation...")
657 shutil.rmtree(html_docs_source_dir)
658 pprint('CYAN', "Removing doxygen generated documentation done.")
659 elif bld.cmd == 'build':
660 if not os.access(html_docs_source_dir, os.R_OK):
661 os.popen("doxygen").read()
662 else:
663 pprint('CYAN', "doxygen documentation already built.")
665 bld(features='intltool_po', appname=APPNAME, podir='po', install_path="${LOCALE_DIR}")
667 def get_tags_dirs():
668 source_root = os.path.dirname(Utils.g_module.root_path)
669 if 'relpath' in os.path.__all__:
670 source_root = os.path.relpath(source_root)
671 paths = source_root
672 paths += " " + os.path.join(source_root, "common")
673 paths += " " + os.path.join(source_root, "cdbus")
674 paths += " " + os.path.join(source_root, "proxies")
675 paths += " " + os.path.join(source_root, "daemon")
676 paths += " " + os.path.join(source_root, "gui")
677 paths += " " + os.path.join(source_root, "example-apps")
678 paths += " " + os.path.join(source_root, "lib")
679 paths += " " + os.path.join(source_root, "lash_compat", "liblash")
680 paths += " " + os.path.join(source_root, "lash_compat", "liblash", "lash")
681 return paths
683 def gtags(ctx):
684 '''build tag files for GNU global'''
685 cmd = "find %s -mindepth 1 -maxdepth 1 -name '*.[ch]' -print | gtags --statistics -f -" % get_tags_dirs()
686 #print("Running: %s" % cmd)
687 os.system(cmd)
689 def etags(ctx):
690 '''build TAGS file using etags'''
691 cmd = "find %s -mindepth 1 -maxdepth 1 -name '*.[ch]' -print | etags -" % get_tags_dirs()
692 #print("Running: %s" % cmd)
693 os.system(cmd)
694 os.system("stat -c '%y' TAGS")
696 class ladish_dist(waflib.Scripting.Dist):
697 cmd = 'dist'
698 fun = 'dist'
700 def __init__(self):
701 Dist.__init__(self)
702 if Options.options.distname:
703 self.base_name = Options.options.distname
704 else:
705 try:
706 self.base_name = self.cmd_and_log("LANG= git describe --tags", quiet=waflib.Context.BOTH).splitlines()[0]
707 except:
708 self.base_name = APPNAME + '-' + VERSION
709 self.base_name += Options.options.distsuffix
711 #print self.base_name
713 if Options.options.distname and Options.options.tagdist:
714 ret = self.exec_command("LANG= git tag " + self.base_name)
715 if ret != 0:
716 raise waflib.Errors.WafError('git tag creation failed')
718 def get_base_name(self):
719 return self.base_name
721 def get_excl(self):
722 excl = Dist.get_excl(self)
724 excl += ' .gitmodules'
725 excl += ' GTAGS'
726 excl += ' GRTAGS'
727 excl += ' GPATH'
728 excl += ' GSYMS'
730 if Options.options.distnodeps:
731 excl += ' laditools'
732 excl += ' jack2'
733 excl += ' a2jmidid'
735 #print repr(excl)
736 return excl
738 def execute(self):
739 shutil.copy('./build/version.h', "./")
740 try:
741 super(ladish_dist, self).execute()
742 finally:
743 os.remove("version.h")