8 opt.load('compiler_cxx')
9 opt.add_option('--debug-hash', action='store_true', default = False, help = 'print hashes of data at various points')
10 opt.add_option('--enable-debug', action='store_true', default = False, help = 'build with debugging information and without optimisation')
11 opt.add_option('--disable-gui', action='store_true', default = False, help = 'disable building of GUI tools')
12 opt.add_option('--disable-player', action='store_true', default = False, help = 'disable building of the player components')
13 opt.add_option('--ffmpeg-083', action='store_true', default = False, help = 'Use FFmpeg version in Ubuntu 12.04')
14 opt.add_option('--target-windows', action='store_true', default = False, help = 'set up to do a cross-compile to Windows')
17 conf.load('compiler_cxx')
19 conf.env.append_value('CXXFLAGS', ['-D__STDC_CONSTANT_MACROS', '-msse', '-mfpmath=sse', '-ffast-math', '-fno-strict-aliasing', '-Wall', '-Wno-attributes'])
20 conf.env.append_value('CXXFLAGS', ['-DDVDOMATIC_VERSION="%s"' % VERSION])
22 if conf.options.target_windows:
23 conf.env.append_value('CXXFLAGS', '-DDVDOMATIC_WINDOWS')
24 conf.options.disable_player = True
25 conf.check(lib = 'ws2_32', uselib_store = 'WINSOCK2', msg = "Checking for library winsock2")
27 conf.env.append_value('CXXFLAGS', '-DDVDOMATIC_POSIX')
29 conf.env.DEBUG_HASH = conf.options.debug_hash
30 conf.env.TARGET_WINDOWS = conf.options.target_windows
31 conf.env.DISABLE_GUI = conf.options.disable_gui
32 conf.env.DISABLE_PLAYER = conf.options.disable_player
34 if conf.options.disable_player:
35 conf.env.append_value('CXXFLAGS', '-DDVDOMATIC_DISABLE_PLAYER')
37 if conf.options.enable_debug:
38 conf.env.append_value('CXXFLAGS', '-g')
40 conf.env.append_value('CXXFLAGS', '-O3')
42 if conf.options.ffmpeg_083:
43 conf.env.append_value('CXXFLAGS', '-DDVDOMATIC_FFMPEG_0_8_3')
45 conf.check_cfg(package = 'sigc++-2.0', args = '--cflags --libs', uselib_store = 'SIGC++', mandatory = True)
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 = 'libpostproc', args = '--cflags --libs', uselib_store = 'POSTPROC', mandatory = True)
52 conf.check_cfg(package = 'sndfile', args = '--cflags --libs', uselib_store = 'SNDFILE', mandatory = True)
53 conf.check_cfg(package = 'libdcp', args = '--cflags --libs', uselib_store = 'DCP', mandatory = True)
54 conf.check_cfg(package = '', path = 'Magick++-config', args = '--cppflags --cxxflags --libs', uselib_store = 'MAGICK', mandatory = True)
55 conf.check_cc(msg = 'Checking for library libtiff', function_name = 'TIFFOpen', header_name = 'tiffio.h', lib = 'tiff', uselib_store = 'TIFF')
56 conf.check_cc(fragment = """
58 #include <openjpeg.h>\n
60 void* p = (void *) opj_image_create;\n
63 """, msg = 'Checking for library openjpeg', lib = 'openjpeg', uselib_store = 'OPENJPEG')
65 conf.check_cc(fragment = """
66 #include <libssh/libssh.h>\n
68 ssh_session s = ssh_new ();\n
71 """, msg = 'Checking for library libssh', mandatory = False, lib = 'ssh', uselib_store = 'SSH')
73 conf.check_cxx(fragment = """
74 #include <boost/thread.hpp>\n
75 int main() { boost::thread t (); }\n
76 """, msg = 'Checking for boost threading library',
77 lib = ['boost_thread_win32-mt', 'boost_system-mt'], uselib_store = 'BOOST_THREAD')
78 conf.check_cxx(fragment = """
79 #include <boost/filesystem.hpp>\n
80 int main() { boost::filesystem::copy_file ("a", "b"); }\n
81 """, msg = 'Checking for boost filesystem library',
82 libpath = '/usr/local/lib', lib = ['boost_filesystem-mt', 'boost_system-mt'], uselib_store = 'BOOST_FILESYSTEM')
84 conf.check_cc(fragment = """
86 int main() { g_format_size (1); }
87 """, msg = 'Checking for g_format_size ()',
89 define_name = 'HAVE_G_FORMAT_SIZE',
96 create_version_cc(VERSION)
101 d = { 'PREFIX' : '${PREFIX' }
103 obj = bld(features = 'subst')
104 obj.source = 'dvdomatic.desktop.in'
105 obj.target = 'dvdomatic.desktop'
108 bld.install_files('${PREFIX}/share/applications', 'dvdomatic.desktop')
109 for r in ['22x22', '32x32', '48x48', '64x64', '128x128']:
110 bld.install_files('${PREFIX}/share/icons/hicolor/%s/apps' % r, 'icons/%s/dvdomatic.png' % r)
113 ctx.excl = 'TODO core *~ src/gtk/*~ src/lib/*~ .waf* build .git'
115 def create_version_cc(version):
116 if os.path.exists('.git'):
117 cmd = "LANG= git log --abbrev HEAD^..HEAD ."
118 output = subprocess.Popen(cmd, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0].splitlines()
119 o = output[0].decode('utf-8')
120 commit = o.replace ("commit ", "")[0:10]
125 text = '#include "version.h"\n'
126 text += 'char const * dvdomatic_git_commit = \"%s\";\n' % commit
127 text += 'char const * dvdomatic_version = \"%s\";\n' % version
128 print('Writing version information to src/lib/version.cc')
129 o = open('src/lib/version.cc', 'w')
133 print('Could not open src/lib/version.cc for writing\n')