Another static fix.
[dcpomatic.git] / wscript
1 import subprocess
2 import os
3 import sys
4
5 APPNAME = 'dcpomatic'
6 VERSION = '2.0.14devel'
7
8 def options(opt):
9     opt.load('compiler_cxx')
10     opt.load('winres')
11
12     opt.add_option('--enable-debug',      action='store_true', default=False, help='build with debugging information and without optimisation')
13     opt.add_option('--disable-gui',       action='store_true', default=False, help='disable building of GUI tools')
14     opt.add_option('--disable-tests',     action='store_true', default=False, help='disable building of tests')
15     opt.add_option('--target-windows',    action='store_true', default=False, help='set up to do a cross-compile to make a Windows package')
16     opt.add_option('--target-debian',     action='store_true', default=False, help='set up to compile for a Debian/Ubuntu package')
17     opt.add_option('--debian-unstable',   action='store_true', default=False, help='add extra libraries to static-build correctly on Debian unstable')
18     opt.add_option('--target-centos-6',   action='store_true', default=False, help='set up to compile for a Centos 6.5 package')
19     opt.add_option('--target-centos-7',   action='store_true', default=False, help='set up to compile for a Centos 7 package')
20     opt.add_option('--magickpp-config',   action='store',      default='Magick++-config', help='path to Magick++-config')
21     opt.add_option('--wx-config',         action='store',      default='wx-config', help='path to wx-config')
22     opt.add_option('--address-sanitizer', action='store_true', default=False, help='build with address sanitizer')
23     opt.add_option('--install-prefix',                         default=None,  help='prefix of where DCP-o-matic will be installed')
24
25 def static_ffmpeg(conf):
26     conf.check_cfg(package='libavformat', args='--cflags', uselib_store='AVFORMAT', mandatory=True)
27     conf.env.STLIB_AVFORMAT = ['avformat']
28     conf.check_cfg(package='libavfilter', args='--cflags', uselib_store='AVFILTER', mandatory=True)
29     conf.env.STLIB_AVFILTER = ['avfilter', 'swresample']
30     conf.check_cfg(package='libavcodec', args='--cflags', uselib_store='AVCODEC', mandatory=True)
31     conf.env.STLIB_AVCODEC = ['avcodec']
32     conf.env.LIB_AVCODEC = ['z']
33     conf.check_cfg(package='libavutil', args='--cflags', uselib_store='AVUTIL', mandatory=True)
34     conf.env.STLIB_AVUTIL = ['avutil']
35     conf.check_cfg(package='libswscale', args='--cflags', uselib_store='SWSCALE', mandatory=True)
36     conf.env.STLIB_SWSCALE = ['swscale']
37     conf.check_cfg(package='libswresample', args='--cflags', uselib_store='SWRESAMPLE', mandatory=True)
38     conf.env.STLIB_SWRESAMPLE = ['swresample']
39     conf.check_cfg(package='libpostproc', args='--cflags', uselib_store='POSTPROC', mandatory=True)
40     conf.env.STLIB_POSTPROC = ['postproc']
41
42 def dynamic_ffmpeg(conf):
43     conf.check_cfg(package='libavformat', args='--cflags --libs', uselib_store='AVFORMAT', mandatory=True)
44     conf.check_cfg(package='libavfilter', args='--cflags --libs', uselib_store='AVFILTER', mandatory=True)
45     conf.check_cfg(package='libavcodec', args='--cflags --libs', uselib_store='AVCODEC', mandatory=True)
46     conf.check_cfg(package='libavutil', args='--cflags --libs', uselib_store='AVUTIL', mandatory=True)
47     conf.check_cfg(package='libswscale', args='--cflags --libs', uselib_store='SWSCALE', mandatory=True)
48     conf.check_cfg(package='libswresample', args='--cflags --libs', uselib_store='SWRESAMPLE', mandatory=True)
49     conf.check_cfg(package='libpostproc', args='--cflags --libs', uselib_store='POSTPROC', mandatory=True)
50
51 def static_openjpeg(conf):
52     conf.check_cfg(package='libopenjpeg', args='--cflags', atleast_version='1.5.0', uselib_store='OPENJPEG', mandatory=True)
53     conf.check_cfg(package='libopenjpeg', args='--cflags', max_version='1.5.2', mandatory=True)
54     conf.env.STLIB_OPENJPEG = ['openjpeg']
55
56 def dynamic_openjpeg(conf):
57     conf.check_cfg(package='libopenjpeg', args='--cflags --libs', atleast_version='1.5.0', uselib_store='OPENJPEG', mandatory=True)
58     conf.check_cfg(package='libopenjpeg', args='--cflags --libs', max_version='1.5.2', mandatory=True)
59
60 def static_sub(conf):
61     conf.check_cfg(package='libsub', atleast_version='0.01.0', args='--cflags', uselib_store='SUB', mandatory=True)
62     conf.env.DEFINES_SUB = [f.replace('\\', '') for f in conf.env.DEFINES_SUB]
63     conf.env.STLIB_SUB = ['sub']
64
65 def static_dcp(conf, static_boost, static_xmlpp, static_xmlsec, static_ssh):
66     conf.check_cfg(package='libdcp-1.0', atleast_version='0.96', args='--cflags', uselib_store='DCP', mandatory=True)
67     conf.env.DEFINES_DCP = [f.replace('\\', '') for f in conf.env.DEFINES_DCP]
68     conf.env.STLIB_DCP = ['dcp-1.0', 'asdcp-libdcp-1.0', 'kumu-libdcp-1.0']
69     conf.env.LIB_DCP = ['glibmm-2.4', 'ssl', 'crypto', 'bz2', 'xslt']
70
71     if static_boost:
72         conf.env.STLIB_DCP.append('boost_system')
73
74     if static_xmlpp:
75         conf.env.STLIB_DCP.append('xml++-2.6')
76     else:
77         conf.env.LIB_DCP.append('xml++-2.6')
78
79     if static_xmlsec:
80         conf.env.STLIB_DCP.append('xmlsec1-openssl')
81         conf.env.STLIB_DCP.append('xmlsec1')
82     else:
83         conf.env.LIB_DCP.append('xmlsec1-openssl')
84         conf.env.LIB_DCP.append('xmlsec1')
85
86     if static_ssh:
87         conf.env.STLIB_DCP.append('ssh')
88     else:
89         conf.env.LIB_DCP.append('ssh')
90
91 def dynamic_dcp(conf):
92     conf.check_cfg(package='libdcp-1.0', atleast_version='0.92', args='--cflags --libs', uselib_store='DCP', mandatory=True)
93     conf.env.DEFINES_DCP = [f.replace('\\', '') for f in conf.env.DEFINES_DCP]
94
95 def dynamic_sub(conf):
96     conf.check_cfg(package='libsub', atleast_version='0.01.0', args='--cflags --libs', uselib_store='SUB', mandatory=True)
97     conf.env.DEFINES_SUB = [f.replace('\\', '') for f in conf.env.DEFINES_SUB]
98
99 def dynamic_ssh(conf):
100     conf.check_cc(fragment="""
101                            #include <libssh/libssh.h>\n
102                            int main () {\n
103                            ssh_session s = ssh_new ();\n
104                            return 0;\n
105                            }
106                            """, msg='Checking for library libssh', mandatory=True, lib='ssh', uselib_store='SSH')
107
108 def dynamic_boost(conf, lib_suffix, thread):
109     conf.check_cxx(fragment="""
110                             #include <boost/version.hpp>\n
111                             #if BOOST_VERSION < 104500\n
112                             #error boost too old\n
113                             #endif\n
114                             int main(void) { return 0; }\n
115                             """,
116                    mandatory=True,
117                    msg='Checking for boost library >= 1.45',
118                    okmsg='yes',
119                    errmsg='too old\nPlease install boost version 1.45 or higher.')
120
121     conf.check_cxx(fragment="""
122                             #include <boost/thread.hpp>\n
123                             int main() { boost::thread t (); }\n
124                             """, msg='Checking for boost threading library',
125                             libpath='/usr/local/lib',
126                             lib=[thread, 'boost_system%s' % lib_suffix],
127                             uselib_store='BOOST_THREAD')
128
129     conf.check_cxx(fragment="""
130                             #include <boost/filesystem.hpp>\n
131                             int main() { boost::filesystem::copy_file ("a", "b"); }\n
132                             """, msg='Checking for boost filesystem library',
133                             libpath='/usr/local/lib',
134                             lib=['boost_filesystem%s' % lib_suffix, 'boost_system%s' % lib_suffix],
135                             uselib_store='BOOST_FILESYSTEM')
136
137     conf.check_cxx(fragment="""
138                             #include <boost/date_time.hpp>\n
139                             int main() { boost::gregorian::day_clock::local_day(); }\n
140                             """, msg='Checking for boost datetime library',
141                             libpath='/usr/local/lib',
142                             lib=['boost_date_time%s' % lib_suffix, 'boost_system%s' % lib_suffix],
143                             uselib_store='BOOST_DATETIME')
144
145     conf.check_cxx(fragment="""
146                             #include <boost/signals2.hpp>\n
147                             int main() { boost::signals2::signal<void (int)> x; }\n
148                             """,
149                             msg='Checking for boost signals2 library',
150                             uselib_store='BOOST_SIGNALS2')
151
152 def static_boost(conf, lib_suffix):
153     conf.env.STLIB_BOOST_THREAD = ['boost_thread']
154     conf.env.STLIB_BOOST_FILESYSTEM = ['boost_filesystem%s' % lib_suffix]
155     conf.env.STLIB_BOOST_DATETIME = ['boost_date_time%s' % lib_suffix, 'boost_system%s' % lib_suffix]
156     conf.env.STLIB_BOOST_SIGNALS2 = ['boost_signals2']
157
158 def dynamic_quickmail(conf):
159     conf.check_cxx(fragment="""
160                             #include <quickmail.h>
161                             int main(void) { quickmail_initialize (); }
162                             """,
163                    mandatory=True,
164                    msg='Checking for libquickmail',
165                    libpath='/usr/local/lib',
166                    lib=['quickmail', 'curl'],
167                    uselib_store='QUICKMAIL')
168
169 def configure(conf):
170     conf.load('compiler_cxx')
171     if conf.options.target_windows:
172         conf.load('winres')
173
174     # conf.options -> conf.env
175     conf.env.TARGET_WINDOWS = conf.options.target_windows
176     conf.env.DISABLE_GUI = conf.options.disable_gui
177     conf.env.DISABLE_TESTS = conf.options.disable_tests
178     conf.env.TARGET_DEBIAN = conf.options.target_debian
179     conf.env.DEBIAN_UNSTABLE = conf.options.debian_unstable
180     conf.env.TARGET_CENTOS_6 = conf.options.target_centos_6
181     conf.env.TARGET_CENTOS_7 = conf.options.target_centos_7
182     conf.env.VERSION = VERSION
183     conf.env.TARGET_OSX = sys.platform == 'darwin'
184     conf.env.TARGET_LINUX = not conf.env.TARGET_WINDOWS and not conf.env.TARGET_OSX
185     # true if we should build dcpomatic/libdcpomatic/libdcpomatic-wx statically
186     conf.env.BUILD_STATIC = conf.options.target_debian or conf.options.target_centos_6 or conf.options.target_centos_7
187     if conf.options.install_prefix is None:
188         conf.env.INSTALL_PREFIX = conf.env.PREFIX
189     else:
190         conf.env.INSTALL_PREFIX = conf.options.install_prefix
191
192     # Common CXXFLAGS
193     conf.env.append_value('CXXFLAGS', ['-D__STDC_CONSTANT_MACROS', '-D__STDC_LIMIT_MACROS', '-msse', '-ffast-math', '-fno-strict-aliasing',
194                                        '-Wall', '-Wno-attributes', '-Wextra', '-Wno-unused-result', '-D_FILE_OFFSET_BITS=64'])
195
196     if conf.options.enable_debug:
197         conf.env.append_value('CXXFLAGS', ['-g', '-DDCPOMATIC_DEBUG'])
198     else:
199         conf.env.append_value('CXXFLAGS', '-O2')
200
201     if conf.options.address_sanitizer:
202         conf.env.append_value('CXXFLAGS', ['-fsanitize=address', '-fno-omit-frame-pointer'])
203         conf.env.append_value('LINKFLAGS', ['-fsanitize=address'])
204
205     #
206     # Platform-specific CFLAGS hacks and other tinkering
207     #
208
209     # Windows
210     if conf.env.TARGET_WINDOWS:
211         conf.env.append_value('CXXFLAGS', '-DDCPOMATIC_WINDOWS')
212         conf.env.append_value('CXXFLAGS', '-DWIN32_LEAN_AND_MEAN')
213         conf.env.append_value('CXXFLAGS', '-DBOOST_USE_WINDOWS_H')
214         conf.env.append_value('CXXFLAGS', '-DUNICODE')
215         conf.env.append_value('CXXFLAGS', '-DBOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN')
216         conf.env.append_value('CXXFLAGS', '-mfpmath=sse')
217         wxrc = os.popen('wx-config --rescomp').read().split()[1:]
218         conf.env.append_value('WINRCFLAGS', wxrc)
219         if conf.options.enable_debug:
220             conf.env.append_value('CXXFLAGS', ['-mconsole'])
221             conf.env.append_value('LINKFLAGS', ['-mconsole'])
222         conf.check(lib='ws2_32', uselib_store='WINSOCK2', msg="Checking for library winsock2")
223         conf.check(lib='bfd', uselib_store='BFD', msg="Checking for library bfd")
224         conf.check(lib='dbghelp', uselib_store='DBGHELP', msg="Checking for library dbghelp")
225         conf.check(lib='iberty', uselib_store='IBERTY', msg="Checking for library iberty")
226         conf.check(lib='shlwapi', uselib_store='SHLWAPI', msg="Checking for library shlwapi")
227         conf.check(lib='mswsock', uselib_store='MSWSOCK', msg="Checking for library mswsock")
228         boost_lib_suffix = '-mt'
229         boost_thread = 'boost_thread_win32-mt'
230
231     # POSIX
232     if conf.env.TARGET_LINUX or conf.env.TARGET_OSX:
233         conf.env.append_value('CXXFLAGS', '-DDCPOMATIC_POSIX')
234         conf.env.append_value('CXXFLAGS', '-DPOSIX_LOCALE_PREFIX="%s/share/locale"' % conf.env['INSTALL_PREFIX'])
235         conf.env.append_value('CXXFLAGS', '-DPOSIX_ICON_PREFIX="%s/share/dcpomatic2"' % conf.env['INSTALL_PREFIX'])
236         boost_lib_suffix = ''
237         boost_thread = 'boost_thread'
238         conf.env.append_value('LINKFLAGS', '-pthread')
239
240     # Linux
241     if conf.env.TARGET_LINUX:
242         conf.env.append_value('CXXFLAGS', '-mfpmath=sse')
243         conf.env.append_value('CXXFLAGS', '-DDCPOMATIC_LINUX')
244
245     if conf.env.TARGET_DEBIAN:
246         # libxml2 seems to be linked against this on Ubuntu but it doesn't mention it in its .pc file
247         conf.check_cfg(package='liblzma', args='--cflags --libs', uselib_store='LZMA', mandatory=True)
248
249     if conf.env.TARGET_CENTOS_6 or conf.env.TARGET_CENTOS_7:
250         # libavcodec seems to be linked against this on Centos
251         conf.check_cfg(package='liblzma', args='--cflags --libs', uselib_store='LZMA', mandatory=True)
252         
253     if not conf.env.DISABLE_GUI and conf.env.TARGET_LINUX:
254         conf.check_cfg(package='gtk+-2.0', args='--cflags --libs', uselib_store='GTK', mandatory=True)
255
256     # OSX
257     if conf.env.TARGET_OSX:
258         conf.env.append_value('CXXFLAGS', ['-DDCPOMATIC_OSX', '-Wno-unused-function', '-Wno-unused-parameter'])
259         conf.env.append_value('LINKFLAGS', '-headerpad_max_install_names')
260
261     #
262     # Dependencies.
263     # There's probably a neater way of expressing these, but I've gone for brute force for now.
264     #
265
266     if conf.env.TARGET_DEBIAN:
267         conf.check_cfg(package='libcxml', atleast_version='0.11', args='--cflags', uselib_store='CXML', mandatory=True)
268         conf.env.STLIB_CXML = ['cxml']
269         conf.check_cfg(package='libxml++-2.6', args='--cflags --libs', uselib_store='XMLPP', mandatory=True)
270         conf.check_cfg(package='libcurl', args='--cflags --libs', uselib_store='CURL', mandatory=True)
271         conf.env.STLIB_QUICKMAIL = ['quickmail']
272         static_ffmpeg(conf)
273         static_openjpeg(conf)
274         static_sub(conf)
275         static_dcp(conf, False, False, False, False)
276         dynamic_boost(conf, boost_lib_suffix, boost_thread)
277
278     if conf.env.TARGET_CENTOS_6:
279         # Centos 6.5's boost is too old, so we build a new version statically in the chroot
280         conf.check_cfg(package='libcxml', atleast_version='0.08', args='--cflags --libs-only-L', uselib_store='CXML', mandatory=True)
281         conf.env.STLIB_CXML = ['cxml', 'boost_filesystem']
282         conf.check_cfg(package='libcurl', args='--cflags --libs-only-L', uselib_store='CURL', mandatory=True)
283         conf.env.STLIB_CURL = ['curl']
284         conf.env.LIB_CURL = ['ssh2', 'idn']
285         conf.env.STLIB_QUICKMAIL = ['quickmail', 'curl']
286         conf.env.LIB_QUICKMAIL = ['ssh2', 'idn']
287         static_ffmpeg(conf)
288         static_openjpeg(conf)
289         static_sub(conf)
290         static_dcp(conf, True, True, True, True)
291         static_boost(conf, boost_lib_suffix)
292
293     if conf.env.TARGET_CENTOS_7:
294         # Centos 7's boost is ok so we link it dynamically
295         conf.check_cfg(package='libcxml', atleast_version='0.08', args='--cflags', uselib_store='CXML', mandatory=True)
296         conf.env.STLIB_CXML = ['cxml']
297         conf.check_cfg(package='libcurl', args='--cflags --libs', uselib_store='CURL', mandatory=True)
298         conf.env.STLIB_QUICKMAIL = ['quickmail']
299         conf.env.LIB_SSH = ['gssapi_krb5']
300         conf.env.LIB_XMLPP = ['xml2']
301         conf.env.LIB_XMLSEC = ['ltdl']
302         static_ffmpeg(conf)
303         static_openjpeg(conf)
304         static_sub(conf)
305         static_dcp(conf, False, True, True, True)
306         dynamic_boost(conf, boost_lib_suffix, boost_thread)
307
308     if conf.env.TARGET_WINDOWS:
309         conf.check_cfg(package='libxml++-2.6', args='--cflags --libs', uselib_store='XMLPP', mandatory=True)
310         conf.check_cfg(package='libcurl', args='--cflags --libs', uselib_store='CURL', mandatory=True)
311         conf.check_cxx(fragment="""
312                                 #include <boost/locale.hpp>\n
313                                 int main() { std::locale::global (boost::locale::generator().generate ("")); }\n
314                                 """, msg='Checking for boost locale library',
315                                 libpath='/usr/local/lib',
316                                 lib=['boost_locale%s' % boost_lib_suffix, 'boost_system%s' % boost_lib_suffix],
317                                 uselib_store='BOOST_LOCALE')
318         dynamic_quickmail(conf)
319         dynamic_boost(conf, boost_lib_suffix, boost_thread)
320         dynamic_ffmpeg(conf)
321         dynamic_openjpeg(conf)
322         dynamic_dcp(conf)
323         dynamic_sub(conf)
324         dynamic_ssh(conf)
325
326     # Not packaging; just a straight build
327     if not conf.env.TARGET_WINDOWS and not conf.env.TARGET_DEBIAN and not conf.env.TARGET_CENTOS_6 and not conf.env.TARGET_CENTOS_7:
328         conf.check_cfg(package='libcxml', atleast_version='0.08', args='--cflags --libs', uselib_store='CXML', mandatory=True)
329         conf.check_cfg(package='libxml++-2.6', args='--cflags --libs', uselib_store='XMLPP', mandatory=True)
330         conf.check_cfg(package='libcurl', args='--cflags --libs', uselib_store='CURL', mandatory=True)
331         dynamic_quickmail(conf)
332         dynamic_boost(conf, boost_lib_suffix, boost_thread)
333         dynamic_ffmpeg(conf)
334         dynamic_dcp(conf)
335         dynamic_sub(conf)
336         dynamic_openjpeg(conf)
337         dynamic_ssh(conf)
338
339     # Dependencies which are always dynamically linked
340     conf.check_cfg(package='sndfile', args='--cflags --libs', uselib_store='SNDFILE', mandatory=True)
341     conf.check_cfg(package='glib-2.0', args='--cflags --libs', uselib_store='GLIB', mandatory=True)
342     conf.check_cfg(package= '', path=conf.options.magickpp_config, args='--cppflags --cxxflags --libs', uselib_store='MAGICK', mandatory=True)
343     conf.check_cfg(package='libzip', args='--cflags --libs', uselib_store='ZIP', mandatory=True)
344     conf.check_cfg(package='pangomm-1.4', args='--cflags --libs', uselib_store='PANGOMM', mandatory=True)
345     conf.check_cfg(package='cairomm-1.0', args='--cflags --libs', uselib_store='CAIROMM', mandatory=True)
346
347     conf.check_cc(fragment="""
348                            #include <glib.h>
349                            int main() { g_format_size (1); }
350                            """, msg='Checking for g_format_size ()',
351                            uselib='GLIB',
352                            define_name='HAVE_G_FORMAT_SIZE',
353                            mandatory=False)
354
355     conf.find_program('msgfmt', var='MSGFMT')
356     
357     datadir = conf.env.DATADIR
358     if not datadir:
359         datadir = os.path.join(conf.env.PREFIX, 'share')
360     
361     conf.define('LOCALEDIR', os.path.join(datadir, 'locale'))
362     conf.define('DATADIR', datadir)
363
364     conf.recurse('src')
365     if not conf.env.DISABLE_TESTS:
366         conf.recurse('test')
367
368 def build(bld):
369     create_version_cc(VERSION, bld.env.CXXFLAGS)
370
371     bld.recurse('src')
372     if not bld.env.DISABLE_TESTS:
373         bld.recurse('test')
374     if bld.env.TARGET_WINDOWS:
375         bld.recurse('platform/windows')
376     if bld.env.TARGET_LINUX:
377         bld.recurse('platform/linux')
378     if bld.env.TARGET_OSX:
379         bld.recurse('platform/osx')
380
381     for r in ['22x22', '32x32', '48x48', '64x64', '128x128']:
382         bld.install_files('${PREFIX}/share/icons/hicolor/%s/apps' % r, 'icons/%s/dcpomatic2.png' % r)
383
384     if not bld.env.TARGET_WINDOWS:
385         bld.install_files('${PREFIX}/share/dcpomatic2', 'icons/taskbar_icon.png')
386
387     bld.add_post_fun(post)
388
389 def git_revision():
390     if not os.path.exists('.git'):
391         return None
392
393     cmd = "LANG= git log --abbrev HEAD^..HEAD ."
394     output = subprocess.Popen(cmd, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0].splitlines()
395     o = output[0].decode('utf-8')
396     return o.replace("commit ", "")[0:10]
397
398 def dist(ctx):
399     r = git_revision()
400     if r is not None:
401         f = open('.git_revision', 'w')
402         print >>f,r
403     f.close()
404
405     ctx.excl = """
406                TODO core *~ src/wx/*~ src/lib/*~ builds/*~ doc/manual/*~ src/tools/*~ *.pyc .waf* build .git
407                deps alignment hacks sync *.tar.bz2 *.exe .lock* *build-windows doc/manual/pdf doc/manual/html
408                GRSYMS GRTAGS GSYMS GTAGS
409                """
410
411
412 def create_version_cc(version, cxx_flags):
413     commit = git_revision()
414     if commit is None and os.path.exists('.git_revision'):
415         f = open('.git_revision', 'r')
416         commit = f.readline().strip()
417     
418     if commit is None:
419         commit = 'release'
420
421     try:
422         text =  '#include "version.h"\n'
423         text += 'char const * dcpomatic_git_commit = \"%s\";\n' % commit
424         text += 'char const * dcpomatic_version = \"%s\";\n' % version
425
426         t = ''
427         for f in cxx_flags:
428             f = f.replace('"', '\\"')
429             t += f + ' '
430         text += 'char const * dcpomatic_cxx_flags = \"%s\";\n' % t[:-1]
431
432         print('Writing version information to src/lib/version.cc')
433         o = open('src/lib/version.cc', 'w')
434         o.write(text)
435         o.close()
436     except IOError:
437         print('Could not open src/lib/version.cc for writing\n')
438         sys.exit(-1)
439     
440 def post(ctx):
441     if ctx.cmd == 'install':
442         ctx.exec_command('/sbin/ldconfig')
443
444 def pot(bld):
445     bld.recurse('src')
446
447 def pot_merge(bld):
448     bld.recurse('src')
449
450 def tags(bld):
451     os.system('etags src/lib/*.cc src/lib/*.h src/wx/*.cc src/wx/*.h src/tools/*.cc src/tools/*.h test/*.cc')