10 DBUS_NAME_BASE
= 'org.ladish'
12 # these variables are mandatory ('/' are converted automatically)
16 def display_msg(conf
, msg
="", status
= None, color
= None):
18 conf
.check_message_1(msg
)
19 conf
.check_message_2(status
, color
)
21 Utils
.pprint('NORMAL', msg
)
23 def display_raw_text(conf
, text
, color
= 'NORMAL'):
24 Utils
.pprint(color
, text
, sep
= '')
26 def display_line(conf
, text
, color
= 'NORMAL'):
27 Utils
.pprint(color
, text
, sep
= os
.linesep
)
36 opt
.tool_options('compiler_cc')
37 opt
.tool_options('compiler_cxx')
38 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')
39 opt
.add_option('--enable-liblash', action
='store_true', default
=False, help='Build LASH compatibility library')
41 def add_cflag(conf
, flag
):
42 conf
.env
.append_unique('CXXFLAGS', flag
)
43 conf
.env
.append_unique('CCFLAGS', flag
)
46 conf
.check_tool('compiler_cc')
47 conf
.check_tool('compiler_cxx')
51 atleast_version
= '1.0.0',
53 errmsg
= "not installed, see http://dbus.freedesktop.org/",
54 args
= '--cflags --libs')
56 dbus_dir
= conf
.check_cfg(package
='dbus-1', args
='--variable=session_bus_services_dir', msg
="Retrieving D-Bus services dir")
60 dbus_dir
= dbus_dir
.strip()
61 conf
.env
['DBUS_SERVICES_DIR_REAL'] = dbus_dir
63 if Options
.options
.enable_pkg_config_dbus_service_dir
:
64 conf
.env
['DBUS_SERVICES_DIR'] = dbus_dir
66 conf
.env
['DBUS_SERVICES_DIR'] = os
.path
.join(os
.path
.normpath(conf
.env
['PREFIX']), 'share', 'dbus-1', 'services')
68 conf
.env
['BUILD_LIBLASH'] = Options
.options
.enable_liblash
73 errmsg
= "not installed, see http://e2fsprogs.sourceforge.net/",
74 args
= '--cflags --libs')
76 conf
.check(header_name
='expat.h', define_name
="HAVE_EXPAT")
78 if conf
.is_defined('HAVE_EXPAT'):
79 conf
.env
['LIB_EXPAT'] = ['expat']
82 package
= 'dbus-glib-1',
84 errmsg
= "not installed, see http://dbus.freedesktop.org/",
85 args
= '--cflags --libs')
88 package
= 'glibmm-2.4',
90 errmsg
= "not installed, see http://www.gtkmm.org/",
91 args
= '--cflags --libs')
94 package
= 'gtkmm-2.4',
96 atleast_version
= '2.11.12',
97 errmsg
= "not installed, see http://www.gtkmm.org/",
98 args
= '--cflags --libs')
101 package
= 'libgnomecanvasmm-2.6',
103 errmsg
= "not installed, see http://www.gtkmm.org/",
104 args
= '--cflags --libs')
107 package
= 'libglademm-2.4',
109 errmsg
= "not installed, see http://www.gtkmm.org/",
110 args
= '--cflags --libs')
113 package
= 'flowcanvas',
115 atleast_version
= '0.4.0',
116 errmsg
= "not installed, see http://drobilla.net/software/flowcanvas/",
117 args
= '--cflags --libs')
119 # We need the boost headers package (e.g. libboost-dev)
120 # shared_ptr.hpp and weak_ptr.hpp
121 conf
.check_tool('boost')
124 add_cflag(conf
, '-g')
125 add_cflag(conf
, '-Wall')
126 add_cflag(conf
, '-Werror')
128 conf
.define('DATA_DIR', os
.path
.normpath(os
.path
.join(conf
.env
['PREFIX'], 'share', APPNAME
)))
129 conf
.define('PACKAGE_VERSION', VERSION
)
130 conf
.define('DBUS_NAME_BASE', DBUS_NAME_BASE
)
131 conf
.define('DBUS_BASE_PATH', '/' + DBUS_NAME_BASE
.replace('.', '/'))
132 conf
.define('BASE_NAME', APPNAME
)
133 conf
.define('_GNU_SOURCE', 1)
134 conf
.write_config_header('config.h')
138 display_msg(conf
, "==================")
139 version_msg
= APPNAME
+ "-" + VERSION
142 # version_msg += " exported from r" + rev
144 # version_msg += " git revision will checked and eventually updated during build"
146 display_msg(conf
, version_msg
)
149 display_msg(conf
, "Install prefix", conf
.env
['PREFIX'], 'CYAN')
151 display_msg(conf
, 'Build liblash', yesno(Options
.options
.enable_liblash
))
153 if conf
.env
['DBUS_SERVICES_DIR'] != conf
.env
['DBUS_SERVICES_DIR_REAL']:
155 display_line(conf
, "WARNING: D-Bus session services directory as reported by pkg-config is", 'RED')
156 display_raw_text(conf
, "WARNING:", 'RED')
157 display_line(conf
, conf
.env
['DBUS_SERVICES_DIR_REAL'], 'CYAN')
158 display_line(conf
, 'WARNING: but service file will be installed in', 'RED')
159 display_raw_text(conf
, "WARNING:", 'RED')
160 display_line(conf
, conf
.env
['DBUS_SERVICES_DIR'], 'CYAN')
161 display_line(conf
, 'WARNING: You may need to adjust your D-Bus configuration after installing jackdbus', 'RED')
162 display_line(conf
, 'WARNING: You can override dbus service install directory', 'RED')
163 display_line(conf
, 'WARNING: with --enable-pkg-config-dbus-service-dir option to this script', 'RED')
168 daemon
= bld
.new_task_gen('cc', 'program')
169 daemon
.target
= 'ladishd'
170 daemon
.includes
= "build/default" # XXX config.h version.h and other generated files
171 daemon
.uselib
= 'DBUS-1 LIBXML-2.0 UUID EXPAT'
172 daemon
.ver_header
= 'version.h'
173 daemon
.env
.append_value("LINKFLAGS", ["-lutil", "-ldl"])
193 daemon
.source
.append(os
.path
.join("daemon", source
))
205 daemon
.source
.append(os
.path
.join("dbus", source
))
207 daemon
.source
.append(os
.path
.join("common", "safety.c"))
209 # process name.arnaudov.nedko.ladish.service.in -> name.arnaudov.nedko.ladish.service
211 obj
= bld
.new_task_gen('subst')
212 obj
.source
= os
.path
.join('daemon', 'dbus.service.in')
213 obj
.target
= DBUS_NAME_BASE
+ '.service'
214 obj
.dict = {'dbus_object_path': DBUS_NAME_BASE
,
215 'daemon_bin_path': os
.path
.join(bld
.env
['PREFIX'], 'bin', daemon
.target
)}
216 obj
.install_path
= bld
.env
['DBUS_SERVICES_DIR'] + os
.path
.sep
217 obj
.fun
= misc
.subst_func
219 if bld
.env
['BUILD_LIBLASH']:
220 liblash
= bld
.new_task_gen('cc', 'shlib')
221 liblash
.includes
= "build/default" # XXX config.h version.h and other generated files
222 liblash
.uselib
= 'DBUS-1 LIBXML-2.0 UUID'
223 liblash
.target
= 'lash'
224 liblash
.vnum
= "1.1.1"
225 liblash
.defines
= ['LASH_OLD_API', 'DEBUG_OUTPUT_TERMINAL']
233 'dbus_iface_client.c',
238 liblash
.source
.append(os
.path
.join("lash_compat", "liblash", source
))
250 liblash
.source
.append(os
.path
.join("dbus", source
))
252 liblash
.source
.append(os
.path
.join("common", "safety.c"))
253 liblash
.source
.append(os
.path
.join("daemon", "legacy", "file.c"))
255 # pkgpyexec_LTLIBRARIES = _lash.la
256 # INCLUDES = $(PYTHON_INCLUDES)
257 # _lash_la_LDFLAGS = -module -avoid-version ../liblash/liblash.la
258 # _lash_la_SOURCES = lash.c lash.h lash_wrap.c
259 # pkgpyexec_SCRIPTS = lash.py
260 # CLEANFILES = lash_wrap.c lash.py lash.pyc zynjacku.defs
261 # EXTRA_DIST = test.py lash.i lash.py
262 # lash_wrap.c lash.py: lash.i lash.h
263 # swig -o lash_wrap.c -I$(top_srcdir) -python $(top_srcdir)/$(subdir)/lash.i
265 #####################################################
267 gladish
= bld
.new_task_gen('cxx', 'program')
268 gladish
.features
.append('cc')
269 gladish
.target
= 'gladish'
270 gladish
.defines
= ['DEBUG_OUTPUT_TERMINAL']
271 gladish
.includes
= "build/default" # XXX config.h version.h and other generated files
272 gladish
.uselib
= 'DBUS-1 LIBGNOMECANVASMM-2.6 LIBGLADEMM-2.4 FLOWCANVAS DBUS-GLIB-1'
285 #'load_projects_dialog.cpp',
289 #'project_properties.cpp',
299 gladish
.source
.append(os
.path
.join("gui", source
))
305 gladish
.source
.append(os
.path
.join("dbus", source
))
307 # Glade UI definitions (XML)
308 bld
.install_files(bld
.env
['DATA_DIR'], 'gui/gui.glade')
310 bld
.install_files('${PREFIX}/bin', 'ladish_control', chmod
=0755)
312 # 'Desktop' file (menu entry, icon, etc)
313 #obj = bld.create_obj('subst')
314 #obj.source = 'patchage.desktop.in'
315 #obj.target = 'patchage.desktop'
317 # 'BINDIR' : bld.env()['BINDIR'],
318 # 'APP_INSTALL_NAME' : bld.env()['APP_INSTALL_NAME'],
319 # 'APP_HUMAN_NAME' : bld.env()['APP_HUMAN_NAME'],
321 #install_as(os.path.normpath(bld.env()['DATADIR'] + 'applications/'), bld.env()['APP_INSTALL_NAME'] + '.desktop', 'build/default/patchage.desktop')
325 # Installation layout (with /usr prefix)
327 # /usr/share/applications/patchage.desktop
328 # /usr/share/icons/hicolor/16x16/apps/patchage.png
329 # /usr/share/icons/hicolor/22x22/apps/patchage.png
330 # /usr/share/icons/hicolor/24x24/apps/patchage.png
331 # /usr/share/icons/hicolor/32x32/apps/patchage.png
332 # /usr/share/icons/hicolor/48x48/apps/patchage.png
333 # /usr/share/icons/hicolor/scalable/apps/patchage.svg
334 # /usr/share/patchage/patchage.glade
336 # icon cache is updated using:
337 # gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
339 # Dave disabled this, ask why before removing this
340 #install_as(os.path.normpath(bld.env()['PREFIX'] + '/share/icons/hicolor/scalable/apps/'), bld.env()['APP_INSTALL_NAME'] + '.svg', 'icons/scalable/patchage.svg')
342 #icon_sizes = ['16x16', '22x22', '24x24', '32x32', '48x48']
343 #for icon_size in icon_sizes:
344 # install_as(os.path.normpath(bld.env()['DATADIR'] + '/icons/hicolor/' + icon_size + '/apps/'), bld.env()['APP_INSTALL_NAME'] + '.png', 'icons/' + icon_size + '/patchage.png')
350 from Constants
import RUN_ME
351 from TaskGen
import feature
, after
356 def process_git(self
):
357 if getattr(self
, 'ver_header', None):
358 tsk
= self
.create_task('git_ver')
359 tsk
.set_outputs(self
.path
.find_or_declare(self
.ver_header
))
363 self
.ver
= commands
.getoutput("LANG= git rev-parse HEAD").splitlines()[0]
364 if commands
.getoutput("LANG= git diff-index --name-only HEAD").splitlines():
367 Utils
.pprint('BLUE', "git revision " + self
.ver
)
369 fi
= open(self
.outputs
[0].abspath(self
.env
), 'w')
370 fi
.write('#define GIT_VERSION "%s"\n' % self
.ver
)
373 cls
= Task
.task_type_from_func('git_ver', vars=[], func
=git_ver
, color
='BLUE', before
='cc')
377 cls
.runnable_status
= always
380 sg
= Utils
.h_list(self
.ver
)
381 node
= self
.outputs
[0]
382 variant
= node
.variant(self
.env
)
383 self
.generator
.bld
.node_sigs
[variant
][node
.id] = sg
384 cls
.post_run
= post_run