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"])
225 'studio_jack_conf.c',
228 'cmd_rename_studio.c',
230 'cmd_start_studio.c',
232 'cmd_unload_studio.c',
238 daemon
.source
.append(os
.path
.join("daemon", source
))
248 daemon
.source
.append(os
.path
.join("dbus", source
))
250 daemon
.source
.append(os
.path
.join("common", "safety.c"))
252 # process name.arnaudov.nedko.ladish.service.in -> name.arnaudov.nedko.ladish.service
254 obj
= bld
.new_task_gen('subst')
255 obj
.source
= os
.path
.join('daemon', 'dbus.service.in')
256 obj
.target
= DBUS_NAME_BASE
+ '.service'
257 obj
.dict = {'dbus_object_path': DBUS_NAME_BASE
,
258 'daemon_bin_path': os
.path
.join(bld
.env
['PREFIX'], 'bin', daemon
.target
)}
259 obj
.install_path
= bld
.env
['DBUS_SERVICES_DIR'] + os
.path
.sep
260 obj
.fun
= misc
.subst_func
262 if bld
.env
['BUILD_LIBLASH']:
263 liblash
= bld
.new_task_gen('cc', 'shlib')
264 liblash
.includes
= "build/default" # XXX config.h version.h and other generated files
265 liblash
.uselib
= 'DBUS-1'
266 liblash
.target
= 'lash'
267 liblash
.vnum
= "1.1.1"
268 liblash
.defines
= ['LOG_OUTPUT_STDOUT']
269 liblash
.source
= [os
.path
.join("lash_compat", "liblash", 'lash.c')]
271 # pkgpyexec_LTLIBRARIES = _lash.la
272 # INCLUDES = $(PYTHON_INCLUDES)
273 # _lash_la_LDFLAGS = -module -avoid-version ../liblash/liblash.la
274 # _lash_la_SOURCES = lash.c lash.h lash_wrap.c
275 # pkgpyexec_SCRIPTS = lash.py
276 # CLEANFILES = lash_wrap.c lash.py lash.pyc zynjacku.defs
277 # EXTRA_DIST = test.py lash.i lash.py
278 # lash_wrap.c lash.py: lash.i lash.h
279 # swig -o lash_wrap.c -I$(top_srcdir) -python $(top_srcdir)/$(subdir)/lash.i
281 #####################################################
283 if bld
.env
['BUILD_GLADISH']:
284 gladish
= bld
.new_task_gen('cxx', 'program')
285 gladish
.features
.append('cc')
286 gladish
.target
= 'gladish'
287 gladish
.defines
= ['LOG_OUTPUT_STDOUT']
288 gladish
.includes
= "build/default" # XXX config.h version.h and other generated files
289 gladish
.uselib
= 'DBUS-1 DBUS-GLIB-1 LIBGLADE-2.0 FLOWCANVAS'
302 #'load_projects_dialog.cpp',
306 #'project_properties.cpp',
313 'app_supervisor_proxy.c',
316 gladish
.source
.append(os
.path
.join("gui", source
))
322 gladish
.source
.append(os
.path
.join("dbus", source
))
324 # Glade UI definitions (XML)
325 bld
.install_files(bld
.env
['DATA_DIR'], 'gui/gui.glade')
327 bld
.install_files('${PREFIX}/bin', 'ladish_control', chmod
=0755)
329 # 'Desktop' file (menu entry, icon, etc)
330 #obj = bld.create_obj('subst')
331 #obj.source = 'patchage.desktop.in'
332 #obj.target = 'patchage.desktop'
334 # 'BINDIR' : bld.env()['BINDIR'],
335 # 'APP_INSTALL_NAME' : bld.env()['APP_INSTALL_NAME'],
336 # 'APP_HUMAN_NAME' : bld.env()['APP_HUMAN_NAME'],
338 #install_as(os.path.normpath(bld.env()['DATADIR'] + 'applications/'), bld.env()['APP_INSTALL_NAME'] + '.desktop', 'build/default/patchage.desktop')
342 # Installation layout (with /usr prefix)
344 # /usr/share/applications/patchage.desktop
345 # /usr/share/icons/hicolor/16x16/apps/patchage.png
346 # /usr/share/icons/hicolor/22x22/apps/patchage.png
347 # /usr/share/icons/hicolor/24x24/apps/patchage.png
348 # /usr/share/icons/hicolor/32x32/apps/patchage.png
349 # /usr/share/icons/hicolor/48x48/apps/patchage.png
350 # /usr/share/icons/hicolor/scalable/apps/patchage.svg
351 # /usr/share/patchage/patchage.glade
353 # icon cache is updated using:
354 # gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
356 # Dave disabled this, ask why before removing this
357 #install_as(os.path.normpath(bld.env()['PREFIX'] + '/share/icons/hicolor/scalable/apps/'), bld.env()['APP_INSTALL_NAME'] + '.svg', 'icons/scalable/patchage.svg')
359 #icon_sizes = ['16x16', '22x22', '24x24', '32x32', '48x48']
360 #for icon_size in icon_sizes:
361 # install_as(os.path.normpath(bld.env()['DATADIR'] + '/icons/hicolor/' + icon_size + '/apps/'), bld.env()['APP_INSTALL_NAME'] + '.png', 'icons/' + icon_size + '/patchage.png')
364 shutil
.copy('../build/default/version.h', "./")
367 from Constants
import RUN_ME
368 from TaskGen
import feature
, after
373 def process_git(self
):
374 if getattr(self
, 'ver_header', None):
375 tsk
= self
.create_task('git_ver')
376 tsk
.set_outputs(self
.path
.find_or_declare(self
.ver_header
))
379 header
= self
.outputs
[0].abspath(self
.env
)
380 if os
.access('../version.h', os
.R_OK
):
381 shutil
.copy('../version.h', header
)
382 data
= file(header
).read()
383 m
= re
.match(r
'^#define GIT_VERSION "([^"]*)"$', data
)
385 self
.ver
= m
.group(1)
386 Utils
.pprint('BLUE', "tarball from git revision " + self
.ver
)
391 if os
.access('../.git', os
.R_OK
):
392 self
.ver
= commands
.getoutput("LANG= git rev-parse HEAD").splitlines()[0]
393 if commands
.getoutput("LANG= git diff-index --name-only HEAD").splitlines():
396 Utils
.pprint('BLUE', "git revision " + self
.ver
)
400 fi
= open(header
, 'w')
401 fi
.write('#define GIT_VERSION "%s"\n' % self
.ver
)
404 cls
= Task
.task_type_from_func('git_ver', vars=[], func
=git_ver
, color
='BLUE', before
='cc')
408 cls
.runnable_status
= always
411 sg
= Utils
.h_list(self
.ver
)
412 node
= self
.outputs
[0]
413 variant
= node
.variant(self
.env
)
414 self
.generator
.bld
.node_sigs
[variant
][node
.id] = sg
415 cls
.post_run
= post_run