Merge master.
[dcpomatic.git] / wscript
diff --git a/wscript b/wscript
index 4a49c8d40e89b3319d8931a07520e848909dfa0b..6b55dbdad09f5aabde6ef3dfaf8f23fcf2145175 100644 (file)
--- a/wscript
+++ b/wscript
@@ -1,9 +1,11 @@
 import subprocess
 import os
 import sys
+import distutils
+import distutils.spawn
 
 APPNAME = 'dcpomatic'
-VERSION = '2.0.12'
+VERSION = '2.0.14devel'
 
 def options(opt):
     opt.load('compiler_cxx')
@@ -28,8 +30,9 @@ def static_ffmpeg(conf):
     conf.check_cfg(package='libavfilter', args='--cflags', uselib_store='AVFILTER', mandatory=True)
     conf.env.STLIB_AVFILTER = ['avfilter', 'swresample']
     conf.check_cfg(package='libavcodec', args='--cflags', uselib_store='AVCODEC', mandatory=True)
+    # lzma link is needed by Centos 7, at least
     conf.env.STLIB_AVCODEC = ['avcodec']
-    conf.env.LIB_AVCODEC = ['z']
+    conf.env.LIB_AVCODEC = ['z', 'lzma']
     conf.check_cfg(package='libavutil', args='--cflags', uselib_store='AVUTIL', mandatory=True)
     conf.env.STLIB_AVUTIL = ['avutil']
     conf.check_cfg(package='libswscale', args='--cflags', uselib_store='SWSCALE', mandatory=True)
@@ -57,8 +60,13 @@ def dynamic_openjpeg(conf):
     conf.check_cfg(package='libopenjpeg', args='--cflags --libs', atleast_version='1.5.0', uselib_store='OPENJPEG', mandatory=True)
     conf.check_cfg(package='libopenjpeg', args='--cflags --libs', max_version='1.5.2', mandatory=True)
 
+def static_sub(conf):
+    conf.check_cfg(package='libsub', atleast_version='0.01.0', args='--cflags', uselib_store='SUB', mandatory=True)
+    conf.env.DEFINES_SUB = [f.replace('\\', '') for f in conf.env.DEFINES_SUB]
+    conf.env.STLIB_SUB = ['sub']
+
 def static_dcp(conf, static_boost, static_xmlpp, static_xmlsec, static_ssh):
-    conf.check_cfg(package='libdcp-1.0', atleast_version='0.96', args='--cflags', uselib_store='DCP', mandatory=True)
+    conf.check_cfg(package='libdcp-1.0', atleast_version='1.0', args='--cflags', uselib_store='DCP', mandatory=True)
     conf.env.DEFINES_DCP = [f.replace('\\', '') for f in conf.env.DEFINES_DCP]
     conf.env.STLIB_DCP = ['dcp-1.0', 'asdcp-libdcp-1.0', 'kumu-libdcp-1.0']
     conf.env.LIB_DCP = ['glibmm-2.4', 'ssl', 'crypto', 'bz2', 'xslt']
@@ -87,6 +95,10 @@ def dynamic_dcp(conf):
     conf.check_cfg(package='libdcp-1.0', atleast_version='0.92', args='--cflags --libs', uselib_store='DCP', mandatory=True)
     conf.env.DEFINES_DCP = [f.replace('\\', '') for f in conf.env.DEFINES_DCP]
 
+def dynamic_sub(conf):
+    conf.check_cfg(package='libsub', atleast_version='0.01.0', args='--cflags --libs', uselib_store='SUB', mandatory=True)
+    conf.env.DEFINES_SUB = [f.replace('\\', '') for f in conf.env.DEFINES_SUB]
+
 def dynamic_ssh(conf):
     conf.check_cc(fragment="""
                            #include <libssh/libssh.h>\n
@@ -182,7 +194,7 @@ def configure(conf):
 
     # Common CXXFLAGS
     conf.env.append_value('CXXFLAGS', ['-D__STDC_CONSTANT_MACROS', '-D__STDC_LIMIT_MACROS', '-msse', '-ffast-math', '-fno-strict-aliasing',
-                                       '-Wall', '-Wno-attributes', '-Wextra', '-D_FILE_OFFSET_BITS=64'])
+                                       '-Wall', '-Wno-attributes', '-Wextra', '-Wno-unused-result', '-D_FILE_OFFSET_BITS=64'])
 
     if conf.options.enable_debug:
         conf.env.append_value('CXXFLAGS', ['-g', '-DDCPOMATIC_DEBUG'])
@@ -236,6 +248,10 @@ def configure(conf):
     if conf.env.TARGET_DEBIAN:
         # libxml2 seems to be linked against this on Ubuntu but it doesn't mention it in its .pc file
         conf.check_cfg(package='liblzma', args='--cflags --libs', uselib_store='LZMA', mandatory=True)
+
+    if conf.env.TARGET_CENTOS_6 or conf.env.TARGET_CENTOS_7:
+        # libavcodec seems to be linked against this on Centos
+        conf.check_cfg(package='liblzma', args='--cflags --libs', uselib_store='LZMA', mandatory=True)
         
     if not conf.env.DISABLE_GUI and conf.env.TARGET_LINUX:
         conf.check_cfg(package='gtk+-2.0', args='--cflags --libs', uselib_store='GTK', mandatory=True)
@@ -258,6 +274,7 @@ def configure(conf):
         conf.env.STLIB_QUICKMAIL = ['quickmail']
         static_ffmpeg(conf)
         static_openjpeg(conf)
+        static_sub(conf)
         static_dcp(conf, False, False, False, False)
         dynamic_boost(conf, boost_lib_suffix, boost_thread)
 
@@ -272,6 +289,7 @@ def configure(conf):
         conf.env.LIB_QUICKMAIL = ['ssh2', 'idn']
         static_ffmpeg(conf)
         static_openjpeg(conf)
+        static_sub(conf)
         static_dcp(conf, True, True, True, True)
         static_boost(conf, boost_lib_suffix)
 
@@ -286,6 +304,7 @@ def configure(conf):
         conf.env.LIB_XMLSEC = ['ltdl']
         static_ffmpeg(conf)
         static_openjpeg(conf)
+        static_sub(conf)
         static_dcp(conf, False, True, True, True)
         dynamic_boost(conf, boost_lib_suffix, boost_thread)
 
@@ -304,6 +323,7 @@ def configure(conf):
         dynamic_ffmpeg(conf)
         dynamic_openjpeg(conf)
         dynamic_dcp(conf)
+        dynamic_sub(conf)
         dynamic_ssh(conf)
 
     # Not packaging; just a straight build
@@ -315,13 +335,20 @@ def configure(conf):
         dynamic_boost(conf, boost_lib_suffix, boost_thread)
         dynamic_ffmpeg(conf)
         dynamic_dcp(conf)
+        dynamic_sub(conf)
         dynamic_openjpeg(conf)
         dynamic_ssh(conf)
 
     # Dependencies which are always dynamically linked
     conf.check_cfg(package='sndfile', args='--cflags --libs', uselib_store='SNDFILE', mandatory=True)
     conf.check_cfg(package='glib-2.0', args='--cflags --libs', uselib_store='GLIB', mandatory=True)
-    conf.check_cfg(package= '', path=conf.options.magickpp_config, args='--cppflags --cxxflags --libs', uselib_store='MAGICK', mandatory=True)
+    if distutils.spawn.find_executable(conf.options.magickpp_config):
+        conf.check_cfg(package='', path=conf.options.magickpp_config, args='--cppflags --cxxflags --libs', uselib_store='MAGICK', mandatory=True)
+        conf.env.append_value('CXXFLAGS', '-DDCPOMATIC_IMAGE_MAGICK')
+    else:
+        conf.check_cfg(package='GraphicsMagick++', args='--cflags --libs', uselib_store='MAGICK', mandatory=True)
+        conf.env.append_value('CXXFLAGS', '-DDCPOMATIC_GRAPHICS_MAGICK')
+        
     conf.check_cfg(package='libzip', args='--cflags --libs', uselib_store='ZIP', mandatory=True)
     conf.check_cfg(package='pangomm-1.4', args='--cflags --libs', uselib_store='PANGOMM', mandatory=True)
     conf.check_cfg(package='cairomm-1.0', args='--cflags --libs', uselib_store='CAIROMM', mandatory=True)