7 opt.load('compiler_cxx')
8 opt.add_option('--debug-hash', action='store_true', default = False, help = 'print hashes of data at various points')
9 opt.add_option('--enable-debug', action='store_true', default = False, help = 'build with debugging information and without optimisation')
10 opt.add_option('--disable-gui', action='store_true', default = False, help = 'disable building of GUI tools')
11 opt.add_option('--ffmpeg-083', action='store_true', default = False, help = 'Use FFmpeg version in Ubuntu 12.04')
14 conf.load('compiler_cxx')
16 conf.env.append_value('CXXFLAGS', ['-D__STDC_CONSTANT_MACROS', '-D__STDC_LIMIT_MACROS', '-msse', '-mfpmath=sse', '-ffast-math', '-Wall'])
17 conf.env.append_value('CXXFLAGS', ['-DDVDOMATIC_VERSION="%s"' % VERSION])
19 conf.env.DEBUG_HASH = conf.options.debug_hash
21 if conf.options.enable_debug:
22 conf.env.append_value('CXXFLAGS', '-g')
24 conf.env.append_value('CXXFLAGS', '-O3')
26 if conf.options.ffmpeg_083:
27 conf.env.append_value('CXXFLAGS', '-DDVDOMATIC_FFMPEG_0_8_3')
29 conf.env.DISABLE_GUI = conf.options.disable_gui
31 conf.check_cfg(package = 'sigc++-2.0', args = '--cflags --libs', uselib_store = 'SIGC++', mandatory = True)
32 conf.check_cfg(package = 'libavformat', args = '--cflags --libs', uselib_store = 'AVFORMAT', mandatory = True)
33 conf.check_cfg(package = 'libavfilter', args = '--cflags --libs', uselib_store = 'AVFILTER', mandatory = True)
34 conf.check_cfg(package = 'libavcodec', args = '--cflags --libs', uselib_store = 'AVCODEC', mandatory = True)
35 conf.check_cfg(package = 'libavutil', args = '--cflags --libs', uselib_store = 'AVUTIL', mandatory = True)
36 conf.check_cfg(package = 'libswscale', args = '--cflags --libs', uselib_store = 'SWSCALE', mandatory = True)
37 conf.check_cfg(package = 'libpostproc', args = '--cflags --libs', uselib_store = 'POSTPROC', mandatory = True)
38 conf.check_cfg(package = 'sndfile', args = '--cflags --libs', uselib_store = 'SNDFILE', mandatory = True)
39 conf.check_cfg(package = 'libdcp', args = '--cflags --libs', uselib_store = 'DCP', mandatory = True)
40 conf.check_cfg(package = '', path = 'Magick++-config', args = '--cppflags --cxxflags --libs', uselib_store = 'MAGICK', mandatory = True)
41 conf.check_cc(msg = 'Checking for library libtiff', function_name = 'TIFFOpen', header_name = 'tiffio.h', lib = 'tiff', uselib_store = 'TIFF')
42 conf.check_cc(fragment = """
44 #include <openjpeg.h>\n
46 void* p = (void *) opj_image_create;\n
49 """, msg = 'Checking for library openjpeg', lib = 'openjpeg', uselib_store = 'OPENJPEG')
51 conf.check_cc(fragment = """
52 #include <libssh/libssh.h>\n
54 ssh_session s = ssh_new ();\n
57 """, msg = 'Checking for library libssh', lib = 'ssh', uselib_store = 'SSH')
59 conf.check_cxx(fragment = """
60 #include <boost/thread.hpp>\n
61 int main() { boost::thread t (); }\n
62 """, msg = 'Checking for boost threading library', lib = 'boost_thread', uselib_store = 'BOOST_THREAD')
63 conf.check_cxx(fragment = """
64 #include <boost/filesystem.hpp>\n
65 int main() { boost::filesystem::copy_file ("a", "b"); }\n
66 """, msg = 'Checking for boost filesystem library', libpath = '/usr/local/lib', lib = ['boost_filesystem', 'boost_system'], uselib_store = 'BOOST_FILESYSTEM')
72 create_version_cc(VERSION)
77 d = { 'PREFIX' : '${PREFIX' }
79 obj = bld(features = 'subst')
80 obj.source = 'dvdomatic.desktop.in'
81 obj.target = 'dvdomatic.desktop'
84 bld.install_files('${PREFIX}/share/applications', 'dvdomatic.desktop')
85 for r in ['22x22', '32x32', '48x48', '64x64', '128x128']:
86 bld.install_files('${PREFIX}/share/icons/hicolor/%s/apps' % r, 'icons/%s/dvdomatic.png' % r)
89 ctx.excl = 'TODO core *~ src/gtk/*~ src/lib/*~ .waf* build .git'
91 def create_version_cc(version):
92 cmd = "LANG= git log --abbrev HEAD^..HEAD ."
93 output = subprocess.Popen(cmd, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0].splitlines()
94 o = output[0].decode('utf-8')
95 commit = o.replace ("commit ", "")[0:10]
98 text = '#include "version.h"\n'
99 text += 'char const * dvdomatic_git_commit = \"%s\";\n' % commit
100 text += 'char const * dvdomatic_version = \"%s\";\n' % version
101 print('Writing version information to src/lib/version.cc')
102 o = open('src/lib/version.cc', 'w')
106 print('Could not open src/lib/version.cc for writing\n')