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