Allow static builds.
authorCarl Hetherington <cth@carlh.net>
Fri, 7 Dec 2012 21:23:40 +0000 (21:23 +0000)
committerCarl Hetherington <cth@carlh.net>
Fri, 7 Dec 2012 21:23:40 +0000 (21:23 +0000)
src/lib/wscript
src/tools/wscript
src/wx/wscript
test/wscript
wscript

index 0d3c7d99de937bce70e5a3239383a21f928c11cb..c1786bb818b6566ee85b0c4cddff299cfd5f543a 100644 (file)
@@ -1,5 +1,9 @@
 def build(bld):
-    obj = bld(features = 'cxx cxxshlib')
+    if bld.env.STATIC:
+        obj = bld(features = 'cxx cxxstlib')
+    else:
+        obj = bld(features = 'cxx cxxshlib')
+
     obj.name = 'libdvdomatic'
     obj.export_includes = ['.']
     obj.uselib = 'AVCODEC AVUTIL AVFORMAT AVFILTER SWSCALE SWRESAMPLE SNDFILE BOOST_FILESYSTEM BOOST_THREAD BOOST_DATETIME BOOST_SIGNALS2 OPENJPEG POSTPROC TIFF MAGICK SSH DCP GLIB'
index 9c1ca7524ea65b1f6def3352ac78ebe70c933af1..c8601ad1f2637d05a88e965c0f258a3149a0df3c 100644 (file)
@@ -1,7 +1,7 @@
 def build(bld):
     for t in ['makedcp', 'fixlengths', 'servomatic_cli']:
         obj = bld(features = 'cxx cxxprogram')
-       obj.uselib = 'BOOST_THREAD'
+       obj.uselib = 'BOOST_THREAD DCP'
        obj.includes = ['..']
         obj.use    = ['libdvdomatic']
         obj.source = '%s.cc' % t
@@ -10,6 +10,7 @@ def build(bld):
     if not bld.env.DISABLE_GUI:
         for t in ['dvdomatic', 'servomatic_gui']:
             obj = bld(features = 'cxx cxxprogram')
+            obj.uselib = 'DCP'
             obj.includes = ['..']
             obj.use    = ['libdvdomatic', 'libdvdomatic-wx']
             obj.source = '%s.cc' % t
index d425c3e05a31ead28d652efc8d8c2bfea724a0e6..4dbb04eeacaa4cc0da3155f09e6243e5934b7dbb 100644 (file)
@@ -2,7 +2,11 @@ def configure(conf):
     conf.check_cfg(package = '', path = 'wx-config', args = '--cppflags --cxxflags --libs', uselib_store = 'WXWIDGETS', mandatory = True)
 
 def build(bld):
-    obj = bld(features = 'cxx cxxshlib')
+    if bld.env.STATIC:
+        obj = bld(features = 'cxx cxxstlib')
+    else:
+        obj = bld(features = 'cxx cxxshlib')
+
     obj.name   = 'libdvdomatic-wx'
     obj.includes = [ '..' ]
     obj.export_includes = ['.']
index 8a9cb22920aaf4e6eeb6b337f88b5a2c7cdd706a..3b809f9399e17c759b79d67e1c0b7901bae8e98f 100644 (file)
@@ -8,7 +8,7 @@ def configure(conf):
 def build(bld):
     obj = bld(features = 'cxx cxxprogram')
     obj.name   = 'unit-tests'
-    obj.uselib = 'BOOST_TEST'
+    obj.uselib = 'BOOST_TEST DCP'
     obj.use    = 'libdvdomatic'
     obj.source = 'test.cc'
     obj.target = 'unit-tests'
diff --git a/wscript b/wscript
index ee307202657dae733a6dd169d3a4c5a56f6c6b80..21e3ff9a82d7630b2799f1c79d4247d858a73ab6 100644 (file)
--- a/wscript
+++ b/wscript
@@ -12,6 +12,7 @@ def options(opt):
     opt.add_option('--enable-debug', action='store_true', default = False, help = 'build with debugging information and without optimisation')
     opt.add_option('--disable-gui', action='store_true', default = False, help = 'disable building of GUI tools')
     opt.add_option('--target-windows', action='store_true', default = False, help = 'set up to do a cross-compile to Windows')
+    opt.add_option('--static', action='store_true', default = False, help = 'build statically, and link statically to libdcp and FFmpeg')
 
 def configure(conf):
     conf.load('compiler_cxx')
@@ -19,6 +20,8 @@ def configure(conf):
         conf.load('winres')
 
     conf.env.append_value('CXXFLAGS', ['-D__STDC_CONSTANT_MACROS', '-msse', '-mfpmath=sse', '-ffast-math', '-fno-strict-aliasing', '-Wall', '-Wno-attributes'])
+    # libxml2 seems to be linked against this on Ubuntu, but it doesn't mention it in its .pc file
+    conf.env.append_value('LIB', 'lzma')
 
     if conf.options.target_windows:
         conf.env.append_value('CXXFLAGS', ['-DDVDOMATIC_WINDOWS', '-DWIN32_LEAN_AND_MEAN', '-DBOOST_USE_WINDOWS_H'])
@@ -39,6 +42,7 @@ def configure(conf):
 
     conf.env.TARGET_WINDOWS = conf.options.target_windows
     conf.env.DISABLE_GUI = conf.options.disable_gui
+    conf.env.STATIC = conf.options.static
     conf.env.VERSION = VERSION
 
     if conf.options.enable_debug:
@@ -54,7 +58,10 @@ def configure(conf):
     conf.check_cfg(package = 'libswresample', args = '--cflags --libs', uselib_store = 'SWRESAMPLE', mandatory = False)
     conf.check_cfg(package = 'libpostproc', args = '--cflags --libs', uselib_store = 'POSTPROC', mandatory = True)
     conf.check_cfg(package = 'sndfile', args = '--cflags --libs', uselib_store = 'SNDFILE', mandatory = True)
-    conf.check_cfg(package = 'libdcp', atleast_version = '0.33', args = '--cflags --libs', uselib_store = 'DCP', mandatory = True)
+    libdcp_args = '--cflags --libs'
+    if conf.options.static:
+        libdcp_args += ' --static'
+    conf.check_cfg(package = 'libdcp', atleast_version = '0.33', args = libdcp_args, uselib_store = 'DCP', mandatory = True)
     conf.check_cfg(package = 'glib-2.0', args = '--cflags --libs', uselib_store = 'GLIB', mandatory = True)
     conf.check_cfg(package = '', path = 'Magick++-config', args = '--cppflags --cxxflags --libs', uselib_store = 'MAGICK', mandatory = True)
     conf.check_cc(fragment  = """