Fix build for new libdcp.
[libsub.git] / wscript
diff --git a/wscript b/wscript
index df197713cf27e85c36b3ca1b288216cf59a30af4..19afe56bd8d74a1e0336b37f1e160e23c11522f6 100644 (file)
--- a/wscript
+++ b/wscript
@@ -2,12 +2,13 @@ import subprocess
 import os
 
 APPNAME = 'libsub'
-VERSION = '0.01.0devel'
+VERSION = '1.0.0devel'
+API_VERSION = '-1.0'
 
 def options(opt):
     opt.load('compiler_cxx')
     opt.add_option('--enable-debug', action='store_true', default=False, help='build with debugging information and without optimisation')
-    opt.add_option('--static', action='store_true', default=False, help='build libsub statically and link statically to cxml')
+    opt.add_option('--static', action='store_true', default=False, help='build libsub statically and link statically to cxml and dcp')
     opt.add_option('--target-windows', action='store_true', default=False, help='set up to do a cross-compile to make a Windows package')
     opt.add_option('--disable-tests', action='store_true', default=False, help='disable building of tests')
 
@@ -20,6 +21,7 @@ def configure(conf):
     conf.env.STATIC = conf.options.static
     conf.env.TARGET_WINDOWS = conf.options.target_windows
     conf.env.DISABLE_TESTS = conf.options.disable_tests
+    conf.env.API_VERSION = API_VERSION
 
     if conf.options.enable_debug:
         conf.env.append_value('CXXFLAGS', '-g')
@@ -31,8 +33,14 @@ def configure(conf):
         conf.env.LIB_CXML = ['glibmm-2.4', 'glib-2.0', 'pcre', 'sigc-2.0', 'rt', 'xml++-2.6', 'xml2', 'pthread', 'lzma', 'dl', 'z']
         conf.env.STLIB_CXML = ['cxml']
         conf.check_cfg(package='libcxml', atleast_version='0.08', args='--cflags', uselib_store='CXML', mandatory=True)
+        conf.env.STLIB_DCP = ['dcp-1.0', 'asdcp-libdcp-1.0', 'kumu-libdcp-1.0', 'openjpeg']
+        conf.env.LIB_DCP = ['glibmm-2.4', 'ssl', 'crypto', 'bz2', 'xslt', 'xmlsec1', 'xmlsec1-openssl']
+        conf.check_cfg(package='libdcp-1.0', atleast_version='1.0.0', args='--cflags', uselib_store='DCP', mandatory=True)
+        conf.env.DEFINES_DCP = [f.replace('\\', '') for f in conf.env.DEFINES_DCP]
     else:
         conf.check_cfg(package='libcxml', atleast_version='0.08', args='--cflags --libs', uselib_store='CXML', mandatory=True)
+        conf.check_cfg(package='libdcp-1.0', atleast_version='1.0.0', args='--cflags --libs', uselib_store='DCP', mandatory=True)
+        conf.env.DEFINES_DCP = [f.replace('\\', '') for f in conf.env.DEFINES_DCP]
 
     boost_lib_suffix = ''
     if conf.env.TARGET_WINDOWS:
@@ -79,10 +87,10 @@ def build(bld):
     else:
         boost_lib_suffix = ''
 
-    bld(source='libsub.pc.in',
+    bld(source='libsub%s.pc.in' % bld.env.API_VERSION,
         version=VERSION,
-        includedir='%s/include' % bld.env.PREFIX,
-        libs="-L${libdir} -lsub -lboost_system%s" % boost_lib_suffix,
+        includedir='%s/include/libsub%s' % (bld.env.PREFIX, bld.env.API_VERSION),
+        libs="-L${libdir} -lsub%s -lboost_system%s" % (bld.env.API_VERSION, boost_lib_suffix),
         install_path='${LIBDIR}/pkgconfig')
 
     bld.recurse('src')