Cleanup: missing word in comment.
[dcpomatic.git] / cscript
diff --git a/cscript b/cscript
index 45b02462e0abf2b8e3040aea7e09b42f784a349d..6f7399f55403bfcdddf7cddcee14adc56eeb9384 100644 (file)
--- a/cscript
+++ b/cscript
 #
 
 from __future__ import print_function
+import datetime
 import glob
 import shutil
 import os
 import copy
 import json
 
+def dmg_prefix(variant):
+    return 'DCP-o-matic'
+
+def debian_name(variant):
+    return 'dcpomatic'
+
 deb_build_depends = dict()
 
 deb_build_depends_base = ['debhelper', 'g++', 'pkg-config', 'libsndfile1-dev', 'libgtk2.0-dev', 'libx264-dev']
 
-for v in ['16.04', '18.04', '20.04', '20.10', '21.04', '21.10']:
+for v in ['16.04', '18.04', '20.04']:
     deb_build_depends[v] = copy.deepcopy(deb_build_depends_base)
     deb_build_depends[v].extend(['libssh-dev', 'python'])
-for v in ['22.04', '22.10']:
+for v in ['22.04']:
     deb_build_depends[v] = copy.deepcopy(deb_build_depends_base)
     deb_build_depends[v].extend(['libssh-dev', 'python3.10'])
-for v in ['23.04']:
+for v in ['23.04', '23.10']:
     deb_build_depends[v] = copy.deepcopy(deb_build_depends_base)
     deb_build_depends[v].extend(['libssh-dev', 'python3.11'])
+for v in ['24.04']:
+    deb_build_depends[v] = copy.deepcopy(deb_build_depends_base)
+    deb_build_depends[v].extend(['libssh-dev', 'python3.12'])
 for v in ['9', '10']:
     deb_build_depends[v] = copy.deepcopy(deb_build_depends_base)
     deb_build_depends[v].extend(['libssh-gcrypt-dev', 'python'])
@@ -145,8 +155,8 @@ deb_depends['22.04'].extend(['libboost-filesystem1.74.0',
                              'libnanomsg5',
                              'libdav1d5'])
 
-deb_depends['22.10'] = copy.deepcopy(deb_depends_base)
-deb_depends['22.10'].extend(['libboost-filesystem1.74.0',
+deb_depends['23.04'] = copy.deepcopy(deb_depends_base)
+deb_depends['23.04'].extend(['libboost-filesystem1.74.0',
                              'libboost-thread1.74.0',
                              'libboost-regex1.74.0',
                              'libboost-date-time1.74.0',
@@ -154,17 +164,19 @@ deb_depends['22.10'].extend(['libboost-filesystem1.74.0',
                              'libpangomm-1.4-1v5',
                              'libxml++2.6-2v5',
                              'libzip4',
-                             'libicu71',
+                             'libicu72',
                              'libnettle8',
                              'libssh-4',
                              'libx264-164',
                              'libcurl4',
                              'libpulse0',
                              'libxerces-c3.2',
-                             'libnanomsg5'])
+                             'libnanomsg5',
+                             'libwxgtk3.2-1',
+                             'libwxgtk-gl3.2-1'])
 
-deb_depends['23.04'] = copy.deepcopy(deb_depends_base)
-deb_depends['23.04'].extend(['libboost-filesystem1.74.0',
+deb_depends['23.10'] = copy.deepcopy(deb_depends_base)
+deb_depends['23.10'].extend(['libboost-filesystem1.74.0',
                              'libboost-thread1.74.0',
                              'libboost-regex1.74.0',
                              'libboost-date-time1.74.0',
@@ -183,6 +195,30 @@ deb_depends['23.04'].extend(['libboost-filesystem1.74.0',
                              'libwxgtk3.2-1',
                              'libwxgtk-gl3.2-1'])
 
+def debs(boost, icu, x264):
+    output = copy.deepcopy(deb_depends_base)
+    output.extend(['libboost-filesystem' + boost,
+                   'libboost-thread' + boost,
+                   'libboost-regex' + boost,
+                   'libboost-date-time' + boost,
+                   'libcairomm-1.0-1v5',
+                   'libpangomm-1.4-1v5',
+                   'libxml++2.6-2v5',
+                   'libzip4',
+                   'libicu' + icu,
+                   'libnettle8',
+                   'libssh-4',
+                   'libx264-' + x264,
+                   'libcurl4',
+                   'libpulse0',
+                   'libxerces-c3.2',
+                   'libnanomsg5',
+                   'libwxgtk3.2-1',
+                   'libwxgtk-gl3.2-1'])
+    return output
+
+deb_depends['24.04'] = debs(boost='1.83.0', icu='74', x264='164')
+
 deb_depends['9'] = copy.deepcopy(deb_depends_base)
 deb_depends['9'].extend(['libboost-filesystem1.62.0',
                          'libboost-thread1.62.0',
@@ -324,9 +360,9 @@ def packages(name, packages, f):
         s += str(p) + ', '
     print(s[:-2], file=f)
 
-def make_control(debian_version, bits, filename, debug, gui):
+def make_control(debian_version, bits, filename, debug, gui, name):
     f = open(filename, 'w')
-    print('Source: dcpomatic', file=f)
+    print(f'Source: {name}', file=f)
     print('Section: video', file=f)
     print('Priority: extra', file=f)
     print('Maintainer: Carl Hetherington <carl@dcpomatic.com>', file=f)
@@ -335,9 +371,9 @@ def make_control(debian_version, bits, filename, debug, gui):
     print('Homepage: https://dcpomatic.com/', file=f)
     print('', file=f)
     suffix = '' if gui else '-cli'
-    print(f'Package: dcpomatic{suffix}', file=f)
+    print(f'Package: {name}{suffix}', file=f)
     if gui:
-        print('Replaces: dcpomatic-cli', file=f)
+        print(f'Replaces: {name}-cli', file=f)
     if bits == 32:
         print('Architecture: i386', file=f)
     else:
@@ -358,7 +394,7 @@ def make_control(debian_version, bits, filename, debug, gui):
 
     if debug:
         print('', file=f)
-        print(f'Package: dcpomatic{suffix}-dbg', file=f)
+        print(f'Package: {name}{suffix}-dbg', file=f)
         if bits == 32:
             print('Architecture: i386', file=f)
         else:
@@ -366,8 +402,8 @@ def make_control(debian_version, bits, filename, debug, gui):
         print('Section: debug', file=f)
         print('Priority: extra', file=f)
         packages('Depends', pkg, f)
-        print('Description: debugging symbols for dcpomatic', file=f)
-        print('  This package contains the debugging symbols for dcpomatic.', file=f)
+        print(f'Description: debugging symbols for {name}', file=f)
+        print(f'  This package contains the debugging symbols for {name}.', file=f)
         print('', file=f)
 
 def make_spec(filename, version, target, options, requires=None):
@@ -401,7 +437,8 @@ def make_spec(filename, version, target, options, requires=None):
     print('%{_bindir}/dcpomatic2_playlist', file=f)
     print('%{_bindir}/dcpomatic2_openssl', file=f)
     print('%{_bindir}/dcpomatic2_combiner', file=f)
-    print('%{_bindir}/dcpomatic2_verify', file=f)
+    print('%{_bindir}/dcpomatic2_verify_cli', file=f)
+    print('%{_bindir}/dcpomatic2_verifier', file=f)
     print('%{_bindir}/dcpomatic2_kdm_inspect', file=f)
     print('%{_bindir}/dcpomatic2_map', file=f)
     if can_build_disk(target):
@@ -410,6 +447,7 @@ def make_spec(filename, version, target, options, requires=None):
     print('%{_datadir}/applications/dcpomatic2.desktop', file=f)
     print('%{_datadir}/applications/dcpomatic2_batch.desktop', file=f)
     print('%{_datadir}/applications/dcpomatic2_editor.desktop', file=f)
+    print('%{_datadir}/applications/dcpomatic2_verifier.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)
@@ -428,9 +466,8 @@ def make_spec(filename, version, target, options, requires=None):
     print('%{_datadir}/dcpomatic2/zoom_black.png', file=f)
     print('%{_datadir}/dcpomatic2/zoom_all_white.png', file=f)
     print('%{_datadir}/dcpomatic2/zoom_all_black.png', file=f)
-    print('%{_datadir}/dcpomatic2/tick.png', file=f)
-    print('%{_datadir}/dcpomatic2/no_tick.png', file=f)
-    print('%{_datadir}/dcpomatic2/link.png', file=f)
+    print('%{_datadir}/dcpomatic2/link_black.png', file=f)
+    print('%{_datadir}/dcpomatic2/link_white.png', file=f)
     print('%{_datadir}/dcpomatic2/me.jpg', file=f)
     print('%{_datadir}/dcpomatic2/add_black.png', file=f)
     print('%{_datadir}/dcpomatic2/add_white.png', file=f)
@@ -444,6 +481,7 @@ def make_spec(filename, version, target, options, requires=None):
         print('%%{_datadir}/icons/hicolor/%s/apps/dcpomatic2.png' % r, file=f)
         print('%%{_datadir}/icons/hicolor/%s/apps/dcpomatic2_batch.png' % r, file=f)
         print('%%{_datadir}/icons/hicolor/%s/apps/dcpomatic2_editor.png' % r, file=f)
+        print('%%{_datadir}/icons/hicolor/%s/apps/dcpomatic2_verifier.png' % r, file=f)
         print('%%{_datadir}/icons/hicolor/%s/apps/dcpomatic2_kdm.png' % r, file=f)
         print('%%{_datadir}/icons/hicolor/%s/apps/dcpomatic2_server.png' % r, file=f)
         print('%%{_datadir}/icons/hicolor/%s/apps/dcpomatic2_player.png' % r, file=f)
@@ -451,7 +489,8 @@ def make_spec(filename, version, target, options, requires=None):
         print('%%{_datadir}/icons/hicolor/%s/apps/dcpomatic2_disk.png' % r, file=f)
         print('%%{_datadir}/icons/hicolor/%s/apps/dcpomatic2_combiner.png' % r, file=f)
     for l in ['de_DE', 'es_ES', 'fr_FR', 'it_IT', 'sv_SE', 'nl_NL', 'ru_RU', 'pl_PL', 'da_DK',
-              'pt_PT', 'pt_BR', 'sk_SK', 'cs_CZ', 'uk_UA', 'zh_CN', 'tr_TR', 'sl_SI', 'hu_HU']:
+              'pt_PT', 'pt_BR', 'sk_SK', 'cs_CZ', 'uk_UA', 'zh_CN', 'tr_TR', 'sl_SI', 'hu_HU',
+              'ka_KA', 'fa_IR']:
         print('%%{_datadir}/locale/%s/LC_MESSAGES/dcpomatic2.mo' % l, file=f)
         print('%%{_datadir}/locale/%s/LC_MESSAGES/libdcpomatic2-wx.mo' % l, file=f)
         print('%%{_datadir}/locale/%s/LC_MESSAGES/libdcpomatic2.mo' % l, file=f)
@@ -477,7 +516,7 @@ def make_spec(filename, version, target, options, requires=None):
     print('/bin/cp -r %s/src/libdcp/tags %%{buildroot}/usr/share/libdcp' % target.directory, file=f)
     print('/bin/cp -r %s/src/libdcp/xsd %%{buildroot}/usr/share/libdcp' % target.directory, file=f)
     print('/bin/cp %s/src/libdcp/ratings %%{buildroot}/usr/share/libdcp' % target.directory, file=f)
-    print('/bin/mv %s/bin/dcpverify %%{buildroot}/usr/bin/dcpomatic2_verify' % target.directory, file=f)
+    print('/bin/mv %s/bin/dcpverify %%{buildroot}/usr/bin/dcpomatic2_verify_cli' % target.directory, file=f)
     print('/bin/mv %s/bin/dcpkdm %%{buildroot}/usr/bin/dcpomatic2_kdm_inspect' % target.directory, file=f)
     print('', file=f)
     print('%post', file=f)
@@ -494,30 +533,18 @@ def make_spec(filename, version, target, options, requires=None):
     print('/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :', file=f)
 
 def dependencies(target, options):
-
-    if target.platform == 'linux':
-        ffmpeg_options = { 'shared': False }
-    else:
-        ffmpeg_options = {}
-
-    if target.platform != 'linux' or target.distro != 'arch':
-        deps = [('ffmpeg', '2fb5e99b45e92880bd7953cb98c2027a34884c14', ffmpeg_options)]
-    else:
-        # Use distro-provided FFmpeg on Arch
-        deps = []
-
-    deps.append(('libdcp', 'v1.8.74'))
-    deps.append(('libsub', 'v1.6.44'))
-    deps.append(('leqm-nrt', '4560105773c66ac9216b62313a24093bb0a027ae'))
+    deps = [('libdcp', 'v1.9.7', {'c++17': target.platform == 'osx'})]
+    deps.append(('libsub', 'v1.6.47'))
+    deps.append(('leqm-nrt', '30dcaea1373ac62fba050e02ce5b0c1085797a23'))
     deps.append(('rtaudio', 'f619b76'))
     # 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', '7f29dd5'))
+    deps.append(('openssl', '54298369cacfe0ae01c5aa42ace8a463fd2e7a2e'))
     if can_build_disk(target):
         deps.append(('lwext4', 'ab082923a791b58478d1d9939d65a0583566ac1f'))
-    deps.append(('ffcmp', '15e7fdf0b3896e3f7323a950105382a9c8ae3c39'))
+    deps.append(('ffcmp', '5ab6ed3b75d8ca7cf1f66bb9fb08792b92f4b419'))
 
     return deps
 
@@ -549,7 +576,7 @@ def configure_options(target, options, for_package=False):
     if not options['gui']:
         opt += ' --disable-gui'
 
-    if options['variant'] is not None:
+    if options['variant']:
         opt += ' --variant=%s' % options['variant']
 
     # Build Windows debug versions with static linking as I think gdb works better then
@@ -559,8 +586,13 @@ def configure_options(target, options, for_package=False):
     if can_build_disk(target):
         opt += ' --enable-disk'
 
-    if target.platform == 'osx' and target.arch == 'arm64':
-        opt += ' --target-macos-arm64 --wx-config=%s/wx-config' % target.bin
+    if target.platform == 'osx':
+        opt += ' --c++17'
+        if target.arch == 'arm64':
+            opt += ' --wx-config=%s/wx-config' % target.bin
+
+    if target.platform == 'linux' and target.distro == 'ubuntu' and target.version in ['22.04']:
+        opt += ' --enable-grok'
 
     return opt
 
@@ -685,10 +717,7 @@ def build(target, options, for_package):
         target.command('./waf install')
 
 def package_windows(target):
-    identifier = ''
-    if target.version is not None:
-        identifier = '%s.' % target.version
-    identifier += '%d' % target.bits
+    identifier = '%d' % target.bits
     shutil.copyfile('build/platform/windows/installer.%s.nsi' % identifier, 'build/platform/windows/installer2.%s.nsi' % identifier)
     target.command('sed -i "s~%%resources%%~%s/platform/windows~g" build/platform/windows/installer2.%s.nsi' % (os.getcwd(), identifier))
     target.command('sed -i "s~%%graphics%%~%s/graphics~g" build/platform/windows/installer2.%s.nsi' % (os.getcwd(), identifier))
@@ -701,7 +730,8 @@ def package_windows(target):
     return os.path.abspath(glob.glob('build/platform/windows/*%s*.exe' % target.bits)[0])
 
 def package_debian(target, cpu, version, options):
-    make_control(target.version, target.bits, 'debian/control', target.debug, options['gui'])
+    name = debian_name(options['variant'])
+    make_control(target.version, target.bits, 'debian/control', target.debug, options['gui'], name)
     if target.version != '9' and target.version != '16.04' and options['gui']:
         with open('debian/postinst', 'w') as f:
             print('#!/bin/sh', file=f)
@@ -710,24 +740,30 @@ def package_debian(target, cpu, version, options):
     target.command('./waf dist')
     f = open('debian/files', 'w')
     suffix = '' if options['gui'] else '-cli'
-    print(f'dcpomatic{suffix}_{version}-1_{cpu}.deb video extra', file=f)
+    print(f'{name}{suffix}_{version}-1_{cpu}.deb video extra', file=f)
     shutil.rmtree('build/deb', ignore_errors=True)
 
     os.makedirs('build/deb')
     os.chdir('build/deb')
-    shutil.move('../../dcpomatic-%s.tar.bz2' % version, 'dcpomatic_%s.orig.tar.bz2' % version)
-    target.command('tar xjf dcpomatic_%s.orig.tar.bz2' % version)
-    os.chdir('dcpomatic-%s' % version)
-    target.set('EMAIL', 'carl@dcpomatic.com')
-    target.command('dch -b -v %s-1 "New upstream release."' % version)
+    shutil.move(f'../../dcpomatic-{version}.tar.bz2', f'{name}_1+{version}.orig.tar.bz2')
+    target.command(f'tar xjf {name}_1+{version}.orig.tar.bz2')
+    os.chdir(f'dcpomatic-{version}')
+
+    with open('debian/changelog', 'w') as f:
+        print(f'{name} (1+{version}-1) unstable; urgency=medium', file=f)
+        print('', file=f)
+        print('  * New upstream release.', file=f)
+        print('', file=f)
+        print(f" -- Carl Hetherington <carl@dcpomatic.com>  {datetime.datetime.now().astimezone().strftime('%a, %d %b %Y %H:%M:%S %z')}", file=f)
+
     target.set('CDIST_LINKFLAGS', target.get('LINKFLAGS'))
     target.set('CDIST_CXXFLAGS', target.get('CXXFLAGS'))
     target.set('CDIST_PKG_CONFIG_PATH', target.get('PKG_CONFIG_PATH'))
     target.set('CDIST_DIRECTORY', target.directory)
 
     target.set('CDIST_CONFIGURE', '"' + configure_options(target, options, for_package=True) + '"')
-    target.set('CDIST_PACKAGE', f'dcpomatic{suffix}')
-    target.set('CDIST_WX_VERSION', "3.2" if target.version == "23.04" else "3.1")
+    target.set('CDIST_PACKAGE', f'{name}{suffix}')
+    target.set('CDIST_WX_VERSION', "3.2" if target.version in ("23.04", "23.10", "24.04") else "3.1")
     if not target.debug:
         target.set('CDIST_DEBUG_PACKAGE_FLAG', '--no-ddebs')
 
@@ -759,6 +795,8 @@ def package_rpm(target, cpu, version, options):
 
     make_spec('dcpomatic2.spec', version, target, options, requires)
     cmd = 'rpmbuild --define "_topdir %s" -bb dcpomatic2.spec' % topdir
+    # On Centos 7 we build and install boost ourselves, so we must look for it in the right place
+    target.set('LINKFLAGS', '-L/usr/local/lib')
     target.command(cmd)
     rpms = []
 
@@ -778,7 +816,7 @@ def make_appimage(target, nice_name, internal_name, version, extra_binaries=None
     os.makedirs(f'{appdir}/usr/bin')
     target.command(f'cp {target.directory}/bin/{internal_name} {appdir}/usr/bin')
     target.command(f'cp {target.directory}/src/openssl/apps/openssl {appdir}/usr/bin/dcpomatic2_openssl')
-    target.command(f'cp {target.directory}/bin/dcpverify {appdir}/usr/bin/dcpomatic2_verify')
+    target.command(f'cp {target.directory}/bin/dcpverify {appdir}/usr/bin/dcpomatic2_verify_cli')
     target.command(f'cp {target.directory}/bin/dcpkdm {appdir}/usr/bin/dcpomatic2_kdm_inspect')
     if extra_binaries:
         for bin in extra_binaries:
@@ -791,8 +829,8 @@ def make_appimage(target, nice_name, internal_name, version, extra_binaries=None
     lib = 'usr/lib/x86_64-linux-gnu'
     target.command(f'mkdir -p build/{nice_filename}.AppDir/{lib}/gdk-pixbuf-2.0/2.10.0')
     target.command(f'cp -a /{lib}/gdk-pixbuf-2.0 build/{nice_filename}.AppDir/usr/lib/x86_64-linux-gnu/')
-    target.command('apt update')
-    for package in ['libc6', 'libglib2.0-0', 'gnome-settings-daemon-schemas', 'librsvg2-common', 'libgdk-pixbuf2.0-0', 'libpango-1.0-0', 'libpangoft2-1.0-0', 'libpangocairo-1.0-0']:
+    target.command('sudo apt update')
+    for package in ['libc6', 'libglib2.0-0', 'gnome-settings-daemon-schemas', 'librsvg2-common', 'libgdk-pixbuf2.0-0', 'libpango-1.0-0', 'libpangoft2-1.0-0', 'libpangocairo-1.0-0', 'libthai0']:
         target.command(f'apt download {package}')
         target.command(f'dpkg-deb -x {package}*.deb {appdir}')
     target.command(f'glib-compile-schemas {appdir}/usr/share/glib-2.0/schemas')
@@ -840,6 +878,7 @@ def package(target, version, options):
             out.append(make_appimage(target, 'DCP-o-matic Encode Server', 'dcpomatic2_server', version))
             out.append(make_appimage(target, 'DCP-o-matic Combiner', 'dcpomatic2_combiner', version))
             out.append(make_appimage(target, 'DCP-o-matic Editor', 'dcpomatic2_editor', version))
+            out.append(make_appimage(target, 'DCP-o-matic Verifier', 'dcpomatic2_verifier', version))
             return out
         else:
             if target.bits == 32:
@@ -856,8 +895,10 @@ def package(target, version, options):
         cmd = 'bash platform/osx/make_dmg.sh -e %s -r %s -i %s -p %s %s' % (target.environment_prefix, target.directory, target.apple_id, target.apple_password, archs)
         if 'part' in options:
             cmd += ' -b ' + options['part']
+        if options['variant']:
+            cmd += ' -v ' + options['variant']
         target.command(cmd)
-        return glob.glob('build/platform/osx/DCP-o-matic*.dmg')
+        return glob.glob('build/platform/osx/' + dmg_prefix(options['variant']) + '*.dmg')
     elif target.platform == 'docker':
         shutil.copyfile(target.deb, 'build/platform/docker')
         f = open('build/platform/docker/Dockerfile', 'w')
@@ -894,7 +935,11 @@ def test(target, options, test):
     if target.platform == 'windows':
         cmd = 'run\\tests '
     else:
-        cmd = 'run/tests --check --log_level=test_suite '
+        cmd = 'run/tests '
+    if target.environment_prefix:
+        cmd += '-e %s ' % target.environment_prefix
+    if target.platform != 'windows':
+        cmd += ' --check --log_level=test_suite '
     if target.debug:
         cmd += '--backtrace '
     if test is not None: