Supporters update.
[dcpomatic.git] / cscript
diff --git a/cscript b/cscript
index 32d8b1eee24eff99011daafe3a51663f78e0bdff..7bf3ce5ec74715cd554fe4322615a2672aa3f563 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)
@@ -362,7 +361,7 @@ def make_spec(filename, version, target, options, requires=None):
     print('cd dcpomatic-%s' % version, file=f)
     print('export PKG_CONFIG_PATH=%s/lib/pkgconfig:%s/lib64/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig' % (target.directory, target.directory), file=f)
     print('CXXFLAGS="-I%s/include" LDFLAGS="-L%s/lib" ./waf configure --prefix=%%{buildroot}/usr --destdir=/usr %s' %
-          (target.directory, target.directory, configure_options(target, options)), file=f)
+          (target.directory, target.directory, configure_options(target, options, for_package=True)), file=f)
     print('./waf', file=f)
     print('%install', file=f)
     print('cd dcpomatic-%s' % version, file=f)
@@ -416,12 +415,14 @@ def dependencies(target, options):
 
 option_defaults = { "gui": True, "variant": None }
 
-def configure_options(target, options):
+def configure_options(target, options, for_package=False):
     opt = ' --warnings-are-errors'
 
-    if not ((target.platform == 'linux' and target.distro == 'ubuntu' and target.version == '18.04') or
+    if for_package or not (
+            (target.platform == 'linux' and target.distro == 'ubuntu' and target.version == '18.04') or
             (target.platform == 'osx') or
-            (target.platform == 'windows')):
+            (target.platform == 'windows')
+        ):
         # Currently we only build tests on Ubuntu 18.04, macOS and Windows
         opt += ' --disable-tests'
 
@@ -455,7 +456,7 @@ def configure_options(target, options):
 
     return opt
 
-def build(target, options):
+def build(target, options, for_package):
     if target.platform == 'flatpak':
         target.checkout_dependencies()
         prefix = 'https://dcpomatic.com/deps'
@@ -570,8 +571,8 @@ def build(target, options):
         with open('build/com.dcpomatic.DCP-o-matic.json', 'w') as outfile:
             json.dump(desc, outfile)
         target.command('%s --repo=build/platform/repo build/platform/flatpak build/com.dcpomatic.DCP-o-matic.json' % target.flatpak_builder())
-    else:
-        target.command('./waf configure --prefix=%s %s' % (target.directory, configure_options(target, options)))
+    elif target.platform != 'linux' or target.detail == 'appimage' or not for_package:
+        target.command('./waf configure --prefix=%s %s' % (target.directory, configure_options(target, options, for_package)))
         target.command('./waf')
         target.command('./waf install')
 
@@ -616,10 +617,10 @@ def package_debian(target, cpu, version, options):
     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) + '"')
+    target.set('CDIST_CONFIGURE', '"' + configure_options(target, options, for_package=True) + '"')
     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 +648,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 = []