12 DBUS_NAME_BASE
= 'org.ladish'
14 # these variables are mandatory ('/' are converted automatically)
18 def display_msg(conf
, msg
="", status
= None, color
= None):
20 conf
.check_message_1(msg
)
21 conf
.check_message_2(status
, color
)
23 Utils
.pprint('NORMAL', msg
)
25 def display_raw_text(conf
, text
, color
= 'NORMAL'):
26 Utils
.pprint(color
, text
, sep
= '')
28 def display_line(conf
, text
, color
= 'NORMAL'):
29 Utils
.pprint(color
, text
, sep
= os
.linesep
)
38 opt
.tool_options('compiler_cc')
39 opt
.tool_options('compiler_cxx')
40 opt
.tool_options('boost')
41 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')
42 opt
.add_option('--enable-liblash', action
='store_true', default
=False, help='Build LASH compatibility library')
44 def add_cflag(conf
, flag
):
45 conf
.env
.append_unique('CXXFLAGS', flag
)
46 conf
.env
.append_unique('CCFLAGS', flag
)
49 conf
.check_tool('compiler_cc')
50 conf
.check_tool('compiler_cxx')
51 conf
.check_tool('boost')
55 atleast_version
= '1.0.0',
57 errmsg
= "not installed, see http://dbus.freedesktop.org/",
58 args
= '--cflags --libs')
60 dbus_dir
= conf
.check_cfg(package
='dbus-1', args
='--variable=session_bus_services_dir', msg
="Retrieving D-Bus services dir")
64 dbus_dir
= dbus_dir
.strip()
65 conf
.env
['DBUS_SERVICES_DIR_REAL'] = dbus_dir
67 if Options
.options
.enable_pkg_config_dbus_service_dir
:
68 conf
.env
['DBUS_SERVICES_DIR'] = dbus_dir
70 conf
.env
['DBUS_SERVICES_DIR'] = os
.path
.join(os
.path
.normpath(conf
.env
['PREFIX']), 'share', 'dbus-1', 'services')
72 conf
.env
['BUILD_LIBLASH'] = Options
.options
.enable_liblash
77 errmsg
= "not installed, see http://e2fsprogs.sourceforge.net/",
78 args
= '--cflags --libs')
80 conf
.check(header_name
='expat.h', define_name
="HAVE_EXPAT")
82 if conf
.is_defined('HAVE_EXPAT'):
83 conf
.env
['LIB_EXPAT'] = ['expat']
87 if build_gui
and not conf
.check_cfg(
90 errmsg
= "not installed, see http://www.gtk.org/",
91 args
= '--cflags --libs'):
94 if build_gui
and not conf
.check_cfg(
95 package
= 'dbus-glib-1',
97 errmsg
= "not installed, see http://dbus.freedesktop.org/",
98 args
= '--cflags --libs'):
101 if build_gui
and not conf
.check_cfg(
102 package
= 'gtk+-2.0',
104 errmsg
= "not installed, see http://www.gtk.org/",
105 args
= '--cflags --libs'):
108 if build_gui
and not conf
.check_cfg(
109 package
= 'libglade-2.0',
111 errmsg
= "not installed, see http://ftp.gnome.org/pub/GNOME/sources/libglade/",
112 args
= '--cflags --libs'):
115 if build_gui
and not conf
.check_cfg(
116 package
= 'flowcanvas',
118 atleast_version
= '0.5.3',
119 errmsg
= "not installed, see http://drobilla.net/software/flowcanvas/",
120 args
= '--cflags --libs'):
124 # We need the boost headers package (e.g. libboost-dev)
125 # shared_ptr.hpp and weak_ptr.hpp
126 build_gui
= conf
.check_boost(errmsg
="not found, see http://boost.org/")
128 conf
.env
['BUILD_GLADISH'] = build_gui
130 add_cflag(conf
, '-g')
131 add_cflag(conf
, '-Wall')
132 add_cflag(conf
, '-Werror')
134 conf
.define('DATA_DIR', os
.path
.normpath(os
.path
.join(conf
.env
['PREFIX'], 'share', APPNAME
)))
135 conf
.define('PACKAGE_VERSION', VERSION
)
136 conf
.define('DBUS_NAME_BASE', DBUS_NAME_BASE
)
137 conf
.define('DBUS_BASE_PATH', '/' + DBUS_NAME_BASE
.replace('.', '/'))
138 conf
.define('BASE_NAME', APPNAME
)
139 conf
.define('_GNU_SOURCE', 1)
140 conf
.write_config_header('config.h')
144 display_msg(conf
, "==================")
145 version_msg
= APPNAME
+ "-" + VERSION
147 if os
.access('version.h', os
.R_OK
):
148 data
= file('version.h').read()
149 m
= re
.match(r
'^#define GIT_VERSION "([^"]*)"$', data
)
151 version_msg
+= " exported from " + m
.group(1)
152 elif os
.access('.git', os
.R_OK
):
153 version_msg
+= " git revision will checked and eventually updated during build"
155 display_msg(conf
, version_msg
)
158 display_msg(conf
, "Install prefix", conf
.env
['PREFIX'], 'CYAN')
160 display_msg(conf
, 'Build gladish', yesno(conf
.env
['BUILD_GLADISH']))
161 display_msg(conf
, 'Build liblash', yesno(Options
.options
.enable_liblash
))
163 if conf
.env
['DBUS_SERVICES_DIR'] != conf
.env
['DBUS_SERVICES_DIR_REAL']:
165 display_line(conf
, "WARNING: D-Bus session services directory as reported by pkg-config is", 'RED')
166 display_raw_text(conf
, "WARNING:", 'RED')
167 display_line(conf
, conf
.env
['DBUS_SERVICES_DIR_REAL'], 'CYAN')
168 display_line(conf
, 'WARNING: but service file will be installed in', 'RED')
169 display_raw_text(conf
, "WARNING:", 'RED')
170 display_line(conf
, conf
.env
['DBUS_SERVICES_DIR'], 'CYAN')
171 display_line(conf
, 'WARNING: You may need to adjust your D-Bus configuration after installing jackdbus', 'RED')
172 display_line(conf
, 'WARNING: You can override dbus service install directory', 'RED')
173 display_line(conf
, 'WARNING: with --enable-pkg-config-dbus-service-dir option to this script', 'RED')
178 daemon
= bld
.new_task_gen('cc', 'program')
179 daemon
.target
= 'ladishd'
180 daemon
.includes
= "build/default" # XXX config.h version.h and other generated files
181 daemon
.uselib
= 'DBUS-1 UUID EXPAT'
182 daemon
.ver_header
= 'version.h'
183 daemon
.env
.append_value("LINKFLAGS", ["-lutil", "-ldl", "-Wl,-E"])
209 'studio_jack_conf.c',
213 daemon
.source
.append(os
.path
.join("daemon", source
))
223 daemon
.source
.append(os
.path
.join("dbus", source
))
225 daemon
.source
.append(os
.path
.join("common", "safety.c"))
227 # process name.arnaudov.nedko.ladish.service.in -> name.arnaudov.nedko.ladish.service
229 obj
= bld
.new_task_gen('subst')
230 obj
.source
= os
.path
.join('daemon', 'dbus.service.in')
231 obj
.target
= DBUS_NAME_BASE
+ '.service'
232 obj
.dict = {'dbus_object_path': DBUS_NAME_BASE
,
233 'daemon_bin_path': os
.path
.join(bld
.env
['PREFIX'], 'bin', daemon
.target
)}
234 obj
.install_path
= bld
.env
['DBUS_SERVICES_DIR'] + os
.path
.sep
235 obj
.fun
= misc
.subst_func
237 if bld
.env
['BUILD_LIBLASH']:
238 liblash
= bld
.new_task_gen('cc', 'shlib')
239 liblash
.includes
= "build/default" # XXX config.h version.h and other generated files
240 liblash
.uselib
= 'DBUS-1'
241 liblash
.target
= 'lash'
242 liblash
.vnum
= "1.1.1"
243 liblash
.defines
= ['LOG_OUTPUT_STDOUT']
244 liblash
.source
= [os
.path
.join("lash_compat", "liblash", 'lash.c')]
246 # pkgpyexec_LTLIBRARIES = _lash.la
247 # INCLUDES = $(PYTHON_INCLUDES)
248 # _lash_la_LDFLAGS = -module -avoid-version ../liblash/liblash.la
249 # _lash_la_SOURCES = lash.c lash.h lash_wrap.c
250 # pkgpyexec_SCRIPTS = lash.py
251 # CLEANFILES = lash_wrap.c lash.py lash.pyc zynjacku.defs
252 # EXTRA_DIST = test.py lash.i lash.py
253 # lash_wrap.c lash.py: lash.i lash.h
254 # swig -o lash_wrap.c -I$(top_srcdir) -python $(top_srcdir)/$(subdir)/lash.i
256 #####################################################
258 if bld
.env
['BUILD_GLADISH']:
259 gladish
= bld
.new_task_gen('cxx', 'program')
260 gladish
.features
.append('cc')
261 gladish
.target
= 'gladish'
262 gladish
.defines
= ['LOG_OUTPUT_STDOUT']
263 gladish
.includes
= "build/default" # XXX config.h version.h and other generated files
264 gladish
.uselib
= 'DBUS-1 DBUS-GLIB-1 LIBGLADE-2.0 FLOWCANVAS'
277 #'load_projects_dialog.cpp',
281 #'project_properties.cpp',
291 gladish
.source
.append(os
.path
.join("gui", source
))
297 gladish
.source
.append(os
.path
.join("dbus", source
))
299 # Glade UI definitions (XML)
300 bld
.install_files(bld
.env
['DATA_DIR'], 'gui/gui.glade')
302 bld
.install_files('${PREFIX}/bin', 'ladish_control', chmod
=0755)
304 # 'Desktop' file (menu entry, icon, etc)
305 #obj = bld.create_obj('subst')
306 #obj.source = 'patchage.desktop.in'
307 #obj.target = 'patchage.desktop'
309 # 'BINDIR' : bld.env()['BINDIR'],
310 # 'APP_INSTALL_NAME' : bld.env()['APP_INSTALL_NAME'],
311 # 'APP_HUMAN_NAME' : bld.env()['APP_HUMAN_NAME'],
313 #install_as(os.path.normpath(bld.env()['DATADIR'] + 'applications/'), bld.env()['APP_INSTALL_NAME'] + '.desktop', 'build/default/patchage.desktop')
317 # Installation layout (with /usr prefix)
319 # /usr/share/applications/patchage.desktop
320 # /usr/share/icons/hicolor/16x16/apps/patchage.png
321 # /usr/share/icons/hicolor/22x22/apps/patchage.png
322 # /usr/share/icons/hicolor/24x24/apps/patchage.png
323 # /usr/share/icons/hicolor/32x32/apps/patchage.png
324 # /usr/share/icons/hicolor/48x48/apps/patchage.png
325 # /usr/share/icons/hicolor/scalable/apps/patchage.svg
326 # /usr/share/patchage/patchage.glade
328 # icon cache is updated using:
329 # gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
331 # Dave disabled this, ask why before removing this
332 #install_as(os.path.normpath(bld.env()['PREFIX'] + '/share/icons/hicolor/scalable/apps/'), bld.env()['APP_INSTALL_NAME'] + '.svg', 'icons/scalable/patchage.svg')
334 #icon_sizes = ['16x16', '22x22', '24x24', '32x32', '48x48']
335 #for icon_size in icon_sizes:
336 # install_as(os.path.normpath(bld.env()['DATADIR'] + '/icons/hicolor/' + icon_size + '/apps/'), bld.env()['APP_INSTALL_NAME'] + '.png', 'icons/' + icon_size + '/patchage.png')
339 shutil
.copy('../build/default/version.h', "./")
342 from Constants
import RUN_ME
343 from TaskGen
import feature
, after
348 def process_git(self
):
349 if getattr(self
, 'ver_header', None):
350 tsk
= self
.create_task('git_ver')
351 tsk
.set_outputs(self
.path
.find_or_declare(self
.ver_header
))
354 header
= self
.outputs
[0].abspath(self
.env
)
355 if os
.access('../version.h', os
.R_OK
):
356 shutil
.copy('../version.h', header
)
357 data
= file(header
).read()
358 m
= re
.match(r
'^#define GIT_VERSION "([^"]*)"$', data
)
360 self
.ver
= m
.group(1)
361 Utils
.pprint('BLUE', "tarball from git revision " + self
.ver
)
366 if os
.access('../.git', os
.R_OK
):
367 self
.ver
= commands
.getoutput("LANG= git rev-parse HEAD").splitlines()[0]
368 if commands
.getoutput("LANG= git diff-index --name-only HEAD").splitlines():
371 Utils
.pprint('BLUE', "git revision " + self
.ver
)
375 fi
= open(header
, 'w')
376 fi
.write('#define GIT_VERSION "%s"\n' % self
.ver
)
379 cls
= Task
.task_type_from_func('git_ver', vars=[], func
=git_ver
, color
='BLUE', before
='cc')
383 cls
.runnable_status
= always
386 sg
= Utils
.h_list(self
.ver
)
387 node
= self
.outputs
[0]
388 variant
= node
.variant(self
.env
)
389 self
.generator
.bld
.node_sigs
[variant
][node
.id] = sg
390 cls
.post_run
= post_run