12 DBUS_NAME_BASE
= 'org.ladish'
15 # these variables are mandatory ('/' are converted automatically)
19 def display_msg(conf
, msg
="", status
= None, color
= None):
21 conf
.check_message_1(msg
)
22 conf
.check_message_2(status
, color
)
24 Utils
.pprint('NORMAL', msg
)
26 def display_raw_text(conf
, text
, color
= 'NORMAL'):
27 Utils
.pprint(color
, text
, sep
= '')
29 def display_line(conf
, text
, color
= 'NORMAL'):
30 Utils
.pprint(color
, text
, sep
= os
.linesep
)
39 opt
.tool_options('compiler_cc')
40 opt
.tool_options('compiler_cxx')
41 opt
.tool_options('boost')
42 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')
43 opt
.add_option('--enable-liblash', action
='store_true', default
=False, help='Build LASH compatibility library')
45 opt
.add_option('--debug', action
='store_true', default
=False, dest
='debug', help="Build debuggable binaries")
47 def add_cflag(conf
, flag
):
48 conf
.env
.append_unique('CXXFLAGS', flag
)
49 conf
.env
.append_unique('CCFLAGS', flag
)
51 def add_linkflag(conf
, flag
):
52 conf
.env
.append_unique('LINKFLAGS', flag
)
55 conf
.check_tool('compiler_cc')
56 conf
.check_tool('compiler_cxx')
57 conf
.check_tool('boost')
61 atleast_version
= '1.0.0',
63 errmsg
= "not installed, see http://dbus.freedesktop.org/",
64 args
= '--cflags --libs')
66 dbus_dir
= conf
.check_cfg(package
='dbus-1', args
='--variable=session_bus_services_dir', msg
="Retrieving D-Bus services dir")
70 dbus_dir
= dbus_dir
.strip()
71 conf
.env
['DBUS_SERVICES_DIR_REAL'] = dbus_dir
73 if Options
.options
.enable_pkg_config_dbus_service_dir
:
74 conf
.env
['DBUS_SERVICES_DIR'] = dbus_dir
76 conf
.env
['DBUS_SERVICES_DIR'] = os
.path
.join(os
.path
.normpath(conf
.env
['PREFIX']), 'share', 'dbus-1', 'services')
78 conf
.env
['BUILD_LIBLASH'] = Options
.options
.enable_liblash
83 errmsg
= "not installed, see http://e2fsprogs.sourceforge.net/",
84 args
= '--cflags --libs')
87 header_name
='expat.h',
89 errmsg
= "not installed, see http://expat.sourceforge.net/")
91 conf
.env
['LIB_EXPAT'] = ['expat']
95 if build_gui
and not conf
.check_cfg(
98 errmsg
= "not installed, see http://www.gtk.org/",
99 args
= '--cflags --libs'):
102 if build_gui
and not conf
.check_cfg(
103 package
= 'dbus-glib-1',
105 errmsg
= "not installed, see http://dbus.freedesktop.org/",
106 args
= '--cflags --libs'):
109 if build_gui
and not conf
.check_cfg(
110 package
= 'gtk+-2.0',
112 errmsg
= "not installed, see http://www.gtk.org/",
113 args
= '--cflags --libs'):
116 if build_gui
and not conf
.check_cfg(
117 package
= 'libglade-2.0',
119 errmsg
= "not installed, see http://ftp.gnome.org/pub/GNOME/sources/libglade/",
120 args
= '--cflags --libs'):
123 if build_gui
and not conf
.check_cfg(
124 package
= 'flowcanvas',
126 atleast_version
= '0.5.3',
127 errmsg
= "not installed, see http://drobilla.net/software/flowcanvas/",
128 args
= '--cflags --libs'):
132 # We need the boost headers package (e.g. libboost-dev)
133 # shared_ptr.hpp and weak_ptr.hpp
134 build_gui
= conf
.check_boost(errmsg
="not found, see http://boost.org/")
136 conf
.env
['BUILD_GLADISH'] = build_gui
138 conf
.env
['BUILD_WERROR'] = not RELEASE
139 if conf
.env
['BUILD_WERROR']:
140 add_cflag(conf
, '-Wall')
141 add_cflag(conf
, '-Werror')
143 conf
.env
['BUILD_DEBUG'] = not RELEASE
or Options
.options
.debug
144 if conf
.env
['BUILD_DEBUG']:
145 add_cflag(conf
, '-g')
146 add_linkflag(conf
, '-g')
148 conf
.define('DATA_DIR', os
.path
.normpath(os
.path
.join(conf
.env
['PREFIX'], 'share', APPNAME
)))
149 conf
.define('PACKAGE_VERSION', VERSION
)
150 conf
.define('DBUS_NAME_BASE', DBUS_NAME_BASE
)
151 conf
.define('DBUS_BASE_PATH', '/' + DBUS_NAME_BASE
.replace('.', '/'))
152 conf
.define('BASE_NAME', APPNAME
)
153 conf
.define('_GNU_SOURCE', 1)
154 conf
.write_config_header('config.h')
158 display_msg(conf
, "==================")
159 version_msg
= APPNAME
+ "-" + VERSION
161 if os
.access('version.h', os
.R_OK
):
162 data
= file('version.h').read()
163 m
= re
.match(r
'^#define GIT_VERSION "([^"]*)"$', data
)
165 version_msg
+= " exported from " + m
.group(1)
166 elif os
.access('.git', os
.R_OK
):
167 version_msg
+= " git revision will checked and eventually updated during build"
169 display_msg(conf
, version_msg
)
172 display_msg(conf
, "Install prefix", conf
.env
['PREFIX'], 'CYAN')
174 display_msg(conf
, 'Build gladish', yesno(conf
.env
['BUILD_GLADISH']))
175 display_msg(conf
, 'Build liblash', yesno(Options
.options
.enable_liblash
))
176 display_msg(conf
, 'Treat warnings as errors', yesno(conf
.env
['BUILD_WERROR']))
177 display_msg(conf
, 'Debuggable binaries', yesno(conf
.env
['BUILD_DEBUG']))
179 if conf
.env
['DBUS_SERVICES_DIR'] != conf
.env
['DBUS_SERVICES_DIR_REAL']:
181 display_line(conf
, "WARNING: D-Bus session services directory as reported by pkg-config is", 'RED')
182 display_raw_text(conf
, "WARNING:", 'RED')
183 display_line(conf
, conf
.env
['DBUS_SERVICES_DIR_REAL'], 'CYAN')
184 display_line(conf
, 'WARNING: but service file will be installed in', 'RED')
185 display_raw_text(conf
, "WARNING:", 'RED')
186 display_line(conf
, conf
.env
['DBUS_SERVICES_DIR'], 'CYAN')
187 display_line(conf
, 'WARNING: You may need to adjust your D-Bus configuration after installing ladish', 'RED')
188 display_line(conf
, 'WARNING: You can override dbus service install directory', 'RED')
189 display_line(conf
, 'WARNING: with --enable-pkg-config-dbus-service-dir option to this script', 'RED')
194 daemon
= bld
.new_task_gen('cc', 'program')
195 daemon
.target
= 'ladishd'
196 daemon
.includes
= "build/default" # XXX config.h version.h and other generated files
197 daemon
.uselib
= 'DBUS-1 UUID EXPAT'
198 daemon
.ver_header
= 'version.h'
199 daemon
.env
.append_value("LINKFLAGS", ["-lutil", "-ldl", "-Wl,-E"])
223 'studio_jack_conf.c',
226 'cmd_rename_studio.c',
228 'cmd_start_studio.c',
230 'cmd_unload_studio.c',
235 daemon
.source
.append(os
.path
.join("daemon", source
))
242 daemon
.source
.append(os
.path
.join("proxies", source
))
252 daemon
.source
.append(os
.path
.join("dbus", source
))
254 daemon
.source
.append(os
.path
.join("common", "safety.c"))
256 # process name.arnaudov.nedko.ladish.service.in -> name.arnaudov.nedko.ladish.service
258 obj
= bld
.new_task_gen('subst')
259 obj
.source
= os
.path
.join('daemon', 'dbus.service.in')
260 obj
.target
= DBUS_NAME_BASE
+ '.service'
261 obj
.dict = {'dbus_object_path': DBUS_NAME_BASE
,
262 'daemon_bin_path': os
.path
.join(bld
.env
['PREFIX'], 'bin', daemon
.target
)}
263 obj
.install_path
= bld
.env
['DBUS_SERVICES_DIR'] + os
.path
.sep
264 obj
.fun
= misc
.subst_func
266 if bld
.env
['BUILD_LIBLASH']:
267 liblash
= bld
.new_task_gen('cc', 'shlib')
268 liblash
.includes
= "build/default" # XXX config.h version.h and other generated files
269 liblash
.uselib
= 'DBUS-1'
270 liblash
.target
= 'lash'
271 liblash
.vnum
= "1.1.1"
272 liblash
.defines
= ['LOG_OUTPUT_STDOUT']
273 liblash
.source
= [os
.path
.join("lash_compat", "liblash", 'lash.c')]
275 # pkgpyexec_LTLIBRARIES = _lash.la
276 # INCLUDES = $(PYTHON_INCLUDES)
277 # _lash_la_LDFLAGS = -module -avoid-version ../liblash/liblash.la
278 # _lash_la_SOURCES = lash.c lash.h lash_wrap.c
279 # pkgpyexec_SCRIPTS = lash.py
280 # CLEANFILES = lash_wrap.c lash.py lash.pyc zynjacku.defs
281 # EXTRA_DIST = test.py lash.i lash.py
282 # lash_wrap.c lash.py: lash.i lash.h
283 # swig -o lash_wrap.c -I$(top_srcdir) -python $(top_srcdir)/$(subdir)/lash.i
285 #####################################################
287 if bld
.env
['BUILD_GLADISH']:
288 gladish
= bld
.new_task_gen('cxx', 'program')
289 gladish
.features
.append('cc')
290 gladish
.target
= 'gladish'
291 gladish
.defines
= ['LOG_OUTPUT_STDOUT']
292 gladish
.includes
= "build/default" # XXX config.h version.h and other generated files
293 gladish
.uselib
= 'DBUS-1 DBUS-GLIB-1 LIBGLADE-2.0 FLOWCANVAS'
303 #'load_projects_dialog.cpp',
307 #'project_properties.cpp',
314 gladish
.source
.append(os
.path
.join("gui", source
))
321 'app_supervisor_proxy.c',
323 gladish
.source
.append(os
.path
.join("proxies", source
))
329 gladish
.source
.append(os
.path
.join("dbus", source
))
331 # Glade UI definitions (XML)
332 bld
.install_files(bld
.env
['DATA_DIR'], 'gui/gui.glade')
334 bld
.install_files('${PREFIX}/bin', 'ladish_control', chmod
=0755)
336 # 'Desktop' file (menu entry, icon, etc)
337 #obj = bld.create_obj('subst')
338 #obj.source = 'patchage.desktop.in'
339 #obj.target = 'patchage.desktop'
341 # 'BINDIR' : bld.env()['BINDIR'],
342 # 'APP_INSTALL_NAME' : bld.env()['APP_INSTALL_NAME'],
343 # 'APP_HUMAN_NAME' : bld.env()['APP_HUMAN_NAME'],
345 #install_as(os.path.normpath(bld.env()['DATADIR'] + 'applications/'), bld.env()['APP_INSTALL_NAME'] + '.desktop', 'build/default/patchage.desktop')
349 # Installation layout (with /usr prefix)
351 # /usr/share/applications/patchage.desktop
352 # /usr/share/icons/hicolor/16x16/apps/patchage.png
353 # /usr/share/icons/hicolor/22x22/apps/patchage.png
354 # /usr/share/icons/hicolor/24x24/apps/patchage.png
355 # /usr/share/icons/hicolor/32x32/apps/patchage.png
356 # /usr/share/icons/hicolor/48x48/apps/patchage.png
357 # /usr/share/icons/hicolor/scalable/apps/patchage.svg
358 # /usr/share/patchage/patchage.glade
360 # icon cache is updated using:
361 # gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
363 # Dave disabled this, ask why before removing this
364 #install_as(os.path.normpath(bld.env()['PREFIX'] + '/share/icons/hicolor/scalable/apps/'), bld.env()['APP_INSTALL_NAME'] + '.svg', 'icons/scalable/patchage.svg')
366 #icon_sizes = ['16x16', '22x22', '24x24', '32x32', '48x48']
367 #for icon_size in icon_sizes:
368 # install_as(os.path.normpath(bld.env()['DATADIR'] + '/icons/hicolor/' + icon_size + '/apps/'), bld.env()['APP_INSTALL_NAME'] + '.png', 'icons/' + icon_size + '/patchage.png')
371 shutil
.copy('../build/default/version.h', "./")
374 from Constants
import RUN_ME
375 from TaskGen
import feature
, after
380 def process_git(self
):
381 if getattr(self
, 'ver_header', None):
382 tsk
= self
.create_task('git_ver')
383 tsk
.set_outputs(self
.path
.find_or_declare(self
.ver_header
))
386 header
= self
.outputs
[0].abspath(self
.env
)
387 if os
.access('../version.h', os
.R_OK
):
388 shutil
.copy('../version.h', header
)
389 data
= file(header
).read()
390 m
= re
.match(r
'^#define GIT_VERSION "([^"]*)"$', data
)
392 self
.ver
= m
.group(1)
393 Utils
.pprint('BLUE', "tarball from git revision " + self
.ver
)
398 if os
.access('../.git', os
.R_OK
):
399 self
.ver
= commands
.getoutput("LANG= git rev-parse HEAD").splitlines()[0]
400 if commands
.getoutput("LANG= git diff-index --name-only HEAD").splitlines():
403 Utils
.pprint('BLUE', "git revision " + self
.ver
)
407 fi
= open(header
, 'w')
408 fi
.write('#define GIT_VERSION "%s"\n' % self
.ver
)
411 cls
= Task
.task_type_from_func('git_ver', vars=[], func
=git_ver
, color
='BLUE', before
='cc')
415 cls
.runnable_status
= always
418 sg
= Utils
.h_list(self
.ver
)
419 node
= self
.outputs
[0]
420 variant
= node
.variant(self
.env
)
421 self
.generator
.bld
.node_sigs
[variant
][node
.id] = sg
422 cls
.post_run
= post_run