Use new cscript syntax.
[dcpomatic.git] / cscript
diff --git a/cscript b/cscript
index ff6320443a80fdad81ce9de5ecdf7ad9274f5b4c..71760f030c5ae9eacd7a0922877a386b8ae0dd73 100644 (file)
--- a/cscript
+++ b/cscript
@@ -1,6 +1,6 @@
 # -*- mode: python -*-
 #
-#    Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
+#    Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net>
 #
 #    This file is part of DCP-o-matic.
 #
@@ -196,14 +196,14 @@ deb_depends['unstable'].extend(['libboost-filesystem1.67.0',
                                 'libx264-155',
                                 'libcurl4'])
 
-def build_dist(target):
-    # We can build dcpomatic2_dist on platforms that have Boost process and can build the lwext4
+def can_build_disk(target):
+    # We can build dcpomatic2_disk on platforms that have Boost process and can build the lwext4
     # library.  For now, just whitelist good ones here.
     #
     # - Lots of Linux distros don't have a new enough boost (1.64 or above)
     # - On Centos 6 we can't build lwext4 because it needs a new CMake which Centos 6's g++ is not new enough to build.
     # - On Centos 7 there is a build error in lwext4 related to __unused
-    return target.platform == 'windows' or (target.platform == 'linux' and target.distro == 'ubuntu' and target.version in ['18.04', '18.10', '19.04'])
+    return target.platform == 'windows' or target.platform == 'osx' or (target.platform == 'linux' and target.distro == 'ubuntu' and target.version in ['18.04', '18.10', '19.04'])
 
 def packages(name, packages, f):
     s = '%s: ' % name
@@ -286,9 +286,9 @@ def make_spec(filename, version, target, options, requires=None):
     if options['variant'] == 'swaroop-studio':
         print('%{_bindir}/dcpomatic2_ecinema', file=f)
         print('%{_bindir}/dcpomatic2_uuid', file=f)
-    if os.path.exists(os.path.join(tools, "dcpomatic2_dist")):
-        print('%{_bindir}/dcpomatic2_dist', file=f)
-        print('%{_bindir}/dcpomatic2_dist_writer', file=f)
+    if os.path.exists(os.path.join(tools, "dcpomatic2_disk")):
+        print('%{_bindir}/dcpomatic2_disk', file=f)
+        print('%{_bindir}/dcpomatic2_disk_writer', file=f)
     print('%{_datadir}/applications/dcpomatic2.desktop', file=f)
     print('%{_datadir}/applications/dcpomatic2_batch.desktop', file=f)
     print('%{_datadir}/applications/dcpomatic2_server.desktop', file=f)
@@ -362,21 +362,25 @@ def dependencies(target):
         # Use distro-provided FFmpeg on Arch
         deps = []
 
-    deps.append(('libdcp', None))
-    deps.append(('libsub', None))
+    cpp_lib_options = {}
+    if target.platform == 'osx' and target.bits == 64:
+        # We can use C++11 mode, so let's do it.
+        options['force-cpp11'] = True
+
+    deps.append(('libdcp', None, cpp_lib_options))
+    deps.append(('libsub', None, cpp_lib_options))
     deps.append(('rtaudio', 'carl'))
     # We get our OpenSSL libraries from the environment, but we
     # also need a patched openssl binary to make certificates.
     # This dependency is to get that binary, which is added into
     # the appropriate place later
     deps.append(('openssl', 'carl'))
-    if build_dist(target):
+    if can_build_disk(target):
         deps.append(('lwext4', 'carl2'))
 
     return deps
 
-def option_defaults():
-    return { "gui": True, "variant": None }
+option_defaults = { "gui": True, "variant": None, "disk": False }
 
 def configure_options(target, options):
     opt = ''
@@ -401,6 +405,8 @@ def configure_options(target, options):
                 # I worry that this will cause ABI problems but I don't have
                 # a better solution.
                 opt += ' --force-cpp11'
+    elif target.platform == 'osx' and target.bits == 64:
+        opt += ' --force-cpp11'
 
     if not options['gui']:
         opt += ' --disable-gui'
@@ -412,8 +418,8 @@ def configure_options(target, options):
     if target.debug and target.platform == 'windows':
         opt += ' --static-dcpomatic'
 
-    if build_dist(target):
-       opt += ' --enable-dist'
+    if can_build_disk(target) and options['disk']:
+       opt += ' --enable-disk'
 
     return opt