Fix build/package for modification to cdist.
[dcpomatic.git] / cscript
diff --git a/cscript b/cscript
index 32d8b1eee24eff99011daafe3a51663f78e0bdff..332d3b6d0bb26afb33f1ae4542a2d09478c202df 100644 (file)
--- a/cscript
+++ b/cscript
@@ -39,7 +39,7 @@ for v in ['11']:
     deb_build_depends[v] = copy.deepcopy(deb_build_depends_base)
     deb_build_depends[v].extend(['libssh-gcrypt-dev', 'python3.9'])
 deb_build_depends['unstable'] = copy.deepcopy(deb_build_depends_base)
-deb_build_depends['unstable'].extend(['python'])
+deb_build_depends['unstable'].extend(['python3'])
 
 deb_depends = dict()
 deb_depends_gui = dict()
@@ -281,7 +281,6 @@ 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)
@@ -311,7 +310,7 @@ def make_spec(filename, version, target, options, requires=None):
     print('%{_bindir}/dcpomatic2_openssl', file=f)
     print('%{_bindir}/dcpomatic2_combiner', file=f)
     print('%{_bindir}/dcpomatic2_verify', file=f)
-    if os.path.exists(os.path.join(tools, "dcpomatic2_disk")):
+    if can_build_disk(target):
         print('%{_bindir}/dcpomatic2_disk', file=f)
         print('%caps(cap_dac_override=ep) %{_bindir}/dcpomatic2_disk_writer', file=f)
     print('%{_datadir}/applications/dcpomatic2.desktop', file=f)
@@ -321,7 +320,7 @@ def make_spec(filename, version, target, options, requires=None):
     print('%{_datadir}/applications/dcpomatic2_player.desktop', file=f)
     print('%{_datadir}/applications/dcpomatic2_playlist.desktop', file=f)
     print('%{_datadir}/applications/dcpomatic2_combiner.desktop', file=f)
-    if os.path.exists(os.path.join(tools, "dcpomatic2_disk")):
+    if can_build_disk(target):
         print('%{_datadir}/applications/dcpomatic2_disk.desktop', file=f)
     print('%{_datadir}/dcpomatic2/dcpomatic2_server_small.png', file=f)
     print('%{_datadir}/dcpomatic2/select.png', file=f)
@@ -618,8 +617,8 @@ def package_debian(target, cpu, version, options):
 
     target.set('CDIST_CONFIGURE', '"' + configure_options(target, options) + '"')
     target.set('CDIST_PACKAGE', f'dcpomatic{suffix}')
-    if target.debug:
-        target.set('CDIST_DEBUG_PACKAGE_FLAG', f'--dbg-package=dcpomatic{suffix}-dbg')
+    if not target.debug:
+        target.set('CDIST_DEBUG_PACKAGE_FLAG', '--no-ddebs')
 
     target.command('dpkg-buildpackage -uc -us')
 
@@ -647,8 +646,8 @@ def package_rpm(target, cpu, version, options):
     if target.distro == 'mageia':
         requires = "lib64xmlsec1-devel lib64canberra-gtk0 libcap-utils"
 
-    make_spec('build/platform/linux/dcpomatic2.spec', version, target, options, requires)
-    cmd = 'rpmbuild --define "_topdir %s" -bb build/platform/linux/dcpomatic2.spec' % topdir
+    make_spec('dcpomatic2.spec', version, target, options, requires)
+    cmd = 'rpmbuild --define "_topdir %s" -bb dcpomatic2.spec' % topdir
     target.command(cmd)
     rpms = []
 
@@ -712,6 +711,10 @@ def make_appimage(target, nice_name, internal_name, version):
 
 def package(target, version, options):
     """version: DCP-o-matic version string"""
+    if target.platform != 'linux' or target.detail == 'appimage':
+        # In most cases we need to build ourselves before packaging, but on some Linux targets the packaging
+        # tool wants to build DCP-o-matic so we don't bother here.
+        build(target, options)
     if target.platform == 'windows':
         return package_windows(target)
     elif target.platform == 'linux':