More Debian 8 trimming.
[dcpomatic.git] / cscript
diff --git a/cscript b/cscript
index eb7a817eb88683aa8e385793d444ad6ef8b0cfac..7e75cb8d2a6b995a025caf296eed5f2c82025f92 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.
 #
@@ -33,14 +33,10 @@ deb_build_depends['16.04'] = copy.deepcopy(deb_build_depends_base)
 deb_build_depends['16.04'].extend(['libssh-dev'])
 deb_build_depends['18.04'] = copy.deepcopy(deb_build_depends_base)
 deb_build_depends['18.04'].extend(['libssh-dev'])
-deb_build_depends['19.04'] = copy.deepcopy(deb_build_depends_base)
-deb_build_depends['19.04'].extend(['libssh-dev'])
 deb_build_depends['19.10'] = copy.deepcopy(deb_build_depends_base)
 deb_build_depends['19.10'].extend(['libssh-dev'])
-deb_build_depends['7'] = copy.deepcopy(deb_build_depends_base)
-deb_build_depends['7'].extend(['libssh-dev'])
-deb_build_depends['8'] = copy.deepcopy(deb_build_depends_base)
-deb_build_depends['8'].extend(['libssh-gcrypt-dev'])
+deb_build_depends['20.04'] = copy.deepcopy(deb_build_depends_base)
+deb_build_depends['20.04'].extend(['libssh-dev'])
 deb_build_depends['9'] = copy.deepcopy(deb_build_depends_base)
 deb_build_depends['9'].extend(['libssh-gcrypt-dev'])
 deb_build_depends['10'] = copy.deepcopy(deb_build_depends_base)
@@ -66,7 +62,8 @@ deb_depends['16.04'].extend(['libboost-filesystem1.58.0',
                              'libnettle6',
                              'libssh-4',
                              'libx264-148',
-                             'libcurl3'])
+                             'libcurl3',
+                             'libxerces-c3.1'])
 
 deb_depends['18.04'] = copy.deepcopy(deb_depends_base)
 deb_depends['18.04'].extend(['libboost-filesystem1.65.1',
@@ -83,10 +80,12 @@ deb_depends['18.04'].extend(['libboost-filesystem1.65.1',
                              'libssh-4',
                              'libx264-152',
                              'libcurl4',
-                             'libpulse0'])
+                             'libpulse0',
+                             'libxerces-c3.2',
+                             'libnanomsg4'])
 
-deb_depends['19.04'] = copy.deepcopy(deb_depends_base)
-deb_depends['19.04'].extend(['libboost-filesystem1.67.0',
+deb_depends['19.10'] = copy.deepcopy(deb_depends_base)
+deb_depends['19.10'].extend(['libboost-filesystem1.67.0',
                              'libboost-thread1.67.0',
                              'libboost-regex1.67.0',
                              'libboost-date-time1.67.0',
@@ -100,42 +99,28 @@ deb_depends['19.04'].extend(['libboost-filesystem1.67.0',
                              'libssh-4',
                              'libx264-155',
                              'libcurl4',
-                             'libpulse0'])
-
-deb_depends['19.10'] = copy.deepcopy(deb_depends_base)
-deb_depends['19.10'].extend(['libboost-filesystem1.67.0',
-                             'libboost-thread1.67.0',
-                             'libboost-regex1.67.0',
-                             'libboost-date-time1.67.0',
+                             'libpulse0',
+                             'libxerces-c3.2',
+                             'libnanomsg5'])
+
+deb_depends['20.04'] = copy.deepcopy(deb_depends_base)
+deb_depends['20.04'].extend(['libboost-filesystem1.71.0',
+                             'libboost-thread1.71.0',
+                             'libboost-regex1.71.0',
+                             'libboost-date-time1.71.0',
                              'libcairomm-1.0-1v5',
                              'libpangomm-1.4-1v5',
                              'libxml++2.6-2v5',
                              'libzip5',
-                             'libwxgtk3.0-0v5',
-                             'libicu63',
-                             'libnettle6',
+                             'libwxgtk3.0-gtk3-0v5',
+                             'libicu66',
+                             'libnettle7',
                              'libssh-4',
                              'libx264-155',
                              'libcurl4',
-                             'libpulse0'])
-
-deb_depends['8'] = copy.deepcopy(deb_depends_base)
-deb_depends['8'].extend(['libboost-filesystem1.55.0',
-                         'libboost-thread1.55.0',
-                         'libboost-date-time1.55.0',
-                         'libboost-regex1.55.0',
-                         'libxml++2.6-2',
-                         'libzip2',
-                         'libcairomm-1.0-1',
-                         'libpangomm-1.4-1',
-                         'libwxgtk3.0-0',
-                         'libxcb-xfixes0',
-                         'libxcb-shape0',
-                         'libicu52',
-                         'libnettle4',
-                         'libssh-4',
-                         'libx264-142',
-                         'libcurl3'])
+                             'libpulse0',
+                             'libxerces-c3.2',
+                             'libnanomsg5'])
 
 deb_depends['9'] = copy.deepcopy(deb_depends_base)
 deb_depends['9'].extend(['libboost-filesystem1.62.0',
@@ -152,7 +137,8 @@ deb_depends['9'].extend(['libboost-filesystem1.62.0',
                          'libssh-gcrypt-4',
                          'libnettle6',
                          'libx264-148',
-                         'libcurl3'])
+                         'libcurl3',
+                         'libxerces-c3.1'])
 
 deb_depends_gui['9'] = [ 'libwxgtk3.0-0v5',
                          'libxcb-xfixes0',
@@ -175,7 +161,9 @@ deb_depends['10'].extend(['libboost-filesystem1.67.0',
                           'libssh-gcrypt-4',
                           'libnettle6',
                           'libx264-155',
-                          'libcurl4'])
+                          'libcurl4',
+                          'libxerces-c3.2',
+                          'libnanomsg5'])
 
 deb_depends_gui['10'] = [ 'libwxgtk3.0-0v5',
                           'libxcb-xfixes0',
@@ -194,7 +182,32 @@ deb_depends['unstable'].extend(['libboost-filesystem1.67.0',
                                 'libicu63',
                                 'libnettle6',
                                 'libx264-155',
-                                'libcurl4'])
+                                'libcurl4',
+                                'libxerces-c3.2'])
+
+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 (including Ubuntu 16.04) 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
+    if target.platform == 'windows':
+        return True
+    if target.platform == 'osx':
+        return True
+    if target.platform == 'linux':
+        if target.distro == 'ubuntu' and target.version in ['18.04', '19.10', '20.04']:
+            return True
+        if target.distro == 'debian' and target.version == '10':
+            return True
+        if target.detail == 'appimage':
+            return True 
+        if target.distro == 'fedora' and target.version == '31':
+            return True
+        if target.distro == 'centos' and target.version == '8':
+            return True
+    return False
 
 def packages(name, packages, f):
     s = '%s: ' % name
@@ -245,6 +258,7 @@ def make_control(debian_version, bits, filename, debug, gui):
 
 def make_spec(filename, version, target, options, requires=None):
     """Make a .spec file for a RPM build"""
+    tools = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(filename))), "src/tools")
     f = open(filename, 'w')
     print('Summary:A program that generates Digital Cinema Packages (DCPs) from video and audio files', file=f)
     print('Name:dcpomatic2', file=f)
@@ -275,12 +289,18 @@ 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_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)
     print('%{_datadir}/applications/dcpomatic2_kdm.desktop', file=f)
     print('%{_datadir}/applications/dcpomatic2_player.desktop', file=f)
     print('%{_datadir}/applications/dcpomatic2_playlist.desktop', file=f)
+    print('%{_datadir}/applications/dcpomatic2_playlist.desktop', file=f)
+    if os.path.exists(os.path.join(tools, "dcpomatic2_disk")):
+        print('%{_datadir}/applications/dcpomatic2_disk.desktop', file=f)
     print('%{_datadir}/dcpomatic2/dcpomatic2_server_small.png', file=f)
     print('%{_datadir}/dcpomatic2/select.png', file=f)
     print('%{_datadir}/dcpomatic2/sequence.png', file=f)
@@ -333,7 +353,7 @@ def make_spec(filename, version, target, options, requires=None):
     print('%posttrans', file=f)
     print('/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :', file=f)
 
-def dependencies(target):
+def dependencies(target, options):
 
     if target.platform == 'linux':
         ffmpeg_options = { 'shared': False }
@@ -348,19 +368,26 @@ def dependencies(target):
         # Use distro-provided FFmpeg on Arch
         deps = []
 
-    deps.append(('libdcp', None))
-    deps.append(('libsub', None))
+    # Let's use C++11 mode if we can
+    cpp_lib_options = {'force-cpp11': True} if (
+            (target.platform == 'osx' and target.bits == 64) or
+            (target.platform == 'windows')) else {}
+
+    deps.append(('libdcp', None, cpp_lib_options))
+    deps.append(('libsub', None, cpp_lib_options))
+    deps.append(('leqm-nrt', 'carl'))
     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 can_build_disk(target):
+        deps.append(('lwext4', 'carl2'))
 
     return deps
 
-def option_defaults():
-    return { "gui": True, "variant": None }
+option_defaults = { "gui": True, "variant": None }
 
 def configure_options(target, options):
     opt = ''
@@ -385,6 +412,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'
@@ -396,6 +425,9 @@ def configure_options(target, options):
     if target.debug and target.platform == 'windows':
         opt += ' --static-dcpomatic'
 
+    if can_build_disk(target):
+       opt += ' --enable-disk'
+
     return opt
 
 def build(target, options):
@@ -650,7 +682,7 @@ def package(target, version, options):
             elif target.distro == 'centos' or target.distro == 'fedora' or target.distro == 'mageia':
                 return package_rpm(target, cpu, version, options)
     elif target.platform == 'osx' and target.bits is None:
-        target.command('bash platform/osx/make_dmg.sh %s %s universal %s %s' % (target.environment_prefix, target.directory, target.apple_id, target.apple_password))
+        target.command('bash platform/osx/make_dmg.sh %s %s universal no %s %s' % (target.environment_prefix, target.directory, target.apple_id, target.apple_password))
         return [os.path.abspath(x) for x in glob.glob('build/platform/osx/DCP-o-matic*.dmg')]
     elif target.platform == 'osx' and target.bits == 64:
         target.command('bash platform/osx/make_dmg.sh %s %s thin %s %s' % (target.environment_prefix, target.directory, target.apple_id, target.apple_password))