Merge branch 'stable' into 'main'
[ladish.git] / wscript
blob89c785f69f52b3d79a8996ab6cb58af935fa6150
1 #! /usr/bin/env python
2 # encoding: utf-8
4 from __future__ import with_statement
7 parallel_debug = False
9 APPNAME='ladish'
10 VERSION='2-dev'
11 DBUS_NAME_BASE = 'org.ladish'
12 RELEASE = False
14 # these variables are mandatory ('/' are converted automatically)
15 top = '.'
16 out = 'build'
18 import os, sys, re, io, optparse, shutil, tokenize
19 from hashlib import md5
21 from waflib import Errors, Utils, Options, Logs, Scripting
22 from waflib import Configure
23 from waflib import Context
25 def display_msg(conf, msg="", status = None, color = None):
26 if status:
27 conf.msg(msg, status, color)
28 else:
29 Logs.pprint('NORMAL', msg)
31 def display_raw_text(conf, text, color = 'NORMAL'):
32 Logs.pprint(color, text, sep = '')
34 def display_line(conf, text, color = 'NORMAL'):
35 Logs.pprint(color, text, sep = os.linesep)
37 def yesno(bool):
38 if bool:
39 return "yes"
40 else:
41 return "no"
43 def options(opt):
44 opt.load('compiler_c')
45 opt.load('compiler_cxx')
46 opt.load('python')
47 opt.add_option('--enable-pkg-config-dbus-service-dir', action='store_true', default=False, help='force D-Bus service install dir to be one returned by pkg-config')
48 opt.add_option('--enable-gladish', action='store_true', default=False, help='Build gladish')
49 opt.add_option('--enable-liblash', action='store_true', default=False, help='Build LASH compatibility library')
50 opt.add_option('--debug', action='store_true', default=False, dest='debug', help="Build debuggable binaries")
51 opt.add_option('--siginfo', action='store_true', default=False, dest='siginfo', help="Log backtrace on fatal signal")
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 opt.add_option('--docdir', type='string', default=None, help="Define doc dir [default: PREFIX'/share/doc/" + APPNAME + ']')
61 if parallel_debug:
62 opt.load('parallel_debug')
64 def add_cflag(conf, flag):
65 conf.env.prepend_value('CXXFLAGS', flag)
66 conf.env.prepend_value('CFLAGS', flag)
68 def add_linkflag(conf, flag):
69 conf.env.prepend_value('LINKFLAGS', flag)
71 def check_gcc_optimizations_enabled(flags):
72 gcc_optimizations_enabled = False
73 for flag in flags:
74 if len(flag) < 2 or flag[0] != '-' or flag[1] != 'O':
75 continue
76 if len(flag) == 2:
77 gcc_optimizations_enabled = True;
78 else:
79 gcc_optimizations_enabled = flag[2] != '0';
80 return gcc_optimizations_enabled
82 def create_service_taskgen(bld, target, opath, binary):
83 bld(
84 features = 'subst', # the feature 'subst' overrides the source/target processing
85 source = os.path.join('daemon', 'dbus.service.in'), # list of string or nodes
86 target = target, # list of strings or nodes
87 install_path = bld.env['DBUS_SERVICES_DIR'] + os.path.sep,
88 # variables to use in the substitution
89 dbus_object_path = opath,
90 daemon_bin_path = os.path.join(bld.env['PREFIX'], 'bin', binary))
92 def configure(conf):
93 conf.load('compiler_c')
94 conf.load('compiler_cxx')
95 conf.load('python')
96 conf.load('intltool')
97 if parallel_debug:
98 conf.load('parallel_debug')
100 # dladdr() is used by daemon/siginfo.c
101 # dlvsym() is used by the alsapid library
102 conf.check_cc(msg="Checking for libdl", lib=['dl'], uselib_store='DL')
104 # forkpty() is used by ladishd
105 conf.check_cc(msg="Checking for libutil", lib=['util'], uselib_store='UTIL')
107 conf.check_cfg(
108 package = 'jack',
109 mandatory = True,
110 errmsg = "not installed, see http://jackaudio.org/",
111 args = '--cflags --libs')
113 conf.check_cfg(
114 package = 'alsa',
115 mandatory = True,
116 errmsg = "not installed, see http://www.alsa-project.org/",
117 args = '--cflags')
119 conf.check_cfg(
120 package = 'dbus-1',
121 atleast_version = '1.0.0',
122 mandatory = True,
123 errmsg = "not installed, see http://dbus.freedesktop.org/",
124 args = '--cflags --libs')
126 dbus_dir = conf.check_cfg(package='dbus-1', args='--variable=session_bus_services_dir', msg="Retrieving D-Bus services dir")
127 if not dbus_dir:
128 return
130 dbus_dir = dbus_dir.strip()
131 conf.env['DBUS_SERVICES_DIR_REAL'] = dbus_dir
133 if Options.options.enable_pkg_config_dbus_service_dir:
134 conf.env['DBUS_SERVICES_DIR'] = dbus_dir
135 else:
136 conf.env['DBUS_SERVICES_DIR'] = os.path.join(os.path.normpath(conf.env['PREFIX']), 'share', 'dbus-1', 'services')
138 conf.check_cfg(
139 package = 'cdbus-1',
140 atleast_version = '1.0.0',
141 mandatory = True,
142 errmsg = "not installed, see https://github.com/LADI/cdbus",
143 args = '--cflags --libs')
145 if Options.options.libdir:
146 conf.env['LIBDIR'] = Options.options.libdir
147 else:
148 conf.env['LIBDIR'] = os.path.join(os.path.normpath(conf.env['PREFIX']), 'lib')
150 if Options.options.docdir:
151 conf.env['DOCDIR'] = Options.options.docdir
152 else:
153 conf.env['DOCDIR'] = os.path.join(os.path.normpath(conf.env['PREFIX']), 'share', 'doc', APPNAME)
155 conf.env['BUILD_DOXYGEN_DOCS'] = Options.options.doxygen
157 conf.check_cfg(
158 package = 'uuid',
159 mandatory = True,
160 errmsg = "not installed, see http://e2fsprogs.sourceforge.net/",
161 args = '--cflags --libs')
163 conf.check(
164 header_name='expat.h',
165 mandatory = True,
166 errmsg = "not installed, see http://expat.sourceforge.net/")
168 conf.env['LIB_EXPAT'] = ['expat']
170 if Options.options.enable_gladish:
171 conf.check_cfg(
172 package = 'glib-2.0',
173 errmsg = "not installed, see http://www.gtk.org/",
174 args = '--cflags --libs')
175 conf.check_cfg(
176 package = 'dbus-glib-1',
177 errmsg = "not installed, see http://dbus.freedesktop.org/",
178 args = '--cflags --libs')
179 conf.check_cfg(
180 package = 'gtk+-2.0',
181 atleast_version = '2.20.0',
182 errmsg = "not installed, see http://www.gtk.org/",
183 args = '--cflags --libs')
184 conf.check_cfg(
185 package = 'gtkmm-2.4',
186 atleast_version = '2.10.0',
187 errmsg = "not installed, see http://www.gtkmm.org",
188 args = '--cflags --libs')
190 conf.check_cfg(
191 package = 'libgnomecanvasmm-2.6',
192 atleast_version = '2.6.0',
193 errmsg = "not installed, see http://www.gtkmm.org",
194 args = '--cflags --libs')
196 #autowaf.check_pkg(conf, 'libgvc', uselib_store='AGRAPH', atleast_version='2.8', mandatory=False)
198 # The boost headers package (e.g. libboost-dev) is needed
199 conf.multicheck(
200 {'header_name': "boost/shared_ptr.hpp"},
201 {'header_name': "boost/weak_ptr.hpp"},
202 {'header_name': "boost/enable_shared_from_this.hpp"},
203 {'header_name': "boost/utility.hpp"},
204 msg = "Checking for boost headers",
205 mandatory = False)
206 display_msg(conf, 'Found boost/shared_ptr.hpp',
207 yesno(conf.env['HAVE_BOOST_SHARED_PTR_HPP']))
208 display_msg(conf, 'Found boost/weak_ptr.hpp',
209 yesno(conf.env['HAVE_BOOST_WEAK_PTR_HPP']))
210 display_msg(conf, 'Found boost/enable_shared_from_this.hpp',
211 yesno(conf.env['HAVE_BOOST_ENABLE_SHARED_FROM_THIS_HPP']))
212 display_msg(conf, 'Found boost/utility.hpp',
213 yesno(conf.env['HAVE_BOOST_UTILITY_HPP']))
214 if not (conf.env['HAVE_BOOST_SHARED_PTR_HPP'] and \
215 conf.env['HAVE_BOOST_WEAK_PTR_HPP'] and \
216 conf.env['HAVE_BOOST_ENABLE_SHARED_FROM_THIS_HPP'] and \
217 conf.env['HAVE_BOOST_UTILITY_HPP']):
218 display_line(conf, "One or more boost headers not found, see http://boost.org/")
219 sys.exit(1)
221 conf.env['BUILD_GLADISH'] = Options.options.enable_gladish
222 conf.env['BUILD_LIBLASH'] = Options.options.enable_liblash
223 conf.env['BUILD_SIGINFO'] = Options.options.siginfo
225 add_cflag(conf, '-fvisibility=hidden')
227 conf.env['BUILD_WERROR'] = False #not RELEASE
228 add_cflag(conf, '-Wall')
230 add_cflag(conf, '-Wimplicit-fallthrough=2')
232 if conf.env['BUILD_WERROR']:
233 add_cflag(conf, '-Werror')
234 # for pre gcc-4.4, enable optimizations so use of uninitialized variables gets detected
235 try:
236 is_gcc = conf.env['CC_NAME'] == 'gcc'
237 if is_gcc:
238 gcc_ver = []
239 for n in conf.env['CC_VERSION']:
240 gcc_ver.append(int(n))
241 if gcc_ver[0] < 4 or gcc_ver[1] < 4:
242 #print "optimize force enable is required"
243 if not check_gcc_optimizations_enabled(conf.env['CFLAGS']):
244 if Options.options.debug:
245 print ("C optimization must be forced in order to enable -Wuninitialized")
246 print ("However this will not be made because debug compilation is enabled")
247 else:
248 print ("C optimization forced in order to enable -Wuninitialized")
249 conf.env.append_unique('CFLAGS', "-O")
250 except:
251 pass
253 conf.env['BUILD_DEBUG'] = Options.options.debug
254 if conf.env['BUILD_DEBUG']:
255 add_cflag(conf, '-g')
256 add_cflag(conf, '-O0')
257 add_linkflag(conf, '-g')
259 conf.env['DATA_DIR'] = os.path.normpath(os.path.join(conf.env['PREFIX'], 'share', APPNAME))
260 conf.env['LOCALE_DIR'] = os.path.normpath(os.path.join(conf.env['PREFIX'], 'share', 'locale'))
262 # write some parts of the configure environment to the config.h file
263 conf.define('DATA_DIR', conf.env['DATA_DIR'])
264 conf.define('LOCALE_DIR', conf.env['LOCALE_DIR'])
265 conf.define('PACKAGE_VERSION', VERSION)
266 conf.define('DBUS_NAME_BASE', DBUS_NAME_BASE)
267 conf.define('DBUS_BASE_PATH', '/' + DBUS_NAME_BASE.replace('.', '/'))
268 conf.define('BASE_NAME', APPNAME)
269 conf.define('SIGINFO_ENABLED', conf.env['BUILD_SIGINFO'])
270 conf.define('_GNU_SOURCE', 1)
271 conf.write_config_header('config.h')
273 display_msg(conf)
275 display_msg(conf, "==================")
276 version_msg = APPNAME + "-" + VERSION
278 if os.access('version.h', os.R_OK):
279 data = open('version.h').read()
280 m = re.match(r'^#define GIT_VERSION "([^"]*)"$', data)
281 if m != None:
282 version_msg += " exported from " + m.group(1)
283 elif os.access('.git', os.R_OK):
284 version_msg += " git revision will checked and eventually updated during build"
286 display_msg(conf, version_msg)
288 display_msg(conf)
289 display_msg(conf, "Install prefix", conf.env['PREFIX'], 'CYAN')
291 display_msg(conf, 'Build gladish', yesno(conf.env['BUILD_GLADISH']))
292 display_msg(conf, 'Build liblash', yesno(Options.options.enable_liblash))
293 display_msg(conf, 'Build with siginfo', yesno(conf.env['BUILD_SIGINFO']))
294 display_msg(conf, 'Treat warnings as errors', yesno(conf.env['BUILD_WERROR']))
295 display_msg(conf, 'Debuggable binaries', yesno(conf.env['BUILD_DEBUG']))
296 display_msg(conf, 'Build doxygen documentation', yesno(conf.env['BUILD_DOXYGEN_DOCS']))
298 if conf.env['DBUS_SERVICES_DIR'] != conf.env['DBUS_SERVICES_DIR_REAL']:
299 display_msg(conf)
300 display_line(conf, "WARNING: D-Bus session services directory as reported by pkg-config is", 'RED')
301 display_raw_text(conf, "WARNING:", 'RED')
302 display_line(conf, conf.env['DBUS_SERVICES_DIR_REAL'], 'CYAN')
303 display_line(conf, 'WARNING: but service file will be installed in', 'RED')
304 display_raw_text(conf, "WARNING:", 'RED')
305 display_line(conf, conf.env['DBUS_SERVICES_DIR'], 'CYAN')
306 display_line(conf, 'WARNING: You may need to adjust your D-Bus configuration after installing ladish', 'RED')
307 display_line(conf, 'WARNING: You can override dbus service install directory', 'RED')
308 display_line(conf, 'WARNING: with --enable-pkg-config-dbus-service-dir option to this script', 'RED')
310 display_msg(conf, 'C compiler flags', repr(conf.env['CFLAGS']))
311 display_msg(conf, 'C++ compiler flags', repr(conf.env['CXXFLAGS']))
312 display_msg(conf, 'Linker flags', repr(conf.env['LINKFLAGS']))
314 if not conf.env['BUILD_GLADISH']:
315 display_msg(conf)
316 display_line(conf, "WARNING: The GUI frontend will not built", 'RED')
318 display_msg(conf)
320 def git_ver(self):
321 bld = self.generator.bld
322 header = self.outputs[0].abspath()
323 if os.access('./version.h', os.R_OK):
324 header = os.path.join(os.getcwd(), out, "version.h")
325 shutil.copy('./version.h', header)
326 data = open(header).read()
327 m = re.match(r'^#define GIT_VERSION "([^"]*)"$', data)
328 if m != None:
329 self.ver = m.group(1)
330 Logs.pprint('BLUE', "tarball from git revision " + self.ver)
331 else:
332 self.ver = "tarball"
333 return
335 if bld.srcnode.find_node('.git'):
336 self.ver = bld.cmd_and_log("LANG= git rev-parse HEAD", quiet=Context.BOTH).splitlines()[0]
337 if bld.cmd_and_log("LANG= git diff-index --name-only HEAD", quiet=Context.BOTH).splitlines():
338 self.ver += "-dirty"
340 Logs.pprint('BLUE', "git revision " + self.ver)
341 else:
342 self.ver = "unknown"
344 fi = open(header, 'w')
345 fi.write('#define GIT_VERSION "%s"\n' % self.ver)
346 fi.close()
348 def build(bld):
349 if not bld.env['DATA_DIR']:
350 raise "DATA_DIR is emtpy"
352 bld(rule=git_ver, target='version.h', update_outputs=True, always=True, ext_out=['.h'])
354 daemon = bld.program(source = [], features = 'c cprogram', includes = [bld.path.get_bld()])
355 daemon.target = 'ladishd'
356 daemon.uselib = 'DBUS-1 CDBUS-1 UUID EXPAT DL UTIL'
357 daemon.ver_header = 'version.h'
358 # Make backtrace function lookup to work for functions in the executable itself
359 daemon.env.append_value("LINKFLAGS", ["-Wl,-E"])
360 daemon.defines = ["HAVE_CONFIG_H"]
362 daemon.source = ["string_constants.c"]
364 for source in [
365 'main.c',
366 'loader.c',
367 'proctitle.c',
368 'procfs.c',
369 'control.c',
370 'studio.c',
371 'graph.c',
372 'graph_manager.c',
373 'client.c',
374 'port.c',
375 'virtualizer.c',
376 'dict.c',
377 'graph_dict.c',
378 'escape.c',
379 'studio_jack_conf.c',
380 'studio_list.c',
381 'save.c',
382 'load.c',
383 'cmd_load_studio.c',
384 'cmd_new_studio.c',
385 'cmd_rename_studio.c',
386 'cmd_save_studio.c',
387 'cmd_start_studio.c',
388 'cmd_stop_studio.c',
389 'cmd_unload_studio.c',
390 'cmd_new_app.c',
391 'cmd_change_app_state.c',
392 'cmd_remove_app.c',
393 'cmd_create_room.c',
394 'cmd_delete_room.c',
395 'cmd_save_project.c',
396 'cmd_unload_project.c',
397 'cmd_load_project.c',
398 'cmd_exit.c',
399 'cqueue.c',
400 'app_supervisor.c',
401 'room.c',
402 'room_save.c',
403 'room_load.c',
404 'recent_store.c',
405 'recent_projects.c',
406 'check_integrity.c',
407 'lash_server.c',
408 'jack_session.c',
410 daemon.source.append(os.path.join("daemon", source))
412 if Options.options.siginfo:
413 daemon.source.append(os.path.join("daemon", 'siginfo.c'))
415 for source in [
416 'jack_proxy.c',
417 'graph_proxy.c',
418 'a2j_proxy.c',
419 "jmcore_proxy.c",
420 "notify_proxy.c",
421 "conf_proxy.c",
422 "lash_client_proxy.c",
424 daemon.source.append(os.path.join("proxies", source))
426 for source in [
427 'log.c',
428 'time.c',
429 'dirhelpers.c',
430 'catdup.c',
432 daemon.source.append(os.path.join("common", source))
434 daemon.source.append(os.path.join("alsapid", "helper.c"))
436 # process dbus.service.in -> ladish.service
437 create_service_taskgen(bld, DBUS_NAME_BASE + '.service', DBUS_NAME_BASE, daemon.target)
439 #####################################################
440 # jmcore
441 jmcore = bld.program(source = [], features = 'c cprogram', includes = [bld.path.get_bld()])
442 jmcore.target = 'jmcore'
443 jmcore.uselib = 'DBUS-1 CDBUS-1 JACK'
444 jmcore.defines = ['LOG_OUTPUT_STDOUT']
445 jmcore.source = ['jmcore.c']
447 for source in [
448 'log.c',
450 jmcore.source.append(os.path.join("common", source))
452 create_service_taskgen(bld, DBUS_NAME_BASE + '.jmcore.service', DBUS_NAME_BASE + ".jmcore", jmcore.target)
454 #####################################################
455 # conf
456 ladiconfd = bld.program(source = [], features = 'c cprogram', includes = [bld.path.get_bld()])
457 ladiconfd.target = 'ladiconfd'
458 ladiconfd.uselib = 'DBUS-1 CDBUS-1'
459 ladiconfd.defines = ['LOG_OUTPUT_STDOUT']
460 ladiconfd.source = ['conf.c']
462 for source in [
463 'log.c',
464 'dirhelpers.c',
465 'catdup.c',
467 ladiconfd.source.append(os.path.join("common", source))
469 create_service_taskgen(bld, DBUS_NAME_BASE + '.conf.service', DBUS_NAME_BASE + ".conf", ladiconfd.target)
471 #####################################################
472 # alsapid
473 alsapid = bld.shlib(source = [], features = 'c cshlib', includes = [bld.path.get_bld()])
474 alsapid.uselib = 'DL'
475 alsapid.target = 'alsapid'
476 for source in [
477 'lib.c',
478 'helper.c',
480 alsapid.source.append(os.path.join("alsapid", source))
482 #####################################################
483 # liblash
484 if bld.env['BUILD_LIBLASH']:
485 liblash = bld.shlib(source = [], features = 'c cshlib', includes = [bld.path.get_bld()])
486 liblash.uselib = 'DBUS-1 CDBUS-1'
487 liblash.target = 'lash'
488 liblash.vnum = "1.1.1"
489 liblash.defines = ['LOG_OUTPUT_STDOUT']
490 liblash.source = [os.path.join("lash_compat", "liblash", 'lash.c')]
492 for source in [
493 'dirhelpers.c',
494 'catdup.c',
495 'file.c',
496 'log.c',
498 liblash.source.append(os.path.join("common", source))
500 bld.install_files('${PREFIX}/include/lash-1.0/lash', bld.path.ant_glob('lash_compat/liblash/lash/*.h'))
502 # process lash-1.0.pc.in -> lash-1.0.pc
503 bld(
504 features = 'subst', # the feature 'subst' overrides the source/target processing
505 source = os.path.join("lash_compat", 'lash-1.0.pc.in'), # list of string or nodes
506 target = 'lash-1.0.pc', # list of strings or nodes
507 install_path = '${LIBDIR}/pkgconfig/',
508 # variables to use in the substitution
509 prefix = bld.env['PREFIX'],
510 exec_prefix = bld.env['PREFIX'],
511 libdir = bld.env['LIBDIR'],
512 includedir = os.path.normpath(bld.env['PREFIX'] + '/include'))
514 #####################################################
515 # gladish
516 if bld.env['BUILD_GLADISH']:
517 gladish = bld.program(source = [], features = 'c cxx cxxprogram', includes = [bld.path.get_bld()])
518 gladish.target = 'gladish'
519 gladish.defines = ['LOG_OUTPUT_STDOUT']
520 gladish.uselib = 'DBUS-1 CDBUS-1 DBUS-GLIB-1 GTKMM-2.4 LIBGNOMECANVASMM-2.6 GTK+-2.0'
522 gladish.source = ["string_constants.c"]
524 for source in [
525 'main.c',
526 'load_project_dialog.c',
527 'save_project_dialog.c',
528 'project_properties.c',
529 'world_tree.c',
530 'graph_view.c',
531 'canvas.cpp',
532 'graph_canvas.c',
533 'gtk_builder.c',
534 'ask_dialog.c',
535 'create_room_dialog.c',
536 'menu.c',
537 'dynmenu.c',
538 'toolbar.c',
539 'about.c',
540 'dbus.c',
541 'studio.c',
542 'studio_list.c',
543 'dialogs.c',
544 'jack.c',
545 'control.c',
546 'pixbuf.c',
547 'room.c',
548 'statusbar.c',
549 'action.c',
550 'settings.c',
551 'zoom.c',
553 gladish.source.append(os.path.join("gui", source))
555 for source in [
556 'Module.cpp',
557 'Item.cpp',
558 'Port.cpp',
559 'Connection.cpp',
560 'Ellipse.cpp',
561 'Canvas.cpp',
562 'Connectable.cpp',
564 gladish.source.append(os.path.join("gui", "flowcanvas", source))
566 for source in [
567 'jack_proxy.c',
568 'a2j_proxy.c',
569 'graph_proxy.c',
570 'studio_proxy.c',
571 'control_proxy.c',
572 'app_supervisor_proxy.c',
573 "room_proxy.c",
574 "conf_proxy.c",
576 gladish.source.append(os.path.join("proxies", source))
578 for source in [
579 'log.c',
580 'catdup.c',
581 'file.c',
583 gladish.source.append(os.path.join("common", source))
585 # GtkBuilder UI definitions (XML)
586 bld.install_files('${DATA_DIR}', 'gui/gladish.ui')
588 # 'Desktop' file (menu entry, icon, etc)
589 bld.install_files('${PREFIX}/share/applications/', 'gui/gladish.desktop', chmod=0o0644)
591 # Icons
592 icon_sizes = ['16x16', '22x22', '24x24', '32x32', '48x48', '256x256']
593 for icon_size in icon_sizes:
594 bld.path.ant_glob('art/' + icon_size + '/apps/*.png')
595 bld.install_files('${PREFIX}/share/icons/hicolor/' + icon_size + '/apps/', 'art/' + icon_size + '/apps/gladish.png')
597 status_images = []
598 for status in ["down", "unloaded", "started", "stopped", "warning", "error"]:
599 status_images.append("art/status_" + status + ".png")
601 bld.install_files('${DATA_DIR}', status_images)
602 bld.install_files('${DATA_DIR}', "art/ladish-logo-128x128.png")
604 bld(features='intltool_po', appname=APPNAME, podir='po', install_path="${LOCALE_DIR}")
606 bld.install_files('${PREFIX}/bin', 'ladish_control', chmod=0o0755)
608 bld.install_files('${DOCDIR}', ["AUTHORS", "README.adoc", "NEWS"])
609 bld.install_as('${DATA_DIR}/COPYING', "gpl2.txt")
611 if bld.env['BUILD_DOXYGEN_DOCS'] == True:
612 html_docs_source_dir = "build/default/html"
613 if bld.cmd == 'clean':
614 if os.access(html_docs_source_dir, os.R_OK):
615 Logs.pprint('CYAN', "Removing doxygen generated documentation...")
616 shutil.rmtree(html_docs_source_dir)
617 Logs.pprint('CYAN', "Removing doxygen generated documentation done.")
618 elif bld.cmd == 'build':
619 if not os.access(html_docs_source_dir, os.R_OK):
620 os.popen("doxygen").read()
621 else:
622 Logs.pprint('CYAN', "doxygen documentation already built.")
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, "proxies")
631 paths += " " + os.path.join(source_root, "daemon")
632 paths += " " + os.path.join(source_root, "gui")
633 paths += " " + os.path.join(source_root, "example-apps")
634 paths += " " + os.path.join(source_root, "lib")
635 paths += " " + os.path.join(source_root, "lash_compat", "liblash")
636 paths += " " + os.path.join(source_root, "lash_compat", "liblash", "lash")
637 return paths
639 def gtags(ctx):
640 '''build tag files for GNU global'''
641 cmd = "find %s -mindepth 1 -maxdepth 1 -name '*.[ch]' -print | gtags --statistics -f -" % get_tags_dirs()
642 #print("Running: %s" % cmd)
643 os.system(cmd)
645 def etags(ctx):
646 '''build TAGS file using etags'''
647 cmd = "find %s -mindepth 1 -maxdepth 1 -name '*.[ch]' -print | etags -" % get_tags_dirs()
648 #print("Running: %s" % cmd)
649 os.system(cmd)
650 os.system("stat -c '%y' TAGS")
652 class ladish_dist(Scripting.Dist):
653 cmd = 'dist'
654 fun = 'dist'
656 def __init__(self):
657 Scripting.Dist.__init__(self)
658 if Options.options.distname:
659 self.base_name = Options.options.distname
660 else:
661 try:
662 sha = self.cmd_and_log("LANG= git rev-parse --short HEAD", quiet=Context.BOTH).splitlines()[0]
663 self.base_name = APPNAME + '-' + VERSION + "-g" + sha
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 = Scripting.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 += ' jack2'
690 excl += ' a2jmidid'
692 #print repr(excl)
693 return excl
695 def execute(self):
696 shutil.copy('./build/version.h', "./")
697 try:
698 super(ladish_dist, self).execute()
699 finally:
700 os.remove("version.h")